/* Heading face from blitsgames.com (their @font-face "Logo Font" -> Mister-Belvedere-Oblique.ttf). */
@font-face {
  font-family: 'Mister Belvedere Oblique';
  src: url('fonts/Mister-Belvedere-Oblique.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* BLits palette: black / white / greys taken from blitsgames.com computed styles. */
:root {
  --bg: #000000;
  --bg-glow: url("img/site-bg.png");
  --surface: #222222;
  --surface-2: #2b2b2b;
  --surface-3: #333333;
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.3);
  --text: #ffffff;
  --muted: #999999;
  --faint: #808080;
  --accent: #ffffff;
  --accent-ink: #000000;
  --good: #dddddd;
  --bad: #8f8f8f;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  --font: 'Open Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-heading: 'Mister Belvedere Oblique', var(--font);
  --card-w: 128px;
  --label-w: 64px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  background-image: var(--bg-glow);
  background-attachment: fixed;
  background-size: cover;
  background-position: left bottom;
  background-repeat: no-repeat;
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body.is-dragging { cursor: grabbing; user-select: none; }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 0.4em; font-weight: 900; letter-spacing: -0.01em; }
h1, h2, h3, h4, h5, h6 { font-family: var(--font-heading); font-weight: 400; letter-spacing: normal; }
h1 { font-size: clamp(1.7rem, 2.2vw + 1.1rem, 2.6rem); }
h2 { font-size: 1.25rem; }
p { margin: 0 0 1em; }
a { color: var(--accent); }
button { font: inherit; }
input, select, textarea { font-family: inherit; }

.skip-link { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip-link:focus { left: 8px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 900; font-size: 1.05rem; white-space: nowrap; }
.brand-mark { color: var(--accent); font-size: 1.2rem; }
.brand-logo { display: block; height: 28px; width: auto; }
/* Side padding keeps the skewed corners of the first and last pill inside the scroll clip. */
.steps { display: flex; gap: 6px; padding: 0 6px; overflow-x: auto; scrollbar-width: none; }
.steps::-webkit-scrollbar { display: none; }
/* Nav pills are parallelograms like the poll-page .btn: fill and border sit on a skewed ::before so the
   logo stays upright, and only that shape takes pointer events. States set --step-bg / --step-border. */
.step {
  --step-bg: var(--surface-2); --step-border: var(--border);
  position: relative; isolation: isolate;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; font-size: 0.78rem; font-weight: 700;
  color: var(--muted); border: 1px solid transparent; background: none; pointer-events: none;
  white-space: nowrap; cursor: default;
}
.step::before {
  content: ''; position: absolute; inset: -1px; z-index: -1; pointer-events: auto;
  background: var(--step-bg); border: 1px solid var(--step-border); transform: skewX(-15deg);
}
.step .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.step-logo { display: block; flex: none; width: 56px; height: 28px; margin: -3px 0; object-fit: contain; }
/* Nav pill status colors are the original (pre-BLits) palette; the pill surface stays greyscale. */
.step.done .dot { background: #3ddc84; }
.step.skipped .dot { background: var(--faint); }
.step.current { color: var(--text); --step-border: #6c8cff; }
.step.current .dot { background: #6c8cff; box-shadow: 0 0 0 3px rgba(108, 140, 255, 0.25); }
.step.clash .dot { background: #ff6f91; }
.step.locked { opacity: 0.55; }
button.step { cursor: pointer; }
button.step:hover { --step-border: var(--border-strong); color: var(--text); }

/* Layout */
.app { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 24px 16px 48px; outline: none; }
.loading { text-align: center; color: var(--muted); padding: 48px 0; }

.eyebrow { text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.72rem; font-weight: 800; color: var(--accent); margin-bottom: 8px; }
.lead { font-size: 1.08rem; color: var(--muted); max-width: 62ch; }
.hint { color: var(--muted); font-size: 0.9rem; }
.accent-text { color: var(--accent); }
.notice { background: var(--surface-2); border: 1px solid var(--border); padding: 12px 16px; border-radius: var(--radius-sm); color: var(--muted); }

/* Buttons */
.btn {
  --btn-bg: var(--surface-2); --btn-border: var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px; border: 1px solid var(--btn-border);
  background: var(--btn-bg); color: var(--text); font-weight: 800; cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease, opacity 0.12s ease;
  text-decoration: none;
}
.btn:hover { --btn-bg: var(--surface-3); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-primary { --btn-bg: var(--accent); --btn-border: transparent; color: var(--accent-ink); }
.btn-primary:hover { --btn-bg: color-mix(in srgb, var(--accent) 85%, black); }
.btn-ghost { --btn-bg: transparent; }
.btn-lg { padding: 14px 26px; font-size: 1.05rem; }
.btn-sm { padding: 6px 12px; font-size: 0.82rem; }
.btn:focus-visible, .card:focus-visible, .tier-label:focus-visible, .fighter:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
/* Poll and share pages: parallelogram buttons (the admin panel keeps pills). The fill and border are
   drawn on a skewed ::before so the label stays upright, and only that shape takes pointer events,
   so the hit area is the parallelogram too. Button variants set --btn-bg / --btn-border. */
:where(body:not(.admin-body)) .btn { position: relative; isolation: isolate; border-color: transparent; border-radius: 0; background: none; pointer-events: none; }
:where(body:not(.admin-body)) .btn::before {
  content: ''; position: absolute; inset: -1px; z-index: -1; pointer-events: auto;
  background: var(--btn-bg); border: 1px solid var(--btn-border); transform: skewX(-15deg);
  transition: background 0.12s ease, border-color 0.12s ease;
}
:where(body:not(.admin-body)) .btn:focus-visible { outline: none; }
:where(body:not(.admin-body)) .btn:focus-visible::before { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Home */
.hero { padding: 24px 0 8px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin: 20px 0 8px; }
.game-list { margin-top: 28px; }
.games { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.game-item {
  display: grid; grid-template-columns: auto 1fr auto auto; gap: 14px; align-items: center;
  padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  border-left: 4px solid var(--accent);
}
.game-num { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-weight: 900; color: var(--muted); font-size: 0.85rem; }
.game-logo { width: 96px; height: 48px; object-fit: contain; }
.game-name { font-weight: 800; }
.game-desc { color: var(--muted); font-size: 0.85rem; }
.chip { font-size: 0.72rem; font-weight: 800; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.chip-done { color: var(--good); border-color: rgba(221, 221, 221, 0.35); }
.chip-ranking { color: var(--accent); border-color: rgba(255, 255, 255, 0.4); }
/* The home game list keeps the original colors: per-game accent bar (from the DB) and status chips. */
.game-item .chip-done { color: #3ddc84; border-color: rgba(61, 220, 132, 0.35); }
.game-item .chip-ranking { border-color: rgba(108, 140, 255, 0.4); }
/* Per-game accents show in the game list above and on the finish summary; everywhere else they stay BLits white. */
.gate, .tier-head, .saved { --accent: #ffffff !important; }
.fighter { --game-accent: #ffffff !important; }
.bonus-note { margin-top: 18px; padding: 14px 16px; border-radius: var(--radius); background: rgba(255, 255, 255, 0.06); border: 1px solid var(--border); color: var(--muted); }
.bonus-note strong { color: var(--text); }
/* Home footer: BLits social accounts, kept small and muted under the game list. */
.social-links { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 12px; margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--border); }
.social-label { color: var(--faint); font-size: 0.8rem; font-weight: 700; }
.social-links ul { display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; }
.social-links a { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--muted); transition: color 0.12s ease, background 0.12s ease; }
.social-links a:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); }
.social-links a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.social-links svg { width: 20px; height: 20px; fill: currentColor; }

/* Gate */
.gate { text-align: center; padding: 40px 0; max-width: 680px; margin: 0 auto; }
.gate .lead { margin: 0 auto 24px; }
.gate-logo { display: block; width: min(320px, 100%); height: 140px; margin: 8px auto 20px; object-fit: contain; }
.gate-actions { display: flex; flex-direction: column; gap: 12px; align-items: center; margin-bottom: 16px; }
.gate-actions .btn { min-width: 280px; }
.back-row { display: flex; margin-bottom: 12px; }

/* Tier editor */
.tier-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 6px; }
.tier-head h1 { margin: 0; }
.tier-status { font-weight: 800; color: var(--muted); padding: 6px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.tier-status.complete { color: var(--good); border-color: rgba(221, 221, 221, 0.35); }
.tier-board { margin-top: 12px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.tier-row { display: grid; grid-template-columns: var(--label-w) 1fr; border-bottom: 1px solid var(--border); }
.tier-row:last-child { border-bottom: none; }
.tier-label {
  display: grid; place-items: center; border: none; cursor: pointer;
  background: var(--tier-color); color: #141414; font-weight: 900; font-size: 1.5rem;
  min-height: 110px; padding: 6px; text-align: center; line-height: 1.1;
}
.tier-label.small { font-size: 0.85rem; }
.tier-label:hover { filter: brightness(1.08); }
.tier-row.unscored { border-top: 2px dashed var(--border-strong); }
.tier-row.unscored .dropzone { background: rgba(255, 255, 255, 0.015); }
.dropzone { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px; align-content: flex-start; min-height: 110px; transition: background 0.12s ease; }
.dropzone.over { background: rgba(255, 255, 255, 0.06); box-shadow: inset 0 0 0 2px var(--accent); }
.dropzone.targetable { cursor: copy; }
.pool-wrap { margin-top: 18px; }
.pool-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.pool-head h2 { margin: 0 0 8px; }
.pool { border: 2px dashed var(--border-strong); border-radius: var(--radius); background: rgba(255, 255, 255, 0.02); min-height: 130px; }
.pool.empty::after { content: 'Everyone is placed. Nice!'; color: var(--faint); font-weight: 700; padding: 40px 0; width: 100%; text-align: center; }
.tier-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; flex-wrap: wrap; }

/* Experimental side-by-side layout, opt-in via the Unranked toggle: Unranked becomes a sticky column beside the tiers. */
.pool-head { flex-wrap: wrap; }
.pool-head .hint { margin-left: auto; }
.rank-layout.side { display: grid; grid-template-columns: minmax(0, 1fr) calc(var(--card-w) * 2 + 40px); gap: 16px; align-items: start; margin-top: 12px; }
.rank-layout.side .tier-board { margin-top: 0; }
.rank-layout.side .pool-wrap {
  margin-top: 0; position: sticky; top: calc(var(--sticky-top, 0px) + 8px);
  display: flex; flex-direction: column; max-height: calc(100vh - var(--sticky-top, 0px) - 16px);
}
.rank-layout.side .pool-head { align-items: center; gap: 4px 8px; margin-bottom: 8px; }
.rank-layout.side .pool-head h2 { margin: 0; }
.rank-layout.side .layout-toggle { margin-left: auto; }
.rank-layout.side .pool-head .hint { order: 1; flex-basis: 100%; margin-left: 0; }
.rank-layout.side .pool { flex: 1 1 auto; overflow-y: auto; scrollbar-width: thin; }
/* Touch: a vertical swipe scrolls the column, a sideways drag (toward the tiers) picks the card up. */
.rank-layout.side .pool .card { touch-action: pan-y; }

.card {
  width: var(--card-w); border-radius: var(--radius-sm); overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--border);
  cursor: grab; user-select: none; -webkit-user-select: none; touch-action: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
  position: relative;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35); border-color: var(--border-strong); }
.card.selected { box-shadow: 0 0 0 3px var(--accent), 0 6px 16px rgba(0, 0, 0, 0.35); }
.card.dragging { opacity: 0.35; }
.card-img { aspect-ratio: 1 / 1; background: #000000; }
.card-img img { width: 100%; height: 100%; object-fit: cover; object-position: center 28%; display: block; -webkit-user-drag: none; pointer-events: none; }
.card-fallback { width: 100%; height: 100%; display: grid; place-items: center; font-weight: 900; font-size: 1.6rem; color: var(--muted); background: linear-gradient(135deg, var(--surface-3), var(--surface)); }
.card-name { padding: 4px 6px; font-size: 0.8rem; font-weight: 800; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drag-ghost { position: fixed; left: 0; top: 0; pointer-events: none; z-index: 1000; box-shadow: var(--shadow); opacity: 0.95; cursor: grabbing; transition: none; will-change: transform; }
.drag-ghost.card:hover { transform: none; }
.selection-bar {
  position: sticky; bottom: 12px; margin-top: 16px; display: none; align-items: center; gap: 10px; justify-content: center; flex-wrap: wrap;
  padding: 10px 14px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border-strong); box-shadow: var(--shadow);
}
.selection-bar.visible { display: flex; }
.selection-bar .tier-pick { width: 40px; height: 40px; border-radius: 50%; border: none; font-weight: 900; font-size: 1rem; color: #141414; cursor: pointer; }

/* Interlude & per-game saved screen */
.interlude, .saved { text-align: center; padding: 48px 0; max-width: 680px; margin: 0 auto; }
.interlude .big, .saved .big { font-size: 3rem; margin-bottom: 8px; }
.saved .tier-pill { font-size: 0.72rem; padding: 2px 10px; border-radius: 999px; color: #141414; font-weight: 900; vertical-align: middle; }
.saved .gate-actions { margin-top: 8px; }
.mini-cards.centered { justify-content: center; margin: 0 auto 24px; }

/* Clash */
.clash-head { text-align: center; margin-bottom: 18px; }
.clash-head h1 { margin-bottom: 4px; }
.round { display: inline-block; margin-top: 8px; padding: 4px 14px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-weight: 800; color: var(--muted); }
.arena { display: grid; grid-template-columns: 1fr auto 1fr; gap: 18px; align-items: stretch; max-width: 820px; margin: 0 auto; }
.vs { display: grid; place-items: center; font-weight: 900; font-size: 1.6rem; color: var(--faint); }
.fighter {
  position: relative; border-radius: var(--radius); overflow: hidden; background: var(--surface); border: 1px solid var(--border);
  cursor: pointer; text-align: left; padding: 0; color: var(--text); width: 100%; display: flex; flex-direction: column;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.3s ease, filter 0.3s ease;
}
.fighter:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.fighter-img { aspect-ratio: 1 / 1; background: #000000; }
.fighter-img img { width: 100%; height: 100%; object-fit: cover; object-position: center 25%; display: block; pointer-events: none; -webkit-user-drag: none; }
.fighter-img .card-fallback { font-size: 3rem; }
.fighter-body { padding: 12px 14px 14px; }
.fighter-name { font-weight: 900; font-size: 1.25rem; }
.fighter-sub { color: var(--muted); font-size: 0.85rem; }
.fighter-game { display: inline-block; margin-top: 8px; font-size: 0.72rem; font-weight: 800; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--game-accent, var(--border-strong)); color: var(--game-accent, var(--muted)); }
.fighter.win { box-shadow: 0 0 0 3px var(--good), var(--shadow); transform: translateY(-4px); }
.fighter.lose { opacity: 0.38; filter: grayscale(0.7); }
.fighter:disabled { cursor: default; }
.fighter .badge { position: absolute; top: 10px; left: 10px; padding: 4px 10px; border-radius: 999px; background: var(--good); color: #000000; font-weight: 900; font-size: 0.78rem; opacity: 0; transform: scale(0.8); transition: opacity 0.2s, transform 0.2s; }
.fighter.win .badge { opacity: 1; transform: scale(1); }
.clash-feedback { text-align: center; min-height: 28px; margin-top: 16px; color: var(--muted); font-weight: 700; }
.clash-actions { display: flex; justify-content: center; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.arena.busy .fighter { pointer-events: none; }

/* Finish */
.finish { max-width: 820px; margin: 0 auto; }
.finish-top { text-align: center; padding: 24px 0 8px; }
.summary-game { margin-top: 20px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent); }
.summary-game h3 { margin: 0 0 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.summary-game h3 > span:first-child { color: var(--accent); }
.summary-game h3 .tier-pill { font-size: 0.72rem; padding: 2px 10px; border-radius: 999px; color: #141414; font-weight: 900; }
.mini-cards { display: flex; flex-wrap: wrap; gap: 8px; }
.mini-card { width: 92px; border-radius: 8px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); }
.mini-card .card-img { aspect-ratio: 1 / 1; }
.mini-card .card-name { font-size: 0.72rem; }
.record { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 18px 0; }
.stat { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); }
.stat .label { color: var(--muted); font-size: 0.78rem; font-weight: 700; }
.stat .value { font-size: 1.6rem; font-weight: 900; }
.finish-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 24px; }

/* Sharing */
.game-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.summary-game h3 .actions { display: flex; gap: 8px; align-items: center; font-family: var(--font); }
.share-dialog {
  border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text);
  padding: 0; width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; box-shadow: var(--shadow);
}
.share-dialog::backdrop { background: rgba(0, 0, 0, 0.62); backdrop-filter: blur(4px); }
.share-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.share-head h2 { margin: 0; font-size: 1.1rem; }
.share-body { padding: 18px 20px 20px; display: grid; gap: 14px; }
.share-preview { width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--border); display: block; background: #000000; }
.share-link { display: grid; gap: 6px; font-weight: 700; font-size: 0.85rem; }
.share-link-row { display: flex; gap: 8px; }
.share-link-row input { flex: 1; min-width: 0; font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 8px; padding: 8px 10px; }
.share-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Confirm dialog (replaces the native window.confirm) */
.confirm-dialog {
  border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text);
  padding: 22px 22px 18px; width: min(420px, calc(100vw - 32px)); box-shadow: var(--shadow);
}
.confirm-dialog::backdrop { background: rgba(0, 0, 0, 0.62); backdrop-filter: blur(4px); }
.confirm-message { margin: 0 0 20px; font-weight: 700; line-height: 1.45; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; }
.confirm-ok { --btn-bg: #ffffff; color: #000000; --btn-border: #ffffff; }
.confirm-ok:hover { --btn-bg: #e6e6e6; }
.confirm-cancel { --btn-bg: transparent; color: #ffffff; --btn-border: #ffffff; }
.confirm-cancel:hover { --btn-bg: rgba(255, 255, 255, 0.1); }
.confirm-dialog .btn:focus-visible::before { outline: 3px solid #ffffff; outline-offset: 2px; }

/* Nickname: the welcome screen field and the home page dialog */
.nickname-field { display: grid; gap: 8px; font-weight: 700; text-align: left; }
.nickname-input { width: 100%; font: inherit; font-weight: 400; color: var(--text); background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 8px; padding: 10px 12px; }
.nickname-input:focus-visible { outline: 3px solid #ffffff; outline-offset: 2px; }
.welcome-form { display: grid; gap: 20px; width: min(320px, 100%); margin: 8px auto 0; }
.welcome-form .gate-actions { margin-bottom: 0; }
.confirm-dialog .nickname-field { margin-bottom: 8px; }
.nickname-note { margin: 0 0 18px; }

/* Clash milestone toast (every 20 rounds). Non-blocking: clicks pass through except on the close button. */
.milestone-toast {
  position: fixed; top: 16px; left: 50%; transform: translate(-50%, calc(-100% - 24px)); z-index: 60;
  display: flex; align-items: center; gap: 14px; width: min(440px, calc(100vw - 24px));
  border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text);
  padding: 14px 40px 14px 16px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s;
}
.milestone-toast.show { opacity: 1; transform: translate(-50%, 0); }
.milestone-trophy { font-size: 2.4rem; line-height: 1; flex: none; }
.milestone-lead { margin: 0 0 4px; font-weight: 800; font-size: 1rem; line-height: 1.35; }
.milestone-rank { margin: 0; line-height: 1.35; font-size: 0.92rem; }
.milestone-close {
  position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border: 0; border-radius: 999px;
  background: transparent; color: var(--muted); font-size: 1.3rem; line-height: 1; cursor: pointer; pointer-events: auto;
}
.milestone-close:hover { color: var(--text); background: rgba(255, 255, 255, 0.1); }
.milestone-close:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
@media (prefers-reduced-motion: reduce) { .milestone-toast { transition: opacity 0.25s; } }

/* Public share page */
.share-view .card, .share-view .tier-label { cursor: default; }
.share-view .card { touch-action: auto; }
.share-view .card:hover { transform: none; box-shadow: none; border-color: var(--border); }
.share-view .tier-label:hover { filter: none; }
.share-view .tier-head .actions { display: flex; gap: 8px; }
.share-cta { text-align: center; padding: 40px 0 12px; }
.share-cta h2 { margin-bottom: 18px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: var(--surface-3); border: 1px solid var(--border-strong); color: var(--text);
  padding: 10px 16px; border-radius: 999px; font-weight: 700; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 50; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: var(--bad); }

@media (max-width: 640px) {
  :root { --card-w: 88px; --label-w: 44px; }
  .tier-label { font-size: 1.2rem; min-height: 92px; }
  .tier-label.small { font-size: 0.7rem; padding: 4px; }
  .dropzone { min-height: 92px; gap: 6px; padding: 6px; }
  .card-name { font-size: 0.72rem; }
  .arena { gap: 8px; }
  .vs { font-size: 1.1rem; }
  .fighter-body { padding: 8px 10px 10px; }
  .fighter-name { font-size: 1rem; }
  .game-item { grid-template-columns: auto 1fr; }
  .game-item .chip, .game-item .game-actions { grid-column: 2; justify-self: start; }
  .game-logo { width: 72px; height: 36px; }
  .gate-logo { height: 110px; margin-bottom: 16px; }
  .topbar { flex-wrap: wrap; }
  .brand-logo { height: 20px; } /* the logo is wider than the old star; keeps the title on one line at 390px */
  .steps { width: 100%; }
  .step-logo { width: 44px; height: 24px; margin: -2px 0; }
  .rank-layout.side { grid-template-columns: minmax(0, 1fr) calc(var(--card-w) + 20px); gap: 8px; }
  .rank-layout.side .pool-head .hint { display: none; }
  .rank-layout.side .layout-toggle { padding: 6px 4px; font-size: 0.72rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Favorite crown: the first card in the highest tier in use */
.card.favorite { box-shadow: 0 0 0 2px #dddddd, 0 6px 16px rgba(0, 0, 0, 0.35); }
.card.favorite.selected { box-shadow: 0 0 0 3px var(--accent), 0 0 0 5px #dddddd, 0 6px 16px rgba(0, 0, 0, 0.35); }
.crown { position: absolute; top: 4px; left: 4px; z-index: 2; font-size: 1rem; line-height: 1; padding: 3px 5px; border-radius: 999px; background: rgba(0, 0, 0, 0.78); pointer-events: none; }
.mini-card { position: relative; }
.mini-card.favorite { box-shadow: 0 0 0 2px #dddddd; }
.mini-card .crown { font-size: 0.8rem; padding: 2px 4px; }
.fav-line { margin: 8px 0 0; color: var(--muted); font-size: 0.9rem; min-height: 1.4em; }
.fav-line strong { color: var(--text); }
.crown-btn { --btn-border: rgba(221, 221, 221, 0.6); }
.crown-btn:hover { --btn-border: #dddddd; }
