/* ============================================
   ライブトリセツ 2026 — Neo-Glass
   ============================================ */

/* --- Animated custom properties --- */
@property --aurora-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

@property --glow-opacity {
  syntax: '<number>';
  initial-value: 0;
  inherits: false;
}

@property --border-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

/* --- Custom properties --- */
:root {
  --bg: #08080c;
  --bg-surface: rgba(255, 255, 255, 0.04);
  --bg-glass: rgba(255, 255, 255, 0.07);
  --bg-glass-hover: rgba(255, 255, 255, 0.12);
  --bg-glass-active: rgba(255, 255, 255, 0.15);

  --border: rgba(255, 255, 255, 0.10);
  --border-hover: rgba(255, 255, 255, 0.18);
  --border-active: rgba(255, 255, 255, 0.25);

  --text: #ededf0;
  --text-dim: #7c7c96;
  --text-sub: #a0a0b8;

  --accent: #a78bfa;
  --accent-2: #818cf8;
  --accent-3: #6366f1;
  --accent-glow: rgba(167, 139, 250, 0.25);
  --accent-glow-strong: rgba(167, 139, 250, 0.5);

  --gradient: linear-gradient(135deg, var(--accent), var(--accent-2), var(--accent-3));

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;

  --header-h: 52px;
  --tab-h: 48px;
  --top-offset: calc(var(--header-h) + var(--tab-h));

  --font: 'Zen Kaku Gothic New', sans-serif;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- Reset --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  font-weight: 300;
  font-size: 15px;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
}

strong {
  font-weight: 700;
}

img {
  max-width: 100%;
  height: auto;
}

/* --- Aurora background (STRONGER) --- */
.aurora-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.aurora-layer {
  position: absolute;
  width: 140vmax;
  height: 140vmax;
  border-radius: 50%;
  filter: blur(100px);
  will-change: transform;
}

.aurora-1 {
  top: -60%;
  left: -30%;
  background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
  animation: aurora-drift-1 25s ease-in-out infinite alternate;
  opacity: 0.3;
}

.aurora-2 {
  bottom: -50%;
  right: -20%;
  background: radial-gradient(circle, var(--accent-2) 0%, transparent 70%);
  animation: aurora-drift-2 30s ease-in-out infinite alternate;
  opacity: 0.25;
}

.aurora-3 {
  top: 20%;
  left: 40%;
  width: 80vmax;
  height: 80vmax;
  background: radial-gradient(circle, var(--accent-3) 0%, transparent 70%);
  animation: aurora-drift-3 20s ease-in-out infinite alternate;
  opacity: 0.15;
}

@keyframes aurora-drift-1 {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(15%, 10%) scale(1.1); }
}

@keyframes aurora-drift-2 {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-10%, -15%) scale(1.15); }
}

@keyframes aurora-drift-3 {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-20%, 20%) scale(0.9); }
}

/* --- Scroll progress --- */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--gradient);
  transform-origin: left;
  transform: scaleX(0);
  z-index: 1000;
  pointer-events: none;
}

/* --- Site header (ALWAYS VISIBLE) --- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  z-index: 100;
  background: rgba(8, 8, 12, 0.8);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 16px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.header-logo {
  font-weight: 900;
  font-size: 17px;
  letter-spacing: 0.12em;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-divider {
  width: 1px;
  height: 16px;
  background: var(--border-hover);
}

.header-subtitle {
  font-weight: 400;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
}

/* --- Header search --- */
.header-search {
  display: flex;
  align-items: center;
  margin-left: auto;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.header-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(167, 139, 250, 0.15);
}

.search-icon-inline {
  flex-shrink: 0;
  color: var(--text-dim);
  transition: color 0.2s var(--ease);
}

.header-search:focus-within .search-icon-inline {
  color: var(--accent);
}

.search-input {
  width: min(140px, 35vw);
  padding: 4px 0;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  outline: none;
  -webkit-appearance: none;
}

.search-input::placeholder {
  color: var(--text-dim);
  font-size: 14px;
}

/* Search: badge on tabs */
.tab-btn .search-badge {
  display: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow-strong);
  position: absolute;
  top: 8px;
  right: 6px;
}

.tab-btn.has-results .search-badge {
  display: block;
}

/* Search: highlight */
.search-highlight {
  background: rgba(167, 139, 250, 0.35);
  border-radius: 2px;
  padding: 0 2px;
  color: #fff;
}

/* Search: dim non-matching */
.accordion.search-hidden {
  opacity: 0.2;
  pointer-events: none;
  transition: opacity 0.3s var(--ease);
}

.accordion.search-match {
  border-color: var(--accent) !important;
  box-shadow: 0 0 12px rgba(167, 139, 250, 0.15);
}

/* --- Tab bar --- */
.tab-bar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  height: var(--tab-h);
  z-index: 99;
  background: rgba(8, 8, 12, 0.75);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border-bottom: 1px solid var(--border);
}

.tab-bar-inner {
  display: flex;
  gap: 2px;
  height: 100%;
  padding: 0 12px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}

.tab-bar-inner::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  flex: 0 0 auto;
  scroll-snap-align: center;
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 14px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.25s var(--ease), text-shadow 0.25s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.tab-btn::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--gradient);
  border-radius: 2px 2px 0 0;
  transform: translateX(-50%);
  transition: width 0.3s var(--ease-spring);
}

.tab-btn.active {
  color: var(--text);
  text-shadow: 0 0 16px var(--accent-glow-strong);
}

.tab-btn.active::after {
  width: calc(100% - 16px);
}

.tab-btn:active {
  transform: scale(0.96);
}

/* --- Main --- */
.main {
  position: relative;
  z-index: 1;
  padding-top: var(--top-offset);
  min-height: 100vh;
  min-height: 100dvh;
}

/* --- Hero --- */
.hero {
  text-align: center;
  padding: 48px 24px 0;
}

.hero-title {
  font-size: clamp(28px, 7vw, 48px);
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1.2;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 30px rgba(167, 139, 250, 0.3));
  opacity: 0;
  transform: translateY(20px);
  animation: hero-in 0.8s 0.2s var(--ease) forwards;
}

.hero-tag {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(12px);
  animation: hero-in 0.8s 0.4s var(--ease) forwards;
}

@keyframes hero-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Marquee (電光掲示板) --- */
.marquee-wrapper {
  margin: 28px -24px 32px;
  overflow: hidden;
  padding: 16px 0;
  background: rgba(0, 0, 0, 0.6);
  border-top: 1px solid rgba(167, 139, 250, 0.3);
  border-bottom: 1px solid rgba(167, 139, 250, 0.3);
  position: relative;
  opacity: 0;
  animation: hero-in 0.8s 0.6s var(--ease) forwards;
}

.marquee-wrapper::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(167, 139, 250, 0.04) 1px, transparent 1px);
  background-size: 4px 4px;
  pointer-events: none;
}

.marquee-track {
  display: flex;
  gap: 100px;
  width: max-content;
  animation: marquee-scroll 22s linear infinite;
  position: relative;
  z-index: 1;
}

.marquee-text {
  flex-shrink: 0;
  font-family: 'DotGothic16', monospace;
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0.12em;
  color: var(--accent);
  white-space: nowrap;
  text-shadow: 0 0 8px rgba(167, 139, 250, 0.6), 0 0 20px rgba(167, 139, 250, 0.3);
}

@keyframes marquee-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(calc(-50% - 50px)); }
}

/* --- Tab panels --- */
.tab-panel {
  display: none;
  padding: 24px 16px 80px;
  max-width: 720px;
  margin: 0 auto;
}

.tab-panel.active {
  display: block;
  animation: panel-in 0.4s var(--ease) both;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* --- Section heading --- */
.section-heading {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 20px;
  padding-left: 4px;
  position: relative;
}

.section-heading::before {
  content: '';
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 48px;
  height: 3px;
  background: var(--gradient);
  border-radius: 3px;
}

/* --- Principles grid --- */
.principles-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.principle-card {
  position: relative;
  padding: 24px 20px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overflow: hidden;
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.principle-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(from var(--border-angle), transparent 40%, var(--accent) 65%, var(--accent-2) 80%, transparent 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.4;
  animation: border-rotate 6s linear infinite;
  transition: opacity 0.5s var(--ease);
  pointer-events: none;
}

.principle-card:hover::before,
.principle-card:focus-within::before {
  opacity: 1;
}

.principle-card:hover {
  box-shadow: 0 0 24px rgba(167, 139, 250, 0.12);
}

@keyframes border-rotate {
  to { --border-angle: 360deg; }
}

.principle-num {
  font-size: 36px;
  font-weight: 900;
  letter-spacing: -0.02em;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: 8px;
}

.principle-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
}

.principle-body {
  font-size: 14px;
  line-height: 1.85;
  color: var(--text-sub);
}

.accent-text {
  display: inline;
  color: var(--accent);
  font-weight: 500;
}

/* --- Accordion --- */
.accordion-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.accordion {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease), box-shadow 0.25s var(--ease), opacity 0.3s var(--ease);
}

.accordion:hover {
  border-color: var(--border-hover);
  background: var(--bg-glass-hover);
}

.accordion[open] {
  border-color: var(--accent);
  background: var(--bg-glass-active);
  box-shadow: 0 0 16px rgba(167, 139, 250, 0.1);
}

.accordion-q {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.6;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  -webkit-tap-highlight-color: transparent;
  transition: padding 0.3s var(--ease);
}

.accordion-q::-webkit-details-marker {
  display: none;
}

.accordion-q::after {
  content: '+';
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin-left: auto;
  font-size: 18px;
  font-weight: 300;
  color: var(--text-dim);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  transition: transform 0.35s var(--ease-spring), color 0.25s var(--ease), background 0.25s var(--ease);
}

.accordion[open] > .accordion-q::after {
  content: '+';
  transform: rotate(45deg);
  color: var(--accent);
  background: var(--accent-glow);
  box-shadow: 0 0 10px var(--accent-glow);
}

.accordion-a {
  padding: 0 18px 18px;
  font-size: 14px;
  line-height: 1.85;
  color: var(--text-sub);
  animation: accordion-open 0.3s var(--ease) both;
}

.accordion-a p {
  margin-bottom: 10px;
}

.accordion-a p:last-child {
  margin-bottom: 0;
}

.accordion-a ul {
  margin: 8px 0;
  padding-left: 20px;
}

.accordion-a li {
  margin-bottom: 4px;
}

@keyframes accordion-open {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Scroll-driven reveal for accordion items */
.accordion {
  animation: reveal-up linear both;
  animation-timeline: view();
  animation-range: entry 0% entry 25%;
}

@keyframes reveal-up {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* --- Placeholder note --- */
.placeholder-note {
  padding: 16px;
  background: rgba(167, 139, 250, 0.08);
  border: 1px dashed rgba(167, 139, 250, 0.25);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--accent);
  text-align: center;
}

/* --- Conclusion --- */
.conclusion-block {
  margin-top: 48px;
  padding: 40px 24px;
  text-align: center;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.conclusion-block .section-heading {
  text-align: center;
}

.conclusion-block .section-heading::before {
  left: 50%;
  transform: translateX(-50%);
}

.conclusion-text {
  margin: 16px 0 0;
  font-size: 16px;
  font-weight: 500;
  line-height: 2;
  color: var(--text);
}

/* --- Conclusion actions --- */
.conclusion-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
}

.btn-return {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  background: var(--bg-glass);
  border: 1px solid var(--border-hover);
  border-radius: 999px;
  text-decoration: none;
  transition: all 0.3s var(--ease);
}

.btn-return:hover {
  background: var(--bg-glass-hover);
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
}

.btn-return-arrow {
  font-size: 18px;
  transition: transform 0.3s var(--ease);
}

.btn-return:hover .btn-return-arrow {
  transform: translateX(-3px);
}

.btn-share {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.3s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.btn-share:hover {
  background: rgba(167, 139, 250, 0.12);
  box-shadow: 0 0 20px var(--accent-glow);
}

.btn-share:active {
  transform: scale(0.97);
}

.share-icon {
  flex-shrink: 0;
}

/* --- Toast notification --- */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 12px 24px;
  background: rgba(167, 139, 250, 0.9);
  color: #fff;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  border-radius: 999px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* --- Footer --- */
.site-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 24px 16px;
  font-size: 11px;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .aurora-bg {
    display: none;
  }

  .scroll-progress {
    display: none;
  }

  .hero-title,
  .hero-tag,
  .marquee-wrapper {
    opacity: 1;
    transform: none;
  }

  /* マーキーは電光掲示板の主要演出なので例外的に動かす（速度は落とす） */
  .marquee-track {
    animation: marquee-scroll 40s linear infinite !important;
  }
}

/* --- Desktop (bonus, not primary) --- */
@media (min-width: 768px) {
  body {
    font-size: 16px;
  }

  .header-inner {
    padding: 0 32px;
  }

  .tab-bar-inner {
    justify-content: center;
    padding: 0 24px;
  }

  .tab-btn {
    padding: 0 20px;
    font-size: 14px;
  }

  .hero {
    padding: 64px 32px 0;
  }

  .hero-title {
    font-size: 48px;
  }

  .marquee-wrapper {
    margin-left: -32px;
    margin-right: -32px;
  }

  .tab-panel {
    padding: 32px 24px 100px;
  }

  .principles-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }

  .section-heading {
    font-size: 24px;
  }

  .accordion-q {
    font-size: 15px;
  }

  .accordion-a {
    font-size: 15px;
  }

  .search-input {
    width: 200px;
  }
}

/* --- Very small screens --- */
@media (max-width: 374px) {
  .tab-btn {
    padding: 0 10px;
    font-size: 12px;
  }

  .hero {
    padding: 36px 16px 0;
  }

  .marquee-wrapper {
    margin-left: -16px;
    margin-right: -16px;
  }

  .tab-panel {
    padding: 20px 12px 60px;
  }

  .search-input {
    width: 100px;
  }
}
