/* BallBrawl — "Night Arena": a slate UI over the current arena's sky (themes.js swaps the sky per arena).
   Flat navy panels with a dark stroke and a solid drop edge; yellow is the one call to action. */
:root {
  --floor: #203A5E;
  --panel: #3A2617; /* dark walnut */
  --panel-2: #4B321E;
  --grain: repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.1) 0 2px, transparent 2px 38px), repeating-linear-gradient(90deg, rgba(255, 225, 180, 0.035) 0 1px, transparent 1px 19px); /* planks */
  --stroke: #0A0E1F;
  --text: #FFFFFF;
  --muted: #D2BC98;
  --gold: #FFCC33;
  --gold-ink: #3A2500;
  --go: #36D27A;
  --go-ink: #06301A;
  --you: #4CC9F0;
  --foe: #FF4D5E;
  --lift: 0 4px 0 var(--stroke);
  --stroke-text: 0 2px 0 var(--stroke), 2px 0 0 var(--stroke), -2px 0 0 var(--stroke), 0 -2px 0 var(--stroke), 0 3px 0 var(--stroke);
  --display: 'Russo One', Nunito, system-ui, sans-serif;
  --hi: #6E4B2B; /* the lit top edge of a panel */
  --rar-common: #A9B8D0; --rar-rare: #4C9EFF; --rar-epic: #B05CFF; --rar-legend: #FFB627; /* one rarity set everywhere */
  --sky: /* Night Arena; other arenas set their own sky from themes.js */
    radial-gradient(1.5px 1.5px at 12% 18%, #fff 50%, transparent 51%), radial-gradient(1.5px 1.5px at 78% 9%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 33% 41%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 88% 36%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 56% 22%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 8% 63%, #fff 50%, transparent 51%),
    linear-gradient(180deg, #0F0F23 0%, #111B38 55%, #14284A 100%);
  --size: 360px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center;
  background: var(--sky) fixed;
  color: var(--text);
  font: 700 16px/1.35 Nunito, system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; }
a { color: var(--text); }
h2 { margin: 0; font-size: 24px; font-weight: 900; }
.muted { color: var(--muted); font-size: 14px; margin: 6px 0 12px; }
.center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 14px; }
.grow { flex: 1; }
.wide-btn { width: 100%; margin: 8px 0; }

/* ---------- header ---------- */
.bar { position: relative; z-index: 20; width: min(100%, 600px); display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; }
.brand { font-weight: 900; font-size: 24px; text-shadow: var(--stroke-text); }
.brand b { color: var(--gold); }
.pill {
  display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px 0 9px;
  border-radius: 12px; background: var(--grain), var(--panel); border: 3px solid var(--stroke); box-shadow: var(--lift); font-weight: 900;
}
.icon-btn {
  width: 44px; height: 44px; display: grid; place-items: center; padding: 0; cursor: pointer;
  border-radius: 12px; background: var(--grain), var(--panel); border: 3px solid var(--stroke); box-shadow: var(--lift); color: var(--text);
}
.icon-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--stroke); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.sm { width: 36px; height: 36px; border-radius: 12px; }
.icon-btn.sm svg { width: 18px; height: 18px; }
.gem { display: inline-block; flex: none; width: 22px; height: 22px; background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'><circle cx='16' cy='16' r='13.2' fill='%237E3FE6'/><path d='M16.0 8.4 L16.0 2.8 L23.8 5.3 L18.6 12.4Z' fill='%23A66BFF'/><path d='M18.6 12.4 L23.8 5.3 L28.6 11.9 L23.2 13.7Z' fill='%236A2BD0'/><path d='M23.2 13.7 L28.6 11.9 L28.6 20.1 L20.2 17.4Z' fill='%23A66BFF'/><path d='M20.2 17.4 L28.6 20.1 L23.8 26.7 L20.5 22.1Z' fill='%236A2BD0'/><path d='M20.5 22.1 L23.8 26.7 L16.0 29.2 L16.0 20.4Z' fill='%23A66BFF'/><path d='M16.0 20.4 L16.0 29.2 L8.2 26.7 L11.5 22.1Z' fill='%236A2BD0'/><path d='M11.5 22.1 L8.2 26.7 L3.4 20.1 L11.8 17.4Z' fill='%23A66BFF'/><path d='M11.8 17.4 L3.4 20.1 L3.4 11.9 L8.8 13.7Z' fill='%236A2BD0'/><path d='M8.8 13.7 L3.4 11.9 L8.2 5.3 L13.4 12.4Z' fill='%23A66BFF'/><path d='M13.4 12.4 L8.2 5.3 L16.0 2.8 L16.0 8.4Z' fill='%236A2BD0'/><path d='M16.0 8.4 L18.6 12.4 L23.2 13.7 L20.2 17.4 L20.5 22.1 L16.0 20.4 L11.5 22.1 L11.8 17.4 L8.8 13.7 L13.4 12.4Z' fill='%23D9B3FF'/><circle cx='16' cy='16' r='13.2' fill='none' stroke='%231A0B33' stroke-width='2.2'/><path d='M11 6.5Q11 9 13.5 9Q11 9 11 11.5Q11 9 8.5 9Q11 9 11 6.5Z' fill='%23FFFFFF'/></svg>") center / contain no-repeat; }
.coin { display: inline-block; flex: none; width: 22px; height: 22px; background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'><circle cx='16' cy='16.5' r='14.5' fill='%23D98E00' stroke='%230F1F38' stroke-width='2'/><circle cx='16' cy='15' r='12' fill='%23FFCC33'/><circle cx='16' cy='15' r='8.8' fill='none' stroke='%23E59F00' stroke-width='1.6'/><path d='M16 9.2l1.8 3.7 4 .6-2.9 2.8.7 4-3.6-1.9-3.6 1.9.7-4-2.9-2.8 4-.6z' fill='%23FFF1B0' stroke='%23C98200' stroke-width='1.1' stroke-linejoin='round'/><path d='M8 11.5a8.8 8.8 0 0 1 5-5' fill='none' stroke='%23FFFFFF' stroke-width='1.8' stroke-linecap='round' opacity='.85'/></svg>") center / contain no-repeat; }
.trophy { display: inline-block; width: 18px; height: 18px; flex: none; background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'><path d='M9.5 8H5v2.6a5 5 0 0 0 5.4 4.8M22.5 8H27v2.6a5 5 0 0 1-5.4 4.8' fill='none' stroke='%230F1F38' stroke-width='4.4' stroke-linecap='round'/><path d='M9.5 8H5v2.6a5 5 0 0 0 5.4 4.8M22.5 8H27v2.6a5 5 0 0 1-5.4 4.8' fill='none' stroke='%23FFCC33' stroke-width='2' stroke-linecap='round'/><path d='M9 4.5h14v8a7 7 0 0 1-14 0z' fill='%23FFCC33' stroke='%230F1F38' stroke-width='2' stroke-linejoin='round'/><path d='M13.8 19h4.4v4.2h-4.4z' fill='%23E09A00' stroke='%230F1F38' stroke-width='2' stroke-linejoin='round'/><rect x='9' y='23' width='14' height='5.5' rx='1.6' fill='%23C98A4B' stroke='%230F1F38' stroke-width='2'/><path d='M12.6 7.5v4' stroke='%23FFF1B0' stroke-width='2' stroke-linecap='round'/></svg>") center / contain no-repeat; }
.trophies { display: inline-flex; align-items: center; gap: 5px; font-weight: 900; color: var(--gold); }

/* ---------- battle ---------- */
.stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 0 12px; }
.hud {
  width: var(--size); height: 58px; padding: 0 8px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  border-radius: 16px; background: var(--grain), var(--panel); border: 3px solid var(--stroke);
}
.dots { display: flex; gap: 5px; align-items: center; }
.dots.foe { justify-content: flex-end; }
.por {
  position: relative; display: inline-grid; place-items: center; overflow: hidden; flex: none;
  width: 30px; height: 30px; border-radius: 50%; background: var(--floor); border: 2.5px solid var(--you);
}
.foe .por { border-color: var(--foe); }
.por.cur { width: 42px; height: 42px; border-width: 3px; }
.por canvas { display: block; margin-top: -4px; }
.por.dead { border-color: #3D5A85; opacity: 0.7; }
.por.dead::after { content: '\2715'; color: #FF8F9B; font-weight: 900; font-size: 15px; }
.hud-mid { font-weight: 900; font-size: 14px; text-align: center; white-space: nowrap; padding: 0 6px; }
.hud-mid.sudden { color: var(--foe); }
.arena-wrap { position: relative; border-radius: 8px; overflow: hidden; box-shadow: 0 14px 26px rgba(15, 31, 56, 0.45); }
canvas { display: block; touch-action: none; cursor: crosshair; }
.banner {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; opacity: 0;
  padding: 0 16px; text-align: center; font-weight: 900; font-size: clamp(26px, 8vw, 44px);
  text-shadow: 0 4px 0 var(--stroke), 3px 0 0 var(--stroke), -3px 0 0 var(--stroke), 0 -3px 0 var(--stroke);
}
.banner.show { animation: pop 1.5s ease-out forwards; }
.banner.stay { animation: popstay 0.4s ease-out forwards; }
.banner.you { color: #9BE7FF; }
.banner.foe { color: #FF9AA6; }
@keyframes pop {
  0% { opacity: 0; transform: scale(0.6); }
  15% { opacity: 1; transform: scale(1.08); }
  25% { transform: scale(1); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.05); }
}
@keyframes popstay { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: scale(1); } }
.banner b { color: #FFFFFF; margin: 0 0.2em; }
.banner small { display: block; margin-top: 6px; font-size: 0.5em; color: #FFCC33; }
.cards { position: absolute; left: 6px; right: 6px; top: 6px; display: flex; justify-content: space-between; gap: 8px; pointer-events: none; transition: opacity 0.3s; }
.cards.fade { opacity: 0; }
.cardab {
  display: flex; align-items: center; gap: 5px; max-width: 46%; padding: 4px 7px 4px 4px; border-radius: 12px;
  background: rgba(15, 31, 56, 0.92); border: 1.5px solid rgba(169, 193, 228, 0.5); font-size: 10px; line-height: 1.15;
}
.cardab.foe { flex-direction: row-reverse; text-align: right; }
.cardab canvas { flex: none; border-radius: 8px; background: var(--floor); }
.cardab b { display: block; font-size: 11px; font-weight: 900; }
.cardab small { display: block; font-weight: 700; color: var(--muted); }
body.record { background: #000; }
.record header, .record footer, .record #watch-bar, .record .hud .dots { display: none !important; }
.record .stage { flex: 1; width: min(100vw, calc(100dvh * 9 / 16)); padding: 0 12px; background: var(--sky); }
.record .hud { grid-template-columns: 1fr; height: 70px; }
.record .hud-mid { font-size: 18px; }
.hint {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); pointer-events: none;
  padding: 7px 14px; border-radius: 999px; background: rgba(15, 31, 56, 0.88);
  font-weight: 800; font-size: 13px; white-space: nowrap; animation: bob 1.6s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translate(-50%, -4px); } }
.controls { position: relative; width: var(--size); height: 88px; display: flex; align-items: center; justify-content: space-between; }
.pips { display: flex; gap: 10px; }
.pip {
  --p: 0; width: 48px; height: 54px; display: grid; place-items: center; border-radius: 12px;
  border: 3px solid var(--stroke); box-shadow: var(--lift);
  background: linear-gradient(to top, rgba(255, 204, 51, 0.45) calc(var(--p) * 100%), var(--panel) 0);
}
.pip svg { width: 26px; height: 26px; fill: #3D5A85; }
.pip.on { background: var(--gold); }
.pip.on svg { fill: var(--gold-ink); }
.super-btn {
  --p: 0; width: 84px; height: 84px; padding: 6px; border-radius: 50%; cursor: pointer;
  border: 3px solid var(--stroke); box-shadow: var(--lift);
  background: conic-gradient(var(--gold) calc(var(--p) * 1turn), var(--panel) 0);
}
.super-btn span {
  display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%;
  background: var(--grain), var(--panel); border: 3px solid var(--stroke);
  font-weight: 900; font-size: 13px; text-transform: uppercase; color: var(--muted);
}
.super-btn:disabled { cursor: default; }
.super-btn.ready { animation: pulse 0.9s ease-in-out infinite; }
.super-btn.ready span { background: var(--gold); color: var(--gold-ink); }
.super-btn:active span { transform: scale(0.94); }
@keyframes pulse { 50% { transform: scale(1.06); } }
.watch-bar { display: flex; gap: 10px; }
.foot { padding: 14px; font-size: 13px; }
.foot a { color: var(--panel); }

/* ---------- buttons ---------- */
.btn {
  padding: 14px 18px; border-radius: 16px; cursor: pointer; font-weight: 900;
  border: 3px solid var(--stroke); background: var(--grain), var(--panel-2); color: var(--text); box-shadow: 0 5px 0 var(--stroke);
  transition: transform 0.06s, box-shadow 0.06s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--stroke); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: 0 5px 0 var(--stroke); }
.btn.primary { background: var(--gold); color: var(--gold-ink); }
.btn.ad { background: var(--go); color: var(--go-ink); display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn.ad::before { content: ''; border-left: 11px solid currentColor; border-top: 7px solid transparent; border-bottom: 7px solid transparent; }
.btn.ad small { font-weight: 800; opacity: 0.75; font-size: 12px; }
.btn.ghost { background: transparent; box-shadow: none; border-color: rgba(255, 255, 255, 0.3); }
.btn.big { font-size: 22px; padding: 16px; }
.btn.sm { padding: 8px 12px; font-size: 14px; border-radius: 12px; border-width: 2.5px; box-shadow: 0 3px 0 var(--stroke); }
.btn.sm:active { box-shadow: 0 1px 0 var(--stroke); }
.btn.danger { color: #FF8F9B; border-color: rgba(255, 77, 94, 0.5); margin-top: 18px; }
.btn.share { width: 100%; margin-bottom: 12px; }
.price { display: inline-flex; align-items: center; gap: 4px; }
.price .coin { width: 15px; height: 15px; }

/* ---------- overlays ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 30; display: grid; place-items: start center;
  padding: 16px; overflow-y: auto; background: rgba(15, 31, 56, 0.55);
}
.overlay > .card { margin: auto 0; }
.card {
  width: min(100%, 380px); min-width: 0; padding: 22px; border-radius: 16px;
  background: var(--grain), var(--panel); border: 3px solid var(--stroke); box-shadow: 0 8px 0 var(--stroke);
  animation: rise 0.22s ease-out;
}
.card.wide { width: min(100%, 580px); }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.chip { display: inline-block; padding: 6px 12px; border-radius: 999px; background: var(--grain), var(--panel-2); font-weight: 800; font-size: 13px; color: var(--muted); }
.sticky {
  position: sticky; bottom: -22px; margin: 0 -22px -22px; padding: 12px 22px 22px;
  background: var(--grain), var(--panel); border-top: 3px solid var(--stroke); border-radius: 0 0 13px 13px;
}
.result { text-align: center; }
.trophy-line { display: flex; justify-content: center; align-items: center; gap: 8px; margin: 4px 0; font-size: 24px; font-weight: 900; }
.trophy-line .up { color: var(--go); }
.trophy-line .down { color: #FF8F9B; }
.reply-note { margin: 0 0 12px; padding: 10px 12px; border-radius: 12px; background: var(--grain), var(--panel-2); border: 2px solid var(--gold); font-weight: 800; }
.ball-hero { display: grid; place-items: center; margin: 4px 0 6px; }
.sup-line { color: var(--muted); font-size: 14px; }
.sup-line b { color: var(--gold); }
.reward h2 { font-size: 22px; }
.pop { animation: popin 0.6s cubic-bezier(0.2, 1.6, 0.4, 1); }
@keyframes popin { from { transform: scale(0.2) rotate(-20deg); opacity: 0; } }
.code-hero { font: 900 34px ui-monospace, Consolas, monospace; letter-spacing: 4px; color: var(--gold); }
.skin-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 8px; }
.skin {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 2px; cursor: pointer;
  border-radius: 12px; background: var(--grain), var(--panel-2); border: 2.5px solid var(--stroke); font-size: 11px; font-weight: 800; color: var(--muted);
}
.skin.on { border-color: var(--gold); color: var(--text); }
.skin .price { font-size: 11px; }
.skin.locked canvas { opacity: 0.55; }
#r-squad.sad canvas { animation: none; filter: grayscale(0.7) brightness(0.8); }

/* squad picker */
.versus { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; }
.slots { display: flex; gap: 8px; }
.slot {
  position: relative; width: 64px; height: 64px; display: grid; place-items: center; padding: 0; cursor: pointer;
  border-radius: 16px; background: var(--grain), var(--panel-2); border: 2.5px dashed #7A5634;
}
.slot.active { border: 3px solid var(--gold); }
.slot b {
  position: absolute; top: -9px; left: -9px; width: 22px; height: 22px; display: grid; place-items: center;
  border-radius: 50%; background: var(--you); color: #05202B; border: 2.5px solid var(--stroke); font-size: 12px;
}
.vs { font-weight: 900; font-size: 26px; color: var(--gold); }
.enemy { text-align: right; margin-left: auto; }
.enemy small { color: var(--foe); font-weight: 900; }
.mini-row { display: flex; gap: 4px; margin-top: 4px; }
.mini-row canvas { border-radius: 50%; box-shadow: 0 0 0 2px var(--foe); }
.mini-row.big { justify-content: center; gap: 10px; margin: 16px 0 8px; }
.mini-row.big canvas { box-shadow: 0 0 0 3px var(--foe); }
.squad-note { margin: 0 0 6px; font-weight: 800; font-size: 13px; color: var(--muted); }
.squad-note.live { color: var(--go); }
.s-info { margin: 0 0 14px; padding: 10px 12px; border-radius: 12px; font-size: 13px; color: var(--muted); background: var(--stroke); }
.s-info b { color: var(--text); font-size: 15px; }
.s-info em { font-style: normal; color: var(--gold); font-weight: 800; }

/* spectator picker */
.you-label { color: var(--you); font-weight: 900; display: block; margin-top: 8px; }
.foe-label { color: var(--foe); font-weight: 900; display: block; margin-top: 12px; }
.pick-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.pick {
  width: 74px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px; cursor: pointer;
  border-radius: 16px; background: var(--grain), var(--panel-2); border: 2.5px solid var(--stroke); font-size: 11px; font-weight: 800; color: var(--muted);
}
.pick.sel, .pick.sel-avatar { border-color: var(--you); color: var(--text); }
#w-right .pick.sel { border-color: var(--foe); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; max-width: calc(100% - 32px);
  padding: 12px 18px; border-radius: 999px; background: var(--grain), var(--panel); border: 3px solid var(--stroke); box-shadow: var(--lift);
  font-weight: 800; text-align: center; animation: rise 0.2s ease-out;
}
.confetti { position: fixed; top: 55%; z-index: 60; border-radius: 2px; pointer-events: none; animation: confetti 1.5s cubic-bezier(0.2, 0.6, 0.4, 1) forwards; }
@keyframes confetti {
  0% { transform: translate(0, 0) rotate(0); opacity: 1; }
  45% { transform: translate(calc(var(--dx) * 0.6), var(--dy)) rotate(calc(var(--r) * 0.5)); opacity: 1; }
  100% { transform: translate(var(--dx), calc(var(--dy) * -0.6 + 240px)) rotate(var(--r)); opacity: 0; }
}

/* ---------- home: lobby + pages ---------- */
.page { position: fixed; inset: 0; z-index: 9; padding-top: 68px; display: flex; justify-content: center; background: var(--sky); }
.page-in { width: min(100%, 560px); height: 100%; min-height: 0; display: flex; flex-direction: column; }
.badge { position: absolute; top: -6px; right: 0; width: 18px; height: 18px; border-radius: 50%; background: var(--foe); border: 3px solid var(--stroke); }

.lobby { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; padding: 0 14px calc(14px + env(safe-area-inset-bottom)); }
.me {
  align-self: flex-start; max-width: 100%; display: flex; gap: 10px; align-items: center; padding: 6px 16px 6px 6px;
  border-radius: 16px; background: var(--grain), var(--panel); border: 3px solid var(--stroke); box-shadow: var(--lift);
}
.avatar canvas { display: block; border-radius: 50%; box-shadow: 0 0 0 2.5px var(--you); }
.me-txt { display: flex; flex-direction: column; min-width: 0; }
.me-txt b { font-weight: 900; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* the hero: your squad standing in the current arena (a perspective stage, arenaSvg in meta.js) */
.hero {
  flex: 1; min-height: 0; container-type: size; display: flex; justify-content: center; align-items: flex-start;
  padding: 0; border: 0; background: none; cursor: pointer; color: var(--text);
}
.ah { position: relative; width: min(100cqw - 2 * var(--side-room, 0px), (100cqh - 20px) * 0.8136); aspect-ratio: 358 / 440; }
.ah-art svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hero-wrap { position: relative; flex: 1; min-height: 0; display: flex; container-type: size; }
.ah-name { /* the arena name over the back wall: tap to swipe through every arena */
  position: absolute; z-index: 3; left: 50%; top: calc(min((100cqw - 2 * var(--side-room, 0px)) / 0.8136, 100cqh - 20px) * 0.05); translate: -50% 0;
  display: flex; flex-direction: column; align-items: center; gap: 3px; white-space: nowrap; cursor: pointer;
  padding: 4px 14px; border: 0; border-radius: 12px; background: rgba(10, 14, 31, 0.35); color: var(--text);
}
.ah-name b::before { content: '\2039  '; color: var(--muted); }
.ah-name b::after { content: '  \203A'; color: var(--muted); }
.ah-name:active { transform: scale(0.96); }
.ah-name small { font-weight: 900; font-size: 10px; line-height: 1; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); }
.ah-name b { font: 400 clamp(14px, 5.4cqw, 20px)/1 var(--display); letter-spacing: 0.5px; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5); }
.trio { position: relative; z-index: 1; display: flex; align-items: flex-end; justify-content: center; }
.trio canvas { animation: float 2.6s ease-in-out infinite; }
.hero .trio { position: absolute; inset: 0; }
.hero .trio canvas { position: absolute; translate: -50% -53%; height: auto !important; }
.hero .trio canvas:nth-child(1) { left: 21.2%; top: 64.1%; width: 37.5% !important; animation-delay: -0.9s; }
.hero .trio canvas:nth-child(2) { left: 50%; top: 72.3%; width: 64.8% !important; z-index: 1; }
.hero .trio canvas:nth-child(3) { left: 78.8%; top: 64.1%; width: 37.5% !important; animation-delay: -1.7s; }
@keyframes float { 50% { transform: translateY(-7px); } }
.hero:active .trio { transform: scale(0.98); }
.nameplate {
  position: absolute; z-index: 2; left: 50%; bottom: -18px; translate: -50% 0; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 7px 20px 8px; border-radius: 12px; background: var(--grain), var(--panel); box-shadow: inset 0 2px 0 var(--hi), 0 4px 0 var(--stroke); white-space: nowrap;
}
.nameplate b { font: 400 24px/1 var(--display); letter-spacing: 0.5px; }
.nameplate small { font-weight: 900; font-size: 11px; line-height: 1.2; letter-spacing: 0.8px; text-transform: uppercase; color: var(--muted); }

.road-bar {
  position: relative; flex: none; height: 44px; margin-top: 8px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 0 6px 0 12px; border: 0; border-radius: 12px; cursor: pointer; color: var(--text); text-align: left; background: var(--grain), var(--panel);
  box-shadow: inset 0 0 0 1.5px rgba(255, 204, 51, 0.4), inset 0 3px 0 var(--hi), 0 4px 0 var(--stroke);
}
.road-bar:active { transform: translateY(3px); box-shadow: inset 0 0 0 1.5px rgba(255, 204, 51, 0.4), inset 0 3px 0 var(--hi), 0 1px 0 var(--stroke); }
.rb-tr { display: flex; align-items: center; gap: 5px; }
.rb-tr .trophy { width: 22px; height: 22px; }
.rb-tr b { font-size: 18px; font-weight: 900; color: var(--gold); }
.rb-mid { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.rb-mid small { font-weight: 900; font-size: 11px; line-height: 1.2; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rb-bar { display: block; height: 8px; border-radius: 999px; background: var(--stroke); overflow: hidden; }
.rb-bar i { display: block; height: 100%; border-radius: 999px; background: var(--gold); }
.road-bar .badge { top: -6px; right: -6px; width: 16px; height: 16px; border-color: var(--panel); }

/* Play: the one yellow thing on the screen, with the mode in small caps */
.play-line { flex: none; display: flex; gap: 10px; align-items: stretch; }
.play {
  flex: 1; min-width: 0; height: 80px; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 0 10px; cursor: pointer;
  color: #141414; border: 3px solid var(--stroke); border-radius: 12px; background: linear-gradient(180deg, #FFE38A 0 38%, var(--gold) 40% 100%);
  box-shadow: 0 6px 0 #A67C00, 0 6px 0 3px var(--stroke); transition: transform 0.06s, box-shadow 0.06s;
}
.play:active { transform: translateY(4px); box-shadow: 0 2px 0 #A67C00, 0 2px 0 3px var(--stroke); }
.play svg { width: 32px; height: 32px; flex: none; }
.pl-txt { display: flex; flex-direction: column; gap: 4px; min-width: 0; text-align: left; }
.pl-txt small { display: flex; align-items: center; gap: 5px; font-weight: 900; font-size: 11px; line-height: 1; letter-spacing: 1.5px; text-transform: uppercase; color: #3D2E00; white-space: nowrap; }
.pl-txt small.live::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #1F8A4C; }
.pl-txt b { font: 400 30px/1 var(--display); letter-spacing: 2px; text-transform: uppercase; }

/* the dock: six tiles under Play */
.dock { flex: none; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; margin-top: 4px; }
.sbtn {
  position: relative; min-width: 0; height: 76px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 0 1px; cursor: pointer; border: 0; border-radius: 12px; background: var(--grain), var(--panel); color: #D7E0F5; letter-spacing: -0.35px;
  box-shadow: inset 0 2px 0 var(--hi), 0 4px 0 var(--stroke); font-weight: 800; font-size: 11px; line-height: 1; transition: transform 0.06s, box-shadow 0.06s;
}
.sbtn:active { transform: translateY(3px); box-shadow: inset 0 2px 0 var(--hi), 0 1px 0 var(--stroke); }
.sbtn .ic { display: grid; place-items: center; }
.sbtn svg { width: 30px; height: 30px; overflow: visible; }
.sbtn > span:last-of-type { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sbtn .badge { top: -5px; right: -4px; width: 14px; height: 14px; border-color: var(--panel); }

.sub { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.sub-head { display: flex; align-items: center; gap: 14px; padding: 2px 16px 12px; }
.back-btn {
  width: 52px; height: 46px; flex: none; display: grid; place-items: center; padding: 0; cursor: pointer;
  border-radius: 12px; background: var(--grain), var(--panel); border: 3px solid var(--stroke); box-shadow: var(--lift);
}
.back-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--stroke); }
.back-btn svg { width: 24px; height: 24px; fill: none; stroke: #FFFFFF; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.sub-head h2 { font-size: 28px; text-shadow: var(--stroke-text); }
.tab-body { flex: 1; overflow-y: auto; padding: 0 16px 16px; overscroll-behavior: contain; }
.tab h3 { margin: 18px 0 10px; font-size: 14px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.6px; text-shadow: var(--stroke-text); }
.tab > h3:first-child { margin-top: 4px; }
.tab .muted { color: var(--text); text-shadow: 0 2px 0 var(--stroke); }
.tab .card .muted, .tab .code-box ~ .muted { text-shadow: 0 2px 0 var(--stroke); }

/* trophy road (horizontal) */
#tab-path { min-height: 100%; display: flex; flex-direction: column; justify-content: center; }
.path-hero {
  display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; padding: 12px 14px; margin: 2px 0 6px;
  border-radius: 16px; background: var(--grain), var(--panel); border: 3px solid var(--stroke); box-shadow: 0 5px 0 var(--stroke);
}
.ph-trophies { display: flex; align-items: center; gap: 8px; }
.ph-trophies .trophy { width: 40px; height: 40px; }
.ph-trophies b { font-size: 34px; font-weight: 900; color: var(--gold); }
.ph-bar { height: 12px; border-radius: 999px; background: var(--stroke); overflow: hidden; }
.ph-bar i { display: block; height: 100%; width: var(--p); border-radius: 999px; background: var(--gold); }
.big-coin { width: 54px !important; height: 54px !important; }


/* ball tiles (collection and squad picker) */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 10px; padding-bottom: 8px; }
@media (min-width: 520px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile {
  position: relative; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px 10px;
  border-radius: 16px; cursor: pointer; color: var(--text);
  background: var(--grain), var(--panel); border: 3px solid var(--stroke); box-shadow: 0 5px 0 var(--stroke);
}
.card .tile { background: var(--grain), var(--panel-2); }
.tile:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--stroke); }
.tile b { max-width: 100%; font-size: 14px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile small { display: flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 800; color: var(--muted); }
.tile small .trophy { width: 12px; height: 12px; }
.tile.locked { background: #24170D; }
.tile.locked canvas { filter: grayscale(0.85) brightness(0.65); }
.tile.locked small { color: var(--gold); }
.tile.info { border-color: var(--gold); }
.tile .pos {
  position: absolute; top: -9px; left: -7px; min-width: 24px; height: 24px; padding: 0 5px; display: grid; place-items: center;
  border-radius: 12px; background: var(--you); color: #05202B; border: 2.5px solid var(--stroke); font: 900 12px Nunito, sans-serif;
}
.tile .btn.sm { margin-top: 4px; padding: 4px 8px; font-size: 12px; }
.tile .btn.ad { padding: 4px 7px; font-size: 11px; gap: 5px; }
.tile .btn.ad::before { border-left-width: 8px; border-top-width: 5px; border-bottom-width: 5px; }
#s-cards small { color: var(--gold); }
#s-cards .tile b { font-size: 13px; }

/* quests */
.daily { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.dcell {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 2px; text-align: center;
  border-radius: 12px; background: var(--grain), var(--panel); border: 3px solid var(--stroke); font-size: 11px; font-weight: 800; color: var(--muted);
}
.dcell b { display: flex; align-items: center; gap: 2px; font-size: 13px; color: var(--text); }
.dcell.done { border-color: var(--go); opacity: 0.65; }
.dcell.today { border-color: var(--gold); color: var(--text); cursor: pointer; animation: pulse 1s ease-in-out infinite; }
.qrow {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-bottom: 8px;
  border-radius: 12px; background: var(--grain), var(--panel); border: 3px solid var(--stroke);
}
.qrow .q-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; font-weight: 800; font-size: 14px; }
.qrow .bar { height: 10px; padding: 0; border-radius: 8px; background: var(--stroke); overflow: hidden; }
.qrow .bar i { display: block; height: 100%; width: var(--p); background: var(--gold); }
.qrow small { color: var(--muted); font-weight: 800; min-width: 92px; text-align: right; } /* same width on every row, so the bars line up */
.qrow .ok { color: var(--go); font-weight: 900; }

/* leaders */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 4px 0 10px; padding: 4px; border-radius: 12px; background: var(--grain), var(--panel); border: 3px solid var(--stroke); }
.seg button { border: 0; border-radius: 12px; padding: 10px; cursor: pointer; font-weight: 900; background: transparent; color: var(--muted); }
.seg button.on { background: var(--gold); color: var(--gold-ink); }
.lrow {
  display: grid; grid-template-columns: 34px 36px 1fr auto; align-items: center; gap: 10px; padding: 8px 10px; margin-bottom: 6px;
  border-radius: 12px; background: var(--grain), var(--panel); border: 3px solid var(--stroke);
}
.lrow.mine { border-color: var(--you); }
.lrow .rk { font-weight: 900; text-align: center; color: var(--muted); }
.lrow.top1 .rk { color: #FFD23F; } .lrow.top2 .rk { color: #D6DDE8; } .lrow.top3 .rk { color: #E59A5B; }
.lrow canvas { border-radius: 50%; }
.lrow .nm { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lrow .sc { display: flex; align-items: center; gap: 4px; font-weight: 900; }
.llist .gap { text-align: center; color: var(--muted); margin: 4px 0; }

/* profile */
.nick-row { display: flex; align-items: center; justify-content: center; gap: 8px; }
.nick { font-weight: 900; color: var(--text); }
.big-nick { margin-top: 6px; }
.big-nick .nick { font-size: 24px; text-shadow: var(--stroke-text); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { padding: 12px 8px; text-align: center; border-radius: 12px; background: var(--grain), var(--panel); border: 3px solid var(--stroke); }
.stat b { display: block; font-size: 20px; font-weight: 900; }
.stat small { color: var(--muted); font-weight: 800; font-size: 11px; }
.tab .pick { background: var(--grain), var(--panel); }
.code-box { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--grain), var(--panel); border: 3px dashed var(--gold); }
.code-box b { font: 900 24px ui-monospace, Consolas, monospace; letter-spacing: 3px; }
.code-in {
  flex: 1; min-width: 0; padding: 10px 12px; border-radius: 12px; border: 3px solid var(--stroke); background: var(--grain), var(--panel);
  color: var(--text); font: 800 18px ui-monospace, Consolas, monospace; letter-spacing: 2px; text-transform: uppercase;
}

/* lobby: gift chip, chest button next to Play */
.lobby-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.lobby-top .me { min-width: 0; }
.gift-chip {
  flex: none; display: flex; align-items: center; gap: 6px; padding: 5px 10px 5px 6px; border-radius: 12px; cursor: pointer;
  border: 3px solid var(--stroke); background: var(--gold); color: var(--gold-ink); box-shadow: var(--lift);
  font-weight: 900; font-size: 12px; line-height: 1.1; text-align: left; max-width: 120px; animation: wiggle 2.4s ease-in-out infinite;
}
.gift-chip svg { width: 26px; height: 26px; flex: none; }
.gift-chip:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--stroke); }
@keyframes wiggle { 0%, 86%, 100% { transform: rotate(0); } 90% { transform: rotate(-5deg); } 94% { transform: rotate(5deg); } }
.chest-btn {
  position: relative; flex: none; width: 80px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  padding: 4px 4px 6px; border-radius: 12px; cursor: pointer; color: var(--text);
  border: 3px solid var(--stroke); background: var(--grain), var(--panel); box-shadow: inset 0 2px 0 var(--hi), 0 6px 0 var(--stroke);
}
.chest-btn:active { transform: translateY(3px); box-shadow: inset 0 2px 0 var(--hi), 0 3px 0 var(--stroke); }
.chest-art svg { display: block; width: 56px; height: auto; }
.chest-btn small { font-size: 11px; font-weight: 900; color: var(--muted); }
.chest-btn.has .chest-art svg { animation: wiggle 2s ease-in-out infinite; }
.chest-n {
  position: absolute; top: -10px; right: -8px; min-width: 26px; height: 26px; padding: 0 6px; display: grid; place-items: center;
  border-radius: 12px; background: var(--foe); color: #fff; border: 3px solid var(--stroke); font-size: 13px; font-weight: 900;
}

/* chest screen */
.ch-list { display: flex; flex-direction: column; gap: 10px; margin: 10px 0 6px; }
.ch-row {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px;
  border-radius: 16px; background: var(--grain), var(--panel-2); border: 2.5px solid var(--stroke); text-align: left;
}
.ch-row svg { display: block; width: 64px; height: auto; }
.ch-row b { font-weight: 900; font-size: 15px; }
.ch-row .cnt { color: var(--gold); margin-left: 4px; }
.ch-row small { display: block; font-size: 11px; font-weight: 700; color: var(--muted); }
.ch-row.empty svg { filter: grayscale(0.8) brightness(0.7); }
/* the opening scene */
.opener {
  position: fixed; inset: 0; z-index: 45; overflow: hidden; cursor: pointer; user-select: none; -webkit-user-select: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px 16px;
  background: radial-gradient(circle at 50% 45%, #2A4A8A 0%, #142647 45%, #0A1426 100%);
}
.opener.k-big { background: radial-gradient(circle at 50% 45%, #2E6BE0 0%, #15306E 45%, #0A1426 100%); }
.opener.k-mega { background: radial-gradient(circle at 50% 45%, #8E3FE0 0%, #3E1A7A 45%, #120A26 100%); }
.op-rays {
  position: absolute; left: 50%; top: 45%; width: 180vmax; height: 180vmax; margin: -90vmax 0 0 -90vmax; pointer-events: none;
  background: repeating-conic-gradient(rgba(255, 255, 255, 0.07) 0 8deg, transparent 8deg 20deg);
  -webkit-mask-image: radial-gradient(circle, #000 0, transparent 60%); mask-image: radial-gradient(circle, #000 0, transparent 60%);
  animation: spin 24s linear infinite;
}
@keyframes spin { to { transform: rotate(1turn); } }
.op-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.op-flash.go { animation: flash 0.5s ease-out; }
@keyframes flash { 0% { opacity: 0.95; } 100% { opacity: 0; } }
.op-title { position: relative; font-size: 30px; text-shadow: var(--stroke-text); color: var(--gold); }
.op-stage { position: relative; width: min(100%, 360px); min-height: 300px; display: grid; place-items: center; }
.opener { --glow: #FFE38A; }
.opener.k-big { --glow: #A8F0FF; }
.opener.k-mega { --glow: #FFB8FF; }
.op-chest { position: relative; width: 230px; transition: transform 0.45s cubic-bezier(0.3, 1.3, 0.5, 1); }
.op-chest .chest-svg { display: block; width: 100%; height: auto; overflow: visible; }
.op-chest .lid, .op-chest .body, .op-chest .seam { transform-box: fill-box; transform-origin: 50% 100%; }
.chest-svg .inside, .chest-svg .seam { opacity: 0; }
.op-chest .seam { opacity: calc(var(--k, 0) * 0.34); transform-origin: 50% 50%; animation: seam 0.35s ease-in-out infinite alternate; }
@keyframes seam { to { transform: scaleY(1.7); } }
.op-chest.drop { animation: opDrop 0.65s cubic-bezier(0.3, 1.4, 0.5, 1); }
@keyframes opDrop { 0% { transform: translateY(-110vh); } 70% { transform: translateY(10px) scale(1.06, 0.9); } 100% { transform: none; } }
.op-chest.idle { animation: opIdle 1.5s ease-in-out infinite; }
@keyframes opIdle { 50% { transform: translateY(-7px) scale(1.02); } }
.op-chest.hit { animation: opHit 0.32s ease-out; }
@keyframes opHit {
  0% { transform: none; } 30% { transform: scale(calc(1 + var(--k, 1) * 0.06), calc(1 - var(--k, 1) * 0.06)) rotate(calc(var(--k, 1) * -4deg)); }
  65% { transform: scale(0.95, 1.06) rotate(calc(var(--k, 1) * 3deg)); } 100% { transform: none; }
}
.op-chest.hit::after, .op-chest.open::after {
  content: ''; position: absolute; left: 50%; top: 52%; width: 10px; height: 10px; border-radius: 50%; pointer-events: none;
  box-shadow: 0 0 60px 40px var(--glow); opacity: 0.6; transform: translate(-50%, -50%); animation: glow 0.4s ease-out forwards;
}
.op-chest.open::after { box-shadow: 0 0 130px 100px var(--glow); animation: glow 1s ease-out forwards; }
@keyframes glow { from { opacity: 0.9; } to { opacity: 0; } }
.op-chest.open .inside { opacity: 1; }
.op-chest.open .seam { opacity: 0; animation: none; }
.op-chest.open .lid { animation: lidOff 0.95s cubic-bezier(0.25, 0.7, 0.4, 1) forwards; }
@keyframes lidOff {
  0% { transform: none; } 22% { transform: translateY(-48px) rotate(-10deg) scale(1.06); }
  100% { transform: translate(130px, -330px) rotate(230deg) scale(0.6); opacity: 0; }
}
.op-chest.open .body { animation: bodyBump 0.45s ease-out; }
@keyframes bodyBump { 35% { transform: scale(1.12, 0.86); } 70% { transform: scale(0.96, 1.05); } }
.op-chest.low { transform: translateY(84px) scale(0.6); }
.op-beam { /* the light column out of the open chest */
  position: absolute; z-index: -1; left: 50%; bottom: 44%; width: 170px; height: 70vh; margin-left: -85px; pointer-events: none; opacity: 0;
  background: linear-gradient(to top, var(--glow), transparent); clip-path: polygon(32% 100%, 68% 100%, 100% 0, 0 0); transform-origin: 50% 100%;
}
.op-chest.open .op-beam { animation: beam 1.6s ease-out forwards; }
@keyframes beam { 0% { opacity: 0; transform: scaleY(0.1); } 15% { opacity: 0.85; transform: scaleY(1); } 100% { opacity: 0.25; } }
.op-p { /* sparks and coins out of the chest */
  position: fixed; z-index: 2; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 2px; pointer-events: none;
  background: var(--glow); box-shadow: 0 0 10px var(--glow); animation: opP 1.15s cubic-bezier(0.2, 0.6, 0.4, 1) both;
}
.op-p.coin { width: 24px; height: 24px; margin: -12px 0 0 -12px; border-radius: 0; box-shadow: none; }
@keyframes opP {
  0% { transform: translate(0, 0) rotate(0) scale(0.3); opacity: 1; }
  45% { transform: translate(var(--dx), var(--dy)) rotate(calc(var(--r) * 0.5)) scale(1); opacity: 1; }
  100% { transform: translate(calc(var(--dx) * 1.3), calc(var(--dy) * 0.3 + 240px)) rotate(var(--r)) scale(0.7); opacity: 0; }
}
.op-glow { /* rays behind the reward card, in the rarity colour */
  position: absolute; left: 50%; top: 50%; width: 560px; height: 560px; margin: -280px 0 0 -280px; pointer-events: none; --rc: rgba(255, 204, 51, 0.35);
  background: repeating-conic-gradient(var(--rc) 0 10deg, transparent 10deg 24deg);
  -webkit-mask-image: radial-gradient(circle, #000 0, transparent 62%); mask-image: radial-gradient(circle, #000 0, transparent 62%);
}
.op-glow.show { animation: spin 10s linear infinite, glowIn 0.45s ease-out; }
.op-glow.r-skin { --rc: rgba(200, 144, 255, 0.5); }
.op-glow.r-ball { --rc: rgba(255, 159, 28, 0.55); }
@keyframes glowIn { from { opacity: 0; transform: scale(0.2); } }
.op-item { position: absolute; inset: auto; overflow: hidden; }
.op-item.show { animation: opItem 0.6s cubic-bezier(0.2, 1.3, 0.4, 1) both; }
@keyframes opItem {
  0% { transform: translateY(120px) scale(0.15) rotate(-14deg); opacity: 0; }
  60% { transform: translateY(-14px) scale(1.08) rotate(3deg); opacity: 1; } 100% { transform: none; opacity: 1; }
}
.op-item::after { /* a shine sweeps across the card */
  content: ''; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.4), transparent); transform: skewX(-15deg);
}
.op-item.show::after { animation: shine 0.9s 0.45s ease-out both; }
@keyframes shine { to { left: 130%; } }
.op-card, .op-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 20px 14px; min-width: 200px; max-width: 280px;
  border-radius: 16px; background: var(--grain), var(--panel); border: 4px solid var(--stroke); box-shadow: 0 8px 0 var(--stroke); text-align: center; color: var(--text);
}
.op-item { box-shadow: 0 8px 0 var(--stroke), 0 0 60px rgba(255, 204, 51, 0.45); }
.op-item.r-skin { border-color: #C890FF; box-shadow: 0 8px 0 var(--stroke), 0 0 70px rgba(200, 144, 255, 0.7); }
.op-item.r-ball { border-color: #FF9F1C; box-shadow: 0 8px 0 var(--stroke), 0 0 80px rgba(255, 159, 28, 0.8); }
.op-card b, .op-item b { font-size: 26px; font-weight: 900; line-height: 1.1; }
.op-card small, .op-item small { font-size: 13px; font-weight: 700; color: var(--muted); }
.op-card .ribbon, .op-item .ribbon {
  padding: 3px 12px; border-radius: 999px; background: #FF9F1C; color: #3A1A00; border: 3px solid var(--stroke); font-size: 12px; font-weight: 900; letter-spacing: 1px;
}
.op-sum { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.op-card.small { min-width: 96px; max-width: 140px; padding: 10px; gap: 4px; animation: lootin 0.4s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
.op-card.small b { font-size: 15px; }
.op-card.small small { font-size: 11px; }
@keyframes lootin { from { opacity: 0; transform: scale(0.3) translateY(24px); } }
.op-hint { position: relative; min-height: 22px; margin: 0; font-size: 17px; font-weight: 900; color: #fff; text-shadow: 0 2px 0 var(--stroke); animation: bob2 1.2s ease-in-out infinite; }
@keyframes bob2 { 50% { transform: translateY(-4px); } }
.op-btns { position: relative; display: flex; flex-direction: column; gap: 10px; width: min(100%, 320px); }
.op-btns .btn { width: 100%; }
.small { font-size: 12px; }
.rcard.is-chest { background: #3B2C7A; }
.reward .ball-hero .chest-svg { width: 160px; height: auto; }

/* account (email) */
.acct { margin: 4px 0 14px; padding: 14px; border-radius: 16px; background: var(--grain), var(--panel); border: 3px solid var(--stroke); box-shadow: 0 5px 0 var(--stroke); }
.acct-pitch { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.acct-pitch canvas { flex: none; }
.acct-pitch b { display: block; font-size: 16px; font-weight: 900; color: var(--gold); }
.acct-pitch small { display: block; margin-top: 2px; font-size: 13px; font-weight: 700; color: var(--muted); }
.acct-form { display: flex; flex-direction: column; gap: 10px; }
.acct-form .seg { margin: 0; }
.fld { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 800; color: var(--muted); }
.fld input {
  padding: 12px; border-radius: 12px; border: 3px solid var(--stroke); background: var(--grain), var(--panel-2); color: var(--text);
  font: 800 16px Nunito, system-ui, sans-serif;
}
.fld input:focus-visible, .chk input:focus-visible { outline: 3px solid var(--gold); outline-offset: 1px; }
.chk { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; font-weight: 700; color: var(--text); cursor: pointer; }
.chk input { width: 22px; height: 22px; flex: none; margin: 0; accent-color: var(--gold); }
.acct-msg { margin: 0; padding: 8px 10px; border-radius: 12px; background: rgba(255, 77, 94, 0.16); color: #FFB3BC; font-weight: 800; font-size: 13px; }
.acct-done p { margin: 0 0 8px; font-weight: 800; overflow-wrap: anywhere; }
.acct-done b { color: var(--gold); }

@media (max-width: 420px) {
  .overlay { padding: 10px; }
  .card { padding: 16px; border-radius: 16px; }
  .sticky { bottom: -16px; margin: 0 -16px -16px; padding: 12px 16px 16px; border-radius: 0 0 13px 13px; }
  .slot { width: 56px; height: 56px; border-radius: 12px; }
  .btn.sm { font-size: 12.5px; padding: 7px 9px; }
}
@media (max-height: 700px) {
  .lobby { gap: 8px; }
  .sbtn { height: 58px; gap: 4px; }
  .sbtn svg { width: 24px; height: 24px; }
  .play { height: 64px; }
  .pl-txt b { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .banner.show, .hint, .card, .trio canvas, .rcard.ready, .super-btn.ready, .dcell.today, .gift-chip, .chest-btn.has .chest-art svg, .op-rays, .op-chest, .op-chest .lid, .op-chest .seam, .op-beam, .op-p, .op-glow, .op-item, .op-item::after, .op-hint { animation-duration: 0.01s; animation-iteration-count: 1; }
}

/* arenas: the next one on the Glory Road page, and the new-arena popup */
.arena-pop svg { display: block; width: 168px; height: auto; filter: drop-shadow(0 8px 0 rgba(0, 0, 0, 0.35)); }

/* lobby: title under the nickname, league emblem */
.me { align-items: center; }
.me-title { font-size: 11px; font-weight: 800; line-height: 1.1; color: var(--gold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.league-ic { display: inline-grid; flex: none; }
.league-ic svg { display: block; width: 30px; height: auto; }
.league-ic.sm svg { width: 18px; }
.lrow .sc { display: flex; align-items: center; gap: 4px; justify-content: flex-end; }
.league-card { display: flex; align-items: center; gap: 12px; margin: 4px 0 14px; padding: 10px 14px; border-radius: 16px; background: var(--grain), var(--panel); box-shadow: inset 0 2px 0 var(--hi), 0 4px 0 var(--stroke); }
.league-card svg { width: 54px; height: auto; flex: none; }
.league-card div { display: flex; flex-direction: column; gap: 2px; }
.league-card small { font-size: 11px; font-weight: 900; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.league-card b { font: 400 22px/1.1 var(--display); }
.league-card span { font-size: 13px; color: var(--muted); }
/* chips: titles and languages */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 16px; }
.chip {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 12px; border-radius: 12px; cursor: pointer;
  border: 2px solid transparent; background: var(--grain), var(--panel); color: var(--text); font-weight: 800; font-size: 13px; box-shadow: 0 3px 0 var(--stroke);
}
.chip.on { border-color: var(--gold); color: var(--gold); }
.chip.locked { opacity: 0.55; cursor: default; }
.chip small { font-size: 11px; font-weight: 700; color: var(--muted); }
/* ball ranks */
.rk-badge {
  display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 5px; border-radius: 8px; flex: none;
  font: 400 13px/1 var(--display); color: #0A0E1F; border: 2px solid #0A0E1F; background: #B98B5E;
}
.rk-badge.t-bronze { background: #E39A5B; } .rk-badge.t-silver { background: #E3E9F2; } .rk-badge.t-gold { background: #FFD23F; }
.rk-badge.t-diamond { background: #8EEBFF; } .rk-badge.t-master { background: #FF7A88; color: #fff; text-shadow: 0 1px 0 #0A0E1F; }
.tile { position: relative; }
.tile .rk-badge { position: absolute; top: 6px; left: 6px; }
.bpath { margin: 4px 0 12px; padding: 10px; border-radius: 16px; background: var(--grain), var(--panel-2); text-align: left; }
.bp-head { display: flex; align-items: center; gap: 10px; }
.bp-head .rk-badge { min-width: 34px; height: 34px; font-size: 18px; border-radius: 12px; }
.bp-head div { display: flex; flex-direction: column; }
.bp-head small { color: var(--muted); font-size: 12px; }
.bp-bar { height: 8px; margin: 8px 0; border-radius: 999px; background: var(--stroke); overflow: hidden; }
.bp-bar i { display: block; height: 100%; border-radius: 999px; background: var(--gold); }
.bp-steps { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.bp-step { flex: none; width: 64px; min-height: 76px; display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 4px; padding: 6px 4px; border-radius: 12px; background: var(--grain), var(--panel); opacity: 0.6; }
.bp-step.done { opacity: 1; background: #24406A; }
.bp-step.next { opacity: 1; box-shadow: inset 0 0 0 2px var(--gold); }
.bp-step .chest-ico svg { width: 40px; height: 36px; display: block; }
.bp-coins { display: flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 900; color: var(--gold); }
.bp-coins .coin { width: 14px; height: 14px; }
.bp-title { font-size: 10px; font-weight: 900; line-height: 1.1; text-align: center; color: var(--gold); }
/* skins page */
.sk-list { display: flex; flex-direction: column; gap: 12px; padding-bottom: 12px; }
.sk-row { padding: 10px; border-radius: 16px; background: var(--grain), var(--panel); box-shadow: inset 0 2px 0 var(--hi), 0 4px 0 var(--stroke); }
.sk-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.sk-head b { flex: 1; font-size: 16px; }
.sk-opts { margin: 0; }
/* arenas page */
.ar-list { display: flex; flex-direction: column; align-items: center; gap: 26px; padding: 6px 0 20px; }
.ar-card {
  position: relative; width: min(84%, 320px); display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 12px 12px 14px; border-radius: 16px; background: var(--grain), var(--panel); box-shadow: inset 0 2px 0 var(--hi), 0 5px 0 var(--stroke);
}
.ar-card:not(:last-child)::after { /* the road down to the previous arena */
  content: ''; position: absolute; left: 50%; bottom: -27px; height: 22px; margin-left: -3px; border-left: 6px dotted var(--muted); opacity: 0.6;
}
.ar-card.cur { box-shadow: inset 0 0 0 3px var(--gold), 0 5px 0 var(--stroke), 0 0 40px rgba(255, 204, 51, 0.25); }
.ar-art { position: relative; width: 100%; }
.ar-art svg { display: block; width: 100%; height: auto; }
.ar-card.locked .ar-art svg { filter: saturate(0.55) brightness(0.62); }
.ar-card.locked .ar-art::after {
  content: ''; position: absolute; left: 50%; top: 45%; width: 56px; height: 64px; translate: -50% -50%;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 32'><path d='M7 14V9a7 7 0 0 1 14 0v5' fill='none' stroke='%230A0E1F' stroke-width='6'/><path d='M7 14V9a7 7 0 0 1 14 0v5' fill='none' stroke='%23C9D4E6' stroke-width='3'/><rect x='2' y='13' width='24' height='18' rx='4' fill='%23FFCC33' stroke='%230A0E1F' stroke-width='2.5'/><circle cx='14' cy='21' r='2.6' fill='%230A0E1F'/></svg>") center / contain no-repeat;
}
.ar-card small { font-size: 11px; font-weight: 900; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); }
.ar-card b { font: 400 22px/1.1 var(--display); }
.ar-st { display: flex; align-items: center; gap: 4px; font-weight: 900; color: var(--gold); }
.watch-btn { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0 0 12px; }
.watch-btn svg { width: 24px; height: 24px; }

/* emotes in battle */
.emote-btn {
  width: 54px; height: 54px; padding: 0; display: grid; place-items: center; border-radius: 50%; cursor: pointer;
  border: 3px solid var(--stroke); background: var(--grain), var(--panel); box-shadow: 0 4px 0 var(--stroke);
}
.emote-btn svg { width: 32px; height: 32px; }
.emote-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--stroke); }
.emote-tray {
  position: absolute; z-index: 6; left: 50%; bottom: 86px; translate: -50% 0; display: grid; grid-template-columns: repeat(4, 58px); gap: 8px; max-height: 210px; overflow-y: auto;
  padding: 10px; border-radius: 16px; background: var(--grain), var(--panel); box-shadow: inset 0 2px 0 var(--hi), 0 5px 0 var(--stroke); animation: trayIn 0.18s ease-out;
}
.emote-tray button { width: 58px; height: 58px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 12px; background: #FFFFFF; box-shadow: inset 0 -3px 0 #C9D4E6; cursor: pointer; }
.emote-tray button:active { transform: scale(0.9); }
@keyframes trayIn { from { opacity: 0; transform: translateY(12px) scale(0.9); } }

/* banners and decorations */
.me { position: relative; width: min(268px, 100%); height: 60px; padding: 6px 58px 6px 10px; background: none; border: 0; box-shadow: none; filter: drop-shadow(0 4px 0 #0A0E1F); }
.me-bg { position: absolute; inset: 0; z-index: 0; }
.me-bg svg { display: block; width: 100%; height: 100%; }
.me .avatar, .me .me-txt, .me .league-ic { position: relative; z-index: 1; }
.me .me-txt b { text-shadow: 0 2px 0 #0A0E1F; }
.me-deco { z-index: 2; }
.me-deco { position: absolute; right: 6px; top: 50%; translate: 0 -50%; width: 44px; height: 44px; pointer-events: none; }
.me-deco svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.35)); }
.me .league-ic { margin-left: 2px; }
/* chest slots */
.slots { flex: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.cslot {
  position: relative; height: 92px; padding: 4px 2px; display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 1px;
  border: 2px solid var(--stroke); border-radius: 12px; cursor: pointer; color: var(--text); background: #2A4478;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.2), 0 4px 0 var(--stroke);
}
.cslot svg { width: 50px; height: auto; display: block; }
.cslot b, .cslot small { font-size: 11px; font-weight: 900; line-height: 1.05; white-space: nowrap; text-shadow: 0 1px 0 #0A0E1F; }
.cs-top { color: #C9D4E6; }
.cs-time { font: 400 13px/1 var(--display) !important; }
.cslot.start { background: #2F6FE0; }
.cslot.start .cs-top { color: #FFFFFF; animation: bob2 1.2s ease-in-out infinite; }
.cslot.busy { background: #2E9E52; }
.cs-clock { display: flex; align-items: center; gap: 3px; padding: 1px 6px; border-radius: 999px; background: rgba(10, 14, 31, 0.55); color: #FFFFFF; font: 400 12px/1 var(--display) !important; }
.cs-clock svg { width: 13px; height: 13px; }
.cs-now { color: #E6FFE9; font-size: 10px !important; }
.cs-gems { display: inline-flex; align-items: center; gap: 3px; font: 400 13px/1 var(--display) !important; }
.cs-gems .gem { width: 14px; height: 14px; }
.cslot.ready { background: var(--gold); }
.cslot.ready .cs-top, .cslot.ready .cs-big { color: #2A1A00; text-shadow: none; }
.cs-big { font: 400 14px/1 var(--display) !important; }
.cslot.ready svg { animation: wiggle 1.6s ease-in-out infinite; }
.cslot.empty { background: rgba(30, 39, 66, 0.45); border: 2px dashed rgba(157, 176, 214, 0.3); box-shadow: none; justify-content: center; }
.sl-empty { width: 30px; height: 22px; }
.cslot:active { transform: translateY(3px); }
.sl-art svg { width: 150px; height: auto; display: block; margin: 0 auto; }
.sl-time { font: 400 24px/1.1 var(--display); color: #8EEBFF; margin: 4px 0; }
.chest-btn[hidden] { display: none !important; }
.gem.big-gem, .op-card .gem { display: inline-block; }
.frag-bar { display: block; width: 100%; height: 6px; border-radius: 999px; background: var(--stroke); overflow: hidden; }
.frag-bar i { display: block; height: 100%; background: #C890FF; }
.skin .frag-bar { width: 80%; margin-top: 2px; }
.frag-n { font-size: 10px; font-weight: 900; color: #C890FF; }
.op-item.r-gems, .op-card.r-gems { border-color: var(--go); }
.op-item.r-frag { border-color: #C890FF; }
.op-item.r-emote { border-color: #7FE7FF; }
.op-glow.r-gems { --rc: rgba(54, 210, 122, 0.45); }
.op-glow.r-frag { --rc: rgba(200, 144, 255, 0.45); }
.op-glow.r-emote { --rc: rgba(127, 231, 255, 0.45); }
.op-item .frag-bar { width: 160px; height: 10px; border-radius: 999px; }
.op-item canvas, .op-card canvas { display: block; }
/* shop */
.sh-top { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; }
.sh-bal { display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px; border-radius: 999px; background: var(--grain), var(--panel); font-weight: 900; }
.sh-ad { margin-left: auto; }
.sh-sec { margin: 0 0 18px; }
.sh-sec h3 { margin: 0 0 8px; }
.sh-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.sh-sec.wide .sh-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sh-tile {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 4px; min-height: 120px; padding: 10px 6px 8px;
  border: 2px solid transparent; border-radius: 12px; cursor: pointer; color: var(--text); background: var(--grain), var(--panel); box-shadow: inset 0 2px 0 var(--hi), 0 4px 0 var(--stroke);
}
.sh-tile b { font-size: 12px; font-weight: 900; line-height: 1.15; text-align: center; }
.sh-price { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; background: var(--stroke); font-weight: 900; font-size: 13px; }
.sh-price .gem, .sh-price .coin { width: 16px; height: 16px; }
.sh-tile.own .sh-price { background: transparent; color: var(--go); }
.sh-tile.on { border-color: var(--gold); }
.sh-tile.on .sh-price { color: var(--gold); }
.sh-tile.confirm { border-color: var(--go); }
.sh-tile.confirm .sh-price { background: var(--go); color: var(--go-ink); }
.sh-tile.deal { background: linear-gradient(180deg, #3B2C7A, #251C52); }
.sh-off { position: absolute; top: -6px; right: -4px; padding: 2px 7px; border-radius: 8px; background: var(--foe); font-size: 11px; font-weight: 900; }
.sh-anim { position: absolute; top: -6px; left: -4px; padding: 2px 6px; border-radius: 8px; background: #7A3FC8; font-size: 10px; font-weight: 900; text-transform: uppercase; }
.sh-tile[class*=' t-'] { box-shadow: inset 0 2px 0 var(--hi), inset 0 -3px 0 var(--rar), 0 4px 0 var(--stroke); }
.sh-tile canvas { display: block; }
.banner-prev { display: block; width: 100%; }
.banner-prev svg { display: block; width: 100%; height: auto; aspect-ratio: 250 / 58; }
.deco-prev svg { width: 56px; height: 56px; display: block; }
.look-prev svg { width: 100%; max-width: 120px; height: auto; display: block; }
.sh-gems { margin: 12px 0 18px; padding: 12px; border-radius: 12px; background: var(--grain), var(--panel); }

/* settings */
.settings { text-align: left; }
.settings h2 { text-align: center; margin-bottom: 8px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 2px; border-bottom: 1px solid rgba(157, 176, 214, 0.15); font-weight: 800; }
.toggle { position: relative; width: 52px; height: 30px; flex: none; border: 0; border-radius: 999px; cursor: pointer; background: var(--stroke); box-shadow: inset 0 0 0 2px rgba(157, 176, 214, 0.3); transition: background 0.15s; }
.toggle::after { content: ''; position: absolute; top: 4px; left: 4px; width: 22px; height: 22px; border-radius: 50%; background: #C9D4E6; transition: transform 0.15s; }
.toggle.on { background: var(--go); }
.toggle.on::after { transform: translateX(22px); background: #FFFFFF; }
.brand { font-size: clamp(19px, 5.6vw, 24px); }
/* inbox */
.mail-list { display: flex; flex-direction: column; gap: 10px; padding-bottom: 12px; }
.letter { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 12px; background: var(--grain), var(--panel); box-shadow: inset 0 2px 0 var(--hi), 0 4px 0 var(--stroke); }
.letter.new { box-shadow: inset 0 0 0 2px var(--gold), 0 4px 0 var(--stroke); }
.letter b { font-size: 16px; }
.letter small { color: var(--muted); font-size: 12px; }
.letter p { margin: 2px 0 6px; white-space: pre-line; }
.letter .btn { align-self: flex-start; display: inline-flex; align-items: center; gap: 5px; }
.letter .btn .coin, .letter .btn .gem { width: 16px; height: 16px; }
.sh-tile b:empty { display: none; }

/* lobby, Clash Royale style: small round buttons on both sides of the arena */
.side { position: absolute; z-index: 3; top: 15%; display: flex; flex-direction: column; gap: 12px; }
.side.l { left: 0; }
.side.r { right: 0; }
.side-btn { position: relative; width: 56px; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; border: 0; background: none; cursor: pointer; color: var(--text); }
.side-btn .ic {
  width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%;
  background: var(--grain), var(--panel-2); border: 2.5px solid var(--stroke); box-shadow: inset 0 2px 0 var(--hi), 0 3px 0 var(--stroke);
}
.side-btn svg { width: 28px; height: 28px; overflow: visible; }
.side-btn > span:not(.ic) { max-width: 64px; font-size: 10px; font-weight: 900; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 0 #0A0E1F, 0 0 4px #0A0E1F; }
.side-btn #l-tr, .side-btn > #l-tr { font: 400 12px/1 var(--display); color: var(--gold); }
.side-btn .badge { top: -3px; right: 2px; width: 14px; height: 14px; border-color: var(--panel); }
.side-btn:active .ic { transform: translateY(2px); box-shadow: inset 0 2px 0 var(--hi), 0 1px 0 #0A0E1F; }
.dock { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.lobby-top .me { flex: 1; }
@media (max-height: 700px) { .side { gap: 6px; } .side-btn .ic { width: 40px; height: 40px; } .side-btn svg { width: 24px; height: 24px; } }

/* modes */
.mode-btn {
  position: relative; flex: none; width: 76px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 4px;
  border: 3px solid var(--stroke); border-radius: 12px; cursor: pointer; color: var(--text); background: var(--grain), var(--panel); box-shadow: inset 0 2px 0 var(--hi), 0 6px 0 var(--stroke);
}
.mode-btn:active { transform: translateY(3px); box-shadow: inset 0 2px 0 var(--hi), 0 3px 0 var(--stroke); }
.mode-btn b { font-size: 11px; font-weight: 900; line-height: 1; white-space: nowrap; }
.mode-ic { display: grid; place-items: center; }
.mode-ic svg { width: 34px; height: 34px; display: block; }
.md-list { display: flex; flex-direction: column; gap: 10px; margin: 10px 0 14px; }
.md-card {
  display: flex; align-items: center; gap: 12px; padding: 12px; border: 2px solid transparent; border-radius: 16px; cursor: pointer; text-align: left;
  color: var(--text); background: var(--grain), var(--panel-2); box-shadow: 0 4px 0 var(--stroke);
}
.md-card.on { border-color: var(--gold); }
.md-card .mode-ic svg { width: 48px; height: 48px; }
.md-txt { display: flex; flex-direction: column; gap: 3px; }
.md-txt b { font: 400 18px/1.1 var(--display); }
.md-txt small { font-size: 13px; color: var(--muted); }
.md-txt em { font-style: normal; font-size: 11px; font-weight: 900; color: var(--gold); text-transform: uppercase; letter-spacing: 0.5px; }

/* player level */
.avatar { position: relative; }
.lvl-badge {
  position: absolute; left: -6px; bottom: -6px; z-index: 2; min-width: 22px; height: 22px; padding: 0 4px; display: grid; place-items: center;
  font: 400 12px/1 var(--display); color: #FFFFFF; text-shadow: 0 1px 0 #0A0E1F; border-radius: 8px; background: #3D86FF; border: 2px solid #0A0E1F;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); border-radius: 0; min-width: 24px; height: 26px;
}
.lvl-badge.big { position: static; min-width: 34px; height: 38px; font-size: 16px; }
.xp-bar { display: block; width: 100%; max-width: 130px; height: 6px; margin-top: 3px; border-radius: 999px; background: rgba(10, 14, 31, 0.6); overflow: hidden; }
.xp-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #4CC9F0, #8EEBFF); }
.p-level { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-direction: column; }
.p-level .xp-bar { width: 90px; }

/* clans */
.clan-head, .clan-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; background: var(--grain), var(--panel); box-shadow: inset 0 2px 0 var(--hi), 0 4px 0 var(--stroke); }
.clan-head { margin: 4px 0 12px; }
.clan-head div, .clan-row div { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.clan-head b { font: 400 20px/1.1 var(--display); }
.clan-row b { font-weight: 900; }
.clan-head small, .clan-row small { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.clan-badge { display: grid; place-items: center; flex: none; }
.clan-badge svg { width: 44px; height: auto; display: block; }
.clan-row .clan-badge svg { width: 36px; }
.clan-make { margin: 0 0 18px; padding: 12px; border-radius: 16px; background: var(--grain), var(--panel-2); }
.clan-make h3, .clan-make h4 { margin: 0 0 8px; }
.clan-make h4 { margin-top: 12px; }
.clan-badges { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; margin-bottom: 12px; }
.clan-badges .clan-badge { padding: 4px 0; border: 2px solid transparent; border-radius: 12px; background: var(--grain), var(--panel); cursor: pointer; }
.clan-badges .clan-badge svg { width: 100%; max-width: 34px; }
.clan-badges .clan-badge.on { border-color: var(--gold); }
.clan-top { display: flex; flex-direction: column; gap: 8px; }
.clan-top h3 { margin: 0 0 4px; }

/* the name card opens the Glory Road */
.me { cursor: pointer; }
.me:active { transform: translateY(2px); }
.me .badge { top: -4px; right: 8px; z-index: 3; }
.me-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.me-tr { display: inline-flex; align-items: center; gap: 3px; flex: none; font: 400 12px/1 var(--display); color: var(--gold); }
.me-tr .trophy { width: 14px; height: 14px; }

/* first launch: pick a language */
.lang-pick .chip-row { justify-content: center; }
.lang-pick .chip { font-size: 16px; padding: 12px 18px; }

/* the Glory Road: one vertical road with the arenas on it */
.vroad { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 6px 0 20px 42px; }
.vroad::before { content: ''; position: absolute; left: 16px; top: 0; bottom: 0; width: 10px; border-radius: 999px; background: rgba(10, 14, 31, 0.7); }
.vr-fill { position: absolute; left: 16px; bottom: 0; width: 10px; border-radius: 999px; background: linear-gradient(180deg, #FFE38A, #E59F00); box-shadow: 0 0 10px rgba(255, 204, 51, 0.5); }
.vr-row {
  position: relative; display: flex; align-items: center; gap: 10px; min-height: 70px; padding: 8px 12px; border-radius: 12px;
  background: linear-gradient(180deg, #3E8E4A, #2C6E36); box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.18), 0 4px 0 var(--stroke);
}
.vr-row.locked { background: linear-gradient(180deg, #4A3420, #33231A); }
.vr-row.done { opacity: 0.65; }
.vr-row.ready { box-shadow: inset 0 0 0 3px var(--gold), 0 4px 0 var(--stroke); }
.vr-at {
  position: absolute; left: -44px; top: 50%; translate: 0 -50%; z-index: 1; display: inline-flex; align-items: center; gap: 2px; padding: 2px 5px;
  border-radius: 999px; background: var(--panel); border: 2px solid #0A0E1F; font: 400 10px/1 var(--display); color: var(--gold);
}
.vr-at .trophy { width: 10px; height: 10px; }
.vr-row canvas, .vr-row .chest-ico svg { flex: none; }
.vr-row .chest-ico svg { width: 54px; height: 50px; display: block; }
.vr-row .big-gem { width: 40px; height: 40px; }
.vr-name { flex: 1; min-width: 0; font-weight: 900; font-size: 14px; text-shadow: 0 1px 0 #0A0E1F; }
.vr-state { flex: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: rgba(10, 14, 31, 0.5); font-weight: 900; color: var(--go); }
.vr-state svg { width: 14px; height: 14px; fill: var(--muted); }
.vr-me { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; align-self: flex-start; background: var(--gold); color: #2A1A00; font-weight: 900; box-shadow: 0 4px 0 var(--stroke); margin-left: -30px; }
.vr-me span { display: inline-flex; align-items: center; gap: 3px; }
.vr-arena { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 10px 14px; border-radius: 16px; background: var(--grain), linear-gradient(180deg, #4B321E, #33221A); box-shadow: inset 0 2px 0 var(--hi), 0 5px 0 var(--stroke); }
.vr-arena.cur { box-shadow: inset 0 0 0 3px var(--gold), 0 5px 0 var(--stroke); }
.vr-ribbon {
  display: flex; flex-direction: column; align-items: center; gap: 2px; width: 92%; padding: 8px 18px 7px; color: #FFFFFF;
  background: linear-gradient(180deg, #3D86FF, #1E4FB0); clip-path: polygon(0 0, 100% 0, 96% 50%, 100% 100%, 0 100%, 4% 50%);
}
.vr-ribbon b { font: 400 20px/1.1 var(--display); text-shadow: 0 2px 0 #0A0E1F; }
.vr-ribbon span { display: inline-flex; align-items: center; gap: 3px; font-weight: 900; font-size: 13px; color: var(--gold); text-shadow: 0 1px 0 #0A0E1F; }
.vr-art { position: relative; width: min(80%, 260px); }
.vr-art svg { display: block; width: 100%; height: auto; }
.vr-plate { position: absolute; left: 50%; bottom: -6px; translate: -50% 0; padding: 4px 16px; border-radius: 12px; background: var(--panel-2); border: 2px solid #0A0E1F; font: 400 15px/1 var(--display); white-space: nowrap; box-shadow: 0 3px 0 #0A0E1F; }
.vr-arena.locked .vr-art svg { filter: saturate(0.5) brightness(0.6); }
.vr-opens { margin-top: 4px; font-weight: 900; color: #8EEBFF; }
.vr-unlocks { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.vr-ball { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 66px; padding: 4px 2px; border-radius: 12px; background: var(--grain), var(--panel); box-shadow: 0 3px 0 var(--stroke); }
.vr-ball small { font-size: 10px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.vr-ball.no canvas { filter: grayscale(1) brightness(0.7); }
.arena-lock { display: flex; align-items: center; justify-content: center; gap: 4px; flex-wrap: wrap; font-weight: 900; color: var(--gold); }
/* locked balls look "not found" */
.tile.locked canvas { filter: grayscale(1) brightness(0.6); }

/* parties */
.pchoice .pc-join { margin: 10px 0 6px; }
.pchoice .code-in { letter-spacing: 4px; text-align: center; }
.party .pt-code { font: 400 26px/1 var(--display); letter-spacing: 4px; color: var(--gold); }
.pt-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 10px 0 14px; }
.pt-list.duo { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pt-seat { display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 92px; padding: 8px 4px; border-radius: 12px; background: var(--grain), var(--panel-2); box-shadow: 0 3px 0 var(--stroke); }
.pt-seat.blue { box-shadow: inset 0 0 0 2px var(--you), 0 3px 0 var(--stroke); }
.pt-seat.red { box-shadow: inset 0 0 0 2px var(--foe), 0 3px 0 var(--stroke); }
.pt-seat b { font-size: 12px; text-align: center; line-height: 1.15; }
.pt-seat small { color: var(--muted); font-weight: 800; }
.pt-empty { width: 44px; height: 44px; border-radius: 50%; border: 2px dashed rgba(157, 176, 214, 0.4); }

.tile small .trophy { width: 14px; height: 14px; vertical-align: -2px; margin-right: 2px; }

/* ---------- Stitch pass: capital display titles, price buttons, the squad card, chest hints, empty slots ---------- */
h2, .sh-sec h3 { font-family: var(--display); font-weight: 400; text-transform: uppercase; letter-spacing: 0.02em; }
#rw-text, #c-title, #ball-name { font-family: inherit; font-weight: 900; text-transform: none; letter-spacing: 0; }
.sh-sec h3 { display: flex; align-items: center; gap: 8px; font-size: 18px; text-shadow: var(--stroke-text); }
.sh-note { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; background: var(--stroke); color: var(--muted); font: 800 12px Nunito, sans-serif; text-transform: none; text-shadow: none; letter-spacing: 0; }
.sh-note svg { width: 14px; height: 14px; }
.sh-tile .sh-price { align-self: stretch; justify-content: center; padding: 5px 6px; border-radius: 12px; background: var(--gold); color: var(--gold-ink); border: 2.5px solid var(--stroke); box-shadow: 0 3px 0 var(--stroke); }
.sh-tile .sh-price:has(.gem) { background: #B44CF0; color: #FFFFFF; }
.sh-tile.own .sh-price { background: rgba(54, 210, 122, 0.12); color: var(--go); border-color: var(--go); box-shadow: none; }
.sh-tile.own .sh-price::before { content: '\2713'; margin-right: 2px; }
.sh-tile.on .sh-price { background: rgba(255, 204, 51, 0.12); color: var(--gold); border-color: var(--gold); box-shadow: none; }
.sh-tile.confirm .sh-price { background: var(--go); color: var(--go-ink); }

.versus { padding: 10px 12px; border-radius: 16px; background: rgba(10, 14, 31, 0.45); border: 3px solid var(--stroke); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.06); }
.versus small { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; font: 400 12px var(--display); text-transform: uppercase; letter-spacing: 0.04em; }
.versus small::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.mine small { color: var(--you); }
.enemy small { justify-content: flex-end; }
.s-info { display: flex; flex-direction: column; gap: 4px; padding: 12px; background: var(--grain), var(--panel); border: 3px solid var(--stroke); box-shadow: inset 0 2px 0 var(--hi); color: var(--muted); }
.si-head { display: flex; align-items: center; gap: 8px; }
.si-head b { font: 400 19px var(--display); color: var(--text); text-transform: uppercase; }
.hp-pill { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; background: var(--stroke); color: var(--text); font-weight: 900; font-size: 13px; }
.hp-pill svg { width: 15px; height: 15px; }
.si-super { display: flex; gap: 10px; align-items: flex-start; margin-top: 6px; padding: 8px 10px; border-radius: 12px; background: rgba(255, 204, 51, 0.08); border: 2px solid rgba(255, 204, 51, 0.35); }
.si-super > i { flex: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; background: var(--gold); border: 2px solid var(--stroke); }
.si-super > i svg { width: 16px; height: 16px; fill: var(--gold-ink); }
.si-super b { display: block; color: var(--gold); font-size: 14px; }
.si-super span span { color: var(--text); font-size: 13px; }
#s-cards .tile { padding-top: 18px; }
#s-cards .tile:not(.locked) small { color: var(--muted); }
.tile .tag { position: absolute; top: 5px; left: 8px; right: 8px; font: 400 10px var(--display); color: var(--gold); text-transform: uppercase; letter-spacing: 0.03em; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#s-cards .tile .pos { left: auto; right: -7px; }
.tile.locked::after { /* a padlock over the ball */
  content: ''; position: absolute; left: calc(50% - 13px); top: 29px; width: 26px; height: 26px; pointer-events: none;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M7.5 10V7.5a4.5 4.5 0 0 1 9 0V10' fill='none' stroke='%230A0E1F' stroke-width='4.5'/><path d='M7.5 10V7.5a4.5 4.5 0 0 1 9 0V10' fill='none' stroke='%23C9D2E0' stroke-width='2'/><rect x='4.5' y='10' width='15' height='11.5' rx='3' fill='%23FFCC33' stroke='%230A0E1F' stroke-width='2'/><circle cx='12' cy='15.3' r='1.8' fill='%230A0E1F'/></svg>") center / contain no-repeat;
}
#s-cards .tile.locked::after { top: 35px; }

.op-hint { padding: 8px 18px; border-radius: 999px; background: #1E9BE0; border: 3px solid var(--stroke); box-shadow: 0 4px 0 var(--stroke); font: 400 15px var(--display); text-transform: uppercase; letter-spacing: 0.03em; }
.op-hint:empty { visibility: hidden; }
#op-done { background: var(--go); color: var(--go-ink); }

.cslot.empty { flex-direction: column; gap: 2px; color: rgba(157, 176, 214, 0.75); }
.cslot.empty .sl-plus { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 2px solid currentColor; font-size: 18px; line-height: 1; }
.cslot.empty small { font: 400 10px var(--display); text-transform: uppercase; letter-spacing: 0.04em; }
.xp-row { display: flex; align-items: center; gap: 6px; }
.xp-row .xp-bar { flex: 1; margin-top: 0; }
.xp-row small { font-size: 10px; font-weight: 900; color: #8EEBFF; }

/* on a computer the super button says which key fires it */
@media (hover: hover) and (pointer: fine) {
  #super-btn { position: relative; }
  #super-btn::after { content: attr(data-key); position: absolute; left: 50%; bottom: -20px; transform: translateX(-50%); padding: 1px 8px; border-radius: 8px; background: var(--stroke); color: var(--muted); font: 800 11px Nunito, sans-serif; white-space: nowrap; }
}

/* ---------- the VS screen before a fight: the foe's banner slides in from the right, yours from the left ---------- */
.vs-intro {
  position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; justify-content: center; gap: 22px; padding-bottom: 4vh; overflow: hidden;
  background: radial-gradient(circle at 50% 50%, rgba(40, 60, 140, 0.55), rgba(5, 8, 20, 0.88));
}
.vs-intro.out { animation: vsOut 0.28s ease-in forwards; }
.vs-card { position: relative; z-index: 0; width: min(94%, 520px); height: 104px; display: flex; align-items: center; gap: 12px; padding: 0 30px 0 18px; }
.vs-card.foe { align-self: flex-end; flex-direction: row-reverse; padding: 0 18px 0 30px; text-align: right; animation: vsFromRight 0.45s cubic-bezier(0.2, 1.3, 0.4, 1) both; }
.vs-card.mine { align-self: flex-start; animation: vsFromLeft 0.45s cubic-bezier(0.2, 1.3, 0.4, 1) 0.12s both; }
.vs-bg { position: absolute; inset: 0; z-index: -1; filter: drop-shadow(0 6px 0 rgba(10, 14, 31, 0.6)); }
.vs-bg svg { display: block; width: 100%; height: 100%; }
.vs-card.foe .vs-bg svg { transform: scaleX(-1); }
.vs-av { position: relative; flex: none; width: 70px; height: 70px; display: grid; place-items: center; border-radius: 50%; background: rgba(10, 14, 31, 0.45); border: 3px solid var(--stroke); }
.vs-av .lvl-badge { position: absolute; left: -6px; bottom: -6px; }
.vs-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.vs-nick { font: 400 21px var(--display); text-shadow: var(--stroke-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vs-clan, .vs-meta { display: flex; align-items: center; gap: 5px; font-weight: 900; font-size: 13px; text-shadow: 0 2px 0 var(--stroke); }
.vs-clan:empty { display: none; }
.vs-card.foe .vs-clan, .vs-card.foe .vs-meta { justify-content: flex-end; }
.vs-clan .clan-badge svg { width: 18px; height: 20px; display: block; }
.vs-meta svg { width: 22px; height: 22px; }
.vs-meta .trophy { width: 16px; height: 16px; }
.vs-deco { flex: none; }
.vs-deco svg { width: 46px; height: 46px; display: block; }
.vs-card.mine .vs-deco { margin-left: auto; }
.vs-card.foe .vs-deco { margin-right: auto; }
.vs-shield {
  align-self: center; width: 96px; height: 108px; display: grid; place-items: center; animation: vsPop 0.5s 0.32s both;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 108'><path d='M48 4l40 14v30c0 26-17 46-40 56C25 94 8 74 8 48V18z' fill='%232E5BD8' stroke='%230A0E1F' stroke-width='5' stroke-linejoin='round'/><path d='M48 12l32 11v25c0 21-13 37-32 46-19-9-32-25-32-46V23z' fill='none' stroke='%23FFCC33' stroke-width='5'/><path d='M48 18l26 9v20' fill='none' stroke='%23FFFFFF' stroke-opacity='.35' stroke-width='4'/></svg>") center / contain no-repeat;
}
.vs-shield b { font: 400 34px var(--display); color: #FFE38A; text-shadow: var(--stroke-text); transform: translateY(-4px); }
@keyframes vsFromLeft { from { transform: translateX(-110%); } }
@keyframes vsFromRight { from { transform: translateX(110%); } }
@keyframes vsPop { from { transform: scale(0) rotate(-25deg); } 70% { transform: scale(1.15); } to { transform: none; } }
@keyframes vsOut { to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .vs-card, .vs-shield { animation: none; } }

/* ---------- the familiar ---------- */
.fam-hero { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 14px 14px; border-radius: 16px;
  background: radial-gradient(circle at 50% 30%, #5A3B22, var(--panel) 70%); border: 3px solid var(--stroke); box-shadow: inset 0 2px 0 var(--hi), 0 5px 0 var(--stroke); }
.fam-lv { position: absolute; top: 12px; left: 12px; padding: 4px 12px; border-radius: 999px; background: var(--stroke); border: 2.5px solid var(--gold); color: var(--gold); font: 400 14px var(--display); }
.fam-art { display: block; margin-top: 6px; animation: famBob 2.4s ease-in-out infinite; filter: drop-shadow(0 10px 8px rgba(0, 0, 0, 0.35)); }
.fam-name { margin: 0; font: 400 24px var(--display); text-transform: uppercase; color: var(--gold); text-shadow: var(--stroke-text); }
.fam-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.fam-stats > span { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; background: var(--stroke); }
.fam-stats i { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 12px; background: var(--grain), var(--panel-2); }
.fam-stats i svg { width: 22px; height: 22px; }
.fam-stats small { display: block; font: 400 10px var(--display); color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.fam-stats b { color: var(--go); font: 400 16px var(--display); }
.fam-xp { display: flex; justify-content: space-between; width: 100%; font-weight: 900; }
.fam-xp small { font: 400 12px var(--display); color: var(--muted); text-transform: uppercase; }
.fam-xp b { color: var(--gold); }
.fam-bar { max-width: none; height: 12px; border-radius: 8px; }
.fam-bar i { border-radius: 8px; background: linear-gradient(90deg, #36D27A, #8EF0B4); }
.fam-note { margin: 0; font-size: 12px; }
.fam-hint { margin: 12px 4px; }
.fam-card canvas { display: block; }
.side-btn.c-fam .ic canvas { display: block; }
.vs-fam { display: inline-flex; align-items: center; gap: 2px; margin-left: 6px; }
.vs-fam b { font: 400 12px var(--display); color: var(--gold); }
@keyframes famBob { 50% { transform: translateY(-8px); } }

/* ---------- wide screens (laptops): the current arena, big and blurred, fills the empty sides; the side buttons hug the stage ---------- */
#bg-art { display: none; }
@media (min-width: 760px) {
  #bg-art { position: fixed; inset: -60px; z-index: -1; display: grid; place-items: center; pointer-events: none; overflow: hidden; filter: blur(16px) saturate(1.15) brightness(0.8); }
  #bg-art svg { width: max(115vw, 115vh * 0.8136); height: auto; flex: none; }
  #bg-art::after { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 50%, transparent 30%, rgba(5, 8, 20, 0.55) 100%); }
  :root { --side-room: 74px; }
  .side.l { left: max(0px, calc(50% - min(50cqw - var(--side-room), (100cqh - 20px) * 0.4068) - var(--side-room))); }
  .side.r { right: max(0px, calc(50% - min(50cqw - var(--side-room), (100cqh - 20px) * 0.4068) - var(--side-room))); }
}

/* hints over the arena sky stay readable on light arenas (candy, temple) */
.tab > p.muted, .fam-hint { padding: 8px 12px; border-radius: 12px; background: rgba(10, 14, 31, 0.55); color: #DCE6FA; }

/* ---------- the profile stand: banner ribbon on top, the favourite ball on a lit pedestal ---------- */
.p-stand { overflow: hidden; margin-bottom: 14px; border-radius: 16px; border: 3px solid var(--stroke); box-shadow: 0 5px 0 var(--stroke);
  background: radial-gradient(ellipse 60% 55% at 50% 30%, rgba(255, 236, 160, 0.28), transparent 70%), var(--grain), radial-gradient(ellipse at 50% 100%, #5A3B22, #24170D 70%); }
.p-ribbon { position: relative; display: flex; align-items: center; gap: 10px; height: 76px; padding: 8px 34px 8px 12px; filter: drop-shadow(0 4px 0 #0A0E1F); }
.p-ribbon > :not(.me-bg) { position: relative; z-index: 1; }
.p-who { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.p-who .nick-row { display: flex; align-items: center; gap: 6px; }
.p-who .nick { font: 400 19px var(--display); text-shadow: var(--stroke-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-clan { display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 900; text-shadow: 0 2px 0 var(--stroke); }
.p-clan .clan-badge svg { width: 16px; height: 18px; display: block; }
.p-ribbon .me-deco { position: absolute; right: 26px; top: 50%; transform: translateY(-50%); }
.p-ribbon .me-deco svg { width: 40px; height: 40px; display: block; }
.p-show { position: relative; display: flex; flex-direction: column; align-items: center; padding: 6px 0 16px; }
.p-fav { position: relative; display: flex; flex-direction: column; align-items: center; }
.p-fav canvas { position: relative; z-index: 1; animation: famBob 2.6s ease-in-out infinite; }
.p-ped { width: 190px; height: 40px; margin-top: -26px; border-radius: 50%; border: 3px solid var(--stroke);
  background: radial-gradient(ellipse at 50% 40%, #FFE38A, #E0A21E 60%, #8A5A0E); box-shadow: 0 0 34px 10px rgba(255, 210, 90, 0.35), 0 6px 0 var(--stroke); }
.p-fav-name { margin-top: 8px; font: 400 24px var(--display); text-transform: uppercase; color: var(--gold); text-shadow: var(--stroke-text); }
.p-fav-rank { display: flex; align-items: center; gap: 6px; font-weight: 900; color: var(--muted); }
.p-fam { position: absolute; left: 14%; top: 14px; z-index: 2; animation: famBob 2.2s ease-in-out infinite reverse; }

.fam-perk { margin: 0; font-weight: 900; color: #DCE6FA; text-align: center; }
.fam-card .fam-what { font-size: 10px; font-weight: 800; line-height: 1.15; color: var(--muted); text-align: center; }
.fam-stats:has(> span:only-child) { grid-template-columns: 1fr; }

/* the face-to-face lands hard: a white flash and a shake when the VS shield hits */
.vs-intro::after { content: ''; position: absolute; inset: 0; background: #FFFFFF; opacity: 0; pointer-events: none; animation: vsFlash 0.5s 0.34s ease-out; }
.vs-intro .vs-card.mine { animation: vsFromLeft 0.45s cubic-bezier(0.2, 1.3, 0.4, 1) 0.12s both, vsShake 0.35s 0.6s; }
.vs-intro .vs-card.foe { animation: vsFromRight 0.45s cubic-bezier(0.2, 1.3, 0.4, 1) both, vsShake 0.35s 0.6s; }
@keyframes vsFlash { 0% { opacity: 0.75; } 100% { opacity: 0; } }
@keyframes vsShake { 20% { translate: -8px 3px; } 40% { translate: 7px -2px; } 60% { translate: -5px 2px; } 80% { translate: 3px -1px; } }

/* ---------- ball rarity: a coloured frame, a glow and a tag (common · rare · mythic · legendary) ---------- */
.r-common, .t-common { --rar: var(--rar-common); } .r-rare, .t-rare { --rar: var(--rar-rare); } .r-mythic, .t-epic { --rar: var(--rar-epic); } .r-legend, .t-legend { --rar: var(--rar-legend); }
.tile[class*=' r-'], .tile[class^='r-'] { border-color: color-mix(in srgb, var(--rar) 75%, #0A0E1F); box-shadow: 0 5px 0 var(--stroke), inset 0 0 18px -6px var(--rar); }
.tile.r-legend:not(.locked) { background: radial-gradient(circle at 50% 28%, rgba(255, 182, 39, 0.22), var(--panel-2) 70%); }
.tile.r-mythic:not(.locked) { background: radial-gradient(circle at 50% 28%, rgba(176, 92, 255, 0.2), var(--panel-2) 70%); }
.tile.info { border-color: var(--gold); }
.tile .rar { order: 9; margin-top: 3px; padding: 1px 7px; border-radius: 8px; background: var(--rar); color: #0A0E1F; font: 400 10px var(--display); text-transform: uppercase; letter-spacing: 0.03em; }
#s-cards .tile .rar { display: none; } /* the picker already shows the super's name; the frame colour says the rarity */
.vr-row.is-ball { border-color: var(--rar, var(--stroke)); }
.rar-chip { padding: 2px 8px; border-radius: 8px; background: var(--rar); color: #0A0E1F; font: 400 10px var(--display); text-transform: uppercase; }

/* ---------- the Glory Road (Stitch design): a rail up the middle, cards left and right, arena gates ---------- */

/* ---------- the guild (Stitch design): a wooden sign, the owl master, parchment notices, a gift shelf, the hall of fame ---------- */
.guild { --wood-d: #5E3A18; --parch: #FFF4DC; --ink: #3A2412; }
.g-sign { position: relative; margin: 18px 6px 6px; padding: 12px 16px; border-radius: 12px; text-align: center; background: linear-gradient(180deg, #A86A33, var(--wood-d));
  border: 4px solid #2E1A0A; box-shadow: inset 0 3px 0 rgba(255, 220, 160, 0.4), 0 6px 0 #2E1A0A; }
.g-sign b { font: 400 21px var(--display); text-transform: uppercase; color: #FFD23F; text-shadow: var(--stroke-text); }
.g-sign i { position: absolute; top: -18px; width: 6px; height: 18px; background: repeating-linear-gradient(180deg, #9AA3B5 0 4px, #5A6478 4px 8px); }
.g-sign i:first-child { left: 22%; }
.g-sign i:nth-child(2) { right: 22%; }
.g-master { position: relative; display: flex; align-items: center; gap: 8px; margin: 6px 0 10px; }
.g-master canvas { flex: none; }
.g-hat { position: absolute; left: 18px; top: -10px; width: 36px; height: 36px; rotate: -14deg; background: center / contain no-repeat
  url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 34 34'%3E%3Cpath d='M17 2 L29 28 H5 Z' fill='%237A4FE0' stroke='%230A0E1F' stroke-width='2.5' stroke-linejoin='round'/%3E%3Cpath d='M2 28 H32' stroke='%230A0E1F' stroke-width='5' stroke-linecap='round'/%3E%3Cpath d='M2 28 H32' stroke='%235B3BB0' stroke-width='2.5' stroke-linecap='round'/%3E%3Cpath d='M17 10 l1.6 3.3 3.6.5-2.6 2.5.6 3.6-3.2-1.7-3.2 1.7.6-3.6-2.6-2.5 3.6-.5z' fill='%23FFD23F'/%3E%3C/svg%3E"); }
.g-say { position: relative; flex: 1; margin: 0; padding: 10px 14px; border-radius: 16px; background: #FFFFFF; color: var(--ink); font-weight: 900; font-size: 13px; border: 3px solid var(--stroke); }
.g-say::before { content: ''; position: absolute; left: -11px; top: 50%; translate: 0 -50%; border: 8px solid transparent; border-right-color: var(--stroke); }
.g-board { padding: 12px; border-radius: 16px; background: linear-gradient(180deg, #7A4A22, #5A3416); border: 4px solid #2E1A0A; box-shadow: inset 0 0 0 3px rgba(255, 200, 140, 0.18), 0 6px 0 #2E1A0A; }
.g-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.g-head b { padding: 4px 12px; border-radius: 12px; background: rgba(46, 26, 10, 0.6); font: 400 14px var(--display); text-transform: uppercase; color: #FFE6B0; }
.g-head .sh-note svg { width: 13px; height: 13px; }
.notices { display: flex; flex-direction: column; gap: 16px; }
.notice { position: relative; padding: 16px 14px 12px; border-radius: 8px 14px 8px 12px; background: var(--parch); color: var(--ink); rotate: var(--tilt);
  border: 2px solid #C9A46A; box-shadow: 0 6px 0 rgba(46, 26, 10, 0.6), inset 0 0 22px rgba(201, 164, 106, 0.35); }
.notice .pin { position: absolute; top: -7px; left: 50%; width: 14px; height: 14px; translate: -50%; border-radius: 50%; background: #E0304A; border: 2px solid var(--stroke); }
.notice.done .pin { background: #FFD23F; }
.n-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.rank { padding: 2px 9px; border-radius: 8px; font: 400 11px var(--display); color: #fff; border: 2px solid var(--stroke); }
.rank.rC { background: #A8642A; }
.rank.rB { background: #2E6BE0; }
.rank.rA { background: #8E3FE0; }
.n-state { padding: 2px 8px; border-radius: 8px; background: #FFE2A0; color: #8A5A0E; font: 400 10px var(--display); text-transform: uppercase; }
.stamp { padding: 2px 10px; border: 3px solid #2FA65A; border-radius: 8px; color: #1E8A46; font: 400 15px var(--display); text-transform: uppercase; rotate: 8deg; }
.n-title { display: block; font: 400 16px var(--display); }
.n-prog, .n-rw { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; font-weight: 900; font-size: 12px; }
.n-prog b { color: #2E6BE0; }
.notice.done .n-prog b { color: #1E8A46; }
.n-rw b { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; }
.n-rw .coin { width: 16px; height: 16px; }
.n-bar { display: block; height: 10px; margin-top: 4px; border-radius: 8px; background: #F4D58A; border: 2px solid #8A5A0E; overflow: hidden; }
.n-bar i { display: block; height: 100%; background: linear-gradient(90deg, #2E86E0, #4CC9F0); }
.notice.done .n-bar i { background: linear-gradient(90deg, #2FA65A, #6FE08E); }
.notice.claimed { opacity: 0.6; }
.notice .btn { margin: 10px 0 0; }
.g-h { display: flex; align-items: center; justify-content: space-between; margin: 18px 2px 8px; color: var(--gold); font: 400 18px var(--display); text-transform: uppercase; text-shadow: var(--stroke-text); }
.daily.shelf { padding: 10px; border-radius: 16px; background: linear-gradient(180deg, #7A4A22, #5A3416); border: 3px solid #2E1A0A; box-shadow: 0 5px 0 #2E1A0A; }
.dcell .d-gift svg { width: 32px; height: auto; }
.dcell .d-lock svg { width: 16px; height: 16px; fill: var(--muted); }
.dcell .d-taken { color: var(--go); font-size: 10px; font-weight: 900; }
.dcell .d-claim { padding: 3px 6px; font-size: 10px; }
.hall { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 16px; background: linear-gradient(180deg, #6A4020, #4A2C12); border: 3px solid #2E1A0A; }
.plaque { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: rgba(10, 14, 31, 0.6); border: 2px solid var(--stroke); }
.p-ic { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: var(--panel-2); border: 2px solid var(--stroke); }
.p-ic .trophy { width: 26px; height: 26px; }
.p-ic svg { width: 22px; height: 22px; fill: var(--muted); }
.plaque.got .p-ic, .plaque.ready .p-ic { background: linear-gradient(180deg, #FFE07A, #E0A21E); }
.plaque.locked { opacity: 0.55; }
.p-txt { flex: 1; min-width: 0; }
.p-txt b { font-size: 14px; }
.p-ok { color: var(--go); font-weight: 900; }
.p-n { color: var(--muted); font-weight: 900; font-size: 12px; }

/* ---------- commanders: big characters beside the arena who "lead" the balls ---------- */
.hero-svg { display: block; width: 100%; height: auto; }
.l-hero { display: block; width: 30px; }
.fam-art { display: block; width: 150px; margin-top: 6px; animation: famBob 2.4s ease-in-out infinite; filter: drop-shadow(0 10px 8px rgba(0, 0, 0, 0.35)); }
.fam-mini { display: block; width: 58px; }
.vs-fam .hero-svg { width: 26px; }
.p-fam { width: 74px; }
.cmds { width: var(--size); display: flex; justify-content: space-between; align-items: flex-end; margin-top: -10px; pointer-events: none; }
.cmd { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 150px; }
.cmd-art { display: block; width: 84px; filter: drop-shadow(0 6px 0 rgba(10, 14, 31, 0.55)); transform-origin: 50% 100%; }
.cmd.them .cmd-art { scale: -1 1; animation-delay: -1s; }
.cmd-name { max-width: 150px; padding: 2px 8px; border-radius: 8px; border: 2px solid var(--stroke); font: 400 10px var(--display); text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmd.you .cmd-name { background: var(--you); color: #05202B; }
.cmd.them .cmd-name { background: var(--foe); color: #fff; }
@media (min-width: 760px) { /* wide screens: they stand beside the arena, bigger */
  .stage { position: relative; }
  .cmds { position: absolute; top: 50%; left: 50%; width: calc(var(--size) + 380px); translate: -50% -40%; margin: 0; }
  .cmd { width: 170px; }
  .cmd-art { width: 150px; }
  .cmd-name { font-size: 12px; max-width: 170px; }
}

/* ---------- rarity on skins and commanders, the same colours as the balls ---------- */
.skin[class*=' r-'] { border-color: color-mix(in srgb, var(--rar) 70%, #0A0E1F); box-shadow: inset 0 0 14px -6px var(--rar); }
.skin.on[class*=' r-'] { border-color: var(--gold); }
.skin .rar, .fam-card .rar { padding: 1px 6px; border-radius: 8px; background: var(--rar); color: #0A0E1F; font: 400 10px var(--display); text-transform: uppercase; letter-spacing: 0.03em; }
.fam-card[class*=' r-'] { border-color: color-mix(in srgb, var(--rar) 75%, #0A0E1F); box-shadow: 0 5px 0 var(--stroke), inset 0 0 18px -6px var(--rar); }
.fam-card .rar { align-self: center; }
.fam-name .rar-chip { display: inline-block; margin-left: 8px; padding: 3px 8px; vertical-align: middle; font-size: 10px; line-height: 1; text-shadow: none; -webkit-text-stroke: 0; color: #0A0E1F; } /* no outline from the title around it */

/* ---------- commanders, more alive: breathing, a sway, a pedestal, a "go!" gesture and speech bubbles ---------- */
.cmd { position: relative; }
.cmd::before { content: ''; position: absolute; left: 50%; bottom: 18px; width: 74%; height: 16px; translate: -50% 0; border-radius: 50%; background: radial-gradient(closest-side, color-mix(in srgb, var(--you) 55%, transparent), transparent); animation: cmdGlow 2.4s ease-in-out infinite; }
.cmd.them::before { background: radial-gradient(closest-side, color-mix(in srgb, var(--foe) 55%, transparent), transparent); }
@keyframes cmdGlow { 50% { opacity: 0.55; scale: 0.9; } }
.cmd-say { position: absolute; z-index: 2; bottom: calc(100% - 14px); left: 50%; translate: -50% 0; padding: 4px 10px; border-radius: 12px; border: 2.5px solid var(--stroke); background: #fff; color: #0A0E1F; font: 400 12px var(--display); white-space: nowrap; pointer-events: none; opacity: 0; scale: 0.4; }
.cmd-say::after { content: ''; position: absolute; left: 50%; top: 100%; translate: -50% -2px; border: 7px solid transparent; border-top-color: #fff; }
.cmd-say.on { animation: cmdSay 1.6s ease-out; }
@keyframes cmdSay { 0% { opacity: 0; scale: 0.4; } 12% { opacity: 1; scale: 1.1; } 20%, 80% { opacity: 1; scale: 1; } 100% { opacity: 0; scale: 0.9; translate: -50% -8px; } }
.cmd.win .cmd-say.on, .cmd.sad .cmd-say.on { animation-duration: 3s; }


/* ---------- living commanders: they breathe, the head nods and looks at the fight; joy and despair at the end ---------- */
.hero-live .h-all { transform-box: view-box; transform-origin: 70px 158px; animation: hBreath 2.6s ease-in-out infinite; }
.hero-live .h-head { transform-box: view-box; transform-origin: 70px 86px; animation: hHead 6s ease-in-out infinite; }
.cmd.them .h-head, .r-cmd.them .h-head { animation-delay: -2.5s; }
@keyframes hBreath { 50% { transform: scale(0.985, 1.03); } }
@keyframes hHead { 0%, 100% { transform: rotate(-3deg); } 20% { transform: rotate(3deg) translateY(-1px); } 38% { transform: rotate(-2deg); }
  46%, 58% { transform: rotate(10deg) translateX(2px); } /* a long look at the fight */ 68% { transform: rotate(0); } 84% { transform: rotate(4deg) translateY(-2px); } }
.cmd-art { animation: cmdIdle 2.6s ease-in-out infinite; }
@keyframes cmdIdle { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-5px) rotate(2deg); } }
.cmd.cheer .cmd-art { animation: cmdCheer 0.6s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes cmdCheer { 0% { transform: scale(1, 1); } 25% { transform: scale(1.12, 0.86); } 55% { transform: translateY(-22px) scale(0.92, 1.1) rotate(-6deg); } 100% { transform: none; } }
.cmd.cheer .h-head { animation: hNod 0.6s ease-out; }
@keyframes hNod { 40% { transform: rotate(-10deg) translateY(-3px); } }
.cmd.ouch .cmd-art { animation: cmdOuch 0.5s ease-out; }
@keyframes cmdOuch { 20% { transform: translateX(-12px) rotate(-12deg) scale(0.94); filter: brightness(1.6) sepia(1) hue-rotate(-40deg) saturate(4) drop-shadow(0 6px 0 rgba(10, 14, 31, 0.55)); } 55% { transform: translateX(5px) rotate(5deg); } }
.cmd.ouch .h-head { animation: hJerk 0.5s ease-out; }
@keyframes hJerk { 25% { transform: rotate(-16deg) translateX(-3px); } }
.cmd.cast .cmd-art { animation: cmdCast 0.8s ease-out; }
@keyframes cmdCast { 30% { transform: scale(1.22) rotate(6deg); filter: drop-shadow(0 0 18px #FFE38A) brightness(1.25); } 60% { transform: scale(1.1) rotate(-3deg); } }
.cmd.point .cmd-art { animation: cmdPoint 0.5s ease-out; }
@keyframes cmdPoint { 35% { transform: translateX(10px) rotate(10deg) scale(1.08, 0.95); } }
/* joy: jumping, golden glow, sparkles; despair: dark, slumped, head down, a rain cloud */
.cmd.win .cmd-art, .r-cmd.win .hero-live { animation: cmdWin 0.7s ease-in-out infinite; filter: drop-shadow(0 0 14px rgba(255, 210, 63, 0.9)) drop-shadow(0 6px 0 rgba(10, 14, 31, 0.55)); }
@keyframes cmdWin { 0%, 100% { transform: translateY(0) scale(1.06, 0.94); } 45% { transform: translateY(-20px) scale(0.95, 1.06) rotate(-4deg); } 55% { transform: translateY(-20px) scale(0.95, 1.06) rotate(4deg); } }
.cmd.win .h-head, .r-cmd.win .h-head { animation: hHappy 0.7s ease-in-out infinite; }
@keyframes hHappy { 0%, 100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg) translateY(-2px); } }
.cmd.sad .cmd-art, .r-cmd.sad .hero-live { animation: cmdSad 3s ease-in-out infinite; filter: grayscale(0.85) brightness(0.45) drop-shadow(0 6px 0 rgba(10, 14, 31, 0.55)); }
@keyframes cmdSad { 0%, 100% { transform: translateY(8px) scale(1.04, 0.92) rotate(-2deg); } 50% { transform: translateY(10px) scale(1.05, 0.9) rotate(2deg); } }
.cmd.sad .h-head, .r-cmd.sad .h-head { animation: hDroop 3s ease-in-out infinite; }
@keyframes hDroop { 0%, 100% { transform: rotate(14deg) translateY(6px); } 50% { transform: rotate(10deg) translateY(8px); } }
.r-cmd.them .hero-live { scale: -1 1; }
.r-cmd.win::before { content: '✦ ✧ ✦'; position: absolute; left: 0; right: 0; top: -14px; text-align: center; color: #FFE38A; font-size: 16px; letter-spacing: 6px; text-shadow: 0 0 8px #FFD23F; animation: sparkle 0.9s ease-in-out infinite; }
@keyframes sparkle { 50% { opacity: 0.4; transform: translateY(-4px) scale(1.15); } }
.r-rain { position: absolute; left: 50%; top: -30px; width: 58px; translate: -50% 0; animation: rainBob 2.5s ease-in-out infinite; }
.r-rain .r-drop { animation: rainDrop 0.7s linear infinite; }
@keyframes rainBob { 50% { translate: -50% -3px; } }
@keyframes rainDrop { 0% { transform: translateY(-4px); opacity: 0; } 30% { opacity: 1; } 100% { transform: translateY(8px); opacity: 0; } }

/* ---------- settings: grouped rows, help links; the report form; a note for parents ---------- */
.settings { max-height: 88vh; overflow-y: auto; text-align: left; }
.settings h2 { text-align: center; }
.settings h3 { margin: 14px 2px 6px; font: 400 12px var(--display); text-transform: uppercase; color: var(--muted); letter-spacing: 0.04em; }
.set-group { display: flex; flex-direction: column; border-radius: 12px; background: rgba(10, 14, 31, 0.35); border: 2px solid var(--stroke); overflow: hidden; }
.set-group .set-row { padding: 10px 12px; margin: 0; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.set-group > :last-child { border-bottom: 0; }
.set-link { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 13px 12px; border: 0; border-bottom: 1px solid rgba(255, 255, 255, 0.06); background: none; color: var(--text); font: 800 15px var(--body, inherit); text-align: left; text-decoration: none; cursor: pointer; }
.set-link i { font-style: normal; font-size: 22px; color: var(--muted); }
.set-link:active { background: rgba(255, 255, 255, 0.06); }
.settings #set-account { margin-top: 14px; }
.report { text-align: left; }
.report h2 { text-align: center; }
.rep-field { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; font-weight: 800; font-size: 13px; }
.rep-field input, .rep-field textarea { width: 100%; padding: 10px 12px; border-radius: 12px; border: 2px solid var(--stroke); background: #0F1A33; color: var(--text); font: 700 15px inherit; resize: vertical; }
.rep-field input:focus, .rep-field textarea:focus { outline: 2px solid var(--you); }
.report .chip-row { margin-top: 6px; }
.parents-body { white-space: pre-line; text-align: left; line-height: 1.5; font-size: 14px; }

/* ---------- gem packs (Dodo Payments) ---------- */
.pay-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.pay-pack { position: relative; padding-top: 18px; }
.pay-pack.best { border-color: var(--gold); box-shadow: 0 5px 0 var(--stroke), 0 0 16px rgba(255, 210, 63, 0.45); }
.pay-gems { display: flex; justify-content: center; gap: 0; min-height: 40px; align-items: center; }
.pay-gems .gem { width: 30px; height: 30px; margin: 0 -5px; }
.pay-pack b { font: 400 20px var(--display); }
#sl-paid { margin: 4px 0 0; }

/* ---------- the lobby's bottom, calmer: smaller chest slots without the extra words, a slimmer dock ---------- */
.lobby { gap: 10px; }
.play { height: 72px; }
.pl-txt b { font-size: 28px; }
.mode-btn { width: 72px; }
.cslot { height: 78px; justify-content: center; gap: 3px; }
.cslot svg { width: 44px; }
.cslot.locked .cs-top { display: none; } /* "Locked" said nothing the grey padlock doesn't */
.cslot.locked::after { content: ''; position: absolute; top: 5px; right: 6px; width: 12px; height: 12px; opacity: 0.75;
  background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23C9D4E6' d='M7 10V7a5 5 0 0 1 10 0v3h1v11H6V10zm2 0h6V7a3 3 0 0 0-6 0z'/%3E%3C/svg%3E"); }
.cslot.start .cs-top { font-size: 10px; }
.cslot .cs-time { padding: 2px 8px; border-radius: 999px; background: rgba(10, 14, 31, 0.45); font-size: 12px !important; }
.cslot.busy .cs-now { display: none; }
.cslot.busy .cs-gems { padding: 2px 8px; border-radius: 999px; background: rgba(10, 14, 31, 0.45); }
.sbtn { height: 62px; gap: 5px; font-size: 10.5px; }
.sbtn svg { width: 26px; height: 26px; }

/* ---------- wide screens: side panels ---------- */
.wing { position: fixed; top: 84px; z-index: 2; width: min(300px, calc((100vw - 640px) / 2 - 48px)); display: flex; flex-direction: column; gap: 14px; }
.wing.l { left: max(24px, calc(50% - 320px - min(300px, calc((100vw - 640px) / 2 - 48px)) - 28px)); }
.wing.r { right: max(24px, calc(50% - 320px - min(300px, calc((100vw - 640px) / 2 - 48px)) - 28px)); }
.wcard { display: flex; flex-direction: column; gap: 10px; width: 100%; padding: 14px; text-align: left; color: var(--text); cursor: pointer; border: 3px solid var(--stroke); border-radius: 16px;
  background: var(--grain), linear-gradient(180deg, rgba(75, 50, 30, 0.95), rgba(46, 30, 18, 0.95)); box-shadow: inset 0 2px 0 var(--hi), 0 6px 0 var(--stroke); transition: transform 0.08s; }
.wcard:hover { transform: translateY(-2px); }
.wcard:active { transform: translateY(2px); }
.wcard h4 { margin: 0; font: 400 15px var(--display); text-transform: uppercase; color: var(--gold); text-shadow: 0 2px 0 var(--stroke); }
.wq { display: grid; grid-template-columns: 1fr auto; grid-template-areas: 'n r' 'b c'; gap: 4px 10px; align-items: center; }
.wq b { grid-area: n; font-size: 13px; font-weight: 900; line-height: 1.15; }
.wq em { grid-area: r; display: inline-flex; align-items: center; gap: 3px; font: 400 13px var(--display); font-style: normal; color: var(--gold); }
.wq .wq-bar { grid-area: b; }
.wq small { grid-area: c; font-size: 11px; font-weight: 900; color: var(--muted); }
.wq.ready .wq-bar i { background: var(--gold); }
.wq.done { opacity: 0.55; }
.wq-bar { display: block; height: 8px; border-radius: 999px; background: #0F1A33; overflow: hidden; }
.wq-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #4CC9F0, #6FF0B4); }
.wroad { display: flex; align-items: center; gap: 12px; }
.wr-ic { flex: none; display: grid; place-items: center; width: 60px; height: 60px; border-radius: 12px; background: #0F1A33; border: 2px solid var(--stroke); }
.wr-ic .chest-ico svg { width: 46px; }
.wr-txt { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.wr-txt b { font: 400 14px var(--display); text-transform: uppercase; }
.wr-txt small { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 800; font-size: 12px; }
.wr-txt .trophy { width: 12px; height: 12px; }
.wdeal { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 0 2px; text-align: center; }
.wdeal b { font-size: 13px; font-weight: 900; }
.wdeal .sh-off { position: absolute; top: -4px; right: 0; }
.wdeal .banner-prev { width: 100%; }
.wcmd { display: flex; align-items: center; gap: 12px; }
.wc-art { width: 90px; flex: none; }
.wcmd b { display: block; font: 400 18px var(--display); text-transform: uppercase; }
.wcmd small { color: var(--muted); font-weight: 900; }
.ad-wing:empty { display: none; } /* a 300×250 display ad goes here once AdSense is live */
@media (max-height: 760px) { .wing { top: 74px; gap: 10px; } .wcard { padding: 10px 12px; gap: 7px; } }

/* ---------- the logo (Stitch) and the companions: bigger, standing on the banner and bobbing ---------- */
.brand .logo-svg { display: block; height: 46px; width: auto; overflow: visible; filter: drop-shadow(0 3px 0 rgba(10, 14, 31, 0.5)); }
@media (max-width: 420px) { .brand .logo-svg { height: 38px; } }
.me { padding-right: 66px; }
.me-deco { top: auto; bottom: -6px; right: 0; translate: none; width: 70px; height: 70px; animation: compBob 2.2s ease-in-out infinite; transform-origin: 50% 100%; }
.me-deco svg { filter: drop-shadow(0 3px 0 rgba(10, 14, 31, 0.5)); }
@keyframes compBob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-4px) rotate(3deg) scaleY(1.03); } }
.deco-prev svg { width: 78px; height: 78px; }
.vs-deco svg { width: 68px; height: 68px; animation: compBob 2.2s ease-in-out infinite; }
.p-ribbon .me-deco { right: 14px; top: auto; bottom: -4px; transform: none; width: auto; height: auto; }
.p-ribbon .me-deco svg { width: 62px; height: 62px; }

/* ---------- survival: pick one of three upgrades between waves ---------- */
.up-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.up-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px 12px; border: 3px solid var(--stroke); border-radius: 16px; cursor: pointer; color: var(--text);
  background: linear-gradient(180deg, #2E4C8A, #1E3466); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.2), 0 5px 0 var(--stroke); animation: upIn 0.4s cubic-bezier(.3, 1.5, .5, 1) backwards; }
.up-card:nth-child(2) { animation-delay: 0.08s; }
.up-card:nth-child(3) { animation-delay: 0.16s; }
.up-card:hover { border-color: var(--gold); }
.up-card:active { transform: translateY(3px); }
.up-card svg { width: 48px; height: 48px; filter: drop-shadow(0 3px 0 rgba(10, 14, 31, 0.5)); }
.up-card b { font: 400 13px var(--display); text-transform: uppercase; text-align: center; line-height: 1.1; }
.up-card small { font-size: 11px; font-weight: 800; color: #C9D4E6; text-align: center; line-height: 1.25; }
@keyframes upIn { from { opacity: 0; transform: translateY(20px) scale(0.8); } }

/* ---------- leaders: the top three on a podium ---------- */
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; align-items: end; gap: 6px; margin: 8px 0 14px; padding-top: 26px; }
.pod { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; }
.pod canvas { border-radius: 50%; filter: drop-shadow(0 6px 0 rgba(10, 14, 31, 0.5)); animation: podDrop 0.6s cubic-bezier(.3, 1.5, .5, 1) backwards; }
.pod.p1 canvas { animation-delay: 0.25s; } .pod.p2 canvas { animation-delay: 0.1s; } .pod.p3 canvas { animation-delay: 0.4s; }
.pod-nm { max-width: 100%; padding: 0 4px; font-weight: 900; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pod-sc { display: inline-flex; align-items: center; gap: 3px; font: 400 14px var(--display); color: var(--gold); text-shadow: 0 2px 0 var(--stroke); }
.pod-sc .trophy { width: 14px; height: 14px; }
.pod-base { display: grid; place-items: start center; width: 100%; margin-top: 4px; padding-top: 8px; border: 3px solid var(--stroke); border-bottom: 0; border-radius: 12px 12px 0 0;
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.35); transform-origin: 50% 100%; animation: podRise 0.5s ease-out backwards; }
.pod-base b { font: 400 30px/1 var(--display); color: #fff; text-shadow: var(--stroke-text); }
.pod.p1 .pod-base { height: 110px; background: linear-gradient(180deg, #FFE38A, #E5A100); }
.pod.p2 .pod-base { height: 78px; background: linear-gradient(180deg, #EEF2F8, #9AA8BE); animation-delay: 0.08s; }
.pod.p3 .pod-base { height: 56px; background: linear-gradient(180deg, #F2B47A, #B0622A); animation-delay: 0.16s; }
.pod.p1::before { content: ''; position: absolute; top: -20px; left: 50%; width: 150px; height: 150px; translate: -50% 0; z-index: -1; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 210, 63, 0.45), transparent); animation: podGlow 2.4s ease-in-out infinite; }
.pod-crown { position: absolute; top: -26px; z-index: 1; width: 34px; animation: podCrown 1.8s ease-in-out infinite; }
.pod-crown svg { display: block; width: 100%; filter: drop-shadow(0 2px 0 rgba(10, 14, 31, 0.5)); }
.pod.mine .pod-nm { color: var(--you); }
.pod.mine canvas { box-shadow: 0 0 0 3px var(--you), 0 0 18px var(--you); }
@keyframes podRise { from { transform: scaleY(0); } }
@keyframes podDrop { from { opacity: 0; transform: translateY(-40px) scale(0.6); } }
@keyframes podGlow { 50% { opacity: 0.6; scale: 0.9; } }
@keyframes podCrown { 50% { transform: translateY(-4px) rotate(-6deg); } }

/* ---------- nickname editor ---------- */
.nick-card { max-height: 90vh; overflow-y: auto; }
.nk-preview { margin: 6px 0 10px; padding: 12px; border-radius: 12px; background: rgba(10, 14, 31, 0.45); border: 2px solid var(--stroke); font: 400 22px var(--display); text-align: center; color: var(--gold); }
.nick-card h3 { margin: 10px 2px 6px; font: 400 12px var(--display); text-transform: uppercase; color: var(--muted); text-align: left; }
.nk-words { max-height: 150px; overflow-y: auto; justify-content: flex-start; padding: 2px; }
.nk-words .chip { padding: 7px 11px; font-size: 13px; }
.nick-card #nk-dice { margin-top: 10px; }

/* ---------- friends ---------- */
.fr-me { display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 4px 0 12px; padding: 12px; border-radius: 16px; background: var(--grain), var(--panel); border: 3px solid var(--stroke); }
.fr-me small { color: var(--muted); font-weight: 800; }
.fr-me b { font: 400 20px var(--display); color: var(--gold); }
#tab-friends h3 { margin: 14px 2px 8px; font: 400 13px var(--display); text-transform: uppercase; color: var(--muted); }
.fr-find { display: grid; grid-template-columns: 1fr 1fr 70px; gap: 6px; }
.fr-find select, .fr-find input { min-width: 0; padding: 10px 8px; border-radius: 12px; border: 2px solid var(--stroke); background: #0F1A33; color: var(--text); font: 800 14px inherit; }
.fr-find .btn { grid-column: 1 / -1; }
.fr-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.fr-row { display: grid; grid-template-columns: 10px 36px 1fr auto auto; align-items: center; gap: 8px; padding: 8px 10px; margin-bottom: 6px; border-radius: 12px; background: var(--grain), var(--panel); border: 3px solid var(--stroke); }
.fr-dot { width: 10px; height: 10px; border-radius: 50%; background: #5B6478; }
.fr-row.on .fr-dot { background: #3DDC84; box-shadow: 0 0 8px #3DDC84; }
.fr-nm { min-width: 0; display: flex; flex-direction: column; }
.fr-nm b { font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fr-nm small { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); font-weight: 800; font-size: 12px; }
.fr-nm .trophy { width: 12px; height: 12px; }
.fr-row .btn.sm { padding: 7px 12px; font-size: 13px; }
.fr-wait { color: var(--muted); font-weight: 800; font-size: 12px; }
.pt-fr-h { margin: 12px 0 4px; font: 400 12px var(--display); text-transform: uppercase; color: var(--muted); }
.pt-friends { max-height: 170px; overflow-y: auto; margin-bottom: 8px; }
.pt-friends .fr-row { grid-template-columns: 10px 32px 1fr auto; }
.invite { text-align: center; }
.inv-av { display: grid; place-items: center; margin-bottom: 4px; animation: invPop 0.5s cubic-bezier(.3, 1.6, .5, 1); }
.inv-text { font-weight: 800; font-size: 16px; }
@keyframes invPop { from { transform: scale(0.3); opacity: 0; } }
#fr-results:empty, #fr-note:empty { display: none; }

/* own nickname */
.nk-input, #fr-q { width: 100%; padding: 12px 14px; border-radius: 12px; border: 3px solid var(--stroke); background: #0F1A33; color: var(--gold); font: 400 20px var(--display); text-align: center; }
#fr-q { font-size: 16px; color: var(--text); text-align: left; }
.nk-input:focus, #fr-q:focus { outline: 2px solid var(--you); }
.nk-err { margin: 6px 0 0; color: #FF7A85; font-weight: 800; font-size: 13px; }
.fr-find { grid-template-columns: 1fr auto; }
.fr-find .btn { grid-column: auto; }
.op-card .tix-art { display: block; filter: drop-shadow(0 6px 10px rgba(0,0,0,0.35)); }
.op-card.small .tix-art svg { width: 100%; }
.emote-tray button.spray { background: #4B321E; box-shadow: inset 0 -3px 0 #2A1B10; }
.sh-tile .sh-price.chest { background: none; box-shadow: none; border: 0; color: #9FB0CF; font-weight: 800; }
.tix-ic { display: inline-block; width: 22px; vertical-align: -5px; margin-right: 4px; }
.tix-ic svg { width: 100%; height: auto; display: block; }
.tix-ic.none { opacity: 0.4; filter: grayscale(1); }
.mode-btn { position: relative; }
.tix-badge { position: absolute; top: -9px; right: -9px; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 12px; background: #FFD23F; color: #0A0F1C;
  border: 3px solid #0A0F1C; font: 900 15px Rubik, sans-serif; display: grid; place-items: center; box-sizing: border-box; }
.tix-fly { position: fixed; left: 50%; top: 27%; width: 210px; z-index: 60; pointer-events: none; animation: tixFly 1.6s cubic-bezier(.2,.8,.3,1) forwards; filter: drop-shadow(0 10px 18px rgba(0,0,0,.5)); }
.tix-fly svg { width: 100%; height: auto; display: block; }
.tix-fly b { position: absolute; right: -34px; top: -18px; font: 900 44px Rubik, sans-serif; color: #FFD23F; -webkit-text-stroke: 7px #0A0F1C; paint-order: stroke fill; }
@keyframes tixFly {
  0% { transform: translate(-50%, -50%) scale(0.3) rotate(-20deg); opacity: 0; }
  14% { transform: translate(-50%, -50%) scale(1.18) rotate(6deg); opacity: 1; }
  28% { transform: translate(-50%, -50%) scale(1) rotate(-5deg); }
  42% { transform: translate(-50%, -50%) scale(1) rotate(4deg); }
  70% { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 1; }
  100% { transform: translate(-50%, -190%) scale(0.55) rotate(-14deg); opacity: 0; }
}

/* ---------- design system pass (DESIGN.md): calmer lobby, messages in the profile ---------- */
.side { gap: 16px; }
.slots.none { grid-template-columns: 1fr; }
.slot-hint { height: 44px; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 0 14px; border-radius: 12px;
  border: 2px dashed rgba(157, 176, 214, 0.3); color: var(--muted); font-size: 13px; font-weight: 800; }
.slot-hint svg { width: 34px; height: auto; flex: none; opacity: 0.55; filter: grayscale(1); }
.sh-top:has(> .sh-ad:empty) { display: none; }
.p-mail { position: relative; display: flex; align-items: center; justify-content: center; gap: 10px; }
.p-mail svg { width: 26px; height: 26px; flex: none; }
.p-mail .badge { top: -7px; right: -5px; }

/* ---------- Glory Road: a board-game map. Each arena is a patch of its own ground with its things about and a gate at its
   start; the rewards stand on plates along one winding path (gold where you've been); your ball stands where you are. ---------- */
body[data-tab=path] .page-in { width: min(100%, 760px); }
.road4 { position: relative; margin: 0 -16px; padding-bottom: 96px; }
.rd-path { position: absolute; left: 0; top: 0; z-index: 1; pointer-events: none; overflow: visible; }
.rd-path path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.rd-path .p-edge { stroke: #1A1008; stroke-width: 46px; }
.rd-path .p-road { stroke: #E9D3A0; stroke-width: 36px; }
.rd-path .p-done { stroke: #FFCC33; stroke-width: 36px; filter: drop-shadow(0 0 10px rgba(255, 204, 51, 0.6)); }
.rd-path .p-dash { stroke: rgba(120, 80, 30, 0.35); stroke-width: 4px; stroke-dasharray: 2 16; }
.rd-zone { position: relative; overflow: hidden; border-top: 5px solid var(--stroke);
  background: radial-gradient(ellipse 70% 30% at 50% 70%, color-mix(in srgb, var(--zl) 30%, transparent), transparent 70%),
    repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.05) 0 2px, transparent 2px 26px), linear-gradient(color-mix(in srgb, var(--zf) 80%, #000), var(--zf)); }
.rd-zone::before { content: ''; position: absolute; inset: -30px; background: var(--zimg) center / cover; filter: blur(14px) saturate(1.1); opacity: 0.55; pointer-events: none; }
.rd-zone.locked > :not(.rd-gate) { filter: saturate(0.45) brightness(0.65); }
.rd-zone.locked { background-color: #000; }
.rd-zone.locked::after { content: ''; position: absolute; inset: 0; background: rgba(10, 6, 2, 0.35); pointer-events: none; }
.rd-prop { position: absolute; z-index: 1; width: 64px; height: 64px; translate: -50% 50%; opacity: 0.9; filter: drop-shadow(0 6px 4px rgba(0, 0, 0, 0.35)); pointer-events: none; }
.rd-gate { position: absolute; z-index: 3; left: 50%; bottom: 22px; translate: -50% 0; width: min(88%, 400px); box-sizing: border-box; display: flex; align-items: center; gap: 12px;
  padding: 10px 14px 10px 10px; border-radius: 16px; border: 4px solid var(--stroke); background: var(--grain), var(--panel); box-shadow: inset 0 2px 0 var(--hi), 0 6px 0 var(--stroke); }
.rd-gate::before { content: ''; position: absolute; left: 50%; top: -34px; translate: -50% 0; width: 70%; height: 46px; border: 5px solid var(--stroke); border-bottom: 0; border-radius: 999px 999px 0 0;
  background: none; box-shadow: inset 0 3px 0 var(--hi); } /* the arch over the road */
.rd-zone.cur .rd-gate { box-shadow: 0 0 0 4px var(--gold), 0 6px 0 var(--stroke); }
.rd-gate canvas { flex: none; display: block; width: 96px; height: 96px; border-radius: 10px; border: 3px solid var(--stroke); }
.rd-zone.locked .rd-gate canvas { filter: grayscale(0.5) brightness(0.75); }
.rd-gtxt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.rd-gtxt small { display: inline-flex; align-items: center; gap: 4px; font: 400 12px var(--display); text-transform: uppercase; color: var(--gold); }
.rd-gtxt small .trophy { width: 13px; height: 13px; }
.rd-gtxt b { font: 400 22px var(--display); line-height: 1.05; }
.rd-chips { display: flex; gap: 2px; margin-top: 2px; }
.rd-lock { position: absolute; top: 8px; right: 10px; width: 22px; height: 22px; color: var(--muted); } .rd-lock svg { width: 100%; height: 100%; fill: currentColor; }
.rd-node { position: absolute; z-index: 2; width: 96px; translate: -50% 50%; display: flex; flex-direction: column; align-items: center; padding: 0; border: 0; background: none; color: var(--text); cursor: pointer; }
.rd-plate { position: relative; display: grid; place-items: center; width: 84px; height: 84px; border-radius: 50%; border: 4px solid var(--stroke);
  background: radial-gradient(circle at 50% 32%, #FFF4D6, #E2BC74 58%, #9A6A2C); box-shadow: inset 0 -7px 0 rgba(0, 0, 0, 0.2), 0 7px 0 var(--stroke); }
.rd-plate .coin, .rd-plate .gem { width: 46px; height: 46px; }
.rd-plate .chest-3d { width: 76px; margin: -6px 0 -2px; }
.rd-node[class*=' r-'] .rd-plate { box-shadow: 0 0 0 4px var(--rar), inset 0 -7px 0 rgba(0, 0, 0, 0.2), 0 7px 0 var(--stroke); }
.rd-at { margin-top: -12px; z-index: 1; padding: 1px 9px; border-radius: 999px; background: var(--stroke); border: 2px solid #6E4B2B; font: 900 13px Rubik, sans-serif; color: #F2DDB0; }
.rd-name { position: absolute; top: 18px; left: calc(100% - 4px); width: 130px; display: flex; flex-direction: column; text-align: left; font-size: 14px; font-weight: 900; line-height: 1.1;
  text-shadow: 0 2px 0 var(--stroke), 0 0 6px rgba(0, 0, 0, 0.8); pointer-events: none; }
.rd-name small { font: 400 11px var(--display); text-transform: uppercase; color: var(--gold); }
.rd-node.flip .rd-name { left: auto; right: calc(100% - 4px); text-align: right; align-items: flex-end; }
.rd-mark { position: absolute; top: -4px; right: 4px; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--stroke); background: #3A2617; color: var(--muted); font-weight: 900; }
.rd-mark svg { width: 13px; height: 13px; fill: currentColor; }
.rd-node.done .rd-mark { background: var(--go); color: var(--go-ink); }
.rd-node.done .rd-plate { filter: saturate(0.55) brightness(0.85); }
.rd-node.locked .rd-plate { filter: grayscale(0.55) brightness(0.72); }
.rd-node.ready .rd-plate { background: radial-gradient(circle at 50% 32%, #FFFBE8, #FFD54A 58%, #E09A10); animation: bob2 1.2s ease-in-out infinite;
  box-shadow: 0 0 0 6px rgba(255, 204, 51, 0.45), 0 0 26px rgba(255, 204, 51, 0.7), 0 7px 0 var(--stroke); }
.rd-claim { position: absolute; top: 72px; padding: 4px 12px; border-radius: 999px; border: 3px solid var(--stroke); background: var(--go); color: var(--go-ink);
  font: 400 13px var(--display); text-transform: uppercase; box-shadow: 0 3px 0 var(--stroke); z-index: 2; }
.rd-node.ready .rd-at { display: none; }
.rd-me { position: absolute; z-index: 4; translate: -50% 50%; pointer-events: none; }
.rd-me .rd-flag, .rd-me .rd-tonext { position: absolute; left: calc(100% + 8px); } .rd-me .rd-flag { top: 4px; } .rd-me .rd-tonext { top: 40px; }
.rd-me.flip .rd-flag, .rd-me.flip .rd-tonext { left: auto; right: calc(100% + 8px); }
.rd-av { display: grid; place-items: center; width: 66px; height: 66px; box-sizing: border-box; border-radius: 50%; border: 5px solid var(--you);
  background: var(--grain), var(--panel); box-shadow: 0 0 0 4px var(--stroke), 0 0 24px rgba(76, 201, 240, 0.7); animation: bob2 1.6s ease-in-out infinite; }
.rd-flag { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; padding: 4px 12px; border-radius: 999px; border: 3px solid var(--stroke); background: var(--you);
  color: var(--stroke); font: 400 14px var(--display); text-transform: uppercase; box-shadow: 0 3px 0 var(--stroke); }
.rd-flag .trophy, .rd-tonext .trophy { width: 14px; height: 14px; }
.rd-tonext { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font-size: 13px; font-weight: 900; text-shadow: 0 2px 0 var(--stroke), 0 0 6px #000; }
.path-hero { grid-template-columns: auto 1fr; gap: 14px; padding: 10px 14px 12px; }
.ph-info { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ph-info b { font: 400 15px var(--display); text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph-info small { font-size: 12px; font-weight: 800; color: var(--muted); }
.r3-bar { position: sticky; bottom: 8px; z-index: 5; display: flex; align-items: center; gap: 10px; margin-top: -80px; padding: 10px 10px 10px 14px;
  border-radius: 16px; background: var(--grain), var(--panel); border: 3px solid var(--stroke); box-shadow: inset 0 2px 0 var(--hi), 0 5px 0 var(--stroke); }
.r3-bar > span { flex: 1; min-width: 0; font: 400 13px var(--display); text-transform: uppercase; color: var(--go); }
.r3-bar .btn { margin: 0; font: 400 18px var(--display); text-transform: uppercase; }

/* ---------- the result: a ribbon, the squad on a little stage, reward tiles that pop in, one big button ---------- */
.result { position: relative; width: min(100%, 420px); padding: 0 18px 18px; overflow: visible; }
.r-ribbon { position: relative; margin: 16px -30px 0; padding: 14px 40px 16px; background: #2F6FE0; border: 3px solid var(--stroke); box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.25), 0 5px 0 var(--stroke);
  clip-path: polygon(0 0, 100% 0, calc(100% - 18px) 50%, 100% 100%, 0 100%, 18px 50%); }
.result:has(#r-title.lose) .r-ribbon { background: #5B2A3A; }
#r-title { margin: 0; font: 400 40px/1 var(--display); text-transform: uppercase; letter-spacing: 0.03em; text-shadow: var(--stroke-text); }
#r-title.win { color: var(--gold); }
#r-title.lose { color: #FFB3BD; }
.r-stage { position: relative; display: flex; align-items: flex-end; justify-content: center; min-height: 150px; margin: 10px 0 2px; padding: 0 70px; }
.r-stage::before { content: ''; position: absolute; left: 50%; top: 52%; width: 300px; height: 300px; translate: -50% -50%; z-index: 0; pointer-events: none; opacity: 0.35;
  background: repeating-conic-gradient(from 0deg, rgba(255, 227, 138, 0.9) 0deg 10deg, transparent 10deg 30deg); -webkit-mask: radial-gradient(circle, #000 20%, transparent 70%); mask: radial-gradient(circle, #000 20%, transparent 70%);
  animation: rRays 12s linear infinite; }
.result:has(#r-title.lose) .r-stage::before { display: none; }
@keyframes rRays { to { rotate: 360deg; } }
#r-squad { position: relative; z-index: 1; }
#r-squad canvas:nth-child(1) { order: 2; position: relative; z-index: 1; margin: 0 -16px; }
#r-squad canvas:nth-child(2) { order: 1; margin-bottom: 8px; }
#r-squad canvas:nth-child(3) { order: 3; margin-bottom: 8px; }
.r-cmds { position: absolute; inset: auto 0 0; z-index: 2; height: 0; pointer-events: none; }
.r-cmd { position: absolute; bottom: 0; width: 74px; }
.r-cmd.you { left: -6px; }
.r-cmd.them { right: -6px; }
.r-sub { margin: 8px 0 6px; font-size: 14px; font-weight: 900; color: var(--muted); }
.r-loot { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 8px 0 10px; }
.r-tile { width: 92px; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 6px 9px; border-radius: 12px;
  background: var(--grain), var(--panel-2); border: 3px solid var(--stroke); box-shadow: inset 0 2px 0 var(--hi), 0 4px 0 var(--stroke);
  animation: rPop 0.35s cubic-bezier(.3, 1.4, .6, 1) both; animation-delay: calc(0.25s + var(--i, 0) * 0.18s); }
@keyframes rPop { from { opacity: 0; scale: 0.4; } to { opacity: 1; scale: 1; } }
.r-art { display: grid; place-items: center; height: 44px; }
.r-art .coin { width: 38px; height: 38px; }
.r-art svg { display: block; width: 50px; height: 44px; }
.r-tile b { display: inline-flex; align-items: center; gap: 3px; font: 900 20px/1.1 Rubik, sans-serif; }
.r-tile b .coin, .r-tile b .gem { width: 15px; height: 15px; }
.r-tile.level b { font-size: 14px; }
.r-tile small { font-size: 11px; font-weight: 900; line-height: 1.15; color: var(--muted); }
.r-xp, .r-lv { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: #2F6FE0; border: 3px solid var(--stroke); font: 900 14px Rubik, sans-serif; color: #FFFFFF; }
.r-lv { background: var(--gold); color: var(--gold-ink); font-size: 18px; }
.r-tile.coins { box-shadow: inset 0 2px 0 var(--hi), inset 0 -4px 0 var(--gold), 0 4px 0 var(--stroke); }
.r-tile.chest, .r-tile.ticket { box-shadow: inset 0 2px 0 var(--hi), inset 0 -4px 0 var(--go), 0 4px 0 var(--stroke); }
.r-tile.full, .r-tile.lost { opacity: 0.75; box-shadow: inset 0 2px 0 var(--hi), 0 4px 0 var(--stroke); }
.r-tile.full .r-art svg, .r-tile.lost .r-art svg { filter: grayscale(1) brightness(0.8); }
.r-note { margin: 0 0 10px; font-size: 14px; font-weight: 900; color: #8EEBFF; }
.result #r-next { margin: 4px 0 10px; font: 400 26px var(--display); text-transform: uppercase; }
.r-more { gap: 10px; }
.r-more .btn { margin: 0; }

.r-more > .btn { flex: 1; }

/* ---------- 3D chests: pictures of the models (ball3d.js), sized a little bigger than the drawings they replace ---------- */
.chest-3d { display: block; width: 100%; height: auto; filter: drop-shadow(0 5px 3px rgba(8, 16, 32, 0.35)); }
.chest-art .chest-3d { width: 70px; margin: -7px; }
.chest-btn.has .chest-art .chest-3d { animation: wiggle 2s ease-in-out infinite; }
.ch-row .chest-3d { width: 80px; margin: -8px 0; }
.ch-row.empty .chest-3d { filter: grayscale(0.8) brightness(0.7); }
.reward .ball-hero .chest-3d { width: 200px; }
.bp-step .chest-ico .chest-3d { width: 50px; }
.cslot .chest-3d { width: 64px; margin: -9px 0 -11px; }
.sl-art .chest-3d { width: 190px; margin: -12px auto; }
.vr-row .chest-ico .chest-3d { width: 66px; }
.dcell .d-gift .chest-3d { width: 42px; }
.wr-ic .chest-ico .chest-3d { width: 58px; }
.slot-hint .chest-3d { width: 46px; flex: none; opacity: 0.6; filter: grayscale(1); }
.r-art .chest-3d { width: 64px; margin: -9px 0; }
.r-tile.full .r-art .chest-3d, .r-tile.lost .r-art .chest-3d { filter: grayscale(1) brightness(0.8); }
.op3d { position: relative; display: block; filter: drop-shadow(0 10px 6px rgba(8, 16, 32, 0.4)); }
.op3d img { display: block; width: 100%; height: auto; }
.op3d .lid { position: absolute; inset: 0; }

/* ---------- the big-screen lobby (body.scene, set by wings() in meta.js at 1180×680 and up): chests on a shelf like a garage game ---------- */
.l-side, .l-road, .cslot .ghost { display: none; }
body.scene { --side: clamp(300px, 26vw, 380px); --side-room: 92px; }
body.scene #bg-art { filter: blur(7px) saturate(1.1) brightness(0.8); } /* blurred, but you still see the room */
body.scene .bar { position: fixed; inset: 0 0 auto; width: auto; padding: 18px 28px; pointer-events: none; }
body.scene .bar > * { pointer-events: auto; }
body.scene .bar .brand { position: absolute; left: 50%; top: 12px; translate: -50% 0; }
body.scene .bar > .row { margin-left: auto; }
body.scene .page { padding-top: 0; }
body.scene .page-in { width: 100%; }
body.scene .lobby-top { position: fixed; left: 28px; top: 16px; z-index: 6; }
body.scene .lobby-top .me { width: 360px; height: 70px; }
body.scene .hero-wrap { position: fixed; left: calc(var(--side) + 60px); right: calc(var(--side) + 48px); top: 100px; bottom: 132px; }
body.scene #l-modebtn, body.scene .dock #l-challenge { display: none; }
body.scene .dock { position: fixed; left: calc(50% + 6px); translate: -50% 0; bottom: 24px; z-index: 5; display: flex; gap: 8px; margin: 0; }
body.scene .dock .sbtn { width: 96px; height: 84px; }
body.scene .play-line { position: fixed; right: 28px; bottom: 28px; width: var(--side); z-index: 5; }
body.scene .play { height: 104px; }
body.scene .pl-txt b { font-size: 40px; }

/* the shelf: each chest stands on its own wooden pallet, a cardboard tag with the time above it */
body.scene #l-slots { position: fixed; left: 28px; top: 108px; bottom: 124px; width: calc(var(--side) + 20px); z-index: 5; box-sizing: border-box; display: grid;
  grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 0 18px; padding: 14px 22px 0; border: 4px solid var(--stroke); border-radius: 12px;
  background: repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.2) 0 3px, transparent 3px 58px), linear-gradient(rgba(46, 26, 12, 0.5), rgba(46, 26, 12, 0.3));
  box-shadow: inset 14px 0 0 #9A6230, inset -14px 0 0 #9A6230, inset 0 14px 0 #B97B42, inset 17px 0 0 var(--stroke), inset -17px 0 0 var(--stroke), inset 0 17px 0 var(--stroke), 0 14px 30px rgba(0, 0, 0, 0.45); }
body.scene .cslot { height: auto; padding: 0 0 26px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; background: none; border: 0; box-shadow: none; }
body.scene .cslot::before { content: ''; position: absolute; left: -9px; right: -9px; bottom: 0; height: 44px; border-radius: 4px; border: 3px solid var(--stroke);
  background: radial-gradient(ellipse 40% 34% at var(--sx, 52%) 32%, rgba(20, 8, 0, 0.62), transparent 100%), repeating-linear-gradient(90deg, transparent 0 46px, rgba(60, 30, 8, 0.45) 46px 49px),
    linear-gradient(#B97F48, #E3AC6E 50%, #9A6230 50% 100%);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.35), 0 8px 14px rgba(0, 0, 0, 0.45); }
body.scene .cslot:nth-child(odd)::before { left: -8px; --sx: 40%; } body.scene .cslot:nth-child(even)::before { right: -8px; --sx: 64%; }
body.scene .cslot:nth-child(odd) .chest-svg { scale: -1 1; }
body.scene .cslot .chest-svg { position: relative; z-index: 1; width: min(160px, 100%); margin: 0 0 -26px; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.45)); }
body.scene .cslot .cs-top, body.scene .cslot .cs-time, body.scene .cslot .cs-big, body.scene .cslot.empty small { order: -1; z-index: 2; padding: 4px 12px; border-radius: 8px;
  min-width: 84px; box-sizing: border-box; justify-content: center; text-align: center;
  border: 3px solid var(--stroke); background: #F2DDB0; color: #3A2200; font: 400 16px var(--display); text-shadow: none; box-shadow: 0 3px 0 var(--stroke); }
body.scene .cslot.ready .cs-top, body.scene .cslot .cs-now, body.scene .cslot.start .cs-top, body.scene .cslot .sl-plus { display: none; }
body.scene .cslot.ready .cs-big { background: var(--gold); animation: bob2 1.2s ease-in-out infinite; }
body.scene .cslot.busy .cs-top { display: flex; align-items: center; gap: 6px; background: #5BD27E; } body.scene .cslot.busy .cs-top span { margin: 0; } body.scene .cslot .cs-clock svg { width: 15px; height: 15px; }
body.scene .cslot.busy .cs-gems { position: absolute; z-index: 2; bottom: 48px; right: 2px; padding: 2px 8px; font-size: 13px; }
body.scene .cslot.start .cs-time { background: #8FC7FF; animation: bob2 1.2s ease-in-out infinite; }
body.scene .cslot.locked::after { display: none; }
body.scene .side { gap: 18px; } body.scene .side-btn { width: 80px; } body.scene .side-btn .ic { width: 64px; height: 64px; } body.scene .side-btn svg { width: 38px; height: 38px; }
body.scene .side-btn > span:not(.ic) { max-width: 92px; font-size: 13px; }
body.scene .dock .sbtn svg { width: 38px; height: 38px; } body.scene .dock .sbtn > span:last-of-type { font-size: 13px; }
body.scene .cslot.empty { border: 0; }
body.scene .cslot.empty small { font-size: 14px; background: rgba(242, 221, 176, 0.35); color: rgba(255, 255, 255, 0.85); border-style: dashed; box-shadow: none; }
body.scene .cslot .ghost { display: block; opacity: 0.3; filter: brightness(0); }
body.scene .cslot .ghost .chest-svg { filter: none; }

body.scene .l-side { position: fixed; right: 28px; top: 100px; width: var(--side); z-index: 5; display: flex; flex-direction: column; gap: 12px; }
.l-modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.lm-card { position: relative; min-height: 124px; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 6px; border-radius: 16px;
  background: var(--grain), var(--panel); border: 3px solid var(--stroke); box-shadow: inset 0 2px 0 var(--hi), 0 5px 0 var(--stroke); color: var(--text); cursor: pointer; }
.lm-card > :first-child { margin-bottom: auto; }
.lm-card b { font: 400 16px var(--display); text-transform: uppercase; }
.lm-card small { font-size: 12px; line-height: 1.2; font-weight: 800; color: var(--muted); }
.lm-card.on { border-color: var(--gold); box-shadow: inset 0 2px 0 var(--hi), 0 5px 0 var(--stroke), 0 0 0 3px var(--gold); }
.lm-card.m-boss { background: #3A1A24; } .lm-card.m-survival { background: #1F3A2A; } .lm-card.m-boss small { color: var(--gold); }
.lm-card:active { transform: translateY(3px); }
.lm-pic { border-radius: 8px; border: 2px solid var(--stroke); }
.lm-balls { display: flex; } .lm-balls canvas + canvas { margin-left: -18px; }
.lm-ic { display: grid; place-items: center; height: 62px; } .lm-ic svg { width: 54px; height: 54px; }
body.scene .l-road { position: fixed; left: 28px; bottom: 28px; z-index: 5; display: flex; width: calc(var(--side) + 20px);
  padding: 8px 14px; border-radius: 14px; background: rgba(10, 14, 31, 0.6); border: 0; color: var(--text); cursor: pointer; text-align: left; }
body.scene .l-road[hidden] { display: none; }
.l-road .wroad { width: 100%; }
.l-road .wr-ic { width: 48px; height: 48px; }
@media (max-height: 820px) {
  .lm-card { min-height: 104px; } .lm-card canvas { height: 56px !important; width: auto !important; } body.scene #l-deal { display: none; }
  body.scene #l-slots { top: 100px; } body.scene .cslot .chest-svg { width: min(124px, 100%); } body.scene .dock .sbtn { height: 72px; }
  body.scene .side-btn .ic { width: 54px; height: 54px; } body.scene .side { gap: 10px; }
}

/* the shelf's little things: a TOP SECRET file pinned to the back and a cobweb (behind the chests); a lamp you can switch,
   a spider that drops on its thread and a keychain that swings (#l-shelf, over the shelf); a tap on a chest startles them */
body.scene #l-slots::before { content: ''; position: absolute; inset: 17px 17px 0; pointer-events: none; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 84'%3E %3Cg fill='none' stroke='%23FFFFFF' stroke-opacity='0.4' stroke-width='1'%3E %3Cpath d='M64 0L4 0M64 0L14 28M64 0L36 50M64 0L64 60'/%3E %3Cpath d='M50 0Q52 8 58 10Q60 14 64 14'/%3E%3Cpath d='M34 0Q38 14 48 20Q52 28 64 30'/%3E%3Cpath d='M18 0Q24 22 40 32Q46 42 64 46'/%3E%3C/g%3E %3C/svg%3E") no-repeat 100% 0 / 50px auto; }
body.scene #l-slots::after { content: ''; position: absolute; z-index: 0; left: 50%; top: calc(50% + 12px); width: 110px; height: 85px; translate: -50% 0; pointer-events: none; opacity: 0.3; filter: brightness(0.7) sepia(0.4);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 124 96'%3E %3Cg transform='rotate(-4 62 48)'%3E %3Crect x='8' y='10' width='108' height='78' rx='3' fill='%23F3E6C4' stroke='%230A0E1F' stroke-width='2.5'/%3E %3Crect x='8' y='10' width='108' height='14' fill='%23E2CFA0'/%3E %3Ctext x='16' y='21' font-family='Courier New, monospace' font-weight='700' font-size='8' fill='%235A4428'%3EFILE No. 007-BB%3C/text%3E %3Crect x='16' y='31' width='62' height='5' fill='%231A1A1A'/%3E%3Crect x='16' y='41' width='86' height='5' fill='%231A1A1A'/%3E%3Crect x='16' y='51' width='40' height='5' fill='%231A1A1A'/%3E %3Ctext x='16' y='80' font-family='Courier New, monospace' font-weight='700' font-size='12' fill='%232A1C10'%3Enarrly.org%3C/text%3E %3Cg transform='rotate(-12 72 50)' opacity='0.9'%3E%3Crect x='28' y='39' width='88' height='22' rx='4' fill='%23F3E6C4' fill-opacity='0.6' stroke='%23D62839' stroke-width='2.6'/%3E %3Ctext x='72' y='54.5' text-anchor='middle' font-family='Arial Black, Impact, sans-serif' font-size='10.5' fill='%23D62839'%3ETOP SECRET%3C/text%3E%3C/g%3E %3Crect x='-2' y='4' width='26' height='10' fill='%23FFFFFF' opacity='0.55' transform='rotate(-30 11 9)'/%3E %3Crect x='100' y='4' width='26' height='10' fill='%23FFFFFF' opacity='0.55' transform='rotate(28 113 9)'/%3E %3C/g%3E%3C/svg%3E") no-repeat center / contain; } /* on the lower back wall, between the two chests */
body.scene #l-slots.dark { filter: brightness(0.62) saturate(0.85); }
.shelf-deco { display: none; }
body.scene .shelf-deco { position: fixed; left: 28px; top: 108px; bottom: 124px; width: calc(var(--side) + 20px); z-index: 6; display: block; pointer-events: none; }
.shelf-deco > * { position: absolute; pointer-events: auto; cursor: pointer; }
.sd-light { pointer-events: none !important; left: calc(50% - 170px); top: 50px; width: 340px; height: calc(50% - 40px); mix-blend-mode: screen; filter: blur(2px); animation: flicker 9s linear infinite; }
.sd-light::before, .sd-light::after { content: ''; position: absolute; inset: 0; clip-path: polygon(45% 0, 55% 0, 98% 100%, 2% 100%); } /* a cone from the shade down to the middle plank */
.sd-light::before { background: radial-gradient(ellipse 46% 14% at 50% 100%, rgba(255, 222, 150, 0.5), transparent 100%), linear-gradient(rgba(255, 226, 160, 0.6), rgba(255, 214, 140, 0.24) 55%, rgba(255, 214, 140, 0.12)); }
.sd-light::after { background-image: radial-gradient(circle, rgba(255, 240, 200, 0.9) 0 1px, transparent 2px), radial-gradient(circle, rgba(255, 240, 200, 0.7) 0 1px, transparent 2px);
  background-size: 37px 41px, 53px 47px; background-position: 0 0, 19px 23px; animation: dust 9s linear infinite; } /* dust floating in the beam */
@keyframes dust { to { background-position: 0 -82px, 19px -71px; } }
.sd-lamp { left: calc(50% - 22px); top: 21px; width: 44px; height: 40px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 44 40'%3E %3Cline x1='22' y1='0' x2='22' y2='12' stroke='%230A0E1F' stroke-width='2'/%3E %3Ccircle cx='22' cy='31' r='6.5' fill='%23FFE7A3' stroke='%230A0E1F' stroke-width='1.5'/%3E %3Cpath d='M14 12h16l9 18H5z' fill='%232E7D5B' stroke='%230A0E1F' stroke-width='2.2' stroke-linejoin='round'/%3E %3Cpath d='M16 15h7' stroke='%23FFFFFF' stroke-opacity='0.45' stroke-width='2' stroke-linecap='round'/%3E %3C/svg%3E") no-repeat center / contain; transform-origin: 50% 0; animation: lampSway 5s ease-in-out infinite; }
.shelf-deco.dark .sd-light { opacity: 0; animation: none; }
.shelf-deco.dark .sd-lamp { filter: brightness(0.55) saturate(0.6); }
@keyframes flicker { 0%, 88%, 90%, 93%, 100% { opacity: 1; } 89% { opacity: 0.3; } 91.5% { opacity: 0.55; } }
@keyframes lampSway { 0%, 100% { rotate: -2deg; } 50% { rotate: 2deg; } }
.sd-spider { right: 23px; top: 40px; width: 28px; height: 0; }
.sd-spider::before { content: ''; position: absolute; left: 13.5px; top: 0; width: 1px; height: 16px; background: rgba(255, 255, 255, 0.55); animation: thread 12s ease-in-out infinite; }
.sd-spider svg { position: absolute; left: 0; top: 12px; width: 28px; height: 26px; animation: dangle 12s ease-in-out infinite; }
.sd-spider .ll, .sd-spider .lr { transform-box: fill-box; animation: leg 0.4s ease-in-out infinite alternate; }
.sd-spider .ll { transform-origin: 100% 50%; } .sd-spider .lr { transform-origin: 0 50%; animation-direction: alternate-reverse; }
.sd-spider.go::before { animation: threadDrop 2s cubic-bezier(0.3, 1.2, 0.5, 1); }
.sd-spider.go svg { animation: spiderDrop 2s cubic-bezier(0.3, 1.2, 0.5, 1); }
.sd-spider.go .ll, .sd-spider.go .lr { animation-duration: 0.12s; }
@keyframes thread { 0%, 55%, 100% { height: 16px; } 64%, 76% { height: 70px; } }
@keyframes dangle { 0%, 55%, 100% { top: 12px; } 64%, 76% { top: 66px; } }
@keyframes threadDrop { 0% { height: 16px; } 22% { height: 160px; } 32% { height: 138px; } 42% { height: 150px; } 60% { height: 150px; } 100% { height: 16px; } }
@keyframes spiderDrop { 0% { top: 12px; } 22% { top: 156px; } 32% { top: 134px; } 42% { top: 146px; } 60% { top: 146px; } 100% { top: 12px; } }
@keyframes leg { from { rotate: -9deg; } to { rotate: 9deg; } }
.sd-keys { left: -12px; top: 26px; width: 48px; height: 108px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 66'%3E %3Ccircle cx='24' cy='5' r='3.5' fill='%239AA3B5' stroke='%230A0E1F' stroke-width='1.5'/%3E %3Crect x='17.5' y='6' width='13' height='23' rx='6.5' fill='none' stroke='%230A0E1F' stroke-width='5.5'/%3E %3Crect x='17.5' y='6' width='13' height='23' rx='6.5' fill='none' stroke='%23E3E9F2' stroke-width='2.8'/%3E %3Cpath d='M30 12l-3.5 10' stroke='%230A0E1F' stroke-width='1.6'/%3E %3Cg fill='none' stroke='%230A0E1F' stroke-width='4.2'%3E%3Cellipse cx='24' cy='34' rx='2.8' ry='4.2'/%3E%3Cellipse cx='24' cy='42' rx='1.4' ry='4.2'/%3E%3C/g%3E %3Cg fill='none' stroke='%23E3E9F2' stroke-width='2'%3E%3Cellipse cx='24' cy='34' rx='2.8' ry='4.2'/%3E%3Cellipse cx='24' cy='42' rx='1.4' ry='4.2'/%3E%3C/g%3E %3Ccircle cx='24' cy='53' r='6.5' fill='none' stroke='%230A0E1F' stroke-width='5.5'/%3E%3Ccircle cx='24' cy='53' r='6.5' fill='none' stroke='%23F2C12E' stroke-width='3'/%3E %3Cpath d='M29 57l5 3' stroke='%230A0E1F' stroke-width='1.6'/%3E %3Cpath d='M38 57.5l1.5 3.2 3.5.4-2.6 2.4.7 3.4-3.1-1.7-3.1 1.7.7-3.4-2.6-2.4 3.5-.4z' fill='%23FFCC33' stroke='%230A0E1F' stroke-width='1.4' stroke-linejoin='round'/%3E %3C/svg%3E") no-repeat top / 48px 66px; transform-origin: 50% 4px; animation: keys 3.6s ease-in-out infinite; }
.sd-keys.go { animation: jingle 1.6s ease-out; }
.sd-keys canvas { position: absolute; left: -5px; top: 54px; width: 58px !important; height: 58px !important; filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.4)); }
@keyframes keys { 0%, 100% { rotate: -7deg; } 50% { rotate: 7deg; } }
@keyframes jingle { 0% { rotate: 0deg; } 12% { rotate: 30deg; } 28% { rotate: -24deg; } 44% { rotate: 16deg; } 60% { rotate: -10deg; } 76% { rotate: 5deg; } 100% { rotate: 0deg; } }
body.scene .cslot.ready .chest-svg { animation: wiggle 1.8s ease-in-out infinite; }
@media (max-height: 820px) {
  body.scene #l-slots::before { background-size: 40px auto; } body.scene #l-slots::after { width: 84px; height: 65px; }
  .sd-spider { right: 19px; top: 36px; } .sd-keys { scale: 0.85; }
}
@media (prefers-reduced-motion: reduce) { .sd-keys, .sd-lamp, .sd-light, .sd-light::after, .sd-spider::before, .sd-spider svg, .sd-spider .ll, .sd-spider .lr { animation: none !important; } }

/* ---------- phones too: the chests stand on a wooden plank, a tag with the time above each (big screens override in body.scene) ---------- */
body:not(.scene) .slots .cslot { height: 98px; padding: 0 0 18px; justify-content: flex-end; gap: 3px; background: none; border: 0; box-shadow: none; }
body:not(.scene) .slots .cslot::before { content: ''; position: absolute; left: -4px; right: -4px; bottom: 0; height: 26px; border-radius: 3px; border: 2.5px solid var(--stroke);
  background: radial-gradient(ellipse 34% 34% at 52% 30%, rgba(20, 8, 0, 0.6), transparent 100%), repeating-linear-gradient(90deg, transparent 0 30px, rgba(60, 30, 8, 0.45) 30px 32px),
    linear-gradient(#B97F48, #E3AC6E 50%, #9A6230 50% 100%);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.3), 0 5px 8px rgba(0, 0, 0, 0.4); }
body:not(.scene) .slots .cslot .chest-3d { position: relative; z-index: 1; width: 80px; margin: 0 0 -16px; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.45)); }
body:not(.scene) .slots .cslot .cs-top, body:not(.scene) .slots .cslot .cs-time, body:not(.scene) .slots .cslot .cs-big, body:not(.scene) .slots .cslot.empty small { order: -1; z-index: 2; padding: 2px 7px; border-radius: 8px;
  border: 2px solid var(--stroke); background: #F2DDB0; color: #3A2200; font-family: var(--display); font-weight: 400; text-shadow: none; box-shadow: 0 2px 0 var(--stroke); }
body:not(.scene) .slots .cslot.ready .cs-top, body:not(.scene) .slots .cslot .cs-now, body:not(.scene) .slots .cslot.start .cs-top, body:not(.scene) .slots .cslot .sl-plus { display: none; }
body:not(.scene) .slots .cslot.ready .cs-big { background: var(--gold); font-size: 12px; animation: bob2 1.2s ease-in-out infinite; }
body:not(.scene) .slots .cslot.ready .chest-3d { animation: wiggle 1.8s ease-in-out infinite; }
body:not(.scene) .slots .cslot.busy .cs-top { display: flex; align-items: center; gap: 4px; background: #5BD27E; color: #06301A; } body:not(.scene) .slots .cslot .cs-clock svg { width: 12px; height: 12px; }
body:not(.scene) .slots .cslot.busy .cs-gems { position: absolute; z-index: 2; right: -2px; bottom: 28px; padding: 1px 6px; font-size: 11px; }
body:not(.scene) .slots .cslot.start .cs-time { background: #8FC7FF; animation: bob2 1.2s ease-in-out infinite; }
body:not(.scene) .slots .cslot.locked::after { display: none; }
body:not(.scene) .slots .cslot.empty { border: 0; justify-content: flex-end; }
body:not(.scene) .slots .cslot.empty small { background: rgba(242, 221, 176, 0.35); color: rgba(255, 255, 255, 0.85); border-style: dashed; box-shadow: none; }
body:not(.scene) .slots .cslot .ghost { display: block; opacity: 0.3; filter: brightness(0); } body:not(.scene) .slots .cslot .ghost .chest-3d { filter: none; }

/* the day's deal on a big screen: one compact row (the item, its name, the price), so it never runs into Play */
body.scene .l-side { bottom: 176px; container-type: size; } /* it ends above Play; too short for the deal: the deal goes */
@container (max-height: 548px) { #l-deal { display: none; } }
body.scene #l-deal .wcard { gap: 8px; padding: 10px 14px 12px; }
body.scene #l-deal .wdeal { display: grid; grid-template-columns: 74px 1fr; grid-template-rows: 1fr auto; column-gap: 14px; row-gap: 6px; align-items: center; padding: 0; text-align: left; }
body.scene #l-deal .wdeal > :is(canvas, .deco-prev, .banner-prev) { grid-row: 1 / 3; width: 74px !important; height: 74px !important; border-radius: 12px; object-fit: contain;
  background: radial-gradient(circle at 50% 40%, rgba(255, 214, 140, 0.28), rgba(0, 0, 0, 0.25) 70%); border: 2px solid var(--stroke); }
body.scene #l-deal .wdeal b { align-self: end; font-size: 15px; line-height: 1.2; }
body.scene #l-deal .wdeal .sh-price { justify-self: start; align-self: start; font-size: 15px; padding: 4px 12px; }
body.scene #l-deal .wdeal .sh-off { top: -6px; left: 50px; right: auto; z-index: 1; border: 2px solid var(--stroke); }


/* the 3D commanders (heroes.js): pictures with the drawings' 140:160 shape; the living one is its body with the head on top */
.hero3d { aspect-ratio: 140 / 160; object-fit: contain; }
span.hero3d { position: relative; }
.hero-live.hero3d .h-all { position: absolute; inset: 0; display: block; transform-origin: 50% 99%; }
span.hero3d img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.hero-live.hero3d .h-head { transform-origin: 50% 62%; }
