/* Code Heist finale. Load after styles.css; existing IDs remain compatible. */
:root {
  color-scheme: dark;
  --bg: #0b0a0c;
  --panel: #171416;
  --panel2: #211b1e;
  --line: #3e3236;
  --text: #fbf4eb;
  --muted: #b8aba8;
  --blue: #edca86;
  --green: #bfdbb9;
  --red: #ff9aa5;
  --amber: #edca86;
  --gold: #edca86;
  --gold-bright: #f9dfa5;
  --gold-dark: #725634;
  --crimson: #be2949;
  --crimson-dark: #5a182b;
  --ink: #20150c;
  --shadow: 0 22px 70px #00000045;
}

body {
  background:
    radial-gradient(ellipse at 80% 0%, #651a282b, transparent 49%),
    radial-gradient(ellipse at 0% 38%, #a7741e0b, transparent 44%),
    var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: linear-gradient(#d0a66804 1px, transparent 1px), linear-gradient(90deg, #d0a66804 1px, transparent 1px);
  background-size: 64px 64px;
  pointer-events: none;
  z-index: -1;
}
.ambient { opacity: .11; filter: blur(120px); }
.ambient-one { background: #ad243f; top: -110px; left: auto; right: -140px; }
.ambient-two { background: #9b7133; top: 55%; left: -270px; right: auto; }
a { color: var(--gold); text-underline-offset: 4px; }
a:hover { color: var(--gold-bright); }
button, input, textarea, select { font: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 3px solid var(--gold-bright);
  outline-offset: 4px;
}
button:disabled { opacity: .5; }

.site-header {
  max-width: 1280px;
  padding: 22px 32px;
  border-bottom-color: var(--line);
}
.logo-frame {
  background: #fff;
  border-radius: 10px;
  padding: 5px;
  box-shadow: 0 0 0 1px #ffffff30;
}
.brand-eyebrow { color: #b8aca7; letter-spacing: 1.7px; }
.brand-name { font-size: 27px; letter-spacing: -.9px; }
.brand-dot { color: var(--crimson); }
.header-round { color: #e2cba9; letter-spacing: 1.5px; }
.header-divider { color: #725f5b; }
.signal-dot { background: var(--crimson); box-shadow: 0 0 12px #be294970; }
.eyebrow { color: var(--gold); font-size: 10px; letter-spacing: 2.4px; }
.mini-line { background: var(--crimson); width: 34px; height: 2px; }
.muted, .field-help { color: var(--muted); }

.welcome-layout {
  max-width: 1200px;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 465px);
  gap: 76px;
  margin-top: 54px;
  margin-bottom: 76px;
}
.welcome-story { min-width: 0; padding-top: 10px; }
.welcome-story h1 {
  font-size: clamp(62px, 6.4vw, 88px);
  letter-spacing: -5.5px;
  line-height: .98;
  margin: 29px 0 26px;
  font-weight: 700;
}
.welcome-story h1 span { color: var(--gold); }
.hero-description { font-size: 17px; color: #c9bbb5; line-height: 1.75; max-width: 430px; }
.hero-facts { border-color: var(--line); gap: 40px; padding: 24px 0; }
.hero-facts strong { color: #f5e8d4; font-size: 29px; letter-spacing: -1px; }
.hero-facts span { font-size: 10px; color: var(--muted); }
.challenge-tags span { border-color: #514039; background: #d4a95d08; color: #dbc6a7; }
.section-preview { margin-top: 31px; }
.section-preview > div { padding: 17px 0; }
.section-preview > div > span { color: var(--gold); font-size: 16px; width: 25px; }
.section-preview strong { font-size: 13px; }
.section-preview small { color: #a99a97; line-height: 1.5; }
.section-preview b { color: var(--gold); font-variant-numeric: tabular-nums; white-space: nowrap; }

.finale-hero { position: relative; isolation: isolate; }
.finale-hero::after {
  content: '';
  position: absolute;
  width: 250px;
  height: 250px;
  right: -48px;
  top: 14px;
  border-radius: 50%;
  border: 1px solid #e6b96b18;
  background:
    radial-gradient(circle, #120e1100 17%, #e4b65d0c 18%, #e4b65d0c 19%, transparent 20%, transparent 35%, #e4b65d0e 36%, transparent 37%, transparent 47%, #e4b65d0b 48%, transparent 49%, transparent 62%, #e4b65d0e 63%, transparent 64%),
    repeating-conic-gradient(from 8deg, transparent 0 43deg, #e6b96b0a 44deg 45deg);
  box-shadow: 0 0 0 14px #e6b96b03, 0 0 0 15px #e6b96b0c, 0 0 0 32px #e6b96b02;
  opacity: .7;
  pointer-events: none;
  z-index: -1;
}
.finale-badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border: 1px solid #893148;
  border-radius: 5px;
  background: #be294913;
  color: #ffbdc7;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
}
.finale-badge::before { content: ''; width: 5px; height: 5px; background: #f56a84; border-radius: 50%; }
.finale-subtitle { color: #c4b4ae; font-size: 14px; line-height: 1.8; max-width: 460px; margin: 16px 0 25px; }

.entry-card, .question-panel, .result-card, .navigator-panel {
  background: linear-gradient(135deg, #21191cf5, #131114f5);
  border-color: #49383d;
  box-shadow: var(--shadow);
}
.entry-card { border-radius: 18px; padding: 30px; border-top: 2px solid var(--crimson); }
.entry-card h2 { font-size: 27px; letter-spacing: -.9px; margin-top: 25px; }
.step-label { color: #bbaea7; letter-spacing: 1.7px; }
.access-badge { background: #5c402419; color: var(--gold); border-color: #765435; letter-spacing: 1.5px; }
.entry-card input, #answer-text, .final-vault-form input, .admin-layout input, .admin-layout textarea, .admin-layout select, .section-status-card input {
  background: #100d10;
  border: 1px solid #554148;
  border-radius: 8px;
  color: var(--text);
  padding: 12px 13px;
  min-width: 0;
}
.entry-card input::placeholder, #answer-text::placeholder, .final-vault-form input::placeholder { color: #94827e; opacity: 1; }
.entry-card label { color: #e3d7ca; }
.member-row { background: #0b090d60; border-color: #433137; border-radius: 9px; }
.member-number, .member-row-heading strong { color: #d3c5bd; }
.remove-member, .remove-member-button { color: #ffadb8; }
.add-member-button { background: #332127; color: #ead7cd; border-color: #68414b; }
.add-member-button:hover { background: #4a2933; }
.score-rule { background: #211b1e; border-color: #4a393d; }
.correct-rule strong, .hard-rule strong { color: var(--gold); }
.skip-rule strong { color: #f0e3d2; }
.score-rule span { color: #c1b0a8; }
.warning-box { background: #b7872d0b; border-color: #8b673b65; color: #dac4a0; }
.warning-box strong { color: var(--gold-bright); }
.warning-symbol { border-color: #b48b4b; color: var(--gold); }
.brief-rules p { color: #b8aaa4; font-size: 11px; }
.brief-rules span { color: var(--gold); }
.entry-footnote { color: #a1928e; font-size: 10px; }
.inline-error { color: #ffb0bd; line-height: 1.6; }
.button { border-radius: 7px; font-size: 12px; letter-spacing: .2px; }
.button-primary { color: var(--ink); background: var(--gold); border-color: var(--gold); box-shadow: 0 3px 14px #edca8610; }
.button-primary:hover:not(:disabled) { background: var(--gold-bright); border-color: var(--gold-bright); }
.button-secondary { background: #2b2025; border-color: #63434e; color: #f1ddd7; }
.button-secondary:hover:not(:disabled) { background: #422832; border-color: #946273; }
.button-quiet { color: #d0bbb5; }
.button-quiet:hover:not(:disabled) { background: #312128; }

.quiz-layout { max-width: 1240px; margin-top: 24px; }
.quiz-topline { background: #0b0a0cf2; border-bottom: 1px solid #3e323673; margin-bottom: 25px; padding: 15px 0 21px; backdrop-filter: blur(14px); }
.quiz-title { font-size: 31px; letter-spacing: -1.2px; }
.timer-box { background: #24171c; border-color: #713447; border-radius: 9px; min-width: 173px; }
.timer-box > span { color: #d4b1b9; }
.timer-box strong { color: #f9e9dc; font-size: 35px; }
.timer-box small { color: #baa1a2; }
.timer-box.urgent { background: #451521; border-color: #e0556e; box-shadow: 0 0 24px #be294926; }
.timer-box.urgent strong { color: #ffb5c1; }
.quiz-columns { grid-template-columns: 285px minmax(0, 1fr); gap: 25px; }
.navigator-panel { padding: 22px; border-radius: 12px; background: #141114; scrollbar-color: #79514c transparent; }
.navigator-heading h2 { font-size: 13px; }
.progress-track { background: #3b2a31; }
.progress-track > div { background: linear-gradient(90deg, #ab2542, #e6ba6c); }
.progress-stats strong, .progress-stats div:first-child strong { color: var(--gold); }
.progress-stats div:nth-child(2) strong { color: #d8b2a0; }
.map-section h3 { color: #c4b1a8; font-size: 10px; }
.map-button { background: #231b20; border-color: #58424b; color: #c9b7b0; border-radius: 5px; min-height: 35px; }
.map-button.answered { background: #48361f; border-color: #987343; color: #ffe1a6; }
.map-button.skipped { background: #2b2326; border-color: #68504d; color: #d1aba1; }
.map-button.current { box-shadow: 0 0 0 2px var(--gold); }
.map-button.locked, .map-button[aria-disabled='true'] { background: #181416; border-color: #3d2e34; color: #92817d; }
.legend-answered { background: var(--gold); }
.legend-skipped { background: #c7978a; }
.sidebar-scoring p { color: #d0bbb3; }
.question-panel { border-radius: 14px; padding: 31px; }
.section-badge { background: #481c2938; border-color: #863749; color: #f0abb8; font-size: 9px; letter-spacing: 1.2px; }
.question-position { color: #c1aea6; }
.question-panel h2, #question-title { color: #fff4e9; font-size: 25px; font-weight: 600; line-height: 1.4; }
.question-stem { color: #d7c9c1; font-size: 14px; line-height: 1.85; }
.code-block { background: #100d10; border-color: #4d3940; border-left-color: var(--crimson); color: #f2d5bc; font-size: 13px; border-radius: 7px; }
.puzzle-diagram { background: #fff; border: 1px solid #e7ddd0; border-radius: 8px; }
.data-table th { background: #2a1e23; color: var(--gold); }
.data-table td { color: #dfd1c8; }
.data-table th, .data-table td { border-bottom-color: #51393e; }
.option { background: #1a1418; border-color: #593e48; border-radius: 8px; padding: 15px 16px; min-height: 57px; }
.option:hover { background: #30212a; border-color: #8d5a6b; }
.option.selected { background: #7a53281e; border-color: var(--gold); box-shadow: inset 3px 0 0 var(--gold); }
.option-letter { background: #30222a; border-color: #644550; color: #d5c1b8; }
.option.selected .option-letter { background: var(--gold); color: var(--ink); border-color: var(--gold); }
.option-text { color: #efded2; }
.option-check { color: var(--gold); }
.option:has(input:focus-visible) { outline-color: var(--gold); }
.answer-label { color: #ead9cc; }
.answer-save-row { color: #b5a39b; font-size: 10px; }
.answer-save-row span:last-child { color: var(--gold); }
.hint-box { background: #a6782510; color: #f6dca6; border-color: #9a743e; }
.hint-controls { margin: 4px 0 23px; }
.hint-controls .button { border-color: #826044; color: #f2cf9c; background: #3c2b1b33; }
.hint-controls .button:hover:not(:disabled) { background: #55401f50; }
.question-controls { border-top-color: var(--line); padding-top: 24px; margin-top: auto; }
.grid-cell.on { background: #3b2029; border-color: var(--gold); }

/* Vault progress intentionally uses text labels as well as color states. */
.vault-console {
  position: relative;
  overflow: hidden;
  background: linear-gradient(110deg, #221a1b, #131114);
  border: 1px solid #705037;
  border-radius: 12px;
  padding: 23px;
  box-shadow: inset 0 1px 0 #edca8612;
  margin: 0 0 25px;
}
.vault-console::before { content: ''; position: absolute; top: 0; left: 24px; right: 24px; height: 2px; background: linear-gradient(90deg, transparent, #b9873b, transparent); pointer-events: none; }
.vault-console h2 { font-family: var(--heading); font-size: 18px; margin: 0 0 8px; letter-spacing: -.3px; }
.vault-console > p { color: #baa69a; font-size: 12px; line-height: 1.7; margin: 6px 0 18px; }
.vault-console .eyebrow { font-size: 8px; margin-bottom: 12px; }
.vault-progress { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.fragment-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
  padding: 17px 14px;
  border: 1px solid #523b42;
  background: #0e0c0f90;
  border-radius: 7px;
}
.fragment-card > span:first-child, .fragment-card > small { font-size: 9px; color: #b3a099; letter-spacing: .4px; line-height: 1.5; }
.fragment-card strong:not(.fragment-value), .fragment-card h3 { margin: 0; font-size: 11px; font-weight: 600; color: #e4d1c2; line-height: 1.5; }
.fragment-value { display: block; color: #796368; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 28px; font-weight: 600; line-height: 1.2; letter-spacing: 5px; font-variant-numeric: tabular-nums; padding: 5px 0; }
.fragment-card.locked, .fragment-card[data-status='locked'] { border-color: #4c343d; }
.fragment-card.pending, .fragment-card[data-status='pending'] { border-style: dashed; border-color: #98764b; background: #aa7d2510; }
.fragment-card.pending .fragment-value, .fragment-card[data-status='pending'] .fragment-value { color: #d6b887; }
.fragment-card.unlocked, .fragment-card[data-status='unlocked'] { border-color: #a78547; background: linear-gradient(130deg, #8e642420, #0e0c0f90); }
.fragment-card.unlocked .fragment-value, .fragment-card[data-status='unlocked'] .fragment-value { color: var(--gold-bright); }
.fragment-card.unlocked::after, .fragment-card[data-status='unlocked']::after { content: '✓'; position: absolute; top: 10px; right: 11px; color: var(--gold); font-size: 12px; }
.fragment-card .status, .fragment-card .fragment-status { font-size: 9px; font-weight: 600; color: #c19fa5; line-height: 1.5; }
.fragment-card.pending .status, .fragment-card.pending .fragment-status { color: #e8c88d; }
.fragment-card.unlocked .status, .fragment-card.unlocked .fragment-status { color: var(--gold); }
.navigator-panel .vault-console { padding: 15px; margin-top: 22px; margin-bottom: 17px; }
.navigator-panel .vault-progress { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.navigator-panel .fragment-card { padding: 12px 10px; }
.navigator-panel .fragment-value { font-size: 23px; letter-spacing: 3px; }

.section-status-card { border: 1px solid #745243; border-radius: 9px; padding: 19px; margin: 23px 0; background: #a7762310; }
.section-status-card h3 { font-family: var(--heading); font-size: 16px; margin: 0 0 8px; color: #f7dfb9; }
.section-status-card p { color: #cbb39e; font-size: 12px; line-height: 1.75; margin: 6px 0; }
.section-status-card .button { margin-top: 13px; }
.section-status-card.pending { border-style: dashed; }
.section-status-card.unlocked { border-color: #93733d; background: #ac7b2312; }
.section-submit { width: 100%; margin-top: 12px; min-height: 46px; }
.rescue-panel { margin: 23px 0; padding: 23px; border: 1px solid #92652f; border-left: 3px solid var(--gold); border-radius: 8px; background: linear-gradient(115deg, #9b6b1b12, #171316); }
.rescue-panel h3 { font-family: var(--heading); font-size: 20px; margin: 0 0 10px; color: var(--gold-bright); }
.rescue-panel p { color: #d4bfa4; line-height: 1.8; font-size: 13px; }
.rescue-panel .options { margin: 18px 0; }
.final-vault-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding-top: 22px; margin-top: 20px; border-top: 1px solid #76583960; }
.final-vault-form label { display: block; width: 100%; color: #dac19b; font-size: 11px; font-weight: 600; margin-bottom: -3px; }
.final-vault-form input { flex: 1 1 200px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 22px; letter-spacing: 5px; min-height: 48px; text-transform: uppercase; }
.final-vault-form .button { flex: 0 0 auto; min-height: 48px; }
.final-vault-form .field-help, .final-vault-form [role='status'] { width: 100%; margin: 0; font-size: 11px; line-height: 1.7; }
.score-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid #5c433b; border-radius: 9px; margin: 22px 0; background: #181315; }
.score-strip > div { padding: 18px 15px; border-right: 1px solid #5c433b; min-width: 0; }
.score-strip > div:last-child { border-right: 0; }
.score-strip strong { display: block; color: var(--gold); font-family: var(--heading); font-size: 27px; font-variant-numeric: tabular-nums; letter-spacing: -.6px; margin: 0 0 7px; }
.score-strip span, .score-strip small { font-size: 10px; color: #bba99c; line-height: 1.6; }
.server-status { display: flex; align-items: center; gap: 8px; color: #baa597; font-size: 10px; line-height: 1.7; padding: 9px 0; }
.server-status::before { content: ''; flex-shrink: 0; width: 6px; height: 6px; border-radius: 50%; background: #987347; }
.server-status.connected::before, .server-status[data-status='connected']::before { background: #bfdbb9; }
.server-status.error, .server-status[data-status='error'] { color: #ffb0bd; }
.server-status.error::before, .server-status[data-status='error']::before { background: #f97592; }

.result-layout { max-width: 860px; }
.result-card { max-width: none; border-radius: 18px; border-top: 2px solid var(--gold); padding: 38px; }
.result-mark { background: #6e4c201a; border-color: #98723c; color: var(--gold); }
.result-card .eyebrow { color: var(--gold); }
.result-card h1 { font-size: 35px; }
.result-team { color: #e7ccb5; }
.result-members > div { border-bottom-color: #473039; }
.submission-stats { background: #241b20; border-color: #50373f; }
.submission-stats strong, .final-score strong { color: var(--gold); }
.result-meta span { color: #bdaca1; }
.result-meta strong { color: #e4d0c1; }
.result-note { color: #c0ada2; max-width: 570px; }
.review-details pre { background: #100d10; color: #e0cbbd; }
.review-details h3 { color: var(--gold); }
.submit-dialog { background: #21191d; border-color: #7b495b; border-radius: 13px; box-shadow: 0 28px 90px #000a; }
.submit-dialog::backdrop { background: #080508d9; backdrop-filter: blur(6px); }
.submit-dialog h2 { color: #f7e7d7; font-size: 27px; }
.dialog-close { color: #d0b6af; }
.site-footer { max-width: 1216px; padding: 25px 0; border-color: var(--line); color: #ae968b; font-size: 9px; }
.site-footer span:last-child { color: #b09a8d; }

/* Coordinator views share the event identity, with a quieter working surface. */
.admin-layout { max-width: 1240px; padding: 0 28px; margin: 35px auto 65px; display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 25px; align-items: start; }
.admin-layout > header, .admin-layout > .admin-header, .admin-layout > .admin-toolbar { grid-column: 1 / -1; }
.admin-layout h1 { font-family: var(--heading); font-size: 32px; letter-spacing: -1.1px; margin: 12px 0; }
.admin-teamlist { background: #171216; border: 1px solid #49343d; border-radius: 11px; padding: 17px; min-width: 0; }
.admin-teamlist h2 { font-family: var(--heading); font-size: 15px; margin: 0 0 14px; }
.admin-teamlist > input { width: 100%; font-size: 12px; margin-bottom: 14px; }
.admin-teamlist > button, .admin-teamlist .team-item { display: block; width: 100%; text-align: left; background: #21181e; border: 1px solid #533a43; border-radius: 7px; color: #e6cfc1; padding: 13px; margin-top: 9px; font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.admin-teamlist > button:hover, .admin-teamlist .team-item:hover { background: #35212c; border-color: #916073; }
.admin-teamlist > button.active, .admin-teamlist .team-item.active, .admin-teamlist [aria-current='true'] { border-color: var(--gold); box-shadow: inset 3px 0 0 var(--gold); background: #73522720; }
.admin-teamlist .team-item small, .admin-teamlist > button small { display: block; color: #b7a195; font-size: 10px; margin-top: 3px; }
.admin-review-card { background: linear-gradient(130deg, #20171d, #151115); border: 1px solid #533743; border-radius: 12px; padding: 27px; margin-bottom: 20px; min-width: 0; }
.admin-review-card h2, .admin-review-card h3 { font-family: var(--heading); margin: 0 0 12px; color: #f0decb; line-height: 1.5; }
.admin-review-card h2 { font-size: 23px; letter-spacing: -.6px; }
.admin-review-card h3 { font-size: 16px; }
.admin-review-card p { color: #c4afa4; font-size: 13px; line-height: 1.8; }
.admin-review-card pre { overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; background: #0d0b0e; border: 1px solid #47303a; border-radius: 8px; padding: 16px; color: #e9cfb8; font-size: 12px; line-height: 1.8; }
.admin-review-card label { color: #dbc5b4; font-size: 12px; line-height: 1.8; }
.admin-review-card .button { margin: 8px 8px 0 0; }
.admin-review-card table { width: 100%; border-collapse: collapse; font-size: 12px; }
.admin-review-card th { text-align: left; color: var(--gold); background: #2a1e23; }
.admin-review-card th, .admin-review-card td { padding: 12px; border-bottom: 1px solid #50343e; line-height: 1.6; }
.admin-review-card td { color: #ddc7b9; }

@media (min-width: 1000px) {
  .admin-teamlist { position: sticky; top: 25px; max-height: calc(100vh - 50px); overflow: auto; scrollbar-width: thin; scrollbar-color: #79514c transparent; }
  .navigator-panel { top: 153px; max-height: calc(100vh - 175px); }
}
@media (max-width: 1100px) {
  .welcome-layout { gap: 43px; grid-template-columns: minmax(0, 1fr) minmax(350px, 420px); }
  .welcome-story h1 { font-size: 70px; letter-spacing: -4.5px; }
  .quiz-columns { grid-template-columns: 255px minmax(0, 1fr); gap: 19px; }
  .navigator-panel { padding: 17px; }
  .question-panel { padding: 26px; }
  .hero-facts { gap: 28px; }
  .fragment-card { padding: 14px 10px; }
}
@media (max-width: 850px) {
  .site-header { padding: 20px 24px; }
  .welcome-layout { grid-template-columns: minmax(0, 1fr); max-width: 590px; gap: 33px; margin-top: 33px; }
  .welcome-story h1 { font-size: 76px; letter-spacing: -4.8px; }
  .hero-facts { justify-content: space-between; gap: 20px; }
  .finale-hero::after { width: 225px; height: 225px; right: -16px; top: 26px; }
  .entry-card { padding: 28px; }
  .quiz-columns { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .navigator-panel { order: 2; }
  .question-panel { order: 1; }
  .navigator-panel .vault-progress { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .quiz-topline { padding: 12px 0 16px; }
  .quiz-title { font-size: 27px; }
  .timer-box { min-width: 146px; }
  .timer-box strong { font-size: 31px; }
  .section-preview { display: block; }
  .site-footer { margin: 0 25px; }
  .admin-layout { grid-template-columns: minmax(0, 1fr); padding: 0 22px; }
  .admin-teamlist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .admin-teamlist h2, .admin-teamlist > input { grid-column: 1 / -1; }
  .admin-teamlist > button, .admin-teamlist .team-item { margin: 0; }
}
@media (max-width: 540px) {
  .site-header { padding: 17px 18px; }
  .brand { gap: 10px; }
  .brand-name { font-size: 22px; }
  .brand-eyebrow { font-size: 6.5px; letter-spacing: .9px; }
  .logo-frame img { width: 43px; height: 43px; }
  .header-round { font-size: 0; max-width: 78px; gap: 7px; }
  .header-round::after { content: 'THE FINALE'; font-size: 8px; letter-spacing: 1px; color: #edca86; white-space: nowrap; }
  .header-round .signal-dot { margin-right: 0; width: 5px; height: 5px; }
  .welcome-layout { padding: 0 19px; margin-top: 27px; margin-bottom: 45px; }
  .welcome-story { padding-top: 0; }
  .welcome-story h1 { font-size: clamp(54px, 15vw, 72px); letter-spacing: -3.6px; line-height: 1; margin-top: 25px; }
  .hero-description { font-size: 15px; }
  .hero-facts { padding: 20px 0; gap: 12px; }
  .hero-facts strong { font-size: 25px; }
  .hero-facts span { font-size: 8px; }
  .finale-badge { font-size: 8px; letter-spacing: 1.6px; }
  .finale-subtitle { font-size: 12px; }
  .finale-hero::after { width: 190px; height: 190px; right: -25px; top: 40px; opacity: .55; }
  .entry-card { padding: 23px 20px; }
  .entry-card h2 { font-size: 24px; }
  .section-preview { margin-top: 26px; }
  .section-preview > div { padding: 14px 0; }
  .section-preview small { font-size: 9px; }
  .quiz-layout { padding: 0 15px; margin-top: 17px; }
  .quiz-topline { gap: 11px; }
  .quiz-title { font-size: 23px; max-width: 195px; letter-spacing: -.8px; }
  .quiz-topline .eyebrow { font-size: 7px; letter-spacing: 1.2px; }
  .timer-box { min-width: 112px; padding: 10px; }
  .timer-box strong { font-size: 27px; }
  .timer-box > span, .timer-box small { font-size: 6px; }
  .question-panel { padding: 23px 18px; border-radius: 11px; }
  .question-panel h2, #question-title { font-size: 21px; }
  .question-stem { font-size: 13px; }
  .question-heading { margin-bottom: 19px; gap: 10px; }
  .section-badge { font-size: 8px; padding: 6px 8px; }
  .question-position { font-size: 9px; }
  .option { padding: 13px 12px; gap: 11px; }
  .option-text { font-size: 12px; }
  .code-block { font-size: 12px; padding: 14px; }
  .question-controls { gap: 6px; padding-top: 20px; }
  .question-controls .button { font-size: 10px; padding: 10px 10px; }
  .hint-controls { margin-bottom: 19px; gap: 10px; }
  .answer-save-row { font-size: 9px; flex-wrap: wrap; }
  .vault-console { padding: 19px 16px; }
  .vault-progress, .navigator-panel .vault-progress { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .fragment-card { padding: 14px 12px; }
  .fragment-value { font-size: 27px; }
  .score-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .score-strip > div { padding: 16px 12px; }
  .score-strip > div:nth-child(2) { border-right: 0; }
  .score-strip > div:nth-child(-n+2) { border-bottom: 1px solid #5c433b; }
  .score-strip strong { font-size: 25px; }
  .section-status-card, .rescue-panel { padding: 18px; }
  .final-vault-form input { flex-basis: 100%; width: 100%; }
  .final-vault-form .button { width: 100%; }
  .result-layout { padding: 0 15px; margin-top: 32px; }
  .result-card { padding: 28px 18px; }
  .result-card h1 { font-size: 29px; }
  .result-meta { flex-wrap: wrap; gap: 18px; }
  .result-meta > div { min-width: 125px; }
  .submit-dialog { padding: 28px 22px; }
  .dialog-actions { flex-wrap: wrap; }
  .dialog-actions .button { flex: 1; padding: 11px 12px; }
  .site-footer { margin: 0 20px; padding: 21px 0; font-size: 7px; gap: 20px; }
  .site-footer span:last-child { font-size: 8px; line-height: 1.7; }
  .admin-layout { padding: 0 15px; margin-top: 25px; gap: 18px; }
  .admin-layout h1 { font-size: 27px; }
  .admin-teamlist { grid-template-columns: minmax(0, 1fr); padding: 15px; }
  .admin-review-card { padding: 22px 18px; }
  .admin-review-card h2 { font-size: 21px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  button:hover:not(:disabled) { transform: none; }
}
@media (forced-colors: active) {
  .fragment-card, .option, .vault-console, .section-status-card, .rescue-panel { border: 1px solid CanvasText; }
  .fragment-card.unlocked, .option.selected { outline: 2px solid Highlight; outline-offset: -3px; }
  .ambient, .finale-hero::after { display: none; }
}

.brand{text-decoration:none;color:inherit}.site-footer a{color:var(--muted);text-decoration:none}.admin-mark-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:18px}.admin-answer{white-space:pre-wrap;overflow-wrap:anywhere;font:inherit;line-height:1.7}.admin-review-card details pre{white-space:pre-wrap;overflow-wrap:anywhere;font:inherit;line-height:1.7}.admin-teamlist>div button{width:100%;display:block;text-align:left;margin:9px 0}.admin-teamlist>div button strong,.admin-teamlist>div button span{display:block}.admin-teamlist>div button span{font-size:10px;color:var(--muted);margin-top:6px}.rescue-panel .option{padding:12px}.rescue-panel{max-height:90vh;overflow-y:auto}.final-vault-form input{width:100%;font:inherit;letter-spacing:4px;padding:14px;margin:12px 0;background:#100d10;border:1px solid #6d563a;color:#f6de9a;border-radius:8px}.final-vault-form .button{width:100%}.section-status-card p{margin:0;line-height:1.7}.section-submit{width:100%;margin-top:18px}.final-score strong{color:var(--gold,var(--green))}.fragment-card .button{margin:8px 0 0;font-size:10px;padding:7px;min-height:32px}

/* Warm paper surfaces keep long puzzles readable inside the finale setting. */
:is(.question-panel, .rescue-panel) {
  --text: #30252b;
  --muted: #64575b;
  --line: #d9cabc;
  --gold: #795819;
  --gold-bright: #684618;
  --blue: #7d263f;
  --green: #72551c;
  color-scheme: light;
  background: #fbf6ee;
  color: var(--text);
  border-color: #cfbaa0;
}
:is(.question-panel, .rescue-panel) :is(h2, h3, #question-title, .answer-label) { color: #30252b; }
.question-panel .section-badge { background: #f0e0e4; border-color: #d0a2ad; color: #73263e; }
.question-panel .question-position { color: #66555b; }
:is(.question-panel, .rescue-panel) :is(.question-stem, p, legend) { color: #45383d; }
:is(.question-panel, .rescue-panel) :is(.field-help, .muted, .diagram-description, .answer-save-row) { color: #64575b; }
:is(.question-panel, .rescue-panel) .code-block { background: #f1ebe4; border-color: #d4c3b6; border-left-color: #9d3a54; color: #392b31; }
.question-panel .data-table th { background: #eedfc8; color: #59401e; }
.question-panel .data-table td { color: #45383d; background: #fffaf4; }
.question-panel .data-table :is(th, td) { border-bottom-color: #d7c7b7; }
:is(.question-panel, .rescue-panel) .option { background: #fffdf9; border-color: #d6c6b9; }
:is(.question-panel, .rescue-panel) .option:hover { background: #f7ecdf; border-color: #a27359; }
:is(.question-panel, .rescue-panel) .option.selected { background: #f3e4cd; border-color: #956426; box-shadow: inset 3px 0 0 #956426; }
:is(.question-panel, .rescue-panel) .option-letter { background: #f0e7dc; border-color: #cfbca9; color: #634b3e; }
:is(.question-panel, .rescue-panel) .option.selected .option-letter { background: #795819; border-color: #795819; color: #fff; }
:is(.question-panel, .rescue-panel) .option-text { color: #352a2f; line-height: 1.65; }
.question-panel #answer-text { background: #fffdf9; border-color: #bfa997; color: #30252b; }
.question-panel #answer-text::placeholder { color: #74646a; }
.question-panel .answer-save-row span:last-child { color: #795819; }
.question-panel .hint-box { background: #f7e9c9; border-color: #b88c43; color: #5b4017; }
:is(.question-panel, .rescue-panel) .button-primary { background: #7d263f; border-color: #7d263f; color: #fffaf4; }
:is(.question-panel, .rescue-panel) .button-primary:hover:not(:disabled) { background: #632038; border-color: #632038; }
:is(.question-panel, .rescue-panel) .button-secondary { background: #efe1ce; border-color: #bfa383; color: #644322; }
:is(.question-panel, .rescue-panel) .button-secondary:hover:not(:disabled) { background: #e6d1b7; }
:is(.question-panel, .rescue-panel) .button-quiet { color: #684a3c; }
:is(.question-panel, .rescue-panel) .button-quiet:hover:not(:disabled) { background: #ebddcf; }
.question-panel .hint-controls .button { background: #f5e8cf; border-color: #b68c49; color: #614218; }
.question-panel .hint-controls .button:hover:not(:disabled) { background: #ead5ae; }
.question-panel .section-status-card { background: #f2e8d7; border-color: #bea178; }
.question-panel .section-status-card :is(h3, p) { color: #594429; }
.question-panel .grid-cell.on { background: #513039; border-color: #81541e; color: #fff; }
.rescue-panel .dialog-close { color: #6d4350; }
.rescue-panel .eyebrow { color: #795819; }
.rescue-panel .dialog-warning { background: #f3e4cf; border-color: #be9770; color: #59432c; }

.result-highlights { display: grid; grid-template-columns: 1fr 1fr; margin: 30px 0 15px; border: 1px solid #72593d; border-radius: 12px; background: linear-gradient(120deg, #33251d, #1c151b); }
.result-highlights > div { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 15px; min-width: 0; }
.result-highlights .final-score { margin: 0; border-right: 1px solid #72593d; }
.result-highlights .metric-label { color: #e0c4a9; font-size: 10px; letter-spacing: 1.3px; text-transform: uppercase; margin-bottom: 12px; }
.result-highlights strong { font-family: var(--heading); color: #ffe0a5; font-size: 57px; line-height: 1.2; font-variant-numeric: tabular-nums; letter-spacing: -1.5px; }
.result-highlights .metric-unit { color: #d2bca9; font-size: 11px; margin-top: 9px; }
#result-time-note { color: #c0ada2; margin: 12px 0 24px; font-size: 11px; line-height: 1.7; }
@media (max-width: 540px) {
  .result-highlights > div { padding: 22px 9px; }
  .result-highlights .metric-label { font-size: 8px; letter-spacing: .5px; }
  .result-highlights strong { font-size: 40px; }
  .result-highlights .metric-unit { font-size: 10px; }
}
