/* Eriband Arena — UI theme (Copper, the default; styles/themes.css has the others).
   Dark warm backgrounds, copper pixel frames (generated at startup as
   border images: --frame-*), teal accents, red primary buttons.
   Fonts: Press Start 2P (titles), Pixelify Sans (text), Micro 5 (numbers). */

@font-face { font-family: 'Press Start 2P'; src: url('../assets/fonts/press-start-2p.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Pixelify Sans'; src: url('../assets/fonts/pixelify-sans-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Pixelify Sans'; src: url('../assets/fonts/pixelify-sans-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Micro 5'; src: url('../assets/fonts/micro-5.woff2') format('woff2'); font-display: swap; }

:root {
  --bg: #120e16;
  --bg-2: #1a141f;
  --panel: #231c29;
  --panel-2: #2c2433;
  --panel-3: #362c3e;
  --inset: #17121b;
  --line: #4b3a3c;
  --copper: #c8692e;
  --copper-hi: #f0a14a;
  --copper-dk: #7a3a1c;
  --teal: #3fe0b8;
  --teal-hi: #8ff5dc;
  --teal-dk: #1d8a72;
  --text: #ece3d6;
  --text-2: #c7b9a8;
  --muted: #8d7f72;
  --red: #b3262c;
  --red-hi: #e0484d;
  --red-dk: #6e1418;
  --gold: #f5c542;
  --good: #5fd068;
  --bad: #e5484d;
  --blue: #3b82f6;
  --blue-hi: #8cc0ff;
  --team-red: #e5484d;
  --team-red-hi: #ff9a9a;
  --rarity-common: #b8b0a4;
  --rarity-rare: #4f9dff;
  --rarity-epic: #b56cff;
  --rarity-legendary: #f5a623;
  --ui-scale: 1;
  --font-title: 'Press Start 2P', monospace;
  --font-text: 'Pixelify Sans', 'Trebuchet MS', sans-serif;
  --font-num: 'Micro 5', 'Pixelify Sans', monospace;
  /* the frames of the chosen theme (render/frames.js draws them all; styles/themes.css picks) */
  --frame-panel: var(--fr-copper-panel, none);
  --frame-button: var(--fr-copper-button, none);
  --frame-button-red: var(--fr-copper-button-red, none);
  --frame-tab: var(--fr-copper-tab, none);
  --frame-inset: var(--fr-copper-inset, none);
  --frame-card: var(--fr-copper-card, none);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --gap: 12px;
  --radius: 0px;
  --fs-xs: calc(12px * var(--ui-scale));
  --fs-s: calc(14px * var(--ui-scale));
  --fs-m: calc(17px * var(--ui-scale));
  --fs-l: calc(21px * var(--ui-scale));
  --fs-xl: calc(28px * var(--ui-scale));
  --fs-title: calc(clamp(18px, 3.4vw, 34px) * var(--ui-scale));
}

/* Colour-blind friendly: Red turns orange */
:root.cb {
  --team-red: #f08a2b;
  --team-red-hi: #ffc58a;
  --red: #b5651d;
  --red-hi: #f08a2b;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-text);
  font-size: var(--fs-m);
  line-height: 1.3;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  overscroll-behavior: none;
}

body { position: fixed; inset: 0; }

input, textarea, [contenteditable] { -webkit-user-select: text; user-select: text; }

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  z-index: 0;
}

#app {
  position: fixed;
  inset: 0;
  z-index: 1;
  padding: var(--safe-t) var(--safe-r) var(--safe-b) var(--safe-l);
  overflow: hidden;
}

#layer-modal { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
#layer-modal > * { pointer-events: auto; }

/* ------------------------------------------------------------------ boot */

#boot {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: radial-gradient(ellipse at center, #2a1a14 0%, var(--bg) 70%);
  transition: opacity 0.4s;
}
#boot.gone { opacity: 0; pointer-events: none; }
.boot-title { font-family: var(--font-title); font-size: clamp(28px, 7vw, 64px); color: var(--copper-hi); text-shadow: 0 4px 0 var(--copper-dk), 0 0 24px rgba(240, 161, 74, 0.35); letter-spacing: 2px; }
.boot-sub { font-family: var(--font-title); font-size: clamp(12px, 2.4vw, 20px); color: var(--teal); letter-spacing: 8px; }
.boot-bar { width: min(260px, 60vw); height: 10px; background: var(--inset); border: 2px solid var(--copper-dk); }
.boot-bar i { display: block; height: 100%; width: 0; background: var(--teal); transition: width 0.2s; }
.noscript { position: fixed; inset: 0; display: grid; place-items: center; color: var(--text); }

/* ------------------------------------------------------------- screens */

.screen {
  position: absolute;
  inset: var(--safe-t) var(--safe-r) var(--safe-b) var(--safe-l);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: screen-in 0.22s ease-out;
}
.screen.scroll { overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
@keyframes screen-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.screen-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  min-height: 56px;
}
.screen-head .grow { flex: 1; }
.screen-body { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 6px 14px 18px; -webkit-overflow-scrolling: touch; }
.screen-foot { display: flex; gap: 10px; justify-content: center; padding: 10px 14px 14px; flex-wrap: wrap; }

.vignette::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
  z-index: -1;
}

/* ---------------------------------------------------------- typography */

.title {
  font-family: var(--font-title);
  font-size: var(--fs-title);
  color: var(--text);
  letter-spacing: 1px;
  text-shadow: 0 3px 0 #000, 0 0 18px rgba(0, 0, 0, 0.6);
  margin: 0;
  line-height: 1.25;
}
.title.teal { color: var(--teal); text-shadow: 0 3px 0 var(--teal-dk), 0 0 16px rgba(63, 224, 184, 0.3); }
.title.copper { color: var(--copper-hi); text-shadow: 0 3px 0 var(--copper-dk); }
.h2 { font-family: var(--font-title); font-size: calc(13px * var(--ui-scale)); color: var(--teal); letter-spacing: 1px; margin: 0 0 8px; }
.h3 { font-weight: 700; font-size: var(--fs-m); margin: 0 0 6px; color: var(--text); }
.num { font-family: var(--font-num); font-size: 1.35em; line-height: 0.9; letter-spacing: 0.5px; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-s); }
.xs { font-size: var(--fs-xs); }
.good { color: var(--good); }
.bad { color: var(--bad); }
.gold { color: var(--gold); }
.teal { color: var(--teal); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.rarity-common { color: var(--rarity-common); }
.rarity-rare { color: var(--rarity-rare); }
.rarity-epic { color: var(--rarity-epic); }
.rarity-legendary { color: var(--rarity-legendary); }
.rarity-normal { color: var(--rarity-common); }

/* -------------------------------------------------------------- layout */

.row { display: flex; align-items: center; gap: var(--gap); }
.row.wrap { flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.row.between { justify-content: space-between; }
.row.center { justify-content: center; }
.col { display: flex; flex-direction: column; gap: var(--gap); }
.grow { flex: 1; min-width: 0; }
.gap-s { gap: 6px; }
.gap-l { gap: 20px; }
.grid { display: grid; gap: var(--gap); }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(calc(118px * var(--ui-scale)), 1fr)); }
.grid.wide { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.spacer { flex: 1; }
.hidden { display: none !important; }
.mt { margin-top: var(--gap); }
.mb { margin-bottom: var(--gap); }
.max { max-width: 1100px; margin-left: auto; margin-right: auto; width: 100%; }
.max-s { max-width: 640px; margin-left: auto; margin-right: auto; width: 100%; }
.max-m { max-width: 860px; margin-left: auto; margin-right: auto; width: 100%; }

/* --------------------------------------------------------------- panels */

.panel {
  position: relative;
  background: var(--panel);
  border: 12px solid var(--copper-dk);
  border-image: var(--frame-panel) 12 fill / 12px / 0 stretch;
  padding: 10px 12px;
  image-rendering: pixelated;
  box-shadow: var(--panel-shadow, none);
}
.panel.dark { background: var(--bg-2); }
.panel.flat { border-width: 2px; border-image: none; border-color: var(--line); background: var(--panel-2); }
.panel.inset {
  background: var(--inset);
  border: 6px solid #0c090e;
  border-image: var(--frame-inset) 6 fill / 6px / 0 stretch;
}
.panel > .tab {
  position: absolute;
  top: -26px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 20px 5px;
  white-space: nowrap;
  font-weight: 700;
  font-size: var(--fs-s);
  color: var(--text);
  background: var(--panel-2);
  border: 9px solid var(--copper-dk);
  border-image: var(--frame-tab) 9 fill / 9px / 0 stretch;
  z-index: 1;
}
.panel.has-tab { margin-top: 22px; padding-top: 18px; }

.section { margin: 18px 0 8px; }
.divider { height: 2px; background: linear-gradient(90deg, transparent, var(--copper-dk), transparent); margin: 10px 0; border: 0; }

/* -------------------------------------------------------------- buttons */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  min-width: 44px;
  padding: 6px 18px;
  font-family: var(--font-button, var(--font-text));
  font-weight: 700;
  font-size: var(--fs-m);
  letter-spacing: var(--button-spacing, normal);
  color: var(--text);
  background: var(--panel-2);
  border: 9px solid var(--copper-dk);
  border-image: var(--frame-button) 9 fill / 9px / 0 stretch;
  cursor: pointer;
  image-rendering: pixelated;
  outline: none;
  box-shadow: var(--button-shadow, none);
  text-shadow: var(--button-text-shadow, 0 2px 0 rgba(0, 0, 0, 0.6));
  transition: transform 0.06s, filter 0.12s;
  -webkit-appearance: none;
  appearance: none;
}
.btn > * { pointer-events: none; }
.btn:hover:not(:disabled) { filter: brightness(1.18); }
.btn:active:not(:disabled), .btn.pressed { transform: translateY(2px); filter: brightness(0.92); }
.btn:disabled, .btn.disabled { filter: grayscale(0.7) brightness(0.6); cursor: not-allowed; }
.btn.primary { border-image-source: var(--frame-button-red); color: var(--primary-text, #ffe9d6); text-shadow: var(--primary-text-shadow, 0 2px 0 rgba(0, 0, 0, 0.6)); }
.btn.teal { color: var(--teal-hi); }
.btn.small { min-height: 34px; padding: 2px 10px; font-size: var(--fs-s); }
.btn.big { min-height: 58px; padding: 8px 28px; font-size: var(--fs-l); }
.btn.block { width: 100%; }
.btn.icon { padding: 4px; min-width: 44px; }
.btn.icon.small { min-width: 34px; }
.btn img, .btn canvas { image-rendering: pixelated; }
.btn .kbd { margin-left: 4px; }
.btn.active { color: var(--teal); filter: brightness(1.2); }
.btn.selected { box-shadow: 0 0 0 2px var(--teal), 0 0 14px rgba(63, 224, 184, 0.45); }
/* the admin panel's preview is on in this browser */
.tuning-badge { position: fixed; left: 50%; bottom: 6px; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 8px; padding: 4px 8px; background: #3a1d08; border: 2px solid var(--gold); color: var(--gold); box-shadow: 0 2px 0 #000; }
/* a mode the admin panel closed: shown, not enterable (ui/modes.js) */
.btn.mode-closed { opacity: 0.45; filter: grayscale(0.6); }
/* the background chooser (menu > castle button, Settings > Display) */
.bg-choice { flex-direction: column; align-items: center; gap: 4px; padding: 8px; max-width: min(280px, 80vw); height: auto; white-space: normal; text-align: center; }
.bg-choice .bg-preview { width: min(256px, 72vw); aspect-ratio: 16 / 9; height: auto; image-rendering: pixelated; border: 2px solid #000; }

/* A focus ring for keyboard and controller only */
.nav-visible :focus-visible, .nav-visible .focused {
  outline: 3px solid var(--teal);
  outline-offset: 3px;
  box-shadow: 0 0 16px rgba(63, 224, 184, 0.55);
  z-index: 2;
}
:focus { outline: none; }

.link { color: var(--teal); background: none; border: none; font: inherit; cursor: pointer; padding: 0; text-decoration: underline; }

/* Key and button hints */
.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  font-family: var(--font-num);
  font-size: 18px;
  line-height: 1;
  color: var(--text);
  background: #0d0a10;
  border: 1px solid var(--line);
  border-bottom-width: 3px;
}
.kbd.pad { border-radius: 50%; min-width: 22px; height: 22px; padding: 0; border-bottom-width: 1px; }
.kbd.pad.a { background: #1f6f3f; } .kbd.pad.b { background: #8a1f22; } .kbd.pad.x { background: #1e4fa8; } .kbd.pad.y { background: #a8861e; }
.touch .kbd { display: none; }

/* ---------------------------------------------------------------- tabs */

.tabs { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.tabs .btn { min-height: 38px; font-size: var(--fs-s); padding: 2px 12px; }
.tabs .btn.on { color: var(--teal); filter: brightness(1.25); }
.tabs .btn.on::after { content: ''; position: absolute; left: 6px; right: 6px; bottom: -6px; height: 3px; background: var(--teal); }

/* ------------------------------------------------------------ currencies */

.currencies { display: flex; gap: 8px; align-items: center; }
.cur {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px 2px 4px;
  background: rgba(10, 7, 12, 0.75);
  border: 2px solid var(--line);
  font-family: var(--font-num);
  font-size: 22px;
  line-height: 1;
  min-height: 30px;
}
.cur img { width: 20px; height: 20px; image-rendering: pixelated; }
.icon-img { image-rendering: pixelated; vertical-align: middle; }

/* ------------------------------------------------------------- cards */

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 6px 8px;
  background: var(--panel-2);
  border: 9px solid var(--copper-dk);
  border-image: var(--frame-card) 9 fill / 9px / 0 stretch;
  cursor: pointer;
  text-align: center;
  color: var(--text);
  font: inherit;
  min-width: 0;
  image-rendering: pixelated;
}
.card:hover { filter: brightness(1.15); }
.card .portrait { width: 64px; height: 64px; image-rendering: pixelated; }
.card .name { font-weight: 700; font-size: var(--fs-s); max-width: 100%; }
.card .sub { font-size: var(--fs-xs); color: var(--muted); }
.card.locked { filter: grayscale(1) brightness(0.55); }
.card.picked { box-shadow: 0 0 0 3px var(--blue), 0 0 12px rgba(59, 130, 246, 0.6); }
.card.picked.red { box-shadow: 0 0 0 3px var(--team-red), 0 0 12px rgba(229, 72, 77, 0.6); }
.card.banned::after {
  content: '';
  position: absolute;
  inset: 6px;
  background:
    linear-gradient(45deg, transparent 46%, var(--bad) 46%, var(--bad) 54%, transparent 54%),
    linear-gradient(-45deg, transparent 46%, var(--bad) 46%, var(--bad) 54%, transparent 54%);
  opacity: 0.85;
  pointer-events: none;
}
.card .badge-tl, .card .badge-tr { position: absolute; top: 2px; font-size: var(--fs-xs); }
.card .badge-tl { left: 4px; }
.card .badge-tr { right: 4px; }
.card.holo::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 20%, rgba(255, 120, 220, 0.25) 35%, rgba(120, 255, 240, 0.25) 50%, rgba(255, 245, 120, 0.25) 65%, transparent 80%);
  background-size: 250% 100%;
  animation: holo 3.5s linear infinite;
  mix-blend-mode: screen;
}
@keyframes holo { from { background-position: 100% 0; } to { background-position: -150% 0; } }

.tier { font-family: var(--font-title); font-size: 9px; color: var(--gold); text-shadow: 0 1px 0 #000; }
.stars { color: var(--gold); letter-spacing: -1px; font-size: var(--fs-xs); }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--line);
  font-size: var(--fs-xs);
  white-space: nowrap;
}
.chip.order { border-color: #d9b45a; color: #f3d58a; }
.chip.wild { border-color: #5fbf4a; color: #9be38a; }
.chip.arcane { border-color: #8a6bff; color: #c3b0ff; }
.chip.shadow { border-color: #8a4b9a; color: #d39be0; }

/* ---------------------------------------------------------------- bars */

.bar {
  position: relative;
  height: 12px;
  background: #0b080d;
  border: 2px solid #000;
  box-shadow: inset 0 0 0 1px var(--copper-dk);
  overflow: hidden;
}
.bar > i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--teal); transition: width 0.25s; }
.bar.hp > i { background: linear-gradient(180deg, #7ff07a, #3fae46); }
.bar.hp.low > i { background: linear-gradient(180deg, #ff8a7a, #c8342c); }
.bar.energy > i { background: linear-gradient(180deg, #ffe066, #e0a020); }
.bar.xp > i { background: linear-gradient(180deg, var(--teal-hi), var(--teal-dk)); }
.bar > b { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-num); font-size: 16px; line-height: 1; color: #fff; text-shadow: 0 1px 0 #000; font-weight: normal; }
.cb .bar.hp.low > i { background: repeating-linear-gradient(45deg, #c8342c 0 4px, #8a1f22 4px 8px); }

/* --------------------------------------------------------------- modal */

.modal-back {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(12px, var(--safe-t)) max(12px, var(--safe-r)) max(12px, var(--safe-b)) max(12px, var(--safe-l));
  background: rgba(5, 3, 7, 0.72);
  animation: fade-in 0.15s ease-out;
}
.modal {
  width: min(560px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  animation: pop-in 0.18s ease-out;
}
.modal.wide { width: min(900px, 100%); }
.modal .modal-body { overflow-y: auto; min-height: 0; padding: 4px 2px; }
.modal .modal-foot { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; padding-top: 12px; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: none; } }

/* -------------------------------------------------------------- toasts */

#toasts {
  position: fixed;
  z-index: 40;
  left: 50%;
  top: calc(var(--safe-t) + 10px);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  width: min(92vw, 480px);
}
.toast {
  padding: 8px 16px;
  background: var(--panel);
  border: 9px solid var(--copper-dk);
  border-image: var(--frame-tab) 9 fill / 9px / 0 stretch;
  font-size: var(--fs-s);
  text-align: center;
  animation: toast 3s ease forwards;
}
.toast.good { color: var(--good); }
.toast.bad { color: var(--bad); }
@keyframes toast { 0% { opacity: 0; transform: translateY(-8px); } 8% { opacity: 1; transform: none; } 85% { opacity: 1; } 100% { opacity: 0; } }

/* ------------------------------------------------------------- tooltip */

#tooltip {
  position: fixed;
  z-index: 45;
  max-width: min(340px, 90vw);
  padding: 8px 10px;
  background: rgba(20, 15, 24, 0.97);
  border: 8px solid var(--copper-dk);
  border-image: var(--frame-panel) 12 fill / 8px / 0 stretch;
  font-size: var(--fs-s);
  pointer-events: none;
}
#tooltip .tt-title { font-weight: 700; color: var(--teal); margin-bottom: 2px; }

/* --------------------------------------------------------------- forms */

.input {
  width: 100%;
  min-height: 42px;
  padding: 6px 10px;
  font: inherit;
  color: var(--text);
  background: var(--inset);
  border: 2px solid var(--line);
  outline: none;
}
.input:focus { border-color: var(--teal); }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 4px 0; cursor: pointer; }
.switch { position: relative; width: 46px; height: 24px; background: var(--inset); border: 2px solid var(--line); flex: none; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; background: var(--muted); transition: left 0.12s, background 0.12s; }
.switch.on { border-color: var(--teal-dk); }
.switch.on::after { left: 24px; background: var(--teal); }
input[type='range'] { width: 100%; accent-color: var(--teal); min-height: 28px; }
select.input { -webkit-appearance: none; appearance: none; }

/* ------------------------------------------------------------- lists */

.list { display: flex; flex-direction: column; gap: 6px; }
.list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--panel-2);
  border: 2px solid var(--line);
  min-height: 48px;
  color: var(--text);
  font: inherit;
  text-align: left;
  width: 100%;
}
button.list-item { cursor: pointer; }
button.list-item:hover { border-color: var(--copper); }
.list-item.done { opacity: 0.6; }

/* ------------------------------------------------------- menu (title) */

.menu-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 12px; min-height: 0; }
.menu-logo { text-align: center; }
.menu-logo .t1 { font-family: var(--font-title); font-size: clamp(30px, 7.2vw, 72px); color: var(--copper-hi); text-shadow: 0 5px 0 var(--copper-dk), 0 8px 0 #000, 0 0 40px rgba(240, 140, 60, 0.35); letter-spacing: 3px; }
.menu-logo .t2 { font-family: var(--font-title); font-size: clamp(11px, 2.2vw, 20px); color: var(--teal); letter-spacing: 10px; margin-top: 8px; }
.menu-buttons { display: grid; grid-template-columns: repeat(2, minmax(150px, 230px)); gap: 10px; }
.menu-buttons .btn { width: 100%; }
.menu-buttons .btn.wide { grid-column: span 2; }
.menu-corner { position: absolute; display: flex; gap: 8px; align-items: center; }
.menu-corner.tl { top: 10px; left: 12px; }
.menu-corner.tr { top: 10px; right: 12px; }
.menu-corner.bl { bottom: 10px; left: 12px; }
.menu-corner.br { bottom: 10px; right: 12px; }
/* phones: the online box shrinks to one line beside the version row */
@media (max-width: 700px) {
  .menu-corner.br { max-width: calc(100vw - 210px); }
  .menu-corner.br .online-box { min-width: 0; max-width: 100%; padding: 4px 8px; }
  .menu-corner.br .online-box .h2 { display: none; }
  .menu-corner.br .online-box > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
  /* the top row: currencies and the icon buttons, tighter, wrapping rather than running off the screen */
  .menu-corner.tr { left: 8px; right: 8px; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
  .menu-corner.tr .currencies { gap: 4px; }
  .menu-corner.tr .cur { padding: 2px 6px 2px 3px; }
  .menu-corner.tr .btn.icon { min-width: 40px; min-height: 40px; }
}
.version { font-family: var(--font-num); font-size: 18px; color: var(--muted); }
.online-box { min-width: 160px; font-size: var(--fs-s); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 6px currentColor; vertical-align: middle; }
.dot.on { background: var(--good); color: var(--good); }
.dot.off { background: var(--bad); color: var(--bad); }
.red-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; background: var(--bad); color: #fff; font-family: var(--font-num); font-size: 16px; line-height: 1; position: absolute; top: -8px; right: -8px; }

/* ------------------------------------------------------- playercard */

.playercard { position: relative; width: 100%; max-width: 520px; aspect-ratio: 4 / 1; image-rendering: pixelated; overflow: hidden; border: 3px solid #000; box-shadow: 0 0 0 2px var(--copper-dk); }
.playercard canvas.card-bg { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
.playercard .pc-emblem { position: absolute; left: 2.5%; top: 10%; height: 80%; aspect-ratio: 1; image-rendering: pixelated; filter: drop-shadow(0 2px 0 #000); }
.playercard .pc-text { position: absolute; left: 25%; right: 14%; top: 14%; bottom: 14%; display: flex; flex-direction: column; justify-content: center; text-shadow: 0 2px 0 #000, 0 0 6px #000; }
.playercard .pc-name { font-family: var(--font-title); font-size: clamp(10px, 2.4vw, 17px); color: #fff; }
.playercard .pc-clan { color: var(--gold); margin-right: 6px; }
.playercard .pc-sub { font-size: var(--fs-s); color: var(--text-2); margin-top: 4px; }
.playercard .pc-rank { position: absolute; right: 2.5%; top: 12%; height: 76%; aspect-ratio: 1; image-rendering: pixelated; }

/* --------------------------------------------------------- battle HUD */

.battle { position: absolute; inset: 0; }
.battle .hud-top { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 6px 10px; pointer-events: none; }
.battle .hud-top > * { pointer-events: auto; }
.battle .turn-banner { text-align: center; }
.battle .turn-banner .t { font-family: var(--font-title); font-size: calc(11px * var(--ui-scale)); color: var(--text); text-shadow: 0 2px 0 #000; }
.battle .timer { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 64px; font-family: var(--font-num); font-size: 30px; line-height: 1; color: var(--text); text-shadow: 0 2px 0 #000; }
.battle .timer.idle { visibility: hidden; }
.battle .timer.low .timer-n { color: var(--bad); animation: blink 0.5s steps(2) infinite; }
/* the time left, draining live: green, then gold, then red; framed in the colour of the side whose turn it is */
.battle .timer-bar { width: 64px; height: 8px; background: #120d14; border: 2px solid var(--blue-hi); box-shadow: 0 2px 0 #000; overflow: hidden; }
.battle .timer.red .timer-bar { border-color: var(--team-red-hi); }
.battle .timer-bar i { display: block; height: 100%; width: 100%; background: var(--good); transition: width 0.1s linear, background-color 0.3s; }
.battle .timer[data-level='mid'] .timer-bar i { background: var(--gold); }
.battle .timer[data-level='low'] .timer-bar i { background: var(--bad); }
@keyframes blink { 50% { opacity: 0.4; } }
.cells { position: absolute; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); z-index: 2; }
.cell-btn { position: relative; background: transparent; border: none; padding: 0; margin: 0; cursor: pointer; outline: none; touch-action: none; }
.cell-btn:disabled { cursor: default; }
.nav-visible .cell-btn.focused, .nav-visible .cell-btn:focus-visible { outline: none; box-shadow: none; }
.roster { position: absolute; display: flex; flex-direction: column; gap: 6px; z-index: 3; }
.roster.left { left: 8px; }
.roster.right { right: 8px; }
.roster-hero {
  position: relative;
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 2px 6px;
  align-items: center;
  width: calc(170px * var(--ui-scale));
  padding: 4px 6px;
  background: rgba(20, 15, 24, 0.86);
  border: 2px solid var(--line);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.roster-hero canvas { width: 40px; height: 40px; image-rendering: pixelated; grid-row: span 3; }
.roster-hero .nm { font-size: var(--fs-xs); font-weight: 700; }
.roster-hero .bar { height: 8px; }
.roster-hero.dead { opacity: 0.35; filter: grayscale(1); }
.roster-hero.active { border-color: var(--teal); box-shadow: 0 0 10px rgba(63, 224, 184, 0.5); }
.roster-hero.blue { border-left: 4px solid var(--blue); }
.roster-hero.red { border-left: 4px solid var(--team-red); }
.roster-hero .st { position: absolute; top: 2px; right: 4px; font-size: 12px; }

.action-bar { position: absolute; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; z-index: 4; padding: 6px; flex-wrap: nowrap; }
.action-btn { flex-direction: column; min-width: calc(68px * var(--ui-scale)); min-height: 62px; padding: 4px 6px; font-size: var(--fs-xs); gap: 2px; }
.action-btn canvas, .action-btn img { width: 28px; height: 28px; image-rendering: pixelated; }
.action-btn .cd { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-num); font-size: 30px; background: rgba(0, 0, 0, 0.55); color: var(--text); }
.action-btn.ult.ready { animation: ult-glow 1s ease-in-out infinite alternate; color: var(--gold); }
@keyframes ult-glow { from { box-shadow: 0 0 4px rgba(245, 197, 66, 0.4); } to { box-shadow: 0 0 18px rgba(245, 197, 66, 0.9); } }
.action-btn .kbd { position: absolute; top: -10px; right: -8px; }

.hint-line { position: absolute; left: 50%; transform: translateX(-50%); text-align: center; font-size: var(--fs-s); color: var(--text-2); text-shadow: 0 2px 0 #000; z-index: 3; pointer-events: none; white-space: nowrap; }

.next-strip { display: flex; gap: 3px; align-items: center; }
/* Arena Rush (a prototype) */
.rush-grid { display: grid; grid-template-columns: 220px minmax(0, 1fr) 240px; gap: 12px; align-items: start; }
.rush-player { display: flex; flex-direction: column; gap: 3px; padding: 5px 7px; background: var(--panel-3); border: 2px solid #000; }
.rush-player.me { border-color: var(--teal); }
.rush-player.vs { box-shadow: inset 0 0 0 2px var(--red); }
.rush-player.out { opacity: 0.45; }
.rush-board { display: grid; grid-template-columns: repeat(3, 84px); gap: 4px; justify-content: center; padding: 6px; background: #4a3e48; border: 3px solid #1a1220; }
.rush-sq { display: grid; place-items: center; height: 84px; background: #7a6e78; border-top: 2px solid #8e8290; cursor: pointer; }
.rush-sq.dk { background: #6a5e6a; border-top-color: #7e7280; }
.rush-sq:hover { box-shadow: inset 0 0 0 2px var(--teal); }
.rush-unit { position: relative; display: grid; place-items: center; width: 60px; height: 60px; padding: 0; background: rgba(0, 0, 0, 0.25); border: 2px solid #000; cursor: pointer; }
.rush-unit canvas { width: 48px; height: 48px; image-rendering: pixelated; }
.rush-unit.sel { border-color: var(--teal); box-shadow: 0 0 10px rgba(63, 224, 184, 0.6); }
.rush-unit.t2 { border-color: var(--rarity-rare); }
.rush-unit.t3 { border-color: var(--gold); }
.rush-tier { position: absolute; left: 2px; top: 1px; font: 700 10px var(--font-text); color: var(--gold); text-shadow: 0 1px 0 #000; }
.rush-bench { display: flex; flex-wrap: wrap; gap: 4px; min-height: 64px; padding: 4px; background: var(--inset); border: 2px solid #000; cursor: pointer; }
.rush-slot { width: 60px; height: 60px; border: 2px dashed var(--line); }
.rush-shop { grid-column: 1 / -1; }
.rush-shop-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.rush-card { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 4px; color: var(--text); font: inherit; background: var(--panel-3); border: 2px solid #000; box-shadow: inset 0 0 0 2px var(--line); cursor: pointer; }
.rush-card.c2 { box-shadow: inset 0 0 0 2px var(--rarity-rare); }
.rush-card.c3 { box-shadow: inset 0 0 0 2px var(--rarity-epic); }
.rush-card canvas { width: 48px; height: 48px; image-rendering: pixelated; }
.rush-card:disabled { opacity: 0.5; cursor: default; }
.rush-card.empty { justify-content: center; color: var(--muted); }
.chip.faded { opacity: 0.55; }
.rush-rules { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
@media (max-width: 900px) {
  .rush-grid { grid-template-columns: 1fr; }
  .rush-board { grid-template-columns: repeat(3, 72px); }
  .rush-sq { height: 72px; }
  .rush-shop-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* maintenance mode (ui/maintenance.js): the screen over the game for players, a banner for admins */
.maint { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; padding: 16px; background: rgba(8, 6, 12, 0.92); }
.maint-box { width: min(460px, 100%); text-align: center; }
.maint-banner { position: fixed; left: 50%; top: calc(4px + var(--safe-t)); transform: translateX(-50%); z-index: 95; padding: 3px 10px; color: #fff1d8; background: #8a1f2a; border: 2px solid #000; pointer-events: none; }
/* screen transitions (ui/transition.js): the map's encounter and a fade through black */
.screen-fx { position: fixed; inset: 0; z-index: 90; pointer-events: none; }
.screen-fx.fade { background: #08060c; opacity: 0; transition: opacity 0.3s; }
.screen-fx.fade.on { opacity: 1; }
.screen-fx.flash { background: #fff1d8; opacity: 0; transition: opacity 0.08s; }
.screen-fx.flash.on { opacity: 0.85; }
.screen-fx.bars i { position: absolute; left: 0; width: 100%; height: 12.6%; background: #08060c; animation: fx-bar-l 0.36s steps(6, end) both; }
.screen-fx.bars i.r { animation-name: fx-bar-r; }
.screen-fx.bars.out { transition: opacity 0.35s; opacity: 0; }
@keyframes fx-bar-l { from { transform: translateX(-100%); } to { transform: none; } }
@keyframes fx-bar-r { from { transform: translateX(100%); } to { transform: none; } }
/* the story box on the map after a fight */
.ow-say { position: absolute; left: 50%; bottom: 44px; transform: translateX(-50%); width: min(720px, calc(100% - 24px)); display: flex; flex-direction: column; gap: 6px; padding: 12px 16px; }
.ow-say .camp-story { margin: 0; }
/* the story map */
.ow-wrap { position: relative; flex: 1; min-height: 0; margin: 0 10px 10px; border: 3px solid #000; box-shadow: inset 0 0 0 2px var(--copper-dk); overflow: hidden; }
.ow-canvas { display: block; image-rendering: pixelated; outline: none; touch-action: none; }
.ow-hint { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); padding: 4px 10px; color: var(--muted); background: rgba(16, 12, 22, 0.85); border: 2px solid #000; white-space: nowrap; pointer-events: none; }
.ow-stars { position: absolute; right: 10px; top: 8px; padding: 3px 8px; background: rgba(16, 12, 22, 0.85); border: 2px solid #000; pointer-events: none; }
@media (max-width: 700px) { .ow-hint { white-space: normal; width: 92%; text-align: center; } }
/* the campaign: chapters, each a path of fights */
.camp-chapter.locked { opacity: 0.6; }
.camp-story { font-style: italic; color: var(--text); }
.camp-path { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; padding: 6px 0; }
.camp-link { flex: 0 0 22px; height: 4px; background: var(--line); }
.camp-link.on { background: var(--copper); }
.camp-node { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; width: 112px; padding: 8px 4px 6px; color: var(--text); font: inherit; background: var(--panel-3); border: 2px solid #000; box-shadow: inset 0 0 0 2px var(--copper-dk); cursor: pointer; }
.camp-node:hover:not([disabled]), .camp-node:focus-visible { box-shadow: inset 0 0 0 2px var(--teal); outline: none; }
.camp-node.next { box-shadow: inset 0 0 0 2px var(--teal), 0 0 10px rgba(63, 224, 184, 0.45); }
.camp-node.boss { background: linear-gradient(rgba(138, 31, 42, 0.35), var(--panel-3)); }
.camp-node.locked { cursor: default; opacity: 0.55; }
.camp-pic { display: grid; place-items: center; width: 44px; height: 44px; background: var(--inset); border: 2px solid #000; }
.camp-pic canvas { width: 40px; height: 40px; image-rendering: pixelated; }
.camp-name { text-align: center; line-height: 1.2; min-height: 2.4em; }
.camp-crown { position: absolute; top: -9px; right: -6px; }
.camp-stars i { font-style: normal; color: var(--line); letter-spacing: 1px; }
.camp-stars i.on { color: var(--gold); }
.camp-stars.big { font-size: 22px; }
/* the Daily Challenge */
.daily-champ { gap: 2px; width: 64px; }
.daily-champ canvas { width: 48px; height: 48px; image-rendering: pixelated; background: var(--inset); border: 2px solid #000; }
.daily-row { display: flex; align-items: center; gap: 10px; padding: 4px 8px; background: var(--panel-3); border: 2px solid #000; }
.daily-row.me { border-color: var(--teal); }
.daily-chart { display: flex; align-items: flex-end; gap: 3px; height: 80px; padding: 4px; background: var(--inset); border: 2px solid #000; }
.daily-chart i { flex: 1; min-width: 4px; background: var(--copper); }
.daily-chart i.won { background: var(--teal); }
/* a champion's mastery path (collection) */
.path-step { display: flex; align-items: center; gap: 10px; }
.path-n { display: grid; place-items: center; width: 24px; height: 24px; flex: none; font: 700 12px var(--font-text); color: var(--muted); background: var(--inset); border: 2px solid var(--line); }
.path-step.done .path-n { color: #1a1220; background: var(--teal); border-color: #000; }
.path-lore { margin: 2px 0 0; font-style: italic; }
/* the draft's saved-teams dropdown, and a plan's champions in the pool */
.team-menu { position: relative; }
.team-menu-list { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; display: flex; flex-direction: column; gap: 4px; min-width: 260px; max-height: 320px; overflow-y: auto; padding: 6px; }
.team-menu-row { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 5px 7px; color: var(--text); font: inherit; text-align: left; background: var(--panel-3); border: 2px solid #000; cursor: pointer; }
.team-menu-row:hover, .team-menu-row:focus-visible { border-color: var(--teal); outline: none; }
.team-menu-row canvas { width: 24px; height: 24px; image-rendering: pixelated; background: rgba(0, 0, 0, 0.4); }
.champ-tile.planned { box-shadow: inset 0 0 0 2px var(--gold); }
.ct-plan { position: absolute; left: 4px; bottom: 4px; color: var(--gold); font-size: 14px; text-shadow: 0 1px 0 #000; }
/* the turn timeline under the turn text: this turn and the next four, in their side's colour */
.turn-line { display: flex; gap: 3px; justify-content: center; margin-top: 3px; }
.tl-chip { display: inline-flex; align-items: center; justify-content: center; gap: 3px; min-width: 32px; height: 22px; padding: 0 5px; font: 700 13px var(--font-text); color: var(--text); background: rgba(16, 12, 22, 0.85); border: 1px solid #000; border-bottom: 3px solid var(--blue); }
.tl-chip.red { border-bottom-color: var(--red); }
.tl-chip.now { outline: 1px solid var(--teal); background: rgba(40, 30, 50, 0.95); }
.tl-chip b { font-weight: 700; }
.tl-chip .icon-img { width: 14px; height: 14px; }
.tl-sd { color: var(--bad); font-size: 10px; }
.narrow .turn-line { display: none; }
.next-strip canvas { width: 26px; height: 26px; image-rendering: pixelated; background: rgba(0, 0, 0, 0.5); border: 1px solid var(--line); }
.next-strip canvas.rest { opacity: 0.35; }

.chronicle {
  position: absolute;
  z-index: 5;
  width: min(320px, 92vw);
  max-height: 46vh;
  display: flex;
  flex-direction: column;
}
/* big screens: docked under the arena, always open (match.js layout) */
.chronicle.docked { max-height: none; padding: 6px 10px; }
.chronicle.docked .chron-head { margin-bottom: 2px; }
.chronicle.docked .chron-head .h2 { font-size: var(--fs-xs); }
.chronicle.docked .chron-opts-btn { min-width: 26px; min-height: 26px; width: 26px; height: 26px; padding: 2px; }
.chronicle.docked .chron-opts { top: 34px; }
.chronicle.docked .log { flex: 1 1 auto; min-height: 0; }
.chronicle.docked .chron-voice { flex-direction: row; flex-wrap: wrap; margin-bottom: 4px; padding: 2px 6px; }
.chronicle.docked .chron-chat { margin-top: 4px; }
.chron-docked .chron-btn { display: none; }
/* phones: the other player wrote, a "!" pulses on the chronicle's button */
.chron-btn.badge.alert::after { min-width: 18px; padding: 0; font-weight: 700; animation: chron-alert 0.9s ease-in-out infinite alternate; }
@keyframes chron-alert { from { transform: scale(1); box-shadow: 0 0 0 0 rgba(229, 72, 77, 0.7); } to { transform: scale(1.25); box-shadow: 0 0 0 5px rgba(229, 72, 77, 0); } }
.reduce-motion .chron-btn.badge.alert::after { animation: none; }
.chronicle .log { overflow-y: auto; font-size: var(--fs-xs); display: flex; flex-direction: column; gap: 2px; padding-right: 4px; -webkit-user-select: text; user-select: text; }
/* The chronicle (match.js addLog): sections, times, rich lines, the ⚙ options */
.chron-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.chron-head .h2 { margin: 0; flex: 1; }
.chron-clock { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-num); font-size: 15px; color: var(--muted); }
.chron-clock canvas, .chron-clock img { width: 12px; height: 12px; image-rendering: pixelated; }
.chron-clock.stopped { color: var(--gold); }
.chron-opts-btn.on { box-shadow: inset 0 0 0 2px var(--gold); }
.chron-opts { position: absolute; z-index: 3; right: 8px; top: 38px; width: min(300px, calc(100% - 16px)); max-height: 70%; overflow-y: auto; padding: 8px; background: #17121f; border: 2px solid #000; box-shadow: 0 0 0 2px rgba(255, 246, 220, 0.15), 0 8px 18px rgba(0, 0, 0, 0.6); }
.lo-head { margin: 0 2px 6px; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.lo-row { display: flex; align-items: center; gap: 8px; width: 100%; padding: 5px 6px; text-align: left; color: var(--text); background: none; border: 2px solid transparent; cursor: pointer; font: inherit; }
.lo-row + .lo-row { margin-top: 2px; }
.lo-row:hover, .lo-row:focus-visible { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 246, 220, 0.15); outline: none; }
.lo-ico { flex-shrink: 0; width: 22px; font-size: 15px; text-align: center; }
.lo-text { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.lo-text b { font-size: 12px; }
.lo-text small { font-size: 11px; line-height: 1.2; color: var(--muted); }
.lo-sw { position: relative; flex-shrink: 0; width: 34px; height: 18px; background: #5a5266; border: 3px solid #000; }
.lo-sw i { position: absolute; top: 1px; left: 1px; width: 10px; height: 10px; background: #fffbea; box-shadow: inset -2px -2px 0 #b9ae98; transition: left 0.1s steps(2); }
.lo-row.on .lo-sw { background: #3fae5a; }
.lo-row.on .lo-sw i { left: 17px; }
.chronicle .log { gap: 3px; line-height: 1.35; }
.chronicle .log .log-group { display: flex; align-items: center; gap: 8px; margin-top: 6px; padding: 2px 8px; font-size: 10px; color: var(--text); text-transform: uppercase; letter-spacing: 1px;
  background: rgba(255, 255, 255, 0.06); border-left: 4px solid rgba(255, 246, 220, 0.25); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.35); }
.chronicle .log .log-group:first-child { margin-top: 0; }
.chronicle .log .log-group.p0 { border-left-color: var(--blue); background: rgba(70, 120, 255, 0.16); }
.chronicle .log .log-group.p1 { border-left-color: var(--team-red); background: rgba(229, 72, 77, 0.16); }
.chronicle .log .lg-title { font-weight: 700; }
.chronicle .log .log-group.p0 .lg-who { color: var(--blue-hi); }
.chronicle .log .log-group.p1 .lg-who { color: var(--team-red-hi); }
.chronicle .log .lg-time { margin-left: auto; display: inline-flex; align-items: center; gap: 3px; color: var(--muted); white-space: nowrap; text-transform: none; }
.chronicle .log .lg-time canvas, .chronicle .log .lg-time img { width: 10px; height: 10px; image-rendering: pixelated; }
.chronicle .log .lg { display: flex; align-items: baseline; gap: 8px; margin-left: 10px; padding-left: 6px; border-left: 3px solid rgba(255, 246, 220, 0.12); }
.chronicle .log .lg.p0 { border-left-color: var(--blue); }
.chronicle .log .lg.p1 { border-left-color: var(--team-red); }
.chronicle .log .lg-txt { flex: 1; min-width: 0; }
.chronicle .log .log-time { flex: 0 0 auto; min-width: 38px; font-family: var(--font-num); font-size: 14px; color: var(--text); }
.chronicle .log .log-time.same { opacity: 0.3; }
.chronicle .log .lg-u { font-weight: 700; }
.chronicle .log .lg-u.p0 { color: var(--blue-hi); }
.chronicle .log .lg-u.p1 { color: var(--team-red-hi); }
.chronicle .log .lg-u.p2 { color: #c9a8ff; }
.chronicle .log .lg-num { font-family: var(--font-num); font-size: 15px; font-weight: normal; padding: 0 1px; }
.chronicle .log .lg-num.atk { color: #ff6b5e; }
.chronicle .log .lg-num.spell { color: #ff6bd0; }
.chronicle .log .lg-num.heal { color: #6be07a; }
.chronicle .log .lg-num.shield { color: #8fc2ff; }
.chronicle .log .lg-ab { font-weight: 700; color: #c8a0ff; }
.chronicle .log .lg-ab.ult { color: #ffb15e; }
/* an Ultimate: the line glows */
.chronicle .log .lg.lg-ult { padding: 2px 8px; font-weight: 700; color: #3a1a08; background: linear-gradient(90deg, #ff9a3c, #ffd36b 70%, #fff3b0); box-shadow: inset 0 -2px 0 rgba(140, 60, 10, 0.35); }
.chronicle .log .lg.lg-ult .lg-u.p0 { color: #1c3f9a; }
.chronicle .log .lg.lg-ult .lg-u.p1 { color: #9a1c1c; }
.chronicle .log .lg.lg-ult .lg-ab.ult { color: #6a1a00; }
.chronicle .log .lg.lg-ult .log-time { color: #3a1a08; }
/* sudden death: a dark band */
.chronicle .log .lg.lg-warn { padding: 3px 8px; font-weight: 700; color: #ffd36b; background: #2a1c24; border-left-color: #e0453c; box-shadow: inset 0 0 0 1px #5a2a2a; text-shadow: 1px 1px 0 #000; }
/* a critical hit and a miss */
.chronicle .log .lg-crit { display: inline-block; margin-left: 2px; padding: 0 4px; font-size: 10px; font-weight: 700; color: #fff3a0; text-transform: uppercase;
  background: linear-gradient(#ff9a3c, #d0261a); border: 2px solid #000; transform: rotate(-3deg); animation: lg-crit 1s steps(2) infinite; }
@keyframes lg-crit { 50% { transform: rotate(-3deg) scale(1.08); filter: brightness(1.2); } }
.chronicle .log .lg-miss { display: inline-block; position: relative; margin-left: 4px; padding: 0 6px 0 18px; font-size: 10px; letter-spacing: 1px; color: #c8dcf0; text-transform: uppercase;
  background: linear-gradient(90deg, transparent, rgba(120, 160, 210, 0.45) 35%, rgba(150, 190, 235, 0.6)); border-right: 3px solid #8aa8c8; transform: skewX(-14deg);
  text-shadow: -3px 0 rgba(200, 220, 240, 0.3), -7px 0 rgba(200, 220, 240, 0.12); animation: lg-miss 1.6s ease-in-out infinite; }
.chronicle .log .lg-miss::before { content: '💨'; position: absolute; left: 1px; top: 50%; transform: translateY(-50%) skewX(14deg); font-size: 10px; text-shadow: none; }
@keyframes lg-miss { 50% { transform: skewX(-14deg) translateX(3px); opacity: 0.8; } }
.reduce-motion .chronicle .log .lg-crit, .reduce-motion .chronicle .log .lg-miss { animation: none; }
.chronicle .log .lg.lg-death .lg-txt::before { content: '💀 '; }
/* the announcer, the mascots, the chat */
.chronicle .log .lg.lg-banner { padding: 1px 8px; background: linear-gradient(90deg, rgba(242, 193, 78, 0.28), rgba(242, 193, 78, 0.05) 70%); border-left-color: var(--gold); }
.chronicle .log .lg-ann { font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--gold); }
.chronicle .log .lg.lg-banner.p0 .lg-ann { color: var(--blue-hi); }
.chronicle .log .lg.lg-banner.p1 .lg-ann { color: var(--team-red-hi); }
.chronicle .log .lg.lg-emote { color: var(--muted); }
.chronicle .log .lg-ll { display: inline-block; width: 18px; height: 18px; margin-right: 4px; vertical-align: -4px; image-rendering: pixelated; }
.chronicle .log .lg.lg-chat { font-weight: 700; }
.chronicle .log .lg.lg-notice { color: var(--muted); font-style: italic; }
/* the ⚙'s choices */
.chronicle .log.no-times .log-time { display: none; }
.chronicle .log.no-damage .lg.lg-dmg { display: none; }
.chronicle .log.no-deaths .lg.lg-death { display: none; }
.chronicle .log.no-banners .lg.lg-banner { display: none; }
.chronicle .log.no-turns .log-group { display: none; }
.chronicle .log.no-turns .lg { margin-left: 0; }
.chronicle .log.no-emotes .lg.lg-emote { display: none; }

.announce {
  position: absolute;
  left: 50%;
  top: 32%;
  transform: translate(-50%, -50%);
  z-index: 8;
  font-family: var(--font-title);
  font-size: clamp(18px, 4.6vw, 44px);
  color: var(--gold);
  text-shadow: 0 4px 0 #6b3a10, 0 7px 0 #000, 0 0 30px rgba(245, 197, 66, 0.5);
  white-space: nowrap;
  pointer-events: none;
  animation: announce 1.6s ease-out forwards;
}
.announce.red { color: var(--team-red-hi); text-shadow: 0 4px 0 var(--red-dk), 0 7px 0 #000; }
.announce.teal { color: var(--teal-hi); text-shadow: 0 4px 0 var(--teal-dk), 0 7px 0 #000; }
@keyframes announce { 0% { opacity: 0; transform: translate(-50%, -50%) scale(2.2); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -60%) scale(1); } }

/* ------------------------------------------------------- draft screen */

/* The champion select: header with the turn tracker, the choice bar, then
   your team | the champion pool | the other team + the preview. */
.dr { display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 0; padding: 0 10px 10px; }
.dr-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 8px 14px; }
.dr.p0 .dr-head { box-shadow: inset 4px 0 0 var(--blue); }
.dr.p1 .dr-head { box-shadow: inset 4px 0 0 var(--team-red); }
.dr.banning .dr-head { background: linear-gradient(90deg, rgba(200, 40, 30, 0.22), transparent 60%), var(--panel); }
.dr-title { min-width: 0; }
.dr-title .t { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-family: var(--font-title); font-size: calc(12px * var(--ui-scale)); line-height: 1.5; color: var(--text); text-shadow: 0 2px 0 #000; }
.dr-title .sub { font-size: var(--fs-s); color: var(--text-2); margin-top: 3px; }
.dr-rand { display: none; }
.dr-count-step { font-family: var(--font-num); font-size: 20px; color: var(--muted); margin-left: 4px; }
.dr-mark { display: inline-grid; place-items: center; width: 22px; height: 22px; flex: none; font-family: var(--font-text); font-size: 14px; font-weight: 700; color: #fff; border: 2px solid #000; }
.dr-mark.p0 { background: var(--blue); }
.dr-mark.p1 { background: var(--team-red); }

/* Turn tracker */
.dr-steps { display: flex; align-items: center; gap: 3px; padding: 4px 6px; background: rgba(0, 0, 0, 0.35); border: 2px solid #000; }
.ds { position: relative; display: grid; place-items: center; width: 28px; height: 28px; font-family: var(--font-num); font-size: 18px; line-height: 1; color: var(--muted); background: var(--inset); border: 2px solid var(--line); }
.ds.p0 { border-color: #2a5aa8; }
.ds.p1 { border-color: #9b2a30; }
.ds.ban { background: #2e1416; font-size: 12px; }
.ds.done { background: radial-gradient(circle at 50% 40%, #3a3044, #1d1724); color: var(--text); }
.ds.done.ban canvas { filter: grayscale(1) brightness(0.75); }
.ds canvas { width: 22px; height: 22px; image-rendering: pixelated; }
.ds.now { border-color: var(--gold); color: var(--gold); box-shadow: 0 0 12px rgba(245, 197, 66, 0.6); animation: turn-glow 1.2s ease-in-out infinite; }
.ds .chip { padding: 0 3px; font-size: 11px; }
.ds-gap { width: 3px; }
@keyframes turn-glow { 50% { box-shadow: 0 0 4px rgba(245, 197, 66, 0.25); } }

/* Choice bar */
.dr-choice-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 10px; background: rgba(20, 15, 24, 0.92); }
.dr-choice { display: flex; align-items: center; gap: 10px; min-width: 0; }
.dc-icon { display: grid; place-items: center; width: 50px; height: 50px; flex: none; background: radial-gradient(circle at 50% 40%, #3a3044, #1d1724); border: 2px solid #000; box-shadow: inset 0 0 0 1px var(--copper-dk); }
.dc-icon canvas { width: 42px; height: 42px; }
.dc-icon.ban { background: #2e1416; }
.dc-icon.ban canvas { filter: grayscale(1) brightness(0.8); }
.dc-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.dc-text b { font-size: var(--fs-l); line-height: 1.1; }
.dr-buttons { flex: none; }

/* Three columns */
.dr-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 236px minmax(0, 1fr) 300px; gap: 10px; align-items: stretch; }
.dr-team { display: flex; flex-direction: column; gap: 8px; align-self: start; padding: 8px 10px 10px; }
.dr-team.p0 { box-shadow: inset 0 3px 0 var(--blue); }
.dr-team.p1 { box-shadow: inset 0 3px 0 var(--team-red); }
.dr-team.active { box-shadow: inset 0 3px 0 var(--gold), 0 0 0 2px var(--gold), 0 0 18px rgba(245, 197, 66, 0.35); }
.dr-team-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.dr-team-head b { min-width: 0; }
.dr-team-head small { margin-left: auto; }
.dr-bans { display: flex; align-items: center; gap: 8px; }
.dr-ban { position: relative; display: grid; place-items: center; width: 40px; height: 40px; background: var(--inset); border: 2px dashed var(--line); font-size: 14px; }
.dr-ban.filled { border: 2px solid #000; background: #2e1416; }
.dr-ban.filled canvas { width: 32px; height: 32px; filter: grayscale(1) brightness(0.75); }
.dr-ban.filled::after { content: ''; position: absolute; inset: 2px; background: linear-gradient(45deg, transparent 44%, var(--bad) 44% 56%, transparent 56%), linear-gradient(-45deg, transparent 44%, var(--bad) 44% 56%, transparent 56%); pointer-events: none; }
.dr-ban .chip { padding: 0 4px; font-size: 11px; }
.dr-ban .ghost { width: 32px; height: 32px; opacity: 0.45; filter: grayscale(1); image-rendering: pixelated; }
.dr-slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.dr-slot { position: relative; display: grid; place-items: center; aspect-ratio: 1; padding: 0; background: var(--inset); border: 2px dashed var(--line); color: var(--muted); font: inherit; }
.dr-slot canvas { width: 82%; height: 82%; image-rendering: pixelated; }
.dr-slot.filled { border: 2px solid #000; background: radial-gradient(circle at 50% 38%, #3e3448, #1d1724 75%); box-shadow: inset 0 0 0 1px var(--copper-dk); }
.dr-slot.next { border: 2px solid var(--gold); animation: slot-blink 1s steps(1) infinite; }
.dr-slot .ghost { opacity: 0.42; }
.dr-slot.removable { cursor: pointer; }
.dr-slot.removable:hover { border-color: var(--bad); }
.dr-slot.secret { font-family: var(--font-num); font-size: 26px; }
.dr-slot.secret.ready { color: var(--good); border: 2px solid #2f7d3b; background: #1e2e18; }
.dr-slot.incoming > * { visibility: hidden; }
.dr-slot.land { animation: slot-land 0.36s ease-out; }
.dr-slot-tier { position: absolute; left: 3px; top: 2px; }
.dr-syn { display: flex; flex-wrap: wrap; gap: 4px; min-height: 22px; }
.dr-syn .chip { opacity: 0.65; }
.dr-syn .chip.on { opacity: 1; box-shadow: 0 0 8px rgba(255, 255, 255, 0.15); }
@keyframes slot-blink { 50% { border-color: rgba(245, 197, 66, 0.25); } }
@keyframes slot-land { 0% { transform: scale(1.22); } 55% { transform: scale(0.9); } 100% { transform: scale(1); } }

/* The pool */
.dr-pool { display: flex; flex-direction: column; gap: 8px; min-height: 0; min-width: 0; padding: 8px 10px; }
.dr-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dr-search { width: auto; flex: 1 1 150px; min-width: 120px; min-height: 36px; padding: 4px 10px; }
.dr-filters { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fac-btn.on { color: #1c1206; filter: brightness(1.25); }
.fac-btn.order.on { color: #f3d58a; } .fac-btn.wild.on { color: #9be38a; } .fac-btn.arcane.on { color: #c3b0ff; } .fac-btn.shadow.on { color: #d39be0; }
.fac-btn.all.on { color: var(--teal); }
.dr-count { margin-left: auto; white-space: nowrap; }
.chip-btn.order { color: #f3d58a; } .chip-btn.wild { color: #9be38a; } .chip-btn.arcane { color: #c3b0ff; } .chip-btn.shadow { color: #d39be0; }
.dr-grid { flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(106px, 1fr)); gap: 14px 10px; padding: 12px 8px 6px; align-content: start; background: rgba(10, 7, 12, 0.45); border: 2px solid #000; }
.champ-tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px 6px; color: var(--text); font: inherit; text-align: center; cursor: pointer; background: var(--panel-2); border: 9px solid var(--copper-dk); border-image: var(--frame-card) 9 fill / 9px / 0 stretch; transition: transform 0.12s, box-shadow 0.12s; }
.champ-tile:not(.disabled):hover { transform: translateY(-3px); filter: brightness(1.12); }
.nav-visible .champ-tile:focus-visible { transform: translateY(-3px); }
.champ-tile.disabled { cursor: default; }
.champ-tile.disabled:not(.chosen):not(.banned) > .ct-icon, .champ-tile.disabled:not(.chosen):not(.banned) > .ct-name { opacity: 0.45; }
.ct-icon { display: grid; place-items: center; width: 62px; height: 62px; background: radial-gradient(circle at 50% 38%, #3e3448, #1d1724 75%); border: 2px solid #000; box-shadow: inset 0 0 0 1px var(--copper-dk); }
.ct-icon canvas { width: 54px; height: 54px; image-rendering: pixelated; }
.ct-icon.big { width: 80px; height: 80px; flex: none; }
.ct-icon.big canvas { width: 72px; height: 72px; }
.ct-name { min-height: 18px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: calc(13px * var(--ui-scale)); line-height: 1.1; color: #f1e6cc; overflow-wrap: normal; word-break: normal; }
.ct-facs { display: flex; gap: 3px; }
.ct-fac { width: 9px; height: 9px; border: 1px solid #000; }
.ct-fac.order { background: #d9b45a; } .ct-fac.wild { background: #5fbf4a; } .ct-fac.arcane { background: #8a6bff; } .ct-fac.shadow { background: #8a4b9a; }
.ct-tier { position: absolute; top: -10px; left: -10px; padding: 3px 4px; background: #1a1220; border: 2px solid var(--copper-dk); }
.ct-lock { position: absolute; top: -12px; left: -10px; font-size: 15px; }
.champ-tile.locked .ct-icon, .champ-tile.locked .ct-name { opacity: 0.5; filter: grayscale(0.8); }
.champ-tile.banned > :not(.ct-ban) { opacity: 0.35; filter: grayscale(1); }
.ct-ban { position: absolute; left: 50%; top: 36%; z-index: 1; transform: translate(-50%, -50%) rotate(-14deg); padding: 2px 6px; font-weight: 700; font-size: var(--fs-xs); color: var(--bad); background: rgba(20, 8, 10, 0.85); border: 2px solid var(--bad); letter-spacing: 1px; text-transform: uppercase; }
.ct-picks { position: absolute; top: -12px; right: -10px; display: flex; gap: 2px; }
.ct-picks i { display: grid; place-items: center; width: 20px; height: 20px; font-style: normal; font-weight: 700; font-size: 12px; color: #fff; border: 2px solid #000; }
.ct-picks i.p0 { background: var(--blue); }
.ct-picks i.p1 { background: var(--team-red); }
.ct-order { position: absolute; top: -12px; right: -10px; display: grid; place-items: center; width: 22px; height: 22px; font-family: var(--font-num); font-size: 18px; color: #1c1206; background: var(--gold); border: 2px solid #000; }
.ct-go { display: none; }
.champ-tile.chosen { transform: translateY(-3px); box-shadow: 0 0 0 3px var(--gold), 0 0 16px rgba(245, 197, 66, 0.45); }
.dr.banning .champ-tile.chosen { box-shadow: 0 0 0 3px var(--bad), 0 0 16px rgba(229, 72, 77, 0.45); }
.champ-tile.fx-hit { box-shadow: 0 0 0 3px var(--bad); }
.champ-tile.holo .ct-icon { box-shadow: inset 0 0 0 1px #c8a0ff, 0 0 10px rgba(200, 160, 255, 0.5); }

/* The other team + the preview */
.dr-side { display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow-y: auto; }
.dr-preview { padding: 10px 12px; }
.dr-preview.empty { display: flex; align-items: center; justify-content: center; min-height: 90px; }
.dr-hint { margin-top: 8px; padding: 6px 8px; color: var(--gold); background: rgba(0, 0, 0, 0.3); box-shadow: inset 3px 0 0 var(--gold); }
.dr-fly { position: fixed; z-index: 30; pointer-events: none; image-rendering: pixelated; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.6)); }

/* Tablets: both teams on the left, the pool on the right */
@media (max-width: 1100px) {
  .dr-body { grid-template-columns: 220px minmax(0, 1fr); grid-template-rows: auto auto 1fr; }
  .dr-side { display: contents; }
  .dr-body > .dr-team { grid-column: 1; grid-row: 1; }
  .dr-side > .dr-team { grid-column: 1; grid-row: 2; }
  .dr-side > .dr-preview { grid-column: 1; grid-row: 3; align-self: start; max-height: 100%; overflow-y: auto; }
  .dr-pool { grid-column: 2; grid-row: 1 / span 3; }
}

/* Phones: the two teams side by side, the pool below; the page scrolls, the choice bar stays on top */
@media (max-width: 700px) {
  .dr { overflow-y: auto; padding: 0 6px 6px; gap: 6px; }
  /* Header: title + the Random dice on one line, the tracker below */
  .dr-head { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'title rand' 'steps steps'; gap: 6px; padding: 6px 8px; }
  .dr-title { grid-area: title; }
  .dr-steps { grid-area: steps; overflow-x: auto; }
  .dr-rand { display: inline-flex; grid-area: rand; align-self: start; }
  .dr-title .sub { display: none; }
  .ds { width: 24px; height: 24px; flex: none; font-size: 16px; }
  .ds canvas { width: 18px; height: 18px; }
  /* No "Picking X" box: the chosen card and the ghost in the slot say it, a second tap locks in.
     What stays (Fast match, No ban) is just the buttons. */
  .dr-choice-bar.quiet, .dr-choice, .dr-rand-txt, .dr-choice-bar.k-blind .dr-lock { display: none; }
  .dr-choice-bar { position: sticky; top: 0; z-index: 4; padding: 4px 6px; justify-content: flex-end; }
  .dr-buttons { flex: 1 1 100%; justify-content: flex-end; }
  .ct-go { display: block; position: absolute; left: 50%; bottom: -11px; z-index: 2; transform: translateX(-50%); padding: 1px 5px; white-space: nowrap; font-weight: 700; font-size: 9px; color: #1c1206; background: var(--gold); border: 2px solid #000; animation: turn-glow 1.2s ease-in-out infinite; }
  .dr.banning .ct-go { color: #fff; background: var(--bad); }
  .dr-ban .ghost { width: 22px; height: 22px; }
  .dr-title .t { font-size: 10px; flex-wrap: nowrap; align-items: flex-start; }
  .dr-title .tt { flex: 1 1 auto; min-width: 0; }
  .dr-count-step { flex: none; font-size: 16px; }
  .dr-buttons .btn { padding: 2px 8px; }
  /* Teams as full-width strips, one on top of the other: six slots in a row */
  .dr-body { display: grid; grid-template-columns: 1fr; grid-template-rows: auto auto auto auto; gap: 6px; flex: none; }
  .dr-body > .dr-team { grid-column: 1; grid-row: 1; }
  .dr-side > .dr-team { grid-column: 1; grid-row: 2; }
  .dr-pool { grid-column: 1; grid-row: 3; padding: 6px; }
  .dr-side > .dr-preview { grid-column: 1; grid-row: 4; }
  .dr-side > .dr-preview.empty { display: none; }
  .dr-team { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'head ban' 'slots slots' 'syn syn'; align-items: center; padding: 5px 6px 6px; gap: 4px 8px; }
  .dr-team-head { grid-area: head; }
  .dr-bans { grid-area: ban; gap: 6px; }
  .dr-slots { grid-area: slots; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 3px; }
  .dr-syn { grid-area: syn; min-height: 0; }
  .dr-syn:empty { display: none; }
  .dr-team.raid-box { display: flex; flex-direction: column; gap: 4px; }
  .dr-syn .chip { font-size: 10px; padding: 0 5px; }
  .dr-slot-tier { font-size: 7px; padding: 0 1px; left: 1px; top: 1px; }
  .dr-ban { width: 28px; height: 28px; }
  .dr-ban.filled canvas { width: 22px; height: 22px; }
  .dr-bans small { font-size: 10px; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .dr-grid { flex: none; overflow: visible; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 6px; padding: 10px 6px 4px; }
  .champ-tile { padding: 6px 2px 4px; }
  .ct-icon { width: 44px; height: 44px; }
  .ct-icon canvas { width: 38px; height: 38px; }
  .ct-name { font-size: 10px; min-height: 14px; letter-spacing: -0.2px; }
  .dr-search { flex-basis: 100%; min-height: 32px; }
  .dr-filters { flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; gap: 4px; padding-bottom: 2px; }
  .dr-filters .btn.small { flex: none; min-height: 30px; padding: 0 7px; font-size: 11px; }
  .dr-count { display: none; }
}

/* ----------------------------------------------------- emblem editor */

.emblem-editor { display: grid; grid-template-columns: 1fr 300px; gap: 12px; flex: 1; min-height: 0; padding: 0 12px 12px; }
.emblem-stage { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 0; }
.emblem-hint { margin: 0; max-width: 560px; }
.screen-emblem .screen-head .btn { white-space: nowrap; }
@media (max-width: 560px) {
  .screen-emblem .screen-head .title { display: none; }
  .screen-emblem .screen-head { gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
  .screen-emblem .screen-head .btn.small { padding: 2px 6px; }
  .emblem-hint { font-size: 11px; }
}
.emblem-stage canvas { width: min(100%, 56vh); aspect-ratio: 1; image-rendering: auto; background: repeating-conic-gradient(#1b1520 0 25%, #221a28 0 50%) 0 0 / 24px 24px; border: 3px solid #000; box-shadow: 0 0 0 2px var(--copper-dk); touch-action: none; }
.emblem-side { display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow-y: auto; }
.shape-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 4px; }
.shape-grid button { aspect-ratio: 1; padding: 4px; background: var(--inset); border: 2px solid var(--line); cursor: pointer; }
.shape-grid button canvas { width: 100%; height: 100%; }
.layer-list .list-item { min-height: 40px; padding: 4px 8px; }
.layer-list .list-item.sel { border-color: var(--teal); }
.swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; }
.swatches button { aspect-ratio: 1; border: 2px solid #000; cursor: pointer; padding: 0; }
.swatches button.sel { outline: 2px solid #fff; }

/* ------------------------------------------- match on narrow screens */

.narrow .hud-top { flex-wrap: wrap; padding: 4px 6px; gap: 4px; }
.narrow .hud-top .turn-banner { min-width: 0; }
.narrow .hud-top .turn-banner .t { font-size: 9px; line-height: 1.4; }
.narrow .hud-top .turn-banner .xs { font-size: 10px; }
.narrow .next-strip { display: none; }
.narrow .timer { font-size: 24px; min-width: 48px; }
.narrow .timer-bar { width: 48px; height: 6px; }
.narrow .roster { flex-wrap: nowrap !important; gap: 4px; }
/* phones: the rosters are just the champions' square portraits (HP, energy and the rest are on the board
   and in the champion's bubble) */
.narrow .roster-hero { display: grid; place-items: center; width: 48px; height: 48px; flex: 0 0 auto; padding: 1px; grid-template-columns: 1fr; gap: 0; }
.narrow .roster-hero canvas { width: 40px; height: 40px; grid-row: auto; }
.narrow .roster-hero > :not(canvas) { display: none; }
.narrow .roster-hero.blue { border-left-width: 2px; border-bottom: 3px solid var(--blue); }
.narrow .roster-hero.red { border-left-width: 2px; border-bottom: 3px solid var(--team-red); }
.narrow .action-bar { gap: 3px; padding: 3px; }
.narrow .hint-line { font-size: 12px; max-width: 96vw; overflow: hidden; text-overflow: ellipsis; }

/* -------------------------------------------------------- responsive */

@media (max-width: 860px) {
  .emblem-editor { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .emblem-stage canvas { width: min(100%, 38vh); }
}

@media (max-width: 560px) {
  :root { --gap: 8px; }
  .menu-buttons { grid-template-columns: 1fr 1fr; gap: 6px; }
  .menu-buttons .btn { font-size: var(--fs-s); min-height: 46px; padding: 4px 8px; }
  .screen-head { min-height: 48px; padding: 6px 8px; }
  .screen-body { padding: 4px 8px 14px; }
  .roster-hero { width: auto; grid-template-columns: 30px 1fr; padding: 2px 4px; }
  .roster-hero canvas { width: 30px; height: 30px; }
  .action-btn { min-width: 52px; min-height: 54px; }
  .action-btn .lbl { display: none; }
}

@media (max-height: 520px) and (orientation: landscape) {
  .menu-logo .t1 { font-size: 28px; }
  .menu-wrap { gap: 8px; }
}

/* ----------------------------------------------- comfort and motion */

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

.scroll-thin::-webkit-scrollbar, .screen-body::-webkit-scrollbar, .modal-body::-webkit-scrollbar, .log::-webkit-scrollbar, .pool::-webkit-scrollbar { width: 10px; height: 10px; }
.screen-body::-webkit-scrollbar-thumb, .modal-body::-webkit-scrollbar-thumb, .log::-webkit-scrollbar-thumb, .pool::-webkit-scrollbar-thumb, .scroll-thin::-webkit-scrollbar-thumb { background: var(--copper-dk); border: 2px solid var(--bg); }
.screen-body::-webkit-scrollbar-track, .modal-body::-webkit-scrollbar-track, .log::-webkit-scrollbar-track, .pool::-webkit-scrollbar-track, .scroll-thin::-webkit-scrollbar-track { background: var(--bg-2); }
* { scrollbar-color: var(--copper-dk) var(--bg-2); scrollbar-width: thin; }

/* ------------------------------------------------------------------ online */
[hidden] { display: none !important; }
.badge { position: relative; }
.badge::after { content: attr(data-badge); position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 4px; display: grid; place-items: center; font-family: var(--font-num); font-size: 15px; line-height: 1; color: #fff; background: var(--bad); border: 2px solid #000; border-radius: 9px; pointer-events: none; }
.badge-btn { color: #fff; background-color: var(--bad); }
.btn.left { justify-content: flex-start; text-align: left; }
.btn.link { background: none; border: none; border-image: none; box-shadow: none; padding: 0 2px; min-height: 0; color: var(--teal); text-decoration: underline; max-width: 100%; }
.acc-btn { max-width: 200px; }
.acc-btn .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-row, .lb-row, .mk-row { padding: 3px 4px; border-bottom: 1px solid rgba(75, 58, 60, 0.5); min-height: 34px; }
.player-row:last-child, .lb-row:last-child, .mk-row:last-child { border-bottom: none; }
.lb-row.mine { background: rgba(63, 224, 184, 0.1); box-shadow: inset 3px 0 0 var(--teal); }
.lb-pos { min-width: 34px; color: var(--muted); }
.rarity-common { color: #d8d2c6; } .rarity-rare { color: #8cc0ff; } .rarity-epic { color: #d39be0; } .rarity-legendary { color: var(--gold); }
.lobby-code { font-size: calc(30px * var(--ui-scale)); letter-spacing: 8px; margin: 4px 0; user-select: all; -webkit-user-select: all; }
.lobby-team.p0 { box-shadow: inset 0 3px 0 var(--blue); }
.lobby-team.p1 { box-shadow: inset 0 3px 0 var(--team-red); }
.lobby-seat { min-height: 34px; }
.spinner { width: 34px; height: 34px; border: 4px solid var(--line); border-top-color: var(--teal); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.live-tag { color: var(--bad); font-weight: 700; font-size: var(--fs-xs); margin-right: 6px; animation: turn-glow 1.2s ease-in-out infinite; }
.bracket { display: flex; gap: 10px; overflow-x: auto; align-items: center; padding-bottom: 6px; }
.bracket-round { min-width: 150px; }
.bracket-match { padding: 4px 6px; position: relative; }
.bracket-match .lost { opacity: 0.45; text-decoration: line-through; }
/* the tutorial's coach */
.coach { position: absolute; left: 12px; bottom: 12px; z-index: 30; width: clamp(220px, 17.5vw, 340px); display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; box-shadow: 0 6px 0 #000, 0 0 0 2px var(--gold); }
.coach-head { display: flex; align-items: center; gap: 8px; }
.coach-text { margin: 0; line-height: 1.45; }
.coach-buttons { align-items: center; flex-wrap: wrap; }
.coach.min { width: auto; }
.coach-hl { outline: 3px solid var(--gold) !important; outline-offset: 2px; animation: coach-pulse 1.2s ease-in-out infinite; }
@keyframes coach-pulse { 50% { outline-color: rgba(245, 197, 66, 0.25); } }
@media (max-width: 700px) {
  .coach { left: 50%; transform: translateX(-50%); width: 94vw; bottom: 8px; padding: 6px 8px; gap: 4px; }
  .coach:not([data-phase='fast']) { bottom: auto; top: 56px; }
  .coach .coach-text { font-size: var(--fs-xs); }
}
/* the snake mini-game */
.snake-body { display: flex; justify-content: center; }
.snake-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.snake-hud { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 640px; }
.snake-hud .bar { min-width: 120px; }
.snake-wrap { position: relative; }
.snake-xp { width: 70px; }
.snake-xp .bar, .snake-hud .snake-xp .bar { height: 8px; min-width: 0; }
.snake-perks { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -45%); z-index: 5; width: min(560px, calc(100vw - 24px)); display: flex; flex-direction: column; gap: 6px; text-align: center; }
.snake-perk-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.snake-perk { flex-direction: column; gap: 4px; padding: 8px 6px; min-height: 120px; white-space: normal; text-align: center; }
.snake-perk .kbd { align-self: center; }
@media (max-width: 700px) {
  .snake-perk-list { grid-template-columns: 1fr; }
  .snake-perk { min-height: 0; }
  .snake-hud { flex-wrap: wrap; row-gap: 4px; }
  .snake-hud > .grow { order: 9; flex: 1 1 100%; }
}
.snake-canvas { border: 3px solid var(--copper-dk); box-shadow: 0 4px 0 #000; image-rendering: pixelated; touch-action: none; background: #2a2622; }
.snake-pad { display: none; grid-template-columns: repeat(3, 56px); grid-template-rows: repeat(2, 48px); gap: 6px; }
.snake-pad .btn { font-size: 20px; padding: 0; min-height: 0; }
.snake-pad .snake-up { grid-column: 2; grid-row: 1; }
.snake-pad .snake-left { grid-column: 1; grid-row: 2; }
.snake-pad .snake-down { grid-column: 2; grid-row: 2; }
.snake-pad .snake-right { grid-column: 3; grid-row: 2; }
@media (pointer: coarse), (max-width: 700px) { .snake-pad { display: grid; } }
/* the patrol */
.patrol-routes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.patrol-route { display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; padding: 10px 6px; text-align: center; }
.patrol-route.selected { border-color: var(--teal); box-shadow: inset 0 3px 0 var(--teal); }
.patrol-route-icon { font-size: 28px; }
/* the gauntlet */
.gaunt-floors { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.gaunt-floor { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; background: rgba(20, 15, 24, 0.85); border: 2px solid var(--line); min-width: 0; }
.gaunt-floor b { font-family: var(--font-title); font-size: 18px; }
.gaunt-floor.done { border-color: var(--teal); opacity: 0.75; }
.gaunt-floor.now { border-color: var(--gold); box-shadow: 0 0 12px rgba(245, 197, 66, 0.35); }
.gaunt-floor.boss b { color: var(--team-red); }
.gaunt-team { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.gaunt-hero { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; }
.gaunt-hero .bar { width: 100%; }
.gaunt-hero.fallen canvas, .gaunt-hero.fallen img { filter: grayscale(1) brightness(0.55); }
.gaunt-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; }
.gaunt-choice { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; cursor: pointer; padding: 12px 10px; }
.gaunt-choice:hover:not([disabled]) { border-color: var(--gold); }
.gaunt-choice[disabled] { opacity: 0.5; cursor: default; }
.gaunt-choice-icon { font-size: 30px; }
.chip.relic { background: rgba(126, 87, 194, 0.25); border-color: #9a7ad8; }
@media (max-width: 700px) {
  .gaunt-floor span { display: none; }
  .gaunt-team { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.bracket-match .bracket-watch { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); min-height: 0; min-width: 0; padding: 3px; }
.cup.running { box-shadow: inset 3px 0 0 var(--teal); }
.cup.done, .cup.cancelled { opacity: 0.75; }

/* The online status bar in a game (the other player left, reconnecting) */
.online-status { position: absolute; left: 50%; top: 58px; transform: translateX(-50%); z-index: 7; display: flex; gap: 8px; align-items: center; padding: 6px 10px; font-size: var(--fs-s); background: rgba(20, 15, 24, 0.94); border: 2px solid var(--copper-dk); box-shadow: 0 4px 0 #000; max-width: 94vw; }
.online-status.hidden { display: none; }
.chronicle .chron-chat { margin-top: 6px; }
.chronicle .chron-chat .input { min-height: 32px; padding: 3px 8px; }
.chronicle .log .chat { font-weight: 700; }
/* voice chat: my microphone, the other player's state, a glow while they talk */
.chronicle .chron-voice { display: flex; flex-direction: column; gap: 4px; padding: 4px 6px; margin-bottom: 6px; border: 2px solid rgba(255, 255, 255, 0.12); border-radius: 4px; }
.chron-voice .vrow { display: flex; align-items: center; gap: 6px; min-height: 28px; }
.chron-voice .vpeer.talking { color: var(--teal); }
.chron-voice .vpeer.talking canvas { filter: drop-shadow(0 0 3px var(--teal)); }
.chron-voice .btn.muted-mic { border-color: var(--bad); }
.btn.voice-talk { box-shadow: 0 0 0 2px var(--teal), 0 0 10px var(--teal); }

/* Invitations (top of the screen, over everything but windows) */
#layer-pop { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 25; display: flex; flex-direction: column; gap: 8px; width: min(380px, 94vw); pointer-events: none; }
#layer-pop > * { pointer-events: auto; }
.invite-pop { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; animation: pop-in 0.25s ease-out; }
.invite-bar { height: 6px; }
@keyframes pop-in { from { transform: translateY(-12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* The chat dock (full screen on phones) */
#layer-dock { position: fixed; right: 12px; bottom: 12px; z-index: 15; pointer-events: none; }
#layer-dock > * { pointer-events: auto; }
.chat-dock { width: min(360px, 94vw); height: min(480px, 70vh); display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; }
.chat-head { flex: none; }
.chat-older { align-self: center; flex: none; }
.chat-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; padding: 4px; background: var(--inset); border: 2px solid #000; -webkit-user-select: text; user-select: text; }
.chat-day { margin: 6px 0 2px; }
.chat-msg { align-self: flex-start; max-width: 82%; padding: 5px 8px; font-size: var(--fs-s); background: var(--panel-3); border: 2px solid #000; border-radius: 2px 10px 10px 10px; overflow-wrap: anywhere; }
.chat-msg.mine { align-self: flex-end; background: #1d4a40; border-radius: 10px 2px 10px 10px; }
.chat-emote { font-size: 26px; line-height: 1.1; }
.chat-meta { display: flex; gap: 4px; justify-content: flex-end; align-items: center; margin-top: 2px; }
.chat-unsend { background: none; border: none; color: var(--muted); cursor: pointer; font: inherit; padding: 0 2px; }
.chat-unsend:hover { color: var(--bad); }
.chat-send { flex: none; }
.chat-send .input { min-height: 34px; }
@media (max-width: 700px) {
  #layer-dock { inset: 0; }
  .chat-dock { width: 100%; height: 100%; }
}

/* 2v2: which teammate plays a champion */
.dr-owner { position: absolute; left: 2px; right: 2px; bottom: 1px; font-size: 9px; line-height: 1.1; color: var(--text-2); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 0 #000; pointer-events: none; }
.dr-owner.me { color: var(--teal); }

/* ------------------------------------------------ match stats (ui/match-stats.js) */

.ms { display: flex; flex-direction: column; gap: 14px; }
.ms .s0 { --side: var(--blue); --side-hi: var(--blue-hi); }
.ms .s1 { --side: var(--team-red); --side-hi: var(--team-red-hi); }
.ms-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ms-result { font-family: var(--font-title); font-size: calc(16px * var(--ui-scale)); line-height: 1.4; }
.ms-sec { display: flex; flex-direction: column; gap: 8px; }
.ms-sec > .h2 { margin: 0; }
.ms-ico { width: 14px; height: 14px; vertical-align: -2px; image-rendering: pixelated; flex: none; }
.ms-pic { position: relative; display: inline-grid; place-items: center; flex: none; background: radial-gradient(circle at 50% 38%, #3e3448, #1d1724 75%); border: 2px solid #000; box-shadow: inset 0 0 0 1px var(--side, var(--copper-dk)); }
.ms-pic canvas { display: block; image-rendering: pixelated; }
.ms-pic.dead canvas, .mh-hero.dead > canvas { filter: grayscale(1) brightness(0.75); opacity: 0.8; }
.ms-pic.empty { width: 44px; height: 44px; color: var(--muted); }
/* momentum */
.ms-chips { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; }
.ms-chip { display: flex; flex-direction: column; gap: 1px; min-width: 0; padding: 4px 8px; background: var(--well, rgba(0, 0, 0, 0.25)); border: 2px solid var(--line); box-shadow: inset 3px 0 0 var(--side, var(--gold)); }
.ms-chip b { color: var(--side-hi, var(--text)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-chip small { font-size: var(--fs-xs); color: var(--muted); }
.ms-chip.mid { align-items: center; text-align: center; box-shadow: none; }
.ms-chip.mid b { color: var(--gold); font-size: 22px; }
.ms-plot { --text: #ece3d6; --muted: #8d7f72; position: relative; height: 190px; margin-right: 34px; color: var(--text); background: linear-gradient(180deg, #161224, #0b0a12); border: 2px solid #000; box-shadow: inset 0 0 0 1px var(--line); touch-action: pan-y; cursor: crosshair; }
.ms-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ms-stop.s0.hi { stop-color: var(--blue); stop-opacity: 0.55; }
.ms-stop.s0.lo { stop-color: var(--blue); stop-opacity: 0.05; }
.ms-stop.s1.hi { stop-color: var(--team-red); stop-opacity: 0.55; }
.ms-stop.s1.lo { stop-color: var(--team-red); stop-opacity: 0.05; }
.ms-mid { stroke: rgba(255, 255, 255, 0.35); stroke-width: 1; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.ms-tp { stroke: var(--gold); stroke-width: 1.5; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.ms-line { fill: none; stroke: #fff; stroke-width: 2; vector-effect: non-scaling-stroke; }
.ms-line-shadow { fill: none; stroke: #000; stroke-width: 5; opacity: 0.6; vector-effect: non-scaling-stroke; }
.ms-tick { stroke: rgba(255, 255, 255, 0.25); stroke-width: 1; vector-effect: non-scaling-stroke; }
.ms-tag { position: absolute; left: 8px; font-size: var(--fs-xs); color: var(--side-hi); text-shadow: 0 1px 0 #000; pointer-events: none; }
.ms-tag.top { top: 6px; }
.ms-tag.bottom { bottom: 10px; }
.ms-even { position: absolute; right: 8px; top: 50%; transform: translateY(-120%); font-size: var(--fs-xs); color: var(--muted); pointer-events: none; }
.ms-end { position: absolute; right: -4px; transform: translate(100%, -50%); padding: 0 4px; font-family: var(--font-num); font-size: 18px; line-height: 1.2; color: #fff; background: #2a2433; border: 2px solid #000; pointer-events: none; }
.ms-end.s0 { background: var(--blue); }
.ms-end.s1 { background: var(--team-red); }
.ms-pin { position: absolute; width: 0; height: 0; pointer-events: none; }
.ms-pin-dot { position: absolute; left: -5px; top: -5px; width: 10px; height: 10px; background: var(--gold); border: 2px solid #000; transform: rotate(45deg); }
.ms-flag { position: absolute; left: 8px; bottom: 6px; white-space: nowrap; padding: 1px 5px; font-size: var(--fs-xs); color: #1c1206; background: var(--gold); border: 2px solid #000; }
.ms-pin.left .ms-flag { left: auto; right: 8px; }
.ms-pin.below .ms-flag { bottom: auto; top: 6px; }
.ms-plot.hovering .ms-pin { opacity: 0.45; }
.ms-cursor { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px solid rgba(255, 255, 255, 0.6); pointer-events: none; }
.ms-cursor-dot { position: absolute; left: -5px; width: 10px; height: 10px; margin-top: -5px; background: #fff; border: 2px solid #000; }
.ms-tip { position: absolute; top: 8px; z-index: 2; width: max-content; max-width: min(280px, 70vw); display: flex; flex-direction: column; gap: 4px; padding: 6px 8px; font-size: var(--fs-s); color: #ece3d6; background: rgba(16, 12, 22, 0.96); border: 2px solid #000; box-shadow: inset 0 0 0 1px var(--copper-dk), 0 4px 0 rgba(0, 0, 0, 0.5); pointer-events: none; }
.ms-tip-head { display: flex; justify-content: space-between; gap: 10px; }
.ms-lead { color: #c8c2d4; }
.ms-lead.s0 { color: #8cc0ff; }
.ms-lead.s1 { color: #ff9a9a; }
.ms-tip-move { display: flex; align-items: center; gap: 6px; }
.ms-tip-move .ms-pic { border-width: 1px; }
.ms-tip-why { color: #f5c542; }
.ms-tip-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; border-top: 1px solid rgba(255, 255, 255, 0.15); padding-top: 4px; }
.ms-tip-sides > div { display: flex; flex-direction: column; min-width: 0; }
.ms-tip-sides b { font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-tip-sides .s0 b { color: #8cc0ff; }
.ms-tip-sides .s1 b { color: #ff9a9a; }
.ms-tip-sides small { font-size: var(--fs-xs); color: #b4ac9b; }
.ms-hint { position: absolute; right: 8px; bottom: 10px; color: var(--muted); pointer-events: none; }
.ms-plot.hovering .ms-hint { display: none; }
.ms-turns { position: relative; height: 16px; margin-right: 34px; }
.ms-turns span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.ms-turns span:first-child { transform: none; }
.ms-turns span:last-child { transform: translateX(-100%); }
.ms-note { margin: 0; color: var(--gold); }
/* highlights */
.ms-awards { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.ms-award { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 4px; text-align: center; background: var(--well, rgba(0, 0, 0, 0.22)); border: 2px solid var(--line); box-shadow: inset 0 3px 0 var(--side, var(--line)); min-width: 0; }
.ms-award-top { display: flex; align-items: center; gap: 4px; color: var(--text-2); }
.ms-award-n { font-size: 26px; color: var(--side-hi, var(--text)); }
.ms-award small { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* team against team */
.ms-vs { display: flex; align-items: center; justify-content: center; gap: 12px; }
.ms-vs .s0 { color: var(--blue-hi); }
.ms-vs .s1 { color: var(--team-red-hi); }
.ms-tugs { display: flex; flex-direction: column; gap: 4px; }
.ms-tug { display: grid; grid-template-columns: minmax(110px, 160px) 56px minmax(0, 1fr) 56px; align-items: center; gap: 8px; }
.ms-tug.zero { opacity: 0.45; }
.ms-tug-label { display: flex; align-items: center; gap: 5px; color: var(--text-2); }
.ms-n { font-size: 20px; }
.ms-n.s0 { text-align: right; color: var(--blue-hi); }
.ms-n.s1 { color: var(--team-red-hi); }
.ms-n { display: inline-flex; align-items: center; gap: 3px; }
.ms-n.s0 { justify-content: flex-end; }
/* the side ahead on that number: a gold crown, before the number on the blue side and after it on the red */
.ms-n.s0.lead::before, .ms-n.s1.lead::after { content: ''; flex: none; width: 15px; height: 13px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 20'%3E%3Cpath d='M2 6l5 4.5L12 2l5 8.5L22 6l-2 11H4z' fill='%23f5c542' stroke='%23000' stroke-width='1.6' stroke-linejoin='round'/%3E%3Cpath d='M4.6 14.5h14.8' stroke='%23b8862b' stroke-width='1.4'/%3E%3Ccircle cx='12' cy='2.4' r='1.6' fill='%23f5c542' stroke='%23000' stroke-width='1'/%3E%3C/svg%3E") center / contain no-repeat; }
.ms-tug-bar { display: flex; height: 12px; background: #0b080d; border: 2px solid #000; overflow: hidden; }
.ms-tug-bar i { display: block; height: 100%; }
.ms-tug-bar i.s0 { background: var(--blue); }
.ms-tug-bar i.s1 { background: var(--team-red); }
/* every champion */
.ms-legend { display: flex; flex-wrap: wrap; gap: 10px; color: var(--text-2); }
.ms-key { display: inline-flex; align-items: center; gap: 4px; }
.ms-key i { width: 12px; height: 10px; border: 1px solid #000; }
.ms-key.basic i, .ms-dmgbar i.basic { background: #c8c2d4; }
.ms-key.skill i, .ms-dmgbar i.skill { background: #3fe0b8; }
.ms-key.ult i, .ms-dmgbar i.ult { background: #f5a623; }
.ms-key.other i, .ms-dmgbar i.other { background: #b56cff; }
.ms-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ms-side { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ms-side-head { font-weight: 700; color: var(--side-hi); box-shadow: inset 0 -2px 0 var(--side); padding-bottom: 2px; }
.ms-hero { display: flex; gap: 8px; align-items: center; min-width: 0; }
.ms-hero.dead .ms-hero-name b:first-child { text-decoration: line-through; opacity: 0.7; }
.ms-hero-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ms-hero-name { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.ms-hero-name b:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-hero-dmg { margin-left: auto; font-size: 20px; color: var(--side-hi); }
.ms-dmgbar { display: flex; height: 14px; background: #0b080d; border: 2px solid #000; overflow: hidden; }
.ms-dmgbar i { display: grid; place-items: center; height: 100%; font-style: normal; font-family: var(--font-num); font-size: 14px; line-height: 1; color: #1c1206; overflow: hidden; }
.ms-minis { display: flex; flex-wrap: wrap; gap: 4px 8px; color: var(--text-2); }
.ms-mini { display: inline-flex; align-items: center; gap: 3px; }
.ms-mini.zero { opacity: 0.4; }
@media (max-width: 700px) {
  .ms-awards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ms-sides { grid-template-columns: 1fr; }
  .ms-tug { grid-template-columns: 84px 40px minmax(0, 1fr) 40px; gap: 4px; }
  .ms-n { font-size: 17px; }
  .ms-plot { height: 160px; }
  .ms-chips { grid-template-columns: 1fr 1fr; }
  .ms-chip.mid { grid-column: span 2; grid-row: 2; flex-direction: row; gap: 6px; justify-content: center; }
  .ms-hint { display: none; }
}

/* ------------------------------------------------ the match history's details (profile) */

.mh-row { cursor: pointer; }
.mh-unit { position: relative; display: inline-block; line-height: 0; }
.mh-unit.dead canvas { filter: grayscale(1) brightness(0.6); opacity: 0.75; }
.mh-unit.mvp canvas { filter: drop-shadow(0 0 3px var(--gold)); }
.mh-unit.mvp.dead canvas { filter: grayscale(1) brightness(0.6) drop-shadow(0 0 3px var(--gold)); }
.mh-medal { position: absolute; right: -6px; bottom: -6px; line-height: 0; filter: drop-shadow(0 1px 0 #000); }
.mh-row .mh-chev { flex: none; color: var(--muted); transition: transform 0.15s; }
.mh-row.open { border-color: var(--teal); }
.mh-row.open .mh-chev { transform: rotate(180deg); color: var(--teal); }
.mh-detail { margin: -2px 0 4px; display: flex; flex-direction: column; gap: 8px; animation: fade-in 0.15s ease-out; }
.mh-detail .s0 { --side: var(--blue); --side-hi: var(--blue-hi); }
.mh-detail .s1 { --side: var(--team-red); --side-hi: var(--team-red-hi); }
.mh-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.mh-head .chip { gap: 4px; }
.mh-teams { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mh-team { display: flex; flex-direction: column; gap: 4px; padding: 6px 8px; background: var(--well, rgba(0, 0, 0, 0.18)); border: 2px solid var(--line); box-shadow: inset 0 3px 0 var(--side); min-width: 0; }
.mh-team.won { border-color: var(--gold); }
.mh-team-head { display: flex; align-items: center; gap: 6px; color: var(--side-hi); }
.mh-hero { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 6px; }
.mh-hero.dead .mh-hero-name b { text-decoration: line-through; opacity: 0.7; }
.mh-hero canvas { image-rendering: pixelated; }
.mh-hero-name { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.mh-hero-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mh-mvp { padding: 0 4px; color: #1c1206; background: var(--gold); border: 1px solid #000; }
.mh-nums, .mh-total { display: flex; gap: 8px; align-items: center; }
.mh-nums span, .mh-total span { display: inline-flex; align-items: center; gap: 3px; }
.mh-total { justify-content: flex-end; padding-top: 4px; border-top: 1px solid var(--line); flex-wrap: wrap; }
@media (max-width: 700px) {
  .mh-teams { grid-template-columns: 1fr; }
  .mh-row { flex-wrap: wrap; }
  .mh-row > .row.grow { order: 9; flex: 1 1 100%; }
}

/* The patrol at a glance (ui/patrol-widget.js): bottom right, on the screens that aren't the patrol's */
.patrol-widget { position: fixed; right: calc(12px + var(--safe-r)); bottom: calc(12px + var(--safe-b)); z-index: 14; width: min(250px, calc(100vw - 24px)); display: flex; flex-direction: column; gap: 3px; padding: 5px 8px; text-align: left; color: var(--text); font: inherit; cursor: pointer; box-shadow: 0 4px 0 rgba(0, 0, 0, 0.45); }
.patrol-widget:hover { border-color: var(--teal); }
.pw-head { display: flex; justify-content: space-between; gap: 8px; }
.pw-row { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; align-items: center; gap: 6px; }
.pw-row .bar { height: 10px; }
.pw-row .bar > b { font-size: 13px; }
.pw-row.s0 .pw-name { color: var(--blue-hi); }
.pw-row.s1 .pw-name { color: var(--team-red-hi); }
.pw-foot { text-align: right; }
.bar.hp.team.mine > i { background: linear-gradient(180deg, #8cc0ff, #3b82f6); }
.bar.hp.team.theirs > i { background: linear-gradient(180deg, #ff9a9a, #c8342c); }

/* The replay controls (match.js): over the board, as wide as the screen allows */
.replay-bar { position: absolute; left: 50%; transform: translateX(-50%); top: 58px; z-index: 6; padding: 4px 8px; max-width: calc(100vw - 12px); flex-wrap: wrap; gap: 6px; justify-content: center; }
/* the replay's timeline: a mark per move, in the side's colour; a skull where someone fell */
.replay-timeline { flex: 1 1 100%; width: min(900px, calc(100vw - 40px)); overflow-x: auto; overflow-y: hidden; background: rgba(0, 0, 0, 0.35); box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.6); scrollbar-width: thin; }
/* the old Eriband's replay line: blue moves above the axis, red below, the fallen on the outer rows */
.tl-track { position: relative; height: 104px; margin: 0 14px; }
.tl-zone { position: absolute; top: 0; bottom: 0; border-left: 2px dashed rgba(255, 246, 220, 0.22); }
.tl-zone:first-child { border-left: 0; }
.tl-zone span { position: absolute; z-index: 2; top: 50%; left: 4px; transform: translateY(-50%); padding: 1px 4px; font-size: 8px; line-height: 1.2; color: #f6e2b4; background: rgba(0, 0, 0, 0.7); border: 1px solid rgba(255, 246, 220, 0.25); white-space: nowrap; pointer-events: none; }
.tl-zone.draft { background: rgba(120, 140, 255, 0.07); }
.tl-zone.place { background: rgba(242, 193, 78, 0.1); }
.tl-zone.battle { background: rgba(208, 70, 60, 0.08); }
.tl-axis { position: absolute; left: -14px; right: -14px; top: 50%; height: 6px; margin-top: -3px; background: repeating-linear-gradient(90deg, #6b4a2e 0 12px, #3d2a1b 12px 14px); box-shadow: 0 0 0 2px #000; }
.tl-head { position: absolute; top: 0; bottom: 0; z-index: 4; width: 4px; margin-left: -2px; background: linear-gradient(#ffe48a, var(--gold)); box-shadow: 0 0 0 1px #000, 0 0 10px var(--gold); pointer-events: none; transition: left 0.15s; }
.tl-head::before, .tl-head::after { content: ''; position: absolute; left: 50%; width: 10px; height: 10px; margin-left: -5px; background: var(--gold); box-shadow: 0 0 0 1px #000; transform: rotate(45deg); }
.tl-head::before { top: -5px; }
.tl-head::after { bottom: -5px; }
.tl-mark { position: absolute; z-index: 3; width: 24px; height: 24px; min-width: 0; min-height: 0; margin-left: -12px; padding: 1px; background: #2a2230; border: 2px solid #6b6478; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.5); cursor: pointer; opacity: 0.55; }
.tl-mark canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.tl-mark.s0 { top: 20px; }
.tl-mark.s1 { bottom: 20px; }
/* the stick to the axis, in the team's colour */
.tl-mark::after { content: ''; position: absolute; left: 50%; width: 2px; height: 5px; margin-left: -1px; pointer-events: none; }
.tl-mark.s0::after { top: 100%; margin-top: 2px; background: var(--blue); }
.tl-mark.s1::after { bottom: 100%; margin-bottom: 2px; background: var(--team-red); }
.tl-mark.k-atk { border-color: #e0453c; }
.tl-mark.k-skl { border-color: #a070ff; }
.tl-mark.k-ult { border-color: #ff8a1e; box-shadow: 0 0 8px rgba(255, 138, 30, 0.8); }
.tl-mark.k-mov { border-color: #5fcf6e; }
.tl-mark.k-place { border-color: var(--gold); }
.tl-mark.k-def { border-color: #9fe6ff; }
.tl-mark.k-pick { border-color: #f6e2b4; }
.tl-mark.k-ban { border-color: #3a3a3a; }
.tl-mark.k-ban canvas { filter: grayscale(1) brightness(0.6); }
.tl-mark.past { opacity: 0.8; }
.tl-mark.has-kill { box-shadow: 0 0 0 2px #ff3b3b, 0 0 10px rgba(255, 59, 59, 0.8); }
.tl-mark.now { z-index: 5; opacity: 1; transform: scale(1.3); box-shadow: 0 0 0 2px #fff, 0 0 12px var(--gold); }
.tl-mark:hover, .tl-mark:focus-visible, .tl-victim:hover, .tl-victim:focus-visible { opacity: 1; z-index: 6; transform: scale(1.2); }
.tl-glyph { display: grid; place-items: center; height: 100%; font-size: 13px; line-height: 1; color: #f6e2b4; }
.tl-ban { position: absolute; inset: 0; display: grid; place-items: center; font-size: 16px; font-style: normal; color: #ff5a5a; text-shadow: 0 1px 0 #000; pointer-events: none; }
.tl-ult { position: absolute; top: -10px; right: -9px; font-size: 11px; font-style: normal; filter: drop-shadow(1px 1px 0 #000); pointer-events: none; }
.tl-victim { position: absolute; z-index: 2; width: 18px; height: 18px; min-width: 0; min-height: 0; margin-left: -9px; padding: 1px; background: #1d1724; border: 2px solid; opacity: 0.4; cursor: pointer; }
.tl-victim canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.tl-victim.s0 { top: 0; border-color: var(--blue); }
.tl-victim.s1 { bottom: 0; border-color: var(--team-red); }
.tl-victim.seen { opacity: 0.85; }
.tl-victim i { position: absolute; right: -6px; bottom: -5px; font-size: 9px; font-style: normal; color: #fff; text-shadow: 0 1px 0 #000, 0 0 2px #000; pointer-events: none; }
.narrow .replay-timeline { width: auto; }
.narrow .tl-track { height: 84px; }
.narrow .tl-mark { width: 20px; height: 20px; margin-left: -10px; }
.narrow .tl-mark.s0 { top: 16px; }
.narrow .tl-mark.s1 { bottom: 16px; }
.narrow .tl-victim { width: 15px; height: 15px; margin-left: -7px; }
.replay-bar .replay-range { width: min(40vw, 260px); min-width: 60px; flex: 1 1 auto; }
.narrow .replay-bar { width: calc(100vw - 12px); top: 54px; }
.narrow .replay-bar .btn.small { min-width: 38px; padding: 2px 6px; }
.narrow .replay-bar .btn .kbd { display: none; }

/* ------------------------------------------------ looks (meta/cosmetics.js): faction frames, the Looks tab */

.playercard.frame-order, .card.frame-order, .look-frame.frame-order { box-shadow: 0 0 0 2px #fff6dc, 0 0 0 4px #d9b45a, 0 0 12px rgba(245, 197, 66, 0.45); }
.playercard.frame-wild, .card.frame-wild, .look-frame.frame-wild { box-shadow: 0 0 0 2px #2f7a3a, 0 0 0 4px #7fd35f, 0 0 12px rgba(95, 191, 74, 0.45); }
.playercard.frame-arcane, .card.frame-arcane, .look-frame.frame-arcane { box-shadow: 0 0 0 2px #4a2a8a, 0 0 0 4px #b48cff, 0 0 14px rgba(181, 108, 255, 0.55); }
.playercard.frame-shadow, .card.frame-shadow, .look-frame.frame-shadow { box-shadow: 0 0 0 2px #0c0a10, 0 0 0 4px #8a4b9a, 0 0 14px rgba(60, 20, 80, 0.8); }
.look-card .look-pic { display: grid; place-items: center; width: 72px; height: 72px; }
.look-emoji { font-size: 40px; line-height: 1; }
.look-frame { display: block; width: 52px; height: 36px; background: linear-gradient(160deg, #3a3044, #1d1724); border: 2px solid #000; }

/* A live event (meta/events.js): the corner box on wide screens, one line above the logo on phones */
.event-chip { display: none; padding: 2px 10px; background: rgba(10, 7, 12, 0.8); border: 2px solid var(--gold); text-align: center; }
@media (max-width: 700px) {
  .event-chip { display: block; }
  .menu-corner.br .event-box { display: none; }
}

/* The profile's numbers per mode (profile.js record) */
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
.stat-tile { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 2px; background: var(--well, rgba(0, 0, 0, 0.22)); border: 2px solid var(--line); text-align: center; min-width: 0; }
.stat-tile b { font-size: 22px; line-height: 1; }
.role-row { display: grid; grid-template-columns: 84px minmax(0, 1fr) 36px; align-items: center; gap: 6px; }
.role-row .bar { height: 8px; }

/* Saved teams (profile > Teams) */
.team-slots { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.team-slot { aspect-ratio: 1; display: grid; place-items: center; padding: 0; background: var(--inset); border: 2px dashed var(--line); cursor: pointer; }
.team-slot.filled { border-style: solid; border-color: #000; background: radial-gradient(circle at 50% 38%, #3e3448, #1d1724 75%); }
.team-slot canvas { width: 80%; height: 80%; image-rendering: pixelated; }
.team-row canvas { image-rendering: pixelated; }

/* The emote wheel (match.js): a sphere around your mascot, the 12 emotes on its rim */
.modal-back:has(.emote-wheel-modal) { background: rgba(5, 3, 7, 0.25); }
.modal.emote-wheel-modal { width: auto; background: none; border: 0; border-image: none; box-shadow: none; padding: 0; }
.modal.emote-wheel-modal::before, .modal.emote-wheel-modal::after { display: none; }
.emote-wheel-modal .modal-body { overflow: visible; padding: 0; }
.emote-wheel {
  position: relative; width: 236px; height: 236px; border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0) 34%),
    radial-gradient(circle at 50% 50%, #3d3150 0, #2a2238 52%, #17121f 100%);
  box-shadow: 0 0 0 3px #000, 0 0 0 5px rgba(255, 246, 220, 0.18), inset -14px -18px 30px rgba(0, 0, 0, 0.55), inset 6px 8px 16px rgba(255, 255, 255, 0.06), 0 10px 24px rgba(0, 0, 0, 0.55);
  animation: wheel-in 0.16s ease-out;
}
@keyframes wheel-in { from { transform: scale(0.4); opacity: 0; } to { transform: none; opacity: 1; } }
.emote-orb {
  position: absolute; width: 44px; height: 44px; margin: -22px 0 0 -22px; padding: 0;
  display: grid; place-items: center; font-size: 25px; line-height: 1;
  background: none; border: 0; border-radius: 50%; cursor: pointer;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.6)); transition: transform 0.1s;
}
.emote-orb:hover, .emote-orb:focus-visible { transform: scale(1.4); background: radial-gradient(circle, rgba(242, 193, 78, 0.45), rgba(242, 193, 78, 0) 70%); outline: none; }
.emote-hub {
  position: absolute; left: 50%; top: 50%; width: 92px; height: 92px; margin: -46px 0 0 -46px; padding: 6px;
  display: grid; place-items: center; text-align: center; font: inherit; font-size: 10px; line-height: 1.2; color: #f6e2b4;
  border: 0; border-radius: 50%; cursor: pointer;
  background: radial-gradient(circle at 40% 35%, #2e2539, #120e18);
  box-shadow: 0 0 0 2px #000, inset 0 0 0 2px rgba(255, 246, 220, 0.12);
}
.emote-hub:hover, .emote-hub:focus-visible { color: #fff; outline: none; box-shadow: 0 0 0 2px #000, inset 0 0 0 2px var(--gold); }
.mascot-btn { padding: 0; background: none; border: 0; border-radius: 6px; cursor: pointer; }
.mascot-btn:hover, .mascot-btn:focus-visible { outline: 2px dashed rgba(242, 193, 78, 0.8); outline-offset: -2px; }

/* The game's cursors (platform/cursors.js; Settings > Display). Without them: the system's. */
.game-cursors body { cursor: var(--cur-arrow), auto; }
.game-cursors :is(button, a, select, summary, label, [role="tab"], .toggle, input[type="range"], input[type="checkbox"], .champ-tile, .card, .list-item):not(:disabled) { cursor: var(--cur-hand), pointer; }
.game-cursors :is(button, .champ-tile, .card):disabled, .game-cursors .champ-tile.disabled { cursor: var(--cur-arrow), not-allowed; }
.game-cursors :is(input[type="text"], input[type="email"], input[type="password"], input:not([type]), textarea) { cursor: text; }
.game-cursors [data-tip]:not(button):not(.cell-btn) { cursor: var(--cur-look), help; }
.game-cursors .cell-btn:disabled, .game-cursors .cell-btn[data-cur=""] { cursor: var(--cur-arrow), default; }
.game-cursors .cell-btn[data-cur="hand"] { cursor: var(--cur-hand), pointer; }
.game-cursors .cell-btn[data-cur="look"] { cursor: var(--cur-look), help; }
.game-cursors .cell-btn[data-cur="sword"] { cursor: var(--cur-sword), crosshair; }
.game-cursors .cell-btn[data-cur="wand"] { cursor: var(--cur-wand), pointer; }
.game-cursors .cell-btn[data-cur="ult"] { cursor: var(--cur-ult), pointer; }
.game-cursors .cell-btn[data-cur="boot"] { cursor: var(--cur-boot), pointer; }
.game-cursors .cell-btn[data-cur="ally"] { cursor: var(--cur-ally), pointer; }
.game-cursors .cell-btn[data-cur="place"] { cursor: var(--cur-place), pointer; }
.game-cursors .ms-plot { cursor: var(--cur-look), crosshair; }
/* the walking boots over a square to move to (platform/cursors.js) */
.walk-cursor { position: fixed; left: 0; top: 0; z-index: 100000; width: 32px; height: 32px; pointer-events: none; image-rendering: pixelated; }
.walking .cell-btn[data-cur="boot"] { cursor: none; }

/* the docked chronicle's grip (drag to resize, double click to reset) */
.chron-grip { display: none; }
.chronicle.docked { position: absolute; }
.chronicle.docked .chron-grip { display: grid; place-items: center; position: absolute; left: 50%; top: -9px; width: 72px; height: 14px; margin-left: -36px; z-index: 2; cursor: ns-resize; touch-action: none;
  background: #17121f; border: 2px solid #000; box-shadow: 0 0 0 1px rgba(255, 246, 220, 0.15); }
.chronicle.docked .chron-grip i { width: 34px; height: 4px; background: repeating-linear-gradient(90deg, var(--copper-hi) 0 4px, transparent 4px 7px); }
.chronicle.docked .chron-grip:hover i { background: repeating-linear-gradient(90deg, var(--gold) 0 4px, transparent 4px 7px); }
.game-cursors .chronicle.docked .chron-grip { cursor: ns-resize; }
/* "X's Ultimate is ready" and the auto fight lines */
.chronicle .log .lg.lg-ultready { padding: 1px 8px; color: #ffe2b0; background: linear-gradient(90deg, rgba(255, 154, 60, 0.22), rgba(255, 211, 107, 0.06) 70%); border-left-color: #ffb15e; }
.chronicle .log .lg.lg-ultready .lg-txt::before { content: '⚡ '; }
.chronicle .log .lg.lg-auto { padding: 2px 8px; font-weight: 700; color: #e8fbff; text-shadow: 1px 1px 0 #0a3a48;
  background: repeating-linear-gradient(90deg, rgba(42, 138, 160, 0.55) 0 10px, rgba(47, 150, 173, 0.55) 10px 20px); border-left-color: #7ff0ff; }
.chronicle .log .lg.lg-auto .lg-txt::before { content: '🤖 '; }
.chronicle .log .lg.lg-warn[data-tip] { cursor: help; }
.game-cursors .chronicle .log .lg.lg-warn[data-tip] { cursor: var(--cur-look), help; }
/* the sudden death bubble */
.sd-tip { display: flex; flex-direction: column; gap: 3px; min-width: 220px; }
.sd-head { display: flex; align-items: center; gap: 6px; color: #ffd36b; }
.sd-skull { font-size: 18px; }
.sd-step { display: flex; justify-content: space-between; gap: 12px; padding: 1px 6px; font-size: 12px; background: rgba(229, 72, 77, 0.1); border-left: 3px solid rgba(229, 72, 77, 0.5); }
.sd-step b { color: #ff8a80; font-family: var(--font-num); font-size: 15px; font-weight: normal; }
.sd-step.now { background: rgba(229, 72, 77, 0.3); border-left-color: #ff4a3a; }
/* the game's length at the end */
.res-length { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-family: var(--font-num); font-size: 18px; }
.res-length canvas, .res-length img { width: 16px; height: 16px; image-rendering: pixelated; }

/* Big desktop windows: with Settings > Display > "Screens in a window" (.screen-box), every screen (but
   the menu, a match and the snake) is one centred window over the city, the city dimmed around it, its
   head a band; with it off, the panels alone. Either way the content is centred */
@media (min-width: 1100px) and (min-height: 620px) {
  .screen-box .screen.win {
    inset: calc(14px + var(--safe-t)) 0 calc(14px + var(--safe-b));
    width: min(1240px, calc(100vw - 56px));
    margin: 0 auto;
    background: rgba(20, 15, 24, 0.95);
    border: 3px solid #000;
    box-shadow: inset 0 0 0 2px var(--copper-dk), inset 0 0 0 4px #000, 0 0 0 100vmax rgba(8, 6, 12, 0.42), 0 14px 40px rgba(0, 0, 0, 0.6);
  }
  .screen-box .screen.win > .screen-head {
    padding: 10px 20px;
    min-height: 64px;
    background: linear-gradient(rgba(46, 33, 44, 0.95), rgba(28, 20, 32, 0.95));
    border-bottom: 2px solid var(--copper-dk);
    box-shadow: 0 2px 0 #000;
    margin-bottom: 10px;
  }
  .screen-box .screen.win .screen-body { padding: 8px 28px 26px; }
  .screen-box .screen.win .screen-foot { border-top: 2px solid var(--copper-dk); background: rgba(28, 20, 32, 0.9); }
  .screen.win .grid.wide { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
  /* the menu's lower panels and a match's rosters come in from the edges, around a centred column */
  .menu-corner.bl { left: max(12px, calc(50% - 720px)); }
  .menu-corner.br { right: max(12px, calc(50% - 720px)); }
  .roster.left { left: max(8px, calc(50% - 720px)); }
  .roster.right { right: max(8px, calc(50% - 720px)); }
  .draft-layer .dr { width: min(1480px, 100%); margin: 0 auto; }
  /* the hub page (inde2.html): its bars stay full width, the windows and its home sit centred between them */
  .screen-box.hub-bar-on #app > .screen.win { top: calc(var(--safe-t) + var(--hub-bar-h) + 14px); bottom: calc(var(--safe-b) + var(--hub-bottom-h) + 14px); }
  .hub-bar-on #app > .screen-menu.hub { left: 0; right: 0; width: min(1480px, 100%); margin: 0 auto; }
}
