:root {
  color-scheme: dark;
  font-family: system-ui, sans-serif;
  background: #16101b;
  color: #f6eff4;
  --surface: #211828;
  --line: #44344a;
  --muted: #c5b5c5;
  --gold: #f6c66e;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #ffcf78; outline-offset: 4px; }
.frame { width: min(1140px, calc(100% - 64px)); margin-inline: auto; }
.top { border-bottom: 1px solid #342638; background: #1b1420; }
.top-inner { min-height: 72px; display: grid; grid-template-columns: 1fr 1fr 1fr; align-items: center; }
.brand { display: inline-flex; gap: 10px; align-items: center; font-size: 1.35rem; font-weight: 800; letter-spacing: -.045em; justify-self: start; }
.brand-icon { display: grid; place-items: center; width: 34px; aspect-ratio: 1; border-radius: 10px; background: var(--gold); color: #2e1a12; }
.brand-gold, .balance span { color: var(--gold); }
.nav { width: max-content; margin: auto; padding: 10px 16px; font-weight: 650; font-size: .9rem; border-radius: 8px; background: #302237; }
.balance { justify-self: end; border: 1px solid #4f3a45; padding: 8px 13px; border-radius: 20px; color: #e5d0bd; font-size: .9rem; white-space: nowrap; }
.balance strong { color: #ffe1a3; }
.hero { min-height: 426px; margin-top: 32px; border: 1px solid #68464e; border-radius: 24px; overflow: hidden; display: grid; align-items: center; background: #34202f var(--cover, none) right 44% / cover no-repeat; position: relative; isolation: isolate; }
.hero::before { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, #251521 2%, #251521f0 26%, #25152185 51%, #25152118 77%), linear-gradient(0deg, #28172555, transparent 45%); }
.hero-content { max-width: 480px; padding: 38px 50px; }
h1, h2, h3, p { margin-top: 0; }
h1, h2 { font-family: Georgia, serif; font-weight: 600; }
h1 { font-size: clamp(3.1rem, 7vw, 5.55rem); margin-bottom: 3px; line-height: 1.02; letter-spacing: -.055em; }
.subtitle { font: italic 1.38rem Georgia, serif; color: #ffe0a1; margin-bottom: 16px; }
.hero-copy { max-width: 335px; color: #eee0eb; line-height: 1.55; margin-bottom: 26px; }
.primary, .secondary { display: inline-flex; justify-content: center; align-items: center; min-height: 46px; padding: 10px 19px; border-radius: 10px; font-weight: 750; border: 1px solid transparent; }
.primary { background: var(--gold); color: #2a1916; }
.primary:hover { background: #ffda95; }
.secondary { background: #302438; border-color: var(--line); color: #f6eff4; }
.secondary:hover { background: #413048; }
.level-section { padding-block: 34px 40px; scroll-margin-top: 20px; }
.section-title h2 { font-size: 2.2rem; margin-bottom: 6px; }
.section-title p { color: var(--muted); margin-bottom: 21px; }
.level-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.level { display: flex; flex-direction: column; align-items: flex-start; border: 1px solid var(--line); background: var(--surface); border-radius: 16px; padding: 20px; gap: 10px; }
.level:hover { border-color: var(--accent); }
.discovery { --accent: #b9dba6; --tint: #2f3b35; }
.challenge { --accent: #f6c66e; --tint: #48362c; }
.recall { --accent: #dbb5fe; --tint: #41304e; }
.level-top { display: flex; justify-content: space-between; align-items: center; width: 100%; margin-bottom: 4px; }
.level-icon { display: grid; place-items: center; width: 42px; aspect-ratio: 1; font-size: 1.45rem; border-radius: 10px; background: var(--tint); color: var(--accent); }
.level-label { color: var(--accent); font-size: .875rem; font-weight: 700; }
.level h3 { font-size: 1.3rem; margin: 0; }
.level p { line-height: 1.5; color: var(--muted); margin: 0 0 8px; }
.level button { width: 100%; margin-top: auto; background: var(--tint); color: var(--accent); border-color: var(--line); }
.level button:hover { border-color: var(--accent); }
.footer { display: flex; justify-content: space-between; gap: 12px; padding-block: 20px 30px; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }
.footer a:hover, .verse:hover { text-decoration: underline; }
dialog { width: min(670px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow: auto; margin: auto; color: inherit; padding: 0; background: var(--surface); border: 1px solid #66506d; border-radius: 22px; }
dialog::backdrop { background: #0d0911d9; backdrop-filter: blur(5px); }
body:has(dialog[open]) { overflow: hidden; }
#game-content { padding: clamp(18px, 4vw, 32px); }
.game-top, .round-meta, .actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.game-top { margin-bottom: 14px; }
.round-meta { color: var(--muted); justify-content: flex-start; flex-wrap: wrap; font-size: .9rem; }
.timer { color: var(--gold); font-weight: 750; font-variant-numeric: tabular-nums; }
.close { border: 1px solid var(--line); color: inherit; background: transparent; width: 42px; height: 42px; border-radius: 10px; font-size: 1.35rem; margin-left: auto; }
.close:hover { background: #3c2d45; }
progress { appearance: none; display: block; width: 100%; height: 7px; border: 0; margin-bottom: 24px; border-radius: 7px; overflow: hidden; background: #423447; }
progress::-webkit-progress-bar { background: #423447; }
progress::-webkit-progress-value { background: var(--gold); }
progress::-moz-progress-bar { background: var(--gold); }
#dialog-title { font-size: clamp(1.55rem, 5vw, 2.25rem); line-height: 1.18; margin-bottom: 20px; }
.answers { display: grid; gap: 9px; }
.answer { width: 100%; background: #2c2233; min-height: 51px; border: 1px solid var(--line); color: inherit; text-align: left; padding: 10px 12px; border-radius: 10px; display: flex; align-items: center; gap: 12px; }
.answer:not(:disabled):hover { border-color: var(--gold); }
.answer:disabled { cursor: default; }
.answer.correct { background: #2d3c34; border-color: #83b48e; }
.answer.incorrect { background: #46303f; border-color: #da91ab; }
.key { display: grid; place-items: center; flex: 0 0 28px; height: 28px; border-radius: 7px; background: #ffffff13; font-size: .875rem; }
.feedback { margin-top: 14px; border: 1px solid var(--line); padding: 12px 14px; border-radius: 10px; color: #ede1ec; line-height: 1.5; }
.feedback p { margin: 0 0 5px; }
.verse { color: #ffda91; font-weight: 650; }
.actions { justify-content: flex-end; margin-top: 17px; flex-wrap: wrap; }
.receipt { border: 1px solid var(--line); background: #2c2233; border-radius: 12px; padding: 14px 16px; line-height: 1.5; }
.receipt p { margin-bottom: 0; color: var(--muted); }
.points { color: var(--gold); font: 600 3.3rem Georgia, serif; margin-bottom: 7px; }
@media (max-width: 760px) {
  .frame { width: calc(100% - 32px); }
  .level-grid { grid-template-columns: 1fr; }
  .hero { min-height: 395px; margin-top: 20px; background-position: 61% center; }
  .hero-content { max-width: 360px; padding: 26px; }
  .hero::before { background: linear-gradient(90deg, #251521f7 5%, #251521c9 53%, #2515212b); }
}
@media (max-width: 425px) {
  .top-inner { grid-template-columns: 1fr auto; min-height: 60px; }
  .nav { display: none; }
  .hero { min-height: 360px; }
  .hero-content { padding: 19px; }
}

.library-intro { padding: clamp(34px, 6vw, 74px) 0 27px; }
.library-intro h1 { margin-bottom: 14px; }
.library-intro p { color: var(--muted); font-size: 1.12rem; margin-bottom: 0; line-height: 1.5; }
.library-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; padding-bottom: 44px; }
.library-card { --card-gold: var(--gold); display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 19px; background: var(--surface); }
.library-card.bhagavatam { --card-gold: #a6dcc4; }
.library-card.caitanya { --card-gold: #f3b5da; }
.library-card:hover { border-color: var(--card-gold); }
.library-card img { width: 100%; height: auto; aspect-ratio: 1.62; object-fit: cover; object-position: 65% 46%; border-bottom: 1px solid var(--line); background: #37243e; display: block; }
.library-card-content { display: flex; flex-direction: column; flex: 1; padding: 20px; align-items: flex-start; }
.library-card h2 { font-size: clamp(1.55rem, 3.2vw, 2rem); margin-bottom: 6px; }
.library-card .subtitle { font-size: 1.08rem; color: var(--card-gold); margin-bottom: 14px; }
.game-description { color: var(--muted); line-height: 1.5; margin-bottom: 22px; }
.library-card .primary { margin-top: auto; background: var(--card-gold); }
.library-card .primary:hover { filter: brightness(1.1); }
.library-link { display: inline-block; margin-top: 22px; color: var(--gold); font-weight: 650; }
.library-link:hover { text-decoration: underline; }
.game-hero { margin-top: 14px; }
.game-hero h1 { font-size: clamp(2.9rem, 6.8vw, 5.1rem); overflow-wrap: anywhere; }
.book-source { margin: 18px 0 0; }
@media (max-width: 850px) {
  .library-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 540px) {
  .library-grid { grid-template-columns: 1fr; }
  .library-card img { aspect-ratio: 1.72; }
  .footer { flex-wrap: wrap; }
}
