@font-face{
  font-family:"Rubik Bubbles";
  src:url("fonts/rubik-cyr.woff2") format("woff2");
  font-weight:400; font-style:normal; font-display:swap;
  unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}
@font-face{
  font-family:"Rubik Bubbles";
  src:url("fonts/rubik-lat.woff2") format("woff2");
  font-weight:400; font-style:normal; font-display:swap;
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face{
  font-family:"Nunito";
  src:url("fonts/nunito-cyr.woff2") format("woff2");
  font-weight:200 1000; font-style:normal; font-display:swap;
  unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}
@font-face{
  font-family:"Nunito";
  src:url("fonts/nunito-lat.woff2") format("woff2");
  font-weight:200 1000; font-style:normal; font-display:swap;
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

:root{
  --u: 720px;
  --plum: #21040f;
  --plum-deep: #140109;
  --cranberry: #8c0a14;
  --cranberry-deep: #56020a;
  --gold: #e2ab4a;
  --gold-light: #f6d58e;
  --gold-deep: #9a5d11;
  --cream: #f6e6bf;
  --cream-warm: #ffeac2;
  --teal: #5cb6c7;
  --grain-opacity: .055;
  --vignette: .42;
  --warm-edge: .12;
}

*{ box-sizing:border-box; }
.sr-only{ position:absolute!important; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
html,body{ height:100%; margin:0; }
body{
  background:var(--plum-deep);
  overflow:hidden;
  font-family:"Nunito",system-ui,sans-serif;
  color:var(--cream);
  -webkit-tap-highlight-color:transparent;
  touch-action:none;
  overscroll-behavior:none;
}
button{ font:inherit; }

#ambient{
  position:fixed; inset:-9%;
  background:url("assets/scene.jpg") center/cover no-repeat;
  filter:blur(26px) saturate(1.42) brightness(.68) contrast(1.05);
  transform:scale(1.12);
  z-index:0;
}
/* In landscape the square scene sits at full height, so the room itself is
   continued into the wide sides: two enlarged, soft copies of the painting's
   own edges (window on the left, fireplace on the right). The page reads as
   one wide shot instead of a column in empty bands. */
#ambientSides{
  position:fixed; inset:0; z-index:0;
  display:none; overflow:hidden;
  pointer-events:none;
  background:var(--plum-deep);
}
#ambientSides .side{
  position:absolute; top:0; bottom:0; width:62%;
  background:url("assets/scene.jpg") no-repeat;
  background-size:auto 250%;
  filter:blur(7px) saturate(1.14) brightness(.64) contrast(1.04);
  transform:scale(1.05);
}
#ambientSides .side-l{
  left:0;
  background-position:left top;
}
#ambientSides .side-r{
  right:0;
  background-position:right center;
}
#ambientSides .side-l::after,
#ambientSides .side-r::after{
  content:""; position:absolute; inset:0;
}
#ambientSides .side-l::after{
  background:linear-gradient(90deg, rgba(18,1,9,.62) 0%, rgba(18,1,9,.22) 45%, transparent 78%);
}
#ambientSides .side-r::after{
  background:linear-gradient(270deg, rgba(18,1,9,.62) 0%, rgba(18,1,9,.22) 45%, transparent 78%);
}
@media (orientation:landscape){
  #ambient{ display:none; }
  #ambientSides{ display:block; }
}
#ambientGlow{
  position:fixed; inset:0; z-index:1; pointer-events:none;
  background:
    radial-gradient(62% 34% at 50% 17%, rgba(255,172,74,.17), transparent 72%),
    radial-gradient(54% 30% at 82% 82%, rgba(255,122,42,.16), transparent 72%),
    radial-gradient(46% 30% at 12% 76%, rgba(84,192,212,.10), transparent 72%),
    radial-gradient(125% 105% at 50% 50%, transparent 48%, rgba(18,1,10,.44) 100%);
}
#snowfall{
  position:fixed; left:0; top:-200px; width:100%; height:calc(100% + 200px);
  z-index:1; pointer-events:none; opacity:.78;
  background-image:
    radial-gradient(1.4px 1.4px at 12px 18px, rgba(255,246,226,.92), transparent 100%),
    radial-gradient(1.1px 1.1px at 72px 84px, rgba(214,238,250,.82), transparent 100%),
    radial-gradient(1.8px 1.8px at 128px 142px, rgba(255,240,210,.72), transparent 100%),
    radial-gradient(1px 1px at 46px 112px, rgba(240,248,255,.72), transparent 100%),
    radial-gradient(1.2px 1.2px at 176px 58px, rgba(255,244,222,.66), transparent 100%),
    radial-gradient(1.5px 1.5px at 158px 186px, rgba(222,242,252,.6), transparent 100%);
  background-size:200px 200px;
  animation:snowDrift 22s linear infinite;
  will-change:transform;
  transform:translate3d(0,0,0);
}
@keyframes snowDrift{
  from{ transform:translate3d(0,0,0); }
  to{ transform:translate3d(0,200px,0); }
}

#stage{
  position:relative; z-index:2;
  width:100%; height:100%;
  display:flex; align-items:center; justify-content:center;
  padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* The portrait bands above and below the square stage are dressed as the
   room itself: a garland hangs in at the top, the near table edge sits in at
   the bottom, and the soft room continues behind both. */
#garland{
  position:fixed; z-index:4; pointer-events:none;
  left:0; right:0; top:0;
  height:calc(var(--band-top, 0px) * .90);
  background:url("assets/layers/ext_garland.webp") left top / auto 100% repeat-x;
  filter:drop-shadow(0 12px 20px rgba(18,0,8,.5));
}
#foreground{
  position:fixed; z-index:4; pointer-events:none;
  left:50%; bottom:0; transform:translateX(-50%);
  height:calc(var(--band-bottom, 0px) * 1);
  aspect-ratio:1024 / 587;
  background:url("assets/layers/ext_foreground.webp") center bottom / 100% 100% no-repeat;
  filter:blur(.7px) drop-shadow(0 -10px 24px rgba(18,0,8,.35));
}
@media (orientation:landscape){
  #garland, #foreground{ display:none; }
}

#board{
  position:relative;
  width:var(--u); height:var(--u);
  isolation:isolate;
}
#scene{
  display:block; width:100%; height:100%;
  background:#250511;
  -webkit-mask-image:linear-gradient(180deg, transparent 0, #000 1.2%, #000 97.4%, transparent 100%);
  mask-image:linear-gradient(180deg, transparent 0, #000 1.2%, #000 97.4%, transparent 100%);
}
@media (orientation:landscape){
  #scene{
    -webkit-mask-image:linear-gradient(90deg, transparent 0, #000 4%, #000 96%, transparent 100%);
    mask-image:linear-gradient(90deg, transparent 0, #000 4%, #000 96%, transparent 100%);
  }
}
#film{
  position:absolute; inset:0; z-index:3; pointer-events:none;
  background:
    radial-gradient(115% 100% at 50% 44%, transparent 48%, rgba(28,2,18,var(--vignette)) 100%),
    linear-gradient(90deg, rgba(84,176,208,var(--warm-edge)) 0%, transparent 24%, transparent 74%, rgba(255,132,44,calc(var(--warm-edge) * 1.25)) 100%),
    radial-gradient(48% 60% at 92% 64%, rgba(255,124,38,.10), transparent 70%),
    radial-gradient(36% 52% at 7% 30%, rgba(110,210,225,.09), transparent 70%);
  mix-blend-mode:normal;
}
#film::after{
  content:""; position:absolute; inset:-30%;
  background-image:url("assets/fx/grain.png");
  background-size:128px 128px;
  opacity:var(--grain-opacity);
  mix-blend-mode:soft-light;
  animation:grainShift 1.7s steps(2) infinite;
}
@keyframes grainShift{
  0%{ transform:translate(0,0); }
  25%{ transform:translate(-1.2%,.8%); }
  50%{ transform:translate(.9%,-1.1%); }
  75%{ transform:translate(-.6%,-.4%); }
  100%{ transform:translate(0,0); }
}

#glint{
  position:absolute; z-index:4; width:34%; aspect-ratio:1; left:0; top:0;
  transform:translate(-50%,-50%);
  pointer-events:none; opacity:0;
  background:radial-gradient(circle at 50% 50%,
    rgba(255,239,196,.52) 0%,
    rgba(255,206,120,.26) 16%,
    rgba(255,170,78,.10) 34%,
    transparent 64%);
  mix-blend-mode:screen;
  transition:opacity .18s ease;
  will-change:transform,opacity;
}
#glint.streak{
  background:
    linear-gradient(112deg, transparent 34%, rgba(255,244,214,.38) 46%, rgba(255,198,108,.20) 52%, transparent 64%),
    radial-gradient(circle at 50% 50%, rgba(255,232,182,.28), transparent 58%);
}
#flash{
  position:absolute; inset:0; z-index:4; pointer-events:none; opacity:0;
  background:
    radial-gradient(70% 60% at 58% 50%, rgba(255,214,148,.62), rgba(255,150,62,.24) 42%, transparent 74%),
    radial-gradient(120% 120% at 50% 50%, transparent 40%, rgba(255,182,92,.18) 100%);
  mix-blend-mode:screen;
}

/* ---------- physical tags ---------- */
.enamel-tag{
  position:absolute; z-index:7;
  display:flex; align-items:center; justify-content:center;
  gap:.45em;
  padding:.5em .95em;
  border-radius:999px;
  background:
    linear-gradient(180deg, rgba(255,224,168,.30), rgba(255,190,110,0) 36%),
    radial-gradient(120% 170% at 32% 18%, #bd1a24 0%, #920a14 44%, #6b040e 74%, #4b020a 100%);
  border:0;
  box-shadow:
    0 0 0 1px #7a3c08,
    0 0 0 2.5px #ca8c2c,
    0 0 0 4px #f2cf7d,
    0 0 0 5px rgba(90,32,4,.55),
    0 .5em 1.1em rgba(18,0,9,.58),
    inset 0 .18em .32em rgba(255,231,183,.5),
    inset 0 -.42em .8em rgba(42,0,8,.58);
  color:var(--cream);
  font-weight:900;
  text-shadow:0 .08em 0 #5c090d, 0 .16em .22em rgba(24,0,6,.55);
  white-space:nowrap;
  -webkit-user-select:none; user-select:none;
}
.enamel-tag::before{
  content:""; position:absolute; inset:.12em .55em auto .55em; height:38%;
  border-radius:999px;
  background:linear-gradient(180deg, rgba(255,238,198,.26), rgba(255,220,170,0));
  pointer-events:none;
}

.hud-plate{
  position:absolute; z-index:8;
  pointer-events:none;
}
.plate-art{ position:absolute; inset:0; width:100%; height:100%; display:block; }
.plate-cover{
  position:absolute;
  display:flex; align-items:center; justify-content:center;
  background:
    radial-gradient(120% 170% at 38% 18%, #a6111a 0%, #84060e 48%, #650209 78%, #560208 100%);
  box-shadow:
    inset 0 .16em .34em rgba(255,198,120,.17),
    inset 0 -.36em .6em rgba(34,0,6,.52);
}
#timer{
  left:2.9297%; top:.9766%; width:20.5078%;
  aspect-ratio:210 / 90;
}
.timer-cover{
  left:35.2%; top:14.5%; width:53.6%; height:59%;
  border-radius:14% / 34%;
}
#timerText{
  font-family:"Rubik Bubbles","Nunito",sans-serif;
  font-weight:400;
  font-size:clamp(13px, calc(var(--u) * .034), 32px);
  line-height:1;
  color:#f9e5b0;
  letter-spacing:.01em;
  -webkit-text-stroke:.045em #7f2806;
  text-shadow:
    0 .055em 0 #5b1604,
    0 .1em .16em rgba(38,0,4,.62),
    0 0 .38em rgba(255,202,110,.5),
    0 0 .8em rgba(255,166,72,.22);
}
#counter{
  left:78.6133%; top:1.4648%; width:19.043%;
  aspect-ratio:195 / 80;
}
.counter-cover{
  left:41.5%; top:31.5%; width:54.5%; height:40%;
  border-radius:999px;
  gap:.18em;
  padding:.12em .4em;
}
.slots{ display:flex; align-items:center; justify-content:space-between; gap:.22em; width:100%; }
.slot{
  display:block; flex:1 1 0; aspect-ratio:1; max-height:88%;
  border-radius:50%;
  background:radial-gradient(circle at 36% 30%, #500208 0%, #7e0510 54%, #4a0107 100%);
  box-shadow:
    0 0 0 max(1px,.07em) #d29a39,
    0 0 0 max(2px,.13em) #f3d184,
    inset 0 .08em .16em rgba(255,199,116,.22),
    inset 0 -.12em .2em rgba(24,0,4,.6);
  position:relative;
  transition:background .25s ease, box-shadow .25s ease, transform .25s cubic-bezier(.34,1.56,.64,1);
}
.slot::after{
  content:""; position:absolute; inset:22%;
  border-radius:50%;
  background:radial-gradient(circle at 36% 30%, #ffe9b4, #e3ad4c 52%, #94600f 100%);
  opacity:0; transform:scale(.4);
  transition:opacity .22s ease, transform .3s cubic-bezier(.34,1.56,.64,1);
}
.slot.found{
  background:radial-gradient(circle at 36% 30%, #432006, #6e3b08 60%, #3a1b03 100%);
  box-shadow:
    0 0 0 max(1px,.07em) #ffdf9b,
    0 0 0 max(2px,.14em) #e0a63c,
    0 0 .5em rgba(255,198,96,.75),
    inset 0 .08em .16em rgba(255,236,184,.35);
}
.slot.found::after{ opacity:1; transform:scale(1); }
.slot.pop{ animation:slotPop .55s cubic-bezier(.22,1.42,.36,1); }
@keyframes slotPop{
  0%{ transform:scale(1); }
  35%{ transform:scale(1.38); }
  70%{ transform:scale(.94); }
  100%{ transform:scale(1); }
}

#countTag{
  right:1.4%; top:9.7%;
  height:4.1%; min-width:9.2%;
  padding:.25em .7em;
  font-size:clamp(9px, calc(var(--u) * .019), 19px);
  gap:.3em;
  z-index:8;
  pointer-events:none;
}
#countTag .mouse-mark{ width:1.25em; height:1.25em; }

.mouse-mark{
  display:block; width:1.35em; height:1.35em;
  color:#f0c266;
  filter:drop-shadow(0 1px 0 #53070a) drop-shadow(0 2px 3px rgba(30,0,8,.55));
  flex:none;
}
.mouse-mark .cut{ fill:#8d0a13; }
.mouse-mark .nose{ fill:#f9e4b5; }
.mouse-mark.big{ width:1.55em; height:1.55em; }

#introTag{
  left:50%; bottom:3.4%; pointer-events:none; transform:translateX(-50%);
  padding:.55em 1.15em .6em;
  gap:.55em;
  flex-wrap:wrap;
  row-gap:.02em;
  max-width:88%;
  z-index:9;
  font-size:clamp(12px, calc(var(--u) * .027), 27px);
  transition:opacity .7s ease, transform .7s cubic-bezier(.22,1.2,.36,1);
}
.intro-main{ font-family:"Rubik Bubbles",sans-serif; font-weight:400; letter-spacing:.005em; }
.intro-sub{
  flex-basis:100%; text-align:center;
  font-family:"Nunito",sans-serif; font-weight:800;
  font-size:.6em; letter-spacing:.02em;
  color:#f1d9a8; opacity:.86; text-shadow:0 1px 0 #5c090d;
}
#introTag.gone{ opacity:0; transform:translate(-50%,.55em); pointer-events:none; }
#introTag.lifted{ opacity:0; transform:translate(-50%,.3em); }

.button{
  cursor:pointer; z-index:9;
  transition:transform .18s cubic-bezier(.22,1.2,.36,1), filter .18s ease;
  -webkit-appearance:none; appearance:none;
}
.button:hover{ transform:translateY(-1px) scale(1.015); filter:brightness(1.06); }
.button:active{ transform:translateY(1px) scale(.985); }
.button:focus-visible{ outline:none; box-shadow:0 0 0 2px #f9e2ad, 0 0 0 5px #a96410, 0 .5em 1.1em rgba(18,0,9,.6); }

#hintBtn{
  left:1.7%; bottom:1.7%;
  width:18.6%; height:6.9%;
  font-size:clamp(9.5px, calc(var(--u) * .0185), 19px);
  padding:.3em .8em;
  gap:.4em;
}
.hint-q{
  font-family:"Rubik Bubbles",sans-serif;
  font-size:1.5em; line-height:.9;
  color:#ffe7b2;
  width:1.25em; height:1.25em;
  display:grid; place-items:center;
  border-radius:50%;
  background:radial-gradient(circle at 36% 30%, #5b0208, #8a0812 55%, #4b0208);
  box-shadow:0 0 0 1px #d69a36, 0 0 0 2px #f2cf7d, inset 0 1px 2px rgba(255,210,140,.3);
  text-shadow:0 1px 0 #5b090d;
  flex:none;
}
#soundBtn{
  right:1.7%; bottom:1.7%;
  width:14.6%; height:6.9%;
  font-size:clamp(9.5px, calc(var(--u) * .0185), 19px);
  padding:.3em .7em;
  gap:.35em;
}
.sound-icon{ width:1.65em; height:1.65em; flex:none; overflow:visible; }
.sound-icon .spk{ fill:#f0c467; stroke:#7a2606; stroke-width:.7; }
.sound-icon .wave{ fill:none; stroke:#f0c467; stroke-width:2.2; stroke-linecap:round; }
.sound-icon .cross{ fill:none; stroke:#ffb08c; stroke-width:2.4; stroke-linecap:round; opacity:0; }
#soundBtn[aria-pressed="false"] .wave{ opacity:0; }
#soundBtn.muted{ filter:saturate(.55) brightness(.92); }
#soundBtn.muted .spk{ fill:#e8cdaa; }
.sound-icon .slash-bg{ fill:none; stroke:#4a0710; stroke-width:4.2; stroke-linecap:round; opacity:0; }
.sound-icon .slash{ fill:none; stroke:#ffeccd; stroke-width:2.2; stroke-linecap:round; opacity:0; }
#soundBtn.muted .slash-bg, #soundBtn.muted .slash{ opacity:1; }
#soundBtn:not(.muted) .sound-icon{ filter:drop-shadow(0 0 .28em rgba(255,206,120,.55)); }

#toast{
  left:50%; bottom:10.2%; transform:translate(-50%,.5em);
  z-index:9; opacity:0; pointer-events:none;
  font-size:clamp(10px, calc(var(--u) * .021), 21px);
  padding:.45em 1em;
  transition:opacity .25s ease, transform .3s cubic-bezier(.22,1.2,.36,1);
  max-width:82%;
  white-space:normal; text-align:center;
}
#toast.show{ opacity:1; transform:translate(-50%,0); }
#toast.finale{ bottom:auto; top:25.2%; }

/* ---------- win ---------- */
.win{ position:absolute; inset:0; z-index:20; display:grid; place-items:center; }
.win[hidden]{ display:none; }
.win-backdrop{
  position:absolute; inset:-20%;
  background:radial-gradient(60% 60% at 50% 48%, rgba(30,2,16,.30) 0%, rgba(18,1,10,.82) 100%);
  animation:winFade .7s ease both;
}
@keyframes winFade{ from{ opacity:0; } to{ opacity:1; } }
.win-card{
  position:relative;
  width:min(76%, 430px);
  padding:clamp(20px,4.2vw,38px) clamp(18px,3.6vw,34px) clamp(18px,3vw,28px);
  border-radius:18px;
  text-align:center;
  color:var(--cream);
  background:
    linear-gradient(180deg, rgba(255,222,160,.20), rgba(255,180,90,0) 26%),
    radial-gradient(120% 150% at 32% 12%, #a8121c 0%, #84060f 42%, #5b020b 78%, #420107 100%);
  box-shadow:
    0 0 0 1px #733508,
    0 0 0 3px #c88b2d,
    0 0 0 5px #f0cb77,
    0 0 0 6px rgba(80,25,3,.6),
    0 1.2em 2.4em rgba(8,0,5,.7),
    inset 0 .22em .4em rgba(255,229,180,.4),
    inset 0 -.7em 1.4em rgba(38,0,8,.55);
  animation:cardIn .72s cubic-bezier(.2,1.3,.36,1) both;
}
@keyframes cardIn{
  from{ opacity:0; transform:translateY(18px) scale(.94); }
  to{ opacity:1; transform:translateY(0) scale(1); }
}
.win-card::before{
  content:""; position:absolute; inset:.5em 1.4em auto 1.4em; height:22%;
  border-radius:999px;
  background:linear-gradient(180deg, rgba(255,240,205,.22), transparent);
  pointer-events:none;
}
.win-star{
  position:absolute; left:50%; top:0; width:clamp(42px,8vw,64px); aspect-ratio:1;
  transform:translate(-50%,-52%);
  filter:drop-shadow(0 .2em .3em rgba(30,0,8,.65));
}
.win-star svg{ width:100%; height:100%; }
.win-star path{
  fill:url(#starGold);
  fill:#f4c45e;
  stroke:#8d4b08; stroke-width:2.5;
  paint-order:stroke fill;
  filter:drop-shadow(0 2px 0 #6e3204);
}
#winTitle{
  position:relative;
  margin:.3em 0 .1em;
  font-family:"Rubik Bubbles",sans-serif;
  font-weight:400;
  font-size:clamp(26px,5.6vw,46px);
  line-height:1.02;
  color:#ffe9ba;
  -webkit-text-stroke:.045em #7c2a08;
  text-shadow:0 .07em 0 #621a0a, 0 .16em .3em rgba(30,0,8,.65), 0 0 .55em rgba(255,198,100,.32);
}
.win-sub{
  position:relative;
  margin:.2em 0 1em;
  font-size:clamp(12px,2.1vw,16px);
  font-weight:800;
  color:#f3d6a2;
  opacity:.9;
}
.win-stats{
  position:relative;
  display:flex; justify-content:center; gap:.9em;
  margin:.4em 0 .9em;
}
.stat{
  flex:1 1 0; max-width:9em;
  padding:.45em .5em .55em;
  border-radius:12px;
  background:radial-gradient(circle at 34% 22%, #5b0309, #7c0610 58%, #470107);
  box-shadow:0 0 0 1px #b97c22, 0 0 0 2.5px #eec86f, inset 0 2px 4px rgba(255,210,150,.18), inset 0 -4px 6px rgba(26,0,5,.5);
}
.stat-label{ display:block; font-size:clamp(9px,.9vw,11px); letter-spacing:.08em; text-transform:uppercase; color:#e5c58e; opacity:.8; font-weight:900; }
.stat-value{
  display:block; font-family:"Rubik Bubbles",sans-serif;
  font-size:clamp(20px,3.5vw,30px); line-height:1.15;
  color:#ffe8b6; text-shadow:0 1px 0 #5e1605, 0 3px 5px rgba(30,0,6,.55);
}
.best-line{
  position:relative;
  font-size:clamp(11px,1.8vw,14px);
  font-weight:800; color:#f0d09a; opacity:.92;
  margin:.1em 0 .9em;
}
.best-line a{ color:#ffe1a1; text-decoration-color:#c58a35; text-underline-offset:2px; }
.win-actions{ position:relative; display:flex; gap:.65em; justify-content:center; flex-wrap:wrap; }
.enamel-tag.wide, .enamel-tag.quiet{ position:relative; inset:auto; transform:none; }
.win-actions .button{
  position:relative; inset:auto; transform:none;
  height:2.9em; padding:0 1.4em;
  font-size:clamp(12px,2vw,16px);
}
.win-actions .button.wide{ flex:1 1 9em; max-width:13em; }
.win-actions .button.quiet{ flex:0 1 8em; }
.win-actions .button:hover{ transform:translateY(-1px) scale(1.015); }
.win-actions .button:active{ transform:translateY(1px) scale(.99); }

/* Short landscape screens: the whole card, including both actions, must fit
   above the bottom of the frame. */
@media (orientation:landscape) and (max-height: 620px){
  .win-card{
    width:min(64%, 460px);
    padding:14px 18px 12px;
    border-radius:14px;
  }
  .win-star{ width:clamp(34px, 9vh, 46px); }
  #winTitle{
    font-size:clamp(22px, 6.4vh, 34px);
    margin:.18em 0 .06em;
  }
  .win-sub{
    font-size:clamp(10px, 2.9vh, 14px);
    margin:.12em 0 .45em;
  }
  .win-stats{ margin:.15em 0 .55em; gap:.5em; }
  .stat{ padding:.3em .4em .35em; max-width:10em; }
  .stat-label{ font-size:clamp(8px, 2.1vh, 10px); }
  .stat-value{ font-size:clamp(18px, 5vh, 26px); }
  .best-line{ margin:.05em 0 .45em; font-size:clamp(10px, 2.2vh, 12px); }
  .win-actions{ flex-wrap:nowrap; gap:.5em; }
  .win-actions .button{
    height:2.5em;
    padding:0 1em;
    font-size:clamp(11px, 2.8vh, 15px);
  }
}

/* ---------- loading ---------- */
.loading{
  position:absolute; inset:0; z-index:30;
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:1em;
  background:
    radial-gradient(55% 55% at 50% 46%, rgba(96,10,20,.42), rgba(24,1,12,.96) 70%),
    #14010a;
  color:#f2d6a4;
  border-radius:2px;
  transition:opacity .7s ease, visibility .7s;
}
.loading.done{ opacity:0; visibility:hidden; pointer-events:none; }
.loading-ring{
  width:clamp(34px,8vw,58px); aspect-ratio:1; border-radius:50%;
  border:clamp(4px,.9vw,7px) solid rgba(240,196,110,.18);
  border-top-color:#f2c66b; border-right-color:#b97b25;
  animation:loadSpin 1.1s cubic-bezier(.5,.1,.5,.9) infinite;
  box-shadow:0 0 18px rgba(255,182,80,.18), inset 0 0 12px rgba(255,190,100,.12);
}
@keyframes loadSpin{ to{ transform:rotate(360deg); } }
.loading-text{ font-family:"Rubik Bubbles",sans-serif; font-size:clamp(14px,2.4vw,20px); color:#f3d8a6; text-shadow:0 2px 4px rgba(20,0,8,.6); }

/* ---------- responsive touch ---------- */
#board.tiny .btn-label{ display:none; }
#board.tiny #hintBtn{ width:12%; height:10%; left:1.6%; bottom:1.4%; }
#board.tiny #soundBtn{ width:15.6%; height:10%; right:1.6%; bottom:1.4%; padding:.3em .3em; gap:.18em; }
#board.tiny .sound-icon{ width:1.45em; height:1.45em; }
#board.tiny #soundBtn .btn-label{ display:inline; font-size:.95em; letter-spacing:.01em; }
#board.tiny .hint-q{ font-size:1.8em; }
#board.tiny .sound-icon{ width:2.1em; height:2.1em; }
#board.tiny #introTag{ bottom:4.2%; }
#board.tiny #countTag{ font-size:clamp(9px, calc(var(--u) * .026), 13px); }

@media (prefers-reduced-motion: reduce){
  #film::after{ animation:none; }
  #snowfall{ animation:none; }
  .loading-ring{ animation-duration:2.4s; }
}
