/* HD2 필드 가이드 — design tokens first, then layout, then components. */
:root {
  /* Dark: the original site's olive-black and field yellow. */
  color-scheme: dark;
  --bg: #101211;
  --bg-raise: #131613;
  --surface: #191c1a;
  --surface-2: #202420;
  --surface-3: #282d27;
  --line: #30362f;
  --line-strong: #414a40;
  --text: #f0f1e9;
  --text-2: #a2a99f;
  --text-3: #777f76;
  --accent: #f4e454;
  --accent-ink: #151810;
  --accent-soft: rgba(244, 228, 84, .12);
  --accent-text: #f4e454;
  --kill: #a6ce82;       --kill-soft: rgba(166, 206, 130, .14);
  --bleed: #f2b35c;      --bleed-soft: rgba(242, 179, 92, .14);
  --break: #95c8ec;      --break-soft: rgba(149, 200, 236, .13);
  --blocked: #f9947d;    --blocked-soft: rgba(249, 148, 125, .13);
  --unknown: #8f988c;    --unknown-soft: rgba(143, 152, 140, .13);
  --terminid: #ffae3d;
  --automaton: #ff5d55;
  --illuminate: #ab8cff;
  --c-support: #ffd400; --c-orbital: #ff7a59; --c-eagle: #5cc8ff; --c-defense: #8fd16a;
  --c-backpack: #c89bff; --c-vehicle: #ffb44d; --c-mission: #9aa7b3;
  --g-primary: #ffd400; --g-secondary: #6fb6ff; --g-throwable: #ff8a5c;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .45);
  --font: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
  --mono: ui-monospace, 'Cascadia Mono', 'SF Mono', Consolas, monospace;
  --bar-h: 60px;
  --page: 1280px;
}
/* Light follows the system unless the header toggle picked a theme. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f3f4f5; --bg-raise: #eceef0; --surface: #ffffff; --surface-2: #f6f7f8; --surface-3: #eceef0;
    --line: #e1e4e7; --line-strong: #c9ced3;
    --text: #121518; --text-2: #4a545d; --text-3: #717c86;
    --accent: #ffd400; --accent-ink: #141200; --accent-soft: rgba(255, 212, 0, .22); --accent-text: #8a6d00;
    --kill: #16904c; --kill-soft: rgba(22, 144, 76, .1);
    --bleed: #b8650a; --bleed-soft: rgba(184, 101, 10, .1);
    --break: #1f6fc2; --break-soft: rgba(31, 111, 194, .1);
    --blocked: #c93434; --blocked-soft: rgba(201, 52, 52, .09);
    --unknown: #66717b; --unknown-soft: rgba(102, 113, 123, .1);
    --terminid: #c07000; --automaton: #cf2e28; --illuminate: #6b47d6;
    --c-support: #b89800; --c-orbital: #d4492a; --c-eagle: #1a86c2; --c-defense: #4b8f2a;
    --c-backpack: #8250d0; --c-vehicle: #c77a00; --c-mission: #5f6b76;
    --g-primary: #b89800; --g-secondary: #1f6fc2; --g-throwable: #d4582a;
    --shadow: 0 18px 50px rgba(20, 30, 40, .18);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f4f5; --bg-raise: #eceef0; --surface: #ffffff; --surface-2: #f6f7f8; --surface-3: #eceef0;
  --line: #e1e4e7; --line-strong: #c9ced3;
  --text: #121518; --text-2: #4a545d; --text-3: #717c86;
  --accent: #ffd400; --accent-ink: #141200; --accent-soft: rgba(255, 212, 0, .22); --accent-text: #8a6d00;
  --kill: #16904c; --kill-soft: rgba(22, 144, 76, .1);
  --bleed: #b8650a; --bleed-soft: rgba(184, 101, 10, .1);
  --break: #1f6fc2; --break-soft: rgba(31, 111, 194, .1);
  --blocked: #c93434; --blocked-soft: rgba(201, 52, 52, .09);
  --unknown: #66717b; --unknown-soft: rgba(102, 113, 123, .1);
  --terminid: #c07000; --automaton: #cf2e28; --illuminate: #6b47d6;
  --c-support: #b89800; --c-orbital: #d4492a; --c-eagle: #1a86c2; --c-defense: #4b8f2a;
  --c-backpack: #8250d0; --c-vehicle: #c77a00; --c-mission: #5f6b76;
  --g-primary: #b89800; --g-secondary: #1f6fc2; --g-throwable: #d4582a;
  --shadow: 0 18px 50px rgba(20, 30, 40, .18);
}

/* --- Base ----------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--bar-h) + 12px); }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 15px/1.6 var(--font); font-feature-settings: 'tnum' 1; letter-spacing: -.005em;
  -webkit-font-smoothing: antialiased; display: flex; flex-direction: column;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3 { letter-spacing: -.02em; line-height: 1.25; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.icon { flex: none; }
kbd { font: 600 11px/1 var(--mono); padding: 3px 5px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; color: var(--text-2); background: var(--surface-2); }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: 6px; font-weight: 700; }
.skip:focus { left: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.num { font-variant-numeric: tabular-nums; }
.link { background: none; border: 0; padding: 0; color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; }
.ext { color: var(--text-2); text-decoration: none; border-bottom: 1px solid var(--line-strong); }
.ext:hover { color: var(--accent-text); border-color: currentColor; }

/* --- Top bar ---------------------------------------------------------------- */
.bar {
  position: sticky; top: 0; z-index: 30; height: var(--bar-h);
  display: flex; align-items: center; gap: 24px; padding: 0 max(20px, calc((100vw - var(--page)) / 2 + 20px));
  background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}
.bar::after { /* hazard stripe */
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: repeating-linear-gradient(-45deg, var(--accent) 0 8px, transparent 8px 16px); opacity: .55;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; white-space: nowrap; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); position: relative; }
.brand-mark::before, .brand-mark::after { content: ''; position: absolute; background: var(--accent-ink); }
.brand-mark::before { left: 12px; top: 5px; width: 2.5px; height: 16px; }
.brand-mark::after { top: 12px; left: 5px; height: 2.5px; width: 16px; }
.brand-text { font-size: 16px; font-weight: 600; color: var(--text-2); }
.brand-text b { color: var(--text); font-weight: 800; letter-spacing: .02em; }
.tabs { display: flex; gap: 4px; height: 100%; }
.tabs a {
  display: flex; align-items: center; gap: 7px; padding: 0 14px; height: 100%; text-decoration: none;
  color: var(--text-2); font-weight: 600; font-size: 14.5px; border-bottom: 2px solid transparent; margin-bottom: -1px; position: relative; z-index: 1;
}
.tabs a:hover { color: var(--text); }
.tabs a[aria-current] { color: var(--text); border-color: var(--accent); }
.tabs a[aria-current] .icon { color: var(--accent); }
.bar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.search-trigger {
  display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px 0 12px; min-width: 200px;
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--text-3); font-size: 14px;
}
.search-trigger:hover { border-color: var(--text-3); color: var(--text-2); }
.search-trigger kbd { margin-left: auto; }
.icon-button { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--text-2); }
.icon-button:hover { color: var(--text); border-color: var(--text-3); }
.lang-toggle { width: auto; min-width: 36px; padding: 0 10px; white-space: nowrap; font-size: 13px; font-weight: 750; letter-spacing: .02em; }
/* The English edition stays hidden for the moment it takes to swap the header
   text and load the dictionary (index.html reveals it after 4 s regardless). */
:root[lang="en"]:not([data-i18n-ready]) body { visibility: hidden; }

.tabbar { display: none; }

/* --- Page ------------------------------------------------------------------- */
main { flex: 1; width: 100%; max-width: var(--page); margin: 0 auto; padding: 28px 20px 64px; outline: none; }
main[aria-busy] { opacity: .5; transition: opacity .2s .15s; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 28px; font-weight: 800; }
.page-head p { color: var(--text-2); margin-top: 4px; }
.eyebrow { font: 700 11.5px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--accent-text); display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.eyebrow::before { content: ''; width: 18px; height: 2px; background: var(--accent); }
.footer { max-width: var(--page); margin: 0 auto; width: 100%; padding: 22px 20px 40px; border-top: 1px solid var(--line); color: var(--text-3); font-size: 13px; display: grid; gap: 4px; }
.footer a { color: var(--text-2); }

/* --- Controls ---------------------------------------------------------------- */
.field { position: relative; display: flex; align-items: center; }
.field .icon { position: absolute; left: 12px; color: var(--text-3); pointer-events: none; }
.input {
  width: 100%; height: 42px; padding: 0 12px 0 40px; border-radius: 9px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); font-size: 15px;
}
.input::placeholder { color: var(--text-3); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.select { height: 40px; padding: 0 34px 0 12px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2376828d' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center; appearance: none; font-size: 14px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: transparent; color: var(--text-2); font-size: 13.5px; font-weight: 600; white-space: nowrap;
}
.chip:hover { color: var(--text); border-color: var(--text-3); }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip .count { font-size: 12px; opacity: .6; font-weight: 500; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dot, var(--text-3)); }
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); flex-wrap: wrap; }
.segmented button { border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; color: var(--text-2); font-weight: 600; font-size: 13.5px; display: inline-flex; align-items: center; gap: 7px; }
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 0 var(--line-strong), 0 0 0 1px var(--line-strong); }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 9px;
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); font-weight: 650; font-size: 14px; text-decoration: none; white-space: nowrap;
}
.button:hover { border-color: var(--text-3); }
.button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.button.primary:hover { filter: brightness(1.06); }
.button.ghost { background: transparent; }
.button.small { height: 32px; padding: 0 10px; font-size: 13px; }
.toggle { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); border: 1px dashed var(--line-strong); background: var(--surface); cursor: pointer; }
.toggle input { width: 18px; height: 18px; accent-color: var(--accent); margin: 2px 0 0; flex: none; }
.toggle b { display: block; font-size: 14px; }
.toggle span { color: var(--text-2); font-size: 13px; }

/* --- Badges, keycaps --------------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 5px; font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.badge.kill { background: var(--kill-soft); color: var(--kill); }
.badge.bleed, .badge.conditional { background: var(--bleed-soft); color: var(--bleed); }
.badge.break, .badge.health { background: var(--break-soft); color: var(--break); }
.badge.blocked { background: var(--blocked-soft); color: var(--blocked); }
.badge.unknown { background: var(--unknown-soft); color: var(--unknown); }
.badge.accent { background: var(--accent-soft); color: var(--accent-text); }
.badge.outline { background: transparent; border: 1px solid var(--line-strong); }
.keys { display: inline-flex; gap: 3px; }
.keys kbd { width: 20px; height: 20px; display: grid; place-items: center; padding: 0; font: 700 12px/1 var(--font); color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 45%, var(--line-strong)); background: var(--accent-soft); }
.keys.large kbd { width: 30px; height: 30px; font-size: 16px; border-radius: 6px; }
.faction-tag { font-size: 12px; font-weight: 700; color: var(--fc, var(--text-3)); }
[data-faction="테르미니드"], [data-side="terminid"] { --fc: var(--terminid); }
[data-faction="오토마톤"], [data-side="automaton"] { --fc: var(--automaton); }
[data-faction="일루미닛"], [data-side="illuminate"] { --fc: var(--illuminate); }
[data-faction="공용 시설"] { --fc: var(--text-2); }

/* --- Panels ------------------------------------------------------------------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.panel-head h2, .panel-head h3 { font-size: 16px; font-weight: 750; }
.section-title { display: flex; align-items: baseline; gap: 10px; margin: 28px 0 12px; flex-wrap: wrap; }
.section-title h2 { font-size: 19px; font-weight: 800; }
.section-title p { color: var(--text-3); font-size: 13.5px; }
.note { font-size: 13.5px; color: var(--text-2); }
.notes { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.notes li { position: relative; padding-left: 14px; font-size: 13.5px; color: var(--text-2); }
.notes li::before { content: ''; position: absolute; left: 2px; top: .65em; width: 5px; height: 5px; border-radius: 1px; background: var(--text-3); }
.callout { padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-2); }
.callout.warn { border-color: color-mix(in srgb, var(--bleed) 40%, var(--line)); background: var(--bleed-soft); }
.callout.info { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); background: var(--accent-soft); }
.callout h3 { font-size: 15px; margin-bottom: 4px; }
.callout p { font-size: 14px; color: var(--text-2); }
.empty { text-align: center; padding: 48px 16px; color: var(--text-2); }
.empty h2, .empty h3 { color: var(--text); margin-bottom: 6px; font-size: 18px; }
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
.disclosure { border-top: 1px solid var(--line); }
.disclosure > summary { display: flex; align-items: center; gap: 8px; padding: 10px 0; font-size: 13.5px; font-weight: 650; color: var(--text-2); }
.disclosure > summary::before { content: '+'; width: 18px; height: 18px; display: grid; place-items: center; border-radius: 4px; border: 1px solid var(--line-strong); font-size: 13px; line-height: 1; }
.disclosure[open] > summary::before { content: '−'; }
.disclosure > summary:hover { color: var(--text); }
.disclosure > div { padding: 0 0 12px; display: grid; gap: 8px; }

/* --- Arsenal -------------------------------------------------------------------- */
.arsenal-tools { display: grid; gap: 12px; margin-bottom: 18px; }
.arsenal-tools .row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.arsenal-tools .field { flex: 1 1 280px; }
.arsenal-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 6px 0 12px; font-size: 13.5px; color: var(--text-3); flex-wrap: wrap; }
.arsenal-meta b { color: var(--text); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.card {
  position: relative; display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); text-align: left; transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--line-strong); }
.card::before { content: ''; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--cat, var(--line-strong)); opacity: .9; }
.card.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.card-open { all: unset; cursor: pointer; display: flex; flex-direction: column; gap: 10px; }
.card-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; border-radius: 6px; }
.card-head { display: flex; gap: 12px; align-items: flex-start; padding-right: 36px; }
.strat-icon { width: 44px; height: 44px; flex: none; border-radius: 8px; background: #1a1d1a; border: 1px solid var(--line); padding: 4px; }
.strat-icon.large { width: 64px; height: 64px; padding: 6px; border-radius: 12px; }
.card h3 { font-size: 16.5px; font-weight: 750; }
.card .en { font-size: 12.5px; color: var(--text-3); margin-top: 1px; }
.card .summary { font-size: 13.5px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-keys { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); min-height: 20px; }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-top: auto; }
.stat-row > div { padding: 7px 8px; border-left: 1px solid var(--line); min-width: 0; }
.stat-row > div:first-child { border-left: 0; }
.stat-row dt { font-size: 11px; color: var(--text-3); font-weight: 600; }
.stat-row dd { margin: 1px 0 0; font-weight: 750; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-row dd small { font-size: 11px; font-weight: 600; color: var(--text-3); margin-left: 1px; }
.stat-row dd.dim { color: var(--text-3); font-weight: 600; font-size: 13px; }
.card-modes { display: grid; gap: 3px; margin-top: -4px; font-size: 12.5px; color: var(--text-2); }
.card-modes > span { padding-left: 18px; text-indent: -18px; }
.card-modes b { color: var(--text); font-weight: 700; margin-right: 5px; }
.card-modes > span::before { content: '⇄'; color: var(--accent); margin-right: 6px; }
.card-modes[data-kind="parts"] > span::before { content: '+'; }
.variant-tabs { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; margin-bottom: -8px; }
.variant-tabs h3 { font-size: 14px; font-weight: 750; }
.variant-panel:not([hidden]) { display: grid; gap: 12px; }
.variant-note { font-size: 13.5px; color: var(--text-2); }
.compare-modes { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.compare-modes b { display: block; }
.compare-toggle { position: absolute; top: 12px; right: 12px; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text-2); display: grid; place-items: center; }
.compare-toggle:hover { color: var(--text); border-color: var(--text-3); }
.compare-toggle[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.list .grid { grid-template-columns: 1fr; }
.tray {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 25; display: flex; align-items: center; gap: 12px;
  padding: 10px 10px 10px 16px; border-radius: 12px; background: var(--text); color: var(--bg); box-shadow: var(--shadow); max-width: calc(100vw - 24px);
}
.tray .names { font-size: 14px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tray .button { background: transparent; color: var(--bg); border-color: color-mix(in srgb, var(--bg) 30%, transparent); }
.tray .button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tray .button:disabled { opacity: .45; cursor: not-allowed; }

/* --- Sheet (dialog) ------------------------------------------------------------ */
dialog { color: var(--text); }
.sheet {
  margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: min(560px, 100vw); max-width: 100vw; padding: 0; border: 0;
  background: var(--bg-raise); border-left: 1px solid var(--line); box-shadow: var(--shadow);
}
.sheet.wide { width: min(980px, 100vw); }
.sheet::backdrop, .palette::backdrop { background: rgba(4, 6, 8, .62); backdrop-filter: blur(2px); }
.sheet[open] { animation: slide-in .22s cubic-bezier(.2, .8, .2, 1); }
@keyframes slide-in { from { transform: translateX(40px); opacity: 0; } }
.sheet-body { height: 100%; overflow-y: auto; overscroll-behavior: contain; }
.sheet-top { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; background: color-mix(in srgb, var(--bg-raise) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.sheet-top span { font: 700 11.5px/1 var(--mono); letter-spacing: .12em; color: var(--text-3); text-transform: uppercase; }
.sheet-content { padding: 20px 20px 40px; display: grid; gap: 20px; }
.detail-id { display: flex; gap: 14px; align-items: center; }
.detail-id h2 { font-size: 24px; font-weight: 800; }
.detail-id p { color: var(--text-3); font-size: 13.5px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.detail-grid > div { background: var(--surface); padding: 12px 14px; }
.detail-grid dt { font-size: 12px; color: var(--text-3); font-weight: 600; }
.detail-grid dd { margin: 2px 0 0; font-size: 20px; font-weight: 800; }
.detail-grid dd small { font-size: 12.5px; color: var(--text-3); font-weight: 600; margin-left: 2px; }
.detail-grid dd.dim { font-size: 15px; color: var(--text-2); font-weight: 650; }
.detail-grid .caption { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.block h3 { font-size: 14px; font-weight: 750; margin-bottom: 6px; color: var(--text); }
.block p { color: var(--text-2); font-size: 14.5px; }
.blast { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; padding: 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.blast svg { flex: none; }
.blast-label text { font-size: 11px; font-weight: 750; fill: var(--text); stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; paint-order: stroke; }
.blast p { flex: 1 1 220px; font-size: 13.5px; color: var(--text-2); }
.links { display: flex; gap: 8px; flex-wrap: wrap; }
.sources { font-size: 12.5px; color: var(--text-3); display: flex; gap: 6px 14px; flex-wrap: wrap; }

/* Compare table */
.compare-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.compare-table { border-collapse: collapse; width: 100%; min-width: 640px; font-size: 14px; }
.compare-table th, .compare-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.compare-table thead th { background: var(--surface-2); font-size: 15px; }
.compare-table tbody th { color: var(--text-3); font-weight: 600; font-size: 13px; width: 120px; white-space: nowrap; }
.compare-table td.best { color: var(--accent-text); font-weight: 800; }
.compare-table td small { display: block; color: var(--text-3); font-size: 12px; font-weight: 500; }

/* --- Palette ------------------------------------------------------------------ */
.palette { margin: 10vh auto auto; width: min(640px, calc(100vw - 24px)); padding: 0; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--bg-raise); box-shadow: var(--shadow); overflow: hidden; }
.palette-field { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--line); color: var(--text-3); }
.palette-field input { flex: 1; height: 54px; border: 0; background: transparent; font-size: 16px; color: var(--text); outline: none; }
.palette-field input::-webkit-search-cancel-button { display: none; }
.palette-results { list-style: none; margin: 0; padding: 6px; max-height: min(60vh, 520px); overflow-y: auto; }
.palette-results li[role="option"] { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.palette-results li[aria-selected="true"] { background: var(--surface-3); }
.palette-results .thumb { width: 36px; height: 36px; border-radius: 7px; object-fit: contain; background: #1a1d1a; flex: none; }
.palette-results .label { flex: 1; min-width: 0; }
.palette-results .label b { display: block; font-size: 14.5px; }
.palette-results .label span { font-size: 12.5px; color: var(--text-3); }
.palette-results .group { padding: 10px 10px 4px; font: 700 11px/1 var(--mono); letter-spacing: .12em; color: var(--text-3); }
.palette-results .none { padding: 24px; text-align: center; color: var(--text-3); }

/* --- Enemy view --------------------------------------------------------------- */
.enemy-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 24px; align-items: start; }
.picker { position: sticky; top: calc(var(--bar-h) + 16px); max-height: calc(100vh - var(--bar-h) - 32px); display: flex; flex-direction: column; overflow: hidden; }
.picker-head { padding: 12px; display: grid; gap: 10px; border-bottom: 1px solid var(--line); }
.picker-head .segmented { display: flex; }
.picker-head .segmented button { flex: 1; justify-content: center; padding: 6px 4px; font-size: 13px; }
.picker-list { overflow-y: auto; padding: 6px; display: grid; gap: 2px; overscroll-behavior: contain; }
.picker-item { all: unset; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 600; }
.picker-item:hover { background: var(--surface-2); }
.picker-item[aria-current="true"] { background: var(--accent-soft); color: var(--accent-text); }
.picker-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.picker-item img { width: 40px; height: 32px; object-fit: contain; flex: none; }
.picker-item small { display: block; font-size: 11.5px; color: var(--text-3); font-weight: 500; }
.picker-group { padding: 10px 8px 4px; font-size: 11.5px; font-weight: 700; color: var(--fc, var(--text-3)); letter-spacing: .04em; }
.picker-toggle { display: none; }

.enemy-hero { display: grid; grid-template-columns: 140px 1fr; gap: 20px; padding: 18px; align-items: center; }
.enemy-hero img { width: 140px; height: 110px; object-fit: contain; }
.enemy-hero h1 { font-size: 26px; font-weight: 800; margin: 2px 0 6px; }
.enemy-hero .note { max-width: 70ch; }
.vitals { display: flex; gap: 6px 18px; flex-wrap: wrap; margin: 10px 0; font-size: 13px; color: var(--text-3); }
.vitals b { color: var(--text); font-size: 15px; margin-left: 4px; }

.ranking { overflow: hidden; }
.rank-row { all: unset; box-sizing: border-box; width: 100%; display: grid; grid-template-columns: 36px minmax(0, 1.3fr) minmax(0, 1fr) 92px 96px; gap: 12px; align-items: center; padding: 9px 14px; border-top: 1px solid var(--line); cursor: pointer; }
.rank-row:first-of-type { border-top: 0; }
.rank-row:hover { background: var(--surface-2); }
.rank-row[aria-current="true"] { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.rank-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.rank-row img { width: 34px; height: 34px; }
.rank-row .w b { display: block; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-row .w small, .rank-row .part small { display: block; font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-row .part { font-size: 13.5px; color: var(--text-2); min-width: 0; }
.rank-row .part span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-row .hits { text-align: right; font-size: 22px; font-weight: 850; line-height: 1; }
.rank-row .hits small { font-size: 13px; font-weight: 650; color: var(--text-3); margin-left: 2px; }
.rank-row .hits.dim { font-size: 14px; font-weight: 600; color: var(--text-3); }
.rank-row .badge { justify-self: end; }
.rank-head { display: grid; grid-template-columns: 36px minmax(0, 1.3fr) minmax(0, 1fr) 92px 96px; gap: 12px; padding: 8px 14px; font-size: 11.5px; font-weight: 700; color: var(--text-3); border-bottom: 1px solid var(--line); background: var(--surface-2); }
.rank-head span:nth-child(4), .rank-head span:nth-child(5) { text-align: right; }
.rank-more > summary { padding: 10px 14px; border-top: 1px solid var(--line); font-size: 13.5px; font-weight: 650; color: var(--text-2); }
.rank-more > summary:hover { color: var(--text); }

.matchup { display: grid; gap: 14px; }
.matchup-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.matchup-head img { width: 44px; height: 44px; }
.matchup-head .w-thumb img, .rank-row .w-thumb img, .compare-weapon .w-thumb img { width: auto; height: auto; }
.matchup-head h2 { font-size: 20px; font-weight: 800; }
.matchup-head .segmented { margin-left: auto; }
.stat-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.stat-chip { padding: 7px 11px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); }
.stat-chip span { display: block; font-size: 11.5px; color: var(--text-3); font-weight: 600; }
.stat-chip b { font-size: 16px; }
.stat-chip small { font-size: 12px; color: var(--text-3); margin-left: 6px; }
.verdict { padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); display: grid; gap: 6px; }
.verdict[data-tone="kill"] { border-color: color-mix(in srgb, var(--kill) 45%, var(--line)); background: linear-gradient(90deg, var(--kill-soft), transparent 70%), var(--surface); }
.verdict[data-tone="bleed"] { border-color: color-mix(in srgb, var(--bleed) 45%, var(--line)); background: linear-gradient(90deg, var(--bleed-soft), transparent 70%), var(--surface); }
.verdict .label { font-size: 12px; color: var(--text-3); font-weight: 650; }
.verdict h3 { font-size: 19px; font-weight: 800; }
.verdict h3 .big { font-size: 26px; }
.verdict p { color: var(--text-2); font-size: 14px; }
.assumptions { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; padding: 12px 14px; border-radius: var(--radius); background: var(--surface); border: 1px dashed var(--line-strong); }
.assumptions label { display: grid; gap: 4px; font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.assumptions .check { display: flex; gap: 8px; align-items: center; height: 40px; }
.assumptions p { flex-basis: 100%; font-size: 12.5px; color: var(--text-3); }
.pellet-range { display: grid; gap: 6px; align-items: stretch; }
.pellet-range label { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-size: 13px; }
.pellet-range label b { font-size: 20px; font-weight: 800; color: var(--accent-text); }
.pellet-range input[type="range"] { width: 100%; accent-color: var(--accent); height: 28px; margin: 0; cursor: pointer; }
.bomblet-extra { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; margin-top: 4px; }
.range-scale { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-3); margin-top: -4px; }

.parts { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; }
.part-card { padding: 14px; display: grid; gap: 10px; align-content: start; }
.part-card[data-best] { border-color: color-mix(in srgb, var(--kill) 55%, var(--line)); }
.part-top { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: start; }
.part-top h3 { font-size: 16px; font-weight: 750; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.part-count { display: flex; align-items: baseline; gap: 6px; margin-top: 6px; }
.part-count b { font-size: 30px; font-weight: 850; line-height: 1; }
.part-count span { font-size: 13px; color: var(--text-3); font-weight: 600; }
.part-count.none b { font-size: 15px; color: var(--text-3); font-weight: 650; }
.part-photo { all: unset; cursor: zoom-in; width: 128px; aspect-ratio: 3 / 2; border-radius: 8px; overflow: hidden; position: relative; background: #1a1d1a; border: 1px solid var(--line); }
.part-photo img { position: absolute; max-width: none; }
.part-photo:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.part-photo .zoom { position: absolute; right: 4px; bottom: 4px; width: 22px; height: 22px; border-radius: 5px; background: rgba(0, 0, 0, .6); color: #fff; display: grid; place-items: center; }
.part-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border-radius: 7px; overflow: hidden; border: 1px solid var(--line); }
.part-stats div { background: var(--surface-2); padding: 6px 8px; }
.part-stats dt { font-size: 10.5px; color: var(--text-3); font-weight: 650; }
.part-stats dd { margin: 0; font-size: 13.5px; font-weight: 750; white-space: nowrap; }
.aim { font-size: 13.5px; color: var(--text-2); display: grid; gap: 4px; }
.aim p:first-child { color: var(--text); }
.calc { font-size: 13px; color: var(--text-2); display: grid; gap: 6px; }
.calc ol { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.calc code { font: 12.5px var(--mono); color: var(--text); }
.wiki-ref table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
.wiki-ref th, .wiki-ref td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; }

.image-viewer { display: grid; gap: 16px; }
.image-viewer figure { margin: 0; display: grid; gap: 8px; }
.image-viewer figcaption { font-weight: 700; }
.image-viewer img { border-radius: 8px; border: 1px solid var(--line); width: 100%; height: auto; background: #1a1d1a; }

/* --- Demolition ---------------------------------------------------------------- */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.tile { all: unset; box-sizing: border-box; cursor: pointer; display: grid; grid-template-columns: 44px 1fr; gap: 10px; align-items: center; padding: 10px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.tile:hover { border-color: var(--line-strong); }
.tile[aria-current="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: var(--accent-soft); }
.tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tile img { width: 44px; height: 44px; object-fit: contain; }
.tile b { font-size: 14px; line-height: 1.3; display: block; }
.tile small { font-size: 11.5px; }
.force-scale { display: grid; gap: 8px; }
.force-row { display: grid; grid-template-columns: minmax(110px, 180px) 1fr 56px; gap: 12px; align-items: center; font-size: 13.5px; }
.force-bar { height: 10px; border-radius: 99px; background: var(--surface-3); position: relative; overflow: hidden; }
.force-bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 40%, transparent), var(--accent)); }
.force-row b { text-align: right; }
.result-groups { display: grid; gap: 22px; }
.result-group h3 { font-size: 15px; font-weight: 800; margin-bottom: 8px; display: flex; gap: 8px; align-items: center; }
.result-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; }
.result-item { padding: 12px 14px; display: grid; gap: 6px; align-content: start; }
.result-item header { display: flex; gap: 10px; align-items: center; }
.result-item header img { width: 36px; height: 36px; }
.result-item header b { font-size: 14.5px; display: block; }
.result-item header small { font-size: 12px; color: var(--text-3); }
.result-item header .badge { margin-left: auto; }
.result-item p { font-size: 13px; color: var(--text-2); }
.result-item .how { color: var(--text); font-weight: 650; }
.mode-lines { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.mode-lines li { font-size: 13px; color: var(--text-2); display: flex; gap: 6px; flex-wrap: wrap; align-items: baseline; }
.mode-lines li b { color: var(--text); }

/* --- Factions --------------------------------------------------------------------- */
.faction-sides { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.faction-side { all: unset; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 10px 16px 10px 10px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); font-weight: 750; }
.faction-side img { width: 28px; height: 28px; }
.faction-side[aria-pressed="true"] { border-color: var(--fc); box-shadow: inset 0 -3px 0 var(--fc); }
.faction-side:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.guide-intro { padding: 18px; display: grid; gap: 6px; margin: 14px 0 18px; border-left: 3px solid var(--fc); }
.guide-intro h2 { font-size: 22px; font-weight: 800; }
.guide-intro .en { font: 700 11.5px/1 var(--mono); letter-spacing: .1em; color: var(--text-3); text-transform: uppercase; }
.units { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 14px; }
.unit { display: grid; align-content: start; }
.unit-head { display: grid; grid-template-columns: 84px 1fr; gap: 14px; padding: 16px; border-bottom: 1px solid var(--line); }
.unit-head img { width: 84px; height: 70px; object-fit: contain; }
.unit-head h3 { font-size: 17px; font-weight: 800; }
.unit-head p { font-size: 13.5px; color: var(--text-2); margin-top: 4px; }
.unit-head .base { font-size: 12px; color: var(--text-3); font-weight: 600; }
.pick { border-top: 1px solid var(--line); }
.pick:first-child { border-top: 0; }
.pick > summary { display: grid; grid-template-columns: 22px 34px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 16px; }
.pick > summary:hover { background: var(--surface-2); }
.pick > summary img { width: 34px; height: 34px; }
.pick > summary b { font-size: 14.5px; display: block; }
.pick > summary small { font-size: 12px; color: var(--text-3); }
.pick-result { text-align: right; }
.pick-result b { font-size: 18px; font-weight: 850; }
.pick-result small { display: block; }
.pick-body { padding: 0 16px 16px 96px; display: grid; gap: 10px; font-size: 13.5px; color: var(--text-2); }
.pick-body .how { color: var(--text); }
.rank-num { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; background: var(--surface-3); font-size: 12px; font-weight: 800; color: var(--text-2); }

/* --- Method ------------------------------------------------------------------------- */
.method { display: grid; gap: 18px; }
.method h3 { font-size: 16px; font-weight: 800; }
.method p, .method li { color: var(--text-2); font-size: 14.5px; }
.method ol, .method ul { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 6px; }
.formula { padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); font-size: 14px; display: grid; gap: 8px; }
.formula .step { display: grid; grid-template-columns: 24px 1fr auto; gap: 10px; align-items: baseline; }
.formula .step i { font-style: normal; font-weight: 800; color: var(--accent-text); }
.formula .step b { font-size: 16px; }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 60; padding: 10px 16px; border-radius: 10px; background: var(--text); color: var(--bg); font-weight: 650; font-size: 14px; box-shadow: var(--shadow); }

/* --- Responsive ------------------------------------------------------------------------ */
/* --- Theme toggle -------------------------------------------------------------- */
/* The moon shows in dark mode (tap for light), the sun in light mode. */
.theme-toggle .theme-icon { display: none; }
.theme-toggle [data-theme-icon="dark"] { display: inline-flex; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-toggle [data-theme-icon="dark"] { display: none; }
  :root:not([data-theme="dark"]) .theme-toggle [data-theme-icon="light"] { display: inline-flex; }
}
:root[data-theme="light"] .theme-toggle [data-theme-icon="dark"] { display: none; }
:root[data-theme="light"] .theme-toggle [data-theme-icon="light"] { display: inline-flex; }

/* --- Gear ------------------------------------------------------------------ */
.gear-tabs { display: flex; gap: 22px; flex-wrap: wrap; }
.gear-tabs button { border: 0; background: none; padding: 0 0 6px; font: 800 28px/1.15 var(--font); color: var(--text-3); border-bottom: 3px solid transparent; letter-spacing: -.01em; }
.gear-tabs button:hover { color: var(--text-2); }
.gear-tabs button[aria-pressed="true"] { color: var(--text); border-bottom-color: var(--accent); }
.gear-tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
.gear-head p { margin-top: 8px; }
.gear-groups button .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dot); }
.gear-groups button .count { font-size: 12px; opacity: .6; font-weight: 500; }
.gear-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.gear-card .card-open { gap: 9px; }
.gear-art { display: grid; place-items: center; height: 96px; border-radius: 8px; overflow: hidden;
  background: radial-gradient(120% 90% at 50% 100%, color-mix(in srgb, var(--cat, var(--accent)) 14%, transparent), transparent 70%), var(--surface-2); }
.gear-art img { max-width: 86%; max-height: 78px; width: auto; height: auto; object-fit: contain; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .35)); }
.gear-art[data-group="throwable"] img { max-height: 70px; }
.gear-art.large { height: 170px; margin-bottom: 4px; --cat: var(--accent); }
.gear-art.large img { max-height: 140px; max-width: 80%; }
.gear-art[data-group="secondary"] { --cat: var(--g-secondary); }
.gear-art[data-group="throwable"] { --cat: var(--g-throwable); }
.gear-title h3 { font-size: 16.5px; font-weight: 750; }
.gear-traits { gap: 4px; min-height: 22px; }
.gear-id { margin-top: 0; }
.gear-block { min-width: 0; }
.w-thumb { display: grid; place-items: center; flex: none; border-radius: 7px; background: var(--surface-2); overflow: hidden; }
.w-thumb img { max-width: 92%; max-height: 80%; object-fit: contain; }
.group-tabs { margin: -4px 0 10px; }
.group-tabs .count { font-size: 12px; opacity: .6; font-weight: 500; }
.rank-detail { padding: 2px 14px 18px; background: var(--bg-raise); border-bottom: 1px solid var(--line); box-shadow: inset 3px 0 0 var(--accent); }
.rank-detail .matchup { display: grid; gap: 12px; }
.rank-detail .matchup > .section-title { margin: 10px 0 0; }
.size-tag { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 4px; font-style: normal; font-size: 11px; font-weight: 750; vertical-align: 1px; background: var(--bleed-soft); color: var(--bleed); }
.size-tag[data-size="massive"] { background: var(--blocked-soft); color: var(--blocked); }
.enemy-hero .size-tag { margin-left: 8px; }
.rank-row.one-shot { background: color-mix(in srgb, var(--kill) 9%, transparent); }
.rank-row.one-shot[aria-current="true"] { background: var(--accent-soft); }
.rank-row .one-shot-hits { color: var(--kill); }
.one-shot-note { margin: -2px 0 10px; padding: 9px 12px; border-radius: 8px; font-size: 13.5px; color: var(--text-2); background: var(--kill-soft); border: 1px solid color-mix(in srgb, var(--kill) 30%, var(--line)); }
.one-shot-note.none { background: var(--bleed-soft); border-color: color-mix(in srgb, var(--bleed) 35%, var(--line)); }
.one-shot-note b { color: var(--text); }
.lo-row.heavy { border-color: color-mix(in srgb, var(--bleed) 45%, var(--line)); background: var(--bleed-soft); }
.lo-row.one-shot { border-color: color-mix(in srgb, var(--kill) 40%, var(--line)); }
.one-shot-badge { justify-self: start; padding: 2px 8px; border-radius: 5px; font-size: 11.5px; font-weight: 800; color: var(--kill); background: var(--kill-soft); }
.lo-enemy .size-tag { margin: 0; }
.acc-steps { margin: 8px 0; padding-left: 20px; display: grid; gap: 3px; font-size: 14px; }
.compare-add { margin-left: auto; }
.matchup.flash > .section-title + .panel { animation: matchup-flash 1.6s ease-out; }
@keyframes matchup-flash { 0%, 35% { box-shadow: 0 0 0 2px var(--accent), 0 0 0 7px var(--accent-soft); border-color: var(--accent); } 100% { box-shadow: 0 0 0 0 transparent; } }
.matchup-head .segmented + .compare-add, .matchup-head .compare-add + .segmented { margin-left: 0; }
.enemy-compare { min-width: 520px; }
.enemy-compare td .badge { margin-left: 4px; vertical-align: 2px; }
.compare-hits { font-size: 20px; font-weight: 800; }
.compare-weapon { display: flex; gap: 10px; align-items: center; }
.compare-weapon small { display: block; font-weight: 500; font-size: 12px; color: var(--text-3); }
.gear-modes { min-width: 440px; }
.gear-modes tbody th[scope="row"] { font-weight: 650; font-size: 13px; color: var(--text-2); white-space: normal; width: auto; }
.gear-modes td small { display: inline; color: var(--text-3); margin-left: 1px; }

/* --- Loadout check ----------------------------------------------------------- */
.lo-builder { padding: 14px; display: grid; gap: 12px; }
.lo-slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) repeat(4, minmax(0, 1fr)); gap: 8px; }
.lo-slot { position: relative; min-width: 0; display: grid; }
.lo-slot-pick { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px 10px; border-radius: 9px;
  border: 1px dashed var(--line-strong); background: var(--surface-2); color: var(--text); text-align: center; min-height: 112px; height: 100%; justify-content: center; }
.lo-slot.filled .lo-slot-pick { border-style: solid; }
.lo-slot-pick:hover { border-color: var(--text-3); }
.lo-slot[data-slot-kind="primary"] .lo-slot-pick { box-shadow: inset 0 3px 0 var(--g-primary); }
.lo-slot[data-slot-kind="secondary"] .lo-slot-pick { box-shadow: inset 0 3px 0 var(--g-secondary); }
.lo-slot[data-slot-kind="throwable"] .lo-slot-pick { box-shadow: inset 0 3px 0 var(--g-throwable); }
.lo-slot[data-slot-kind="stratagem"] .lo-slot-pick { box-shadow: inset 0 3px 0 var(--c-support); }
.lo-slot-text { display: grid; gap: 1px; min-width: 0; width: 100%; }
.lo-slot-text small { font-size: 11.5px; color: var(--text-3); font-weight: 600; }
.lo-slot-text b { font-size: 13.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lo-slot:not(.filled) .lo-slot-text b { color: var(--text-3); font-weight: 600; }
.lo-slot-text em { font-style: normal; font-size: 11px; color: var(--bleed); }
.lo-clear { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; }
.lo-thumb { display: grid; place-items: center; flex: none; border-radius: 7px; background: var(--surface-3); overflow: hidden; }
.lo-thumb img { max-width: 92%; max-height: 82%; object-fit: contain; }
.lo-thumb.empty { color: var(--text-3); background: transparent; border: 1px dashed var(--line-strong); }
.lo-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lo-actions .segmented button[data-side][aria-pressed="true"] { color: var(--fc); }
.lo-empty { margin-top: 16px; }
.lo-summary { display: flex; align-items: center; gap: 16px; margin-top: 18px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.lo-score { display: flex; align-items: baseline; gap: 4px; flex: none; }
.lo-score b { font-size: 34px; font-weight: 850; line-height: 1; color: var(--accent-text); }
.lo-score span { color: var(--text-3); font-weight: 650; }
.lo-summary p { color: var(--text-2); font-size: 14px; }
.lo-rows { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 8px; }
.lo-row { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 12px; align-items: center; padding: 10px 12px; }
.lo-row.gap { border-color: color-mix(in srgb, var(--blocked) 40%, var(--line)); background: var(--blocked-soft); }
.lo-enemy { display: grid; justify-items: center; gap: 4px; text-decoration: none; color: var(--text); text-align: center; font-size: 13px; }
.lo-enemy img, .lo-enemy > span { width: 72px; height: 56px; object-fit: contain; }
.lo-enemy:hover b { text-decoration: underline; }
.lo-row-body { display: grid; gap: 8px; min-width: 0; }
.lo-answer { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.lo-answer > span:nth-child(2) { flex: 1 1 140px; min-width: 0; }
.lo-answer small { color: var(--text-3); font-size: 12.5px; }
.lo-also { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: 12.5px; color: var(--text-2); border-top: 1px dashed var(--line); padding-top: 7px; }
.lo-also > small { color: var(--text-3); font-weight: 650; }
.lo-also-item { display: inline-flex; align-items: center; gap: 5px; }
.lo-also-item b { font-weight: 650; color: var(--text); }
.lo-gap-body { display: grid; gap: 8px; justify-items: start; }
.lo-fixes { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.lo-fixes > small { width: 100%; color: var(--text-3); font-weight: 650; font-size: 12px; }
.lo-fix { height: 30px; padding: 0 10px 0 6px; background: var(--surface); }
.lo-fix-group { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; width: 100%; }
.lo-fix-group > span { font-size: 12px; font-weight: 700; color: var(--text-2); min-width: 92px; }
.lo-shield { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.lo-shield input { accent-color: var(--accent); }
.lo-picker .lo-choices { display: grid; gap: 10px; max-height: none; }
.lo-choice-group { display: grid; gap: 2px; }
.lo-choice-group .picker-group { border-bottom: 1px solid var(--line); margin-bottom: 2px; padding-bottom: 6px; }
.lo-kinds { gap: 5px; }
.lo-kinds .chip { height: 30px; padding: 0 10px; font-size: 13px; }
.lo-choice small { display: block; font-size: 12px; color: var(--text-3); }
@media (max-width: 1080px) {
  .search-label { display: none; }
  .search-trigger { min-width: 0; }
  .enemy-layout { grid-template-columns: 1fr; }
  .picker { position: static; max-height: none; }
  .picker-list { max-height: 360px; }
  .picker.collapsed .picker-list, .picker.collapsed .picker-head > :not(.picker-toggle) { display: none; }
  .picker-toggle { display: flex; }
}
@media (max-width: 820px) {
  .rank-detail { padding: 2px 10px 14px; }
  .gear-tabs { gap: 16px; }
  .gear-tabs button { font-size: 22px; }
  .lo-slots { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lo-slot[data-slot-kind="stratagem"] .lo-slot-pick { min-height: 96px; }
  .lo-rows { grid-template-columns: 1fr; }
  .lo-row { grid-template-columns: 84px minmax(0, 1fr); }
  .lo-enemy img, .lo-enemy > span { width: 60px; height: 48px; }
  :root { --bar-h: 54px; }
  .tabs { display: none; }
  .bar { gap: 12px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--line);
  }
  .tabbar a { display: grid; justify-items: center; gap: 2px; padding: 6px 0; font-size: 11.5px; font-weight: 650; color: var(--text-3); text-decoration: none; border-radius: 8px; }
  .tabbar a[aria-current] { color: var(--text); }
  .tabbar a[aria-current] .icon { color: var(--accent); }
  body { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  main { padding: 20px 16px 40px; }
  .footer { padding: 20px 16px 24px; }
  .page-head h1 { font-size: 24px; }
  .tray { bottom: calc(80px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(150px + env(safe-area-inset-bottom)); }
  .sheet, .sheet.wide { margin: auto 0 0; width: 100vw; height: 92dvh; max-height: 92dvh; border-left: 0; border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; }
  @keyframes slide-in { from { transform: translateY(40px); opacity: 0; } }
  .rank-row, .rank-head { grid-template-columns: 34px minmax(0, 1fr) 70px; row-gap: 2px; }
  .rank-head span:nth-child(3), .rank-head span:nth-child(5) { display: none; }
  .rank-row .part { grid-column: 2; grid-row: 2; }
  .rank-row .hits { grid-column: 3; grid-row: 1; }
  .rank-row .badge { grid-column: 3; grid-row: 2; }
  .rank-row img { grid-row: span 2; }
  .enemy-hero { grid-template-columns: 96px 1fr; gap: 14px; padding: 14px; }
  .enemy-hero img { width: 96px; height: 80px; }
  .enemy-hero h1 { font-size: 22px; }
  .matchup-head .segmented { margin-left: 0; }
  .parts, .units, .result-list { grid-template-columns: 1fr; }
  .units { grid-template-columns: minmax(0, 1fr); }
  .pick-body { padding-left: 16px; }
}
@media (max-width: 480px) {
  .gear-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .gear-card { padding: 10px; }
  .gear-card .gear-art { height: 70px; }
  .gear-card .gear-art img { max-height: 56px; }
  .gear-title h3 { font-size: 15px; }
  .gear-card .en { font-size: 11.5px; }
  .gear-card .stat-row dd { font-size: 13.5px; }
  .gear-traits .badge { height: 20px; padding: 0 6px; font-size: 11px; }
  .lo-slots { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .stat-row > div:nth-child(3) { border-left: 0; }
  .stat-row > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .part-top { grid-template-columns: 1fr; }
  .part-photo { width: 100%; }
  .part-stats { grid-template-columns: repeat(2, 1fr); }
  .force-row { grid-template-columns: 1fr 48px; }
  .force-row .force-bar { grid-column: 1 / -1; grid-row: 2; }
  .brand-text { font-size: 15px; }
  /* Room for the language button: phones have no "/" key to hint at, and the
     footer keeps the link to "how the numbers work". */
  .bar-actions { gap: 6px; }
  .search-trigger kbd, .bar-actions [data-action="method"] { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
