@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500;600;700;800&family=Source+Serif+4:opsz,wght@8..60,400;8..60,600&display=swap');

:root {
  --ink: #12151c;
  --ink-soft: #2a3140;
  --paper: #f7f4ef;
  --sand: #d6c4a8;
  --sand-deep: #a8906e;
  --signal: #c1121f;
  --signal-deep: #8a0c16;
  --muted: #6b7280;
  --rule: #ddd5c8;
  --panel: #ebe4d8;
  --hero-void: #0c0e13;
  --chat-w: min(380px, calc(100vw - 32px));
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  font-family: 'Source Serif 4', Georgia, serif;
  color: var(--ink);
  line-height: 1.65;
  overflow-x: hidden;
}

h1, h2, h3, .brand, .kicker, .caption, .nav, .spec-label, .btn, .chat-title {
  font-family: 'Barlow Condensed', 'Arial Narrow', sans-serif;
}

a { color: inherit; text-decoration: none; }

img { max-width: 100%; display: block; }

/* ---------- NAV ---------- */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.75rem;
  background: linear-gradient(180deg, rgba(12,14,19,0.72) 0%, transparent 100%);
  transition: background 0.35s ease, backdrop-filter 0.35s ease;
}

.site-nav.scrolled {
  background: rgba(247, 244, 239, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rule);
}

.site-nav.scrolled .nav-brand,
.site-nav.scrolled .nav-links a {
  color: var(--ink);
}

.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: #fff;
  text-transform: uppercase;
}

.nav-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  mix-blend-mode: screen;
  flex-shrink: 0;
}

.site-nav.scrolled .nav-logo {
  mix-blend-mode: multiply;
}

.nav-wordmark {
  color: inherit;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sand);
  transition: color 0.2s;
}

.nav-links a:hover { color: #fff; }
.site-nav.scrolled .nav-links a:hover { color: var(--signal); }

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(214, 196, 168, 0.35);
  background: transparent;
  cursor: pointer;
  place-items: center;
  gap: 5px;
  flex-direction: column;
  z-index: 45;
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--sand);
  transition: transform 0.25s, opacity 0.25s, background 0.25s;
}

.site-nav.scrolled .nav-toggle {
  border-color: var(--rule);
}

.site-nav.scrolled .nav-toggle span {
  background: var(--ink);
}

.site-nav.menu-open .nav-toggle span:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
}

.site-nav.menu-open .nav-toggle span:nth-child(2) {
  opacity: 0;
}

.site-nav.menu-open .nav-toggle span:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
}

@media (max-width: 900px) {
  .nav-toggle {
    display: grid;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    padding: 0.5rem 0 1rem;
    background: rgba(247, 244, 239, 0.97);
    border-bottom: 1px solid var(--rule);
    backdrop-filter: blur(14px);
  }

  .site-nav.menu-open .nav-links {
    display: flex;
  }

  .nav-links a {
    display: block;
    padding: 0.85rem 1.5rem;
    color: var(--ink);
    border-top: 1px solid var(--rule);
  }

  .nav-links a:hover {
    color: var(--signal);
  }

  .site-nav:not(.scrolled) .nav-links {
    background: rgba(12, 14, 19, 0.96);
    border-bottom-color: rgba(214, 196, 168, 0.2);
  }

  .site-nav:not(.scrolled) .nav-links a {
    color: var(--sand);
    border-top-color: rgba(214, 196, 168, 0.15);
  }

  .site-nav:not(.scrolled) .nav-links a:hover {
    color: #fff;
  }
}

/* ---------- HERO ---------- */
.hero {
  position: relative;
  min-height: 100lvh;
  background: var(--hero-void);
  color: #f5f0e8;
  overflow: hidden;
  display: grid;
  grid-template-rows: 1fr auto;
}

.hero-stage {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-stage model-viewer {
  width: 100%;
  height: 100%;
  --poster-color: transparent;
  background: transparent;
  pointer-events: none;
}

.hero-stage.is-orbiting model-viewer {
  pointer-events: auto;
}

.hero-orbit-gate {
  position: absolute;
  inset: 0;
  z-index: 1;
  touch-action: pan-y;
  cursor: grab;
  background: transparent;
}

.hero-stage.is-orbiting .hero-orbit-gate {
  display: none;
}

.hero-scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(10,12,16,0.55) 0%, rgba(10,12,16,0.12) 38%, rgba(10,12,16,0.78) 72%, rgba(10,12,16,0.96) 100%),
    linear-gradient(90deg, rgba(10,12,16,0.62) 0%, transparent 55%);
}

.hero-content {
  position: relative;
  z-index: 2;
  align-self: end;
  padding: 0 clamp(1.25rem, 4vw, 3.5rem) clamp(2.5rem, 6vw, 4.5rem);
  max-width: 720px;
  pointer-events: none;
}

.hero-content .btn,
.hero-content a {
  pointer-events: auto;
}

.hero-badge {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--sand);
  border-left: 3px solid var(--signal);
  padding-left: 0.85rem;
  margin-bottom: 1.5rem;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: clamp(0.85rem, 2.5vw, 1.5rem);
  margin: 0 0 1rem;
}

.brand-logo {
  width: clamp(4.5rem, 12vw, 7rem);
  height: clamp(4.5rem, 12vw, 7rem);
  object-fit: contain;
  mix-blend-mode: screen;
  flex-shrink: 0;
}

.hero .brand {
  font-size: clamp(3.5rem, 12vw, 6.5rem);
  font-weight: 800;
  letter-spacing: 0.14em;
  line-height: 0.9;
  margin: 0;
  color: #fff;
  text-transform: uppercase;
}

.hero .brand::after {
  content: '';
  display: block;
  width: 4.5rem;
  height: 3.5px;
  background: var(--signal);
  margin-top: 1.1rem;
}

.hero .subtitle {
  font-size: clamp(1rem, 2.2vw, 1.25rem);
  font-weight: 400;
  color: #d9d1c3;
  max-width: 34rem;
  margin: 0 0 1.75rem;
  line-height: 1.4;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--sand);
}

.hero-hint {
  position: absolute;
  right: clamp(1rem, 3vw, 2rem);
  bottom: clamp(1.5rem, 4vw, 3rem);
  z-index: 2;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(214, 196, 168, 0.7);
  pointer-events: none;
}

@media (max-width: 640px) {
  .hero-hint { display: none; }
}

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.75rem 1.35rem;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border: none;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}

.btn-signal {
  background: var(--signal);
  color: #fff;
}

.btn-signal:hover {
  background: var(--signal-deep);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: #f5f0e8;
  border: 1px solid rgba(214, 196, 168, 0.45);
}

.btn-ghost:hover {
  border-color: var(--sand);
  color: #fff;
}

/* ---------- SECTIONS ---------- */
.section {
  padding: clamp(3.5rem, 8vw, 6rem) clamp(1.25rem, 4vw, 3.5rem);
  max-width: 1100px;
  margin: 0 auto;
}

.section.alt {
  background: var(--panel);
  max-width: none;
  padding-left: 0;
  padding-right: 0;
}

.section.alt .section-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 3.5rem);
}

.kicker {
  font-size: 0.8rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--signal);
  margin: 0 0 0.6rem;
  font-weight: 700;
}

.chapter-title {
  font-size: clamp(1.85rem, 4vw, 2.6rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0 0 1.25rem;
  line-height: 1.05;
  border-bottom: 1.5px solid var(--rule);
  padding-bottom: 0.9rem;
}

.section-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 1.75rem 0 0.75rem;
}

.lede {
  font-size: 1.05rem;
  color: var(--ink-soft);
  border-left: 3px solid var(--signal);
  padding-left: 1rem;
  margin: 0 0 1.25rem;
}

p {
  font-size: 1.02rem;
  margin: 0 0 1rem;
}

strong { color: var(--ink); font-weight: 600; }

ul {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
}

li { margin-bottom: 0.5rem; }

.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

/* Spec strip */
.spec-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin: 1.5rem 0 2rem;
  background: var(--ink);
  color: #f3eee6;
  padding: 1.1rem;
}

@media (max-width: 640px) {
  .spec-row { grid-template-columns: repeat(2, 1fr); }
}

.spec-label {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--sand);
  margin-bottom: 0.25rem;
}

.spec-value {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* Figures */
.figure {
  margin: 1.5rem 0 1.25rem;
}

.figure img {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  object-position: center;
  background: #0f1218;
}

.figure.contain img {
  object-fit: contain;
  background: #1a1f28;
  max-height: 380px;
}

.caption {
  margin-top: 0.65rem;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.caption em {
  font-style: normal;
  color: var(--signal);
  margin-right: 0.4rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin: 1.5rem 0;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  margin: 1.5rem 0;
}

.grid-2 .figure,
.grid-3 .figure { margin: 0; }

.grid-2 .figure img { max-height: 280px; }
.grid-3 .figure img { max-height: 200px; }

@media (max-width: 720px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

.split {
  display: grid;
  grid-template-columns: 1fr 1.05fr;
  gap: 1.75rem;
  align-items: start;
  margin: 1.25rem 0;
}

.split .figure { margin: 0; }
.split .figure img { max-height: 360px; }

@media (max-width: 800px) {
  .split { grid-template-columns: 1fr; }
}

.callout {
  background: var(--panel);
  padding: 1.1rem 1.25rem;
  margin: 1.25rem 0;
  border-top: 2px solid var(--signal);
}

.section.alt .callout {
  background: var(--paper);
}

.callout p { margin-bottom: 0; font-size: 0.98rem; }

/* Closing */
.closing {
  background:
    linear-gradient(160deg, #161a22 0%, #0c0e13 55%, #1a120f 100%);
  color: #f3eee6;
  padding: clamp(3.5rem, 8vw, 5.5rem) clamp(1.25rem, 4vw, 3.5rem);
}

.closing-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.closing .kicker { color: var(--sand); }

.closing h2 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 1rem;
  line-height: 1.05;
  color: #fff;
}

.closing .rule {
  width: 3.5rem;
  height: 3px;
  background: var(--signal);
  margin-bottom: 1.5rem;
}

.closing p {
  color: #cfc6b8;
  font-size: 1.1rem;
  max-width: 38rem;
}

.closing-image {
  width: 100%;
  height: min(380px, 45vw);
  object-fit: cover;
  margin: 2rem 0;
  border-top: 2px solid var(--signal);
  border-bottom: 2px solid var(--signal);
}

.closing-foot {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--sand);
}

.site-footer {
  background: var(--ink);
  color: var(--muted);
  padding: 1.25rem clamp(1.25rem, 4vw, 3.5rem);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.footer-meta {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.lyrics-bar {
  position: fixed;
  left: calc(1.25rem + 58px + 0.75rem);
  right: calc(1.25rem + 58px + 0.75rem);
  bottom: 1.35rem;
  z-index: 55;
  min-height: 2.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.45rem 0.65rem;
  background: transparent;
  border: none;
  color: var(--ink-soft);
  font-family: 'Barlow Condensed', sans-serif;
  font-size: clamp(0.9rem, 2.5vw, 1.15rem);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1.35;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.lyrics-bar[hidden] {
  display: none !important;
}

.lyrics-bar.is-on {
  opacity: 1;
}

.lyrics-bar .lyric-thar {
  color: var(--signal);
}

/* ---------- DEVELOPER PAGE ---------- */
.dev-page {
  background: var(--paper);
}

.dev-page .site-nav {
  position: sticky;
  top: 0;
}

.dev-main {
  max-width: 820px;
  margin: 0 auto;
  padding: 5.5rem clamp(1.25rem, 4vw, 3rem) 4rem;
}

.dev-intro {
  margin-bottom: 2rem;
}

.dev-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.65rem;
  align-items: center;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 1rem 0 0;
}

.dev-contact a {
  color: var(--ink);
  border-bottom: 1px solid var(--rule);
  transition: color 0.15s, border-color 0.15s;
}

.dev-contact a:hover {
  color: var(--signal);
  border-bottom-color: var(--signal);
}

.dev-list {
  display: flex;
  flex-direction: column;
  margin: 0.35rem 0 2rem;
  border-top: 1px solid var(--rule);
}

.dev-link {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 0;
  border-bottom: 1px solid var(--rule);
  font-family: 'Barlow Condensed', sans-serif;
  transition: color 0.15s, border-color 0.15s;
}

.dev-link:hover {
  color: var(--signal);
  border-bottom-color: var(--sand-deep);
}

.dev-link-name {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dev-link-meta {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.dev-link:hover .dev-link-meta {
  color: var(--sand-deep);
}

.dev-page .nav-links a[aria-current="page"] {
  color: var(--signal);
}

@media (max-width: 520px) {
  .lyrics-bar {
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    bottom: 1.2rem;
    padding: 0.35rem 0.4rem;
  }
}

/* ---------- AUDIO FAB ---------- */
.audio-fab {
  position: fixed;
  left: max(1rem, env(safe-area-inset-left));
  right: auto;
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 60;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid rgba(214, 196, 168, 0.2);
  background: var(--ink);
  color: #f3eee6;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(18, 21, 28, 0.4);
  display: grid;
  place-items: center;
  transition: transform 0.2s, background 0.2s, color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.audio-fab:hover {
  transform: scale(1.05);
  background: #1c212b;
}

.audio-fab svg {
  width: 22px;
  height: 22px;
}

.audio-fab .icon-sound-on { display: block; }
.audio-fab .icon-sound-off { display: none; }
.audio-fab.is-muted .icon-sound-on { display: none; }
.audio-fab.is-muted .icon-sound-off { display: block; }
.audio-fab:not(.is-muted) {
  background: var(--signal);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 28px rgba(193, 18, 31, 0.45);
}

/* ---------- CHAT ---------- */
.chat-fab {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 60;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--signal);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(193, 18, 31, 0.4);
  display: grid;
  place-items: center;
  transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.chat-fab:hover {
  background: var(--signal-deep);
  transform: scale(1.05);
  box-shadow: 0 12px 34px rgba(138, 12, 22, 0.45);
}

.chat-fab:focus-visible {
  outline: 2px solid var(--sand);
  outline-offset: 3px;
}

.chat-fab svg {
  width: 24px;
  height: 24px;
}

.chat-fab .icon-close { display: none; }
.chat-fab[aria-expanded="true"] .icon-chat { display: none; }
.chat-fab[aria-expanded="true"] .icon-close { display: block; }

.chat-panel {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: calc(max(1rem, env(safe-area-inset-bottom)) + 68px);
  z-index: 59;
  width: var(--chat-w);
  height: min(520px, calc(100dvh - 110px - env(safe-area-inset-bottom)));
  max-height: calc(100dvh - 96px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  background: var(--paper);
  border: 1px solid var(--rule);
  box-shadow: 0 18px 50px rgba(18, 21, 28, 0.28);
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.96);
  transform-origin: bottom right;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
  overflow: hidden;
}

.chat-panel.open {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  background: var(--ink);
  color: #f3eee6;
}

.chat-modes {
  display: flex;
  gap: 0.25rem;
  background: rgba(255,255,255,0.06);
  padding: 0.2rem;
  flex-shrink: 0;
}

.chat-mode {
  border: none;
  background: transparent;
  color: var(--sand);
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.4rem 0.65rem;
  cursor: pointer;
}

.chat-mode.active {
  background: var(--signal);
  color: #fff;
}

.chat-tutorial {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.85rem;
  padding: 1.5rem 1.25rem;
  background: rgba(12, 14, 19, 0.92);
  color: #f3eee6;
  font-family: 'Barlow Condensed', sans-serif;
  letter-spacing: 0.04em;
  animation: chatTutIn 0.25s ease;
}

.chat-tutorial[hidden] {
  display: none !important;
}

.chat-tutorial p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.45;
  color: #d9d1c3;
}

.chat-tutorial strong {
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-right: 0.35rem;
}

.chat-tutorial-btn {
  align-self: flex-start;
  margin-top: 0.5rem;
  border: none;
  background: var(--signal);
  color: #fff;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.65rem 1.15rem;
  cursor: pointer;
}

.chat-tutorial-btn:hover {
  background: var(--signal-deep);
}

.chat-tutorial.is-out {
  animation: chatTutOut 0.35s ease forwards;
}

@keyframes chatTutIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes chatTutOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

.chat-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.chat-subtitle {
  margin: 0.15rem 0 0;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sand);
  font-family: 'Barlow Condensed', sans-serif;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: #f3efe8;
}

.chat-bubble {
  max-width: 88%;
  padding: 0.7rem 0.85rem;
  font-size: 0.92rem;
  line-height: 1.55;
}

.chat-bubble.user,
.chat-bubble.system {
  white-space: pre-wrap;
}

.chat-bubble.bot p {
  margin: 0 0 0.55rem;
}

.chat-bubble.bot p:last-child {
  margin-bottom: 0;
}

.chat-bubble.bot ul {
  margin: 0.15rem 0 0.55rem;
  padding-left: 1.15rem;
}

.chat-bubble.bot li {
  margin-bottom: 0.3rem;
}

.chat-bubble.bot strong {
  color: var(--ink);
  font-weight: 700;
}

.chat-bubble.bot {
  align-self: flex-start;
  background: var(--panel);
  border-left: 3px solid var(--signal);
  color: var(--ink);
}

.chat-bubble.user {
  align-self: flex-end;
  background: var(--ink);
  color: #f3eee6;
}

.chat-bubble.system {
  align-self: center;
  max-width: 95%;
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
  font-family: 'Barlow Condensed', sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.chat-typing {
  align-self: flex-start;
  padding: 0.5rem 0.85rem;
  color: var(--muted);
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.chat-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid var(--rule);
  background: var(--paper);
}

.chat-form input {
  flex: 1;
  border: 1px solid var(--rule);
  background: #fff;
  padding: 0.7rem 0.85rem;
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 0.95rem;
  color: var(--ink);
  outline: none;
}

.chat-form input:focus {
  border-color: var(--sand-deep);
}

.chat-form button {
  border: none;
  background: var(--signal);
  color: #fff;
  padding: 0 1rem;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}

.chat-form button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-form button:not(:disabled):hover {
  background: var(--signal-deep);
}

/* ---------- DOWNLOAD ---------- */
.dl-priority {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 148px));
  gap: 1rem;
  margin: 1.25rem 0 2.25rem;
}

.dl-square {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 1rem;
  background: var(--signal);
  color: #fff;
  text-align: center;
  font-family: 'Barlow Condensed', sans-serif;
  transition: background 0.2s, transform 0.2s;
}

.dl-square:hover {
  background: var(--signal-deep);
  transform: translateY(-2px);
  color: #fff;
}

.dl-square-label {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.15;
}

.dl-square-meta {
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.85;
}

.dl-list {
  display: flex;
  flex-direction: column;
  margin: 0.5rem 0 1.75rem;
  border-top: 1px solid var(--rule);
}

.dl-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 0;
  border-bottom: 1px solid var(--rule);
  font-family: 'Barlow Condensed', sans-serif;
  transition: color 0.15s, border-color 0.15s;
}

.dl-item:hover {
  color: var(--signal);
  border-bottom-color: var(--sand-deep);
}

.dl-name {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dl-meta {
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.dl-item:hover .dl-meta { color: var(--sand-deep); }

.dl-preview {
  margin: 0 0 2rem;
}

.dl-preview video {
  width: 100%;
  max-height: 420px;
  background: #0f1218;
  display: block;
}

.dl-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.85rem;
  margin: 0.75rem 0 2rem;
}

.dl-thumb {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.15s;
}

.dl-thumb img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #151920;
}

.dl-thumb:hover { color: var(--signal); }

/* ---------- RESPONSIVE: phone / tablet / desktop ---------- */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.site-nav {
  padding-top: max(0.85rem, env(safe-area-inset-top));
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
}

.lyrics-bar {
  left: calc(max(1rem, env(safe-area-inset-left)) + 56px + 0.55rem);
  right: calc(max(1rem, env(safe-area-inset-right)) + 56px + 0.55rem);
  bottom: max(1.1rem, env(safe-area-inset-bottom));
}

@media (max-width: 1024px) {
  .section,
  .section.alt .section-inner,
  .closing-inner {
    padding-left: clamp(1rem, 3vw, 2rem);
    padding-right: clamp(1rem, 3vw, 2rem);
  }

  .hero-content {
    padding-bottom: clamp(5.5rem, 12vw, 7rem);
  }

  .hero-hint {
    bottom: 5.5rem;
    font-size: 0.68rem;
  }
}

@media (max-width: 768px) {
  :root {
    --chat-w: min(100vw - 1.5rem, 420px);
  }

  .hero .brand {
    letter-spacing: 0.1em;
  }

  .brand-lockup {
    flex-wrap: wrap;
  }

  .hero-actions {
    width: 100%;
  }

  .hero-actions .btn {
    flex: 1 1 auto;
    min-height: 44px;
  }

  .chat-header {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .chat-modes {
    width: 100%;
  }

  .chat-mode {
    flex: 1;
    text-align: center;
    min-height: 36px;
  }

  .chat-form input,
  .chat-form button,
  .chat-tutorial-btn {
    min-height: 44px;
    font-size: 16px; /* avoid iOS zoom */
  }

  .chat-panel {
    right: max(0.75rem, env(safe-area-inset-right));
    left: max(0.75rem, env(safe-area-inset-left));
    width: auto;
    bottom: calc(max(1rem, env(safe-area-inset-bottom)) + 68px);
    height: min(70dvh, calc(100dvh - 120px));
    transform-origin: bottom center;
  }

  .dl-item,
  .dev-link {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .dl-priority {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 320px;
  }

  .dl-gallery {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  }

  .spec-row {
    grid-template-columns: 1fr 1fr;
  }

  .audio-fab,
  .chat-fab {
    width: 52px;
    height: 52px;
  }

  .lyrics-bar {
    left: calc(max(0.85rem, env(safe-area-inset-left)) + 52px + 0.4rem);
    right: calc(max(0.85rem, env(safe-area-inset-right)) + 52px + 0.4rem);
    font-size: 0.72rem;
    letter-spacing: 0.05em;
  }
}

@media (max-width: 480px) {
  .nav-wordmark {
    font-size: 1.1rem;
    letter-spacing: 0.12em;
  }

  .hero-meta {
    gap: 0.65rem;
    font-size: 0.7rem;
  }

  .chapter-title {
    font-size: 1.65rem;
  }

  .grid-2,
  .grid-3,
  .split {
    grid-template-columns: 1fr;
  }

  .dl-preview video {
    max-height: 240px;
  }

  .site-footer {
    padding-bottom: calc(5.5rem + env(safe-area-inset-bottom));
  }

  .dev-main {
    padding-top: 4.5rem;
  }
}

@media (min-width: 768px) and (max-width: 1024px) {
  .nav-links {
    gap: 0.85rem;
  }

  .nav-links a {
    font-size: 0.75rem;
    letter-spacing: 0.1em;
  }

  .dl-gallery {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}

@media (hover: none) {
  .chat-fab:hover,
  .audio-fab:hover {
    transform: none;
  }
}
