/* PocketDex - calm paper, soft cards, serif titles, a 3D meadow. Same family as Jeda. Tokens in design.md. */
:root {
  --bg: #f6f2eb;
  --surface: #ffffff;
  --surface-2: #f0ebe2;
  --line: #e6dfd3;
  --text: #26221d;
  --muted: #6b6157;
  --accent: #c0432f;
  --accent-soft: #f7e6df;
  --ok: #3f7f52;
  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 1px 2px rgba(60, 45, 25, 0.04), 0 8px 24px rgba(60, 45, 25, 0.07);
  --shadow-lift: 0 2px 4px rgba(60, 45, 25, 0.05), 0 14px 34px rgba(60, 45, 25, 0.1);
  --sans: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "Noto Serif", Georgia, serif;
  --pixel: "Silkscreen", "Segoe UI", monospace;
  --tabbar-h: 64px;
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  background-image: radial-gradient(ellipse 80% 340px at 50% -80px, rgba(232, 214, 176, 0.55), transparent 70%);
  background-repeat: no-repeat;
  color: var(--text);
  font: 400 15px/1.6 var(--sans);
  min-height: 100vh;
  padding-bottom: calc(var(--tabbar-h) + 36px + env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased;
}
img { image-rendering: pixelated; max-width: 100%; }
a { color: inherit; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, .h2 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.01em; line-height: 1.15; }
h1 { font-size: 2.1rem; }
h2, .h2 { font-size: 1.75rem; }
h3, .h3 { font-size: 0.78rem; font-weight: 650; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; line-height: 1.4; }
.h3 .muted { text-transform: none; letter-spacing: 0; font-weight: 500; margin-left: 6px; }
.eyebrow { display: block; font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.mt { margin-top: 22px; }
.lead { color: var(--muted); max-width: 62ch; margin-top: 8px; }
.hint { font-size: 0.82rem; color: var(--muted); margin-top: 14px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--text); color: var(--bg); padding: 8px 14px; border-radius: 999px; z-index: 50; }
.skip:focus { left: 12px; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------------------------------------------------------------- top bar + floating tab bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  max-width: 1180px; margin: 0 auto; padding: 14px 24px;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #f19a84 0 18%, var(--accent) 19% 100%);
  box-shadow: 0 0 0 3px var(--surface), 0 0 0 4px var(--line);
}
.brand-name { font-family: var(--serif); font-size: 1.35rem; font-weight: 600; letter-spacing: 0.01em; }
.hdr-progress { display: flex; align-items: center; gap: 10px; margin-left: auto; font-size: 0.85rem; }
.hdr-progress b { font-weight: 600; font-variant-numeric: tabular-nums; }
.hdr-label { color: var(--muted); font-size: 0.8rem; margin-right: -4px; }
.hdr-track { width: 110px; height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.hdr-track span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 999px; }
.icon-toggle {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface);
  border-radius: 999px; padding: 6px 12px 6px 10px; font-size: 0.82rem; cursor: pointer;
}
.icon-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-toggle[aria-pressed="false"] { color: var(--muted); }
.icon-toggle[aria-pressed="false"] .wave { opacity: 0.2; }

.tabbar {
  position: fixed; z-index: 25; left: 50%; transform: translateX(-50%);
  bottom: calc(12px + env(safe-area-inset-bottom));
  width: min(460px, calc(100% - 24px)); height: var(--tabbar-h);
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 6px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(16px);
  border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 12px 32px rgba(40, 30, 15, 0.16);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-decoration: none; color: var(--muted); font-size: 0.7rem; font-weight: 550; border-radius: 18px;
}
.tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a:hover { color: var(--text); }
.tabbar a.on { color: var(--text); background: var(--surface-2); font-weight: 650; }

.view { max-width: 1180px; margin: 0 auto; padding: 18px 24px 40px; outline: none; }
.page-head { margin: 10px 0 22px; }

/* ---------------------------------------------------------------- primitives */
.panel, .card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; min-width: 0; }
.row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; align-items: center; }
.row.center { justify-content: center; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 9px 18px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font-weight: 600; font-size: 0.92rem;
  text-decoration: none; cursor: pointer; transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn.primary { background: var(--text); color: var(--bg); border-color: var(--text); box-shadow: 0 6px 18px rgba(40, 30, 15, 0.18); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface); }
.btn.light { background: rgba(255, 255, 255, 0.92); border-color: transparent; box-shadow: 0 6px 18px rgba(40, 30, 15, 0.14); }
.btn.sm { min-height: 34px; padding: 5px 13px; font-size: 0.84rem; }
.btn.wide { width: 100%; margin-top: 14px; }
.btn.danger { color: var(--accent); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn .ico { width: 16px; height: 16px; }
.text-link { display: inline-flex; align-items: center; gap: 4px; margin-top: 12px; font-weight: 550; font-size: 0.9rem; color: var(--muted); }
.text-link:hover { color: var(--text); }
.panel > .text-link:first-child { margin: 0 0 14px; }
.icon-btn { background: none; border: 0; color: var(--muted); font-size: 0.8rem; text-decoration: underline; cursor: pointer; padding: 4px; }
.icon-btn:hover { color: var(--accent); }

.field-input {
  width: 100%; min-height: 44px; padding: 10px 14px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.field-input:focus { border-color: #cfc3b1; outline: none; box-shadow: 0 0 0 3px rgba(192, 67, 47, 0.12); }
textarea.field-input { resize: vertical; min-height: 88px; }
select.field-input { cursor: pointer; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--text); margin-top: 2px; flex: none; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--text); font-size: 0.74rem; font-weight: 600; text-transform: capitalize; white-space: nowrap;
}
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--tc, #ccc); }
.t-normal { --tc: #b0a789; } .t-fire { --tc: #e8642a; } .t-water { --tc: #3d7fd9; }
.t-electric { --tc: #e3b416; } .t-grass { --tc: #5daa3e; } .t-ice { --tc: #6cc4bf; }
.t-fighting { --tc: #b33026; } .t-poison { --tc: #9a5a63; } .t-ground { --tc: #c49a4e; }
.t-flying { --tc: #7fa6dc; } .t-psychic { --tc: #d9666f; } .t-bug { --tc: #93a62a; }
.t-rock { --tc: #a8913a; } .t-ghost { --tc: #4b5a73; } .t-dragon { --tc: #1f7a7a; }
.t-dark { --tc: #4a3d33; } .t-steel { --tc: #9aa1ad; } .t-fairy { --tc: #e0a0a8; }

/* sprite plate */
.lcd {
  background: radial-gradient(circle at 50% 62%, #fffdf9 0 34%, var(--surface-2) 70%);
  border-radius: var(--radius); display: grid; place-items: center;
}
.sprite-md { width: 96px; height: 96px; }
.sprite-lg { width: 144px; height: 144px; }
.sprite-xl { width: 192px; height: 192px; }
.silhouette { filter: brightness(0) opacity(0.82); }
.bob { animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-5px); } }

/* entry text: a quiet quote */
.dialog {
  margin-top: 16px; padding: 16px 20px; border-radius: var(--radius-sm); background: var(--surface-2);
  font-family: var(--serif); font-size: 1.05rem; line-height: 1.65; color: #3a332b;
}
.dialog b { font-family: var(--sans); font-size: 0.92em; letter-spacing: 0.02em; }
.big-name { font-family: var(--serif); font-size: 1.45rem; font-weight: 600; line-height: 1.2; }
.no, .pixel { font-family: var(--pixel); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

/* ---------------------------------------------------------------- meadow stage */
.stage {
  position: relative; overflow: hidden; border-radius: 26px; box-shadow: var(--shadow-lift);
  background: linear-gradient(180deg, var(--sky-top, #cfe0e8) 0%, var(--sky-bottom, #f3efe4) 62%);
  isolation: isolate;
}
.stage.hero { height: 340px; margin-bottom: 22px; }
.stage.tall { height: min(68vh, 620px); min-height: 380px; }
.meadow-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.meadow-canvas:active { cursor: grabbing; }
.stage-caption { position: absolute; left: 22px; top: 18px; z-index: 2; pointer-events: none; }
.stage.hero::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 46%; z-index: 1; pointer-events: none;
  background: linear-gradient(180deg, rgba(246, 242, 235, 0.55), rgba(246, 242, 235, 0)); }
.stage[data-phase="night"].hero::before { background: linear-gradient(180deg, rgba(20, 24, 38, 0.45), rgba(20, 24, 38, 0)); }
.stage-caption .eyebrow { color: #4d453c; }
.stage-title { font-family: var(--serif); font-size: 1.6rem; font-weight: 600; color: var(--text); }
.stage[data-phase="night"] .stage-caption .eyebrow, .stage[data-phase="night"] .stage-title { color: #f3ede3; }
.stage-cta { pointer-events: auto; display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 7px 14px;
  border-radius: 999px; background: rgba(255, 255, 255, 0.88); color: var(--text); font-size: 0.86rem; font-weight: 600;
  text-decoration: none; box-shadow: 0 1px 2px rgba(60, 45, 25, 0.08); transition: background 150ms ease; }
.stage-cta:hover { background: #fff; }
.stage-cta svg { width: 16px; height: 16px; }
.meadow-fallback { position: absolute; inset: auto 22px 22px 22px; background: rgba(255, 255, 255, 0.9); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 0.9rem; z-index: 2; }
.meadow-pick {
  position: absolute; left: 16px; bottom: 16px; z-index: 3; width: min(420px, calc(100% - 32px));
  display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 4px 12px; align-items: center;
  background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(8px); border-radius: 18px; padding: 10px 14px; box-shadow: var(--shadow-lift);
}
.meadow-pick img { width: 64px; height: 64px; grid-row: span 2; }
.pick-name { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; line-height: 1.2; margin: 2px 0 4px; }
.pick-actions { grid-column: 2; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.icon-close { margin-left: auto; width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--surface-2); cursor: pointer; display: grid; place-items: center; }
.icon-close svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.stage.hero .meadow-pick ~ .stage-cta, .stage.hero .meadow-pick:not([hidden]) + .stage-cta { display: none; }
.meadow-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.resident-list { list-style: none; display: grid; gap: 2px; max-height: 430px; overflow-y: auto; margin: 0 -8px; }
.resident-list a { display: flex; align-items: center; gap: 10px; padding: 4px 8px; border-radius: 12px; text-decoration: none; }
.resident-list a:hover { background: var(--surface-2); }
.resident-list img { width: 44px; height: 44px; }
.resident-list b { display: block; font-weight: 600; font-size: 0.92rem; }
.resident-list small { color: var(--muted); font-size: 0.78rem; }

/* ---------------------------------------------------------------- today */
/* next step strip (Today) */
.next-step { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 16px; align-items: center;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 18px; margin: 0 0 18px; }
.next-sprite { width: 56px; height: 56px; border-radius: 16px; background: var(--surface-2); display: grid; place-items: center; }
.next-sprite img { width: 48px; height: 48px; }
.next-copy .eyebrow { margin: 0; }
.next-title { font-family: var(--serif); font-size: 1.22rem; font-weight: 600; line-height: 1.25; margin-top: 2px; }
.next-text { color: var(--muted); font-size: 0.9rem; line-height: 1.45; }

.today-head { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-end; justify-content: space-between; margin: 8px 0 20px; }
.today-head h1 { margin-top: 4px; }
.kpis { display: flex; gap: 10px; flex-wrap: wrap; }
.kpis div { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 10px 16px; min-width: 104px; }
.kpis dt { font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 650; }
.kpis dd { font-family: var(--serif); font-size: 1.6rem; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpis small { font-family: var(--sans); font-size: 0.78rem; color: var(--muted); font-weight: 500; }
.today-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px; }
.encounter { grid-row: span 2; }
.train-partner { display: flex; align-items: center; gap: 14px; margin: 10px 0 6px; padding: 10px 14px 10px 8px; border-radius: var(--radius-sm); background: var(--surface-2); }
.tp-sprite { width: 64px; height: 64px; flex: none; }
.tp-body { flex: 1; min-width: 0; }
.tp-name { display: flex; justify-content: space-between; align-items: baseline; font-family: var(--serif); font-weight: 600; font-size: 1.05rem; }
.tp-name span { font-family: var(--pixel); font-size: 0.72rem; font-weight: 400; color: var(--muted); }
.tp-note { margin-top: 6px; font-size: 0.8rem; color: var(--muted); }
.streak:empty { display: none; }
.detail-tools { display: inline-flex; flex-wrap: wrap; gap: 4px 18px; margin-left: 8px; }
.timer-box { flex: none; text-align: right; }
.timer-sub { margin-top: 4px; font-size: 0.8rem; color: var(--muted); letter-spacing: 0.02em; white-space: nowrap; }
.battle-actions { margin-top: 18px; }
.train-partner.is-empty { padding: 10px 12px; }
.tp-suggest { opacity: 0.9; }
.encounter-actions { align-items: center; gap: 18px; }
.encounter-actions .text-link { margin-top: 0; }
.encounter-screen { height: 250px; }
.habit-quick { list-style: none; }
.habit-quick li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.habit-quick li:last-child { border-bottom: 0; }
.partner-row { display: flex; gap: 16px; align-items: center; }
.partner-row > div { flex: 1; min-width: 0; }
.xpbar { height: 8px; border-radius: 999px; background: var(--surface-2); margin-top: 8px; overflow: hidden; }
.xpbar u { display: block; height: 100%; background: var(--accent); border-radius: 999px; text-decoration: none; }
.mini-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; }
.mini-grid a { background: var(--surface-2); border-radius: 12px; display: grid; place-items: center; aspect-ratio: 1; }
.mini-grid img { width: 100%; }

/* ---------------------------------------------------------------- pokedex */
.dex { display: grid; grid-template-columns: minmax(0, 400px) minmax(0, 1fr); gap: 20px; align-items: start; }
.dex-list-pane { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; position: sticky; top: 76px; }
.dex-tools { padding: 16px 16px 10px; border-bottom: 1px solid var(--line); }
.filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
.filters .field-input { min-height: 38px; padding: 6px 10px; font-size: 0.84rem; border-radius: 12px; }
.count { font-size: 0.78rem; color: var(--muted); margin-top: 8px; }
.dex-list { overflow-y: auto; max-height: calc(100vh - 290px); min-height: 360px; padding: 10px 6px 6px;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 18px); mask-image: linear-gradient(180deg, transparent 0, #000 18px); }
.dex-row img { width: 40px; height: 40px; }
.dex-row {
  display: grid; grid-template-columns: 38px 40px minmax(0, 1fr) auto 14px; align-items: center; gap: 8px;
  padding: 2px 10px; border-radius: 12px; text-decoration: none;
}
.dex-row:hover { background: var(--surface-2); }
.dex-row.on { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--accent); }
.dex-row .no { font-size: 0.7rem; color: var(--muted); }
.dex-row .nm { font-weight: 600; font-size: 0.93rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dex-row .tp { display: flex; gap: 4px; }
.dex-row .mark { display: grid; place-items: center; }
.empty { padding: 24px; color: var(--muted); }
.dex-detail-pane { min-width: 0; }
.detail-empty { min-height: 420px; text-align: center; padding: 28px; align-content: center; gap: 6px; }
.detail { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px 28px 28px; }
.detail-nav { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 18px; }
.back-link { display: none; }
.detail-top { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 28px; align-items: start; }
.detail-screen { width: 240px; height: 240px; }
.detail-id .eyebrow { color: var(--accent); }
.detail-id .eyebrow, .field-card .no { font-family: var(--pixel); letter-spacing: 0.04em; text-transform: none; font-weight: 400; font-size: 0.78rem; }
.detail-id h2 { font-size: 2.6rem; margin: 6px 0 2px; }
.genus { color: var(--muted); margin-bottom: 12px; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 22px; margin-top: 16px; }
.facts div { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.facts dt { color: var(--muted); }
.facts dd { font-weight: 600; text-align: right; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.entry-text { font-size: 1.08rem; }
.detail-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 34px; margin: 26px 0 8px; }
.detail > section, .detail-cols section { margin-top: 20px; }
.stat { display: grid; grid-template-columns: 72px 34px minmax(0, 1fr); gap: 10px; align-items: center; padding: 5px 0; }
.stat span { color: var(--muted); font-size: 0.85rem; }
.stat b { text-align: right; font-variant-numeric: tabular-nums; font-size: 0.9rem; }
.stat i { height: 8px; display: block; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.stat u { display: block; height: 100%; background: var(--text); opacity: 0.78; border-radius: 999px; text-decoration: none; }
.stat.total { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 9px; }
.stat.total i { background: none; }
.stat.total b { color: var(--accent); }
.weak-row { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); align-items: start; }
.weak-row:last-child { border-bottom: 0; }
.weak-label { color: var(--muted); font-size: 0.85rem; }
.evo-chain { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.evo-kids { display: flex; flex-direction: column; gap: 6px; }
.evo-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.evo-node {
  display: flex; flex-direction: column; align-items: center; text-decoration: none; background: var(--surface-2);
  border-radius: 16px; padding: 6px 10px 8px; min-width: 96px; font-size: 0.8rem; font-weight: 600;
}
.evo-node:hover { background: #e9e2d6; }
.evo-node img { width: 64px; height: 64px; }
.evo-node.on { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px rgba(192, 67, 47, 0.35); }
.evo-arrow { color: var(--muted); display: grid; }
.note { margin-top: 4px; }

/* ---------------------------------------------------------------- focus */
.focus-setup { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.target { display: flex; gap: 20px; align-items: center; background: var(--surface-2); border-radius: var(--radius); padding: 14px 18px; margin: 14px 0 18px; }
.durations, .palette-pick { border: 0; display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.durations legend, .palette-pick legend { font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 650; margin-bottom: 8px; }
.durations label span, .palette-pick label span {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface);
  border-radius: 999px; padding: 8px 16px; cursor: pointer; font-weight: 600; font-size: 0.88rem;
}
.durations input, .palette-pick input { position: absolute; opacity: 0; }
.durations input:checked + span, .palette-pick input:checked + span { background: var(--text); color: var(--bg); border-color: var(--text); }
.durations input:focus-visible + span, .palette-pick input:focus-visible + span { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.log { list-style: none; }
.log li { display: grid; grid-template-columns: 40px 1fr auto auto; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 0.86rem; }
.log li:last-child { border-bottom: 0; }
.log img { width: 40px; height: 40px; }
.log b.caught { color: var(--ok); }
.log b.fled { color: var(--muted); }
.battle { max-width: 680px; margin: 0 auto; }
/* arena: wild Pokemon top right, partner bottom left (seen from behind) */
.arena {
  position: relative; display: grid; grid-template-rows: 1fr 1fr; gap: 6px; min-height: 420px;
  padding: 20px 22px 16px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  background:
    radial-gradient(ellipse 70% 40% at 50% 0%, rgba(255, 253, 249, 0.9), transparent 70%),
    linear-gradient(180deg, #edf0e8 0%, #f1efe4 38%, #ebe4cf 58%, #e6dcc2 100%);
}
.combatant { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; }
.combatant.ally { grid-template-columns: auto minmax(0, 1fr); }
.status-card {
  width: 100%; max-width: 290px; padding: 10px 14px 12px; border-radius: 16px;
  background: var(--surface); box-shadow: var(--shadow);
}
.combatant.ally .status-card { justify-self: end; }
.sc-name { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 4px; font-family: var(--serif); font-size: 1.08rem; font-weight: 600; line-height: 1.25; }
.sc-name span { font-family: var(--pixel); font-size: 0.72rem; font-weight: 400; color: var(--muted); white-space: nowrap; }
.sc-note { margin-top: 6px; font-size: 0.78rem; line-height: 1.4; color: var(--muted); }
.pad { position: relative; display: grid; place-items: end center; width: 210px; height: 176px; }
.pad::before {
  content: ""; position: absolute; left: 6%; right: 6%; bottom: 4px; height: 38px; border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(112, 128, 76, 0.32), rgba(112, 128, 76, 0) 70%);
}
.pad-empty { place-items: end center; }
.pad-ghost { position: relative; width: 64%; height: 58%; margin-bottom: 18px; border: 2px dashed var(--line); border-radius: 50% 50% 44% 44%; }
.sc-cta { margin-top: 10px; }
.foe-sprite { position: relative; width: 164px; height: 164px; }
.ally-sprite { position: relative; width: 188px; height: 188px; transform: scaleX(-1); }
.hp { display: flex; align-items: center; gap: 8px; font-size: 0.72rem; font-weight: 650; color: var(--muted); }
.hp i { flex: 1; height: 8px; border-radius: 999px; background: var(--surface-2); display: block; overflow: hidden; }
.hp u { display: block; height: 100%; background: var(--accent); border-radius: 999px; text-decoration: none; transition: width 0.6s ease; }
.hp.ok u { background: #7d7468; }
.xp { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 0.66rem; font-weight: 650; color: var(--muted); }
.xp i { position: relative; flex: 1; height: 5px; border-radius: 999px; background: var(--surface-2); display: block; overflow: hidden; }
.xp u { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; text-decoration: none; transition: width 0.6s ease; }
.xp .xp-gain { background: rgba(43, 38, 33, 0.18); }
.xp .xp-now { background: var(--text); z-index: 1; }
.battle-tools { display: flex; justify-content: center; gap: 22px; margin-top: 14px; }
.tool-link { border: 0; background: none; padding: 6px 2px; font: inherit; font-size: 0.86rem; font-weight: 550; color: var(--muted); cursor: pointer; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 4px; }
.tool-link:hover { color: var(--text); text-decoration-color: currentColor; }
.tool-link[aria-pressed="true"] { color: var(--text); }
.arena.is-paused .foe-sprite, .arena.is-paused .ally-sprite { filter: saturate(0.4); opacity: 0.85; }
.hit { animation: hit 0.7s steps(1) 1; }
@keyframes hit { 0%, 30%, 60% { opacity: 0.2; } 15%, 45%, 75%, 100% { opacity: 1; } }
.ally-sprite.lunge, .fw-ally.lunge { animation: lunge 0.5s ease 1; }
@keyframes lunge { 45% { transform: scaleX(-1) translate(-22px, -8px); } }
.command {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px;
  padding: 14px 20px; border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow);
}
.cmd-msg { font-family: var(--serif); font-size: 1.04rem; line-height: 1.5; color: #3a332b; }
.timer { font-family: var(--serif); font-size: 2.8rem; line-height: 1; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }

/* floating focus widget: on every page except Focus while a session runs */
.focus-widget {
  position: fixed; z-index: 24; right: 20px; bottom: calc(12px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 12px; width: 320px; height: var(--tabbar-h); padding: 6px 16px 6px 6px;
  color: var(--text); text-decoration: none;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(16px);
  border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 12px 32px rgba(40, 30, 15, 0.16);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.focus-widget[hidden] { display: none; }
.focus-widget:hover { transform: translateY(-2px); box-shadow: 0 16px 36px rgba(40, 30, 15, 0.2); }
.fw-sprites { position: relative; flex: none; width: 74px; height: 100%; border-radius: 16px; background: var(--surface-2); overflow: hidden; }
.fw-foe { position: absolute; right: 0; top: -2px; width: 38px; height: 38px; }
.fw-ally { position: absolute; left: 0; bottom: -4px; width: 44px; height: 44px; transform: scaleX(-1); }
.fw-main { flex: 1; min-width: 0; display: grid; gap: 3px; }
.fw-title { font-size: 0.8rem; font-weight: 650; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fw-sub { font-size: 0.72rem; color: var(--muted); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fw-time { font-family: var(--serif); font-size: 1.4rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.focus-widget.is-paused .fw-time { color: var(--muted); }
body.has-focus-widget .toast { bottom: calc(var(--tabbar-h) * 2 + 40px); }
@media (max-width: 1080px) {
  .focus-widget { right: auto; left: 50%; transform: translateX(-50%); width: min(460px, calc(100% - 24px)); bottom: calc(var(--tabbar-h) + 22px + env(safe-area-inset-bottom)); }
  .focus-widget:hover { transform: translateX(-50%) translateY(-2px); }
  body.has-focus-widget { padding-bottom: calc(var(--tabbar-h) * 2 + 56px + env(safe-area-inset-bottom)); }
}

@media (min-width: 1081px) {
  .tabbar {
    top: 12px; bottom: auto; height: 46px; width: auto;
    display: flex; gap: 2px; padding: 4px;
    background: color-mix(in srgb, var(--surface) 70%, transparent); box-shadow: none; border-radius: 999px;
  }
  .tabbar a { flex-direction: row; gap: 7px; padding: 0 16px; font-size: 0.86rem; border-radius: 999px; }
  .tabbar svg { width: 18px; height: 18px; }
  .hdr-track { display: none; }
  body { padding-bottom: 48px; }
  .battle { min-height: calc(100vh - 150px); display: flex; flex-direction: column; justify-content: center; }
  .arena { min-height: 460px; }
  body.has-focus-widget { padding-bottom: calc(var(--tabbar-h) + 48px); }
}

/* video that feeds the phone mini player; must stay in the DOM but out of sight */
.mini-video { position: fixed; left: 0; bottom: 0; width: 2px; height: 2px; opacity: 0.01; pointer-events: none; }

/* pop-out battle window (Document Picture-in-Picture) */
.pip-body { margin: 0; min-height: 100vh; padding: 0; background: var(--bg); }
.pip-battle {
  display: grid; grid-template-rows: 1fr 1fr auto; gap: 4px; height: 100vh; box-sizing: border-box; padding: 10px 12px;
  background: linear-gradient(180deg, #edf0e8 0%, #f3efe5 46%, #e8e1cb 46%, #eee8d7 100%);
}
.pip-foe, .pip-ally { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 0; }
.pip-card { flex: 1; min-width: 0; padding: 6px 10px; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.pip-card small { font-family: var(--pixel); font-size: 0.66rem; color: var(--muted); font-weight: 400; }
.pip-battle .fw-foe, .pip-battle .fw-ally { position: static; flex: none; }
.pip-battle .fw-foe { width: 76px; height: 76px; }
.pip-battle .fw-ally { width: 84px; height: 84px; }
.pip-battle .fw-time { font-size: 1.7rem; line-height: 1.1; }
.pip-battle.is-paused .fw-time { color: var(--muted); }
.pip-none { font-size: 0.78rem; color: var(--muted); }
.pip-actions { display: flex; gap: 8px; justify-content: center; }
.pip-done { display: grid; place-items: center; align-content: center; gap: 8px; height: 100vh; text-align: center; font-family: var(--serif); font-size: 1.15rem; font-weight: 600; }
.pip-done img { width: 112px; height: 112px; }

/* ---------------------------------------------------------------- habits */
.habits-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.habit-list { list-style: none; margin: 8px 0 18px; }
.habit { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.streak { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.week { display: flex; gap: 4px; }
.day { width: 22px; height: 22px; display: grid; place-items: center; font-size: 0.66rem; font-weight: 600; border-radius: 50%; background: var(--surface-2); color: var(--muted); }
.day.done { background: var(--text); color: var(--bg); }
.day.today { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--accent); }
.add-habit { display: grid; grid-template-columns: minmax(0, 1fr) 150px auto; gap: 8px; }
.partner-big { height: 220px; margin-bottom: 14px; }
.starter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin: 12px 0; }
.starter, .evo-choice, .pick-item {
  display: flex; flex-direction: column; align-items: center; background: var(--surface-2); border: 0;
  border-radius: 16px; padding: 6px; cursor: pointer; font-size: 0.8rem; font-weight: 600;
}
.starter:hover, .evo-choice:hover, .pick-item:hover { background: #e9e2d6; }
.starter img, .evo-choice img { width: 72px; height: 72px; }

/* ---------------------------------------------------------------- field dex */
.field-head { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: flex-end; margin: 10px 0 22px; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.field-card { display: flex; flex-direction: column; gap: 6px; padding: 14px; text-decoration: none; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); transition: transform 0.15s ease; }
.field-card:hover { transform: translateY(-2px); }
.field-card .no { color: var(--accent); }
.field-card img { width: 100%; max-width: 128px; margin: 0 auto; aspect-ratio: 1; border-radius: 12px; }
.empty-state { display: grid; gap: 14px; justify-items: start; max-width: 540px; }
.empty-state .lcd { width: 100%; height: 140px; font-family: var(--serif); font-size: 1.2rem; color: var(--muted); }
.field-new-grid { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 28px; margin-top: 18px; }
.field-preview { aspect-ratio: 1; width: 100%; }
.field-preview .sprite-xl { width: 82%; height: auto; border-radius: 12px; }
.palette-pick { margin: 16px 0 10px; }
.palette-pick label span { padding: 6px 12px; font-size: 0.8rem; }
.palette-pick i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: -5px; box-shadow: 0 0 0 1.5px var(--surface); }
.palette-pick i:last-of-type { margin-right: 4px; }
.palette-pick .rainbow { background: conic-gradient(#e8642a, #e3b416, #5daa3e, #3d7fd9, #e8642a); }
.fd-form { display: grid; gap: 14px; align-content: start; }
.fd-form label { display: grid; gap: 6px; font-weight: 600; font-size: 0.85rem; }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }

/* ---------------------------------------------------------------- quiz */
.quiz { max-width: 620px; margin: 0 auto; }
.quiz-head { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; margin: 10px 0 18px; }
.quiz-head .field-input { width: auto; }
.quiz-screen { height: 300px; box-shadow: var(--shadow); }
.quiz-options { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; margin-top: 16px; }
.option { justify-content: flex-start; border-radius: var(--radius-sm); min-height: 50px; }
.option .key { font-size: 0.72rem; color: var(--muted); background: var(--surface-2); border-radius: 6px; padding: 1px 7px; }
.option.right { background: var(--text); color: var(--bg); border-color: var(--text); opacity: 1; }
.option.right .key { background: rgba(255, 255, 255, 0.18); color: var(--bg); }
.option.wrong { color: var(--accent); border-color: rgba(192, 67, 47, 0.4); opacity: 1; text-decoration: line-through; }
.quiz-score { text-align: center; margin-top: 18px; color: var(--muted); font-size: 0.9rem; }
.quiz-score b { color: var(--text); }

/* ---------------------------------------------------------------- team */
.view[data-route="team"] .panel + .panel { margin-top: 20px; }
.slots { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.slot { background: var(--surface-2); border-radius: 18px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px; min-height: 172px; text-align: center; }
.slot img { width: 80px; height: 80px; }
.slot b { font-size: 0.9rem; }
.slot.empty { border: 1.5px dashed #d8cfbf; background: transparent; color: var(--muted); justify-content: center; cursor: pointer; font-weight: 600; }
.slot.empty:hover { color: var(--text); border-color: var(--muted); }
.summary p { margin-bottom: 6px; }
.table-wrap { overflow-x: auto; margin-top: 16px; }
.matchup { border-collapse: collapse; font-size: 0.84rem; min-width: 520px; }
.matchup th, .matchup td { border-bottom: 1px solid var(--line); padding: 4px 8px; text-align: center; }
.matchup th img { width: 40px; height: 40px; display: block; margin: auto; }
.matchup td:first-child { text-align: left; }
.matchup tr.danger td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.matchup tr.danger td:nth-last-child(2) { color: var(--accent); font-weight: 650; }
.m2, .m4 { color: var(--accent); font-weight: 650; }
.m4 { background: var(--accent-soft); }
.m05, .m025 { color: var(--muted); }
.m0 { background: var(--surface-2); font-weight: 650; }
.calc { display: grid; grid-template-columns: repeat(2, minmax(0, 200px)); gap: 8px; margin: 8px 0 12px; }

/* ---------------------------------------------------------------- trainer */
.trainer-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.trainer-card h1 { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 6px 0 8px; }
.trainer-card h3 { margin-top: 24px; }
.badges { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.badge { background: var(--surface-2); border-radius: 16px; padding: 12px 8px; display: grid; justify-items: center; text-align: center; gap: 2px; color: var(--muted); }
.badge.earned { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line), var(--shadow); color: var(--text); }
.badge-svg { width: 40px; height: 40px; }
.badge b { font-size: 0.86rem; }
.badge span { font-size: 0.72rem; line-height: 1.35; }
.gen-row { display: grid; grid-template-columns: 72px minmax(0, 1fr) 64px; gap: 10px; align-items: center; padding: 5px 0; font-size: 0.86rem; }
.gen-row i { height: 8px; border-radius: 999px; background: var(--surface-2); display: block; overflow: hidden; }
.gen-row u { display: block; height: 100%; background: var(--accent); border-radius: 999px; text-decoration: none; }
.gen-row b { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.keys-help { list-style: none; display: grid; gap: 6px; font-size: 0.86rem; }
kbd { font: 600 0.72rem var(--sans); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; background: var(--surface); }

/* ---------------------------------------------------------------- more */
.more-list { display: grid; gap: 10px; max-width: 640px; }
.more-item {
  display: grid; grid-template-columns: 46px minmax(0, 1fr) 18px; gap: 14px; align-items: center;
  padding: 14px 16px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); text-decoration: none;
  transition: transform 0.15s ease;
}
.more-item:hover { transform: translateY(-1px); box-shadow: var(--shadow-lift); }
.more-icon { width: 46px; height: 46px; border-radius: 14px; background: var(--surface-2); display: grid; place-items: center; }
.more-icon .ico { width: 22px; height: 22px; }
.more-item b { display: block; font-family: var(--serif); font-size: 1.12rem; font-weight: 600; }
.more-item small { color: var(--muted); font-size: 0.86rem; }
.more-item > .ico { color: var(--muted); }

/* ---------------------------------------------------------------- toast + modal */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 40;
  bottom: calc(var(--tabbar-h) + 26px + env(safe-area-inset-bottom));
  width: min(520px, calc(100vw - 24px)); padding: 13px 18px; border-radius: 16px;
  background: var(--text); color: var(--bg); font-weight: 500; font-size: 0.92rem; box-shadow: var(--shadow-lift); cursor: pointer;
}
.modal { position: fixed; inset: 0; background: rgba(38, 34, 29, 0.32); backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 30; padding: 16px; }
.modal-card { background: var(--surface); border-radius: 24px; box-shadow: 0 24px 60px rgba(40, 30, 15, 0.25); padding: 24px; width: min(520px, 100%); max-height: 86vh; overflow-y: auto; display: grid; gap: 14px; }
.modal-card h2 { font-size: 1.6rem; }
.pick-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; max-height: 50vh; overflow-y: auto; }
.pick-item img { width: 64px; height: 64px; }
.pick-item span { font-family: var(--pixel); font-size: 0.62rem; color: var(--muted); }
.evo-row { display: grid; place-items: center; }
.evo-from { width: 160px; height: 160px; animation: flash 0.5s steps(2) 6; }
@keyframes flash { 50% { filter: brightness(0) invert(1); } }
.evo-options { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .dex { grid-template-columns: minmax(0, 340px) minmax(0, 1fr); }
  .detail-top { grid-template-columns: minmax(0, 1fr); }
  .detail-screen { width: 100%; }
  .detail-cols { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .slots { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .meadow-layout { grid-template-columns: minmax(0, 1fr); }
  .resident-list { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); max-height: none; }
}

@media (max-width: 900px) {
  .topbar { padding: 10px 16px; gap: 10px; }
  .view { padding: 12px 16px 32px; }
  .today-grid, .focus-setup, .habits-grid, .trainer-grid { grid-template-columns: minmax(0, 1fr); }
  .encounter { grid-row: auto; }
  .kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; gap: 8px; }
  .kpis div { min-width: 0; padding: 9px 12px; }
  .dex { grid-template-columns: minmax(0, 1fr); }
  .dex-list-pane { position: static; }
  .dex.has-detail .dex-list-pane { display: none; }
  .dex:not(.has-detail) .dex-detail-pane { display: none; }
  .dex-list { max-height: none; }
  .back-link { display: inline-flex; }
  .detail { padding: 18px; }
  .detail-screen { height: 230px; }
  .detail-id h2 { font-size: 2.1rem; }
  .habit { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "check chip" "streak streak" "week del"; row-gap: 8px; }
  .habit .check { grid-area: check; }
  .habit .chip { grid-area: chip; }
  .habit .streak { grid-area: streak; }
  .habit .icon-btn { grid-area: del; justify-self: end; }
  .habit .week { grid-area: week; }
  .add-habit { grid-template-columns: minmax(0, 1fr); }
  .field-new-grid { grid-template-columns: minmax(0, 1fr); }
  .badges { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stage.hero { height: 280px; }
}

@media (max-width: 520px) {
  .next-step { grid-template-columns: 48px minmax(0, 1fr); gap: 12px 14px; padding: 14px; }
  .next-sprite { width: 48px; height: 48px; border-radius: 14px; }
  .next-sprite img { width: 40px; height: 40px; }
  .next-cta { grid-column: 1 / -1; }
  .next-cta .btn { width: 100%; }
  h1 { font-size: 1.75rem; }
  .brand-name { font-size: 1.2rem; }
  .hdr-track { width: 56px; }
  .hdr-label { display: none; }
  .icon-toggle span { display: none; }
  .icon-toggle { padding: 7px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel, .card { padding: 18px; }
  .filters { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .filters select:last-child { grid-column: 1 / -1; }
  .dex-row { grid-template-columns: 34px 40px minmax(0, 1fr) auto 12px; gap: 6px; padding: 2px 6px; }
  .dex-row .tp .chip:nth-child(2) { display: none; }
  .facts { grid-template-columns: minmax(0, 1fr); }
  .quiz-options { grid-template-columns: minmax(0, 1fr); }
  .slots { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mini-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .target { flex-direction: column; text-align: center; }
  .weak-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .arena { min-height: 0; padding: 14px 12px 10px; gap: 2px; }
  .combatant { gap: 8px; }
  .pad { width: 128px; height: 118px; }
  .foe-sprite { width: 108px; height: 108px; }
  .ally-sprite { width: 124px; height: 124px; }
  .status-card { padding: 8px 10px 10px; }
  .sc-name { font-size: 0.98rem; }
  .command { flex-direction: column-reverse; align-items: stretch; text-align: center; gap: 8px; padding: 12px 14px; }
  .timer { font-size: 2.6rem; }
  .timer-box { text-align: center; }
  .calc { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .stage.hero { height: 250px; border-radius: 22px; }
  .stage-title { font-size: 1.3rem; }
  .stage-cta { margin-top: 8px; padding: 6px 12px; font-size: 0.82rem; }
  .stage.tall { height: 62vh; min-height: 360px; }
  .meadow-pick { grid-template-columns: 52px minmax(0, 1fr); }
  .meadow-pick img { width: 52px; height: 52px; }
}

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

