/* Jungle Pop - "lacquered relief" interface. Flat illustrated shapes, carved
   stone, one warm light. Fonts are Rubik (UI) and Bagel Fat One (display). */

@font-face {
  font-family: "Bagel Fat One";
  src: url("../fonts/bagel-fat-one-latin.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Rubik";
  src: url("../fonts/rubik-latin.woff2") format("woff2");
  font-weight: 500 700; font-style: normal; font-display: swap;
}

:root {
  --deep: #0B1F17;
  --foliage-mid: #143A2A;
  --foliage-light: #1F5A3D;
  --stone: #6E7A68;
  --stone-light: #A9B39C;
  --stone-shadow: #3A433A;
  --gold: #E2B04A;
  --gold-deep: #9A6A1E;
  --cream: #F4ECD8;
  --coral: #F0584A;
  --leaf: #5BC94A;
  --sapphire: #3E7BEA;
  --golden: #F7C531;
  --disp: "Bagel Fat One", system-ui, sans-serif;
  --ui: "Rubik", system-ui, -apple-system, sans-serif;
  --hud-h: 60px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  overflow: hidden;
  background: var(--deep);
  color: var(--cream);
  font-family: var(--ui);
  font-weight: 500;
  -webkit-tap-highlight-color: transparent;
  user-select: none; -webkit-user-select: none;
}

/* flat layered emerald foliage silhouettes fill the screen behind the framed stage */
body::before {
  content: "";
  position: fixed; inset: 0;
  background: url("../assets/cinematic/backdrop.webp") center / cover no-repeat, var(--deep);
  z-index: 0;
}

#stage {
  position: fixed; inset: 0; z-index: 1;
  display: flex; flex-direction: column; align-items: center;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}

/* ---------- carved text ---------- */
.carved {
  color: var(--cream);
  text-shadow:
    3px 0 0 var(--deep), -3px 0 0 var(--deep), 0 3px 0 var(--deep), 0 -3px 0 var(--deep),
    2px 2px 0 var(--deep), -2px 2px 0 var(--deep), 2px -2px 0 var(--deep), -2px -2px 0 var(--deep),
    0 6px 0 var(--gold-deep);
}
.label {
  font: 600 11px/1 var(--ui);
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--stone-light);
}

/* ---------- frame + arena ---------- */
#frame {
  flex: 1 1 auto; min-height: 0; width: 100%;
  display: flex; align-items: center; justify-content: center;
  position: relative; padding: 6px 8px 10px;
}
#arena {
  position: relative;
  overflow: hidden;
  container-type: size;
  container-name: arena;
  border-radius: 18px;
  background: radial-gradient(120% 86% at 50% 6%,
    #26694a 0%, var(--foliage-mid) 42%, var(--deep) 100%);
  box-shadow:
    inset 0 0 0 8px var(--gold-deep),
    inset 0 0 0 6px #2b3127,
    inset 0 0 0 8px rgba(169,179,156,0.35),
    inset 0 0 46px rgba(0,0,0,0.42),
    0 18px 36px rgba(0,0,0,0.6);
}
#arena-bg {
  position: absolute; inset: 0;
  background: radial-gradient(120% 62% at 50% 46%,
    rgba(4,12,9,0.16) 0%, rgba(4,12,9,0.05) 60%, rgba(4,12,9,0) 100%);
}
#game {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  touch-action: none; cursor: crosshair; display: block;
}

/* ---------- HUD: a carved, gold-trimmed lintel inside the arena frame ---------- */
#hud {
  position: absolute; top: 0; left: 0; right: 0;
  width: auto;
  min-height: var(--hud-h);
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: 7px 20px 7px 16px;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.05) 0 20px, rgba(0,0,0,0.045) 20px 40px),
    linear-gradient(180deg, #8f9a82 0%, var(--stone) 46%, #49513f 100%);
  border-bottom: 3px solid var(--gold-deep);
  box-shadow:
    inset 0 3px 0 var(--stone-light),
    inset 0 -5px 0 var(--stone-shadow),
    0 10px 24px rgba(0,0,0,0.5);
  z-index: 5;
  pointer-events: none;
  transition: opacity 0.3s ease;
  overflow: visible;
}
#hud::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 6px; height: 2px;
  background: linear-gradient(90deg, rgba(226,176,74,0) 0%, rgba(226,176,74,0.9) 50%, rgba(226,176,74,0) 100%);
  pointer-events: none;
}
#hud.idle { opacity: 0; }
#hud button { pointer-events: auto; }
.hud-left { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; }
.hud-mid { display: flex; align-items: center; gap: 10px; }
.hud-right { display: flex; align-items: center; }
.stat { display: flex; flex-direction: column; line-height: 1; }
.stat .label { color: rgba(11,31,23,0.7); font-size: 11px; text-shadow: 0 1px 0 rgba(255,255,255,0.3); }
.stat .value {
  font-family: var(--disp);
  font-weight: 400;
  font-size: clamp(26px, 7.6vw, 38px);
  color: var(--cream);
  text-shadow: 0 2px 0 var(--deep), 0 4px 0 var(--gold-deep);
  font-variant-numeric: tabular-nums;
}
.stat.small { flex-direction: row; align-items: baseline; gap: 6px; }
.stat.small .value {
  font-family: var(--ui); font-weight: 700;
  font-size: 15px; color: #12261b;
  text-shadow: none; font-variant-numeric: tabular-nums;
}

.rowdial {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  min-width: 52px;
  background: radial-gradient(circle at 50% 20%, #727c69, #4c5448);
  border-radius: 10px;
  padding: 4px 8px;
  box-shadow: inset 0 2px 0 var(--stone-light), inset 0 -2px 0 var(--stone-shadow);
}
.rowdial .label { color: rgba(11,31,23,0.7); font-size: 10px; }
.rowdial .value {
  font-family: var(--disp); font-weight: 400; font-size: 25px; color: var(--cream);
  text-shadow: 0 2px 0 var(--deep), 0 4px 0 var(--gold-deep); line-height: 1; font-variant-numeric: tabular-nums;
}
.pips { display: flex; gap: 2px; }
.pips i { width: 5px; height: 5px; border-radius: 50%; background: rgba(11,31,23,0.4); }
.pips i.on { background: var(--golden); box-shadow: 0 0 3px var(--golden); }

.ember {
  position: relative; width: 42px; height: 42px; border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, #838d7a, #4c5448);
  box-shadow: inset 0 2px 0 var(--stone-light), inset 0 -3px 0 var(--stone-shadow);
  overflow: hidden;
}
.ember-orb {
  position: absolute; left: 0; bottom: 0; width: 100%; height: 0%;
  background: linear-gradient(180deg, var(--golden), #FF7A1F);
  transition: height 0.25s ease;
}
.ember-count {
  position: absolute; inset: 0; display: grid; place-items: center;
  font: 700 13px var(--ui); color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.7);
  font-variant-numeric: tabular-nums;
}
.ember.ready .ember-orb { height: 100%; box-shadow: 0 0 10px var(--golden); }
.ember.armed { animation: pulse 0.7s infinite alternate; }
@keyframes pulse { from { box-shadow: 0 0 6px rgba(255,180,60,0.5); } to { box-shadow: 0 0 16px rgba(255,180,60,1); } }

.streak {
  position: absolute; top: calc(100% + 8px); right: 12px;
  min-width: 54px; height: 54px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--disp); font-size: 28px; color: var(--cream);
  background: radial-gradient(circle at 36% 30%, #8b9682, var(--stone) 55%, #4c5448);
  box-shadow: inset 0 2px 0 var(--stone-light), inset 0 -3px 0 var(--stone-shadow), 0 4px 10px rgba(0,0,0,0.5);
  opacity: 0; transform: scale(0.6);
  transition: opacity 0.15s, transform 0.15s;
  pointer-events: none;
}
.streak.on { opacity: 1; transform: scale(1); }

/* ---------- round stone icon buttons ---------- */
.round-stone {
  width: 48px; height: 48px; border-radius: 50%;
  border: none; cursor: pointer; padding: 0;
  display: grid; place-items: center; position: relative;
  background: radial-gradient(circle at 36% 30%, #8b9682, var(--stone) 55%, #4c5448);
  box-shadow: inset 0 2px 0 var(--stone-light), inset 0 -3px 0 var(--stone-shadow),
    0 4px 0 #2c332c, 0 8px 14px rgba(0,0,0,0.42);
}
.round-stone svg { width: 26px; height: 26px; fill: var(--cream); stroke: var(--cream); }
.round-stone svg [fill="none"] { stroke-linejoin: round; }
.round-stone:active { transform: translateY(2px); box-shadow: inset 0 2px 0 var(--stone-light), inset 0 -3px 0 var(--stone-shadow), 0 2px 0 #2c332c; }
.round-stone:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.round-stone .slash {
  position: absolute; width: 66%; height: 3.5px; border-radius: 2px;
  background: var(--stone-shadow);
  box-shadow: 0 1px 0 rgba(255,255,255,0.3);
  transform: rotate(-45deg); opacity: 0; transition: opacity 0.15s;
}
.round-stone.off { filter: saturate(0.7) brightness(0.9); }
.round-stone.off svg { opacity: 0.42; }
.round-stone.off .slash { opacity: 0.95; }

/* ---------- carved stone tablets (buttons) ---------- */
.tablet {
  position: relative;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  border: none; cursor: pointer; white-space: nowrap;
  background: linear-gradient(180deg, #848f7c, var(--stone) 44%, #525b4d);
  color: var(--cream);
  border-radius: 12px;
  box-shadow:
    inset 0 2px 0 var(--stone-light),
    inset 0 -4px 0 var(--stone-shadow),
    0 4px 0 #2c332c,
    0 9px 18px rgba(0,0,0,0.42);
}
.tablet:active {
  transform: translateY(3px);
  box-shadow: inset 0 2px 0 var(--stone-light), inset 0 -4px 0 var(--stone-shadow), 0 1px 0 #2c332c;
}
.tablet:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.tablet-play {
  width: calc(100% - 32px); height: 64px;
  font-family: var(--disp); font-size: 28px; color: var(--cream);
  text-transform: uppercase; letter-spacing: 0.03em;
  text-shadow: 0 3px 0 var(--deep), 0 6px 0 var(--gold-deep);
}
.tablet-play::before {
  content: ""; position: absolute; inset: 5px; border-radius: 9px;
  border: 3px solid var(--gold); pointer-events: none;
  box-shadow: inset 0 0 0 1px var(--gold-deep);
}
.tablet-sm {
  flex: 1 1 0; min-width: 0; height: 46px; padding: 0 10px;
  font: 600 12px var(--ui); letter-spacing: 0.12em; text-transform: uppercase;
  overflow: hidden;
}
.pager-btn { flex: 0 0 auto; height: 40px; padding: 0 16px; font: 600 12px var(--ui); letter-spacing: 0.1em; text-transform: uppercase; }
.pager-btn:disabled { opacity: 0.4; }

/* ---------- overlays ---------- */
.overlay {
  position: absolute; inset: 0; z-index: 6;
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
  background: radial-gradient(82% 72% at 50% 40%, rgba(11,31,23,0.74), rgba(6,15,11,0.94));
  backdrop-filter: blur(3px);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 0.28s ease, visibility 0s linear 0.28s;
}
.overlay.show { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity 0.28s ease; }
.panel {
  width: 100%; max-width: 340px; max-height: 96%;
  overflow-y: auto;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 11px;
  transform: translateY(10px) scale(0.98);
  transition: transform 0.3s cubic-bezier(0.22, 0.7, 0.24, 1);
}
.overlay.show .panel { transform: translateY(0) scale(1); }
.panel h2 {
  margin: 0; font-family: var(--disp); font-size: clamp(24px, 8vw, 34px);
  color: var(--cream); text-shadow: 0 3px 0 var(--deep), 0 6px 0 var(--gold-deep);
}

/* ---------- cover: the game's own stage at rest ---------- */
.cover-overlay {
  padding: 0;
  align-items: stretch; justify-content: flex-start;
  flex-direction: column;
  background-color: var(--deep);
  background-image: url("../assets/cover/jungle_pop_shrine.jpg");
  background-size: cover; background-position: center top; background-repeat: no-repeat;
  backdrop-filter: none;
}
.cover-scrim {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg,
    rgba(11,31,23,0.18) 0%, rgba(11,31,23,0.04) 26%,
    rgba(6,14,10,0.34) 58%, rgba(5,12,9,0.82) 82%, rgba(4,10,7,0.95) 100%);
}
.cover-lintel {
  position: relative; text-align: center; padding-top: 3.4cqh;
}
.cover-jungle {
  font: 700 clamp(15px, 4.6cqw, 30px)/1 var(--ui);
  letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--cream);
  text-shadow: 0 2px 0 var(--deep), 0 0 6px rgba(11,31,23,0.85);
  padding-left: 0.3em;
}
.cover-stage {
  position: relative; flex: 1 1 auto;
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 1.5cqh;
}
.pop-wordmark {
  margin: 0; display: flex; align-items: flex-end; justify-content: center;
  gap: 0;
  filter: drop-shadow(0 10px 16px rgba(0,0,0,0.55));
  animation: popbob 3s ease-in-out infinite;
}
@keyframes popbob { 0%,100% { transform: translateY(-3px); } 50% { transform: translateY(3px); } }
.pop-letter { position: relative; display: block; margin: 0 -1.8cqw; }
.pop-letter svg { display: block; width: auto; }
/* each P is narrower and a little taller than the O */
.pop-p1 svg, .pop-p2 svg { height: min(54cqw, 50cqh); }
.pop-o svg { height: min(44cqw, 42cqh); z-index: 2; }
.pop-p1, .pop-p2 { z-index: 1; }
.pop-sym {
  position: absolute; display: grid; place-items: center;
  width: 26%; aspect-ratio: 1; border-radius: 50%;
  border: 3px solid var(--deep);
  box-shadow: inset 0 -3px 5px rgba(0,0,0,0.35), inset 0 3px 4px rgba(255,255,255,0.55), 0 2px 4px rgba(0,0,0,0.4);
}
.pop-p1 .pop-sym { background: radial-gradient(circle at 35% 28%, #ffd3cb, var(--coral) 60%, #7A1F16); }
.pop-o .pop-sym { background: radial-gradient(circle at 35% 28%, #c8f7b6, var(--leaf) 60%, #24651B); }
.pop-p2 .pop-sym { background: radial-gradient(circle at 35% 28%, #c3d6ff, var(--sapphire) 60%, #173C86); }
.pop-sym svg { width: 62%; height: 62%; fill: rgba(255,255,255,0.95); stroke: rgba(255,255,255,0.95); filter: drop-shadow(0 1px 1px rgba(0,0,0,0.45)); }
/* the P counter sits upper-middle; the O counter is centred */
.pop-p1 .pop-sym, .pop-p2 .pop-sym { left: 41%; top: 45%; width: 23%; }
.pop-o .pop-sym { left: 50%; top: 50%; transform: translate(-50%, -50%); width: 26%; }
.cover-cham {
  position: absolute; left: 50%; bottom: 72%;
  width: 82%; height: auto;
  transform: translateX(-52%);
  filter: drop-shadow(0 6px 8px rgba(0,0,0,0.45));
}
.cover-hang {
  position: absolute; top: 55cqw; left: 50%; transform: translateX(-50%);
  display: flex; gap: 0.6cqw; align-items: flex-start;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.5));
}
.hangbub {
  width: 8cqw; height: 8cqw; border-radius: 50%;
  display: grid; place-items: center; position: relative;
  box-shadow: inset -2px -3px 6px rgba(0,0,0,0.35), inset 3px 3px 6px rgba(255,255,255,0.5), 0 2px 4px rgba(0,0,0,0.4);
  border: 2px solid rgba(11,31,23,0.5);
}
.hangbub:nth-child(2) { margin-top: 4cqw; }
.hangbub:nth-child(4) { margin-top: 2cqw; }
.hangbub svg { width: 58%; height: 58%; fill: rgba(255,255,255,0.9); stroke: rgba(255,255,255,0.9); stroke-width: 1.4; }
.hb-red { background: radial-gradient(circle at 34% 28%, #ffd3cb, var(--coral) 58%, #7A1F16); }
.hb-green { background: radial-gradient(circle at 34% 28%, #c8f7b6, var(--leaf) 58%, #24651B); }
.hb-blue { background: radial-gradient(circle at 34% 28%, #c3d6ff, var(--sapphire) 58%, #173C86); }
.hb-yellow { background: radial-gradient(circle at 34% 28%, #fff0b8, var(--golden) 58%, #855E0A); }

.cover-bottom {
  position: relative; flex: 0 0 auto;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  width: 100%; padding: 0 0 calc(16px + env(safe-area-inset-bottom));
}
.best-medallion {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  min-width: 92px; padding: 6px 18px 8px; border-radius: 40px;
  background: radial-gradient(circle at 50% 24%, #7d8773, var(--stone) 52%, #434b40);
  box-shadow: inset 0 2px 0 var(--stone-light), inset 0 -4px 0 var(--stone-shadow), 0 5px 12px rgba(0,0,0,0.45);
  border: 2px solid var(--stone-shadow);
}
.best-medallion .label { color: rgba(11,31,23,0.6); font-size: 10px; }
.best-medallion b {
  font-family: var(--ui); font-weight: 700; font-size: 24px; color: var(--cream);
  text-shadow: 0 2px 0 var(--deep), 0 4px 0 var(--gold-deep);
  font-variant-numeric: tabular-nums;
}
.tablet-row { display: flex; gap: 10px; width: calc(100% - 32px); }
.icon-row { display: flex; gap: 14px; justify-content: center; margin-top: 2px; }

/* ---------- hints ---------- */
.hints {
  position: absolute; left: 50%; bottom: 27%;
  transform: translate(-50%, 12px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 4;
}
.hints.show { opacity: 1; transform: translate(-50%, 0); }
.hint-card {
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(180deg, #6E7A68, #4c5448);
  border: 2px solid var(--stone-shadow);
  border-radius: 12px; padding: 9px 13px;
  font: 500 14px var(--ui); color: var(--cream);
  box-shadow: inset 0 2px 0 var(--stone-light), 0 8px 20px rgba(0,0,0,0.5);
  pointer-events: auto; max-width: 92vw; white-space: nowrap;
}
.hint-step { font-size: 11px; opacity: 0.7; font-weight: 600; }
.hint-skip {
  pointer-events: auto; background: 0; border: 0;
  color: var(--golden); font: 600 12px var(--ui);
  cursor: pointer; padding: 0 2px;
}

/* ---------- leaderboard ---------- */
.board-overlay { z-index: 9; }
.board-panel {
  max-width: 380px; text-align: left;
  background: linear-gradient(180deg, #5f6a5b, #3f473c);
  border: 3px solid var(--stone-shadow);
  border-radius: 16px;
  padding: 14px 14px calc(12px + env(safe-area-inset-bottom));
  gap: 9px;
  box-shadow: inset 0 2px 0 var(--stone-light), 0 16px 34px rgba(0,0,0,0.55);
}
.board-top { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.board-top h2 { font-size: clamp(20px, 6vw, 26px); }
.board-you { width: 100%; font: 700 12px var(--ui); color: var(--golden); min-height: 15px; text-align: left; }
.board-list { width: 100%; min-height: 250px; gap: 3px; }
.board-pager { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pager-page { font: 600 11px var(--ui); letter-spacing: 0.1em; text-transform: uppercase; color: var(--stone-light); white-space: nowrap; }

.lb-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.lb-row { display: flex; align-items: center; gap: 9px; font: 500 12px var(--ui); line-height: 1.3; padding: 3px 7px; border-radius: 7px; }
.lb-rank { flex: 0 0 30px; color: var(--stone-light); font-weight: 700; font-variant-numeric: tabular-nums; }
.lb-name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--cream); }
.lb-val { flex: 0 0 auto; font-weight: 700; color: var(--golden); font-variant-numeric: tabular-nums; }
.lb-rank.medal {
  flex: 0 0 24px; height: 24px; line-height: 24px; text-align: center;
  border-radius: 50%; font-size: 12px; font-weight: 700; color: #221703;
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.6), inset 0 -3px 0 rgba(0,0,0,0.28), 0 2px 5px rgba(0,0,0,0.5);
}
.lb-row.top1 { background: linear-gradient(90deg, rgba(226,176,74,0.34), rgba(226,176,74,0.05)); }
.lb-row.top2 { background: linear-gradient(90deg, rgba(169,179,156,0.32), rgba(169,179,156,0.05)); }
.lb-row.top3 { background: linear-gradient(90deg, rgba(184,124,76,0.32), rgba(184,124,76,0.05)); }
.lb-row.top1 .lb-rank.medal { background: linear-gradient(180deg, #ffe9a3, #d9a125); }
.lb-row.top2 .lb-rank.medal { background: linear-gradient(180deg, #eef3e6, #a9b39c); }
.lb-row.top3 .lb-rank.medal { background: linear-gradient(180deg, #f2c49a, #b87334); }
.lb-row.top1 { padding-top: 6px; padding-bottom: 6px; }
.lb-row.top1 .lb-name, .lb-row.top2 .lb-name, .lb-row.top3 .lb-name { font-weight: 700; }
.lb-row.top1 .lb-val { color: #ffe9a3; }
.lb-row.top2 .lb-val { color: #eef3e6; }
.lb-row.top3 .lb-val { color: #f0c08e; }
.lb-row.me { background: linear-gradient(90deg, #E2B04A, #FFD873); }
.lb-row.me .lb-name, .lb-row.me .lb-val, .lb-row.me .lb-rank { color: #12261b; }
.lb-row.me .lb-rank.medal { box-shadow: none; background: none; border: 2px solid #12261b; }
.lb-sep { text-align: center; color: var(--stone-light); opacity: 0.5; font-size: 10px; line-height: 1; }
.lb-empty { font: 500 12px var(--ui); opacity: 0.7; padding: 6px 2px; }
.lb-note { font: 500 10px var(--ui); opacity: 0.6; line-height: 1.35; text-align: left; }

/* ---------- final score panel ---------- */
.final { width: 100%; }
.final-row { display: flex; justify-content: space-between; align-items: center; padding: 7px 4px; border-bottom: 1px solid rgba(169,179,156,0.22); font: 500 15px var(--ui); }
.final-row b { font-family: var(--disp); font-size: 20px; color: var(--cream); text-shadow: 0 2px 0 var(--deep), 0 4px 0 var(--gold-deep); font-variant-numeric: tabular-nums; }
.new-best {
  display: none; color: #12261b;
  background: linear-gradient(180deg, #FFE89A, #F7C531);
  padding: 5px 15px; border-radius: 20px;
  font: 700 13px var(--ui); letter-spacing: 0.06em; text-transform: uppercase;
}
.new-best.show { display: inline-block; animation: popin 0.4s ease; }
@keyframes popin { from { transform: scale(0.6); } to { transform: scale(1); } }
.place-line { font: 600 13px var(--ui); color: var(--golden); min-height: 15px; }

@media (prefers-reduced-motion: reduce) {
  .pop-wordmark { animation: none; }
}

/* ---------- short / landscape screens ---------- */
@media (max-height: 560px) {
  .overlay { align-items: flex-start; overflow-y: auto; padding: 10px; }
  .panel { gap: 7px; }
  #hud { padding: 0 10px; gap: 5px; }
  .stat .value { font-size: 18px; }
  .stat .label { font-size: 8px; }
  .stat.small .value { font-size: 12px; }
  .rowdial { padding: 2px 7px; }
  .rowdial .value { font-size: 16px; }
  .ember { width: 30px; height: 30px; }
  .round-stone { width: 38px; height: 38px; }
  .round-stone svg { width: 19px; height: 19px; }
  .cover-bottom { gap: 7px; padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  .cover-lintel { padding-top: 4cqh; }
  .tablet-play { height: 50px; font-size: 22px; }
  .tablet-sm { height: 38px; font-size: 10px; letter-spacing: 0.05em; padding: 0 8px; }
  .best-medallion { padding: 3px 14px 5px; }
  .best-medallion b { font-size: 22px; }
  .panel h2 { font-size: 22px; }
  .final-row { padding: 5px 4px; font-size: 13px; }
  .board-panel { padding: 10px 10px calc(8px + env(safe-area-inset-bottom)); gap: 6px; }
  .board-list { min-height: 150px; }
  .lb-row { font-size: 11px; padding: 2px 6px; }
  .lb-rank.medal { flex: 0 0 20px; height: 20px; line-height: 20px; font-size: 11px; }
}
