:root {
  color-scheme: dark;
  --night: #102821;
  --ink: #f8edcf;
  --muted: #ddd0b0;
  --gold: #f5d390;
  --line: #e6c58067;
  --title: Georgia, 'Times New Roman', serif;
  font: 16px/1.5 system-ui, sans-serif;
  color: var(--ink);
  background: var(--night);
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body, h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid #ffe19d; outline-offset: 5px; }
.wrap { width: min(1170px, calc(100% - 72px)); margin-inline: auto; }
.winter-header { background: #0d231e; border-bottom: 1px solid var(--line); }
.top-line { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px; }
.wordmark { display: inline-flex; align-items: center; min-height: 48px; }
.wordmark img { width: clamp(116px, 25vw, 223px); height: auto; display: block; }
.back { font-size: .89rem; font-weight: 650; color: var(--gold); text-decoration: none; }
.back:hover { text-decoration: underline; }
.fair-hero {
  min-height: 580px;
  display: grid;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, #10241dee 2%, #10241d8a 29%, #14282212 62%), url('art/fair.webp') center 54% / cover, #203b31;
}
.hero-copy { padding-block: 44px 58px; }
.eyebrow { color: var(--gold); font-size: .74rem; font-weight: 740; text-transform: uppercase; letter-spacing: .16em; }
.fair-hero h1 { font: 400 clamp(4rem, 9vw, 8.5rem)/.89 var(--title); letter-spacing: -.065em; margin: 17px 0 26px; }
.fair-hero h1 em { font-weight: 400; color: #ffda8d; }
.fair-hero p:not(.eyebrow) { max-width: 27ch; font-size: clamp(1rem, 1.8vw, 1.2rem); text-shadow: 0 1px 12px #0b1a14; }
.gold-button, .quiet-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 21px; min-height: 48px;
  border: 1px solid transparent; border-radius: 6px; padding: 10px 19px; color: #302015; background: #f6d492;
  font-size: .98rem; font-weight: 760; text-decoration: none;
}
.gold-button:hover { background: #ffe6b0; }
.hero-copy .gold-button { margin-top: 25px; }
.quiet-button { border-color: var(--line); color: var(--ink); background: #0a161654; }
.quiet-button:hover { background: #0a1616; }
.fair-games { padding-block: 65px 76px; scroll-margin-top: 20px; }
.section-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; margin-bottom: 23px; }
.section-heading h2 { font: clamp(2.15rem, 4.6vw, 4rem)/1 var(--title); letter-spacing: -.04em; }
.section-heading p { color: var(--muted); }
.fair-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 18px; }
.game-card { grid-column: span 4; min-width: 0; display: flex; flex-direction: column; color: inherit; text-decoration: none; background: var(--card); border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.game-card:nth-child(-n+2), .game-card:nth-last-child(-n+2) { grid-column: span 6; }
.game-card:hover { border-color: var(--gold); }
.game-card:hover .cover img { transform: scale(1.035); }
.cover { display: block; aspect-ratio: 1.65; position: relative; overflow: hidden; }
.game-card:nth-child(-n+2) .cover, .game-card:nth-last-child(-n+2) .cover { aspect-ratio: 2.15; }
.cover img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 44%; transition: transform .3s ease; }
.cover::after { content: ''; position: absolute; inset: 0; background: linear-gradient(0deg, var(--card), transparent 22%); }
.card-copy { flex: 1; display: grid; align-content: start; gap: 7px; padding: 3px 19px 18px; }
.card-copy h3 { font: 400 clamp(1.45rem, 2.4vw, 2.14rem)/1.05 var(--title); letter-spacing: -.025em; }
.card-copy p { font-size: .92rem; color: var(--muted); }
.card-open { margin-top: 4px; color: var(--gold); font-size: .86rem; font-weight: 700; }
footer { border-top: 1px solid var(--line); background: #0d231e; }
footer .wrap { display: flex; flex-wrap: wrap; gap: 12px 25px; justify-content: space-between; padding-block: 23px; color: var(--muted); font-size: .87rem; }
.game { min-height: calc(100svh - 140px); padding-block: 28px 42px; }
.all-games { display: inline-flex; align-items: center; min-height: 44px; margin-bottom: 15px; }
.game-layout { display: grid; grid-template-columns: minmax(200px, .78fr) minmax(0, 1.2fr); align-items: start; gap: 37px; }
.game-intro { padding: clamp(13px, 2.4vw, 27px) 0; }
.game-intro h1 { max-width: 13ch; margin: 12px 0 16px; font: 400 clamp(2.9rem, 5.6vw, 5.6rem)/.91 var(--title); letter-spacing: -.065em; text-wrap: balance; }
#game-story { max-width: 35ch; color: var(--ink); font-size: 1.08rem; }
.instructions { max-width: 37ch; padding-top: 17px; margin-top: 20px; border-top: 1px solid var(--line); color: var(--muted); }
.instructions h2 { color: var(--gold); font-size: .85rem; margin-bottom: 4px; }
.game-intro button { margin-top: 19px; }
body.play-view { background: radial-gradient(ellipse at 66% 12%, var(--card), #101b1a 75%); }
.game-board { min-width: 0; padding: 9px; border: 1px solid #e9cb8692; border-radius: 12px; background: #111d20; box-shadow: 0 20px 52px #060e1461; }
.game-hud { display: flex; justify-content: space-between; gap: 10px; padding: 4px 7px 9px; font-size: .88rem; font-weight: 760; font-variant-numeric: tabular-nums; }
#round-time { color: var(--gold); flex-shrink: 0; }
.stage { aspect-ratio: 12 / 11; overflow: hidden; position: relative; isolation: isolate; border: 1px solid #e7ca7d6b; border-radius: 6px; background: var(--game-art) center / cover, var(--card); }
.stage::after { content: ''; pointer-events: none; position: absolute; inset: 4px; border: 1px solid #ffe4a23d; border-radius: 3px; }
canvas { width: 100%; height: 100%; display: block; touch-action: auto; }
.game.playing canvas { touch-action: none; }
.game-note[data-tone="retry"] { color: #ffcfab; }
.game-note { display: grid; align-items: center; min-height: 39px; padding: 6px 3px 3px; text-align: center; color: var(--muted); font-size: .87rem; }
.controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; }
.controls:empty { display: none; }
.controls button { min-width: 47px; min-height: 44px; padding: 5px 11px; border: 1px solid #f8d4926e; border-radius: 5px; background: #213535; font-weight: 700; touch-action: manipulation; }
.controls button:active, .controls button[aria-pressed="true"] { color: #201710; background: var(--gold); }
.result { position: absolute; inset: 0; display: grid; place-items: center; background: #101a24a6; z-index: 2; padding: 13px; }
.result-card { max-width: 370px; width: 100%; text-align: center; padding: clamp(14px, 3.3vw, 30px); border: 1px solid #efcf91; border-radius: 7px; background: #142822; box-shadow: 0 12px 44px #10151899; }
.result-star { color: var(--gold); display: block; font-size: 1.8rem; line-height: 1; }
.result h2:focus { outline: none; }
.result h2 { font: clamp(1.65rem, 3.15vw, 2.7rem)/1.03 var(--title); margin: 8px 0; }
.result p { color: var(--muted); font-size: .92rem; margin-bottom: 13px; }
.result-back { display: block; margin: 9px 0 0; }
@media (max-width: 940px) {
  .wrap { width: min(1170px, calc(100% - 42px)); }
  .fair-hero { min-height: 480px; }
  .game-layout { gap: 23px; }
}
@media (max-width: 690px) {
  .wrap { width: calc(100% - 32px); }
  .top-line { min-height: 54px; }
  .fair-hero { min-height: 490px; background: linear-gradient(0deg, #10241df9 2%, #10241dbf 35%, #10241d05 76%), url('art/fair.webp') 57% 53% / cover, #203b31; align-items: end; }
  .hero-copy { padding-block: 100px 32px; }
  .fair-hero h1 { font-size: clamp(3.7rem, 14vw, 5.4rem); margin: 11px 0 15px; }
  .fair-games { padding-block: 36px; }
  .fair-grid { gap: 12px; grid-template-columns: 1fr 1fr; }
  .fair-grid .game-card { grid-column: span 1; }
  .fair-grid .cover { aspect-ratio: 1.13; }
  .card-copy { padding: 2px 10px 12px; gap: 5px; }
  .card-copy h3 { font-size: clamp(1.16rem, 4.9vw, 1.7rem); overflow-wrap: anywhere; }
  .card-copy p { font-size: .81rem; line-height: 1.32; }
  .section-heading { margin-bottom: 15px; }
  .section-heading p { font-size: .88rem; }
  .game { padding-block: 7px 24px; }
  .all-games { margin-bottom: 0; min-height: 37px; }
  .game-layout { grid-template-columns: 1fr; gap: 11px; }
  .game-intro { padding: 3px 0 0; }
  .game-intro h1 { max-width: none; font-size: clamp(2.3rem, 10vw, 3.65rem); margin: 3px 0 7px; text-wrap: initial; }
  #game-story { font-size: .93rem; max-width: none; }
  .instructions { padding-top: 5px; margin-top: 6px; max-width: none; font-size: .83rem; }
  .instructions h2 { display: inline; margin-right: 4px; }
  .instructions p { display: inline; }
  .game-intro button { margin-top: 9px; min-height: 44px; }
  body.round-open .game-intro { display: flex; justify-content: space-between; align-items: center; gap: 7px; }
  body.round-open .game-intro h1 { font-size: clamp(1.42rem, 6.2vw, 2.45rem); margin: 0; }
  body.round-open .game-intro :is(.eyebrow, #game-story, .instructions) { display: none; }
  body.round-open .game-intro button { min-width: 68px; margin: 0; padding: 5px 8px; font-size: .78rem; }
  .game-board { padding: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0s !important; }
}

@media (max-width: 690px) { body.round-open:has(#sound:not([hidden])) .game-intro { display: grid; grid-template-columns: 1fr auto; } body.round-open:has(#sound:not([hidden])) .game-intro h1 { grid-column: 1 / -1; } }

.play-view .game-board { border-color: color-mix(in srgb, var(--game-accent) 52%, #293936); }
.play-view .game-intro .eyebrow { color: var(--game-accent); }
.play-view .stage { border-color: color-mix(in srgb, var(--game-accent) 42%, #333938); }
.play-view[data-game="balloon"] .stage { background-position: center 43%; }
.play-view[data-game="toss"] .stage { background-position: center 66%; }
.play-view[data-game="tower"] .stage { background-position: center 58%; }
.play-view[data-game="lantern"] .game-board { background: #161f33; }
.play-view[data-game="bells"] .game-board, .play-view[data-game="tower"] .game-board { background: #261c2c; }
.play-view[data-game="garland"] .game-board { background: #2a1d25; }
.result-card { position: relative; }
.result[data-type="scored"] .result-card { background: radial-gradient(ellipse at 50% 0%, var(--card), #172821 76%); }
.result[data-type="scored"] .result-star::before, .result[data-type="scored"] .result-star::after {
  content: '✧'; position: absolute; top: 16%; font-size: .75em; opacity: .65;
}
.result[data-type="scored"] .result-star::before { left: 18%; }
.result[data-type="scored"] .result-star::after { right: 18%; }
@media (prefers-reduced-motion: no-preference) {
  .result[data-type="scored"] .result-star { animation: reward-star .65s cubic-bezier(.17,.78,.35,1.17) both; }
  @keyframes reward-star {
    from { opacity: .35; transform: translateY(8px) scale(.65); }
    to { opacity: 1; transform: none; }
  }
}

.route-progress {
  display: block;
  appearance: none;
  width: calc(100% - 14px);
  height: 6px;
  margin: 0 7px 9px;
  border: 0;
  border-radius: 9px;
  background: #304e50;
  color: #dbedbb;
  accent-color: #dbedbb;
}
.route-progress::-webkit-progress-bar { border-radius: inherit; background: #304e50; }
.route-progress::-webkit-progress-value { border-radius: inherit; background: #dbedbb; }
.route-progress::-moz-progress-bar { border-radius: inherit; background: #dbedbb; }
.result[data-type="checkpoint"] .result-card { background: #183837; }
