/* ModiDex: mobile-first styles. Colors live in :root so the look is easy to rebrand. */
:root {
  --bg: #0b1020;
  --bg-2: #121933;
  --panel: #161f3d;
  --panel-2: #1d284d;
  --line: #2a376a;
  --text: #eef2ff;
  --muted: #9aa6cf;
  --accent: #c6ff3d;      /* lime */
  --accent-2: #22d3ee;    /* cyan */
  --hit: #22c55e;
  --close: #eab308;
  --miss: #3a4366;
  --danger: #f43f5e;
  --radius: 14px;
  --font-display: 'Russo One', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 50% -200px, rgba(34, 211, 238, 0.18), transparent 70%),
    radial-gradient(800px 400px at 100% 0, rgba(198, 255, 61, 0.08), transparent 70%),
    var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font-body);
  padding-bottom: env(safe-area-inset-bottom);
}
button { font: inherit; color: inherit; }
a { color: var(--accent-2); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.small { font-size: 12px; color: var(--muted); }

/* ---------- header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  background: rgba(11, 16, 32, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand h1 { margin: 0; font: 24px/1 var(--font-display); letter-spacing: 0.5px; }
.brand h1 span { color: var(--accent); }
.brand-sub { margin: 2px 0 0; font-size: 10px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--panel);
  font-size: 18px; font-weight: 800; cursor: pointer;
}
.icon-btn:active { transform: scale(0.95); }

/* ---------- mode tabs ---------- */
.modes {
  display: grid; grid-template-columns: repeat(var(--n, 4), 1fr); gap: 6px;
  max-width: 560px; margin: 12px auto 0; padding: 0 12px;
}
.mode-tab {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 2px; border-radius: 12px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line);
}
.mode-tab .mode-emoji { font-size: 20px; line-height: 1; }
.mode-tab .mode-label { font: 11px/1 var(--font-display); letter-spacing: 0.5px; color: var(--muted); }
.mode-tab.is-active { border-color: var(--accent); background: var(--panel-2); box-shadow: 0 0 0 1px var(--accent) inset; }
.mode-tab.is-active .mode-label { color: var(--accent); }
.mark {
  position: absolute; top: -5px; right: -5px;
  width: 18px; height: 18px; border-radius: 50%;
  font-size: 11px; font-weight: 800; display: grid; place-items: center;
}
.mark.won { background: var(--hit); color: #04140a; }
.mark.lost { background: var(--danger); color: #fff; }

main { max-width: 560px; margin: 0 auto; padding: 12px; }
.loading { text-align: center; color: var(--muted); padding: 40px 0; }

/* ---------- card (reusable) ---------- */
.card {
  --type: #888;
  position: relative; overflow: hidden;
  border-radius: 18px; padding: 14px;
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--type) 28%, transparent), transparent 55%),
    var(--panel);
  border: 2px solid color-mix(in srgb, var(--type) 70%, var(--line));
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), 0 0 0 4px rgba(255, 255, 255, 0.03) inset;
}
/* holo sheen */
.card::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.07) 45%, transparent 60%);
  background-size: 250% 100%;
  animation: sheen 6s ease-in-out infinite;
}
@keyframes sheen { 0%, 100% { background-position: 100% 0; } 50% { background-position: 0 0; } }
.card-top { display: flex; justify-content: space-between; font: 12px/1 var(--font-display); letter-spacing: 0.6px; color: var(--muted); }
.card-sport { padding: 4px 8px; border-radius: 999px; background: rgba(0, 0, 0, 0.3); color: var(--text); }
.card-hero { display: flex; gap: 12px; align-items: center; margin: 10px 0 12px; }
.emblem { flex: none; width: 96px; height: 96px; filter: drop-shadow(0 4px 12px color-mix(in srgb, var(--type) 50%, transparent)); }
.card.is-hidden .emblem { animation: pulse 2.6s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.04); } }
.card-id { min-width: 0; }
.card-name { margin: 0; font: 22px/1.1 var(--font-display); letter-spacing: 0.5px; overflow-wrap: anywhere; }
.card.is-hidden .card-name { color: var(--muted); letter-spacing: 3px; }
.card-category { margin: 3px 0 0; font-size: 13px; color: var(--muted); font-style: italic; }
.card-team { margin: 3px 0 0; font-size: 12px; color: var(--text); }
.types { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.type-badge {
  --type: #888;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px;
  font: 12px/1.3 var(--font-display); letter-spacing: 0.4px; text-transform: uppercase;
  background: color-mix(in srgb, var(--type) 85%, #000);
  color: #fff; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.5);
  border: 1px solid color-mix(in srgb, var(--type) 60%, #fff);
}

.stats { display: grid; gap: 5px; padding: 10px; border-radius: 12px; background: rgba(0, 0, 0, 0.25); }
.stat-row { display: grid; grid-template-columns: 34px 32px 1fr; align-items: center; gap: 6px; font-size: 12px; }
.stat-label { font-family: var(--font-display); color: var(--muted); }
.stat-val { text-align: right; font-weight: 800; }
.stat-track { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.stat-fill { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.stat-total { text-align: right; font: 11px/1 var(--font-display); color: var(--muted); margin-top: 2px; }
.stat-total b { color: var(--text); font-size: 13px; }

.bio {
  margin: 12px 0 0; padding: 10px 12px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.04); border-left: 3px solid var(--type);
  font-size: 14px;
}
.comp {
  display: grid; gap: 2px; margin-top: 10px; padding: 10px 12px; border-radius: 12px;
  background: linear-gradient(90deg, rgba(198, 255, 61, 0.12), rgba(34, 211, 238, 0.10));
  border: 1px dashed rgba(198, 255, 61, 0.5);
}
.comp-label { font: 10px/1 var(--font-display); letter-spacing: 1px; text-transform: uppercase; color: var(--accent); }
.comp-name { font: 17px/1.2 var(--font-display); }
.comp-why { font-size: 13px; color: var(--muted); }

/* ---------- clues ---------- */
.section-title { margin: 18px 2px 8px; font: 12px/1 var(--font-display); letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.clues ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.clue {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 9px 12px; border-radius: 10px;
  background: var(--bg-2); border: 1px dashed var(--line); color: var(--muted); font-size: 13px;
}
.clue.is-open { border-style: solid; border-color: var(--accent-2); color: var(--text); background: rgba(34, 211, 238, 0.08); }
.clue-label { font-weight: 800; white-space: nowrap; }
.clue-text { text-align: right; }

/* ---------- guess input ---------- */
#play-area { margin-top: 16px; }
.guess-form { display: flex; gap: 8px; scroll-margin-top: 74px; }
.ac-wrap { position: relative; flex: 1; }
#guess-input {
  width: 100%; height: 48px; padding: 0 14px;
  border-radius: 12px; border: 2px solid var(--line); background: var(--bg-2);
  color: var(--text); font: 16px var(--font-body); /* 16px stops iOS zooming */
}
#guess-input:focus { outline: none; border-color: var(--accent-2); }
.ac-list {
  position: absolute; max-height: min(300px, 40vh); left: 0; right: 0; top: calc(100% + 4px); z-index: 30;
  list-style: none; margin: 0; padding: 4px;
  overflow-y: auto;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}
.ac-item { display: flex; justify-content: space-between; gap: 8px; padding: 10px; border-radius: 8px; cursor: pointer; }
.ac-item.is-active, .ac-item:hover { background: rgba(34, 211, 238, 0.15); }
.ac-name { font-weight: 600; }
.ac-meta { color: var(--muted); font-size: 12px; white-space: nowrap; }
.ac-empty { padding: 10px; color: var(--muted); font-size: 13px; }

.btn {
  height: 48px; padding: 0 16px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel-2); font-weight: 800;
}
.btn-primary { background: var(--accent); color: #0b1020; border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.guess-count { display: flex; justify-content: space-between; align-items: center; margin: 8px 2px 0; font-size: 12px; color: var(--muted); }
.dots { display: flex; gap: 5px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.dot.used { background: var(--accent-2); }

/* ---------- guesses ---------- */
.hint { margin: 14px 2px; color: var(--muted); font-size: 13px; text-align: center; }
.tiles { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 4px; }
.tiles-head span { text-align: center; font: 10px/1 var(--font-display); letter-spacing: 0.5px; color: var(--muted); text-transform: uppercase; padding-bottom: 2px; }
.guess { margin-top: 8px; padding: 8px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); }
.guess.is-correct { border-color: var(--hit); }
.guess-name { display: flex; justify-content: space-between; font-weight: 600; font-size: 13px; margin: 0 2px 6px; }
.tile {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 46px; padding: 4px 2px; border-radius: 8px;
  font: 13px/1.1 var(--font-display); text-align: center; color: #fff;
  overflow-wrap: anywhere;
}
.tile.hit { background: var(--hit); color: #04140a; }
.tile.close { background: var(--close); color: #1a1300; }
.tile.miss { background: var(--miss); }
.tile .arrow { font-size: 10px; margin-top: 2px; opacity: 0.9; }
.nowrap { white-space: nowrap; }
.tile.mini { flex: none; display: inline-flex; min-height: 0; width: 24px; height: 24px; padding: 0; margin-right: 8px; vertical-align: middle; }
.tile.flip { animation: flip 0.5s ease both; animation-delay: var(--d); }
@keyframes flip {
  0% { transform: rotateX(90deg); opacity: 0; }
  100% { transform: rotateX(0); opacity: 1; }
}

/* ---------- result ---------- */
.panel { padding: 16px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.panel h2 { margin: 0 0 6px; font: 20px/1.2 var(--font-display); }
.panel.error h2 { color: var(--danger); }
.result.won { border-color: var(--hit); }
.result.lost { border-color: var(--danger); }
.result-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 12px 0; text-align: center; }
.result-stats b { display: block; font: 22px/1.1 var(--font-display); }
.result-stats span { font-size: 11px; color: var(--muted); }
.share-preview {
  margin: 0 0 10px; padding: 10px; border-radius: 10px; background: var(--bg);
  font: 13px/1.35 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; user-select: all;
}
.btn-row { display: flex; gap: 8px; }
.btn-row .btn-primary { flex: 1; }
.next { margin: 12px 0 6px; text-align: center; color: var(--muted); }
.next b { color: var(--text); font-family: var(--font-display); }
.next-modes { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; justify-content: center; font-size: 13px; color: var(--muted); }
.chip { padding: 7px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2); cursor: pointer; font-size: 13px; font-weight: 600; }
.chip.is-active { border-color: var(--accent); color: var(--accent); }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }

/* ---------- dialogs ---------- */
.dialog {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px);
  padding: 0; border: 1px solid var(--line); border-radius: 18px;
  background: var(--panel); color: var(--text);
}
.dialog::backdrop { background: rgba(3, 6, 15, 0.75); backdrop-filter: blur(3px); }
.dialog-inner { position: relative; padding: 18px; }
.dialog-x {
  position: sticky; top: 0; float: right; z-index: 2;
  width: 36px; height: 36px; margin: -6px -6px 0 8px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel-2); cursor: pointer; font-size: 16px;
}
.dialog h2 { margin: 0 0 8px; font: 22px/1.2 var(--font-display); }
.dialog h3 { margin: 18px 0 6px; font: 14px/1.2 var(--font-display); color: var(--accent); letter-spacing: 0.4px; }
.dialog p { margin: 6px 0; }
.dialog-close { width: 100%; margin-top: 16px; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 14px; }
.legend li { display: flex; align-items: center; }
.type-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.type-list li { display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.table-wrap { overflow-x: auto; }
.stat-table { border-collapse: collapse; font-size: 12px; min-width: 520px; }
.stat-table th, .stat-table td { padding: 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.stat-table th { font-family: var(--font-display); color: var(--muted); font-weight: 400; }
.dist { display: grid; gap: 4px; }
.dist-row { display: grid; grid-template-columns: 14px 1fr; gap: 8px; align-items: center; font-size: 13px; }
.dist-bar { display: block; padding: 2px 8px; border-radius: 6px; background: var(--accent-2); color: #0b1020; font-weight: 800; text-align: right; }

/* ---------- toast + footer ---------- */
.toast {
  position: fixed; left: 50%; top: 70px; z-index: 50;
  transform: translate(-50%, -20px); opacity: 0; pointer-events: none;
  padding: 10px 16px; border-radius: 999px; background: var(--text); color: var(--bg); font-weight: 800; font-size: 14px;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.footer { max-width: 560px; margin: 24px auto 0; padding: 0 16px 28px; text-align: center; font-size: 12px; color: var(--muted); }
.footer .legal { font-size: 10px; opacity: 0.75; }

/* ---------- bigger screens ---------- */
@media (min-width: 480px) {
  .emblem { width: 112px; height: 112px; }
  .card-name { font-size: 26px; }
  .tile { font-size: 14px; min-height: 52px; }
  .mode-tab { flex-direction: row; justify-content: center; gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- phones: keep the header on one line next to two buttons ---------- */
@media (max-width: 430px) {
  .brand-sub { font-size: 8.5px; letter-spacing: 0.6px; white-space: nowrap; }
  .brand h1 { font-size: 22px; }
}

/* ---------- very small phones (iPhone SE 1st gen, small Androids) ---------- */
@media (max-width: 359px) {
  .topbar { padding-left: 8px; padding-right: 8px; }
  .brand { gap: 6px; }
  .brand img { width: 28px; height: 28px; }
  .brand h1 { font-size: 20px; }
  .brand-sub { font-size: 8px; letter-spacing: 0.6px; white-space: nowrap; }
  .icon-btn { width: 36px; height: 36px; }
  .emblem { width: 80px; height: 80px; }
  .card-name { font-size: 20px; }
  .tile { font-size: 12px; }
}

/* ---------- tap-to-explain type popup ---------- */
[data-types] { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.tile.tappable { box-shadow: inset 0 -3px 0 rgba(255, 255, 255, 0.25); }
.tile.tappable:active, .type-badge[data-types]:active { transform: scale(0.95); }
.type-pop {
  position: fixed; z-index: 60; width: min(300px, calc(100vw - 16px));
  padding: 10px 12px; border-radius: 12px;
  background: var(--panel-2); border: 1px solid var(--accent-2);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
  font-size: 13px; animation: pop-in 0.12s ease-out;
}
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px); } }
.type-pop-row { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: center; }
.type-pop-row + .type-pop-row { margin-top: 6px; }
.type-pop-verdict { margin: 8px 0 0; padding-top: 8px; border-top: 1px solid var(--line); color: var(--muted); }
.type-pop-verdict.hit { color: var(--hit); }
.type-pop-verdict.close { color: var(--close); }

/* ---------- Gen 1 comp banner (top of card) ---------- */
.comp-banner {
  display: grid; gap: 2px; margin: 10px 0 0; padding: 10px 12px; border-radius: 12px;
  background: linear-gradient(90deg, rgba(198, 255, 61, 0.16), rgba(34, 211, 238, 0.12));
  border: 1px solid rgba(198, 255, 61, 0.55);
  text-align: center;
}
.comp-banner .comp-label { font: 10px/1 var(--font-display); letter-spacing: 1.5px; text-transform: uppercase; color: var(--accent); }
.comp-banner .comp-name { font: 26px/1.15 var(--font-display); letter-spacing: 0.5px; }
.comp-banner .comp-dex { font-size: 15px; color: var(--muted); vertical-align: middle; }
.comp-banner .comp-why { font-size: 13px; color: var(--muted); }

/* ---------- stat comparison ---------- */
.stat-row.has-cmp { grid-template-columns: 34px 32px 1fr 18px; }
.stat-track { position: relative; overflow: visible; }
.stat-fill { border-radius: 99px; }
.stat-marker {
  position: absolute; top: -3px; width: 3px; height: 14px; margin-left: -1.5px;
  border-radius: 2px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6);
}
.stat-cmp { text-align: center; font-size: 11px; font-weight: 800; color: var(--muted); }
.stat-cmp.hit { color: var(--hit); }
.stat-cmp.close { color: var(--close); }
.stat-cmp-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 10px; margin-bottom: 2px; font-size: 12px; color: var(--muted); }
.stat-cmp-head b { color: var(--text); }
.stat-cmp-key { font-size: 11px; display: inline-flex; align-items: center; gap: 4px; }
.key-marker { display: inline-block; width: 3px; height: 11px; border-radius: 2px; background: #fff; }

/* ---------- always-visible color key + selectable guesses ---------- */
.key-line { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; margin: 0 0 8px; font-size: 12px; color: var(--muted); }
.key-line span { display: inline-flex; align-items: center; gap: 4px; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.sw.hit { background: var(--hit); } .sw.close { background: var(--close); } .sw.miss { background: var(--miss); }
.guess { cursor: pointer; }
.guess.is-compared { border-color: var(--accent-2); box-shadow: 0 0 0 1px var(--accent-2) inset; }
.guess.is-correct { cursor: default; }
.guess-meta { display: inline-flex; align-items: center; gap: 6px; }
.cmp-tag { font-size: 11px; color: var(--accent-2); font-weight: 600; }

/* ---------- combined share ---------- */
.combined { margin-top: 14px; padding-top: 4px; border-top: 1px solid var(--line); }
.combined .section-title { margin-top: 12px; }

/* ---------- catching ---------- */
.top-actions { display: flex; gap: 6px; }
.next-throw { margin: 6px 2px 0; font-size: 12px; color: var(--muted); }
.next-throw b { color: var(--text); }
.dex-chip { margin-left: 6px; padding: 2px 6px; border-radius: 999px; font: 9px/1.4 var(--font-body); font-weight: 800; letter-spacing: 0.3px; text-transform: none; vertical-align: middle; }
.dex-chip.caught { background: rgba(34, 197, 94, 0.2); color: var(--hit); }
.dex-chip.seen { background: rgba(154, 166, 207, 0.2); color: var(--text); }
.dex-chip.new { background: rgba(198, 255, 61, 0.2); color: var(--accent); }

.catch {
  display: grid; justify-items: center; gap: 6px; margin: 0 0 14px; padding: 14px 12px;
  border-radius: 14px; text-align: center;
  background: radial-gradient(circle at 50% 0%, rgba(198, 255, 61, 0.14), transparent 70%), var(--bg-2);
  border: 1px solid var(--line);
}
.catch.caught { border-color: var(--hit); }
.catch.escaped { border-color: var(--close); }
.catch.fled { border-color: var(--danger); }
.catch-throw { font-size: 12px; color: var(--muted); }
.catch-ball { font-size: 44px; line-height: 1; }
.catch-msg { margin: 0; font-size: 15px; }
.catch-dex {
  margin-top: 4px; padding: 7px 12px; border-radius: 999px; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--line); font-size: 13px;
}
/* throw animation: the ball wobbles three times, then the result appears */
.catch.animate .catch-ball { animation: wobble 0.5s ease-in-out 3, settle 0.3s ease-out 1.5s both; }
.catch.animate .catch-msg, .catch.animate .catch-dex { opacity: 0; animation: fade-in 0.4s ease-out 1.6s forwards; }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-18deg); } 75% { transform: rotate(18deg); } }
@keyframes settle { from { transform: scale(1.25); } to { transform: scale(1); } }
@keyframes fade-in { to { opacity: 1; } }

/* ---------- Dex page ---------- */
.dex-bar { height: 10px; margin: 6px 0 12px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.dex-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.dex-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.dex-cell { display: grid; gap: 1px; padding: 7px 8px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); min-height: 52px; }
.dex-cell.caught { border-color: rgba(34, 197, 94, 0.6); background: rgba(34, 197, 94, 0.08); }
.dex-cell.seen { border-style: dashed; }
.dex-cell.unknown { opacity: 0.55; }
.dex-no { font: 10px/1.2 var(--font-display); color: var(--muted); }
.dex-name { font-size: 13px; font-weight: 700; overflow-wrap: anywhere; }
.dex-cell.seen .dex-name { color: var(--muted); }
.dex-via { font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 359px) { .top-actions .icon-btn { width: 34px; } }

/* ---------- profile ---------- */
.icon-btn.signed-in { background: var(--accent); color: #0b1020; border-color: var(--accent); font-family: var(--font-display); }
.btn-block { width: 100%; }
.or { text-align: center; color: var(--muted); font-size: 12px; margin: 12px 0 8px; }
.email-form { display: flex; gap: 8px; }
.email-form input {
  flex: 1; min-width: 0; height: 48px; padding: 0 12px; border-radius: 12px;
  border: 2px solid var(--line); background: var(--bg-2); color: var(--text); font: 16px var(--font-body);
}
.email-form input:focus { outline: none; border-color: var(--accent-2); }
.link-btn { padding: 0; border: 0; background: none; color: var(--danger); text-decoration: underline; cursor: pointer; font-size: inherit; }

/* ---------- phones: fit four header buttons + brand ---------- */
@media (max-width: 430px) {
  .topbar { padding-left: 10px; padding-right: 10px; gap: 6px; }
  .top-actions { gap: 4px; }
  .icon-btn { width: 34px; height: 34px; font-size: 16px; border-radius: 10px; }
  .brand { gap: 6px; min-width: 0; }
  .brand img { width: 26px; height: 26px; }
  .brand h1 { font-size: 20px; }
  .brand-sub { font-size: 7.5px; letter-spacing: 0.3px; }
  .email-form { flex-direction: column; }
  .email-form input { flex: none; }
}
@media (max-width: 359px) {
  .brand-sub { display: none; }
}

/* ---------- rare encounters ---------- */
.mark.rare { background: linear-gradient(135deg, #ffe27a, #ff9de2); color: #1a1300; font-size: 10px; }
.rare-line {
  font: 11px/1.2 var(--font-display); letter-spacing: 1px; text-transform: uppercase;
  color: #ffe27a; text-shadow: 0 0 8px rgba(255, 226, 122, 0.6);
}
.legend-note { color: #c9a7ff; }
.rare-tag { font: 11px/1.2 var(--font-display); letter-spacing: 1px; text-transform: uppercase; }
.rare-tag.legendary { color: #c9a7ff; }
.rare-tag.shiny { color: #ffe27a; }
.line-done { display: inline-block; margin-top: 6px; color: var(--accent); font-weight: 800; }

/* shiny: gold shimmer border */
.card.is-shiny {
  border-color: #ffe27a;
  box-shadow: 0 0 0 2px rgba(255, 226, 122, 0.35), 0 0 28px rgba(255, 226, 122, 0.35), 0 10px 30px rgba(0, 0, 0, 0.35);
}
.card.is-shiny::after {
  background: linear-gradient(115deg, transparent 25%, rgba(255, 240, 170, 0.22) 45%, rgba(255, 157, 226, 0.18) 55%, transparent 70%);
  background-size: 250% 100%;
  animation-duration: 3s;
}
.card.is-shiny .comp-banner .comp-name { color: #ffe27a; }
/* legendary: royal purple aura */
.card.is-legendary {
  border-color: #b388ff;
  box-shadow: 0 0 0 2px rgba(179, 136, 255, 0.35), 0 0 30px rgba(179, 136, 255, 0.4), 0 10px 30px rgba(0, 0, 0, 0.35);
}
.card.is-legendary .comp-banner { border-color: rgba(179, 136, 255, 0.8); background: linear-gradient(90deg, rgba(179, 136, 255, 0.22), rgba(255, 226, 122, 0.12)); }
.catch.is-shiny { border-color: #ffe27a; box-shadow: 0 0 22px rgba(255, 226, 122, 0.3); }
.catch.is-legendary { border-color: #b388ff; box-shadow: 0 0 22px rgba(179, 136, 255, 0.3); }
.dex-cell.shiny { border-color: #ffe27a; background: rgba(255, 226, 122, 0.08); }
.dex-cell.legendary .dex-no::after { content: ' 👑'; }

/* ---------- evolution lines ---------- */
.line-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.line-row { display: grid; grid-template-columns: 34px 1fr; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); }
.line-row.done { border-color: var(--accent); background: rgba(198, 255, 61, 0.07); }
.line-head { font: 12px/1 var(--font-display); color: var(--muted); text-align: center; }
.line-row.done .line-head { font-size: 18px; }
.line-members { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; font-size: 13px; }
.line-member.caught { font-weight: 800; color: var(--text); }
.line-member.seen { color: var(--muted); }
.line-member.unknown { color: var(--muted); opacity: 0.55; }
.line-arrow { color: var(--muted); opacity: 0.6; }

/* ---------- friends & groups ---------- */
.invite-note { padding: 8px 10px; border-radius: 10px; background: rgba(34, 211, 238, 0.1); border: 1px solid rgba(34, 211, 238, 0.4); }
.people { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.person {
  display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "rank name arrow" "rank meta arrow";
  align-items: center; column-gap: 8px; row-gap: 2px;
  padding: 9px 10px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line);
}
.person.tappable { cursor: pointer; }
.person.tappable:active { transform: scale(0.99); }
.person.is-me { border-color: var(--accent-2); }
.person .rank { grid-area: rank; font: 14px/1 var(--font-display); color: var(--muted); min-width: 16px; text-align: center; }
.person-name { grid-area: name; font-weight: 800; overflow-wrap: anywhere; }
.person-meta { grid-area: meta; font-size: 12px; color: var(--muted); }
.person-arrow { grid-area: arrow; color: var(--muted); font-size: 18px; }
.person-actions { grid-area: arrow; display: flex; gap: 6px; }
.btn-sm { height: 34px; padding: 0 10px; font-size: 13px; border-radius: 10px; }
.today-chip { display: inline-block; margin-right: 4px; white-space: nowrap; }
.today-row { line-height: 1.8; }
.code { font-family: var(--font-display); letter-spacing: 2px; color: var(--accent); }
.link-btn.plain { color: var(--accent-2); }
.dex-cell.mini { min-height: 40px; padding: 5px 6px; }
.dex-cell.mini .dex-name { font-size: 11px; }
