: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; }
header { position: absolute; z-index: 1; top: max(10px, env(safe-area-inset-top)); inset-inline: 0; text-align: center; pointer-events: none; text-shadow: 0 2px 10px #130900, 0 1px 3px #130900; }
[hidden] { display: none !important; }
.wordmark { margin: 0; color: #fff4df; font: 900 1.03rem/1 system-ui, sans-serif; letter-spacing: -.055em; }
.wordmark span { color: #ffc970; }
.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); background: linear-gradient(90deg, #112017f5 0%, #142218e8 35%, #23140e30 100%), url("assets/workshop-wide.webp") center / cover; }
.intro-copy { position: relative; z-index: 1; max-width: 36rem; }
.intro .wordmark { font-size: clamp(1.45rem, 3.5vw, 2.2rem); }
.intro h1 { color: #fff2d7; font-size: clamp(3rem, 7vw, 7rem); line-height: .92; letter-spacing: -.055em; margin: .28em 0 .24em; text-shadow: 0 4px 18px #0c110d99; }
.intro-copy > p:not(.wordmark) { max-width: 32ch; color: #f7e7ca; font-size: clamp(.95rem, 1.6vw, 1.2rem); line-height: 1.5; margin: 0 0 1.4rem; }
#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:not(:disabled):hover { background: #ffe1ae; }
#start:disabled { opacity: .6; cursor: wait; }
.intro-art { position: relative; align-self: center; aspect-ratio: 1.52; filter: drop-shadow(0 28px 22px #160b08aa); }
.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)); background-image: linear-gradient(180deg, #112017fa 0%, #142218e0 34%, #23140e50 100%), url("assets/workshop-wide.webp"); }
  .intro-copy { text-align: center; }
  .intro-copy > p:not(.wordmark) { margin-inline: auto; }
  .intro h1 { font-size: clamp(2.85rem, 11vw, 4.4rem); }
  .intro-art { width: min(100%, 420px, 51dvh); }
}
@media (orientation: landscape) and (max-height: 540px) {
  .intro { padding: 12px 5vw; }
  .intro h1 { font-size: clamp(2rem, 6vw, 3.65rem); }
  .intro-copy > p:not(.wordmark) { margin-bottom: .8rem; }
}
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; width: min(86%, 340px); left: 50%; top: 45%; transform: translate(-50%, -50%); padding: 16px; border: 1px solid #d7a467; border-radius: 16px; background: #321c13f5; text-align: center; }
#result h2 { margin: 0 0 12px; }
#replay { background: #9b3029; }
#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) {
  header { text-align: left; left: max(12px, env(safe-area-inset-left)); right: auto; }
  h1 { font-size: clamp(1.15rem, 3vw, 1.7rem); }
  .hud { top: calc(max(12px, env(safe-area-inset-top)) + 48px); }
}
@media (min-width: 701px) and (min-height: 541px) {
  .intro-art { transform: translateY(12dvh); }
}
.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; }
.intro .intro-links { display: flex; flex-wrap: wrap; gap: 0 1rem; margin-top: .8rem; font-size: .86rem; }
.intro-links a, .settings-panel a { color: #ffe2a9; text-underline-offset: .2em; }
.intro-links a { display: inline-flex; align-items: center; min-height: 36px; }
.intro a:focus-visible, 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; }
@media (max-width: 700px) and (orientation: portrait) { .intro-links { justify-content: center; } }
