/* ===== PokéAtlas ===== */
:root {
  --bg: #0b1020;
  --bg2: #0f172a;
  --panel: #111a2e;
  --panel2: #16213a;
  --line: #22304d;
  --line2: #2c3c5f;
  --text: #e2e8f0;
  --muted: #8b9bb8;
  --accent: #f97316;
  --accent2: #ef4444;
  --good: #22c55e;
  --bad: #ef4444;
  --radius: 12px;
  --top: 58px;
  --side: 300px;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
body[data-game="emerald"] { --accent: #10b981; --accent2: #0ea5e9; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
img { image-rendering: pixelated; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.pad { padding: 16px; }
.good-text { color: var(--good); }

/* ===== Top bar ===== */
#app { height: 100%; display: flex; flex-direction: column; }
#topbar {
  height: var(--top); flex: 0 0 var(--top); display: flex; align-items: center; gap: 14px; padding: 0 14px;
  background: linear-gradient(180deg, #111a30, #0d1528); border-bottom: 1px solid var(--line); position: relative; z-index: 1200;
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-size: 18px; letter-spacing: .2px; }
.brand-ball { width: 26px; height: 26px; }
.brand-name b { color: var(--accent); }
.game-switch { display: flex; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.game-btn { display: flex; align-items: center; gap: 6px; border: 0; background: transparent; padding: 3px 12px 3px 4px; border-radius: 9px; color: var(--muted); transition: .15s; }
.game-btn img { width: 32px; height: 32px; margin: -4px 0; }
.game-btn span { display: flex; flex-direction: column; line-height: 1.05; text-align: left; }
.game-btn small { font-size: 10px; opacity: .8; }
.game-btn:hover { color: var(--text); background: var(--panel2); }
.game-btn.active { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent2)); box-shadow: 0 4px 14px -6px var(--accent); }
.view-tabs { display: flex; gap: 2px; margin-left: 4px; }
.view-tabs a { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 9px; text-decoration: none; color: var(--muted); font-size: 14px; white-space: nowrap; }
.view-tabs a:hover { background: var(--panel2); color: var(--text); }
.view-tabs a.active { background: var(--panel2); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.global-search { margin-left: auto; position: relative; width: min(380px, 32vw); }
.global-search input { width: 100%; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); color: var(--text); padding: 0 12px 0 34px; font-size: 14px; outline: none; }
.global-search input:focus { border-color: var(--accent); }
.search-icon { position: absolute; left: 11px; top: 10px; font-size: 13px; opacity: .7; }
.search-results { position: absolute; right: 0; top: 44px; width: min(460px, 92vw); max-height: 70vh; overflow: auto; background: var(--panel); border: 1px solid var(--line2); border-radius: 12px; box-shadow: 0 20px 50px -10px #000c; padding: 6px; }
.sr-row { display: grid; grid-template-columns: 34px 1fr; grid-template-rows: auto auto; column-gap: 8px; width: 100%; text-align: left; border: 0; background: transparent; padding: 6px 8px; border-radius: 8px; align-items: center; }
.sr-row:hover { background: var(--panel2); }
.sr-row > img, .sr-row > .sr-emoji { grid-row: span 2; width: 32px; height: 32px; display: grid; place-items: center; font-size: 18px; }
.sr-title { font-weight: 600; font-size: 14px; }
.sr-sub { color: var(--muted); font-size: 12px; }
.sr-more { padding: 8px; color: var(--muted); font-size: 12px; text-align: center; }

/* ===== Views ===== */
.view { display: none; flex: 1; min-height: 0; }
.view.active { display: flex; }
#view-map { position: relative; }

/* ===== Sidebar ===== */
#sidebar { width: var(--side); flex: 0 0 var(--side); background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; overflow-y: auto; z-index: 900; }
.panel-section { padding: 14px 14px 10px; border-bottom: 1px solid var(--line); }
.section-label { display: block; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.select-input, .text-input { width: 100%; height: 38px; background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: 9px; padding: 0 10px; font: inherit; font-size: 14px; outline: none; }
.select-input.sm { height: 32px; font-size: 13px; }
.select-input:focus, .text-input:focus { border-color: var(--accent); }
.quick-jumps details { margin-top: 8px; }
.quick-jumps summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.qj-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.qj-btn { border: 1px solid var(--line); background: var(--bg2); border-radius: 7px; padding: 3px 8px; font-size: 12px; }
.qj-btn:hover { border-color: var(--accent); }
.version-toggle { display: flex; background: var(--bg2); border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.version-toggle button { flex: 1; border: 0; background: transparent; border-radius: 7px; padding: 6px 4px; font-size: 13px; color: var(--muted); }
.version-toggle button.active, .ver-btn-z.active { color: #fff; background: #334155; }
.version-toggle .fr.active { background: #dc2626; }
.version-toggle .lg.active { background: #16a34a; }
.version-toggle.mini { margin: 8px 0; }
.progress-header { display: flex; justify-content: space-between; align-items: baseline; }
.progress-count { font-size: 13px; font-weight: 600; color: var(--accent); }
.progress-bar-track { height: 7px; background: var(--bg2); border-radius: 9px; overflow: hidden; border: 1px solid var(--line); }
.progress-bar-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .3s; }
.progress-controls { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; }
.checkbox-label { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--text); cursor: pointer; }
.checkbox-label input { accent-color: var(--accent); }
.section-header-row { display: flex; justify-content: space-between; align-items: center; }
.mini-actions { font-size: 12px; color: var(--muted); display: flex; gap: 4px; }
.link-btn { border: 0; background: none; color: var(--accent); font-size: 12px; padding: 0; }
.category-list { display: flex; flex-direction: column; gap: 5px; }
.cat-btn { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); background: var(--panel2); border-radius: 10px; padding: 7px 10px; text-align: left; transition: .12s; }
.cat-btn:hover { border-color: var(--cc); }
.cat-btn.off { opacity: .42; filter: grayscale(.7); }
.cat-icon { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; background: color-mix(in srgb, var(--cc) 22%, transparent); border: 1px solid color-mix(in srgb, var(--cc) 50%, transparent); font-size: 14px; }
.cat-name { flex: 1; font-size: 14px; font-weight: 500; }
.cat-count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sidebar-footer { margin-top: auto; padding: 12px 14px; display: flex; gap: 6px; border-top: 1px solid var(--line); }
.secondary-btn, .danger-btn, .ghost-btn, .primary-btn, .mini-btn { border-radius: 9px; padding: 8px 10px; font-size: 13px; border: 1px solid var(--line2); background: var(--panel2); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.secondary-btn { flex: 1; }
.danger-btn { color: #fca5a5; border-color: #7f1d1d; background: #2a1215; }
.primary-btn { background: linear-gradient(135deg, var(--accent), var(--accent2)); border-color: transparent; color: #fff; font-weight: 600; }
.primary-btn.sm { padding: 6px 12px; }
.ghost-btn { background: transparent; }
.mini-btn { padding: 2px 9px; font-size: 16px; }
.secondary-btn:hover, .ghost-btn:hover, .mini-btn:hover { border-color: var(--accent); }
.icon-btn { border: 1px solid var(--line); background: var(--panel2); border-radius: 8px; width: 32px; height: 32px; display: grid; place-items: center; }
.only-mobile { display: none; }

/* ===== Map ===== */
#map-wrap { flex: 1; position: relative; min-width: 0; }
#leaflet-map { position: absolute; inset: 0; background: #0f172a; }
.leaflet-container { background: #0f172a; font: inherit; }
.pixel-tiles, .leaflet-tile, .leaflet-image-layer { image-rendering: pixelated; image-rendering: crisp-edges; }
.leaflet-bar a { background: var(--panel) !important; color: var(--text) !important; border-color: var(--line) !important; width: 36px !important; height: 36px !important; line-height: 36px !important; font-size: 18px !important; }
.leaflet-bar a:hover { background: var(--panel2) !important; }
.fit-btn { display: block; text-align: center; text-decoration: none; border-radius: 4px; }
.zone-rect { fill: transparent; stroke: transparent; cursor: help; }
.zone-rect:hover { fill: rgba(56, 189, 248, .10); stroke: rgba(56, 189, 248, .7); }
.zone-label-wrap { pointer-events: none; }
.zone-label { transform: translate(-50%, -50%); white-space: nowrap; font-size: 12px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px #000, 0 0 4px #000; background: rgba(15, 23, 42, .55); padding: 2px 7px; border-radius: 6px; display: inline-block; }
.zone-label.tl { transform: translate(0, -100%); font-size: 11px; }
#leaflet-map.z-far .zone-label { font-size: 10px; }
#leaflet-map.z-far .zone-label.tl { display: none; }

.mk-wrap { background: none !important; border: 0 !important; }
.mk {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; transform: scale(var(--mk, 1)); transition: transform .12s;
  background: radial-gradient(circle at 50% 35%, #1e293b, #0b1222); border: 2px solid var(--cc); box-shadow: 0 2px 6px #000a, 0 0 0 1px #0008;
}
.mk img { max-width: 26px; max-height: 26px; pointer-events: none; }
.mk.cat-trainer img, .mk.cat-gym img, .mk.cat-npc img, .mk.cat-master_trainer img { max-height: 28px; max-width: 24px; margin-top: -4px; }
.mk.cat-pokemon img { max-width: 32px; max-height: 32px; margin-top: -6px; }
.mk-emoji { font-size: 14px; }
.mk.hidden-item { border-style: dashed; }
.mk.cat-location { width: 22px; height: 22px; border-width: 1px; opacity: .85; }
.mk.cat-location .mk-emoji { font-size: 11px; }
.mk.found { filter: grayscale(1) brightness(.6); opacity: .65; }
.mk.found::after { content: "✓"; position: absolute; right: -4px; bottom: -4px; font-size: 11px; background: var(--good); color: #fff; border-radius: 50%; width: 14px; height: 14px; display: grid; place-items: center; font-weight: 900; }
.mk:hover { transform: scale(calc(var(--mk, 1) * 1.25)); z-index: 1000; }
.mk.selected { transform: scale(calc(var(--mk, 1) * 1.35)); box-shadow: 0 0 0 3px #fff, 0 0 18px var(--cc); }
#leaflet-map.z-far .mk.cat-location { display: none; }
.mk-tip { background: var(--panel) !important; color: var(--text) !important; border: 1px solid var(--line2) !important; border-radius: 8px !important; box-shadow: 0 8px 24px #000a !important; font-size: 13px; }
.mk-tip span { color: var(--muted); font-size: 12px; }
.leaflet-tooltip-top.mk-tip::before { border-top-color: var(--line2) !important; }

.hud-pill { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); background: rgba(17, 26, 46, .92); border: 1px solid var(--line2); padding: 6px 14px; border-radius: 999px; z-index: 800; pointer-events: none; font-weight: 600; display: flex; gap: 8px; align-items: baseline; }
.hud-hint { font-size: 11px; color: var(--muted); font-weight: 400; }
.hud-coords { position: absolute; left: 10px; bottom: 10px; font: 12px ui-monospace, monospace; background: rgba(17, 26, 46, .85); padding: 3px 8px; border-radius: 6px; z-index: 800; color: var(--muted); }
.floating-back-btn { position: absolute; top: 12px; left: 12px; z-index: 800; background: var(--panel); border: 1px solid var(--line2); border-radius: 9px; padding: 7px 12px; }

/* ===== Drawer ===== */
.detail-drawer { position: fixed; top: calc(var(--top) + 10px); right: 10px; bottom: 10px; width: min(420px, calc(100vw - 20px)); background: var(--panel); border: 1px solid var(--line2); border-radius: 16px; z-index: 1100; display: flex; flex-direction: column; box-shadow: 0 20px 60px -10px #000d; animation: slidein .18s ease-out; }
@keyframes slidein { from { transform: translateX(20px); opacity: 0; } }
.drawer-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.drawer-badge { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; color: var(--bc); background: color-mix(in srgb, var(--bc) 15%, transparent); border: 1px solid color-mix(in srgb, var(--bc) 45%, transparent); }
.drawer-body { overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.drawer-hero { display: flex; gap: 12px; align-items: center; }
.trainer-pic { width: 80px; height: 80px; background: radial-gradient(circle, #24324f, transparent 70%); border-radius: 12px; }
.hero-icon { width: 48px; height: 48px; object-fit: contain; }
.drawer-title { font-size: 19px; font-weight: 700; line-height: 1.2; }
.drawer-meta { font-size: 13px; color: var(--muted); margin-top: 4px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.drawer-meta a { text-decoration: none; }
.drawer-meta a:hover { color: var(--accent); }
.drawer-details { margin: 0; font-size: 14px; line-height: 1.5; color: #cbd5e1; }
.drawer-sub { font-size: 12px; color: var(--muted); }
.drawer-section { border-top: 1px solid var(--line); padding-top: 10px; }
.pill { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line2); color: var(--muted); }
.pill.warn { color: #fbbf24; border-color: #78350f; margin-bottom: 6px; }
.pill.lv { color: #fde68a; }
.pill.unlock { color: #a7f3d0; }
.found-btn { border: 1px solid var(--line2); background: var(--panel2); border-radius: 10px; padding: 10px; font-weight: 600; }
.found-btn.is-found { background: color-mix(in srgb, var(--good) 20%, transparent); border-color: var(--good); color: #bbf7d0; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { border: 1px solid var(--line); background: var(--bg2); border-radius: 8px; padding: 5px 10px; font-size: 12px; color: var(--muted); }
.tab.active { color: #fff; border-color: var(--accent); background: color-mix(in srgb, var(--accent) 20%, transparent); }

/* party */
.party { display: flex; flex-direction: column; gap: 8px; }
.party-mon { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.pm-head { display: flex; align-items: center; gap: 8px; }
.pm-id { flex: 1; min-width: 0; }
.pm-name { font-weight: 600; font-size: 14px; }
.pm-name a { text-decoration: none; }
.pm-name a:hover { color: var(--accent); }
.pm-lv { color: var(--muted); font-weight: 500; font-size: 12px; margin-left: 4px; }
.pm-types { margin-top: 2px; display: flex; gap: 3px; }
.pm-item { display: flex; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); max-width: 120px; }
.pm-moves { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.poke-icon { width: 32px; height: 32px; flex: 0 0 32px; margin: -4px 0; }
.poke-icon.lg { width: 40px; height: 40px; flex-basis: 40px; }
.poke-icon.sm { width: 24px; height: 24px; flex-basis: 24px; margin: -3px 0; }
.item-icon { width: 24px; height: 24px; flex: 0 0 24px; }
.move-chip { font-size: 11px; padding: 2px 7px; border-radius: 6px; background: color-mix(in srgb, var(--tc) 22%, #0b1222); border: 1px solid color-mix(in srgb, var(--tc) 55%, transparent); white-space: nowrap; }
.type-badge { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .02em; color: #fff; text-shadow: 0 1px 1px #0008; padding: 2px 9px; border-radius: 6px; background: var(--tc); text-transform: uppercase; margin-right: 3px; }
.type-badge.sm { font-size: 9.5px; padding: 1px 6px; border-radius: 5px; }
.tdot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--tc); margin-left: 2px; box-shadow: 0 0 0 1px #0006; }
.matchup-row { display: flex; gap: 8px; align-items: flex-start; margin: 4px 0; }
.matchup-label { flex: 0 0 80px; font-size: 11px; font-weight: 700; padding: 3px 6px; border-radius: 6px; text-align: center; }
.matchup-label.w4 { background: #7f1d1d; color: #fecaca; }
.matchup-label.w2 { background: #9a3412; color: #fed7aa; }
.matchup-label.r2 { background: #14532d; color: #bbf7d0; }
.matchup-label.r4 { background: #064e3b; color: #a7f3d0; }
.matchup-label.im { background: #1e293b; color: #cbd5e1; }
.matchup-types { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; }
.shop-list { display: flex; flex-direction: column; gap: 2px; }
.shop-row { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 3px 4px; border-radius: 6px; }
.shop-row:hover { background: var(--panel2); }
.shop-row .price { margin-left: auto; color: #fde68a; font-variant-numeric: tabular-nums; }
.mon-card { display: flex; gap: 12px; align-items: center; }
.front-sprite { width: 96px; height: 96px; }
.dex-link.big { font-size: 16px; font-weight: 700; text-decoration: none; display: block; margin-bottom: 4px; }

/* encounters */
.enc-group { margin-bottom: 10px; }
.enc-group-title { font-size: 12px; font-weight: 700; color: #cbd5e1; margin: 6px 0; }
.enc-list { display: flex; flex-direction: column; gap: 2px; }
.enc-row { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; text-decoration: none; font-size: 13px; }
.enc-row:hover { background: var(--panel2); }
.enc-name { flex: 1; display: flex; flex-direction: column; font-weight: 600; min-width: 0; }
.enc-lv { color: var(--muted); font-size: 11.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.enc-meta { flex: none; width: 92px; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; align-self: flex-start; padding-top: 2px; }
.enc-rate { width: 100%; text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 700; position: relative; }
.enc-sub { display: flex; align-items: center; gap: 5px; }
.rate-bar { display: block; height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--accent) var(--r), var(--line) var(--r)); margin-bottom: 2px; }
.ver-pills { display: inline-flex; gap: 2px; }
.ver-pill { font-size: 9px; font-weight: 800; padding: 1px 4px; border-radius: 4px; }
.ver-pill.fr.on { background: #dc2626; color: #fff; }
.ver-pill.lg.on { background: #16a34a; color: #fff; }
.ver-pill.off { background: var(--bg2); color: #475569; }
.zone-markers { display: flex; flex-direction: column; gap: 2px; }
.zone-mk { display: flex; align-items: center; gap: 8px; text-decoration: none; font-size: 13px; padding: 3px 6px; border-radius: 6px; }
.zone-mk:hover { background: var(--panel2); }
.zone-mk.found { opacity: .5; text-decoration: line-through; }

/* ===== Page views ===== */
.page-view { background: var(--bg); }
.page-side { width: 320px; flex: 0 0 320px; background: var(--panel); border-right: 1px solid var(--line); overflow-y: auto; display: flex; flex-direction: column; }
.page-main { flex: 1; overflow-y: auto; padding: 22px 28px 60px; min-width: 0; }
.page-view.single .page-main { max-width: 1200px; margin: 0 auto; }
.page-head h1 { margin: 0 0 6px; font-size: 26px; }
.page-head p { margin: 0 0 18px; line-height: 1.5; max-width: 820px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.card h3 { margin: 0 0 12px; font-size: 15px; display: flex; gap: 8px; align-items: baseline; }
.empty { padding: 60px; text-align: center; color: var(--muted); }
.note { font-size: 13px; padding: 8px 10px; border-radius: 8px; background: var(--panel2); margin-top: 6px; }
.note.warn { color: #fbbf24; }
.table-scroll { overflow-x: auto; }

/* dex list */
.dex-filters { padding: 12px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; position: sticky; top: 0; background: var(--panel); z-index: 2; }
.dex-filter-row { display: flex; gap: 6px; }
.dex-list { flex: 1; overflow-y: auto; padding: 6px; }
.dex-row { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 8px; text-decoration: none; font-size: 14px; }
.dex-row:hover { background: var(--panel2); }
.dex-row.active { background: color-mix(in srgb, var(--accent) 18%, transparent); box-shadow: inset 3px 0 0 var(--accent); }
.dex-row.unavail .dex-name { color: var(--muted); }
.dex-no { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; width: 34px; }
.dex-name { flex: 1; font-weight: 500; }
.dex-bst { font-size: 12px; color: var(--muted); }

.dex-detail { max-width: 1100px; margin: 0 auto; }
.dex-hero { display: flex; gap: 24px; align-items: center; background: linear-gradient(135deg, color-mix(in srgb, var(--t1) 30%, var(--panel)), color-mix(in srgb, var(--t2) 18%, var(--panel)) 70%); }
.dex-hero-art { width: 192px; height: 192px; flex: 0 0 192px; display: grid; place-items: center; background: radial-gradient(circle, #ffffff18, transparent 70%); border-radius: 50%; }
.dex-hero-art img { width: 192px; height: 192px; }
.dex-hero-no { color: var(--muted); font-size: 13px; }
.dex-hero h1 { margin: 2px 0 8px; font-size: 32px; }
.flavor { font-size: 14px; line-height: 1.55; color: #cbd5e1; max-width: 640px; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; }
.facts span { display: flex; flex-direction: column; }
.facts b { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.hero-actions { margin-top: 12px; }
.dex-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dex-grid .card { margin: 0; }
.span2 { grid-column: span 2; }
.stat-row { display: grid; grid-template-columns: 60px 36px 1fr; align-items: center; gap: 8px; font-size: 13px; margin: 5px 0; }
.stat-label { color: var(--muted); }
.stat-val { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.stat-track { height: 8px; background: var(--bg2); border-radius: 6px; overflow: hidden; }
.stat-fill { display: block; height: 100%; border-radius: 6px; }
.loc-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; text-decoration: none; font-size: 13px; border-bottom: 1px solid var(--line); }
.loc-row:hover { background: var(--panel2); }
.loc-zone { font-weight: 600; flex: 1; }
.loc-method { color: var(--muted); }
.loc-lv { width: 70px; text-align: right; }
.loc-rate { width: 44px; text-align: right; color: var(--accent); font-weight: 600; }
.evo-chain { overflow-x: auto; padding: 6px 0; }
.evo-node { display: flex; align-items: center; gap: 4px; }
.evo-kids { display: flex; flex-direction: column; gap: 6px; }
.evo-branch { display: flex; align-items: center; gap: 4px; }
.evo-arrow { display: flex; flex-direction: column; align-items: center; color: var(--muted); font-size: 20px; min-width: 90px; }
.evo-arrow small { font-size: 11px; text-align: center; max-width: 120px; }
.evo-mon { display: flex; flex-direction: column; align-items: center; text-decoration: none; font-size: 13px; padding: 4px 8px; border-radius: 10px; }
.evo-mon:hover { background: var(--panel2); }
.evo-mon.cur { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.evo-sprite { width: 72px; height: 72px; }
.move-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.move-table th { text-align: left; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding: 6px; border-bottom: 1px solid var(--line); }
.move-table td { padding: 5px 6px; border-bottom: 1px solid #1a2540; }
.move-table td.lv { color: var(--muted); width: 50px; }
.move-table td.mvn { font-weight: 600; }
.cat { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 5px; }
.cat-physical { background: #7c2d12; color: #fed7aa; }
.cat-special { background: #1e3a8a; color: #bfdbfe; }
.cat-status { background: #334155; color: #e2e8f0; }
.chip-list { display: flex; flex-wrap: wrap; gap: 5px; }

/* team */
.team-slots { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 14px; }
.slot { background: var(--panel); border: 1px dashed var(--line2); border-radius: 14px; min-height: 170px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 10px; position: relative; text-align: center; gap: 4px; }
.slot.filled { border-style: solid; background: linear-gradient(160deg, color-mix(in srgb, var(--t1) 25%, var(--panel)), color-mix(in srgb, var(--t2) 15%, var(--panel))); }
.slot img { width: 96px; height: 96px; }
.slot-name { font-weight: 700; }
.slot-x { position: absolute; top: 6px; right: 6px; border: 0; background: #0006; border-radius: 6px; width: 22px; height: 22px; font-size: 11px; }
.slot-input { font-size: 13px; }
.cov-table { border-collapse: separate; border-spacing: 2px; font-size: 12px; }
.cov-table th { font-weight: 600; color: var(--muted); padding: 2px 4px; }
.cov-table td { text-align: center; padding: 3px 6px; border-radius: 5px; min-width: 38px; }
.cov-table tr.danger td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.cov-table td.bad { color: #fca5a5; font-weight: 700; }
.cov-table td.good { color: #86efac; font-weight: 700; }
.mult.m4 { background: #991b1b; color: #fff; font-weight: 800; }
.mult.m2 { background: #9a3412; color: #fff; font-weight: 700; }
.mult.m05 { background: #166534; color: #dcfce7; }
.mult.m025 { background: #065f46; color: #d1fae5; }
.mult.m0 { background: #111827; color: #94a3b8; font-weight: 700; }
.cov-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.cov-cell { display: flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 8px; background: var(--bg2); border: 1px solid var(--line); }
.cov-cell.miss { border-color: #7f1d1d; background: #1d0f13; }
.cov-cell span { display: flex; }
.row-controls { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; font-size: 13px; color: var(--muted); }
.row-controls .select-input { max-width: 460px; }
.sugg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin-top: 8px; }
.sugg { display: flex; gap: 8px; align-items: center; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; }
.sugg > div { flex: 1; min-width: 0; font-size: 13px; }
.sugg-img { width: 56px; height: 56px; }
.boss-table td.mu { display: table-cell; line-height: 1.1; }
.boss-table td.mu span { display: block; font-weight: 700; }
.boss-table td.mu small { color: var(--muted); }
.boss-table td.great { background: #14532d; }
.boss-table td.ok { background: #1e3a2a; }
.boss-table td.bad { background: #4c1d1d; }
.boss-table td.foe { display: flex; align-items: center; gap: 4px; text-align: left; white-space: nowrap; }
.empty-team p { margin: 0; color: var(--muted); }

/* types */
.type-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.tp, .tpa { border: 2px solid transparent; background: color-mix(in srgb, var(--tc) 35%, #0b1222); color: #fff; border-radius: 8px; padding: 6px 12px; font-weight: 700; font-size: 13px; text-shadow: 0 1px 1px #0008; }
.tp.on, .tpa.on { background: var(--tc); border-color: #fff; }
.calc-out { margin-top: 12px; }
.mon-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.mon-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px 3px 4px; border-radius: 999px; background: var(--bg2); border: 1px solid var(--line); text-decoration: none; font-size: 13px; }
.mon-chip:hover { border-color: var(--accent); }
.type-chart { border-collapse: separate; border-spacing: 2px; font-size: 12px; }
.type-chart th.col-h span { display: inline-block; writing-mode: vertical-rl; transform: rotate(180deg); background: var(--tc); color: #fff; padding: 6px 3px; border-radius: 5px; font-weight: 700; font-size: 10px; text-transform: uppercase; }
.type-chart th.corner { font-size: 10px; color: var(--muted); }
.type-chart td { width: 34px; height: 30px; text-align: center; border-radius: 5px; background: var(--bg2); font-weight: 700; }
.type-chart tr.hl td, .type-chart td.hl { outline: 1px solid #fff4; }
.type-chart tr.hl th .type-badge, .type-chart th.hl span { box-shadow: 0 0 0 2px #fff; }

/* guide */
.guide-side-head { padding: 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 2; }
.chapter-list { padding: 6px; }
.chapter-sep { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; padding: 12px 8px 4px; }
.chapter-row { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; text-decoration: none; font-size: 14px; }
.chapter-row:hover { background: var(--panel2); }
.chapter-row.active { background: color-mix(in srgb, var(--accent) 18%, transparent); box-shadow: inset 3px 0 0 var(--accent); }
.chapter-row.done .ch-num { background: var(--good); color: #052e16; }
.chapter-row.done .ch-title { color: var(--muted); }
.ch-num { flex: 0 0 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--panel2); border: 1px solid var(--line2); font-size: 11px; font-weight: 700; }
.ch-title { flex: 1; }
.ch-lv { font-size: 11px; color: var(--muted); }
.guide-chapter { max-width: 1250px; margin: 0 auto; }
.chapter-head h1 { margin: 2px 0 6px; font-size: 28px; }
.lead { font-size: 15px; color: #cbd5e1; margin: 0 0 10px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.area-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 16px; }
.area-chip { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); text-decoration: none; }
.area-chip:hover { border-color: var(--accent); color: var(--accent); }
.guide-cols { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.steps { margin: 0; padding-left: 22px; line-height: 1.6; font-size: 14.5px; }
.steps li { margin-bottom: 6px; }
.steps li::marker { color: var(--accent); font-weight: 700; }
.tips { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.tip { font-size: 13.5px; background: color-mix(in srgb, var(--accent) 9%, var(--panel2)); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); border-radius: 9px; padding: 8px 10px; line-height: 1.5; }
.done-toggle { margin-top: 14px; }
.boss-card .boss-head { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.boss-name { font-size: 18px; font-weight: 700; }
.rec-list { display: flex; flex-direction: column; gap: 8px; }
.rec { display: flex; gap: 10px; align-items: center; font-size: 14px; }
.rec-img { width: 64px; height: 64px; flex: 0 0 64px; }
.rec a { text-decoration: none; }
.catch-list { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 8px; }
.catch-row { display: flex; align-items: flex-start; gap: 8px; text-decoration: none; font-size: 13px; padding: 6px; border-radius: 8px; min-width: 0; }
.catch-row > .poke-icon, .catch-row > img { flex: none; margin-top: 2px; }
.cr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cr-top { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.cr-sp { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-meta { display: inline-flex; align-items: center; gap: 4px; flex: none; }
.cr-main .weak-row { margin-top: 3px; padding-top: 0; border-top: 0; }
.catch-row:hover { background: var(--panel2); }
.cr-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-lv { color: var(--muted); font-size: 11px; }
.new { color: #fde047; font-size: 9px; font-weight: 800; }
.list-row { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 4px 4px; border-radius: 6px; text-decoration: none; }
.list-row:hover { background: var(--panel2); }
.list-row.found .lr-title { text-decoration: line-through; color: var(--muted); }
.lr-title { flex: 1; min-width: 0; }
.lr-sub { color: var(--muted); font-size: 11px; max-width: 140px; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row a.map-link { text-decoration: none; }
.found-chk { accent-color: var(--good); }
.trainer-det, .shop-det { border-bottom: 1px solid var(--line); padding: 4px 0; }
.trainer-det summary, .shop-det summary { cursor: pointer; font-size: 13px; display: flex; align-items: center; gap: 6px; padding: 3px 0; }
.trainer-det .party { margin: 6px 0; }
.mon-mini { margin-left: auto; display: flex; }
.chapter-nav { display: flex; justify-content: space-between; margin-top: 20px; gap: 10px; }
.intro { line-height: 1.6; }
.map-link.small, a.small { font-size: 12px; color: var(--accent); text-decoration: none; }

/* misc */
.hover-tooltip { position: fixed; z-index: 3000; pointer-events: none; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--panel2); border: 1px solid var(--line2); padding: 10px 18px; border-radius: 10px; z-index: 4000; box-shadow: 0 10px 30px #000a; font-size: 14px; }
.loading { position: fixed; inset: 0; display: grid; place-items: center; align-content: center; gap: 10px; background: var(--bg); z-index: 5000; color: var(--muted); }
.loading img { width: 48px; height: 48px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #26344f; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ===== Responsive ===== */
@media (max-width: 1180px) {
  .view-tabs a span { display: none; }
  .global-search { width: min(280px, 30vw); }
  .guide-cols { grid-template-columns: 1fr; }
  .team-slots { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 820px) {
  :root { --top: 104px; }
  #topbar { flex-wrap: wrap; height: auto; padding: 8px 10px; gap: 8px; }
  .only-mobile { display: grid; }
  .brand-name { display: none; }
  .game-btn small { display: none; }
  .global-search { order: 5; width: 100%; margin: 0; }
  .view-tabs { margin-left: auto; }
  .view-tabs a { padding: 8px; }
  #sidebar { position: absolute; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: 10px 0 40px #000a; }
  body.sidebar-open #sidebar { transform: none; }
  .page-view:not(.single) { flex-direction: column; }
  .page-side { width: 100%; flex: 0 0 auto; max-height: 34vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .page-main { padding: 14px; }
  .dex-hero { flex-direction: column; text-align: center; }
  .dex-hero-art, .dex-hero-art img { width: 144px; height: 144px; flex-basis: 144px; }
  .facts { justify-content: center; }
  .dex-grid { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .team-slots { grid-template-columns: repeat(2, 1fr); }
  .detail-drawer { top: auto; left: 6px; right: 6px; width: auto; height: 62vh; bottom: 6px; }
  .catch-list { grid-template-columns: 1fr; }
}

/* ===== Weakness strip (every Pokémon card) ===== */
/* Types = solid uppercase blocks next to the name. Weaknesses = a separate, quieter row of
   rounded outline chips with a colour dot, so the two never read as one cluster. */
.weak-row { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 4px 6px; margin-top: 5px; padding-top: 5px; border-top: 1px dashed var(--line); font-weight: 500; }
.wk-chips { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.wk-lbl { font-size: 10px; letter-spacing: .02em; color: var(--muted); font-weight: 600; white-space: nowrap; line-height: 19px; }
.wk-lbl.im { margin-left: 0; }
.wk-none { font-size: 11px; color: var(--muted); font-style: italic; }
.wk-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; line-height: 1; padding: 3px 8px 3px 6px; border-radius: 999px; background: var(--bg2); color: #cbd5e1; border: 1px solid var(--line2); font-weight: 600; white-space: nowrap; }
.wk-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--tc); flex: none; }
.wk-badge.x4 { color: #fff; border-color: #f8717188; background: color-mix(in srgb, #ef4444 14%, var(--bg2)); }
.wk-x { font-size: 9.5px; font-weight: 800; color: #fca5a5; order: -1; margin-right: -1px; }
.wk-badge.x4::before { order: 0; }
.wk-badge.im { opacity: .75; border-style: dashed; }
.enc-name .weak-row { margin-top: 4px; padding-top: 0; border-top: 0; }
.enc-title { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; }
.enc-sp { font-weight: 700; }
.enc-types { display: inline-flex; gap: 3px; margin-top: 0; }
.enc-types .type-badge { margin-right: 0; }
.cr-name, .lr-title { display: flex; flex-direction: column; min-width: 0; }
.cr-name .weak-row, .lr-title .weak-row { margin-top: 2px; }

/* ===== Far / mid zoom decluttering ===== */
#leaflet-map.z-far .mk:not(.cat-gym) { width: 10px; height: 10px; margin: 10px; border-width: 2px; transform: none; background: var(--cc); box-shadow: 0 0 0 1px #000b; }
#leaflet-map.z-far .mk:not(.cat-gym) > * { display: none; }
#leaflet-map.z-far .mk.cat-gym { transform: scale(.7); }
#leaflet-map.z-far .zone-label.sub,
#leaflet-map.z-mid .zone-label.sub { display: none; }
#leaflet-map.z-mid .mk.cat-location { opacity: .55; }

/* ===== Touch / iPad ===== */
html, body { height: 100dvh; overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
body { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
#leaflet-map { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#leaflet-map .leaflet-control-zoom a, #leaflet-map .fit-btn { width: 40px; height: 40px; line-height: 40px; font-size: 20px; }
@media (pointer: coarse) {
  .tab, .cat-row, .ver-btn, .game-btn, .view-tabs a { min-height: 36px; }
}
/* inset connectors */
.conn-line { pointer-events: none; }
#leaflet-map.z-far .conn-line { stroke-width: 1.2px; }
#leaflet-map.z-far .conn-halo { display: none; }
.zone-label.inset { font-size: 10px; padding: 1px 5px; opacity: .92; }
.team-tabs.grouped > .tabs .tab { font-weight: 600; }
.tab-note { font-size: 12px; color: var(--muted); margin: 2px 0 8px; }
.team-tabs.sub { margin-top: 6px; }
.team-tabs.sub > .tabs .tab { font-size: 11px; padding: 4px 9px; }
.shop-tag { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 999px; font-size: 10.5px; color: var(--muted); border: 1px solid var(--line); vertical-align: 1px; }
