:root {
  --bg: #0b0d17;
  --bg-2: #141830;
  --panel: rgba(255, 255, 255, .05);
  --panel-line: rgba(255, 255, 255, .10);
  --text: #eef0ff;
  --muted: #9aa0c4;
  --accent: #ffcb3d;
  --accent-2: #6c5cff;
  --good: #3fd07a;
  --bad: #ff5d6c;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 700px at 12% -10%, #2a1d5e 0%, transparent 60%),
    radial-gradient(900px 600px at 105% 0%, #5c1636 0%, transparent 55%),
    var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, 'Segoe UI', sans-serif;
}

h1, h2, h3 { margin: 0; line-height: 1.2; }
.muted { color: var(--muted); font-size: 12px; }
[hidden] { display: none !important; }

/* ------------------------------------------------------------- controls */

.btn {
  appearance: none;
  border: 1px solid var(--panel-line);
  background: rgba(255, 255, 255, .07);
  color: var(--text);
  padding: 9px 14px;
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform .08s ease, background .15s ease, border-color .15s ease;
}
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, .13); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, var(--accent) 0%, #f0a81b 100%);
  border-color: #ffdc7a;
  color: #241a00;
}
.btn-primary:hover:not(:disabled) { background: linear-gradient(180deg, #ffd968 0%, #ffb524 100%); }
.btn-ghost { background: transparent; }
.btn-danger { background: rgba(255, 93, 108, .16); border-color: rgba(255, 93, 108, .5); color: #ffc0c6; }
.btn-small { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.field-inline { flex-direction: row; align-items: center; gap: 8px; }
.field-inline > span { white-space: nowrap; }

input, select {
  background: rgba(0, 0, 0, .30);
  border: 1px solid var(--panel-line);
  color: var(--text);
  padding: 9px 11px;
  border-radius: 10px;
  font: inherit;
  min-width: 0;
}
input:focus, select:focus { outline: 2px solid var(--accent-2); outline-offset: 1px; }

.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.check input { margin-top: 2px; }

/* ---------------------------------------------------------------- lobby */

.lobby { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.lobby-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 22px;
  padding: 30px;
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.logo { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.logo span { color: var(--accent); }
.tagline { margin: 2px 0 0; color: var(--muted); font-size: 14px; }

.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  border-radius: 16px;
  border: 2px solid rgba(255, 203, 61, .55);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .45);
  flex: none;
  object-fit: cover;
}
.brand-mark-sm { border-radius: 9px; border-width: 1px; box-shadow: none; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--panel-line); }
.join-row { display: flex; gap: 10px; }
.join-row input {
  flex: 1;
  text-transform: uppercase;
  letter-spacing: .35em;
  font-weight: 700;
  text-align: center;
}
.join-row .btn { width: auto; }
.lobby-error { color: var(--bad); font-size: 13px; min-height: 18px; margin: 0; }

/* sign in / create account */
.auth-switch {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  padding: 4px; border-radius: 12px; background: rgba(0, 0, 0, .28);
}
.auth-tab {
  background: none; border: 0; border-radius: 9px; padding: 8px;
  color: var(--muted); font: inherit; font-weight: 600; font-size: 13px; cursor: pointer;
}
.auth-tab.active { background: rgba(255, 255, 255, .10); color: var(--text); }

/* run picker */
.menu-card { width: min(500px, 100%); }
.menu-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.menu-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin: 4px 0 -4px;
}
.run-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; }
.run-empty { color: var(--muted); font-size: 13px; padding: 14px; text-align: center; border: 1px dashed var(--panel-line); border-radius: 12px; }

.run-card {
  width: 100%; text-align: left; display: flex; flex-direction: column; gap: 5px;
  padding: 11px 13px; border-radius: 12px;
  border: 1px solid var(--panel-line); background: rgba(255, 255, 255, .04);
  color: var(--text); font: inherit; cursor: pointer;
}
.run-card:hover { background: rgba(255, 255, 255, .10); border-color: rgba(255, 203, 61, .4); }
.run-card-top { display: flex; align-items: center; gap: 8px; }
.run-code { letter-spacing: .2em; color: var(--accent); font-size: 15px; }
.run-card-top .muted { margin-left: auto; }
.run-players { display: flex; gap: 5px; flex-wrap: wrap; }
.run-player {
  font-size: 11px; padding: 1px 8px; border-radius: 999px;
  border: 1px solid var(--player-color); color: var(--muted);
}
.run-player.online { color: var(--text); background: color-mix(in srgb, var(--player-color) 20%, transparent); }
.lobby-hint { color: var(--muted); font-size: 12px; margin: -8px 0 0; min-height: 16px; }
.lobby-card form, form.lobby-card { display: flex; flex-direction: column; gap: 16px; }
.join-prompt {
  margin: 0;
  padding: 10px 14px;
  border-radius: 11px;
  border: 1px solid rgba(255, 203, 61, .35);
  background: rgba(255, 203, 61, .10);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}
#codeInput[readonly] { opacity: .75; cursor: default; }

/* ----------------------------------------------------------------- run */

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--panel-line);
  background: rgba(10, 12, 26, .72);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
  flex-wrap: wrap;
}
.logo-btn {
  display: flex; align-items: center; gap: 9px;
  background: none; border: 0; color: var(--text);
  font-size: 17px; font-weight: 800; cursor: pointer; padding: 0;
}
.logo-btn-text span { color: var(--accent); }

.code-chip {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255, 203, 61, .12);
  border: 1px solid rgba(255, 203, 61, .35);
  color: var(--accent);
  padding: 5px 12px; border-radius: 999px; cursor: pointer; font: inherit;
}
.code-chip strong { letter-spacing: .22em; font-size: 15px; }
.code-label { font-size: 10px; letter-spacing: .12em; opacity: .8; }

.player-chips { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.player-chip {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--panel-line);
  border-left: 3px solid var(--player-color, var(--accent));
  border-radius: 10px; padding: 4px 10px; background: var(--panel);
}
.player-chip .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--good); box-shadow: 0 0 8px var(--good);
}
.player-chip.offline { opacity: .5; }
.player-chip.offline .dot { background: var(--muted); box-shadow: none; }
.player-chip strong { font-size: 13px; }
.tally { font-size: 11px; color: var(--muted); }
.topbar-actions { display: flex; gap: 8px; margin-left: auto; }

.run-body {
  display: grid;
  grid-template-columns: minmax(340px, 560px) minmax(0, 1fr) 260px;
  gap: 18px;
  padding: 18px;
  align-items: start;
}
@media (max-width: 1240px) {
  .run-body { grid-template-columns: minmax(0, 1fr); }
  .log-panel { order: 3; }
}

.wheel-panel, .board-panel, .log-panel {
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius);
  padding: 16px;
}

.wheel-head { display: flex; gap: 12px; align-items: flex-end; margin-bottom: 14px; flex-wrap: wrap; }
.wheel-head .field { flex: 1; min-width: 160px; }
.btn-spin { font-size: 17px; letter-spacing: .12em; padding: 10px 26px; }

.wheel-stage { position: relative; display: grid; place-items: center; }
#wheelCanvas { width: 100%; max-width: 520px; aspect-ratio: 1; display: block; }

.wheel-pointer {
  position: absolute;
  right: max(0px, calc(50% - 268px));
  top: 50%;
  transform: translateY(-50%);
  width: 0; height: 0;
  border-top: 13px solid transparent;
  border-bottom: 13px solid transparent;
  border-right: 26px solid var(--accent);
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .6));
}

.wheel-status {
  position: absolute;
  bottom: 6%;
  background: rgba(6, 8, 18, .88);
  border: 1px solid var(--panel-line);
  padding: 8px 18px;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: .04em;
  max-width: 90%;
  text-align: center;
}

.wheel-meta { color: var(--muted); font-size: 12px; text-align: center; margin: 10px 0 0; }

/* --------------------------------------------------------------- tokens */

.tokens { margin-top: 16px; border-top: 1px solid var(--panel-line); padding-top: 14px; }
.token-list { display: flex; flex-direction: column; gap: 8px; }
.token {
  display: flex; flex-direction: column; gap: 3px;
  padding: 10px 12px; border-radius: 11px;
  border: 1px solid var(--panel-line);
  background: rgba(255, 255, 255, .04);
}
.token-head { display: flex; align-items: center; gap: 8px; }
.token-icon {
  width: 22px; height: 22px; display: grid; place-items: center;
  border-radius: 6px; font-size: 13px; font-weight: 800;
  background: rgba(255, 255, 255, .12);
}
.token-soul-swap .token-icon { background: #111; color: #fff; }
.token-force-trade .token-icon { background: #f2f2f2; color: #111; }
.token-free-pick { border-color: rgba(255, 203, 61, .5); background: rgba(255, 203, 61, .09); }
.token-free-pick .token-icon { background: var(--accent); color: #241a00; }
.token-actions { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }

.picker-search { width: 100%; margin: 10px 0; }
.pool-grid-short { max-height: 210px; }
.customize-current { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.customize-current img { width: 54px; height: 54px; image-rendering: pixelated; }
.customize-stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
@media (max-width: 560px) { .customize-stats { grid-template-columns: repeat(3, 1fr); } }
.customize-stat { display: flex; flex-direction: column; gap: 2px; align-items: center; }
.customize-stat input { width: 100%; text-align: center; padding: 6px 4px; }

/* --------------------------------------------------------------- stages */

.stages { margin-top: 16px; border-top: 1px solid var(--panel-line); padding-top: 14px; }
.stages-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.stages-head h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

.stage-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.stage {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  padding: 9px 12px;
  border-radius: 11px;
  border: 1px solid var(--panel-line);
  background: rgba(255, 255, 255, .04);
}
.stage.locked { opacity: .62; }
.stage.unlocked { border-color: rgba(63, 208, 122, .35); }

.stage-top { display: flex; align-items: center; gap: 8px; }
.stage-name { font-size: 14px; }
.stage-spins {
  font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px;
  background: rgba(255, 203, 61, .16); color: var(--accent);
}
.stage-top .route-del { opacity: 0; }
.stage:hover .route-del { opacity: 1; }

.stage-check { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); grid-column: 2; grid-row: 1; }
.stage-status { grid-column: 1 / -1; font-size: 11px; color: var(--muted); }
.stage-status.ready { color: var(--good); }

.stage-form { display: flex; gap: 8px; margin-top: 12px; }
.stage-form input[type="text"] { flex: 1; }
.stage-form input[type="number"] { width: 62px; }

/* ---------------------------------------------------------------- board */

.board { overflow-x: auto; }
.board-grid { display: grid; gap: 8px; min-width: max-content; }
.board-corner, .board-head {
  position: sticky; top: 0;
  font-size: 12px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); padding-bottom: 4px;
}
.board-head { display: flex; flex-direction: column; border-bottom: 2px solid var(--player-color); }
.board-head strong { color: var(--text); font-size: 14px; text-transform: none; letter-spacing: 0; }

.board-route {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 6px; border-right: 1px solid var(--panel-line);
}
.board-route-text { display: flex; flex-direction: column; gap: 1px; }
.board-stage-name { font-size: 13px; font-weight: 600; color: var(--text); }
.board-slot { font-size: 11px; color: var(--muted); }
.route-del {
  background: none; border: 0; color: var(--muted); cursor: pointer;
  font-size: 16px; line-height: 1; padding: 0 4px; opacity: 0;
}
.route-del:hover { color: var(--bad); }

.board-cell { display: flex; flex-direction: column; gap: 6px; min-height: 62px; }
.board-cell.empty-cell {
  border: 1px dashed var(--panel-line); border-radius: 10px;
  display: grid; place-items: center;
}
.board-cell.link-broken { position: relative; }

.mon-card {
  display: flex; align-items: center; gap: 10px; text-align: left;
  width: 100%; padding: 7px 10px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--panel-line);
  border-left: 3px solid var(--player-color);
  border-radius: 10px; color: var(--text); font: inherit; cursor: pointer;
}
.mon-card:hover { background: rgba(255, 255, 255, .11); }
.mon-card.status-fainted { opacity: .45; filter: grayscale(1); }
.mon-card.status-fainted .mon-name { text-decoration: line-through; }
.mon-sprite { width: 40px; height: 40px; image-rendering: pixelated; flex: none; }
.mon-body { min-width: 0; display: flex; flex-direction: column; }
.mon-name { font-size: 13px; font-weight: 700; }
.mon-species { font-size: 11px; color: var(--muted); }
.mon-meta { display: flex; gap: 5px; align-items: center; margin-top: 2px; flex-wrap: wrap; }
.iv-total { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tag {
  font-size: 10px; padding: 1px 6px; border-radius: 999px;
  background: rgba(255, 255, 255, .10); color: var(--muted);
}
.tag-wild { background: rgba(255, 203, 61, .18); color: var(--accent); font-weight: 700; }
.empty { color: var(--muted); padding: 20px; text-align: center; }

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

.tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--panel-line); }
.tab {
  background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--muted); font: inherit; font-weight: 600; font-size: 13px;
  padding: 8px 14px; cursor: pointer; margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* -------------------------------------------------------------- parties */

.parties { display: flex; flex-direction: column; gap: 14px; }
.party-panel {
  border: 1px solid var(--panel-line);
  border-left: 3px solid var(--player-color);
  border-radius: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, .03);
}
.party-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.party-tally { display: flex; align-items: center; gap: 10px; }
.party-title { display: flex; align-items: center; gap: 8px; }
.party-title .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 8px var(--good); }
.party-title .dot.off { background: var(--muted); box-shadow: none; }

.party-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 900px) { .party-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.party-slot {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 5px;
  border: 1px solid var(--panel-line);
  border-radius: 11px;
  background: rgba(0, 0, 0, .22);
  color: var(--text); font: inherit; cursor: pointer; min-height: 128px;
}
.party-slot:hover { background: rgba(255, 255, 255, .08); }
.party-slot.empty {
  border-style: dashed; background: none; cursor: default;
  opacity: .35;
}
.party-sprite { width: 52px; height: 52px; image-rendering: pixelated; }
.party-name { font-size: 12px; text-align: center; line-height: 1.2; }
.party-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px 4px; width: 100%; margin-top: 2px; }
.pstat { display: flex; align-items: center; justify-content: space-between; gap: 3px; font-size: 9px; padding: 0 1px; }
.pstat-key { color: var(--muted); }
/* The band is the colour here - there's no room for "21-30" at this size. */
.pstat-pip { width: 14px; height: 5px; border-radius: 999px; background: var(--muted); flex: none; }
.pstat.tone-max .pstat-pip { background: var(--accent); }
.pstat.tone-great .pstat-pip { background: var(--good); }
.pstat.tone-meh .pstat-pip { background: #ffb257; }
.pstat.tone-bad .pstat-pip { background: var(--bad); }
.pstat-wild { background: rgba(255, 203, 61, .14); border-radius: 3px; }
.party-total { font-size: 10px; color: var(--muted); }

.party-extra { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.party-extra-label { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); width: 34px; flex: none; }
.party-strip { display: flex; gap: 4px; flex-wrap: wrap; }
.mini-mon {
  border: 1px solid var(--panel-line); border-radius: 8px; padding: 1px;
  background: rgba(0, 0, 0, .2); cursor: pointer; line-height: 0;
}
.mini-mon img { width: 34px; height: 34px; image-rendering: pixelated; }
.mini-mon.status-fainted { opacity: .4; filter: grayscale(1); }

/* --------------------------------------------------- party view (watch mode) */

.party-view .run-body { grid-template-columns: minmax(0, 1fr); max-width: 1100px; margin: 0 auto; }
.party-view .log-panel,
.party-view .stages { display: none; }
.party-view .tabs { display: none; }
.party-view #wheelCanvas { max-width: 620px; }
.party-view .wheel-pointer { right: max(0px, calc(50% - 318px)); }
.party-view .party-slot { min-height: 138px; }
.party-view .board-panel { background: none; border: 0; padding: 0; }

/* --------------------------------------------------------------- events */

.event-banner { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.event-card {
  display: flex; flex-direction: column; gap: 4px;
  padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--panel-line);
  background: linear-gradient(100deg, rgba(108, 92, 255, .22), rgba(255, 255, 255, .04));
}
.event-card strong { letter-spacing: .12em; font-size: 13px; }
.event-soul-swap { border-color: rgba(255, 255, 255, .35); }
.event-force-trade { border-color: rgba(255, 203, 61, .45); }
.event-resolve { display: flex; gap: 8px; margin-top: 6px; }
.event-resolve input { flex: 1; }

/* ------------------------------------------------------------------ log */

.log-panel h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 10px; }
.log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; max-height: 70vh; overflow-y: auto; }
.log li { display: flex; gap: 8px; font-size: 12px; line-height: 1.4; }
.log-time { color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }

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

.modal {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(4, 5, 14, .78);
  backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 20px;
}
.modal-card {
  width: min(560px, 100%);
  max-height: 90vh; overflow-y: auto;
  background: linear-gradient(180deg, #191d38 0%, #10132a 100%);
  border: 1px solid var(--panel-line);
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 18px; }
.modal-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }

/* ----------------------------------------------------------- dice screen */

.dice-card { width: min(600px, 100%); }
.dice-head { display: flex; gap: 14px; align-items: center; margin-bottom: 18px; }
.dice-sprite { width: 78px; height: 78px; image-rendering: pixelated; }
.dice-route { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.dice-species { font-size: 26px; font-weight: 800; }
.dice-owner { margin: 2px 0 0; font-size: 13px; color: var(--muted); }

.dice-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
@media (max-width: 560px) { .dice-grid { grid-template-columns: repeat(3, 1fr); } }

.die {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 12px 4px 10px;
  border-radius: 12px;
  border: 1px solid var(--panel-line);
  background: rgba(0, 0, 0, .28);
}
.die-label { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.die-value { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
/* "21-30" needs to sit in the same box as "31" */
.die-value.die-band { font-size: 18px; letter-spacing: -.02em; }
.die.rolling .die-value { opacity: .75; }
.die.rolling { animation: shake .18s linear infinite; }
@keyframes shake {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}
.die.tone-max   { border-color: var(--accent); background: rgba(255, 203, 61, .16); }
.die.tone-max .die-value { color: var(--accent); }
.die.tone-great { border-color: rgba(63, 208, 122, .5); }
.die.tone-great .die-value { color: var(--good); }
.die.tone-meh .die-value { color: #ffb257; }
.die.tone-bad .die-value { color: var(--bad); }
.die.die-wild {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 203, 61, .35), 0 0 24px rgba(255, 203, 61, .35);
}
.die.die-wild .die-value { color: var(--accent); }

.dice-total { text-align: center; font-weight: 700; margin: 14px 0 4px; min-height: 22px; }
.dice-hint { text-align: center; color: var(--muted); font-size: 12px; margin: 0 0 14px; min-height: 18px; }
.dice-actions { display: flex; gap: 10px; justify-content: center; }

.wildcard-step {
  margin-top: 18px; padding-top: 16px;
  border-top: 1px solid var(--panel-line);
}
.wildcard-title { margin: 0; font-weight: 800; color: var(--accent); }
.wildcard-sub { margin: 4px 0 12px; font-size: 13px; color: var(--muted); }
.wildcard-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.wildcard-row .btn { display: flex; flex-direction: column; gap: 2px; align-items: center; }
.wc-stat { font-size: 13px; }
.wc-swap { font-size: 10px; color: var(--muted); font-weight: 500; }

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

.mon-modal-head { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.mon-modal-sprite { width: 82px; height: 82px; image-rendering: pixelated; }
.stat-list { display: flex; flex-direction: column; gap: 7px; margin-bottom: 10px; }
.stat-row { display: grid; grid-template-columns: 42px 1fr 30px 18px; gap: 9px; align-items: center; }
.stat-key { font-size: 12px; color: var(--muted); }
.stat-bar { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, .09); overflow: hidden; }
.stat-fill { height: 100%; border-radius: 999px; background: var(--muted); }
.stat-fill.tone-max { background: var(--accent); }
.stat-fill.tone-great { background: var(--good); }
.stat-fill.tone-meh { background: #ffb257; }
.stat-fill.tone-bad { background: var(--bad); }
.stat-value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; font-size: 13px; }
.nick-form { display: flex; gap: 8px; margin-top: 12px; }
.nick-form input { flex: 1; }
.link-box { margin-top: 16px; border-top: 1px solid var(--panel-line); padding-top: 14px; }
.link-box h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 8px; }
.link-row { display: flex; gap: 8px; align-items: center; padding: 5px 0; font-size: 13px; }
.link-row.status-fainted { opacity: .5; text-decoration: line-through; }

/* ------------------------------------------------------------ pokemmo dex */

.dex { margin-top: 20px; border-top: 1px solid var(--panel-line); padding-top: 16px; }
.dex-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.dex-head h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.dex-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin: 16px 0 7px;
}

.type-row { display: flex; gap: 5px; }
.type {
  font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px; background: rgba(255, 255, 255, .12); color: #fff;
  white-space: nowrap;
}
.type-normal { background: #9099a1; } .type-fire { background: #ff9c54; }
.type-water { background: #4d90d5; } .type-electric { background: #f3d23b; color: #3b3200; }
.type-grass { background: #63bb5b; } .type-ice { background: #74cec0; color: #093a34; }
.type-fighting { background: #ce4069; } .type-poison { background: #ab6ac8; }
.type-ground { background: #d97845; } .type-flying { background: #8fa8dd; }
.type-psychic { background: #f97176; } .type-bug { background: #90c12c; color: #1b2b00; }
.type-rock { background: #c7b78b; color: #2d2612; } .type-ghost { background: #5269ad; }
.type-dragon { background: #0a6dc4; } .type-dark { background: #5a5366; }
.type-steel { background: #5a8ea1; } .type-fairy { background: #ec8fe6; color: #3d1039; }
.type-physical { background: #c92112; } .type-special { background: #4f5870; }
.type-status { background: #8c888c; }

.dex-base { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.base-stat {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 6px 2px; border-radius: 9px; background: rgba(0, 0, 0, .24);
  font-size: 13px;
}
.base-stat .muted { font-size: 9px; }

.evo-chain { display: flex; flex-direction: column; gap: 8px; }
.evo-step {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center;
  padding: 8px; border-radius: 11px; border: 1px solid var(--panel-line);
  background: rgba(0, 0, 0, .18);
}
.evo-step.evo-now { border-color: rgba(255, 203, 61, .5); background: rgba(255, 203, 61, .08); }
.evo-mon { display: flex; flex-direction: column; align-items: center; font-size: 11px; gap: 1px; }
.evo-mon img { width: 46px; height: 46px; image-rendering: pixelated; }
.evo-how { display: flex; flex-direction: column; align-items: center; font-size: 11px; color: var(--accent); text-align: center; }
.evo-arrow { font-size: 15px; color: var(--muted); }

.move-filters { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 9px; }
.move-table { max-height: 320px; overflow-y: auto; border: 1px solid var(--panel-line); border-radius: 11px; }
.move-row {
  display: grid; grid-template-columns: 46px 1fr 70px 58px 40px 46px;
  gap: 6px; align-items: center; padding: 6px 9px; font-size: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, .05);
}
.move-row:last-child { border-bottom: 0; }
.move-header {
  position: sticky; top: 0; background: #171b33; z-index: 1;
  font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
}
.move-lv { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); font-size: 11px; }
.move-name { font-weight: 600; }
.move-row .type { justify-self: start; }
.dex-link { display: inline-block; margin-top: 12px; color: var(--accent-2); font-size: 12px; }

@media (max-width: 560px) {
  .move-row { grid-template-columns: 40px 1fr 62px; }
  .move-row > :nth-child(n + 4) { display: none; }
}

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

.settings-card { width: min(760px, 100%); }
.settings-body { display: flex; flex-direction: column; gap: 16px; }
.event-counts { display: flex; gap: 18px; flex-wrap: wrap; }
.event-counts input { width: 78px; }
.pool-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.pool-head h3 { font-size: 14px; }
.pool-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.pool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 6px;
  max-height: 300px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--panel-line);
  border-radius: 12px;
}
.pool-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 8px; border-radius: 9px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, .04);
  color: var(--muted); font: inherit; font-size: 12px; cursor: pointer;
  opacity: .5;
}
.pool-chip img { width: 26px; height: 26px; image-rendering: pixelated; }
.pool-chip.on { opacity: 1; color: var(--text); border-color: var(--accent); background: rgba(255, 203, 61, .12); }
.pool-chip:disabled { cursor: not-allowed; }

/* ----------------------------------------------------------- danger zone */

.danger-zone {
  margin-top: 6px;
  border: 1px solid rgba(255, 93, 108, .35);
  border-radius: 12px;
  padding: 12px 14px;
  background: rgba(255, 93, 108, .06);
}
.danger-zone h3 {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--bad); margin-bottom: 10px;
}
.danger-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 8px 0;
}
.danger-row + .danger-row { border-top: 1px solid rgba(255, 93, 108, .18); }
.danger-row strong { font-size: 13px; }
.danger-row p { margin: 2px 0 0; }
.danger-row .btn { flex: none; }

/* ---------------------------------------------------------------- toast */

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: #191d38; border: 1px solid var(--panel-line);
  padding: 11px 18px; border-radius: 12px; z-index: 90;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .55); font-size: 14px;
}
.toast-good { border-color: rgba(63, 208, 122, .55); }
.toast-bad { border-color: rgba(255, 93, 108, .55); }
