/* Tokens mirrored from frontend/src/theme/theme.ts (live app chrome). */
:root {
  --bg: #0a0a0a;
  --card: #141414;
  --surface: #1c1c1c;
  --border: #2e2e2e;
  --text: #f8f4ef;
  --text-muted: #9a948c;
  --primary: #c4ccd8;
  --gold: #e8c25e;
  --gold-hi: #f4de96;
  --gold-lo: #d6a638;
  --gold-ink: #1a1400;
  --hunter: #c84bff;
  --movie: #ff4d6a;
  --tv: #2dd4a8;
  --anime: #ff8c42;
  --manga: #ff5c9a;
  --book: #4d9fff;
  --max: 720px;
  --wide: 920px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; color-scheme: dark; }
body {
  margin: 0;
  color: var(--text);
  font-family: var(--font-body);
  background: var(--bg);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.12;
  margin: 0;
  letter-spacing: -0.03em;
}
p { margin: 0; }

.chest-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.9s var(--ease);
}
.chest-canvas.is-ready { opacity: 1; }

.vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 55% at 50% 42%, transparent 20%, rgba(10, 10, 10, 0.35) 70%, rgba(10, 10, 10, 0.78) 100%),
    linear-gradient(180deg, rgba(10, 10, 10, 0.28) 0%, transparent 22%, transparent 58%, rgba(10, 10, 10, 0.88) 100%);
}
.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.07;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.9'/%3E%3C/svg%3E");
}

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: rgba(10, 10, 10, 0.28);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: background 0.35s var(--ease), border-color 0.35s var(--ease);
}
.site-header.is-scrolled {
  background: rgba(10, 10, 10, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom-color: rgba(46, 46, 46, 0.7);
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text);
}
.wordmark img {
  width: 28px;
  height: 28px;
  border-radius: 7px;
}
.header-cta {
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gold-ink);
  background: linear-gradient(90deg, var(--gold) 0%, var(--gold-hi) 50%, var(--gold-lo) 100%);
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid rgba(214, 166, 56, 0.45);
  transition: transform 0.13s var(--ease);
}
.header-cta:active { transform: scale(0.97); }
.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}
.header-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
}
.header-link:hover { color: var(--text); }

main { position: relative; z-index: 2; }

.stage {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 96px 22px 56px;
  pointer-events: none;
}
.stage a,
.stage button { pointer-events: auto; }

.stage-copy {
  width: min(100%, var(--max));
  text-align: center;
  animation: rise 0.95s var(--ease) both;
  padding: 40px 18px 12px;
  background: linear-gradient(180deg, transparent 0%, rgba(10, 10, 10, 0.55) 28%, rgba(10, 10, 10, 0.82) 100%);
  border-radius: 28px;
}
.stage-mid {
  align-items: center;
  padding-bottom: 12vh;
}
.stage-mid .stage-copy { animation-delay: 0.05s; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-hi);
  margin-bottom: 16px;
}
.brand {
  font-size: clamp(4rem, 16vw, 7.2rem);
  font-weight: 700;
  font-optical-sizing: auto;
  margin-bottom: 10px;
  background: linear-gradient(180deg, #fff6d4 0%, var(--gold-hi) 38%, var(--gold) 72%, var(--gold-lo) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 10px 28px rgba(214, 166, 56, 0.28));
}
.headline {
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 4.6vw, 2.05rem);
  font-weight: 560;
  color: var(--text);
  max-width: 18ch;
  margin: 0 auto 12px;
}
.support {
  color: var(--text-muted);
  font-size: 1.06rem;
  max-width: 30rem;
  margin: 0 auto 28px;
}
.stage-kicker {
  font-size: clamp(2rem, 6vw, 3.1rem);
  margin-bottom: 12px;
}
.stage-copy p.lede {
  color: var(--text-muted);
  font-size: 1.08rem;
  max-width: 32rem;
  margin: 0 auto;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}
.btn-primary,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
  padding: 15px 26px;
  border-radius: 999px;
  transition: transform 0.13s var(--ease), background 0.2s var(--ease);
}
.btn-primary {
  color: var(--gold-ink);
  background: linear-gradient(90deg, var(--gold) 0%, var(--gold-hi) 50%, var(--gold-lo) 100%);
  border: 1px solid rgba(214, 166, 56, 0.5);
  box-shadow: 0 10px 28px rgba(214, 166, 56, 0.28);
}
.btn-primary:hover { transform: none; }
@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover { transform: translateY(-1px); }
}
.btn-primary:active,
.btn-ghost:active { transform: scale(0.97); }
.btn-ghost {
  color: var(--text);
  background: rgba(20, 20, 20, 0.55);
  border: 1px solid rgba(232, 194, 94, 0.28);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
@media (hover: hover) and (pointer: fine) {
  .btn-ghost:hover { background: rgba(32, 32, 32, 0.7); }
}

.scroll-hint {
  margin-top: 36px;
  color: var(--text-muted);
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  opacity: 0.85;
}
.scroll-hint::after {
  content: "";
  display: block;
  width: 1px;
  height: 28px;
  margin: 10px auto 0;
  background: linear-gradient(180deg, var(--gold), transparent);
  animation: drip 1.8s var(--ease) infinite;
}
body.is-past-hero .scroll-hint { opacity: 0; }

.hero-fallback {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.hero-fallback img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 35%;
  opacity: 0.42;
  transform: scale(1.04);
}
.hero-fallback::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(10, 10, 10, 0.35) 0%, rgba(10, 10, 10, 0.55) 42%, rgba(10, 10, 10, 0.97) 78%, var(--bg) 100%),
    radial-gradient(ellipse 70% 50% at 50% 28%, rgba(232, 194, 94, 0.16), transparent 60%);
}
body.has-webgl .hero-fallback {
  opacity: 0;
  transition: opacity 0.9s var(--ease);
}
body.has-webgl .stage { background: transparent; }

section {
  padding: 72px 22px;
}
.section-inner {
  width: min(100%, var(--max));
  margin: 0 auto;
}
.section-title {
  font-size: clamp(1.65rem, 4.5vw, 2.2rem);
  margin-bottom: 10px;
  text-align: center;
}
.section-copy {
  text-align: center;
  color: var(--text-muted);
  font-size: 1.02rem;
  max-width: 34rem;
  margin: 0 auto;
}

.value {
  pointer-events: auto;
  background: transparent;
}
body.has-webgl .value .beat-art {
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 18px rgba(232, 194, 94, 0.18));
}

.beats {
  display: grid;
  gap: 40px;
  margin-top: 48px;
}
.beat {
  text-align: center;
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.65s var(--ease), transform 0.65s var(--ease);
}
.beat.in-view {
  opacity: 1;
  transform: none;
}
.beat-art {
  width: min(160px, 42vw);
  margin: 0 auto 18px;
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.55));
}
.beat h3 {
  font-size: 1.35rem;
  margin-bottom: 8px;
  color: var(--text);
}
.beat p {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 28rem;
  margin: 0 auto;
}
.beat-hunter h3 { color: var(--hunter); }

.formats {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: rgba(20, 20, 20, 0.72);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  pointer-events: auto;
}
body.has-webgl .formats {
  background: rgba(20, 20, 20, 0.42);
}
.type-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 28px;
}
.type-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}
.type-chip i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.type-chip.movie i { background: var(--movie); }
.type-chip.tv i { background: var(--tv); }
.type-chip.anime i { background: var(--anime); }
.type-chip.manga i { background: var(--manga); }
.type-chip.book i { background: var(--book); }

.rate { background: transparent; pointer-events: auto; }
.rate-visual {
  margin: 36px auto 0;
  width: min(100%, 28rem);
  text-align: center;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.65s var(--ease), transform 0.65s var(--ease);
}
.rate-visual.in-view {
  opacity: 1;
  transform: none;
}
.rate-visual img {
  width: min(120px, 32vw);
  height: auto;
  margin: 0 auto 22px;
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.55));
}
body.has-webgl .rate-visual img { display: none; }
.dial-track {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(154, 148, 140, 0.35) 0%,
    rgba(232, 194, 94, 0.55) 55%,
    var(--gold-hi) 100%
  );
  margin: 0 4px 14px;
}
.dial-track::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 72%;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid var(--gold-hi);
  box-shadow: 0 0 0 4px rgba(232, 194, 94, 0.18);
  transform: translate(-50%, -50%);
}
.dial-labels {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0;
}
.dial-labels strong {
  color: var(--gold-hi);
  font-weight: 600;
}
.rate-pillars {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 28px;
}
.pillar {
  text-align: center;
  padding: 4px 6px;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.65s var(--ease), transform 0.65s var(--ease);
}
.pillar.in-view {
  opacity: 1;
  transform: none;
}
.pillar strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 4px;
  color: var(--text);
}
.pillar span {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.privacy .section-title { max-width: 16ch; margin-left: auto; margin-right: auto; }
.privacy,
.final-cta {
  position: relative;
  z-index: 2;
  pointer-events: auto;
}

.import-section {
  position: relative;
  z-index: 3;
  pointer-events: auto;
  border-top: 1px solid rgba(232, 194, 94, 0.18);
  background:
    radial-gradient(ellipse 70% 50% at 50% 0%, rgba(232, 194, 94, 0.1), transparent 55%),
    rgba(10, 10, 10, 0.86);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  padding-top: 88px;
  padding-bottom: 88px;
}
.import-grid {
  display: grid;
  gap: 16px;
  margin-top: 28px;
}
@media (min-width: 640px) {
  .import-grid { grid-template-columns: 1fr 1fr; }
}
.import-card {
  background: rgba(20, 20, 20, 0.94);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  text-align: left;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}
.import-card h3 {
  font-size: 1.15rem;
  margin-bottom: 6px;
}
.import-card p,
.import-howto {
  color: var(--text-muted);
  font-size: 0.92rem;
}
.import-howto { margin: 10px 0 16px; }
.import-file {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.import-file input[type="file"] {
  color: var(--text-muted);
  font-size: 0.85rem;
}
.import-filename {
  color: var(--text-muted);
  font-size: 0.82rem;
}
.btn-secondary,
.btn-import {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 10px 14px;
  border-radius: 999px;
  cursor: pointer;
}
.btn-import {
  width: 100%;
  margin-top: 4px;
  color: var(--gold-ink);
  background: linear-gradient(90deg, var(--gold) 0%, var(--gold-hi) 50%, var(--gold-lo) 100%);
  border-color: rgba(214, 166, 56, 0.45);
  transition: transform 0.13s var(--ease);
}
.btn-import:active:not(:disabled) { transform: scale(0.97); }
.btn-import:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.import-progress {
  margin-top: 12px;
  height: 6px;
  border-radius: 999px;
  background: var(--surface);
  overflow: hidden;
}
.import-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--gold);
  transition: width 0.3s var(--ease);
}
.import-status {
  margin-top: 10px;
  font-size: 0.88rem;
  color: var(--text-muted);
}
.import-status.is-success { color: var(--tv); }
.import-status.is-error { color: var(--movie); }
.import-status.is-progress { color: var(--gold-hi); }
.import-workspace-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 22px;
  margin-bottom: 4px;
}
.import-user {
  color: var(--text-muted);
  font-size: 0.9rem;
}
.import-email-hint {
  color: var(--text-muted);
  font-size: 0.92rem;
  text-align: center;
  margin: 8px auto 0;
  max-width: 34rem;
}
#import-clerk {
  margin-top: 24px;
  min-height: 120px;
}
#import-boot-error {
  margin-top: 16px;
  color: var(--movie);
  text-align: center;
}

.final-cta {
  padding: 88px 22px 96px;
  text-align: center;
  background:
    radial-gradient(ellipse 70% 55% at 50% 0%, rgba(232, 194, 94, 0.12), transparent 55%),
    var(--bg);
}
.final-cta h2 {
  font-size: clamp(1.8rem, 5vw, 2.4rem);
  margin-bottom: 10px;
}
.final-cta p {
  color: var(--text-muted);
  margin: 0 auto 24px;
  max-width: 28rem;
}

footer {
  position: relative;
  z-index: 2;
  padding: 24px 20px 36px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.88rem;
  background: var(--bg);
}
.footer-inner {
  width: min(100%, var(--max));
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  justify-content: space-between;
  align-items: center;
}
footer a {
  color: var(--primary);
  text-decoration: none;
}
footer a:hover { text-decoration: underline; }

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}
@keyframes drip {
  0%, 100% { transform: scaleY(1); opacity: 0.9; }
  50% { transform: scaleY(0.55); opacity: 0.4; }
}

@media (max-width: 560px) {
  .rate-pillars {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .stage { padding-bottom: 40px; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .hero-actions .btn-primary,
  .hero-actions .btn-ghost { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .stage-copy, .beat, .rate-visual, .pillar, .scroll-hint::after {
    animation: none !important;
    transform: none !important;
    transition: opacity 0.2s ease !important;
    opacity: 1 !important;
  }
  .chest-canvas { display: none !important; }
  .vignette { opacity: 0.4; }
}
