/* SkyBlock DPS Lab – design system: tokens, base, layout shell, top bar, landing, player header, scenario bar,
   form controls, buttons, segmented controls, tabs, generic card / table primitives, popovers, states, settings
   dialog and the assumptions panel.  Brief: research/DESIGN.md ("professional, not vibecoded").
   css/panels.css (loadout, results, upgrades) and css/mc.css (Minecraft tooltip, icons, rarity frames) load after
   this file and use the tokens below.  Dark is the default theme; light via html[data-theme="light"]. */

/* ------------------------------------------------------------------------------------------ */
/* Tokens                                                                                       */

:root {
  color-scheme: dark;
  --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-num: var(--font-ui);
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --font-mc: 'Monocraft SkyBlock', 'Minecraft', ui-monospace, monospace; /* font face: css/mc.css */

  --bg: #0b0c0e;
  --surface: #111215;
  --raised: #16181c;
  --hover: #1c1f24;
  --border: #23262c;
  --border-strong: #31353d;
  --text: #e6e7ea;
  --muted: #9096a0;
  --faint: #5c6370;
  --accent: #4f8cff;
  --accent-strong: #3b78ec;
  --accent-weak: rgba(79, 140, 255, 0.12);
  --accent-line: rgba(79, 140, 255, 0.45);
  --on-accent: #ffffff;
  --gain: #3fb950;
  --loss: #f85149;
  --warn: #d29922;
  --gain-weak: rgba(63, 185, 80, 0.1);
  --loss-weak: rgba(248, 81, 73, 0.1);
  --warn-weak: rgba(210, 153, 34, 0.1);
  --shadow-pop: 0 16px 40px -12px rgba(0, 0, 0, 0.7);
  --backdrop: rgba(0, 0, 0, 0.6);
  --skel: #17191d;
  --skel-hi: #1f2227;

  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 8px;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-7: 28px; --sp-8: 32px;
  --topbar-h: 56px;
  --sticky-top: var(--topbar-h);
  --gutter: 16px;

  /* Minecraft colour codes (dark theme: originals, darkest tones lifted for contrast) */
  --mc-0: #4a4a4a; --mc-1: #5560f0; --mc-2: #2fb52f; --mc-3: #1fb5b5;
  --mc-4: #e0393e; --mc-5: #c94ac9; --mc-6: #ffaa00; --mc-7: #aaaaaa;
  --mc-8: #707070; --mc-9: #6f73ff; --mc-a: #55ff55; --mc-b: #55ffff;
  --mc-c: #ff5555; --mc-d: #ff55ff; --mc-e: #ffff55; --mc-f: #f2f2f2;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --raised: #f3f4f6;
  --hover: #eceef1;
  --border: #e3e5e9;
  --border-strong: #cfd3da;
  --text: #16181d;
  --muted: #5b616b;
  --faint: #8b919b;
  --accent: #2f6fe4;
  --accent-strong: #2560cc;
  --accent-weak: rgba(47, 111, 228, 0.08);
  --accent-line: rgba(47, 111, 228, 0.4);
  --gain: #1a7f37;
  --loss: #cf222e;
  --warn: #9a6700;
  --gain-weak: rgba(26, 127, 55, 0.08);
  --loss-weak: rgba(207, 34, 46, 0.07);
  --warn-weak: rgba(154, 103, 0, 0.08);
  --shadow-pop: 0 12px 32px -12px rgba(16, 18, 24, 0.25);
  --backdrop: rgba(16, 18, 24, 0.35);
  --skel: #eef0f3;
  --skel-hi: #f6f7f9;

  --mc-0: #000000; --mc-1: #1f2a9e; --mc-2: #16801b; --mc-3: #0b7d85;
  --mc-4: #a3141a; --mc-5: #8f1a8f; --mc-6: #b06800; --mc-7: #6b6b78;
  --mc-8: #4b4b55; --mc-9: #3434d4; --mc-a: #15872b; --mc-b: #0a8ba3;
  --mc-c: #d42525; --mc-d: #bd1cbd; --mc-e: #8f7300; --mc-f: #23252b;
}

:root {
  /* Rarity colours (item names, slot frames) */
  --r-common: var(--mc-f); --r-uncommon: var(--mc-a); --r-rare: var(--mc-9); --r-epic: var(--mc-5);
  --r-legendary: var(--mc-6); --r-mythic: var(--mc-d); --r-divine: var(--mc-b); --r-special: var(--mc-c);
  --r-very_special: var(--mc-c); --r-ultimate: var(--mc-4); --r-admin: var(--mc-4);

  /* Aliases for older markup (inline styles and modules that predate the v2 token names). */
  --surface-2: var(--raised);
  --surface-3: var(--hover);
  --border-2: var(--border-strong);
  --text-2: var(--muted);
  --text-3: var(--faint);
  --accent-hi: var(--accent);
  --accent-lo: var(--accent-strong);
  --accent-bg: var(--accent-weak);
  --accent-border: var(--accent-line);
  --good: var(--gain);
  --bad: var(--loss);
  --good-bg: var(--gain-weak);
  --bad-bg: var(--loss-weak);
  --warn-bg: var(--warn-weak);
  --info: var(--accent);
  --shadow: none;
  --shadow-sm: none;
}

/* ------------------------------------------------------------------------------------------ */
/* Base                                                                                         */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 16px); }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font: 400 14px/1.5 var(--font-ui);
  font-feature-settings: 'cv11', 'ss01';
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
main { flex: 1 0 auto; outline: none; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; font-weight: 600; letter-spacing: -0.011em; }
p { margin: 0; }
b, strong { font-weight: 600; }
[hidden] { display: none !important; }
.ico { flex: none; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-size: 0.92em; }
/* left: 0 – an absolutely positioned text at its static position inside a horizontal scroller (e.g. a stat list that
   scrolls on phones) would otherwise escape the scroller and widen the page. */
.sr-only { position: absolute !important; left: 0; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
kbd {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); color: var(--faint); font: 500 11px/1 var(--font-ui);
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 0; }

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100; padding: 8px 12px; border-radius: var(--radius);
  background: var(--accent); color: var(--on-accent); font-weight: 600; transition: top .15s;
}
.skip-link:focus { top: 8px; text-decoration: none; }

.container { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 var(--gutter); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ------------------------------------------------------------------------------------------ */
/* Top bar                                                                                      */

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { display: flex; align-items: center; gap: 16px; height: var(--topbar-h); }
.brand {
  display: inline-flex; align-items: baseline; gap: 6px; color: var(--text); font-size: 15px; font-weight: 600;
  letter-spacing: -0.015em; white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand-name .lab { color: var(--muted); font-weight: 500; }
.top-search { flex: 0 1 360px; min-width: 0; margin-left: auto; }
.top-search:empty { display: none; }
.top-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.top-search:empty + .top-actions { margin-left: auto; }

.search-mini { position: relative; display: flex; align-items: center; }
.search-mini > .ico { position: absolute; left: 10px; color: var(--faint); pointer-events: none; }
.search-mini input {
  width: 100%; height: 32px; padding: 0 34px 0 32px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 13px;
  transition: border-color .12s;
}
.search-mini input::-webkit-search-cancel-button { display: none; }
.search-mini input::placeholder { color: var(--faint); }
.search-mini input:hover { border-color: var(--border-strong); }
.search-mini input:focus { border-color: var(--accent); }
.search-mini input[aria-invalid="true"] { border-color: var(--loss); }
.search-mini kbd { position: absolute; right: 8px; pointer-events: none; }
.search-mini input:focus ~ kbd, .search-mini input:not(:placeholder-shown) ~ kbd { display: none; }

/* ------------------------------------------------------------------------------------------ */
/* Buttons                                                                                      */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: var(--radius); border: 1px solid var(--border-strong);
  background: var(--raised); color: var(--text); font-weight: 500; font-size: 13px; line-height: 1; white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--hover); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn .ico { color: var(--muted); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn--primary .ico { color: inherit; }
.btn--primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn--ghost { background: transparent; }
.btn--ghost:hover { background: var(--hover); }
.btn--danger { color: var(--loss); }
.btn--danger:hover { background: var(--loss-weak); border-color: color-mix(in srgb, var(--loss) 40%, transparent); }
.btn--sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn--lg { height: 40px; padding: 0 16px; font-size: 14px; }

.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none; padding: 0;
  border-radius: var(--radius); border: 1px solid transparent; background: transparent; color: var(--muted);
  transition: background .12s, color .12s, border-color .12s;
}
.icon-btn:hover { color: var(--text); background: var(--hover); }
.icon-btn--sm { width: 28px; height: 28px; }
.icon-btn--bare { border-color: transparent; background: transparent; }
.icon-btn--outline { border-color: var(--border-strong); }
.icon-btn-dot { position: absolute; top: 6px; right: 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

.link-btn {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 0; border: 0; background: none;
  color: var(--muted); font-size: 12px; font-weight: 500;
}
.link-btn:hover { color: var(--text); }

/* ------------------------------------------------------------------------------------------ */
/* Form controls                                                                                */

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; padding: 0; border: 0; }
.field-label { font-size: 12px; font-weight: 500; color: var(--muted); }
.field-label .opt { font-weight: 400; color: var(--faint); }
.field-hint { font-size: 12px; color: var(--faint); }
.field-error { font-size: 12px; color: var(--loss); }
.field-error:empty { display: none; }
.input, .select {
  width: 100%; min-width: 0; height: 32px; padding: 0 10px; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-size: 13px;
  transition: border-color .12s;
}
.input::placeholder { color: var(--faint); }
.input:hover, .select:hover { border-color: color-mix(in srgb, var(--border-strong) 60%, var(--muted)); }
.input:focus, .select:focus { border-color: var(--accent); }
.input[aria-invalid="true"] { border-color: var(--loss); }
.input.num { font-variant-numeric: tabular-nums; }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 30px; cursor: pointer; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b919b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
}
.select option, .select optgroup { background: var(--surface); color: var(--text); }
.select--sm { height: 28px; padding: 0 26px 0 8px; font-size: 12px; width: auto; background-position: right 6px center; }

.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; font-size: 13px; }
.check input, input[type="checkbox"].cbx {
  appearance: none; -webkit-appearance: none; width: 16px; height: 16px; margin: 0; flex: none; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); display: inline-grid; place-items: center; cursor: pointer;
  transition: background .12s, border-color .12s;
}
.check input:hover, input[type="checkbox"].cbx:hover { border-color: var(--muted); }
.check input:checked, input[type="checkbox"].cbx:checked { background: var(--accent); border-color: var(--accent); }
.check input:checked::after, input[type="checkbox"].cbx:checked::after {
  content: ''; width: 4px; height: 8px; border: solid #fff; border-width: 0 1.5px 1.5px 0; transform: translateY(-1px) rotate(45deg);
}

/* switch (checkbox role=switch) */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; cursor: pointer; }
.switch-row.is-disabled { opacity: .55; cursor: not-allowed; }
.switch-text { display: flex; flex-direction: column; min-width: 0; }
.switch-label { font-size: 13px; display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.switch-desc { display: flex; flex-direction: column; font-size: 12px; color: var(--faint); line-height: 1.4; }
.switch {
  appearance: none; -webkit-appearance: none; position: relative; flex: none; width: 28px; height: 16px; margin: 0; border-radius: 999px;
  background: var(--hover); border: 1px solid var(--border-strong); cursor: pointer; transition: background .12s, border-color .12s;
}
.switch::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--muted); transition: transform .12s, background .12s;
}
.switch:checked { background: var(--accent); border-color: var(--accent); }
.switch:checked::after { transform: translateX(12px); background: #fff; }

/* ------------------------------------------------------------------------------------------ */
/* Segmented controls & tabs                                                                    */

.seg {
  display: inline-flex; align-items: stretch; gap: 2px; padding: 2px; max-width: 100%;
  border-radius: var(--radius); background: var(--bg); border: 1px solid var(--border);
}
.seg > button, .seg > label {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 28px; height: 28px; padding: 0 10px; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--muted); font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background .12s, color .12s;
}
.seg > button:hover, .seg > label:hover { color: var(--text); background: var(--raised); }
.seg > button[aria-pressed="true"], .seg > button[aria-selected="true"], .seg > label:has(input:checked) {
  background: var(--raised); border-color: var(--border-strong); color: var(--text);
}
:root[data-theme="light"] .seg { background: var(--raised); }
:root[data-theme="light"] .seg > button[aria-pressed="true"], :root[data-theme="light"] .seg > button[aria-selected="true"],
:root[data-theme="light"] .seg > label:has(input:checked) { background: var(--surface); }
:root[data-theme="light"] .seg > button:hover, :root[data-theme="light"] .seg > label:hover { background: var(--surface); }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.seg > label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.seg > label:has(input:disabled), .seg > button:disabled { opacity: .35; cursor: not-allowed; }
.seg > label:has(input:disabled):hover { background: transparent; color: var(--muted); }
.seg--sm > button, .seg--sm > label { height: 24px; min-width: 26px; padding: 0 8px; font-size: 12px; }
.seg .lvl { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.seg > label:has(input:checked) .lvl { color: var(--muted); }
.seg-ico { display: inline-grid; place-items: center; flex: none; }
.field > .seg { align-self: flex-start; }

.tab {
  position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 10px 2px; margin-right: 16px; border: 0;
  background: none; color: var(--muted); font-weight: 500; font-size: 13px; white-space: nowrap;
}
.tab:last-child { margin-right: 0; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); }
.tab[aria-selected="true"]::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--accent); }
.tab .ico { color: var(--faint); }
.tab .count { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------------------------------ */
/* Badges, chips, markers                                                                       */

.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 18px; padding: 0 6px; border-radius: var(--radius-sm);
  font-size: 11px; font-weight: 500; line-height: 1; white-space: nowrap; border: 1px solid var(--border-strong);
  color: var(--muted); background: transparent;
}
.badge--neutral { color: var(--muted); }
.badge--accent { color: var(--accent); border-color: var(--accent-line); }
.badge--good { color: var(--gain); border-color: color-mix(in srgb, var(--gain) 40%, transparent); }
.badge--bad { color: var(--loss); border-color: color-mix(in srgb, var(--loss) 40%, transparent); }
.badge--warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.badge--wrap { height: auto; min-height: 18px; white-space: normal; padding: 2px 6px; line-height: 1.3; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 22px; padding: 1px 8px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); color: var(--muted); font-size: 12px; white-space: nowrap;
}
.chip b, .chip .num { color: var(--chip-c, var(--text)); font-weight: 500; }
.chip--accent, .chip--on { border-color: var(--accent-line); color: var(--text); }
.approx {
  display: inline-block; margin-left: 2px; color: var(--warn); font-size: 0.75em; font-weight: 600; line-height: 1;
  vertical-align: super; cursor: help;
}
.type-list { color: var(--muted); }
.type-badge { display: inline; color: var(--muted); font-size: 12px; white-space: nowrap; }
.type-badge + .type-badge::before { content: ', '; }

/* ------------------------------------------------------------------------------------------ */
/* Card & table primitives                                                                      */

.card {
  min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap;
  min-height: 44px; padding: 10px 16px; border-bottom: 1px solid var(--border);
}
.card-head-text { min-width: 0; flex: 1 1 200px; }
.card-title { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.card-title .ico { color: var(--faint); }
.card-sub { margin-top: 2px; font-size: 12px; color: var(--muted); }
.card-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card-body { padding: 16px; }
.card + .card { margin-top: 16px; }
.subhead { margin: 0 0 8px; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); }
.notes-list { margin: 0; padding-left: 16px; color: var(--muted); font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.warn-list li::marker { color: var(--warn); }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  height: 32px; padding: 0 12px; text-align: left; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .04em;
  color: var(--faint); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { height: 40px; padding: 0 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .r, .table th.r { text-align: right; font-variant-numeric: tabular-nums; }
.table tbody tr:hover td { background: var(--raised); }

/* Item text shared by every view (dom.js itemName / petName / statSymbol). */
.item-name { overflow-wrap: anywhere; }
.item-name.is-empty { color: var(--faint); font-weight: 400; }
.stars { white-space: nowrap; letter-spacing: -0.04em; }
.stars-gold { color: var(--mc-6); }
.stars-master { color: var(--mc-c); margin-left: 1px; }
.pet-lvl { color: var(--faint); font-weight: 400; }
.stat-sym { display: inline-block; width: 1.1em; text-align: center; }

/* Game icon placeholder until ui/icons.js is available (css/mc.css styles the real .mc-icon). */
.mc-icon--ph { display: inline-block; flex: none; border-radius: 2px; background: var(--raised); }

/* ------------------------------------------------------------------------------------------ */
/* Landing                                                                                      */

.landing { padding-top: 64px; padding-bottom: 64px; }
.landing-head { max-width: 640px; }
.landing-kicker { font-size: 12px; font-weight: 500; color: var(--muted); }
.landing-title { margin-top: 8px; font-size: 28px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
.landing-sub { margin-top: 10px; font-size: 15px; color: var(--muted); line-height: 1.55; max-width: 600px; }
.landing-search { margin-top: 24px; max-width: 560px; }
.search-big { display: flex; gap: 8px; }
.search-big .input-wrap { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; }
.search-big .input-wrap > .ico { position: absolute; left: 12px; color: var(--faint); pointer-events: none; }
.search-big input {
  width: 100%; height: 40px; padding: 0 12px 0 36px; border-radius: var(--radius); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-size: 14px; transition: border-color .12s;
}
.search-big input::-webkit-search-cancel-button { display: none; }
.search-big input::placeholder { color: var(--faint); }
.search-big input:hover { border-color: color-mix(in srgb, var(--border-strong) 60%, var(--muted)); }
.search-big input:focus { border-color: var(--accent); }
.search-big input[aria-invalid="true"] { border-color: var(--loss); }
.search-msg { min-height: 20px; margin-top: 6px; font-size: 12px; color: var(--loss); }

.landing-grid {
  display: grid; gap: 32px; margin-top: 40px; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: start;
}
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 28px; margin-bottom: 8px; }
.section-title { font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); }

.player-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.player-row { display: flex; align-items: center; gap: 4px; padding-right: 8px; border-top: 1px solid var(--border); }
.player-row:first-child { border-top: 0; }
.player-link {
  display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; height: 52px; padding: 0 12px; border: 0; background: none;
  text-align: left; border-radius: var(--radius-lg);
}
.player-link:hover .player-row-name { color: var(--accent); }
.player-row:hover { background: var(--raised); }
.player-row:first-child, .player-row:first-child .player-link { border-top-left-radius: var(--radius-lg); border-top-right-radius: var(--radius-lg); }
.player-row:last-child, .player-row:last-child .player-link { border-bottom-left-radius: var(--radius-lg); border-bottom-right-radius: var(--radius-lg); }
.player-av {
  position: relative; width: 32px; height: 32px; flex: none; border-radius: var(--radius-sm); overflow: hidden; background: var(--raised);
  display: grid; place-items: center; color: var(--faint); font-size: 13px; font-weight: 600;
}
.player-av img { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
.player-row-text { display: flex; flex-direction: column; min-width: 0; }
.player-row-name { font-size: 14px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-row-meta { font-size: 12px; color: var(--faint); }
.player-link > .ico { margin-left: auto; color: var(--faint); }

.cover-list { margin: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.cover-row { display: grid; grid-template-columns: 148px minmax(0, 1fr); gap: 16px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--border); }
.cover-row:first-child { border-top: 0; }
.cover-icons { display: flex; gap: 4px; align-items: center; }
.cover-text { min-width: 0; }
.cover-text dt { font-size: 13px; font-weight: 600; }
.cover-text dd { margin: 2px 0 0; font-size: 13px; color: var(--muted); }

/* ------------------------------------------------------------------------------------------ */
/* Player page layout                                                                           */

.player-page { padding-top: 24px; padding-bottom: 48px; display: flex; flex-direction: column; gap: 16px; }
.grid-main { display: grid; gap: 16px; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); align-items: start; }
.grid-main > * { min-width: 0; }
.col-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.col-side > #assume-panel:empty { display: none; }
.demo-banner {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--radius); font-size: 13px; color: var(--muted);
  border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); background: var(--warn-weak);
}
.demo-banner .ico { color: var(--warn); }
.demo-banner b { color: var(--text); }

/* ------------------------------------------------------------------------------------------ */
/* Player header                                                                                */

.phead { display: flex; flex-direction: column; gap: 16px; }
.phead-top { display: flex; align-items: center; gap: 16px; min-width: 0; }
.avatar {
  position: relative; width: 48px; height: 48px; flex: none; border-radius: var(--radius); overflow: hidden;
  background: var(--raised); border: 1px solid var(--border); display: grid; place-items: center;
  font-weight: 600; font-size: 18px; color: var(--faint);
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
.phead-main { flex: 1 1 auto; min-width: 0; }
.phead-name { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
.phead-name h1 { font-size: 20px; font-weight: 600; letter-spacing: -0.015em; overflow-wrap: anywhere; }
.phead-sub { margin-top: 2px; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 16px; color: var(--muted); font-size: 13px; }
.phead-sub .num { color: var(--text); }
.sb-level { font-weight: 600; font-variant-numeric: tabular-nums; }
.phead-actions { display: flex; gap: 4px; flex: none; align-self: flex-start; }
.profile-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px 0 10px; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: var(--surface); font-weight: 500; font-size: 13px;
}
.profile-btn:hover { background: var(--hover); }
.profile-btn .ico { color: var(--faint); }
.gm-ico { font-weight: 600; }
.gm-ironman { color: var(--mc-7); }
.gm-island { color: var(--mc-a); }
.gm-bingo { color: var(--mc-6); }

/* compact stat strip */
.pstrip {
  display: flex; flex-wrap: wrap; margin: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface);
}
.pstat { display: flex; flex-direction: column; justify-content: center; gap: 4px; min-width: 0; padding: 10px 16px; border-left: 1px solid var(--border); }
.pstat:first-child { border-left: 0; }
.pstat dt { font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); white-space: nowrap; }
.pstat dd { margin: 0; display: flex; align-items: center; gap: 4px 12px; flex-wrap: wrap; min-height: 24px; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pstat-unit { font-size: 12px; font-weight: 400; color: var(--muted); }
.pstat--grow { flex: 1 1 auto; }
.pstat-lv {
  display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; color: var(--muted); white-space: nowrap;
  padding-bottom: 2px; border-bottom: 2px solid transparent;
}
.pstat-lv .v { color: var(--text); font-weight: 600; }
.pstat-lv.is-max .v { color: var(--mc-6); }
.pstat-lv.is-selected { border-bottom-color: var(--accent); }
.pstat-lv .mc-icon, .pstat-lv .mc-icon--ph { margin-bottom: 0; }

/* profile listbox (popover) */
.optlist { display: flex; flex-direction: column; gap: 1px; padding: 4px; min-width: 240px; max-height: min(60vh, 420px); overflow: auto; }
.optlist .opt {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: var(--radius-sm); border: 0; background: transparent;
  text-align: left; color: var(--text); font-size: 13px; cursor: pointer;
}
.optlist .opt:hover, .optlist .opt:focus-visible { background: var(--hover); }
.optlist .opt:focus-visible { outline-offset: -2px; }
.optlist .opt[aria-selected="true"] { background: var(--raised); }
.opt-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.opt-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; font-weight: 500; overflow-wrap: anywhere; }
.opt-sub { font-size: 12px; color: var(--faint); display: flex; gap: 8px; flex-wrap: wrap; }
.opt-check { color: var(--accent); visibility: hidden; }
.optlist .opt[aria-selected="true"] .opt-check { visibility: visible; }

/* warnings under the header */
.phead-warn {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius); font-size: 13px;
  border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); background: var(--warn-weak);
}
.phead-warn > .ico { color: var(--warn); margin-top: 2px; flex: none; }
.phead-warn-title { font-weight: 600; margin-bottom: 2px; }
.phead-warn ul { margin: 0; padding-left: 16px; color: var(--muted); display: flex; flex-direction: column; gap: 2px; }

/* ------------------------------------------------------------------------------------------ */
/* Scenario bar                                                                                 */

.scn { overflow: visible; }
.scn-modes { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.scn-modes .seg { flex: none; }
.seg > .mode-tab { gap: 8px; height: 30px; padding: 0 12px; }
.scn-panel { padding: 16px; display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: flex-end; }
.scn-panel > .field { flex: 0 1 auto; }
.scn-panel > .field--grow { flex: 1 1 260px; }
.floor-seg > label { min-width: 32px; padding: 0 8px; }
.target-select { min-width: 240px; max-width: 100%; }

.target-strip {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; padding: 12px 16px; border-top: 1px solid var(--border);
}
.target-id { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 0 1 auto; }
.target-ico { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--radius); background: var(--raised); border: 1px solid var(--border); }
.target-id-text { display: flex; flex-direction: column; min-width: 0; }
.target-name { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.target-name .variant { color: var(--muted); font-weight: 400; }
.target-kind { font-size: 12px; color: var(--muted); }
.target-facts { display: flex; flex-wrap: wrap; gap: 6px 24px; margin: 0; }
.target-fact { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.target-fact dt { font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); white-space: nowrap; }
.target-fact dd { margin: 0; font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.target-fact dd.is-bad { color: var(--loss); }
.target-notes { flex-basis: 100%; display: flex; flex-direction: column; gap: 4px; }
.target-note { display: flex; gap: 6px; align-items: flex-start; font-size: 12px; color: var(--muted); line-height: 1.45; }
.target-note .ico { margin-top: 1px; color: var(--faint); }
.target-note--warn, .target-note--warn .ico { color: var(--warn); }
.target-strip--empty { color: var(--muted); font-size: 13px; }

/* mob combobox */
.combo { position: relative; width: 100%; }
.combo-input-wrap { position: relative; display: flex; align-items: center; }
.combo-input-wrap > .ico { position: absolute; left: 10px; color: var(--faint); pointer-events: none; }
.combo-input { padding-left: 32px; padding-right: 34px; }
.combo-clear { position: absolute; right: 2px; }
.combo-list {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); max-height: min(420px, 60vh); overflow: auto; padding: 4px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop);
}
.combo-group-label {
  position: sticky; top: -4px; z-index: 1; padding: 8px 8px 4px; font-size: 11px; font-weight: 500; text-transform: uppercase;
  letter-spacing: .04em; color: var(--faint); background: var(--surface);
}
.combo-opt { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 4px 8px; border-radius: var(--radius-sm); cursor: pointer; min-width: 0; }
.combo-opt.is-active { background: var(--hover); }
.combo-opt[aria-selected="true"] { box-shadow: inset 2px 0 0 var(--accent); }
.combo-opt-ico { flex: none; display: grid; place-items: center; width: 24px; height: 24px; }
.combo-opt-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.combo-opt-name { font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
.combo-opt-name .variant { color: var(--muted); font-weight: 400; }
.combo-opt-meta { display: flex; flex-wrap: wrap; gap: 0 4px; align-items: center; font-size: 12px; color: var(--faint); }
.combo-opt-meta > span + span::before { content: '·'; margin-right: 4px; }
.combo-opt-meta .type-badge { color: var(--faint); }
.combo-opt-hp { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.combo-empty, .combo-more { padding: 10px 8px; font-size: 12px; color: var(--faint); }
.mob-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.mob-filters .select { width: auto; min-width: 150px; }

.types-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.type-check { position: relative; }
.type-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.type-check > span {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: var(--radius); border: 1px solid var(--border-strong);
  color: var(--muted); font-size: 13px; cursor: pointer; white-space: nowrap; transition: background .12s, color .12s, border-color .12s;
}
.type-check > span:hover { color: var(--text); background: var(--raised); }
.type-check input:checked + span { color: var(--text); background: var(--raised); border-color: var(--accent); }
.type-check input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.custom-grid { display: grid; gap: 16px; grid-template-columns: repeat(3, minmax(0, 200px)) auto; align-items: start; width: 100%; }
/* label row (18px) + gap (6px) above, so the checkbox lines up with the inputs; hints below do not shift it */
.custom-grid > .custom-boss { height: 32px; margin-top: 24px; }

/* sticky scenario summary (phones / tablets, shown once the scenario bar has scrolled away) */
.scn-sticky {
  position: fixed; z-index: 35; left: 0; right: 0; top: var(--sticky-top);
  background: var(--bg); border-bottom: 1px solid var(--border);
  transform: translateY(-110%); visibility: hidden; transition: transform .15s ease, visibility 0s linear .15s;
}
.scn-sticky.is-on { transform: none; visibility: visible; transition: transform .15s ease; }
.scn-sum { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 0; font-size: 13px; min-width: 0; }
.scn-sum-text { display: flex; flex-direction: column; min-width: 0; }
.scn-sum-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scn-sum-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 1025px) { .scn-sticky { display: none; } }

/* ------------------------------------------------------------------------------------------ */
/* Popover                                                                                      */

.pop {
  position: absolute; z-index: 60; max-width: calc(100vw - 16px); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); animation: pop-in .1s ease-out;
}
.pop:focus { outline: none; }
.pop-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 6px 6px 12px; border-bottom: 1px solid var(--border); }
.pop-title { font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 6px; min-width: 0; }
.pop-body { padding: 4px; max-height: min(70vh, 520px); overflow: auto; }
.pop--sheet {
  position: fixed; left: 0 !important; right: 0; bottom: 0; top: auto !important; max-width: none; border-radius: 12px 12px 0 0;
  border-bottom: 0; padding-bottom: env(safe-area-inset-bottom); animation: sheet-in .16s ease-out;
}
.pop--sheet .pop-body { max-height: 70vh; }
.pop--sheet .optlist { max-height: none; }
.pop-backdrop { position: fixed; inset: 0; z-index: 59; background: var(--backdrop); animation: fade-in .12s; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-2px); } to { opacity: 1; transform: none; } }
@keyframes sheet-in { from { transform: translateY(24px); opacity: .5; } to { transform: none; opacity: 1; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ------------------------------------------------------------------------------------------ */
/* States: skeleton, error, empty, toast                                                        */

.skel { display: inline-block; vertical-align: middle; background: var(--skel); animation: skel-pulse 1.4s ease-in-out infinite; }
.skel-stack { display: flex; flex-direction: column; gap: 8px; }
.skel-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
@keyframes skel-pulse { 0%, 100% { background: var(--skel); } 50% { background: var(--skel-hi); } }

.state { display: flex; gap: 14px; align-items: flex-start; padding: 24px; }
.state--compact { padding: 12px 0; gap: 10px; align-items: center; }
.state-ico {
  flex: none; width: 36px; height: 36px; border-radius: var(--radius); display: grid; place-items: center;
  border: 1px solid var(--border); background: var(--raised); color: var(--muted);
}
.state--compact .state-ico { width: 28px; height: 28px; }
.state--error .state-ico { color: var(--loss); }
.state--warn .state-ico { color: var(--warn); }
.state--good .state-ico { color: var(--gain); }
.state-title { font-size: 16px; font-weight: 600; }
.state--compact .state-title { font-size: 13px; font-weight: 500; }
.state-desc { margin-top: 4px; color: var(--muted); max-width: 62ch; }
.state--compact .state-desc { margin-top: 2px; font-size: 12px; }
.state-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.state-actions .btn:disabled { opacity: .6; }
.state-detail { margin-top: 8px; font-family: var(--font-mono); font-size: 12px; color: var(--faint); overflow-wrap: anywhere; }
.error-wrap { max-width: 640px; margin: 48px auto; }

.toast-host { position: fixed; z-index: 80; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--radius); font-size: 13px; font-weight: 500;
  background: var(--raised); color: var(--text); border: 1px solid var(--border-strong); box-shadow: var(--shadow-pop);
  animation: pop-in .12s ease-out; transition: opacity .2s, transform .2s;
}
.toast .ico { color: var(--gain); }
.toast.is-out { opacity: 0; transform: translateY(6px); }

/* ------------------------------------------------------------------------------------------ */
/* Footer                                                                                       */

.footer { border-top: 1px solid var(--border); padding: 20px 0 32px; color: var(--faint); font-size: 12px; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }

/* ------------------------------------------------------------------------------------------ */
/* Settings dialog                                                                              */

.modal {
  width: min(560px, calc(100vw - 24px)); max-height: min(88vh, 900px); padding: 0; border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg); background: var(--surface); color: var(--text); box-shadow: var(--shadow-pop); overflow: hidden;
}
.modal[open] { display: flex; flex-direction: column; animation: pop-in .12s ease-out; }
.modal::backdrop { background: var(--backdrop); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--border); }
.modal-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; }
.modal-title .ico { color: var(--faint); }
.modal-head .card-sub { margin-top: 2px; }
.modal-body { padding: 0 16px 8px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.set-section { padding: 16px 0; }
.set-section + .set-section { border-top: 1px solid var(--border); }
.set-section > .subhead { margin-bottom: 8px; }
.set-h { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.set-h .ico { color: var(--faint); }
.set-text { margin-top: 4px; font-size: 13px; color: var(--muted); }
.set-form { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.set-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.set-row > .input, .set-input-wrap { flex: 1 1 240px; min-width: 0; }
.set-row--between { justify-content: space-between; margin-top: 8px; }
.set-input-wrap { position: relative; display: flex; align-items: center; }
.set-input-wrap .input { padding-right: 36px; }
.set-eye { position: absolute; right: 2px; }
.set-secret.is-masked { -webkit-text-security: disc; }
.set-keystate { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.set-keystate .ico { color: var(--faint); }
.set-status {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-radius: var(--radius); font-size: 13px;
  border: 1px solid var(--border); background: var(--raised);
}
.set-status > span { flex: 1 1 260px; }
.set-status > .ico { flex: none; color: var(--muted); }
.set-status--good > .ico { color: var(--gain); }
.set-status--warn { border-color: color-mix(in srgb, var(--warn) 35%, transparent); background: var(--warn-weak); }
.set-status--warn > .ico { color: var(--warn); }
.set-status--bad { border-color: color-mix(in srgb, var(--loss) 35%, transparent); background: var(--loss-weak); }
.set-status--bad > .ico { color: var(--loss); }
.set-status--accent > .ico { color: var(--accent); }
.set-privacy {
  display: flex; gap: 10px; margin-top: 12px; padding: 12px; border-radius: var(--radius); border: 1px solid var(--border);
  font-size: 12px; color: var(--muted); line-height: 1.5;
}
.set-privacy > .ico { color: var(--faint); margin-top: 2px; flex: none; }
.set-privacy-title { font-weight: 600; color: var(--text); margin-bottom: 2px; }
.set-privacy a { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; font-weight: 500; }
.set-note { display: flex; gap: 6px; align-items: flex-start; margin-top: 4px; }
.set-note .ico { margin-top: 2px; flex: none; }

/* ------------------------------------------------------------------------------------------ */
/* Assumptions panel                                                                            */

.as-run { padding-bottom: 16px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.as-run-h { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.bl { display: flex; flex-direction: column; gap: 10px; }
.bl-head .subhead { margin: 0; }
.bl-grid { display: grid; gap: 4px; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.bl-cell {
  display: flex; flex-direction: column; gap: 4px; align-items: stretch; min-width: 0; padding: 6px 4px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--bg);
}
:root[data-theme="light"] .bl-cell { background: var(--raised); }
.bl-cell.is-on { border-color: var(--accent-line); }
.bl-name { font-size: 11px; font-weight: 500; text-align: center; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bl-cell.is-on .bl-name { color: var(--text); }
.bl-step { display: flex; align-items: center; justify-content: center; gap: 1px; }
.bl-btn { display: grid; place-items: center; width: 20px; height: 24px; flex: none; padding: 0; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--faint); }
.bl-btn:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.bl-btn:disabled { opacity: .35; cursor: default; }
.bl-input { width: 100%; min-width: 0; max-width: 34px; height: 24px; padding: 0 2px; text-align: center; font-size: 13px; border-radius: var(--radius-sm); }
.bl-presets { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bl-mult { display: flex; gap: 6px; align-items: flex-start; color: var(--muted) !important; }
.bl-mult .ico { color: var(--faint); margin-top: 2px; flex: none; }
.as-run-toggles { margin-top: 8px; display: flex; flex-direction: column; }
.as-help { font-size: 12px; color: var(--faint); line-height: 1.4; }
.as-groups { display: flex; flex-direction: column; }
.as-group { border-top: 1px solid var(--border); }
.as-run + .as-groups > .as-group:first-child { border-top: 0; }
.as-group > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 10px 0; font-size: 13px; font-weight: 500; border-radius: var(--radius-sm);
}
.as-group > summary::-webkit-details-marker { display: none; }
.as-group > summary .chev { color: var(--faint); transition: transform .12s; }
.as-group[open] > summary .chev { transform: rotate(90deg); }
.as-group-name { flex: 1; min-width: 0; }
.as-group-count { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.as-group-help { margin: -4px 0 6px 22px; }
.as-list { display: flex; flex-direction: column; padding: 0 0 8px; }
.as-row { position: relative; display: flex; align-items: center; gap: 8px; padding: 2px 0 2px 10px; border-radius: var(--radius-sm); }
.as-row::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px; border-radius: 1px; background: transparent; }
.as-row.is-changed::before { background: var(--accent); }
.as-row--bool > .switch-row { flex: 1; min-width: 0; }
.as-row--field { justify-content: space-between; padding-top: 6px; padding-bottom: 6px; flex-wrap: wrap; }
.as-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1 1 180px; }
.as-label { font-size: 13px; display: block; }
.as-label .approx, .as-label .as-dot { margin-left: 4px; vertical-align: middle; }
.as-default { font-size: 11px; font-variant-numeric: tabular-nums; }
.as-control { display: flex; align-items: center; gap: 6px; flex: 0 1 auto; max-width: 100%; }
.as-num { width: 88px; height: 30px; }
.as-select { height: 30px; width: auto; max-width: 230px; font-size: 12px; }
.as-unit { font-size: 12px; color: var(--faint); }
.as-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); display: inline-block; }
.as-reset { color: var(--faint); }
.as-foot { display: flex; gap: 6px; align-items: center; margin-top: 8px; font-size: 12px; color: var(--faint); }

/* ------------------------------------------------------------------------------------------ */
/* Responsive                                                                                   */

@media (max-width: 1024px) {
  .grid-main { grid-template-columns: minmax(0, 1fr); }
  .grid-main > #results-panel { order: -1; }
  .landing-grid { grid-template-columns: minmax(0, 1fr); gap: 32px; }
}
@media (max-width: 860px) {
  .custom-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .custom-grid > .check { grid-column: span 2; }
  .custom-grid > .custom-boss { height: auto; margin-top: 0; }
  /* two rows: Catacombs · skill average · MP, then class levels | slayer levels */
  .pstat { flex: 1 1 auto; }
  .pstat--classes, .pstat--slayers { order: 1; flex: 1 1 50%; border-top: 1px solid var(--border); }
  .pstat--classes { border-left: 0; }
}
@media (max-width: 760px) {
  /* Phones: the top bar scrolls away; the scenario summary takes the sticky slot. */
  .topbar { position: static; }
  :root { --sticky-top: 0px; }
  .topbar-inner { gap: 8px; }
  .top-search { flex: 1 1 auto; }
  .search-mini kbd { display: none; }
  .search-mini input { padding-right: 8px; } /* no shortcut hint on phones: give the placeholder the room */
  .landing { padding-top: 32px; padding-bottom: 40px; }
  .landing-title { font-size: 24px; }
  .landing-sub { font-size: 14px; }
  .scn-panel { gap: 16px; }
  .scn-panel > .field, .scn-panel > .field--grow { flex: 1 1 100%; }
  .target-select { min-width: 0; }
  .mob-filters .select { flex: 1 1 140px; }
  .pstat { padding: 10px 12px; }
}
@media (max-width: 560px) {
  .brand-name .lab { display: none; }
  .top-search { flex-basis: 0; }
  .phead-top { gap: 12px; align-items: flex-start; }
  .avatar { width: 40px; height: 40px; }
  .phead-name h1 { font-size: 18px; }
  .phead-actions .icon-btn { width: 30px; height: 30px; }
  .pstat { flex: 1 1 40%; border-left: 0; border-top: 1px solid var(--border); }
  .pstat:nth-child(-n+2) { border-top: 0; }
  .pstat:nth-child(2) { border-left: 1px solid var(--border); }
  .pstat--classes, .pstat--slayers, .pstat--mp { flex-basis: 100%; }
  .pstat-lv { gap: 4px; font-size: 13px; }
  .pstat dd { gap: 4px 10px; }
  .search-big { flex-direction: column; }
  .search-big .btn { width: 100%; }
  .cover-row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .custom-grid { grid-template-columns: minmax(0, 1fr); }
  .custom-grid > .check { grid-column: auto; }
  .state { padding: 20px 4px; flex-direction: column; }
  .card-head { padding: 10px 12px; }
  .card-body { padding: 12px; }
  /* Scenario controls: equal-width grids instead of wrapping pill rows. */
  .scn-modes { padding: 8px; }
  .scn-modes .seg { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); width: 100%; }
  .seg > .mode-tab { flex-direction: column; gap: 2px; height: auto; min-height: 44px; padding: 4px 2px; font-size: 12px; min-width: 0; }
  .scn-panel { padding: 12px; }
  .seg--grid { display: grid; grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr)); width: 100%; }
  .seg--grid > label { flex-direction: column; gap: 2px; height: auto; min-height: 44px; padding: 4px 2px; font-size: 12px; min-width: 0; }
  .seg--grid > label > span { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .floor-seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); width: 100%; }
  .floor-seg > label { flex-direction: column; gap: 2px; height: auto; min-height: 44px; min-width: 0; padding: 4px 2px; }
  .target-strip { padding: 12px; gap: 12px 16px; }
  .target-facts { gap: 6px 16px; }
  .modal { width: 100vw; max-width: 100vw; max-height: 92vh; margin: auto 0 0; border-radius: 12px 12px 0 0; border-bottom: 0; }
  .modal-head, .modal-body, .modal-foot { padding-left: 12px; padding-right: 12px; }
  .set-row > .btn { flex: 1 1 auto; }
  .bl-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 440px) {
  /* class / slayer levels are in the header strip right above; the names need the room */
  .seg--grid .lvl { display: none; }
}
@media (max-width: 400px) {
  .seg > .mode-tab { font-size: 11px; }
  .seg--grid > label { font-size: 11px; }
}

/* ========================================================================================== */
/* Style picker (design presets, js/ui/presets.js): top-bar popover + "Style" in Settings.       */
/* Cards use the active preset's tokens; only the thumbnails (.sty-pv) draw in their own preset's */
/* colours, from inline --pv-* variables. Mechanism: index.html bootstrap + css/themes/<id>.css.  */

::view-transition-old(root), ::view-transition-new(root) { animation-duration: .22s; animation-timing-function: ease; }

.pop--style { width: min(1120px, calc(100vw - 16px)); }
.pop--style.pop--sheet { width: auto; }
.pop--style .pop-body { padding: 0; max-height: min(calc(100vh - 120px), 760px); overscroll-behavior: contain; }
.sty-pop { display: flex; flex-direction: column; gap: 10px; padding: 12px; }
.sty-hint { padding: 0 2px; font-size: 12px; line-height: 1.45; color: var(--muted); }

/* Sections (Minimal / Minecraft / Retro & Tech): a small caps heading, its count and a hairline, then the cards. */
.sty-grid { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.sty-group { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.sty-gh {
  display: flex; align-items: center; gap: 8px; padding: 0 2px; font-size: 11px; font-weight: 600; line-height: 1.2;
  letter-spacing: .09em; text-transform: uppercase; color: var(--muted);
}
.sty-gh::after { content: ''; flex: 1 1 auto; min-width: 12px; height: 1px; background: var(--border); }
.sty-gh-n { font-weight: 500; letter-spacing: 0; color: var(--faint); font-variant-numeric: tabular-nums; }
.sty-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 8px; }
.sty-grid--settings { margin-top: 12px; }

.sty-card {
  position: relative; display: flex; align-items: stretch; gap: 12px; min-width: 0; padding: 8px 10px 8px 8px;
  border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); color: var(--text);
  cursor: pointer; transition: border-color .12s, background-color .12s, box-shadow .12s;
}
.sty-card:hover { border-color: var(--border-strong); background: var(--raised); }
.sty-card.is-on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.sty-card:has(.sty-radio:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.sty-radio { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.sty-meta { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; padding-top: 1px; }
.sty-name { font-size: 13px; font-weight: 600; line-height: 1.35; color: var(--text); }
.sty-desc { margin-top: 1px; font-size: 12px; line-height: 1.4; color: var(--muted); }
.sty-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: auto; padding-top: 6px; }
.sty-sw { display: inline-flex; gap: 3px; }
.sty-sw i { width: 12px; height: 12px; border-radius: 3px; background: var(--sw); box-shadow: inset 0 0 0 1px rgba(128, 128, 128, 0.4); }
.sty-mode { font-size: 11px; color: var(--muted); white-space: nowrap; }
/* selected badge, on the thumbnail's top-right corner (ringed in the thumbnail's own background) */
.sty-check {
  position: absolute; z-index: 2; top: 4px; right: 4px; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); color: var(--on-accent); box-shadow: 0 0 0 2px var(--pv-bg);
  opacity: 0; transform: scale(.6); transition: opacity .12s, transform .12s;
}
.sty-check .ico { stroke-width: 3; }
.sty-card.is-on .sty-check { opacity: 1; transform: none; }
.sty-grid[aria-busy="true"] .sty-card.is-on .sty-check { opacity: .5; }

/* Thumbnail: a tiny "damage" panel (label, number, three bars) in the preset's colours and font. */
/* Clean follows the light/dark toggle: while it is active in light mode, its thumbnails show the light palette. */
:root[data-preset="clean"][data-theme="light"] :is(.sty-pv, .sty-mini)[data-pv="clean"] {
  --pv-bg: #f6f7f9; --pv-surface: #ffffff; --pv-line: #e3e5e9; --pv-text: #16181d; --pv-muted: #5b616b; --pv-accent: #2f6fe4; --pv-alt: #1a7f37;
}
.sty-pv {
  position: relative; flex: none; width: 104px; height: 68px; padding: 7px; overflow: hidden; isolation: isolate;
  border-radius: var(--radius); background: var(--pv-bg); color: var(--pv-text); font-family: var(--pv-font);
  box-shadow: inset 0 0 0 1px rgba(128, 128, 128, 0.28);
}
.sty-pv-panel {
  position: relative; display: flex; flex-direction: column; height: 100%; padding: 5px 7px 6px;
  border: 1px solid var(--pv-line); border-radius: 4px; background: var(--pv-surface);
}
.sty-pv-label { font-size: 7px; font-weight: 600; line-height: 1; letter-spacing: .1em; text-transform: uppercase; color: var(--pv-muted); }
.sty-pv-num { margin-top: 3px; font-size: 16px; font-weight: 700; line-height: 1; letter-spacing: -.01em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sty-pv-bars { display: flex; flex-direction: column; gap: 2px; margin-top: auto; }
.sty-pv-bars i { display: block; width: 86%; height: 3px; border-radius: 1px; background: var(--pv-accent); }
.sty-pv-bars i:nth-child(2) { width: 58%; background: var(--pv-alt); }
.sty-pv-bars i:nth-child(3) { width: 34%; background: var(--pv-muted); opacity: .5; }

/* SkyBlock Classic: dark inventory window (black outline, 2px bevel), pixel font with the in-game drop shadow. */
.sty-pv[data-pv="classic"] { border-radius: 0; }
.sty-pv[data-pv="classic"] .sty-pv-panel { border: 2px solid #000; border-radius: 0; box-shadow: inset 2px 2px 0 #4d4d4d, inset -2px -2px 0 #0a0a0a; padding: 5px 7px; }
.sty-pv[data-pv="classic"] .sty-pv-label { font-size: 8px; font-weight: 400; letter-spacing: 0; text-transform: none; text-shadow: 1px 1px 0 #2a2a2a; }
.sty-pv[data-pv="classic"] .sty-pv-num { margin-top: 2px; font-size: 13px; font-weight: 400; letter-spacing: 0; text-shadow: 1.5px 1.5px 0 #3f2a00; }
.sty-pv[data-pv="classic"] .sty-pv-bars i { height: 4px; border-radius: 0; box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.45); }
.sty-pv[data-pv="classic"] .sty-pv-bars i:nth-child(3) { background: #131313; opacity: 1; box-shadow: inset 1px 1px 0 #050505, inset -1px -1px 0 #3b3b3b; }

/* Catacombs: blood-red top rule, condensed caps, square edges. */
.sty-pv[data-pv="catacombs"] { border-radius: 2px; }
.sty-pv[data-pv="catacombs"] .sty-pv-panel { border-radius: 0; border-top: 2px solid var(--pv-accent); }
.sty-pv[data-pv="catacombs"] .sty-pv-label { font-weight: 700; letter-spacing: .18em; }
.sty-pv[data-pv="catacombs"] .sty-pv-num { font-size: 19px; letter-spacing: .01em; text-transform: uppercase; }
.sty-pv[data-pv="catacombs"] .sty-pv-bars i { border-radius: 0; }

/* Neon HUD: cut corners with a 1px cyan rim, glowing numbers and bars. */
.sty-pv[data-pv="neon"] { border-radius: 0; }
.sty-pv[data-pv="neon"] .sty-pv-panel {
  z-index: 0; border: 0; border-radius: 0; background: var(--pv-line);
  clip-path: polygon(9px 0, 100% 0, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%, 0 9px);
}
.sty-pv[data-pv="neon"] .sty-pv-panel::before {
  content: ''; position: absolute; inset: 1px; z-index: -1; background: var(--pv-surface);
  clip-path: polygon(8.6px 0, 100% 0, 100% calc(100% - 8.6px), calc(100% - 8.6px) 100%, 0 100%, 0 8.6px);
}
.sty-pv[data-pv="neon"] .sty-pv-label { color: var(--pv-alt); letter-spacing: .2em; }
.sty-pv[data-pv="neon"] .sty-pv-num { font-size: 15px; color: var(--pv-text); text-shadow: 0 0 6px rgba(0, 229, 255, 0.85); letter-spacing: .03em; }
.sty-pv[data-pv="neon"] .sty-pv-bars i { border-radius: 0; box-shadow: 0 0 5px var(--pv-accent); }
.sty-pv[data-pv="neon"] .sty-pv-bars i:nth-child(2) { box-shadow: 0 0 5px var(--pv-alt); }
.sty-pv[data-pv="neon"] .sty-pv-bars i:nth-child(3) { box-shadow: none; background: var(--pv-text); opacity: .35; }

/* The End: starfield behind a glass panel, purple haze from below. */
.sty-pv[data-pv="void"] { box-shadow: inset 0 -16px 22px -12px rgba(155, 92, 255, 0.75), inset 0 0 0 1px rgba(155, 92, 255, 0.35); }
.sty-pv[data-pv="void"]::before {
  content: ''; position: absolute; top: 0; left: 0; z-index: -1; width: 1px; height: 1px; border-radius: 50%;
  box-shadow: 5px 4px #fff, 22px 2px rgba(255, 255, 255, 0.55), 47px 5px rgba(255, 255, 255, 0.8), 71px 3px #fff, 93px 7px rgba(255, 255, 255, 0.6),
    99px 30px rgba(46, 230, 214, 0.9), 3px 33px rgba(255, 255, 255, 0.7), 2px 60px rgba(255, 255, 255, 0.5), 28px 64px #fff,
    58px 63px rgba(255, 255, 255, 0.6), 84px 65px rgba(155, 92, 255, 1), 101px 52px rgba(255, 255, 255, 0.8),
    40px 24px rgba(255, 255, 255, 0.5), 76px 38px rgba(255, 255, 255, 0.45), 18px 46px rgba(255, 255, 255, 0.4);
}
.sty-pv[data-pv="void"] .sty-pv-panel { border-radius: 8px; backdrop-filter: blur(0.6px); }
.sty-pv[data-pv="void"] .sty-pv-label { color: var(--pv-accent); }
.sty-pv[data-pv="void"] .sty-pv-num { font-weight: 600; letter-spacing: -.02em; }
.sty-pv[data-pv="void"] .sty-pv-bars i { border-radius: 2px; }

/* Terminal: prompt, phosphor glow, block cursor (blinks only on the hovered / selected card). */
.sty-pv[data-pv="terminal"] { border-radius: 0; }
.sty-pv[data-pv="terminal"] .sty-pv-panel { border-radius: 0; padding: 5px 6px 6px; }
.sty-pv[data-pv="terminal"] .sty-pv-label { font-weight: 400; letter-spacing: 0; text-transform: lowercase; }
.sty-pv[data-pv="terminal"] .sty-pv-label::after { content: ':'; }
.sty-pv[data-pv="terminal"] .sty-pv-num { font-size: 13px; font-weight: 500; letter-spacing: 0; text-shadow: 0 0 6px rgba(51, 255, 102, 0.5); }
.sty-pv[data-pv="terminal"] .sty-pv-num::before { content: '>'; margin-right: 4px; color: var(--pv-alt); text-shadow: none; }
.sty-pv[data-pv="terminal"] .sty-pv-num::after {
  content: ''; display: inline-block; width: 6px; height: 11px; margin-left: 2px; vertical-align: -1px; background: var(--pv-text);
}
.sty-card:is(:hover, .is-on) .sty-pv[data-pv="terminal"] .sty-pv-num::after { animation: sty-blink 1.06s steps(1) infinite; }
.sty-pv[data-pv="terminal"] .sty-pv-bars i { border-radius: 0; }
@keyframes sty-blink { 50% { opacity: 0; } }

/* Paper: printed card on cream stock, ink rule on top, serif figures. */
.sty-pv[data-pv="paper"] { border-radius: 2px; }
.sty-pv[data-pv="paper"] .sty-pv-panel { border: 0; border-top: 2px solid var(--pv-text); border-radius: 0; box-shadow: 0 1px 2px rgba(60, 40, 10, 0.16); }
.sty-pv[data-pv="paper"] .sty-pv-label { font-family: var(--font-ui); letter-spacing: .16em; }
.sty-pv[data-pv="paper"] .sty-pv-num { font-size: 18px; font-weight: 600; letter-spacing: -.02em; }
.sty-pv[data-pv="paper"] .sty-pv-bars i { height: 2px; border-radius: 0; }
.sty-pv[data-pv="paper"] .sty-pv-bars i:nth-child(3) { background: var(--pv-text); opacity: .3; }

/* Second set (shown once their stylesheets exist): each thumbnail draws its style's signature in miniature        */
/* (block textures from img/mc, pixelated; texture walls are dimmed by a ::before shade above them).              */
.sty-pv:is([data-pv="titlescreen"], [data-pv="enchanting"], [data-pv="redstone"], [data-pv="nether"]) {
  border-radius: 0; image-rendering: pixelated; background: var(--pv-tex) 0 0 / 24px 24px, var(--pv-bg);
}
.sty-pv:is([data-pv="titlescreen"], [data-pv="enchanting"], [data-pv="redstone"], [data-pv="nether"])::before {
  content: ''; position: absolute; inset: 0; z-index: -1; background: var(--pv-shade);
}

/* Title Screen: options-screen dirt, a black menu list, the yellow splash tilted over it, stone-button bars. */
.sty-pv[data-pv="titlescreen"] { --pv-tex: url("../img/mc/block/dirt.png"); --pv-shade: rgba(0, 0, 0, 0.72); }
.sty-pv[data-pv="titlescreen"] .sty-pv-panel { border: 1px solid #000; border-radius: 0; background: var(--pv-surface); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08); }
.sty-pv[data-pv="titlescreen"] .sty-pv-label {
  position: absolute; top: 4px; right: 3px; font-size: 8px; font-weight: 400; letter-spacing: 0; text-transform: none;
  color: var(--pv-accent); text-shadow: 1px 1px 0 #3f3f15; transform: rotate(-14deg); transform-origin: right center;
}
.sty-pv[data-pv="titlescreen"] .sty-pv-num { margin-top: 10px; font-size: 13px; font-weight: 400; letter-spacing: 0; text-shadow: 1.5px 1.5px 0 #3f3f3f; }
.sty-pv[data-pv="titlescreen"] .sty-pv-bars { gap: 3px; }
.sty-pv[data-pv="titlescreen"] .sty-pv-bars i { height: 4px; border-radius: 0; background: var(--pv-alt); opacity: 1; box-shadow: inset 0 1px 0 #a8a8a8, inset 0 -1px 0 #3b3b3b, 0 0 0 1px #000; }
.sty-pv[data-pv="titlescreen"] .sty-pv-bars i:first-child { background: #8b8b8b; box-shadow: inset 0 0 0 1px #fff, 0 0 0 1px #000; }
.sty-pv[data-pv="titlescreen"] .sty-pv-bars i:nth-child(3) { display: none; }

/* Enchanting Table: a parchment page on the dark bookshelf wall; vermilion rubric, ultramarine figures. */
.sty-pv[data-pv="enchanting"] { --pv-tex: url("../img/mc/block/bookshelf.png"); --pv-shade: rgba(11, 11, 26, 0.82); }
.sty-pv[data-pv="enchanting"] .sty-pv-panel {
  border: 1px solid var(--pv-line); border-radius: 1px; background: var(--pv-surface); color: #2b1e12;
  box-shadow: inset 0 0 0 2px var(--pv-surface), inset 0 0 0 3px rgba(156, 130, 83, 0.45), 0 2px 6px rgba(0, 0, 0, 0.6);
}
.sty-pv[data-pv="enchanting"] .sty-pv-label { color: var(--pv-muted); font-weight: 700; letter-spacing: .14em; }
.sty-pv[data-pv="enchanting"] .sty-pv-num { color: #1e3a9e; font-size: 17px; font-weight: 700; letter-spacing: 0; }
.sty-pv[data-pv="enchanting"] .sty-pv-bars i { height: 3px; border-radius: 0; background: var(--pv-accent); }
.sty-pv[data-pv="enchanting"] .sty-pv-bars i:nth-child(2) { background: #b8902f; }
.sty-pv[data-pv="enchanting"] .sty-pv-bars i:nth-child(3) { background: #2b1e12; opacity: .3; }

/* Redstone: deepslate, a block with a dust-red seam, comparator-amber pixel digits, a powered dust ramp. */
.sty-pv[data-pv="redstone"] { --pv-tex: url("../img/mc/block/deepslate.png"); --pv-shade: rgba(14, 14, 15, 0.78); }
.sty-pv[data-pv="redstone"] .sty-pv-panel { border: 1px solid #000; border-radius: 0; box-shadow: inset 0 2px 0 #3a3a3b, inset 0 -2px 0 #b80000; }
.sty-pv[data-pv="redstone"] .sty-pv-label { font-family: 'Monocraft SkyBlock', ui-monospace, monospace; font-weight: 400; letter-spacing: .12em; color: var(--pv-muted); }
.sty-pv[data-pv="redstone"] .sty-pv-num { font-size: 15px; font-weight: 400; letter-spacing: .02em; color: var(--pv-alt); text-shadow: 0 0 5px rgba(255, 166, 56, 0.45); }
.sty-pv[data-pv="redstone"] .sty-pv-bars i { height: 3px; border-radius: 0; background: var(--pv-accent); }
.sty-pv[data-pv="redstone"] .sty-pv-bars i:nth-child(2) { background: #b80000; }
.sty-pv[data-pv="redstone"] .sty-pv-bars i:nth-child(3) { background: #4d0000; opacity: 1; }

/* Crimson Isle: netherrack lit by lava from below, a blackstone panel with a lava seam on top, molten figures, lava bars. */
.sty-pv[data-pv="nether"] { --pv-tex: url("../img/mc/block/netherrack.png"); --pv-shade: rgba(13, 6, 5, 0.8); }
.sty-pv[data-pv="nether"]::before { box-shadow: inset 0 -18px 20px -12px rgba(255, 106, 0, 0.7); }
.sty-pv[data-pv="nether"] .sty-pv-panel { border: 1px solid var(--pv-line); border-top: 2px solid var(--pv-accent); border-radius: 0; box-shadow: 0 0 0 1px rgba(255, 122, 26, 0.18); }
.sty-pv[data-pv="nether"] .sty-pv-label { color: var(--pv-muted); font-family: system-ui, sans-serif; font-weight: 800; letter-spacing: .16em; }
.sty-pv[data-pv="nether"] .sty-pv-num { font-size: 19px; font-weight: 700; letter-spacing: 0; color: #ffb046; text-shadow: 0 1px 0 #7a1d05; }
.sty-pv[data-pv="nether"] .sty-pv-bars i { height: 3px; border-radius: 0; background: url("../img/mc/block/lava_still.png") 0 -4px / 16px 320px repeat-x, var(--pv-accent); }
.sty-pv[data-pv="nether"] .sty-pv-bars i:nth-child(3) { background: #3a1a14; opacity: 1; }

/* Blueprint: cyanotype with a millimetre grid, a white object-line frame, hatched + dashed construction bars. */
.sty-pv[data-pv="blueprint"] { border-radius: 0; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Cpath d='M0 .5H8M.5 0V8' stroke='%2396cdff' stroke-opacity='.2'/%3E%3C/svg%3E") 0 0 / 8px 8px, var(--pv-bg); }
.sty-pv[data-pv="blueprint"] .sty-pv-panel { border: 1px solid var(--pv-line); border-radius: 0; background: rgba(14, 58, 102, 0.6); }
.sty-pv[data-pv="blueprint"] .sty-pv-label { color: var(--pv-muted); font-family: 'Barlow Condensed', 'Arial Narrow', sans-serif; letter-spacing: .18em; }
.sty-pv[data-pv="blueprint"] .sty-pv-num { font-size: 14px; font-weight: 600; letter-spacing: -.01em; }
.sty-pv[data-pv="blueprint"] .sty-pv-bars i { height: 4px; border-radius: 0; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='3' height='3'%3E%3Cpath d='M-1 4 4-1M-1 1 1-1M2 4 4 2' stroke='%23fff' stroke-width='.9'/%3E%3C/svg%3E") 0 0 / 3px 3px; box-shadow: inset 0 0 0 1px #fff; opacity: 1; }
.sty-pv[data-pv="blueprint"] .sty-pv-bars i:nth-child(2) { height: 0; background: none; box-shadow: none; border-top: 1px dashed var(--pv-muted); }
.sty-pv[data-pv="blueprint"] .sty-pv-bars i:nth-child(3) { width: 22%; height: 3px; background: var(--pv-alt); box-shadow: none; }

/* Retro 98: teal desktop, a silver window with the navy title bar and caption buttons, a segmented progress bar. */
.sty-pv[data-pv="retro98"] { border-radius: 0; }
.sty-pv[data-pv="retro98"] .sty-pv-panel {
  border: 0; border-radius: 0; padding: 12px 6px 5px;
  box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #dfdfdf, inset -2px -2px #808080, inset 2px 2px #fff;
}
.sty-pv[data-pv="retro98"] .sty-pv-panel::before { content: ''; position: absolute; left: 3px; right: 3px; top: 3px; height: 7px; background: var(--pv-accent); }
.sty-pv[data-pv="retro98"] .sty-pv-panel::after {
  content: ''; position: absolute; right: 4px; top: 4px; width: 5px; height: 5px; background: #c0c0c0;
  box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #fff, -6px 0 0 #c0c0c0;
}
.sty-pv[data-pv="retro98"] .sty-pv-label { font-weight: 400; letter-spacing: 0; text-transform: none; font-size: 8px; color: var(--pv-muted); }
.sty-pv[data-pv="retro98"] .sty-pv-num { margin-top: 1px; font-size: 13px; font-weight: 700; letter-spacing: 0; }
.sty-pv[data-pv="retro98"] .sty-pv-bars i { height: 6px; border-radius: 0; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='5' height='5'%3E%3Crect width='4' height='5' fill='%23000080'/%3E%3C/svg%3E") 1px 1px / 5px 4px repeat-x; box-shadow: inset 1px 1px #808080, inset -1px -1px #fff; opacity: 1; }
.sty-pv[data-pv="retro98"] .sty-pv-bars i:nth-child(n+2) { display: none; }

/* Brutalist: paper grid, a white slab with a 2px black border and a hard shadow, poster figures, flat bars. */
.sty-pv[data-pv="brutalist"] { border-radius: 0; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10'%3E%3Cpath d='M0 .5H10M.5 0V10' stroke='%23000' stroke-opacity='.08'/%3E%3C/svg%3E") 0 0 / 10px 10px, var(--pv-bg); }
.sty-pv[data-pv="brutalist"] .sty-pv-panel { border: 2px solid #000; border-radius: 0; box-shadow: 3px 3px 0 #000; padding: 4px 6px 5px; }
.sty-pv[data-pv="brutalist"] .sty-pv-label {
  width: fit-content; padding: 2px 3px 1px; background: #000; color: #fff; font-family: ui-monospace, Consolas, monospace; font-weight: 700; letter-spacing: .06em;
}
.sty-pv[data-pv="brutalist"] .sty-pv-num { font-size: 18px; font-weight: 900; letter-spacing: -.05em; }
.sty-pv[data-pv="brutalist"] .sty-pv-bars i { height: 4px; border-radius: 0; background: #000; opacity: 1; }
.sty-pv[data-pv="brutalist"] .sty-pv-bars i:first-child { height: 5px; background: var(--pv-accent); box-shadow: inset 0 0 0 1px #000; }
.sty-pv[data-pv="brutalist"] .sty-pv-bars i:nth-child(3) { background: var(--pv-alt); }

/* Dragon's Hoard: crimson velvet in a gilded double frame over a gold glow, gold figures, a gold and a crimson bar. */
.sty-pv[data-pv="dragon"] { border-radius: 2px; box-shadow: inset 0 -16px 22px -12px rgba(226, 160, 60, 0.55), inset 0 0 0 1px rgba(226, 176, 74, 0.25); }
.sty-pv[data-pv="dragon"] .sty-pv-panel {
  border: 1px solid var(--pv-line); border-radius: 1px; background: var(--pv-surface);
  box-shadow: inset 0 0 0 2px var(--pv-surface), inset 0 0 0 3px rgba(226, 176, 74, 0.28);
}
.sty-pv[data-pv="dragon"] .sty-pv-label { color: var(--pv-muted); font-weight: 600; letter-spacing: .2em; }
.sty-pv[data-pv="dragon"] .sty-pv-num { font-size: 16px; font-weight: 700; letter-spacing: .01em; color: #f0c25a; text-shadow: 0 1px 0 #6e4510; }
.sty-pv[data-pv="dragon"] .sty-pv-bars i { height: 3px; border-radius: 0; background: var(--pv-accent); box-shadow: inset 0 1px 0 #ffe39a, inset 0 -1px 0 #9a6a1c; }
.sty-pv[data-pv="dragon"] .sty-pv-bars i:nth-child(2) { background: var(--pv-alt); box-shadow: none; }
.sty-pv[data-pv="dragon"] .sty-pv-bars i:nth-child(3) { background: var(--pv-muted); opacity: .35; box-shadow: none; }

/* Compact cards (settings dialog): mini tile with "Aa" in the style's font, name, swatches, mode; description in title. */
.sty-grid--compact { gap: 12px; }
.sty-grid--compact .sty-group { gap: 6px; }
.sty-grid--compact .sty-cards { grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 6px; }
.sty-card--compact { align-items: center; gap: 10px; padding: 6px 8px 6px 6px; }
.sty-card--compact .sty-name { font-size: 12px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.sty-card--compact .sty-foot { margin-top: 3px; padding-top: 0; gap: 6px; }
.sty-card--compact .sty-sw { gap: 2px; }
.sty-card--compact .sty-sw i { width: 8px; height: 8px; border-radius: 2px; }
.sty-mode--ico { display: inline-flex; align-items: center; gap: 2px; }
.sty-mini {
  position: relative; flex: none; display: flex; flex-direction: column; justify-content: center; gap: 3px; width: 40px; height: 40px;
  padding: 0 6px; overflow: hidden; border-radius: var(--radius-sm); background: var(--pv-bg); color: var(--pv-text); font-family: var(--pv-font);
  box-shadow: inset 0 0 0 1px rgba(128, 128, 128, 0.3);
}
.sty-mini-aa { font-size: 15px; font-weight: 700; line-height: 1; letter-spacing: -.01em; }
.sty-mini-bars { display: flex; flex-direction: column; gap: 2px; }
.sty-mini-bars i { display: block; height: 2px; width: 100%; background: var(--pv-accent); }
.sty-mini-bars i + i { width: 62%; background: var(--pv-alt); }
.sty-mini[data-pv="classic"] .sty-mini-aa { font-weight: 400; font-size: 13px; text-shadow: 1px 1px 0 #3f2a00; }
.sty-mini[data-pv="classic"], .sty-mini[data-pv="terminal"], .sty-mini[data-pv="neon"], .sty-mini[data-pv="brutalist"] { border-radius: 0; }
.sty-mini[data-pv="catacombs"] .sty-mini-aa { text-transform: uppercase; font-size: 16px; }
.sty-mini[data-pv="neon"] .sty-mini-aa { text-shadow: 0 0 5px rgba(0, 229, 255, 0.8); }
.sty-mini[data-pv="terminal"] .sty-mini-aa { font-weight: 500; font-size: 13px; }
.sty-mini[data-pv="paper"] .sty-mini-aa { font-weight: 600; font-size: 17px; }
.sty-mini[data-pv="void"] { box-shadow: inset 0 -10px 14px -8px rgba(155, 92, 255, 0.8), inset 0 0 0 1px rgba(155, 92, 255, 0.35); }
.sty-mini:is([data-pv="titlescreen"], [data-pv="enchanting"], [data-pv="redstone"], [data-pv="nether"], [data-pv="blueprint"], [data-pv="retro98"]) { border-radius: 0; }
.sty-mini[data-pv="titlescreen"] .sty-mini-aa { font-weight: 400; font-size: 13px; color: var(--pv-accent); text-shadow: 1px 1px 0 #3f3f15; }
.sty-mini[data-pv="titlescreen"] .sty-mini-bars i { background: #8b8b8b; }
.sty-mini[data-pv="titlescreen"] .sty-mini-bars i + i { background: var(--pv-alt); }
.sty-mini[data-pv="enchanting"] { background: var(--pv-surface); box-shadow: inset 0 0 0 1px var(--pv-line); }
.sty-mini[data-pv="enchanting"] .sty-mini-aa { color: #1e3a9e; font-size: 16px; }
.sty-mini[data-pv="enchanting"] .sty-mini-bars i + i { background: var(--pv-muted); }
.sty-mini[data-pv="redstone"] .sty-mini-aa { font-weight: 400; font-size: 13px; color: var(--pv-alt); }
.sty-mini[data-pv="redstone"] .sty-mini-bars i + i { background: #b80000; }
.sty-mini[data-pv="nether"] { box-shadow: inset 0 -12px 14px -8px rgba(255, 106, 0, 0.75), inset 0 0 0 1px rgba(255, 122, 26, 0.3); }
.sty-mini[data-pv="nether"] .sty-mini-aa { font-size: 17px; color: #ffb046; }
.sty-mini[data-pv="blueprint"] { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Cpath d='M0 .5H8M.5 0V8' stroke='%2396cdff' stroke-opacity='.2'/%3E%3C/svg%3E") 0 0 / 6px 6px, var(--pv-bg); }
.sty-mini[data-pv="blueprint"] .sty-mini-aa { font-weight: 600; font-size: 14px; }
.sty-mini[data-pv="blueprint"] .sty-mini-bars i { background: var(--pv-muted); }
.sty-mini[data-pv="retro98"] { background: var(--pv-surface); box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #fff, inset -2px -2px #808080, inset 2px 2px #dfdfdf; }
.sty-mini[data-pv="retro98"] .sty-mini-aa { font-size: 14px; }
.sty-mini[data-pv="brutalist"] { background: #fff; box-shadow: inset 0 0 0 2px #000; }
.sty-mini[data-pv="brutalist"] .sty-mini-aa { font-weight: 900; font-size: 17px; letter-spacing: -.05em; }
.sty-mini[data-pv="brutalist"] .sty-mini-bars i { height: 3px; }
.sty-mini[data-pv="dragon"] { box-shadow: inset 0 -10px 14px -8px rgba(226, 160, 60, 0.6), inset 0 0 0 1px rgba(226, 176, 74, 0.5); }
.sty-mini[data-pv="dragon"] .sty-mini-aa { color: #f0c25a; text-shadow: 0 1px 0 #6e4510; }
.sty-card--compact.is-on .sty-mini { box-shadow: inset 0 0 0 1px rgba(128, 128, 128, 0.3), 0 0 0 2px var(--surface), 0 0 0 3px var(--accent); }

/* Settings dialog: style section */
.set-mode { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 16px; }
.set-mode > .field-hint { flex-basis: 100%; }
.set-mode .seg > button .ico { color: inherit; }

@media (max-width: 560px) {
  .sty-pop { padding: 12px 12px 16px; }
  .sty-cards { grid-template-columns: minmax(0, 1fr); }
  .sty-grid--compact .sty-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sty-pv { width: 92px; height: 64px; }
}
/* ========================================================================================== */
/* End of style picker block                                                                  */

/* --- Target debuff switches (Max Last Breath / Max Lethality) ------------------------------------------------------ */
.target-debuffs { display: flex; flex-wrap: wrap; gap: var(--sp-2, 8px); width: 100%; margin-top: var(--sp-2, 8px); }
.debuff-btn { display: inline-flex; align-items: center; gap: 6px; }
.debuff-btn .debuff-dot { width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--muted, #9096a0); background: transparent; }
.debuff-btn.is-on { border-color: var(--accent, #4f8cff); color: var(--text, #e6e7ea); background: var(--accent-weak, rgba(79, 140, 255, .14)); }
.debuff-btn.is-on .debuff-dot { background: var(--gain, #3fb950); border-color: var(--gain, #3fb950); }

/* --- Footer: legal notice + data credits (index.html, 404.html) -------------------------------------------------- */
/* Two columns on wide screens, stacked on phones. Only flex properties, so the presets that turn .footer-inner into a
   grid (blueprint) keep their layout. */
.footer-inner > span { flex: 1 1 340px; }
.footer a { color: inherit; text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 2px; }
.footer a:hover { text-decoration-color: currentColor; }
/* Preset-wide link colours (:root[data-preset] a) can vanish on a preset's own footer (brutalist: black on black,
   retro98: blue on teal). Links keep the footer's text colour; presets keep their underline styling. */
:root .footer a:any-link, :root .footer a:any-link:hover { color: inherit; }
:root .footer a:any-link:hover { background: none; }
.def-debuffed .def-old { opacity: .55; margin-right: 2px; }
