:root {
  color-scheme: dark;
  --green: #102d22;
  --green-light: #214b3a;
  --gold: #e0bd73;
  --cream: #f5efe2;
  --red: #a51f2d;
  --ink: #07100c;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 15% 5%, rgba(224, 189, 115, .13), transparent 32%),
    linear-gradient(145deg, #07100c 0%, #102d22 55%, #06100b 100%);
  color: var(--cream);
  font-family: Georgia, "Times New Roman", serif;
}

button, a, select, input { font: inherit; }

button, a, select { -webkit-tap-highlight-color: transparent; }

.app { min-height: 100vh; padding: 18px clamp(14px, 2.5vw, 34px) 112px; }

.topbar {
  max-width: 1440px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand strong { display: block; font-size: clamp(1rem, 2vw, 1.35rem); color: var(--gold); }
.brand small { display: block; margin-top: 2px; opacity: .78; font-family: Arial, sans-serif; }
.cross { font-size: 2rem; color: var(--gold); }

.top-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.top-actions a, .top-actions button {
  border: 1px solid rgba(224, 189, 115, .45);
  border-radius: 999px;
  padding: 9px 14px;
  background: rgba(255,255,255,.06);
  color: var(--cream);
  text-decoration: none;
  cursor: pointer;
  font-family: Arial, sans-serif;
  font-size: .88rem;
}
.top-actions a:hover, .top-actions button:hover { background: rgba(224, 189, 115, .18); }

.stage {
  max-width: 1440px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 46px;
  align-items: center;
  gap: clamp(8px, 1.5vw, 20px);
}

.slide-frame {
  margin: 0;
  position: relative;
  border: 1px solid rgba(224, 189, 115, .28);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 28px 80px rgba(0,0,0,.48);
  background: #000;
}

.slide-frame img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
}

.slide-frame figcaption {
  position: absolute;
  right: 12px;
  bottom: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(4, 13, 9, .78);
  color: #fff;
  font: 600 .75rem Arial, sans-serif;
}

.nav-button {
  width: 46px;
  height: 64px;
  border: 1px solid rgba(224, 189, 115, .36);
  border-radius: 12px;
  background: rgba(255,255,255,.07);
  color: var(--gold);
  font-size: 2.4rem;
  cursor: pointer;
}
.nav-button:hover { background: rgba(224, 189, 115, .16); }
.nav-button:disabled { opacity: .25; cursor: default; }

.page-strip {
  max-width: 1360px;
  margin: 16px auto 0;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 10px;
  scrollbar-color: rgba(224, 189, 115, .4) transparent;
}

.page-chip {
  flex: 0 0 auto;
  width: 42px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.06);
  color: var(--cream);
  cursor: pointer;
  font-family: Arial, sans-serif;
}
.page-chip.active { background: var(--red); border-color: var(--red); font-weight: 700; }

.music-dock {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  width: min(920px, calc(100% - 24px));
  min-height: 76px;
  padding: 11px 16px;
  display: grid;
  grid-template-columns: minmax(210px, 1fr) 46px minmax(120px, 1.3fr) 48px auto auto;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(224, 189, 115, .42);
  border-radius: 18px;
  background: rgba(8, 26, 18, .95);
  box-shadow: 0 14px 50px rgba(0,0,0,.48);
  backdrop-filter: blur(18px);
}

.music-copy { display: flex; align-items: center; gap: 10px; min-width: 0; }
.music-copy strong, .music-copy small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.music-copy strong { color: var(--gold); font-size: .96rem; }
.music-copy small { margin-top: 3px; font: .78rem Arial, sans-serif; opacity: .72; }
.music-icon { font-size: 1.9rem; color: var(--gold); }
.play {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--red);
  color: white;
  cursor: pointer;
}
#progress { width: 100%; accent-color: var(--gold); }
.time, .version-label { font: .78rem Arial, sans-serif; opacity: .8; }
#versionSelect {
  border: 1px solid rgba(224, 189, 115, .4);
  border-radius: 8px;
  background: var(--green-light);
  color: white;
  padding: 8px;
}

.welcome {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 22%, rgba(224, 189, 115, .23), transparent 30%),
    rgba(4, 13, 9, .97);
  transition: opacity .4s ease, visibility .4s ease;
}
.welcome.hidden { opacity: 0; visibility: hidden; }
.welcome-card { width: min(680px, 100%); text-align: center; }
.welcome-cross { display: block; color: var(--gold); font-size: 4rem; }
.eyebrow { color: var(--gold); font: 700 .8rem Arial, sans-serif; letter-spacing: .24em; }
.welcome h1 { margin: 18px 0; font-size: clamp(2.6rem, 8vw, 5.8rem); line-height: .95; }
.welcome p:not(.eyebrow) { max-width: 560px; margin: 0 auto 26px; font: 1.05rem/1.6 Arial, sans-serif; color: rgba(245,239,226,.82); }
.welcome button {
  display: block;
  width: min(360px, 100%);
  margin: 10px auto 0;
  padding: 15px 20px;
  border: 0;
  border-radius: 999px;
  background: var(--red);
  color: white;
  font: 700 1rem Arial, sans-serif;
  cursor: pointer;
}
.welcome .silent { background: transparent; border: 1px solid rgba(224,189,115,.35); color: var(--cream); }

@media (max-width: 760px) {
  .app { padding: 10px 8px 150px; }
  .topbar { align-items: flex-start; }
  .brand small { display: none; }
  .top-actions a { display: none; }
  .stage { grid-template-columns: 34px minmax(0, 1fr) 34px; gap: 4px; }
  .nav-button { width: 34px; height: 52px; border-radius: 9px; font-size: 1.9rem; }
  .slide-frame { border-radius: 8px; }
  .slide-frame figcaption { bottom: 5px; right: 6px; padding: 4px 7px; }
  .page-strip { margin-top: 12px; padding-inline: 38px; }
  .music-dock {
    min-height: 118px;
    grid-template-columns: 1fr 44px auto;
    grid-template-areas: "copy play version" "progress progress time";
    gap: 8px 10px;
  }
  .music-copy { grid-area: copy; }
  .play { grid-area: play; }
  #progress { grid-area: progress; }
  .time { grid-area: time; }
  .version-label { display: none; }
  #versionSelect { grid-area: version; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
