:root { color-scheme: dark; background: #21140f; color: #fff1d3; font: 500 16px system-ui, sans-serif; }
* { box-sizing: border-box; }
body { margin: 0; }
main { position: relative; width: 100%; height: 100dvh; overflow: hidden; }
.cabinet { position: absolute; inset: 0; }
canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
[hidden] { display: none !important; }
.intro { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: center; gap: clamp(8px, 3vw, 48px); padding: clamp(22px, 7vw, 110px); }
.intro-copy { position: relative; z-index: 1; max-width: 36rem; }
#start { border: 1px solid #ffe1a1; border-radius: 8px; min-width: 9.5rem; min-height: 48px; background: #ffd38a; color: #2b1a0d; font-size: 1.05rem; font-weight: 800; box-shadow: 0 4px 0 #a7692b, 0 9px 20px #0a0a0766; }
#start:disabled { opacity: .6; cursor: wait; }
.intro-art { position: relative; align-self: center; aspect-ratio: 1.52; filter: drop-shadow(0 20px 16px #17171745); }
.intro-art img { display: block; position: absolute; pointer-events: none; }
.intro-sleigh { width: 100%; top: -94%; left: 0; }
.intro-present { width: 19%; left: 29%; top: 24%; transform: rotate(-16deg); }
.intro-bear { width: 23%; left: 49%; top: 12%; transform: rotate(8deg); }
@media (max-width: 700px) and (orientation: portrait) {
  .intro { min-height: 100dvh; height: auto; display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: max(26px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom)); }
  .intro-copy { text-align: center; }
}
@media (orientation: landscape) and (max-height: 540px) {
  .intro { padding: 12px 5vw; }
}
h1, h2 { font-family: Georgia, serif; font-weight: normal; }
h1 { margin: 2px 0; font-size: clamp(1.45rem, 5vw, 2.25rem); }
.hud { display: flex; justify-content: space-between; align-items: center; position: absolute; inset: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) auto max(12px, env(safe-area-inset-left)); pointer-events: none; }
.hud button { pointer-events: auto; }
#score, button { border: 1px solid #b88d58; border-radius: 999px; background: #27160fee; color: inherit; font: inherit; font-size: .78rem; padding: .52em .8em; }
button { cursor: pointer; min-height: 36px; }
button:hover, button[aria-pressed=true] { background: #684026; }
button:focus-visible { outline: 2px solid #ffe1a2; outline-offset: 2px; }
#status { position: absolute; left: 50%; bottom: calc(max(10px, env(safe-area-inset-bottom)) + 45px); transform: translateX(-50%); width: max-content; max-width: calc(100% - 16px); font-size: .84rem; text-align: center; margin: 0; padding: 6px 11px; border-radius: 8px; background: #20120de8; pointer-events: none; }
#result { position: absolute; border: 1px solid #d7a467; text-align: center; overflow: auto; }
#share-link { margin-top: 10px; width: 100%; }
footer { position: absolute; inset: auto 0 max(10px, env(safe-area-inset-bottom)); display: flex; justify-content: center; gap: 8px; pointer-events: none; }
footer button { pointer-events: auto; }
@media (max-width: 640px) and (orientation: portrait) {
  .hud { top: calc(max(10px, env(safe-area-inset-top)) + 48px); }
}
@media (orientation: landscape) and (max-height: 540px) {
  h1 { font-size: clamp(1.15rem, 3vw, 1.7rem); }
  .hud { top: calc(max(12px, env(safe-area-inset-top)) + 48px); }
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#placement { position: absolute; inset: 0; }
#placement:focus-visible { outline: 3px solid #ffe0a6; outline-offset: -4px; }
summary:focus-visible, .settings-panel a:focus-visible, input:focus-visible { outline: 2px solid #ffe1a2; outline-offset: 3px; }
#settings { position: relative; pointer-events: auto; }
#settings summary { display: grid; min-height: 36px; place-items: center; border: 1px solid #b88d58; border-radius: 999px; background: #27160fee; font-size: .78rem; padding: .52em .8em; cursor: pointer; list-style: none; }
#settings summary::-webkit-details-marker { display: none; }
.settings-panel { position: absolute; bottom: calc(100% + 8px); left: 0; width: min(236px, 72vw); padding: 10px 12px; display: grid; justify-items: start; gap: 5px; border: 1px solid #d7a467; border-radius: 12px; background: #321c13; font-size: .86rem; }
.settings-panel label { display: flex; align-items: center; gap: .45rem; min-height: 35px; }
.settings-panel input { accent-color: #f1bf70; }
#score { position: absolute; display: grid; }
#score strong { font: 800 clamp(1.8rem, 5vw, 2.55rem)/1 system-ui, sans-serif; font-variant-numeric: tabular-nums; color: #ffe1aa; }
#score span { font-size: .72rem; font-weight: 650; }
#sound { margin-left: auto; }
#status { font-weight: 650; }
.result-count { display: grid; margin: 8px 0; }
.result-count strong { font-size: 3.4rem; line-height: 1; color: #ffe1aa; font-variant-numeric: tabular-nums; }
#record { margin: .65rem 0 1.1rem; font-size: .9rem; }
.result-actions { display: grid; gap: 8px; }
.result-actions button { min-height: 44px; }
#replay { border-color: #ffe1a1; background: #ffd38a; color: #2b1a0d; font-size: 1rem; font-weight: 800; }
#start { border-radius: 999px; box-shadow: none; }
.intro a { color: #171717; }
.intro a:focus-visible, #start:focus-visible { outline-color: #171717; }
@media (max-width:700px) and (orientation:portrait) { .intro-art { width:min(100%,330px,38dvh); } }
@media (orientation:landscape) and (max-height:540px) { .intro { overflow:auto; } }
#playfield button, #settings summary { min-height: 44px; }


.competition-intro {
  color-scheme: dark;
  color: #fff4df;
  background: linear-gradient(90deg,#17110df7 0%,#1b140ee8 40%,#25170a28 100%), url("assets/workshop-wide.webp") center / cover;
}
.competition-intro h1 { color: #fff4df; }
.competition-intro a:focus-visible, .competition-intro #start:focus-visible { outline-color: #fff4df; }
.competition-intro #start, .competition-intro #start:not(:disabled):hover { color: #26180e; background: #ffd38a; border-color: #ffe1a1; }
#score span:first-child { display: flex; gap: .45rem; align-items: baseline; }
@media (max-width:700px) and (orientation:portrait) {
  .competition-intro { background-image: linear-gradient(180deg,#16100af9 0%,#1b140ee8 48%,#25170a28 100%),url("assets/workshop-wide.webp"); }
}
@media (orientation:landscape) and (max-height:540px) {
  .competition-intro h1 { font-size: clamp(1.9rem,4.4vw,2.8rem); }
}

.competition-intro { align-items: center; }
.parchment {
  --paper: radial-gradient(ellipse at 42% 45%,#fff4d8 12%,#f1d8a8 72%,#d8ac70);
  color: #462716;
  color-scheme: light;
  background: var(--paper);
  border: 1px solid #ac7643;
  box-shadow: inset 0 0 16px #a45e282f, 0 8px 30px #0e07078c;
}
.arrival {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  text-align: center;
}
.scroll-paper {
  position: relative;
  border-radius: 7px;
}
.scroll-paper::before,.scroll-paper::after {
  content: "";
  position: absolute;
  height: 9px;
  inset-inline: -7px;
  border-radius: 999px;
  background: linear-gradient(#8f532b,#ebc989 40%,#dbad68 60%,#895028);
  box-shadow: 0 2px 5px #26130775;
}
.scroll-paper::before { top: -5px; }
.scroll-paper::after { bottom: -5px; }
.scroll-paper p { margin: 4px 0; }
.competition-name { font: 800 .68rem/1.25 system-ui,sans-serif; text-transform: uppercase; letter-spacing: .14em; color: #713b26; }
.scroll-paper .opening-thought { font: italic clamp(1.04rem,3.2vw,1.36rem)/1.3 Georgia,serif; margin: 8px auto; max-width:34ch; }
.parchment button { color:#522e1c; border-color:#a36f45; background:#f8e6be; }
.parchment button:hover { background:#fff4d9; }
.parchment button:focus-visible,.parchment a:focus-visible { outline: 2px solid #762e24; outline-offset: 2px; }
#begin,.parchment #replay { color:#fff5e3; background:#762e24; border-color:#762e24; font-weight:750; }
#begin:hover,.parchment #replay:hover { background:#57231d; }
#playfield #score {
  background: radial-gradient(ellipse at 30% 20%,#fff3d5,#eac995);
  color: #462716;
  padding: 5px 11px 7px; border-radius: 6px; gap: 2px;
  font-family: Georgia,serif;
}
#score span { font-size: .78rem; }
#score strong { color:#582c1d; font:800 clamp(2rem,5vw,2.7rem)/1 Georgia,serif; }
#playfield #score.best-passed { border-color:#8e3f27; }
.back-to-games { color: inherit; display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px; pointer-events: auto; }
footer .back-to-games { border-radius: 999px; background: #27160fee; font-size: .78rem; border: 1px solid #b88d58; }
.round-ended .hud,.round-ended footer { display:none; }
.round-ended #result {
  background: var(--paper);
  border-radius: 8px;
  outline: 1px solid #a56b4480; outline-offset:-6px;
}
#result .competition-name { margin: 0 29px 8px; }
#seal {
  display:grid; place-items:center; color:#ffe1b0; background:#8c3430;
  position:absolute; right:12px; top:12px; border:2px double #ef9a72;
  width:36px; aspect-ratio:1; border-radius:48% 50% 45% 49%;
  font-size:1.1rem; box-shadow:0 2px 3px #46271670;
}
#result h2 { font-size:clamp(1.2rem,3vw,1.8rem); margin:0; }
#result .result-count { margin:5px 0; }
#result .result-count strong { color:#683526; font:800 clamp(2.4rem,5vw,3.3rem)/1 Georgia,serif; }
#result #record { margin:3px 0; font-size:.83rem; }
#result .result-actions { display:flex; flex-wrap:wrap; justify-content:center; gap:5px; margin:8px 0 0; }
#result .result-actions button { padding-inline:10px; }
#result .back-to-games { font-size:.85rem; }
@media (max-width:700px) and (orientation:portrait) {
  #playfield .hud { top:max(12px,env(safe-area-inset-top)); }
}
@media (orientation:landscape) and (max-height:540px) {
  #playfield .hud { top:max(12px,env(safe-area-inset-top)); }
}
@media (prefers-reduced-motion:reduce) {
  .scroll-paper,.arrival.rolling .scroll-paper,.round-ended #result { animation:none!important; }
}

/* Proclamation, contest and award. */
.arrival { inset:0; padding:16px 24px; background:#1f130c42; }
.scroll-paper {
  width:min(100%,660px);
  padding:clamp(20px,5dvh,48px) clamp(20px,7vw,72px);
  transform-origin:center;
  animation:unroll .72s .08s both cubic-bezier(.18,.72,.24,1);
}
.scroll-paper::before,.scroll-paper::after {
  height:15px; inset-inline:-9px;
  background:linear-gradient(#623621,#fbe2a3 33%,#c88d53 64%,#673723);
}
.scroll-paper::before { top:-7px; }
.scroll-paper::after { bottom:-7px; }
.scroll-paper > :is(p,button) { animation:proclamation .45s .28s both ease-out; }
@keyframes proclamation { from { opacity:0; } to { opacity:1; } }
@keyframes unroll {
  from { transform:scaleY(.055); opacity:.15; filter:brightness(1.25); }
  to { transform:scaleY(1); opacity:1; }
}
.arrival.rolling { background:transparent; transition:background .55s ease; }
.arrival.rolling .scroll-paper { animation:roll-away .56s both ease-in; }
@keyframes roll-away {
  55% { filter:brightness(1.32); }
  to { transform:scaleY(.045); opacity:0; filter:brightness(1.48); }
}
.scroll-paper .competition-name { font-size:clamp(.75rem,2.3vw,.95rem); }
.scroll-paper .opening-thought {
  font-size:clamp(1.35rem,4vw,2.15rem); line-height:1.22; margin:14px auto 18px;
}
.scroll-paper #begin { padding-inline:26px; min-height:48px; font-size:.96rem; }
.scroll-sparkle {
  position:absolute; opacity:0; color:#ffe7a4; pointer-events:none;
  text-shadow:0 0 12px #ffad53; font-size:1.35rem;
}
.scroll-sparkle:nth-of-type(1) { left:23%; top:43%; --drift:-22px; }
.scroll-sparkle:nth-of-type(2) { left:73%; top:46%; --drift:19px; }
.scroll-sparkle:nth-of-type(3) { left:57%; top:57%; --drift:11px; }
.rolling .scroll-sparkle { animation:scroll-spark .59s ease-out both; }
@keyframes scroll-spark { 42% { opacity:.85; } to { opacity:0; transform:translate(var(--drift),-32px) scale(.45); } }

#playfield #score {
  inset:0 auto auto 50%; transform:translateX(-50%);
  min-width: min(240px,64vw); max-width:calc(100% - 126px);
  padding:6px clamp(8px,2vw,20px) 8px;
  text-align:center; justify-items:center; gap:2px;
  outline:1px solid #985c394d; outline-offset:-4px;
}
#score .competition-name { margin:0; font-size:clamp(.56rem,2.25vw,.69rem); }
#score .live-total { display:flex; align-items:baseline; gap:7px; font-size:clamp(.68rem,2.5vw,.91rem); }
#score .score-benchmarks { display:flex; justify-content:center; flex-wrap:wrap; column-gap:12px; row-gap:2px; }
#score .score-benchmarks span { font-size:clamp(.63rem,2.1vw,.77rem); }
#score strong { font-size:clamp(2rem,6.4vw,3.2rem); }
#sound { min-width:44px; max-width:76px; }
#playfield footer {
  gap:clamp(5px,1.1vw,14px); inset-inline:8px;
}
#playfield footer :is(button,summary,.back-to-games) {
  min-height:48px; font-size:clamp(.78rem,3.05vw,.94rem); padding-inline:clamp(10px,2.3vw,18px);
}
#playfield #status { bottom:calc(max(10px,env(safe-area-inset-bottom)) + 58px); }
.round-ended #result {
  inset:auto auto max(16px,env(safe-area-inset-bottom)) 50%;
  transform:translateX(-50%); width:min(92vw,680px); max-height:49dvh;
  display:grid; grid-template-columns:1fr 1fr; align-items:center; gap:14px;
  padding:14px 22px; outline-offset:-7px; border-radius:9px;
  animation:award-reveal .53s both ease-out;
}
@keyframes award-reveal { from { opacity:0; } 35% { opacity:.28; } to { opacity:1; } }
#result .competition-name { margin:0 0 5px; }
#result h2 { font-size:clamp(1.17rem,3.1vw,1.85rem); }
#result .result-count strong { font-size:clamp(2.55rem,7vw,4rem); }
#seal { right:8px; top:8px; width:30px; }
@media (max-width:700px) and (orientation:portrait) {
  .round-ended #result { grid-template-columns:1fr; width:calc(100% - 20px); gap:1px; padding:10px 11px 4px; }
  #result .result-actions { margin-top:5px; }
}
@media (orientation:landscape) and (max-height:540px) {
  .arrival .scroll-paper { padding-block:11px; width:min(80vw,570px); }
  .scroll-paper .opening-thought { margin:8px auto; font-size:clamp(1.12rem,3.3vw,1.65rem); }
  #playfield #score { padding-block:3px 5px; }
  #score strong { font-size:1.9rem; }
  .round-ended #result { width:min(82vw,650px); max-height:54dvh; padding:8px 16px; }
  #result .result-count { margin:2px 0; }
  #result .result-count strong { font-size:2.25rem; }
}
@media (prefers-reduced-motion:reduce) {
  .scroll-paper > :is(p,button),.rolling .scroll-sparkle { animation:none; }
  .arrival.rolling { transition:none; }
}
@media (max-width:480px) {
  #playfield #score { width:max-content; min-width:0; max-width:calc(100% - 168px); }
}

.competition-intro .game-title { margin:0 0 clamp(18px,3vw,32px); }
.game-title img { display:block; width:min(100%,510px); height:auto; filter:drop-shadow(0 8px 18px #190c0780); }
@media (max-width:700px) and (orientation:portrait) {
  .game-title img { width:min(100%,380px); margin-inline:auto; }
}
.intro-measurement { margin-top: 1rem; color: #fff4df; font-size: .95rem; }
.intro-measurement button { min-height: 44px; margin: .25rem; padding: .4rem .9rem; border: 1px solid #ffe1a1; border-radius: 999px; background: #1b140e; color: #fff4df; }

/* Worldwide best status and the studio's Steam-interest control on the certificate. */
#result #world-status { margin:3px 0; font-size:.83rem; font-weight:700; }
#result .steam-interest { margin:6px auto 0; max-width:34ch; }
#result .steam-interest button { min-height:44px; padding-inline:12px; font-size:.8rem; }
#result .steam-interest p { margin:3px 0 0; font-size:.68rem; line-height:1.3; }
.intro-policies { margin-top: .75rem; color: #fff4df; font-size: .85rem; }
.intro-policies a { color: inherit; display: inline-block; min-height: 24px; padding: 4px 2px; }
