/* Trade helper styles. Palette, base, Poké Ball mark, top bar and site switch live in shared/site.css
   (served at /shared/site.css and loaded first); this file only adds what the trade helper needs. */
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
code { font-family: var(--font-mono); font-size: .92em; background: var(--paper-deep); padding: 1px 5px; border-radius: 6px; }

/* ---------- Top bar (layout; the bar itself is shared) ---------- */
.topbar-inner {
  max-width: 1280px; margin: 0 auto;
  padding: 10px 20px;
  display: flex; align-items: center; gap: 16px;
}
.search { position: relative; flex: 1; max-width: 520px; margin-left: auto; }
.search input {
  width: 100%; height: 46px;
  padding: 0 18px 0 48px;
  border-radius: 999px;
  border: 2px solid var(--line-strong);
  background: var(--paper);
  font: 500 15px var(--font-body);
  box-shadow: inset 0 2px 0 oklch(0.31 0.035 45 / 0.05);
}
.search input::placeholder { color: var(--ink-faint); }
.search input:focus { outline: none; border-color: var(--red); background: #fff; }
.search-ball {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(to bottom, var(--red) 0 45%, var(--ink) 45% 55%, #fff 55%);
  box-shadow: inset 0 0 0 2px var(--ink); pointer-events: none;
}
.suggest, .combo-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 40;
  margin: 0; padding: 6px; list-style: none;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lift);
  max-height: min(60vh, 420px); overflow: auto;
}
.suggest li, .combo-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; border-radius: 10px; min-height: 40px;
  cursor: pointer;
}
.suggest li:hover, .suggest li[aria-selected="true"],
.combo-list li:hover, .combo-list li[aria-selected="true"] { background: var(--red-soft); }
.suggest img { width: 40px; height: 40px; }
.suggest .s-name, .combo-list .o-name { font-weight: 700; }
.suggest .s-form { color: var(--ink-soft); font-size: 13px; }
.suggest .s-sub, .combo-list .o-sub { color: var(--ink-soft); font-size: 12.5px; margin-left: auto; font-family: var(--font-round); white-space: nowrap; }
.combo-list .o-clear { color: var(--ink-soft); font-size: 13.5px; }
.combo-list .o-empty { color: var(--ink-faint); font-size: 13px; cursor: default; }
.combo-list .o-empty:hover { background: none; }

/* ---------- Page shell ---------- */
.page { flex: 1; width: 100%; max-width: 1280px; margin: 0 auto; padding: 24px 20px 48px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 20px; align-items: start; }
.form-col { display: grid; gap: 16px; min-width: 0; }
.out-col { position: sticky; top: 86px; display: grid; gap: 16px; min-width: 0; }
.loading { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 120px 0; color: var(--ink-soft); font-family: var(--font-display); font-size: 20px; }
.footer { max-width: 1280px; width: 100%; margin: 0 auto; padding: 22px 20px 34px; color: var(--ink-soft); font-size: 12.5px; border-top: 2px dashed var(--line); }
.footer p { margin: 4px 0; }
.footer b { font-family: var(--font-round); font-weight: 600; color: var(--ink); }
.footer a { font-weight: 700; border-bottom: 1px dotted currentColor; }

/* ---------- Shared bits ---------- */
.num { font-family: var(--font-round); font-variant-numeric: tabular-nums; }
.type {
  --c: var(--t-normal);
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 10px 0 8px;
  border-radius: 999px;
  font-size: 12.5px; font-weight: 700; line-height: 1;
  color: color-mix(in oklch, var(--c) 72%, black);
  background: color-mix(in oklch, var(--c) 16%, white);
  border: 1.5px solid color-mix(in oklch, var(--c) 45%, white);
  white-space: nowrap;
}
.type::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.types { display: flex; flex-wrap: wrap; gap: 6px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--ink-faint)); flex: none; }

.seg {
  display: inline-flex; padding: 4px; gap: 4px;
  background: var(--paper-deep);
  border-radius: 999px;
  border: 2px solid var(--line);
  flex-wrap: wrap;
}
.seg button {
  border: 0; background: transparent; cursor: pointer;
  min-height: 34px; padding: 0 14px; border-radius: 999px;
  font-weight: 700; color: var(--ink-soft);
}
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 3px 0 var(--line-strong); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 38px; padding: 0 14px;
  border-radius: 999px;
  border: 2px solid var(--line-strong);
  background: var(--card);
  font-weight: 700; font-size: 14px; color: var(--ink-soft);
  cursor: pointer;
  box-shadow: 0 3px 0 var(--line);
  transition: transform .12s, box-shadow .12s;
  white-space: nowrap;
}
.chip:hover { transform: translateY(-1px); box-shadow: 0 4px 0 var(--line-strong); }
/* "从文本" + "导入" and "Import" + " text" are two flex items (phones drop the first part in Chinese, the second in
   English): no chip gap inside a Chinese word, a word space in English. */
#open-import { gap: 0; }
:lang(en) #open-import { gap: 0.3em; }
.chip[aria-pressed="true"] { background: var(--red); border-color: var(--red-ink); color: #fff; box-shadow: 0 3px 0 var(--red-ink); }
.chip.ghost { flex: none; }
.chip small { font-weight: 600; opacity: .8; font-size: 11.5px; }
.chip.shiny[aria-pressed="true"] { background: var(--yellow); border-color: oklch(0.72 0.13 80); color: oklch(0.38 0.08 70); box-shadow: 0 3px 0 oklch(0.72 0.13 80); }

.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 22px;
  border: 2px solid var(--red-ink); border-radius: 999px;
  background: var(--red); color: #fff;
  font-weight: 800; font-size: 15.5px; letter-spacing: .02em;
  box-shadow: 0 4px 0 var(--red-ink);
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 5px 0 var(--red-ink); }
.btn-primary:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--red-ink); }
.btn-primary[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.link-btn { border: 0; background: none; padding: 0; cursor: pointer; font-weight: 700; color: var(--red-ink); text-decoration: underline; text-underline-offset: 3px; font-size: 13px; }

.sprite-wrap { position: relative; display: grid; place-items: center; }
.sprite.fallback { visibility: hidden; }
.sprite-wrap:has(.fallback)::before {
  content: ""; position: absolute; inset: 22%;
  border-radius: 50%;
  background: linear-gradient(to bottom, oklch(0.31 0.035 45 / 0.12) 0 46%, oklch(0.31 0.035 45 / 0.22) 46% 54%, oklch(0.31 0.035 45 / 0.06) 54%);
}

/* ---------- Game switcher ---------- */
.game-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  margin-bottom: 16px; padding: 10px 14px;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.game-bar:empty { display: none; }
.control-label { font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.game-note { font-size: 13px; color: var(--ink-soft); }
.game-note b { color: var(--ink); }
.suggest .s-src { font-size: 11.5px; font-weight: 700; color: oklch(0.45 0.09 80); background: var(--yellow-soft); padding: 1px 7px; border-radius: 999px; white-space: nowrap; }
.source { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.mini-label { font-size: 12.5px; font-weight: 700; color: var(--ink-soft); }
.source .seg { background: oklch(1 0 0 / 0.5); }

/* ---------- Panels ---------- */
.panel {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px 18px;
  min-width: 0;
}
.panel-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-bottom: 14px; }
.panel-head h2 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 21px; white-space: nowrap; }
.panel-head .ball { --size: 18px; }
.panel-head .aside { margin-left: auto; font-size: 12px; color: var(--ink-soft); text-align: right; }
.hint { margin: 0; font-size: 12.5px; color: var(--ink-soft); }
.panel-note {
  margin: -4px 0 14px; padding: 9px 12px;
  border-radius: 12px; background: var(--yellow-soft);
  font-size: 12.5px; color: oklch(0.42 0.07 75);
}

.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.field { display: grid; gap: 7px; min-width: 0; align-content: start; }
.field.wide { grid-column: 1 / -1; }
.field > .label { font-size: 12.5px; font-weight: 700; color: var(--ink-soft); display: flex; align-items: baseline; gap: 8px; }
.field > .label .note { font-weight: 500; color: var(--ink-faint); }
/* English labels are longer: a long note goes under the label instead of squeezing it onto two lines. */
:lang(en) .field > .label { flex-wrap: wrap; row-gap: 2px; }
.input, select.input, textarea {
  width: 100%; height: 42px;
  padding: 0 12px;
  border-radius: 12px;
  border: 2px solid var(--line-strong);
  background: var(--paper);
  font: 600 14.5px var(--font-body);
}
.input::placeholder, textarea::placeholder { color: var(--ink-faint); font-weight: 500; }
.input:focus, textarea:focus { outline: none; border-color: var(--red); background: #fff; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%), linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%); background-position: calc(100% - 18px) 18px, calc(100% - 13px) 18px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.input.num { font-family: var(--font-round); font-weight: 600; }
.combo { position: relative; min-width: 0; }
.combo .input { padding-left: 32px; }
.combo::before {
  content: ""; position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--c, var(--line-strong));
  pointer-events: none;
}
.combo.warn .input { border-color: oklch(0.72 0.13 80); background: var(--yellow-soft); }
/* PokeAPI draws items small inside a padded canvas; the negative margin keeps list rows at their usual height. */
.item-icon { width: 36px; height: 36px; object-fit: contain; flex: none; margin: -4px 0 -4px auto; }
.item-icon.pixel { image-rendering: pixelated; }
.combo-icon { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; margin: 0; pointer-events: none; }
.combo.has-icon .input { padding-right: 44px; }

.cat { font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 6px; flex: none; }
.cat-physical { background: oklch(0.93 0.05 40); color: oklch(0.5 0.13 40); }
.cat-special { background: oklch(0.93 0.04 255); color: oklch(0.48 0.12 255); }
.cat-status { background: oklch(0.93 0.01 80); color: var(--ink-soft); }

.ability-field { display: grid; gap: 10px; }
.ability-desc {
  margin: 0; padding: 9px 12px; border-radius: 12px;
  background: var(--yellow-soft); border: 1.5px solid oklch(0.85 0.1 90);
  font-size: 13px; line-height: 1.55; color: var(--ink);
}
.ability-desc b { margin-right: 8px; }
.ability-desc.random { background: var(--paper-deep); border-color: transparent; color: var(--ink-soft); }
.kv dd .pv-desc { display: block; margin-top: 1px; font-size: 12px; font-weight: 500; color: var(--ink-soft); }

.tera-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.tera-grid button.type { cursor: pointer; height: 30px; padding: 0 11px 0 9px; font-size: 13px; }
.tera-grid button.type[aria-pressed="true"] { background: var(--c); color: #fff; border-color: color-mix(in oklch, var(--c) 70%, black); box-shadow: 0 2px 0 color-mix(in oklch, var(--c) 60%, black); }
.tera-grid button.type[aria-pressed="true"]::before { background: #fff; }
.tera-grid button.plain { --c: var(--ink-faint); }

/* ---------- Hero ---------- */
.hero {
  --c: var(--t-normal);
  --c2: var(--c);
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: 200px 1fr; gap: 24px;
  padding: 22px 26px;
  border-radius: 28px;
  border: 2px solid color-mix(in oklch, var(--c) 30%, white);
  background:
    radial-gradient(120% 140% at 0% 0%, color-mix(in oklch, var(--c) 24%, white) 0 40%, transparent 70%),
    linear-gradient(135deg, color-mix(in oklch, var(--c) 10%, white), color-mix(in oklch, var(--c2) 14%, white));
  box-shadow: 0 5px 0 color-mix(in oklch, var(--c) 25%, oklch(0.85 0.02 60));
}
.hero::after {
  content: ""; position: absolute; right: -90px; bottom: -110px;
  width: 320px; height: 320px; border-radius: 50%;
  border: 30px solid oklch(1 0 0 / 0.55);
  background: linear-gradient(to bottom, transparent 0 45%, oklch(1 0 0 / 0.55) 45% 55%, transparent 55%);
  pointer-events: none;
}
.hero-art {
  position: relative; z-index: 1;
  width: 200px; height: 200px; align-self: start;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, #fff 0 46%, oklch(1 0 0 / 0.55) 68%, transparent 70%);
}
.hero-art img { width: 168px; height: 168px; filter: drop-shadow(0 8px 0 oklch(0.31 0.035 45 / 0.08)); }
.hero-art .star { position: absolute; right: 18px; top: 14px; font-size: 26px; color: oklch(0.75 0.16 85); text-shadow: 0 2px 0 #fff; }
.hero-body { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.hero-no { font: 600 15px var(--font-round); color: color-mix(in oklch, var(--c) 60%, var(--ink)); letter-spacing: .06em; }
.hero-name { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 14px; }
.hero-name h1 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 40px; line-height: 1.05; }
.hero-name .alt { color: var(--ink-soft); font-family: var(--font-round); font-size: 15px; }
.forms { display: flex; flex-wrap: wrap; gap: 8px; }
.form-pill {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 38px; padding: 0 14px 0 6px;
  border-radius: 999px;
  border: 2px solid oklch(1 0 0 / 0.8);
  background: oklch(1 0 0 / 0.62);
  font-weight: 700; font-size: 13.5px; color: var(--ink-soft);
  cursor: pointer;
}
.form-pill img { width: 28px; height: 28px; }
.form-pill .sprite-wrap { width: 28px; height: 28px; }
.form-pill[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.hero-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.hero-controls .mini { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); }
.hero-controls .mini .input { height: 38px; width: 74px; background: oklch(1 0 0 / 0.75); }
.hero-controls .mini .input.nick { width: 150px; }
.hero-controls .seg { background: oklch(1 0 0 / 0.5); }
.hero-controls .fixed { font-size: 13px; color: var(--ink-soft); font-weight: 700; }

.stats { display: grid; grid-template-columns: auto auto 1fr; gap: 4px 10px; align-items: center; max-width: 440px; }
.stats .s-label { font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.stats .s-val { font: 600 13.5px var(--font-round); text-align: right; min-width: 30px; }
.stats .s-bar { height: 9px; border-radius: 999px; background: oklch(1 0 0 / 0.7); overflow: hidden; }
.stats .s-bar i { display: block; height: 100%; border-radius: 999px; background: var(--sc); }
.stats .s-total { grid-column: 1 / -1; font-size: 12px; color: var(--ink-soft); }
.stats .s-total b { font-family: var(--font-round); color: var(--ink); }

/* ---------- Empty state ---------- */
.empty {
  text-align: center; padding: 70px 24px; color: var(--ink-soft);
  background: var(--card); border: 2px dashed var(--line-strong); border-radius: var(--radius);
  display: grid; justify-items: center; gap: 10px;
}
.empty h3 { font-family: var(--font-display); font-weight: 400; font-size: 24px; margin: 4px 0 0; color: var(--ink); }
.empty p { margin: 0; max-width: 440px; }
.empty .ball { --size: 48px; opacity: .85; }
.quick { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 8px; }

/* ---------- Moves ---------- */
.moves { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.move-slot { display: grid; gap: 6px; }
.move-slot .label { font-size: 12px; font-weight: 700; color: var(--ink-faint); }

/* ---------- EV / IV ---------- */
.stat-table { display: grid; grid-template-columns: 64px minmax(0, 1fr) 84px 22px 66px; gap: 8px 10px; align-items: center; }
.stat-table.champions { grid-template-columns: 64px minmax(0, 1fr) 84px 60px; }
.stat-table.iv-only { grid-template-columns: 64px 84px; }
.stat-table .th { font-size: 12px; font-weight: 700; color: var(--ink-faint); }
.stat-table .name { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13.5px; white-space: nowrap; }
.stat-table .name .dot { --c: var(--sc); }
.stat-table .name .amp { font-size: 12px; font-weight: 800; }
.stat-table .name .amp.up { color: var(--red-ink); }
.stat-table .name .amp.down { color: oklch(0.5 0.12 250); }
.stat-table input[type="range"] {
  -webkit-appearance: none; appearance: none;
  display: block; width: 100%; height: 10px; margin: 0;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: linear-gradient(to right, var(--sc) var(--p, 0%), var(--paper-deep) var(--p, 0%));
  cursor: pointer;
}
.stat-table input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; border: 3px solid var(--sc);
  box-shadow: 0 2px 0 var(--line-strong);
}
.stat-table input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: #fff; border: 3px solid var(--sc);
  box-shadow: 0 2px 0 var(--line-strong);
}
.stat-table .input { height: 36px; padding: 0 8px; text-align: center; }
.stat-table .max { border: 0; background: none; cursor: pointer; color: var(--ink-faint); font: 700 11px var(--font-round); padding: 0; }
.stat-table .max:hover { color: var(--red-ink); }
.stat-table .ev-eq { font: 600 11.5px var(--font-round); color: var(--ink-faint); white-space: nowrap; }
.stat-table .input[aria-invalid="true"] { border-color: var(--red); background: var(--red-soft); color: var(--red-ink); }
.stat-hint { margin: 10px 0 0; font-size: 12.5px; font-weight: 600; color: var(--red-ink); }
.stat-hint:empty { display: none; }
.stat-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 14px; padding-top: 12px; border-top: 2px dashed var(--line); }
.stat-foot .total { font-size: 13px; color: var(--ink-soft); }
.stat-foot .total b { font-family: var(--font-round); color: var(--ink); }
.stat-foot .total.over b { color: var(--red-ink); }
.stat-foot .chips { gap: 6px; }
.stat-foot .chip { min-height: 32px; padding: 0 11px; font-size: 12.5px; }

/* ---------- Extras ---------- */
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 6px 0 12px;
  border-radius: 999px;
  background: var(--yellow-soft); border: 1.5px solid oklch(0.85 0.1 90);
  font-size: 13px; font-weight: 700; color: oklch(0.42 0.07 75);
}
.tag button { border: 0; background: none; cursor: pointer; width: 22px; height: 22px; border-radius: 50%; color: inherit; font-size: 15px; line-height: 1; }
.tag button:hover { background: oklch(1 0 0 / 0.7); }

/* ---------- Output ---------- */
.status {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 13px 5px 9px; border-radius: 999px;
  font-weight: 800; font-size: 13.5px;
}
.status.ok { background: var(--green-soft); color: var(--green-ink); }
.status.bad { background: var(--red-soft); color: var(--red-ink); }
.status.busy { background: var(--paper-deep); color: var(--ink-soft); }
.status.warn { background: var(--yellow-soft); color: oklch(0.42 0.07 75); }
.status.warn .mark { background: oklch(0.72 0.13 80); }
.status .ball { --size: 16px; }
.status .mark { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 12px; }
.status.ok .mark { background: var(--green); }
.status.bad .mark { background: var(--red); }

.msg {
  margin: 12px 0 0; padding: 12px 14px;
  border-radius: 14px;
  background: var(--paper-deep);
  border: 2px solid var(--line);
  font: 500 13px/1.55 var(--font-mono);
  white-space: pre-wrap; word-break: break-word;
  max-height: 340px; overflow: auto;
}
.out-actions { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.out-actions .btn-primary { flex: 1; }
:lang(en) .out-actions .btn-primary { white-space: nowrap; }
.steps { margin: 14px 0 0; padding: 0 0 0 20px; font-size: 13px; color: var(--ink-soft); display: grid; gap: 3px; }
.steps b { color: var(--ink); }

.problem {
  margin-top: 12px; padding: 11px 13px;
  border-radius: 12px; background: var(--red-soft);
  color: var(--red-ink); font-size: 13.5px;
}
.problem .zh { font-weight: 800; margin-bottom: 4px; }
.problem .en { font-family: var(--font-mono); font-size: 12px; white-space: pre-wrap; word-break: break-word; color: color-mix(in oklch, var(--red-ink) 80%, var(--ink)); }
.problem details { margin-top: 6px; }
.problem summary { cursor: pointer; font-weight: 700; font-size: 12.5px; }
.problem pre { margin: 6px 0 0; font: 500 11.5px/1.5 var(--font-mono); white-space: pre-wrap; color: var(--ink); max-height: 220px; overflow: auto; }
.error-line { margin: 8px 0 0; color: var(--red-ink); font-size: 13px; font-weight: 700; }
.origin-warn {
  margin: -4px 0 14px; padding: 11px 13px;
  border-radius: 12px; background: var(--red-soft);
  color: var(--red-ink); font-size: 13px;
}
.origin-warn b { display: block; margin-bottom: 2px; font-weight: 800; }
/* The picked event card (panel-event) and the controls it locks. */
.event-card { display: grid; gap: 3px; margin: 0 0 8px; font-size: 14px; }
.event-card .muted { color: var(--ink-soft); font-size: 12.5px; }
.event-note { margin: 0; color: var(--ink-faint); font-size: 12.5px; }
.event-note .chip { margin-left: 4px; }
.chip[disabled], .chip[disabled]:hover { cursor: not-allowed; opacity: .6; transform: none; box-shadow: none; }
.combo .input:disabled { cursor: not-allowed; opacity: .75; }
.changes {
  margin-top: 12px; padding: 11px 13px;
  border-radius: 12px; background: var(--yellow-soft);
  color: oklch(0.42 0.07 75); font-size: 13px;
}
.changes .zh { font-weight: 800; }
.changes ul { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 2px; }
.preview-head .pv-sub .egg { color: var(--red-ink); font-weight: 800; }

.preview-head { display: flex; align-items: center; gap: 12px; }
.preview-head .sprite-wrap { width: 64px; height: 64px; border-radius: 50%; background: radial-gradient(circle at 50% 45%, #fff 0 50%, var(--paper-deep) 72%); flex: none; }
.preview-head img { width: 58px; height: 58px; }
.preview-head .pv-name { font-family: var(--font-display); font-size: 22px; line-height: 1.1; }
.preview-head .pv-sub { font-size: 12.5px; color: var(--ink-soft); }
.preview-head .pv-sub .star { color: oklch(0.7 0.16 85); font-weight: 800; }
.kv { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 6px 10px; margin-top: 12px; font-size: 13.5px; }
/* Room for the longest English label ("Stat Points") on one line. */
:lang(en) .kv { grid-template-columns: 78px minmax(0, 1fr); }
.kv dt { color: var(--ink-soft); font-weight: 700; font-size: 12.5px; padding-top: 1px; }
.kv dd { margin: 0; font-weight: 600; min-width: 0; }
.kv dd .muted { color: var(--ink-faint); font-weight: 500; font-size: 12px; }
.pv-moves { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; }
.pv-stats { display: grid; grid-template-columns: 40px repeat(3, minmax(0, 1fr)); gap: 3px 8px; margin-top: 12px; font-size: 12.5px; text-align: right; }
.pv-stats .h { font-weight: 700; color: var(--ink-faint); font-size: 11.5px; }
.pv-stats .n { text-align: left; font-weight: 700; color: var(--ink-soft); }
.pv-stats .v { font-family: var(--font-round); font-weight: 600; }
.pv-stats .v.max { color: var(--green-ink); }
.pv-stats .ht { font: 700 9.5px var(--font-body); color: oklch(0.6 0.13 80); margin-left: 1px; }
.pv-note { margin: 12px 0 0; padding: 9px 12px; border-radius: 12px; background: var(--yellow-soft); font-size: 12.5px; color: oklch(0.42 0.07 75); }
.placeholder { color: var(--ink-faint); font-size: 13.5px; text-align: center; padding: 30px 10px; }

.versions { display: flex; flex-wrap: wrap; gap: 6px; }
.versions span { font: 600 11.5px var(--font-round); padding: 3px 9px; border-radius: 999px; background: var(--paper-deep); color: var(--ink-soft); }

/* ---------- Batch queue ---------- */
.queue { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; counter-reset: q; }
.queue li {
  counter-increment: q;
  display: grid; grid-template-columns: 18px 40px minmax(0, 1fr) 40px; align-items: center; gap: 10px;
  padding: 6px 6px 6px 10px; border-radius: 14px;
  background: var(--paper-deep); border: 2px solid transparent;
}
.queue li::before { content: counter(q); font: 600 13px var(--font-round); color: var(--ink-faint); text-align: center; }
.queue li.foreign { background: var(--red-soft); border-color: oklch(0.85 0.08 27); }
.queue .sprite-wrap, .queue img { width: 40px; height: 40px; }
.q-body { display: grid; gap: 1px; min-width: 0; }
.q-name { font-weight: 800; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-name .star { color: oklch(0.7 0.16 85); }
.q-sub { display: flex; flex-wrap: wrap; gap: 0 8px; font-size: 12px; color: var(--ink-soft); }
.q-game { font-weight: 700; color: var(--ink); }
.q-game.other { color: var(--red-ink); }
.q-why { font-size: 12px; font-weight: 600; color: var(--red-ink); }
.q-remove {
  width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: none; cursor: pointer; font-size: 18px; line-height: 1; color: var(--ink-soft);
}
.q-remove:hover { background: var(--card); color: var(--red-ink); }
#panel-queue .origin-warn, #panel-queue .changes { margin: 12px 0 0; }
#panel-queue .origin-warn ul { margin: 4px 0 0; padding-left: 18px; display: grid; gap: 2px; }
.q-message { margin-top: 12px; }
.q-message summary { cursor: pointer; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); }
.q-message .msg { margin-top: 8px; }
.q-note { margin-top: 10px; }

/* ---------- Dialog & toast ---------- */
.dialog { border: 0; padding: 0; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-lift); width: min(620px, calc(100vw - 32px)); color: var(--ink); }
.dialog::backdrop { background: oklch(0.31 0.035 45 / 0.35); }
.dialog-body { padding: 20px 22px; display: grid; gap: 12px; }
.dialog-body .panel-head { margin: 0; }
.dialog textarea { height: auto; padding: 10px 12px; font: 500 13px/1.5 var(--font-mono); resize: vertical; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
.dialog-actions .btn-primary { min-height: 40px; }
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 50;
  padding: 10px 18px; border-radius: 999px;
  background: var(--ink); color: #fff; font-weight: 700; font-size: 14px;
  box-shadow: var(--shadow-lift);
}

/* ---------- Narrow screens ---------- */
@media (max-width: 1040px) {
  .layout { grid-template-columns: 1fr; }
  .out-col { position: static; }
}
@media (max-width: 720px) {
  .topbar-inner { flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
  .search { order: 3; flex-basis: calc(100% - var(--lang-room) - 86px); max-width: none; }
  /* The brand and the three-tool site switch fill the first row, so the import button joins the search row, between
     the search box and the language switch, and reads just "导入" / "Import". */
  #open-import { order: 3; margin-left: 0; padding: 0 12px; }
  #open-import .wide { display: none; }
  .page { padding: 16px 16px 40px; }
  .hero { grid-template-columns: 1fr; padding: 18px; justify-items: start; }
  .hero-art { width: 150px; height: 150px; justify-self: center; }
  .hero-art img { width: 126px; height: 126px; }
  .hero-name h1 { font-size: 32px; }
  .fields, .moves { grid-template-columns: 1fr; }
  .stat-table { grid-template-columns: 62px minmax(0, 1fr) 60px 52px; gap: 8px 8px; }
  .stat-table.champions { grid-template-columns: 62px minmax(0, 1fr) 60px; }
  .stat-table.iv-only { grid-template-columns: 62px 60px; }
  .stat-table .max, .stat-table .max-col, .stat-table .ev-eq { display: none; }
  .panel { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .ball.spin { animation: none; }
  .chip, .btn-primary { transition: none; }
}
