/* advente.lv — UI layer. Cel-shaded like the game: flat fills, thick ink
   outlines, hard "sticker" shadows, a Christmas palette and rounded type.
   Everything sits above #world; only controls take pointer events. */

:root {
  --display: 'Baloo 2', ui-rounded, 'Arial Rounded MT Bold', 'Nunito', system-ui, sans-serif;
  --body: 'Nunito', ui-rounded, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;

  --ink: #120b22;
  --ink-2: #4b4262;
  --ink-3: #8c84a0;
  --night: #1b1640;

  --cream: #fff8ef;
  --cream-2: #f7ebd8;
  --cream-3: #ead9c0;
  --snow: #ffffff;
  --ice: #dcebff;

  --red: #d7263d;
  --red-lt: #ef5266;
  --red-dk: #a3172b;
  --green: #1f8a5b;
  --green-lt: #34b07a;
  --green-dk: #146343;
  --gold: #f5c64a;
  --gold-lt: #ffe08a;
  --gold-dk: #d69a14;
  --ginger: #b5652e;
  --blue: #4aa3ff;

  --pop: 0 5px 0 var(--ink);
  --pop-s: 0 4px 0 var(--ink);
  --pop-xs: 0 3px 0 var(--ink);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --edge: 20px;
  --frame: 0px;            /* gap around the game card in framed mode (below) */
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--night); color: var(--ink);
  font-family: var(--body); font-weight: 700;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  overscroll-behavior: none;
  /* Holding a finger to steer must not select text or pop up iOS's
     Copy / Translate menu. Form fields stay selectable. */
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
input, textarea { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }

#world { position: fixed; inset: 0; z-index: 1; }

/* Phones in a browser tab: the browser keeps its bars (Safari offers no way
   to hide them), so the game sits in a rounded card on the night sky, on
   purpose — the same sticker style as the HUD: cream bezel, ink outlines.
   main.js sets html.framed; the home-screen app and fullscreen get the whole
   screen. The HUD sits inside the card with the game. */
html.framed { --frame: 11px; }
html.framed #world, html.framed .hud { inset: var(--frame); border-radius: 26px; }
html.framed #world {
  overflow: hidden;
  box-shadow: 0 0 0 3px var(--ink), 0 0 0 6.5px var(--cream), 0 0 0 9px var(--ink);
}

/* ======================================================================
   Root layer
   ====================================================================== */

.hud {
  position: fixed; inset: 0; z-index: 10;
  pointer-events: none; overflow: hidden;
  font-family: var(--body); font-size: 14px; font-weight: 700; line-height: 1.4; color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none;
}
/* Resets carry zero specificity so any single class below wins. */
:where(.hud) :where(button, a, input, label, .panel, .landing-col) { pointer-events: auto; }
:where(.hud) :where(button, input) { font: inherit; color: inherit; }
:where(.hud) :where(button) { cursor: pointer; border: 0; background: none; padding: 0; margin: 0; text-align: inherit; }
:where(.hud) :where(a) { color: inherit; text-decoration: none; }
:where(.hud) :where(p, h1, h2, h3, h4, ol, ul, figure) { margin: 0; padding: 0; }
:where(.hud) :where(ol, ul) { list-style: none; }
:where(.hud) :where(b, strong) { font-weight: 800; }
.hud [hidden] { display: none !important; }
.hud :focus { outline: none; }
.hud :focus-visible { outline: 2.5px dashed var(--ink); outline-offset: 4px; }
.hud .panel:focus-visible { outline: none; }
.hud .ic { width: 20px; height: 20px; flex: none; display: block; overflow: visible; }

/* --- building blocks ------------------------------------------------------ */

.card {
  position: relative;
  background: var(--cream);
  border: 3px solid var(--ink); border-radius: 22px;
  box-shadow: var(--pop);
  color: var(--ink);
}
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  height: 42px; padding: 0 16px; border-radius: 999px;
  background: var(--cream); border: 2.5px solid var(--ink); box-shadow: var(--pop-s);
  white-space: nowrap; color: var(--ink);
}
/* halftone dots in the shaded corner of a panel, like the game's shadows */
.card::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(circle, rgba(18, 11, 34, 0.085) 1.15px, transparent 1.6px) 0 0 / 7px 7px;
  -webkit-mask-image: linear-gradient(155deg, transparent 58%, #000 100%);
  mask-image: linear-gradient(155deg, transparent 58%, #000 100%);
}

.eyebrow, .lbl {
  font-family: var(--body); font-size: 11px; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-2);
}
.eyebrow-red { color: var(--red); }
kbd {
  display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px; margin-right: 6px;
  background: var(--cream-2); border: 2px solid var(--ink); border-radius: 7px; box-shadow: 0 2px 0 var(--ink);
  font: 600 12px/1 var(--display); color: var(--ink);
}
.sep { font-style: normal; color: var(--ink-3); margin: 0 7px; }

/* snow piled on panel tops (inline SVG; y=20 of the drawing sits on the edge) */
.drift { position: absolute; z-index: 2; pointer-events: none; height: 30px; top: -20px; }
.drift-l { left: 14px; width: 96px; }
.drift-r { right: 18px; width: 64px; }
.holly { position: absolute; pointer-events: none; width: 44px; height: auto; }
.sparkle { position: absolute; pointer-events: none; width: 16px; height: 16px; animation: twinkle 2.4s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { transform: scale(0.6) rotate(0deg); opacity: 0.7; } 50% { transform: scale(1.1) rotate(20deg); opacity: 1; } }

.lights { position: absolute; left: -6px; right: -6px; top: -15px; width: calc(100% + 12px); height: auto; pointer-events: none; z-index: 2; overflow: visible; }
.lights .bulb { animation: glow 2.4s ease-in-out var(--d) infinite; }
@keyframes glow { 0%, 100% { filter: none; opacity: 0.85; } 50% { filter: drop-shadow(0 0 5px var(--bc)) brightness(1.15); opacity: 1; } }

/* --- mode sections ------------------------------------------------------ */

.landing, .game, .death {
  position: absolute; inset: 0; pointer-events: none;
  opacity: 0; visibility: hidden;
  transition: opacity 0.4s var(--ease), visibility 0s linear 0.4s;
}
.hud[data-mode="landing"] .landing,
.hud[data-mode="playing"] .game,
.hud[data-mode="dead"] :is(.game, .death) {
  opacity: 1; visibility: visible;
  transition: opacity 0.4s var(--ease), visibility 0s;
}
.hud[data-mode="dead"] .game { opacity: 0.5; }
.hud[data-mode="dead"] :is(.boost, .hint, .exit) { visibility: hidden; }

/* ======================================================================
   Buttons — chunky, outlined, squishy
   ====================================================================== */

.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 52px; padding: 0 24px; border-radius: 999px;
  border: 3px solid var(--ink); box-shadow: var(--pop);
  font: 700 17px/1 var(--display); letter-spacing: 0.02em; white-space: nowrap;
  transition: transform 0.12s var(--ease), box-shadow 0.12s var(--ease), filter 0.2s;
}
.btn .ic { width: 20px; height: 20px; stroke-width: 3; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 7px 0 var(--ink); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); transition-duration: 0.05s; }
.squish { animation: squish 0.42s var(--spring); }
@keyframes squish { 0% { scale: 1; } 30% { scale: 1.06 0.9; } 60% { scale: 0.97 1.04; } 100% { scale: 1; } }

/* the go button: pine green inside a candy-cane ring */
.btn-go {
  height: 60px; padding: 0 30px; color: var(--cream);
  border: 5px solid transparent;
  background:
    linear-gradient(180deg, var(--green-lt) 0%, var(--green) 52%, var(--green-dk) 100%) padding-box,
    repeating-linear-gradient(-45deg, var(--red) 0 7px, var(--cream) 7px 14px) border-box;
  box-shadow: 0 0 0 2.5px var(--ink), inset 0 0 0 2px var(--ink), 0 6px 0 2.5px var(--ink);
  font-size: 21px; text-shadow: 0 2px 0 var(--ink);
}
.btn-go::before { /* candy gloss */
  content: ''; position: absolute; left: 16px; right: 16px; top: 4px; height: 34%; border-radius: 999px;
  background: rgba(255, 255, 255, 0.24); pointer-events: none;
}
.btn-go .ic { filter: drop-shadow(0 2px 0 var(--ink)); }
.btn-go:hover { box-shadow: 0 0 0 2.5px var(--ink), inset 0 0 0 2px var(--ink), 0 8px 0 2.5px var(--ink); }
.btn-go:active { box-shadow: 0 0 0 2.5px var(--ink), inset 0 0 0 2px var(--ink), 0 2px 0 2.5px var(--ink); }
.btn-go:disabled { cursor: progress; filter: saturate(0.6); }

.btn-soft { background: var(--cream); color: var(--ink); }
.btn-soft:hover { background: var(--snow); }
.btn-gold { background: linear-gradient(180deg, var(--gold-lt), var(--gold) 55%); color: var(--ink); }
.btn-gold:hover { filter: brightness(1.04); }

.x {
  position: relative; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%;
  background: var(--cream); border: 2.5px solid var(--ink); box-shadow: var(--pop-xs); color: var(--ink);
  transition: transform 0.3s var(--spring), background 0.2s;
}
.x .ic { stroke-width: 3; }
.x:hover { background: var(--red); color: var(--cream); transform: rotate(90deg); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 11px; border-radius: 999px;
  border: 2px solid var(--ink); background: var(--cream-2); color: var(--ink);
  font: 900 11px/1 var(--body); letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap;
}
.chip .ic { width: 13px; height: 13px; stroke-width: 2.4; }
.chip-gold { background: var(--gold); }
.chip-green { background: var(--green); color: var(--cream); }
.chip-dim { background: var(--ice); }

.demo-chip {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; flex: none;
  background: var(--ice); border: 2px dashed var(--ink); color: var(--ink);
  font: 900 10px/1 var(--body); letter-spacing: 0.1em; text-transform: uppercase; white-space: nowrap;
  vertical-align: middle; cursor: help;
}

/* outlined display text that reads over any sky or snow */
.wordmark, .brand-top, .hero-t, .watermark {
  font-family: var(--display); font-weight: 700; color: var(--cream);
  -webkit-text-stroke: 7px var(--ink); paint-order: stroke fill;
  text-shadow: 0 5px 0 var(--ink);
}
.wordmark span, .brand-top span, .watermark span { color: var(--red-lt); }

/* ======================================================================
   Corner: big Sponsoriem button + Riga clock
   ====================================================================== */

.corner {
  position: absolute; z-index: 3;
  top: calc(var(--sat) + var(--edge)); right: calc(var(--sar) + var(--edge));
  display: flex; align-items: center; gap: 12px;
}
.clock { height: 44px; font: 600 16px/1 var(--display); font-variant-numeric: tabular-nums; }
.clock-ic { display: grid; }
.clock-ic .ic { width: 22px; height: 22px; }
.clock-p { font: 800 12px/1 var(--body); color: var(--ink-2); }
.clock-p::before { content: '·'; margin-right: 7px; color: var(--ink-3); }
.clock-p:empty { display: none; }

.btn-sponsor {
  display: none; position: relative; align-items: center; gap: 12px;
  height: 64px; padding: 0 20px 0 8px; border-radius: 999px;
  background: linear-gradient(180deg, var(--gold-lt) 0%, var(--gold) 55%, #eab437 100%);
  border: 3px solid var(--ink); box-shadow: var(--pop);
  text-align: left; color: var(--ink);
  animation: pop-in 0.7s var(--spring) 0.2s both;
  transition: transform 0.12s var(--ease), box-shadow 0.12s var(--ease);
}
.hud[data-mode="landing"] .btn-sponsor { display: flex; }
.btn-sponsor:hover { transform: translateY(-2px) rotate(-1deg); box-shadow: 0 7px 0 var(--ink); }
.btn-sponsor:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.btn-sponsor-ic {
  display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%;
  background: var(--cream); border: 2.5px solid var(--ink);
}
.btn-sponsor-ic .ic { width: 28px; height: 28px; }
.btn-sponsor:hover .btn-sponsor-ic .ic { animation: wiggle 0.5s ease-in-out; }
.btn-sponsor-tx { display: flex; flex-direction: column; gap: 3px; }
.btn-sponsor-tx b { font: 700 20px/1 var(--display); letter-spacing: 0.02em; }
.btn-sponsor-tx small { font: 800 12px/1.1 var(--body); color: #5c4310; white-space: nowrap; }
.btn-sponsor-ar .ic { stroke-width: 3; transition: transform 0.3s var(--spring); }
.btn-sponsor:hover .btn-sponsor-ar .ic { transform: translateX(3px); }
.btn-sponsor .sparkle.sp-a { top: -9px; left: 30px; }
.btn-sponsor .sparkle.sp-b { bottom: -7px; right: 26px; width: 12px; height: 12px; animation-delay: 1.1s; }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-12deg); } 75% { transform: rotate(10deg); } }
@keyframes pop-in { from { opacity: 0; transform: translateY(-8px) scale(0.92); } to { opacity: 1; transform: none; } }

.brand-top { position: absolute; z-index: 3; display: none; top: calc(var(--sat) + 14px); left: calc(var(--sal) + 16px); font-size: 24px; -webkit-text-stroke-width: 6px; text-shadow: 0 3px 0 var(--ink); }

/* ======================================================================
   LANDING — the calendar is the HUD; the world stays visible on the right
   ====================================================================== */

.landing-col {
  position: absolute; top: 0; bottom: 0; left: 0;
  width: min(520px, 46vw);
  padding: calc(var(--sat) + 26px) 36px calc(var(--sab) + 26px) calc(var(--sal) + 40px);
  overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  display: flex; flex-direction: column;
  scrollbar-width: none;
}
.landing-col::-webkit-scrollbar { display: none; }
.landing-inner { margin: auto 0; display: flex; flex-direction: column; gap: 18px; width: 100%; padding-top: 6px; }

.landing-inner > * { animation: rise 0.7s var(--spring) both; }
.landing-inner > :nth-child(2) { animation-delay: 0.07s; }
.landing-inner > :nth-child(3) { animation-delay: 0.14s; }
.landing-inner > :nth-child(4) { animation-delay: 0.21s; }
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(0.98); } to { opacity: 1; transform: none; } }

.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.wordmark { position: relative; font-size: 50px; line-height: 1; letter-spacing: 0.01em; padding-left: 4px; }
.wordmark .holly { width: 46px; top: -16px; right: -36px; transform: rotate(14deg); -webkit-text-stroke: 0; }
.tagline {
  display: inline-block; padding: 7px 16px; border-radius: 999px;
  background: var(--red); color: var(--cream); border: 2.5px solid var(--ink); box-shadow: var(--pop-xs);
  font: 600 15px/1.2 var(--display); letter-spacing: 0.01em;
}

/* hero: countdown tiles or today's door */
.hero { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.hero .eyebrow {
  display: inline-block; padding: 5px 12px; border-radius: 999px;
  background: var(--gold); color: var(--ink); border: 2.5px solid var(--ink); box-shadow: var(--pop-xs);
}
.count { display: flex; gap: 9px; }
.count-sep { display: none; }
.count-u {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  width: 70px; padding: 7px 0 6px; border-radius: 16px;
  background: var(--cream); border: 3px solid var(--ink); box-shadow: var(--pop-s);
}
.count-u b { font: 700 30px/1 var(--display); font-variant-numeric: tabular-nums; color: var(--ink); }
.count-u:first-child b { color: var(--red); }
.count-u span { font: 900 9px/1 var(--body); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); }
.hero-t { font-size: 38px; line-height: 1.08; -webkit-text-stroke-width: 7px; }
.hero-t em { font-style: normal; color: var(--gold); }
.hero-s {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 13px; border-radius: 999px;
  background: var(--cream); border: 2.5px solid var(--ink); box-shadow: var(--pop-xs);
  font: 800 13px/1.2 var(--body); color: var(--ink-2);
}
.hero-s b { color: var(--ink); }
.hero-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); border: 2px solid var(--ink); flex: none; }

/* calendar card */
.cal-card { padding: 22px 16px 16px; }
.cal-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 0 2px 12px; }
.cal-title { font: 700 19px/1 var(--display); }
.cal-legend {
  margin-left: auto; display: flex; align-items: center; gap: 5px;
  font: 800 11px/1 var(--body); color: var(--ink-2); white-space: nowrap;
}
.cal-legend i { width: 11px; height: 11px; border-radius: 4px; border: 2px solid var(--ink); margin-left: 7px; }
.lg-past { background: linear-gradient(135deg, var(--red) 50%, var(--green) 50%); }
.lg-today { background: var(--gold); }
.lg-locked { background: var(--cream); }

/* ======================================================================
   Doors — little hinged advent doors (landing grid + calendar overlay)
   ====================================================================== */

.doors { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 9px; }

.door {
  --c: var(--cream-3); --on: var(--ink);
  position: relative; display: block;
  width: 100%; aspect-ratio: 1 / 0.9; min-width: 0; min-height: 44px;
  border-radius: 12px; perspective: 420px;
  transition: transform 0.3s var(--spring);
}
.doors-land .door { aspect-ratio: 1 / 0.8; }
.door-back, .door-leaf {
  position: absolute; inset: 0; border-radius: inherit;
  border: 2.5px solid var(--ink);
  display: grid; place-items: center;
}
.door-back { /* the opening: dark until the door is opened */
  background: #2a2154; box-shadow: var(--pop-xs), inset 0 5px 0 rgba(0, 0, 0, 0.28);
}
.door-bn { font: 700 22px/1 var(--display); color: var(--on); opacity: 0; transition: opacity 0.3s; }
.door-leaf {
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(220, 235, 255, 0.9), transparent 60%),
    var(--cream);
  transform-origin: 0 50%;
  transition: transform 0.55s var(--spring), background 0.3s;
}
.door-leaf::before { /* the raised panel of a little wooden door */
  content: ''; position: absolute; inset: 4px; border-radius: 7px;
  border: 1.5px solid rgba(18, 11, 34, 0.13);
}
.door-leaf::after { /* knob */
  content: ''; position: absolute; right: 5px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%;
  background: var(--gold); border: 1.5px solid var(--ink);
}
.doors-land .door-leaf::after { display: none; } /* the knob reads as "°" on small tiles */
.door-n { position: relative; font: 700 22px/1 var(--display); letter-spacing: -0.01em; }
.n-red .door-n { color: var(--red); }
.n-green .door-n { color: var(--green); }
.door-flake { position: absolute; top: 3px; right: 4px; color: #6aa8e6; }
.door-flake .ic { width: 12px; height: 12px; stroke-width: 2.4; }

@media (hover: hover) {
  .door:hover { transform: translateY(-3px) rotate(-1.5deg); }
  .door.is-locked:hover .door-leaf, .door.is-open:hover .door-leaf { transform: rotateY(-24deg); }
}

/* opened: the leaf swings ajar, the sponsor's colour shows behind */
.door.is-past .door-back { background: var(--c); box-shadow: var(--pop-xs), inset 0 5px 0 rgba(0, 0, 0, 0.16); }
.door.is-past .door-bn { opacity: 1; padding-left: 22%; }
.door.is-past .door-leaf { transform: rotateY(-76deg); background: var(--cream-3); }
.door.is-past .door-leaf .door-n, .door.is-past .door-leaf::after { opacity: 0; }
.door.is-past.is-free .door-back {
  background: radial-gradient(circle, rgba(18, 11, 34, 0.12) 1.1px, transparent 1.5px) 0 0 / 6px 6px, var(--cream-3);
}
.door.is-past.is-sold .door-bn { text-shadow: 0 2px 0 rgba(18, 11, 34, 0.25); }

/* today: a gold door wrapped in ribbon, with a bow on top */
.door.is-open { z-index: 1; }
.door.is-open .door-leaf {
  background:
    linear-gradient(90deg, transparent 41%, var(--ink) 41% calc(41% + 2px), var(--red) calc(41% + 2px) calc(59% - 2px), var(--ink) calc(59% - 2px) 59%, transparent 59%),
    linear-gradient(180deg, var(--gold-lt), var(--gold) 60%, #eab437);
}
.door.is-open .door-leaf::before { display: none; }
.door.is-open .door-leaf::after { display: none; }
.door.is-open .door-n { color: var(--cream); -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; }
.door.is-open .door-back { animation: glow-gold 2.6s ease-in-out infinite; }
@keyframes glow-gold {
  0%, 100% { box-shadow: var(--pop-xs), 0 0 0 0 rgba(245, 198, 74, 0); }
  50% { box-shadow: var(--pop-xs), 0 0 0 5px rgba(245, 198, 74, 0.45), 0 0 22px 6px rgba(245, 198, 74, 0.55); }
}
.door-bow { position: absolute; z-index: 3; top: -14px; left: 50%; width: 38px; margin-left: -19px; pointer-events: none; animation: bob 2.6s ease-in-out infinite; transform-origin: 50% 60%; }
.door-bow .bow { width: 100%; height: auto; display: block; }
@keyframes bob { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg) translateY(-1px); } }


/* ======================================================================
   Play form
   ====================================================================== */

.play-card { padding: 20px 16px 14px; display: flex; flex-direction: column; gap: 12px; }
.form-head { display: none; align-items: center; gap: 10px; margin: -4px 0 0 -4px; }
.form-head p { font: 700 18px/1 var(--display); }

.form-head .avatar { width: 46px; height: 46px; flex: none; }
.form-head .avatar .ball { width: 38px; height: 38px; }
.avatar {
  --c: var(--red);
  flex: none; width: 56px; height: 56px; border-radius: 18px;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--c) 22%, var(--cream)); border: 2.5px solid var(--ink); box-shadow: var(--pop-xs);
  transition: background 0.3s;
}
.avatar .ball { width: 46px; height: 46px; }
.avatar.is-bounce .ball { animation: hop 0.5s var(--spring); }
@keyframes hop { 0% { transform: translateY(0) scale(1); } 35% { transform: translateY(-6px) scale(1.08, 0.92); } 100% { transform: none; } }

.field {
  width: 100%; height: 52px; padding: 0 18px; border-radius: 16px;
  background: var(--snow); border: 2.5px solid var(--ink); box-shadow: inset 0 3px 0 rgba(18, 11, 34, 0.08);
  color: var(--ink); font: 700 16px/1 var(--body);
  -webkit-user-select: text; user-select: text;
  transition: box-shadow 0.2s, border-color 0.2s;
  -webkit-appearance: none; appearance: none;
}
.field::placeholder { color: var(--ink-3); font-weight: 700; }
.field:focus { outline: none; box-shadow: inset 0 3px 0 rgba(18, 11, 34, 0.08), 0 0 0 4px var(--gold); }
.field.is-bad { border-color: var(--red); box-shadow: 0 0 0 4px rgba(215, 38, 61, 0.22); }
.field:-webkit-autofill { -webkit-text-fill-color: var(--ink); -webkit-box-shadow: 0 0 0 40px var(--snow) inset; }

.skins { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; }
.skin {
  position: relative; height: 46px; border-radius: 14px;
  display: grid; place-items: center; border: 2.5px solid transparent;
  transition: background 0.2s, transform 0.3s var(--spring);
}
.skin .ball { width: 36px; height: 36px; transition: transform 0.35s var(--spring); }
.skin:hover .ball { transform: translateY(-3px) rotate(-6deg); }
.skin[aria-checked="true"] { background: var(--gold); border-color: var(--ink); box-shadow: 0 3px 0 var(--ink); }
.skin[aria-checked="true"] .ball { transform: scale(1.08); }

.form-err {
  font: 800 13px/1.3 var(--body); color: var(--red-dk);
  padding: 8px 12px; border-radius: 12px; background: #ffe3e6; border: 2px solid var(--red);
}
.form-err:empty { display: none; }

.btn-play { width: 100%; margin-top: 4px; }
.play-mass {
  padding: 4px 10px; border-radius: 999px; background: rgba(18, 11, 34, 0.3);
  font: 700 15px/1 var(--display); font-variant-numeric: tabular-nums; text-shadow: none;
}
.is-return .btn-play { animation: hello 0.9s var(--spring) 0.5s both; }
@keyframes hello { 0% { scale: 1; } 30% { scale: 1.07 0.92; } 55% { scale: 0.97 1.05; } 100% { scale: 1; } }
.btn-play.is-busy .ic { animation: nudge 0.7s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateX(4px); } }


.live {
  position: absolute; right: calc(var(--sar) + var(--edge)); bottom: calc(var(--sab) + var(--edge) + 4px);
  gap: 9px; font: 800 13px/1 var(--body); color: var(--ink-2);
  animation: rise 0.7s var(--spring) 0.35s both;
}
.live b { color: var(--ink); font-family: var(--display); font-weight: 700; font-size: 15px; }
.live-dot { position: relative; width: 11px; height: 11px; border-radius: 50%; background: var(--cream-3); border: 2px solid var(--ink); flex: none; }
.live.is-on .live-dot { background: var(--green-lt); }
.live.is-on .live-dot::after {
  content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--green-lt);
  animation: ping 2s var(--ease) infinite;
}
@keyframes ping { from { transform: scale(0.4); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }

/* ======================================================================
   IN-GAME HUD
   ====================================================================== */

.game .card { border-width: 2.5px; border-radius: 20px; box-shadow: var(--pop-s); }

/* the way back: a little advent door + "Kalendārs"; ends the game */
.exit {
  position: absolute; top: calc(var(--sat) + var(--edge)); left: calc(var(--sal) + var(--edge));
  display: flex; align-items: center; gap: 10px;
  height: 58px; padding: 0 18px 0 10px; border-radius: 999px;
  color: var(--ink);
  transition: transform 0.12s var(--ease), box-shadow 0.12s var(--ease);
}
.game .exit.card { border-radius: 999px; }
.exit::after { display: none; }
.exit:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--ink); }
.exit:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.exit-back { display: grid; color: var(--ink-2); }
.exit-back .ic { width: 18px; height: 18px; stroke-width: 3; }
.exit:hover .exit-back .ic { animation: nudge-back 0.6s ease-in-out; }
@keyframes nudge-back { 50% { transform: translateX(-3px); } }
.exit-door {
  position: relative; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px;
  border: 2.5px solid var(--ink); box-shadow: 0 2px 0 var(--ink);
  background:
    linear-gradient(90deg, transparent 40%, var(--ink) 40% calc(40% + 2px), var(--red) calc(40% + 2px) calc(60% - 2px), var(--ink) calc(60% - 2px) 60%, transparent 60%),
    linear-gradient(180deg, var(--gold-lt), var(--gold) 60%, #eab437);
}
.exit-n { position: relative; font: 700 19px/1 var(--display); color: var(--cream); -webkit-text-stroke: 4.5px var(--ink); paint-order: stroke fill; }
.exit-bow { position: absolute; top: -12px; left: 50%; width: 26px; margin-left: -13px; animation: bob 2.6s ease-in-out infinite; transform-origin: 50% 60%; }
.exit-bow .bow { display: block; width: 100%; height: auto; }
.exit-door.is-flake { background: var(--cream); }
.exit-door.is-flake .exit-bow { display: none; }
.exit-door.is-flake .exit-n .ic { width: 20px; height: 20px; color: #4f95da; stroke-width: 2.4; }
.exit-tx { font: 700 19px/1 var(--display); letter-spacing: 0.01em; }

/* leaderboard */
.board {
  position: absolute; top: calc(var(--sat) + var(--edge) + 56px); right: calc(var(--sar) + var(--edge));
  width: 220px; padding: 14px 8px 8px;
}
.board .drift-l { left: 10px; width: 80px; top: -17px; height: 25px; }
.board-t { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 10px 6px; font: 700 16px/1 var(--display); }
/* real players online right now (bots don't count) */
.board-on { display: inline-flex; align-items: center; gap: 5px; font: 700 14px/1 var(--display); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.board-on .live-dot { width: 9px; height: 9px; background: var(--green-lt); }
.board li {
  display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 10px; border-radius: 11px;
  font: 800 13.5px/1 var(--body); color: var(--ink);
}
.b-rank { width: 18px; display: grid; place-items: center; font: 700 13px/1 var(--display); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.b-rank .ic { width: 18px; height: 18px; }
.b-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-name em { font-style: normal; margin-left: 6px; padding: 1px 6px; border-radius: 999px; background: var(--red); color: var(--cream); font: 900 9px/1.3 var(--body); letter-spacing: 0.06em; text-transform: uppercase; }
.b-mass { font: 600 13px/1 var(--display); font-variant-numeric: tabular-nums; color: var(--ink-2); }
.board li.me { background: var(--gold); box-shadow: inset 0 0 0 2px var(--ink); }
.board li.me .b-mass, .board li.me .b-rank { color: var(--ink); }
.board li.b-empty { justify-content: center; color: var(--ink-3); font-size: 12.5px; }
/* you, when you're not in the top: your place under a dotted gap */
.board li.is-gap { margin-top: 7px; position: relative; }
.board li.is-gap::before { content: ''; position: absolute; left: 10px; right: 10px; top: -5px; border-top: 2px dotted rgba(18, 11, 34, 0.35); }

.hint {
  position: absolute; bottom: calc(var(--sab) + 22px); left: 50%; transform: translateX(-50%);
  height: 40px; gap: 2px; font: 800 12.5px/1 var(--body); color: var(--ink-2);
  transition: opacity 1.2s var(--ease), transform 1.2s var(--ease);
}
.hint i { font-style: normal; color: var(--ink-3); margin: 0 9px; }
.hint.is-gone { opacity: 0; transform: translate(-50%, 10px); }

.watermark {
  position: absolute; bottom: calc(var(--sab) + 22px); left: calc(var(--sal) + var(--edge));
  font-size: 19px; -webkit-text-stroke-width: 5px; text-shadow: 0 3px 0 var(--ink);
}

.boost {
  position: absolute; display: none;
  bottom: calc(var(--sab) + 28px); left: calc(var(--sal) + 22px);
  width: 86px; height: 86px; border-radius: 50%;
  flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  background: var(--cream-2); border: 3px solid var(--ink); box-shadow: var(--pop);
  color: var(--ink-3);
  touch-action: none;
  transition: transform 0.1s var(--ease), box-shadow 0.1s var(--ease), background 0.2s, color 0.2s;
}
.boost .ic { position: relative; width: 32px; height: 32px; stroke-width: 3.2; }
.boost-tx { position: relative; font: 700 12px/1 var(--display); letter-spacing: 0.02em; }
.boost-ring { position: absolute; inset: -9px; border-radius: 50%; pointer-events: none; }
.boost.is-ready {
  background: radial-gradient(circle at 50% 30%, var(--red-lt), var(--red) 60%, var(--red-dk));
  color: var(--cream);
}
.boost.is-ready .ic, .boost.is-ready .boost-tx { filter: drop-shadow(0 2px 0 var(--ink)); }
.boost.is-ready .boost-ring { border: 3px solid var(--gold); box-shadow: 0 0 14px rgba(245, 198, 74, 0.8); animation: ring 1.6s ease-in-out infinite; }
@keyframes ring { 50% { transform: scale(1.06); opacity: 0.6; } }
.boost.is-cooling { background: var(--cream-2); color: var(--ink-2); }
.boost.is-cooling .boost-ring {
  background: repeating-conic-gradient(var(--red) 0 15deg, var(--cream) 15deg 30deg);
  -webkit-mask: radial-gradient(circle, transparent 46px, #000 47px); mask: radial-gradient(circle, transparent 46px, #000 47px);
  border: 2px solid var(--ink); animation: spin 1.2s linear infinite;
}
.boost.is-hit { transform: translateY(4px) scale(0.94); box-shadow: 0 1px 0 var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }

@media (pointer: coarse) {
  .boost { display: flex; }
  .hint, .watermark, .kbd-hint { display: none; }
}

/* Thumb stick (js/input.js): rests lower right while playing on a touch
   screen and jumps under the thumb when touched. Touches pass through it to
   the game. The clock steps aside while you play so the corner is free. */
.stick {
  position: fixed; z-index: 3; display: none; pointer-events: none;
  left: calc(100vw - var(--frame) - env(safe-area-inset-right, 0px) - 82px);
  top: calc(100dvh - var(--frame) - env(safe-area-inset-bottom, 0px) - 94px);
  width: 128px; height: 128px; margin: -64px 0 0 -64px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 248, 239, 0.28) 0 40%, rgba(255, 248, 239, 0.5) 41% 100%);
  border: 3px solid rgba(18, 11, 34, 0.75); box-shadow: 0 4px 0 rgba(18, 11, 34, 0.35);
  opacity: 0.6; transition: opacity 0.2s, left 0.25s var(--spring), top 0.25s var(--spring);
}
.stick::before {
  content: ''; position: absolute; inset: 22px; border-radius: 50%;
  border: 2.5px dashed rgba(18, 11, 34, 0.25);
}
.stick.is-on { display: block; }
.stick.is-held { opacity: 0.95; transition: opacity 0.1s; }
.stick-knob {
  position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%;
  background: radial-gradient(circle at 50% 30%, var(--red-lt), var(--red) 60%, var(--red-dk));
  border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink), inset 0 3px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.18s var(--spring);
}
.stick.is-held .stick-knob { transition: none; }
@media (pointer: coarse) {
  .hud[data-mode="playing"] .corner { display: none; }
}

/* toasts */
.toasts {
  position: absolute; z-index: 60; left: 50%; transform: translateX(-50%);
  top: calc(var(--sat) + var(--edge) + 4px);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  width: max-content; max-width: calc(100vw - 32px);
}
.toast {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 18px 9px 12px; border-radius: 999px;
  background: var(--cream); border: 2.5px solid var(--ink); box-shadow: var(--pop-s);
  font: 800 14px/1.2 var(--body); color: var(--ink);
  animation: toast-in 0.5s var(--spring) both;
}
.toast .sparkle { position: static; width: 18px; height: 18px; flex: none; }
.toast.out { animation: toast-out 0.4s var(--ease) both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-12px) scale(0.8); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-8px) scale(0.92); } }
.hud[data-mode="landing"] .toasts { top: auto; bottom: calc(var(--sab) + 84px); left: auto; right: calc(var(--sar) + var(--edge)); transform: none; align-items: flex-end; }

/* ======================================================================
   DEATH
   ====================================================================== */

.death { display: grid; place-items: center; padding: 20px; background: rgba(18, 11, 34, 0.42); }
.death-card {
  pointer-events: auto;
  width: min(370px, 100%); padding: 24px 24px 20px; border-radius: 28px;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px;
  transform: translateY(24px) scale(0.9); opacity: 0;
  transition: transform 0.55s var(--spring), opacity 0.3s var(--ease);
}
.hud[data-mode="dead"] .death-card { transform: none; opacity: 1; }
.holly-card { top: -22px; right: 22px; width: 50px; transform: rotate(10deg); z-index: 3; }
.death-ball { width: 78px; height: 70px; margin-top: 2px; }
.death-ball .ball { width: 100%; height: 100%; transform-origin: 50% 95%; animation: dizzy 2.2s ease-in-out infinite; }
@keyframes dizzy { 0%, 100% { transform: rotate(-7deg) scale(1.04, 0.9); } 50% { transform: rotate(7deg) scale(1.04, 0.9); } }
.death-t { font: 700 27px/1.15 var(--display); }
.death-t b { color: var(--red); font-weight: 700; }
.death-mass {
  display: flex; align-items: center; gap: 10px; margin: 0 0 6px;
  padding: 7px 16px; border-radius: 999px; background: var(--cream-2); border: 2.5px solid var(--ink);
}
.death-mass span { font: 900 10.5px/1 var(--body); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); }
.death-mass b { font: 700 22px/1 var(--display); font-variant-numeric: tabular-nums; }
.death-card .btn { width: 100%; }
.death-card .btn-soft { height: 50px; font-size: 16px; }
.death-card .btn-soft .ic { width: 24px; height: 24px; }
.kbd-hint { font: 800 12px/1 var(--body); color: var(--ink-3); }

/* ======================================================================
   OVERLAYS
   ====================================================================== */

.ov {
  position: absolute; inset: 0; z-index: 40;
  display: grid; place-items: center; padding: calc(var(--sat) + 34px) 24px calc(var(--sab) + 24px);
  /* a definite row, so the panel's max-height: 100% holds and its body scrolls */
  grid-template-rows: minmax(0, 1fr);
  visibility: hidden; pointer-events: none;
  transition: visibility 0s linear 0.35s;
}
.ov.is-open { visibility: visible; transition: visibility 0s; }
.ov-dim {
  position: absolute; inset: 0; pointer-events: auto;
  background: rgba(18, 11, 34, 0.55);
  opacity: 0; transition: opacity 0.3s var(--ease);
}
.ov.is-open .ov-dim { opacity: 1; }
.panel {
  position: relative; width: 100%; max-height: 100%;
  background: var(--cream); color: var(--ink);
  border: 3px solid var(--ink); border-radius: 30px;
  box-shadow: 0 8px 0 var(--ink);
  opacity: 0; transform: translateY(30px) scale(0.94);
  transition: opacity 0.25s var(--ease), transform 0.5s var(--spring);
  -webkit-user-select: text; user-select: text;
}
.ov.is-open .panel { opacity: 1; transform: none; }
.panel-cal { display: flex; flex-direction: column; }
.grab { display: none; }

/* the door view scrolls its body so the snow on its top edge stays put */
.panel-cal .cal-body, .panel-sp { overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--cream-3) transparent; }

.panel-cal .cal-body { min-height: 0; }
.panel-head { display: flex; align-items: center; gap: 16px; padding: 22px 22px 0; flex: none; }

/* --- door view: one door, a way back to the calendar --- */
.panel-cal { max-width: 480px; }
.cal-body { padding: 16px 22px 24px; }
.back {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 18px 0 12px; border-radius: 999px;
  background: var(--cream); border: 2.5px solid var(--ink); box-shadow: var(--pop-xs); color: var(--ink);
  font: 700 16px/1 var(--display); transition: transform 0.2s var(--spring), background 0.2s;
}
.back .ic { width: 20px; height: 20px; stroke-width: 3; transition: transform 0.25s var(--spring); }
.back:hover { background: var(--snow); }
.back:hover .ic { transform: translateX(-3px); }

.dd-main { display: contents; }
.dd {
  --c: var(--gold); --on: var(--ink);
  position: relative;
  display: flex; flex-direction: column; gap: 16px;
  animation: dd-in 0.4s var(--spring);
}
@keyframes dd-in { from { opacity: 0; transform: translateY(10px) scale(0.97); } }
.dd-head { display: flex; align-items: center; gap: 14px; }
.dd-n {
  display: grid; place-items: center; min-width: 74px; height: 74px; padding: 0 8px; border-radius: 20px;
  background: var(--cream-2); border: 3px solid var(--ink); box-shadow: var(--pop-xs);
  font: 700 44px/1 var(--display); color: var(--red); font-variant-numeric: tabular-nums;
}
.dd.is-open .dd-n { background: var(--gold); color: var(--cream); -webkit-text-stroke: 6px var(--ink); paint-order: stroke fill; }
.dd.is-past.is-sold .dd-n { background: var(--c); color: var(--on); }
.dd-date { font: 700 18px/1 var(--display); margin-bottom: 8px; }
.dd-who {
  padding: 14px 16px; border-radius: 18px;
  background: var(--c); color: var(--on); border: 3px solid var(--ink); box-shadow: var(--pop-xs);
}
.dd-sponsor { font: 700 24px/1.15 var(--display); }
.dd-tag { margin-top: 4px; font: 700 14px/1.45 var(--body); opacity: 0.85; }
.dd-offer {
  display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 18px;
  background: var(--cream); border: 2.5px dashed var(--ink);
}
.dd-offer-t { font: 600 19px/1.3 var(--display); }
.code {
  display: flex; align-items: center; gap: 8px; padding: 5px 5px 5px 16px; border-radius: 14px;
  background: var(--snow); border: 2.5px solid var(--ink);
}
.code-v { flex: 1; min-width: 0; font: 700 19px/1 var(--display); letter-spacing: 0.14em; overflow: hidden; text-overflow: ellipsis; -webkit-user-select: all; user-select: all; }
.code-copy {
  display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 14px; border-radius: 11px;
  background: var(--gold); border: 2.5px solid var(--ink); box-shadow: 0 3px 0 var(--ink);
  font: 700 14px/1 var(--display); transition: transform 0.1s, box-shadow 0.1s;
}
.code-copy .ic { width: 16px; height: 16px; stroke-width: 2.8; }
.code-copy:active { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
.code-copy.is-done { background: var(--green); color: var(--cream); }
.dd-link {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; min-height: 36px;
  font: 600 16px/1 var(--display); color: var(--red);
  text-decoration: underline wavy; text-decoration-thickness: 1.5px; text-underline-offset: 6px;
}
.dd-link .ic { width: 16px; height: 16px; stroke-width: 3; }
.dd-link:hover { color: var(--red-dk); }
.dd-empty { font: 700 15px/1.5 var(--body); color: var(--ink-2); }

/* the e-mail signup: the door view's main ask */
.dd-sub { padding: 18px; border-radius: 22px; background: var(--snow); border: 3px solid var(--ink); box-shadow: var(--pop-s); }
.dd-sub-form { display: flex; flex-direction: column; gap: 12px; }
.dd-sub-t { font: 700 24px/1.15 var(--display); }
.dd-sub-why { margin-top: -4px; font: 700 14px/1.5 var(--body); color: var(--ink-2); }
.dd-sub-go { width: 100%; margin-top: 2px; }
.dd-sub-s { text-align: center; font: 700 12px/1.45 var(--body); color: var(--ink-2); }
.dd-sub-s a { color: var(--ink); text-decoration: underline; text-decoration-color: rgba(18, 11, 34, 0.35); text-underline-offset: 3px; white-space: nowrap; }
.dd-sub-s a:hover { color: var(--red); }
.dd-sub-ok { display: flex; align-items: center; gap: 10px; font: 700 14px/1.4 var(--body); color: var(--ink-2); }
.dd-sub-ok b { color: var(--ink); overflow-wrap: anywhere; }
.dd-sub-ok-ic { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--green); color: var(--cream); border: 2.5px solid var(--ink); }
.dd-sub-ok-ic .ic { width: 15px; height: 15px; stroke-width: 3.4; }
.dd-sub-chg { margin-left: auto; flex: none; min-height: 32px; padding: 0 4px; font: 800 13px/1 var(--body); color: var(--ink-2); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; text-decoration-color: rgba(18, 11, 34, 0.3); }
.dd-sub-chg:hover { color: var(--red); }

/* --- sponsor overlay --- */
.panel-sp { max-width: 1000px; max-height: min(880px, 100%); }
.x-float { position: sticky; top: 18px; float: right; margin: 18px 18px 0 0; z-index: 4; }
.sp-hero { position: relative; padding: 60px 48px 0; border-radius: 27px 27px 0 0; background: linear-gradient(180deg, #fff1df, var(--cream)); }
.sp-hero .lights { top: 6px; left: 36px; width: calc(100% - 72px); }
.sp-hero .lights-s { display: none; }
.sp-hero h2 em { font-style: normal; color: var(--red); }
.sp-hero h2 { margin-top: 4px; max-width: 16em; padding-right: 56px; font: 700 clamp(30px, 3.8vw, 42px)/1.1 var(--display); }

.sp-sec { padding: 22px 48px 30px; }
.sp-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }

.sp-legend { display: flex; align-items: center; gap: 5px; font: 800 12px/1 var(--body); color: var(--ink-2); }
.sp-legend i { width: 13px; height: 13px; border-radius: 4px; border: 2px solid var(--ink); margin-left: 9px; }
.lg-avail { background: var(--snow); }
.lg-prem { background: var(--gold); }
.lg-taken { background: repeating-linear-gradient(45deg, var(--cream-3) 0 3px, var(--cream-2) 3px 6px); }
.sp-note { font: 700 14px/1.55 var(--body); color: var(--ink-2); }

/* sale tiles: plain cards, availability only */
.doors-sale { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 10px; }
.door-sale {
  aspect-ratio: 1 / 0.92; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between;
  padding: 9px 10px; border-radius: 14px; perspective: none;
  background: var(--snow); border: 2.5px solid var(--ink); box-shadow: var(--pop-xs);
}
.door-sale .door-n { font: 700 22px/1 var(--display); color: var(--ink); }
.door-p { font: 700 14px/1 var(--display); color: var(--green); white-space: nowrap; }
.door-s { font: 800 10.5px/1.1 var(--body); color: var(--ink-3); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.door-star { position: absolute; top: 6px; right: 6px; }
.door-star .ic { width: 18px; height: 18px; }
.door-sale.is-prem.is-avail { background: linear-gradient(180deg, var(--gold-lt), var(--gold)); }
.door-sale.is-prem.is-avail .door-p { color: var(--ink); }
.door-sale.is-taken {
  cursor: default; box-shadow: none; border-color: rgba(18, 11, 34, 0.35);
  background: repeating-linear-gradient(45deg, var(--cream-3) 0 4px, var(--cream-2) 4px 8px);
}
.door-sale.is-taken .door-n { color: var(--ink-3); }
@media (hover: hover) { .door-sale.is-taken:hover { transform: none; } }
.door-sale.is-sel { background: var(--red); transform: translateY(-3px) rotate(-2deg); box-shadow: var(--pop-s); }
.door-sale.is-sel .door-n, .door-sale.is-sel .door-p { color: var(--cream); }
.door-sale.is-sel::after { display: none; }

.sp-cta {
  position: sticky; bottom: 0; z-index: 3;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 16px 28px 18px 48px; border-top: 3px solid var(--ink); border-radius: 0 0 27px 27px;
  background: var(--cream-2);
}
.sp-cta-l { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.sp-cta-t { font: 700 15px/1.3 var(--body); color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-cta-t b { font: 700 17px/1 var(--display); color: var(--ink); }
.sp-cta-t .cta-p { display: none; }
.sp-mail { display: inline-flex; align-items: center; gap: 7px; font: 800 13px/1 var(--body); color: var(--ink-2); align-self: flex-start; }
.sp-mail .ic { width: 17px; height: 17px; stroke-width: 2.4; }
.sp-mail:hover { color: var(--red); }
.btn-reserve { flex: none; }
.btn-sub { font: 700 14px/1 var(--display); padding-left: 12px; border-left: 2px solid rgba(255, 248, 239, 0.45); }

/* ======================================================================
   Responsive
   ====================================================================== */

@media (max-width: 1180px) and (min-width: 900px) {
  .corner { flex-direction: column-reverse; align-items: flex-end; }
}

/* Wide screens: a lobby — calendar on the left, the play card bottom-right,
   the live world in between. */
@media (min-width: 1000px) and (min-height: 600px) {
  .play-card {
    position: fixed; z-index: 2; width: 400px;
    right: calc(var(--sar) + var(--edge)); bottom: calc(var(--sab) + var(--edge) + 60px);
    animation-delay: 0.25s;
  }
  .form-head { display: flex; margin: -2px 0 2px; }
  .doors-land .door { aspect-ratio: 1 / 0.86; }
  .landing-inner { margin: 0; padding-top: 4px; }
  .hud[data-mode="landing"] .toasts { bottom: auto; top: calc(var(--sat) + var(--edge) + 84px); }
}
@media (min-width: 1000px) and (max-width: 1199px) and (min-height: 600px) {
  .play-card { width: 370px; }
  .hud[data-mode="landing"] .toasts { top: calc(var(--sat) + var(--edge) + 140px); }
}

@media (min-width: 900px) and (max-height: 760px) {
  .landing-col { padding-top: calc(var(--sat) + 22px); padding-bottom: calc(var(--sab) + 18px); }
  .landing-inner { gap: 14px; }
  .wordmark { font-size: 42px; }
  .tagline { font-size: 14px; padding: 5px 14px; }
  .count-u { width: 66px; padding: 6px 0 5px; }
  .count-u b { font-size: 27px; }
  .doors-land .door { aspect-ratio: 1 / 0.7; }
  .cal-card { padding: 20px 13px 13px; }
  .play-card { padding: 18px 13px 10px; gap: 10px; }
  .skin { height: 42px; }
  .avatar { width: 52px; height: 52px; }
  .field { height: 48px; }
  .btn-play { height: 56px; }
}

@media (max-width: 899px) and (min-height: 521px), (max-width: 559px) {
  :root { --edge: 12px; }

  /* landing becomes a bottom sheet; the world shows above it */
  .hud[data-mode="landing"] .brand-top { display: block; }
  .landing-col {
    top: auto; right: 0; width: auto; max-height: calc(100% - var(--sat) - 112px);
    padding: 26px calc(var(--sar) + 14px) calc(var(--sab) + 16px) calc(var(--sal) + 14px);
  }
  .landing-inner { max-width: 560px; margin: auto auto 0; gap: 12px; }
  .brand { display: none; }
  .hero { align-items: center; }
  .count { gap: 7px; }
  .count-u { width: 64px; padding: 5px 0 4px; border-radius: 14px; gap: 3px; }
  .count-u b { font-size: 24px; }
  .count-u span { letter-spacing: 0.06em; }
  .hero-t { font-size: 29px; -webkit-text-stroke-width: 6px; text-align: center; }
  .cal-card { padding: 20px 11px 12px; border-radius: 22px; }
  .cal-card .cal-legend { display: none; }
  .doors { gap: 6px; }
  .door { border-radius: 11px; }
  .door-n, .door-bn { font-size: clamp(19px, 4.2vw, 27px); }
  .door-bow { width: 30px; margin-left: -15px; top: -11px; }
  .skins { gap: 2px; }
  .skin { height: 42px; }
  .skin .ball { width: 31px; height: 31px; }
  .live { right: auto; bottom: auto; left: calc(var(--sal) + 12px); top: calc(var(--sat) + var(--edge) + 54px); height: 34px; padding: 0 11px; gap: 7px; font-size: 12px; max-width: calc(100% - 124px); overflow: hidden; }
  .live b { font-size: 13.5px; }
  .live > span { overflow: hidden; text-overflow: ellipsis; }
  .live .sep { margin: 0 5px; }
  .live .wide-only { display: none; }
  .doors-land .door-flake { top: 2px; right: 3px; }

  /* phones: the beanies and Spēlēt share one card under the calendar — one tap to play */
  .play-card { padding: 12px 12px 14px; gap: 12px; }
  .play-card .form-head { display: none; }
  .btn-play { margin-top: 0; }

  /* top bar: brand left, compact sponsor button + clock right */
  .corner { gap: 8px; }
  .clock { height: 36px; padding: 0 11px; gap: 6px; font-size: 14px; }
  .clock-ic .ic { width: 19px; height: 19px; }
  .clock-p { display: none; }
  .hud[data-mode="landing"] .clock { position: absolute; top: 54px; right: 0; height: 34px; }
  .btn-sponsor { height: 46px; padding: 0 15px 0 5px; gap: 8px; }
  .btn-sponsor-ic { width: 34px; height: 34px; }
  .btn-sponsor-ic .ic { width: 21px; height: 21px; }
  .btn-sponsor-tx b { font-size: 16px; }
  .btn-sponsor-tx small, .btn-sponsor-ar { display: none; }
  .btn-sponsor .sparkle.sp-a { left: 22px; top: -8px; }

  /* in-game: Kalendārs top-left, board top-right,
     clock bottom-left, boost bottom-right */
  .exit { height: 52px; padding: 0 14px 0 6px; gap: 8px; }
  .exit-back { display: none; }
  .exit-door { width: 38px; height: 38px; }
  .exit-n { font-size: 18px; }
  .exit-tx { font-size: 17px; }
  .board { top: calc(var(--sat) + var(--edge)); }
  .board { width: 156px; padding: 10px 4px 4px; }
  .board .drift-l { display: none; }
  .board-t { padding: 0 8px 4px; font-size: 14px; }
  .board li { height: 25px; padding: 0 7px; gap: 5px; font-size: 12px; }
  .board li:nth-child(n+4):not(.me) { display: none; }
  .b-name em { display: none; }
  .b-mass { font-size: 11.5px; }
  .hud[data-mode="playing"] .corner, .hud[data-mode="dead"] .corner { top: auto; bottom: calc(var(--sab) + 28px); right: auto; left: calc(var(--sal) + var(--edge)); }
  /* narrow desktop windows (no touch): the clock owns the bottom-left, so the
     key hint rides one row above it and the watermark steps aside */
  .hint { bottom: calc(var(--sab) + 82px); max-width: calc(100% - 24px); }
  .watermark { display: none; }
  .toasts { top: auto; bottom: calc(var(--sab) + 132px); }
  .hud[data-mode="landing"] .toasts { top: calc(var(--sat) + 100px); bottom: auto; left: 50%; right: auto; transform: translateX(-50%); align-items: center; }
  .boost { width: 80px; height: 80px; bottom: calc(var(--sab) + 24px); left: calc(var(--sal) + 16px); }
  .boost.is-cooling .boost-ring { -webkit-mask: radial-gradient(circle, transparent 43px, #000 44px); mask: radial-gradient(circle, transparent 43px, #000 44px); }

  /* overlays become bottom sheets */
  .ov { place-items: end stretch; padding: calc(var(--sat) + 26px) 0 0; }
  .panel {
    border-radius: 28px 28px 0 0; border-bottom: 0; max-height: 100%; box-shadow: none;
    transform: translateY(60px); padding-bottom: var(--sab);
  }
  .grab { display: block; flex: none; width: 44px; height: 5px; border-radius: 5px; margin: 10px auto -6px; background: rgba(18, 11, 34, 0.2); }
  /* full width like the sponsor sheet; content lines up with the landing column (560px) */
  .panel-cal { max-width: none; }
  .panel-cal :is(.panel-head, .cal-body) { padding-left: max(16px, (100% - 560px) / 2); padding-right: max(16px, (100% - 560px) / 2); }
}

@media (max-width: 559px) {
  .hint { display: none; }
}

@media (max-width: 759px) {
  .panel-head { padding: 16px 16px 0; }
  .cal-body { padding: 12px 14px 22px; }
  .dd { gap: 14px; }
  .dd-sub { padding: 16px 14px; }
  .dd-sub-t { font-size: 22px; }
  .dd-n { min-width: 62px; height: 62px; font-size: 36px; }
  .dd-sponsor { font-size: 21px; }

  .x-float { top: 12px; margin: 12px 12px 0 0; }
  .sp-hero { padding: 44px 20px 0; border-radius: 25px 25px 0 0; }
  .sp-hero .lights { left: 16px; width: calc(100% - 80px); top: 8px; }
  .sp-hero .lights-l { display: none; }
  .sp-hero .lights-s { display: block; }
  .sp-hero h2 { font-size: 28px; padding-right: 44px; max-width: none; }
  .sp-sec { padding: 16px 18px 22px; }
  .sp-sec-head { flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 12px; }
  .sp-legend i:first-child { margin-left: 0; }
  .doors-sale { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .door-sale { padding: 8px 9px; }
  .door-sale .door-n { font-size: 20px; }
  .sp-cta { flex-wrap: wrap; padding: 12px 16px calc(var(--sab) + 14px); gap: 10px; border-radius: 0; margin-bottom: calc(var(--sab) * -1); }
  .sp-cta-l { flex: 1 1 100%; flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; padding: 0 4px; }
  .sp-cta-t { font-size: 13.5px; }
  .sp-cta-t .cta-p { display: inline; }
  .sp-mail { flex: none; align-self: auto; }
  .btn-reserve { flex: 1 1 100%; height: 56px; font-size: 18px; }
  .btn-reserve .btn-sub { display: none; }
}

@media (min-width: 760px) and (max-width: 1000px) {
  .doors-sale { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* Short landscape phones keep the side column, compacted */
@media (max-height: 520px) and (min-width: 560px) {
  :root { --edge: 12px; }
  .landing-col { width: min(440px, 52vw); padding-top: calc(var(--sat) + 18px); padding-left: calc(var(--sal) + 20px); padding-right: 20px; }
  .landing-inner { gap: 14px; margin: 0; }
  .wordmark { font-size: 34px; }
  .wordmark .holly { width: 36px; right: -28px; top: -12px; }
  .tagline { display: none; }
  .count-u { width: 60px; padding: 4px 0; }
  .count-u b { font-size: 21px; }
  .count-u span { letter-spacing: 0.06em; }
  .cal-card .cal-legend { display: none; }
  .doors-land .door { aspect-ratio: 1 / 0.62; min-height: 40px; }
  .doors-land .door-n, .doors-land .door-bn { font-size: 17px; }
  .btn-sponsor { height: 50px; }
  .btn-sponsor-tx small { display: none; }
  .btn-sponsor-ic { width: 36px; height: 36px; }
  .exit { height: 48px; padding: 0 14px 0 6px; }
  .exit-door { width: 34px; height: 34px; }
  .board { top: calc(var(--sat) + var(--edge) + 52px); }
  .board li:nth-child(n+5):not(.me) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .hud *, .hud *::before, .hud *::after { animation-duration: 0.001s !important; animation-iteration-count: 1 !important; transition-duration: 0.001s !important; }
}
