:root {
  color-scheme: dark;
  --ink: #101417;
  --panel: #192126;
  --panel-alt: #202b31;
  --rail: #2f3e43;
  --cream: #f4ede1;
  --muted: #b7bcb7;
  --amber: #efbf77;
  --amber-soft: #fad698;
  --green: #a8d2b8;
  --danger: #f6a7a0;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --display: Georgia, "Times New Roman", serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(ellipse at 80% 0, #1a272a 0, transparent 55%), var(--ink); color: var(--cream); min-height: 100svh; font-family: var(--body); font-size: 16px; line-height: 1.5; }
body:has(.screen) { background: #11191c; }
[hidden] { display: none !important; }
a { color: var(--amber-soft); text-underline-offset: .2em; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
button, a, select, input { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--amber-soft); outline-offset: 3px; }
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, p { margin-top: 0; }
h1, .brand, .winner-title { font-family: var(--display); font-weight: 400; letter-spacing: -.035em; line-height: .99; }
h1 { font-size: clamp(3rem, 8vw, 6.6rem); }
h2 { font-family: var(--display); font-weight: 400; font-size: clamp(1.5rem, 4vw, 2.1rem); line-height: 1.15; }
h3 { font-size: 1.06rem; line-height: 1.25; }
small { color: var(--muted); font-size: .9rem; }
.muted { color: var(--muted); }
.accent { color: var(--amber-soft); }
.green { color: var(--green); }
.error { color: var(--danger); }
.eyebrow { margin: 0 0 .65rem; color: var(--amber); font-size: .83rem; text-transform: uppercase; letter-spacing: .13em; font-weight: 650; }
.shell { width: min(1080px, calc(100% - 2.3rem)); margin: 0 auto; padding: 2.3rem 0 5rem; }
.player { width: min(730px, calc(100% - 2rem)); margin: 0 auto; padding: .85rem 0 6rem; }
.loading { padding: 4rem 1.1rem; color: var(--muted); text-align: center; }
.hero { display: grid; align-items: end; background: center right / cover no-repeat linear-gradient(90deg, #0f1518f5 0%, #101719d4 32%, #1017191a 100%), center right / cover no-repeat url('/assets/museum.jpg'), #1d2a2e; border: 1px solid #3f4745; border-radius: 1.35rem; padding: clamp(1.3rem, 4.8vw, 4.4rem); min-height: clamp(27rem, 59vh, 42rem); overflow: hidden; }
.hero h1 { margin: 0 0 1.35rem; max-width: 10ch; }
.hero-copy { max-width: 35rem; }
.hero-copy p:not(.eyebrow) { color: #e0ded4; max-width: 37ch; }
.hero .btn { margin-top: .6rem; }
.hero.compact { min-height: 25rem; }
.hero-note { margin: .75rem 0 0; color: #dfddd3; }
.panel { background: var(--panel); border: 1px solid var(--rail); border-radius: 1rem; padding: clamp(.95rem, 3vw, 1.5rem); }
.panel + .panel, .gap-top { margin-top: 1rem; }
.panel > :last-child { margin-bottom: 0; }
.btn, .switch a { text-decoration: none; border-radius: .6rem; padding: .64rem .92rem; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; line-height: 1.22; color: var(--cream); font-weight: 650; background: #28363b; border: 1px solid #455457; text-align: center; }
.btn:hover { border-color: #a3aaa1; }
.btn.primary { color: #21180d; background: var(--amber); border-color: var(--amber); }
.btn.primary:hover { background: var(--amber-soft); }
.btn.ghost { background: transparent; border-color: var(--rail); }
.btn.small { padding: .47rem .62rem; font-size: .89rem; min-height: 40px; }
.btn.full { width: 100%; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: .64rem; }
.row.between { justify-content: space-between; }
.topline { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1.1rem; }
.brand { font-size: 1.65rem; color: var(--cream); }
.bar { position: sticky; top: 0; margin: -.1rem -1rem 1rem; padding: .7rem 1rem .55rem; z-index: 2; background: #10171cf2; border-bottom: 1px solid var(--rail); backdrop-filter: blur(12px); }
.bar .topline { margin-bottom: .65rem; gap: .45rem; }
.timer { color: var(--amber-soft); font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.36rem; white-space: nowrap; line-height: 1; }
.timer.soon { color: var(--danger); }
.switch { display: grid; gap: .5rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.switch button { min-height: 44px; border: 1px solid var(--rail); border-radius: .55rem; padding: .45rem .28rem; background: #172024; color: #e8e5d9; font-weight: 650; font-size: .91rem; }
.switch button[aria-pressed="true"] { border-color: var(--amber); color: var(--amber-soft); background: #332d24; }
.phase { margin: 0 0 1rem; border-left: 3px solid var(--amber); padding: .65rem .85rem; background: #222a2b; border-radius: 0 .55rem .55rem 0; }
.phase strong { display: block; }
.phase small { display: block; margin-top: .16rem; }
.phase .next { display: inline; }
.section-title { margin: 1.15rem 0 .8rem; }
.doc { background: #e8deca; color: #2b2a26; border-color: #e8deca; }
.doc .eyebrow { color: #65492b; font-size: .78rem; }
.doc h2 { margin: 0 0 .9rem; font-size: clamp(1.42rem, 5vw, 2.06rem); }
.doc ul { margin: .7rem 0 1.3rem; padding-left: 1.1rem; }
.doc li + li { margin-top: .48rem; }
.doc .btn { background: #313d3d; }
.doc .green { color: #18503a; }
.doc-photo { overflow: hidden; width: 100%; max-height: 16rem; min-height: 8rem; object-fit: cover; object-position: center; border-radius: .52rem; margin-bottom: .6rem; cursor: zoom-in; }
.doc-photo.expanded { max-height: none; cursor: zoom-out; }
.locked { border-style: dashed; background: #171f23; }
.locked h3 { margin-bottom: .3rem; }
.portraits { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .6rem; }
.person { min-width: 0; border: 1px solid var(--rail); background: #1b2529; color: var(--cream); padding: 0 0 .6rem; display: block; text-align: left; border-radius: .7rem; overflow: hidden; line-height: 1.23; }
.person[aria-pressed="true"] { border-color: var(--amber); box-shadow: 0 0 0 1px var(--amber); }
.person span { display: block; padding: .45rem .45rem 0; font-size: .82rem; font-weight: 650; overflow-wrap: anywhere; }
.portrait { aspect-ratio: 1 / 1; width: 100%; background: #3c4d4f url('/assets/portraits.jpg') no-repeat; background-size: 200% 200%; }
.portrait[data-index="0"] { background-position: left top; }
.portrait[data-index="1"] { background-position: right top; }
.portrait[data-index="2"] { background-position: left bottom; }
.portrait[data-index="3"] { background-position: right bottom; }
.question { border: 1px solid var(--rail); border-radius: .65rem; padding: .85rem; margin: .65rem 0; background: #172023; }
.question[open] { border-color: #82735a; }
.question summary { cursor: pointer; font-weight: 650; padding: .2rem 0; }
.question p { margin: .65rem 0 0; }
.question .row { margin-top: .7rem; }
.question.unready { opacity: .86; }
.question .line { color: #eadcc4; border-left: 2px solid var(--amber); padding-left: .8rem; }
.question ~ .question { margin-bottom: 0; }
.form-grid { display: grid; gap: .9rem; }
label.field { display: grid; gap: .37rem; color: var(--cream); font-weight: 600; }
input, select { min-height: 45px; width: 100%; background: #121a1d; color: var(--cream); border: 1px solid #526162; border-radius: .56rem; padding: .55rem .65rem; min-width: 0; }
label.check { display: flex; align-items: center; gap: .6rem; }
label.check input { width: 1.2rem; min-height: 1.2rem; accent-color: var(--amber); }
.admin-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; align-items: start; }
.admin-grid .panel { margin: 0; }
.admin-grid h3 { margin: 0; }
.admin-grid .field { margin-top: .55rem; }
.admin-intro { padding: 1rem 0 1.35rem; }
.admin-intro h1 { font-size: clamp(2.5rem, 7vw, 4.7rem); margin-bottom: 1rem; }
.narrow { max-width: 35rem; }
.join-info { margin: .6rem 0; min-height: 2rem; }
.admin-grid .status { display: block; color: var(--muted); min-height: 1.65rem; }
.admin-grid .status.done { color: var(--green); }
.score { margin: 0; padding: 0; list-style: none; }
.score li { display: grid; grid-template-columns: 1fr auto auto; gap: .65rem; align-items: center; padding: .62rem 0; border-bottom: 1px solid var(--rail); font-variant-numeric: tabular-nums; }
.score li:last-child { border: 0; }
.score li:first-child { color: var(--amber-soft); font-weight: 700; }
.timeline { padding: 0; margin: .6rem 0 0; list-style: none; }
.timeline li { display: grid; grid-template-columns: 4.5em minmax(0, 1fr); align-items: baseline; gap: .75rem; margin-bottom: .55rem; }
.timeline time { font-variant-numeric: tabular-nums; color: var(--amber-soft); font-weight: 700; }
.screen { min-height: 100svh; padding: clamp(1.25rem, 3.7vw, 4rem); font-size: clamp(1.02rem, 2vw, 1.48rem); }
.screen .hero { min-height: min(72vh, 48rem); max-width: 98rem; margin: 0 auto; }
.screen .hero h1 { font-size: clamp(3.25rem, 9vw, 8.4rem); }
.screen .hero-copy { max-width: 50rem; }
.screen .hero-copy p { max-width: 42ch; }
.screen .topline { max-width: 98rem; margin: 0 auto 1.15rem; }
.screen .screen-center { min-height: 48vh; display: grid; place-content: center; text-align: center; }
.screen-center .timer { font-size: clamp(5rem, 17vw, 15rem); letter-spacing: -.055em; }
.screen-center h2 { margin: 1rem 0 .65rem; font-size: clamp(1.5rem, 3.9vw, 3.2rem); }
.screen .screen-status { max-width: 98rem; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .65rem; }
.screen-status .panel { margin: 0; text-align: center; }
.screen-finale { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.4fr); gap: 1.1rem; max-width: 98rem; margin: 0 auto; }
.screen-finale .panel { margin: 0; }
.winner-title { font-size: clamp(2.2rem, 5.4vw, 5.2rem); margin-bottom: 1.1rem; }
.reveal { animation: enter .45s ease-out both; }
@keyframes enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.print-preview { width: min(90%, 48rem); color-scheme: light; margin: 1.1rem auto; }
.print-sheet { background: #fff; color: #141414; border: 1px solid #ddd; text-align: center; padding: 2rem; border-radius: .5rem; margin: 1.5rem 0; }
.print-sheet h1 { font-size: 3.2rem; margin: .4rem 0 .8rem; }
.print-sheet img { width: 17rem; height: 17rem; max-width: 100%; margin: .7rem auto; }
.print-sheet p { margin-bottom: .5rem; }
.print-sheet a { color: #212121; text-decoration: none; font-size: .85rem; overflow-wrap: anywhere; }
#toast { position: fixed; bottom: max(1rem, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 2rem); z-index: 5; background: #312821; color: #fff2d7; padding: .7rem .9rem; box-shadow: 0 .2rem 1rem #0007; border: 1px solid #78624d; border-radius: .6rem; }
#toast:empty { display: none; }
#audio-dock { position: fixed; z-index: 4; left: 50%; bottom: max(1rem, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(28rem, calc(100% - 1rem)); padding: .55rem; background: #2a3438; border: 1px solid #566666; border-radius: .7rem; }
#audio-dock audio { width: min(100%, 21rem); height: 42px; }
@media (max-width: 700px) {
  .admin-grid, .screen-finale { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .screen-finale { grid-template-columns: 1fr; }
  .hero { background-image: linear-gradient(0deg, #0d1517 10%, #10171991 68%, #12191b51), url('/assets/museum.jpg'); background-position: center, 60% center; }
  .hero h1 { margin-bottom: .95rem; }
  .screen .screen-status { grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr)); }
}
@media (max-width: 470px) {
  .admin-grid { grid-template-columns: 1fr; }
  .portraits { gap: .4rem; }
  .player { width: calc(100% - 1.5rem); }
  .bar { margin-left: -.75rem; margin-right: -.75rem; padding-left: .75rem; padding-right: .75rem; }
  .player .brand { font-size: 1.3rem; }
  .panel { border-radius: .8rem; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; scroll-behavior: auto !important; } }
@page { size: A4 portrait; margin: 15mm; }
@media print {
  :root { color-scheme: light; }
  body { background: #fff; color: #111; }
  .print-preview { width: auto; margin: 0; }
  .print-sheet { border: 0; border-radius: 0; margin: 0; padding: 26mm 6mm 8mm; break-after: page; }
  .print-sheet:last-child { break-after: auto; }
  .print-sheet img { width: 100mm; height: 100mm; margin: 4mm auto; }
  .print-sheet a { font-size: 9pt; }
  .no-print, #toast, #audio-dock { display: none !important; }
}
