/* DHSeaDev opal-prism identity: deep-water ground, pearl ink, spectrum as
   hairline accent only (no gradient fills, no boxy neon). */
:root{
  --bg:#0f1320; --bg2:#171c2e; --card:#1b2136; --ink:#eef1f8; --muted:#8b93ab;
  /* --line is DECORATIVE only (list separators, card hairlines). It carries no
     state, so WCAG 1.4.11's 3:1 does not apply to it and the opal-prism
     restraint is kept. --edge is for anything that delimits an actual CONTROL
     — inputs, selects, buttons, chips — and is measured: 3.81:1 on --bg,
     3.48:1 on --bg2, 3.28:1 on --card. --focus is the focus ring, deliberately
     not a border-colour swap (2.4.11/2.4.13 want a visible indicator, and a
     1px tint on an already-tinted border is not one). */
  --line:#38426b; --edge:#626FA3; --focus:#9DD9F5;
  --op1:#8B7FD6; --op2:#6EC6E8; --op3:#E879C7; --op4:#6EE7B7;
  --win:#6EE7B7; --lose:#FDA4AF; --gold:#FDE68A;
  --font:'Inter',system-ui,-apple-system,Segoe UI,Roboto,sans-serif;
  /* Type scale in rem so the browser's own font-size setting scales the popup.
     A Chrome popup cannot be zoomed, so this is the ONLY lever a low-vision
     user has here. Everything below sizes off these, never off raw px. */
  --fs-base:0.8125rem; --fs-sm:0.75rem; --fs-xs:0.6875rem; --fs-h1:0.9375rem;
  --fs-cv:1.25rem; --fs-star:1rem;
}
html{font-size:100%}
/* Visually hidden but announced. Used for the win/loss pips, which otherwise
   convey their meaning with colour alone (1.4.1). */
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;
  clip:rect(0 0 0 0);white-space:nowrap;border:0}
*{box-sizing:border-box}
html,body{margin:0}
/* Surface sizing lives in the v2 block at the foot of this file — the popup
   is width:auto with a floor and a ceiling so 200% text reflows instead of
   scrolling sideways, and the full page has no cage at all. */
body{background:var(--bg);color:var(--ink);
  font-family:var(--font);font-size:var(--fs-base);line-height:1.45}
.hidden{display:none!important}
.muted{color:var(--muted)}
.err{color:var(--lose);font-size:var(--fs-sm)}

.hdr{display:flex;align-items:center;gap:8px;padding:12px 14px;border-bottom:1px solid var(--line);
  position:sticky;top:0;background:var(--bg);z-index:2}
.hdr h1{font-size:var(--fs-h1);margin:0;font-weight:600;letter-spacing:.2px;flex:1}
.glyph{display:flex}
.hdr-actions{display:flex;align-items:center;gap:2px;flex:0 0 auto}
.icon-btn{background:none;border:none;color:var(--muted);font-size:var(--fs-h1);cursor:pointer;
  padding:2px 6px;border-radius:6px;display:inline-flex;align-items:center;justify-content:center;
  /* 28px keeps both header controls at a comfortable pointer target without
     growing the 380px header; they sit side by side now rather than alone. */
  min-width:28px;min-height:28px}
.icon-btn:hover{color:var(--ink);background:var(--bg2)}
.icon-btn svg{display:block}

.panel{padding:16px 14px}
.lede{margin:0 0 10px}
.hint{font-size:var(--fs-xs);color:var(--muted);margin:10px 0 0}
.row{display:flex;gap:8px;align-items:center}
input,select,textarea{background:var(--bg2);border:1px solid var(--edge);color:var(--ink);
  border-radius:8px;padding:8px 10px;font:inherit;flex:1;min-width:0}
input:focus-visible,select:focus-visible,textarea:focus-visible,
button:focus-visible,a:focus-visible,[tabindex]:focus-visible,
.rating [role="radio"]:focus-visible{outline:2px solid var(--focus);outline-offset:2px}
/* Keyboard focus must never be removed. If a UA default is suppressed anywhere
   below, the rule above is what replaces it — that ordering is intentional. */
textarea{width:100%;resize:vertical}
button{cursor:pointer;font:inherit}
.primary{background:var(--bg2);border:1px solid var(--op1);color:var(--ink);border-radius:8px;padding:8px 12px;white-space:nowrap}
.primary:hover{border-color:var(--op2)}
.primary:disabled{opacity:.5;cursor:not-allowed}
.ghost{background:none;border:1px solid var(--edge);color:var(--muted);border-radius:8px;padding:6px 10px}
.ghost:hover{border-color:var(--op1);color:var(--ink)}

.spinner{width:16px;height:16px;border:2px solid var(--line);border-top-color:var(--op2);
  border-radius:50%;animation:spin .8s linear infinite;display:inline-block;margin-right:8px;vertical-align:middle}
@keyframes spin{to{transform:rotate(360deg)}}
@media (prefers-reduced-motion:reduce){.spinner{animation:none}}

.profile{display:flex;align-items:center;gap:10px;padding:12px 14px;border-bottom:1px solid var(--line)}
.profile img{border-radius:8px;background:var(--bg2)}
.pmeta{flex:1;min-width:0}
.pname{font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.prank{font-size:var(--fs-xs)}
.wl{font-size:var(--fs-sm);text-align:right;white-space:nowrap}

.tabs{display:flex;border-bottom:1px solid var(--line);padding:0 4px}
.tab{background:none;border:none;color:var(--muted);padding:10px 8px;font-size:var(--fs-sm);flex:1;border-bottom:2px solid transparent}
.tab.active{color:var(--ink);border-bottom-color:var(--op2)}
.tabpane{padding:12px 14px}

.cards{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.card{background:var(--card);border:1px solid var(--line);border-radius:10px;padding:10px}
.ck{font-size:var(--fs-xs);color:var(--muted);text-transform:uppercase;letter-spacing:.4px}
.cv{font-size:var(--fs-cv);font-weight:700;margin-top:2px}
.csub{font-size:var(--fs-xs);margin-top:2px}
.sub{font-size:var(--fs-xs);color:var(--muted);text-transform:uppercase;letter-spacing:.4px;margin:14px 0 6px}

.today-strip{margin-top:8px;padding:6px 10px;border-radius:8px;background:var(--bg2);font-size:var(--fs-xs);color:var(--muted)}
.today-strip b{color:var(--ink)}
.spark{display:block;width:100%;height:36px;margin-top:2px}

.matches{list-style:none;margin:0;padding:0}
.matches-head{display:flex;align-items:center;gap:8px;padding:0 0 4px;
  font-size:var(--fs-xs);color:var(--muted);text-transform:uppercase;letter-spacing:.4px}
.mh-sp{width:6px;flex:none}
.mh-h{flex:1}
.mkda-h,.mtime-h{white-space:nowrap;font-variant-numeric:tabular-nums}
.matches li{display:flex;align-items:center;gap:8px;padding:6px 0;border-bottom:1px solid var(--line);font-size:var(--fs-sm)}
.pip{width:6px;height:22px;border-radius:3px;flex:none}
.pip.w{background:var(--win)}.pip.l{background:var(--lose)}
.mh{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mkda{color:var(--muted);font-variant-numeric:tabular-nums}
.mtime{color:var(--op2);text-decoration:none;font-size:var(--fs-xs);white-space:nowrap;font-variant-numeric:tabular-nums}
.mtime:hover{text-decoration:underline}

.heroes{list-style:none;margin:0;padding:0}
.heroes li{display:flex;align-items:center;gap:8px;padding:5px 0;font-size:var(--fs-sm)}
.heroes .hn{flex:1}
.bar{height:6px;background:var(--bg2);border-radius:3px;width:70px;overflow:hidden}
.bar span{display:block;height:100%;background:var(--op4)}

.share-row{display:flex;align-items:center;gap:10px;margin-top:14px}
.share-panel{margin-top:10px;padding:12px;border:1px solid var(--line);border-radius:10px;background:var(--card)}
.share-panel .row{margin-bottom:8px}
.share-actions{flex-wrap:wrap}
.card-preview{display:block;width:100%;height:auto;border-radius:8px;background:var(--bg2);margin-bottom:8px}

.setting-group{margin-bottom:16px}
.setting-group .row{margin-bottom:8px}
.setlbl{flex:1;font-size:var(--fs-sm);color:var(--muted)}
.setting-group.about a{color:var(--op2);text-decoration:none}
.setting-group.about a:hover{text-decoration:underline}
.ghost.danger{border-color:var(--lose);color:var(--lose)}
.ghost.danger:hover{background:var(--bg2)}

.goals{list-style:none;margin:12px 0 0;padding:0}
.goals li{padding:8px 0;border-bottom:1px solid var(--line)}
.goalhd{display:flex;justify-content:space-between;font-size:var(--fs-sm)}
.goalhd .x{color:var(--muted);cursor:pointer;background:none;border:none;font:inherit;padding:0 4px;line-height:1}
.pbar{height:8px;background:var(--bg2);border-radius:4px;margin-top:6px;overflow:hidden}
.pbar span{display:block;height:100%;background:linear-gradient(90deg,var(--op1),var(--op4))}

.tags{display:flex;flex-wrap:wrap;gap:6px;margin:10px 0}
.tag{background:var(--bg2);border:1px solid var(--edge);color:var(--muted);border-radius:14px;padding:4px 10px;font-size:var(--fs-xs)}
.tag.on,.tag[aria-pressed="true"]{border-color:var(--op3);color:var(--ink)}
/* Selected tag state is conveyed by aria-pressed for AT and by a leading mark
   for sighted users, so it is not colour-only. */
.tag[aria-pressed="true"]::before{content:"\2713\00a0"}
.rating{display:flex;gap:2px;flex:1;font-size:var(--fs-star);color:var(--edge)}
.rating [role="radio"]{cursor:pointer;background:none;border:none;color:inherit;
  font:inherit;padding:0 1px;line-height:1}
.rating [role="radio"].on{color:var(--gold)}
.saved{list-style:none;margin:8px 0 0;padding:0}
.saved li{display:flex;align-items:center;gap:8px;padding:6px 0;border-bottom:1px solid var(--line);font-size:var(--fs-sm)}
.saved .stags{color:var(--muted);font-size:var(--fs-xs)}
.saved .open{margin-left:auto;color:var(--op2);cursor:pointer;background:none;border:none;font:inherit}

.ft{display:flex;justify-content:space-between;align-items:center;padding:10px 14px;border-top:1px solid var(--line);font-size:var(--fs-xs)}
.ft a{color:var(--op2);text-decoration:none}
.ft a:hover{text-decoration:underline}

/* Reduced motion: the spinner was already handled; this covers the rest and is
   the honest scope — there is no other animation in the popup to disable. */
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.001ms!important;animation-iteration-count:1!important;
    transition-duration:.001ms!important}
}

/* Windows High Contrast / forced-colors. Every meaning carried by a custom
   colour is re-stated with a system colour or a border, because in this mode
   the palette above is discarded by the UA. The win/loss pip in particular is
   colour-only in normal mode and invisible here without this block — the
   .sr-only text in each pip is what actually carries it for AT either way. */
@media (forced-colors:active){
  .pip{forced-color-adjust:none;border:1px solid CanvasText}
  .pip.w{background:Highlight}
  .pip.l{background:Canvas;border-style:dashed}
  .tab.active{border-bottom-color:Highlight}
  .tag[aria-pressed="true"],.chip.on{border:2px solid Highlight}
  .rating [role="radio"].on{color:Highlight}
  .bar span,.pbar span{background:Highlight;forced-color-adjust:none}
  input:focus-visible,select:focus-visible,textarea:focus-visible,
  button:focus-visible,a:focus-visible{outline:2px solid Highlight}
}

/* Matchups tab. Reuses .heroes list geometry; the delta is the headline figure
   so it gets tabular numerals and its own weight. Colour is redundant with the
   sign, never the sole carrier. */
.mu-delta{margin-left:auto;font-variant-numeric:tabular-nums;font-weight:600;
  min-width:52px;text-align:right}
#muBaseline{margin:0 0 8px}
#tab-matchups .sub{margin-top:14px}
@media (forced-colors:active){
  .mu-delta{forced-color-adjust:none;color:CanvasText}
}

/* ---- first-run onboarding (lib/onboard.js) ----
   Shared by the popup and the inventory page; inventory.css overrides only
   what the 380px popup body imposes. Deliberately built from the primitives
   already here (--card, --edge, .hint, .muted) rather than a new visual
   language: it is guidance about the app, not a separate product. */
.onboard{margin:10px 14px 0;background:var(--card);border:1px solid var(--edge);
  border-radius:10px;overflow:hidden}
.ob-head{display:flex;align-items:center;gap:4px;padding:2px 4px 2px 2px}
.ob-toggle{flex:1;min-width:0;display:flex;align-items:center;gap:6px;background:none;
  border:none;color:var(--ink);font:inherit;font-weight:600;text-align:left;cursor:pointer;
  padding:8px 6px;border-radius:8px}
.ob-toggle:hover{background:var(--bg2)}
.ob-caret{color:var(--op2);flex:0 0 auto;font-size:var(--fs-xs)}
.ob-prog{font-weight:400;font-size:var(--fs-xs);margin-left:auto;flex:0 0 auto}
.ob-close{flex:0 0 auto}
.ob-body{padding:0 12px 12px}
.ob-body > .hint{margin:0 0 10px}

.ob-steps{list-style:none;margin:0;padding:0;counter-reset:none}
.ob-step{display:flex;gap:9px;align-items:flex-start;padding:7px 0;
  border-top:1px solid var(--line)}
.ob-step:first-child{border-top:none}
/* The number/check marker. Not colour-only: .done also swaps the glyph, and
   lib/onboard.js writes an sr-only "Done." into each completed row (1.4.1). */
.ob-mark{flex:0 0 auto;width:20px;height:20px;border-radius:50%;display:flex;
  align-items:center;justify-content:center;font-size:var(--fs-xs);font-weight:600;
  background:var(--bg2);color:var(--muted);border:1px solid var(--edge);margin-top:1px}
.ob-step.done .ob-mark{background:transparent;color:var(--win);border-color:var(--win)}
.ob-step.current .ob-mark{color:var(--bg);background:var(--op2);border-color:var(--op2)}
.ob-txt{min-width:0}
.ob-txt b{display:block;font-weight:600}
.ob-d{display:block;font-size:var(--fs-xs);color:var(--muted);line-height:1.45;margin-top:1px}
.ob-step.done .ob-txt b{color:var(--muted)}
/* The current step is marked with aria-current in JS; this is its visual
   counterpart. A left rule rather than a background so it survives forced-colors. */
.ob-step.current{border-left:2px solid var(--op2);margin-left:-12px;padding-left:10px}

.ob-done{margin:10px 0 0}
.ob-priv{margin-top:10px;border-top:1px solid var(--line);padding-top:8px}
.ob-priv summary{cursor:pointer;font-size:var(--fs-sm);color:var(--op2);
  padding:2px 0;border-radius:6px}
.ob-priv summary:focus-visible{outline:2px solid var(--focus);outline-offset:2px}
.ob-priv .hint{margin:6px 0 0}
.ob-priv-b{margin-top:8px}
.ob-priv-h{font-size:var(--fs-xs);font-weight:600;color:var(--ink);
  text-transform:uppercase;letter-spacing:.4px}

/* Respect the OS setting. Nothing here animates today, but the caret swap and
   any future transition must not be added without this already in place. */
@media (prefers-reduced-motion:reduce){
  .onboard *{transition:none!important;animation:none!important}
}
/* In forced-colors the token palette is discarded; keep the box and the marker
   readable by falling back to system colours instead of vanishing. */
@media (forced-colors:active){
  .onboard{border:1px solid CanvasText}
  .ob-mark{border:1px solid CanvasText;background:Canvas;color:CanvasText;forced-color-adjust:none}
  .ob-step.done .ob-mark,.ob-step.current .ob-mark{border-color:Highlight;color:Highlight}
}

/* Compact variant — the popup only. A 380x600 popup cannot afford five step
   descriptions AND the control the first step is telling the user to press, so
   only the CURRENT step is expanded. The full text is one step away (it appears
   as the user advances) and always present on the inventory page, which has the
   height for it. Titles alone are still a legible checklist. */
.onboard-compact .ob-step:not(.current) .ob-d{display:none}
.onboard-compact .ob-step{padding:5px 0}
.onboard-compact .ob-body > .hint{margin-bottom:6px}

/* Avatar fallback — same box as the <img> it replaces, so the header does not
   reflow between a player who has an avatar and one who does not. */
.avatar-mono{width:40px;height:40px;border-radius:8px;background:var(--bg2);
  border:1px solid var(--edge);display:flex;align-items:center;justify-content:center;
  font-weight:700;font-size:17px;color:var(--op2);flex:0 0 auto;letter-spacing:.5px}

/* ---- v1.9.0 insight layer ------------------------------------------------
   Reuses the existing card/row vocabulary rather than inventing a second one.
   Colour carries severity and direction; the text says the same thing, so the
   panels still read correctly with colour removed. */

.sync-strip {
  display: flex; flex-direction: column; gap: 4px;
  margin: 0 0 10px; padding: 7px 9px;
  border-left: 3px solid var(--muted, #7c8496);
  background: rgba(127, 140, 170, .07);
  border-radius: 3px;
  font-size: 11.5px; line-height: 1.45;
}
.sync-strip.sev-warn    { border-left-color: #d9a227; background: rgba(217, 162, 39, .09); }
.sync-strip.sev-blocker { border-left-color: #e0605f; background: rgba(224, 96, 95, .10); }
.sync-row { display: flex; gap: 7px; align-items: baseline; }
.sync-dot { flex: 0 0 auto; width: 6px; height: 6px; margin-top: 5px; border-radius: 50%; background: #7c8496; }
.sync-dot.sev-warn { background: #d9a227; }
.sync-dot.sev-blocker { background: #e0605f; }
.sync-msg { flex: 1 1 auto; }

.fix-card {
  padding: 10px 11px; margin-bottom: 12px;
  border: 1px solid rgba(127, 140, 170, .22); border-radius: 5px;
  background: rgba(127, 140, 170, .05);
}
.fix-card.fix-actionable { border-color: rgba(217, 162, 39, .45); background: rgba(217, 162, 39, .07); }
.fix-head { margin: 0 0 5px; font-size: 12.5px; line-height: 1.45; }
.fix-drill { margin: 0; font-size: 11.5px; line-height: 1.5; }
.fix-why { margin: 7px 0 0; padding-left: 16px; font-size: 11px; opacity: .8; }
button.small { padding: 2px 7px; font-size: 10.5px; margin-top: 7px; }

.roles, .mastery { list-style: none; margin: 0 0 10px; padding: 0; }
.role-row, .mastery-row {
  display: grid; align-items: baseline; gap: 8px;
  padding: 5px 2px; border-bottom: 1px solid rgba(127, 140, 170, .14);
  font-size: 11.5px;
}
.role-row { grid-template-columns: 1fr auto auto 4.6em; }
.mastery-row { grid-template-columns: minmax(0,1fr) auto 7.6em 4.2em; }
.role-row:last-child, .mastery-row:last-child { border-bottom: 0; }
.role-row.thin { opacity: .62; }
.role-name, .m-hero { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-games, .m-games, .d-games { opacity: .6; font-variant-numeric: tabular-nums; }
.role-wr, .d-rate { font-variant-numeric: tabular-nums; }
.role-delta, .m-chg, .d-delta { text-align: right; font-variant-numeric: tabular-nums; }
/* The change column must never wrap: a two-line "last hits" pushed the
   verdict out of alignment with every other row. */
.m-chg { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up   { color: #5fbf7a; }
.down { color: #e0605f; }
.m-verdict { text-align: right; opacity: .7; }

.draft-enemies { list-style: none; display: flex; flex-wrap: wrap; gap: 5px; margin: 7px 0; padding: 0; }
.draft-row { display: grid; grid-template-columns: 1fr auto 3.4em 5.6em; gap: 8px;
  align-items: baseline; padding: 5px 2px; font-size: 11.5px;
  border-bottom: 1px solid rgba(127, 140, 170, .14); }
.draft-row.vs-row { grid-template-columns: 1fr auto 3.4em 4.6em; opacity: .88; }
.d-hero { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d-conf { text-align: right; font-size: 10px; opacity: .72; }
.conf-low { color: #d9a227; opacity: .95; }
.draft-sep { margin-top: 10px; padding: 5px 2px 3px; font-size: 10.5px;
  text-transform: uppercase; letter-spacing: .07em; opacity: .6; border-bottom: 0; }

/* ==========================================================================
   v2.0 — SURFACE, THEME, MOTION, AND THE v2 COMPONENTS
   --------------------------------------------------------------------------
   LOOK (svg-graphics §0, for every mark and icon added in 2.0)
     subject   a Dota player's own record: lanes, heroes, percentiles, drafts
     job       read a number and its confidence at a glance, at 13px, in a
               380px box AND on a 1400px page, in light and dark
     use-size  16px (icons) to 1400px (full page panels)
     idiom     UI icon — 24-unit grid, 2-unit live padding, uniform 1.75
               stroke, round caps/joins, fill:none, stroke:currentColor
     palette   ground --bg, base --bg2, raised --card, line --line,
               ink --ink, quiet --muted, win --win, lose --lose, hero --op2
     light     flat. No gradients on marks, no glow, no drop shadows.
     line      uniform 1.75 in the icon set; data marks are fills, not strokes
     ground    both — every token below is redefined for light
   ========================================================================== */

/* ---- Theme axis ---------------------------------------------------------
   Dark is the authored default and stays in :root. Light is defined twice: in
   a prefers-color-scheme query guarded against an explicit dark choice, and
   again unguarded for an explicit light choice. Without the :not() guard a
   user who picks dark on a light-themed OS gets the light palette anyway. */
:root{
  --surface-max:1400px;
  --grad-1:#8B7FD6; --grad-2:#6EC6E8; --grad-3:#E879C7; --grad-4:#6EE7B7;
  --neutral:#8b93ab;            /* a bar that carries no valence */
  --motion-fast:120ms; --motion-med:240ms; --motion-slow:520ms;
  --ease:cubic-bezier(.22,.61,.36,1);
}
@media (prefers-color-scheme:light){
  :root:not([data-theme="dark"]){
    --bg:#f6f7fb; --bg2:#eceef6; --card:#ffffff; --ink:#151827; --muted:#5b6379;
    --line:#d3d8e8; --edge:#8a93b4; --focus:#1f6f95;
    --win:#0f8a5f; --lose:#c02a44; --gold:#8a6d00;
    --neutral:#8189a0;
  }
}
:root[data-theme="light"]{
  --bg:#f6f7fb; --bg2:#eceef6; --card:#ffffff; --ink:#151827; --muted:#5b6379;
  --line:#d3d8e8; --edge:#8a93b4; --focus:#1f6f95;
  --win:#0f8a5f; --lose:#c02a44; --gold:#8a6d00; --neutral:#8189a0;
}

/* ---- Surface sizing -----------------------------------------------------
   POPUP: width:auto between a floor and a ceiling. Chrome sizes the popup from
   the document, so a hard 380px meant 200% text scrolled sideways (measured
   v1.9.0: scrollWidth 658 > clientWidth 420). A floor keeps the normal case at
   380px; the ceiling lets zoomed text reflow instead of clipping.
   FULL: no cage. */
html.surface-popup body{
  /* COMPACT surface = the side panel (2.5). The 600px popup cage and 760px ceiling are gone: a panel is as
     tall as the window and as wide as the user drags it. The class keeps its legacy name. */
  width:auto;min-width:320px;max-width:none;max-height:none;overflow-y:visible;
}
html.surface-full body{
  width:auto;max-width:var(--surface-max);margin:0 auto;max-height:none;overflow:visible;
}
html.surface-full .hdr{position:sticky;top:0;z-index:20;background:var(--bg);padding:14px 24px}
html.surface-full .hdr h1{font-size:1.25rem}
html.surface-full #setup,html.surface-full #loading{padding-left:24px;padding-right:24px}
html.surface-full .profile,html.surface-full .tabpane,
html.surface-full #firstrun,html.surface-full .ft{padding-left:24px;padding-right:24px}
html.surface-full .tabbar{position:sticky;top:57px;z-index:19;background:var(--bg);padding-left:24px;padding-right:24px}
html.surface-full .tab{flex:0 0 auto;padding:12px 18px;font-size:var(--fs-base)}

/* Elements that exist only on one surface. .full-only is display:none in the
   popup rather than absent from the DOM, so one controller drives both and
   there is no second markup file to drift. */
html.surface-popup .full-only{display:none!important}
html.surface-full  .popup-only{display:none!important}

/* ---- Full-page layout ---------------------------------------------------
   Panels are auto-fit so the page reflows at every width without a breakpoint
   per column count. minmax floor is 320px: the narrowest a stat panel stays
   readable at the base type scale. */
html.surface-full .tabpane{max-width:var(--surface-max);margin:0 auto}
html.surface-full .cards{grid-template-columns:repeat(auto-fit,minmax(200px,1fr))}
html.surface-full .pane-grid{
  display:grid;gap:18px;grid-template-columns:repeat(auto-fit,minmax(320px,1fr));align-items:start;
}
.panel-box{background:var(--card);border:1px solid var(--line);border-radius:12px;padding:14px 16px}
html.surface-popup .panel-box{background:none;border:none;padding:0}
html.surface-popup .pane-grid{display:block}

/* ---- Onboarding: progressive ------------------------------------------
   v1.9.0 measured 337px = 56% of the popup's first screen, and it sits outside
   the tab panes so it was on all six tabs. In the popup it is now a one-line
   strip once step 1 is done; the full card only ever renders on the full page
   or before the first step completes. */
html.surface-popup .onboard.is-started{padding:0}
html.surface-popup .onboard.is-started .ob-steps,
html.surface-popup .onboard.is-started .ob-priv,
html.surface-popup .onboard.is-started .ob-lede{display:none}
html.surface-popup .onboard.is-started .ob-toggle{padding:6px 10px;font-size:var(--fs-xs)}

/* ---- Hero art ----------------------------------------------------------
   Valve's portraits are 256x144 (16:9). Fixed intrinsic width+height on the
   element so a slow CDN cannot reflow the list under the cursor, and a tinted
   box behind it so a blocked or failed image leaves a shaped placeholder
   rather than a broken-image glyph. */
.hero-art{flex:0 0 auto;width:44px;height:25px;border-radius:4px;background:var(--bg2);
  object-fit:cover;display:block}
.hero-art.is-failed{visibility:hidden}
html.surface-full .hero-art{width:64px;height:36px}
.hero-icon{width:22px;height:22px;flex:0 0 auto;background:var(--bg2);border-radius:4px}

/* ---- Data marks --------------------------------------------------------
   ONE QUANTITY PER MARK. v1.9.0 put winrate in the bar width and games in the
   text, so a 2-game 100% hero drew the longest bar in the list; and on
   Matchups it drew a green bar beside a red negative delta, because the bar
   was the raw rate and the number was the delta. Both are fixed by giving each
   quantity its own mark:
     .wbar  — width = SAMPLE SIZE (games), fill = shrunk win rate.
     .dbar  — a DIVERGING bar centred on the baseline: left/lose, right/win.
   Confidence is carried by opacity, not by a second colour. */
.wbar{position:relative;height:8px;border-radius:4px;background:var(--bg2);
  width:var(--w,40px);flex:0 0 auto;overflow:hidden}
.wbar>span{display:block;height:100%;border-radius:4px;background:var(--mark,var(--neutral));
  width:100%;opacity:var(--conf,1)}
.dbar{position:relative;height:10px;width:96px;flex:0 0 auto;background:var(--bg2);border-radius:5px}
.dbar::before{content:"";position:absolute;left:50%;top:-2px;bottom:-2px;width:1px;
  background:var(--edge);opacity:.9}
.dbar>span{position:absolute;top:1px;bottom:1px;border-radius:3px;background:var(--mark);
  opacity:var(--conf,1)}
.dbar>span.neg{right:50%}
.dbar>span.pos{left:50%}
.mark-win{--mark:var(--win)} .mark-lose{--mark:var(--lose)} .mark-neutral{--mark:var(--neutral)}
/* A sample too small to mean anything is drawn, labelled, and de-emphasised —
   never hidden, because hiding it would silently change the ranking. */
.thin{font-size:var(--fs-xs);color:var(--muted);font-style:normal}

/* ---- Percentile ladder (benchmarks) ------------------------------------ */
.ladder{position:relative;height:26px;background:var(--bg2);border-radius:6px;overflow:hidden}
.ladder .lr{position:absolute;top:0;bottom:0;background:var(--op2);opacity:.16}
.ladder .lyou{position:absolute;top:-3px;bottom:-3px;width:3px;background:var(--ink);border-radius:2px}
.ladder .lticks{position:absolute;inset:0;display:flex;justify-content:space-between;
  align-items:center;padding:0 6px;font-size:var(--fs-xs);color:var(--muted)}
.pct-row{display:grid;grid-template-columns:1fr 96px 56px;gap:10px;align-items:center;
  padding:7px 0;border-bottom:1px solid var(--line)}
.pct-val{text-align:right;font-variant-numeric:tabular-nums;font-weight:600}

/* ---- Meta / party / matrix --------------------------------------------- */
.meta-grid{display:grid;gap:8px;grid-template-columns:repeat(auto-fit,minmax(210px,1fr))}
.meta-cell{display:flex;align-items:center;gap:8px;padding:6px 8px;background:var(--bg2);
  border-radius:8px;border-left:3px solid var(--mark,var(--neutral))}
.meta-cell .mn{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.party tr>*{padding:6px 8px;border-bottom:1px solid var(--line);text-align:left;font-size:var(--fs-sm)}
.party{width:100%;border-collapse:collapse}
.party th{color:var(--muted);font-size:var(--fs-xs);text-transform:uppercase;letter-spacing:.4px;font-weight:600}
.party td.num{text-align:right;font-variant-numeric:tabular-nums}
.picker{display:grid;gap:6px;grid-template-columns:repeat(auto-fill,minmax(58px,1fr));
  max-height:260px;overflow-y:auto;padding:4px;border:1px solid var(--line);border-radius:10px}
html.surface-full .picker{max-height:340px;grid-template-columns:repeat(auto-fill,minmax(72px,1fr))}
.picker button{background:none;border:1px solid transparent;border-radius:6px;padding:2px;cursor:pointer;
  display:block;line-height:0}
.picker button:hover,.picker button:focus-visible{border-color:var(--op2)}
.picker button[aria-pressed="true"]{border-color:var(--lose);background:var(--bg2)}
.picker img{width:100%;height:auto;aspect-ratio:256/144;border-radius:4px;background:var(--bg2);display:block}

/* ---- Match detail ------------------------------------------------------ */
.mdetail{display:grid;gap:10px}
.mdetail .mrow{display:grid;grid-template-columns:1fr auto auto;gap:10px;align-items:center;
  padding:6px 0;border-bottom:1px solid var(--line)}
.state-chip{display:inline-block;padding:1px 7px;border-radius:999px;font-size:var(--fs-xs);
  border:1px solid var(--edge);color:var(--muted)}
.state-chip.ok{border-color:var(--win);color:var(--win)}
.state-chip.wait{border-color:var(--gold);color:var(--gold)}

/* ---- Motion ------------------------------------------------------------
   One idea per surface, no loops. A popup is open for seconds; an ambient loop
   reads as a screensaver. Every animated surface is COMPLETE with motion
   stopped (svg-graphics §10) — these only affect how a finished state arrives. */
.tabpane{animation:dc-in var(--motion-fast) var(--ease) both}
@keyframes dc-in{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}
.wbar>span,.dbar>span{transition:width var(--motion-med) var(--ease),opacity var(--motion-med) var(--ease)}
.ladder .lyou{transition:left var(--motion-med) var(--ease)}
.spark-line{transition:none}
.spark-draw{stroke-dasharray:1;stroke-dashoffset:1;animation:dc-draw var(--motion-slow) var(--ease) forwards}
@keyframes dc-draw{to{stroke-dashoffset:0}}
.cv{transition:color var(--motion-fast) var(--ease)}
@media (prefers-reduced-motion:reduce){
  .tabpane{animation:none}
  .wbar>span,.dbar>span,.ladder .lyou{transition:none}
  .spark-draw{animation:none;stroke-dashoffset:0}
}
/* forced-colors discards the token palette; keep every mark a visible shape. */
@media (forced-colors:active){
  .wbar,.dbar,.ladder{border:1px solid CanvasText}
  .wbar>span,.dbar>span,.ladder .lr{background:Highlight;opacity:1}
  .ladder .lyou{background:CanvasText}
  .panel-box,.meta-cell{border:1px solid CanvasText}
  .picker button[aria-pressed="true"]{border-color:Highlight}
}

/* Format row and the per-row detail button: both sit inside lists whose rows
   were laid out before either existed, so they get explicit sizing rather than
   inheriting a width meant for something else. */
.format-row{margin:10px 0 2px;align-items:center}
.format-row .setlbl{flex:0 0 auto}
.matches li button.small{margin-top:0;flex:0 0 auto}
.heroes li .thin,.matches li .thin{flex:0 0 auto}
.pct-row:last-child{border-bottom:none}
html.surface-full .matches li,html.surface-full .heroes li{padding:8px 0}

/* --- fixes from the first full-page render ------------------------------
   Each of these was invisible in the markup and obvious on screen. */

/* A two-item auto-fit grid gave each stat card half a 1400px page. Cap them:
   a number that large is not more informative, just louder. */
html.surface-full .cards{grid-template-columns:repeat(auto-fit,minmax(200px,280px));justify-content:start}

/* `.row select{flex:1}` was written for a 380px popup, where stretching is
   correct. On the full page it stretched a five-option menu across the screen. */
html.surface-full .row>select{flex:0 0 auto;min-width:180px;max-width:320px}
html.surface-full .format-row{gap:10px}

/* preserveAspectRatio="none" plus a 40-unit viewBox in a 1400px box flattened
   the trend line into a horizon. Give it real height on the full page — the
   SVG scales, which is the reason it is no longer a canvas. */
.spark{height:44px}
html.surface-full .spark{height:120px}

/* Ladder scale anchors sit inside the track, so they need to survive the fill
   passing underneath them. */
.ladder .lticks{pointer-events:none}
.ladder .lticks span{background:var(--card);padding:0 4px;border-radius:3px;opacity:.92}
html.surface-popup .ladder .lticks span{background:var(--bg2)}

/* --- meta grid, second render pass --------------------------------------
   First render truncated nearly every hero name to three characters ("Wrai…",
   "Spec…", "Cry…") because the portrait, bar and percentage took the row and
   the name got the remainder. The name is the row's subject; it gets the space
   first and the mark is sized to what is left. */
.meta-grid{grid-template-columns:repeat(auto-fit,minmax(272px,1fr))}
.meta-cell{gap:10px;padding:7px 10px}
.meta-cell .mn{flex:1 1 auto;min-width:88px}
.meta-cell .wbar,.meta-cell .dbar{flex:0 0 auto;max-width:56px}
.meta-cell .muted{flex:0 0 auto;font-variant-numeric:tabular-nums;min-width:48px;text-align:right}

/* A label and the control it names must read as one unit. `.row` spreads its
   children, which is right for a toolbar and wrong for a labelled field, so
   pair them explicitly wherever a row holds more than one field. */
.field{display:flex;align-items:center;gap:8px;flex:0 0 auto}
.field .setlbl{flex:0 0 auto}
html.surface-full .field>select{min-width:160px}

/* The draft entry field stretched the width of the page because `.row input`
   is flex:1 — right in a 380px popup, absurd at 1400px. */
html.surface-full .row>input[type="text"]{flex:0 1 420px}
/* The diverging bar's zero line is the thing that makes the mark readable at
   all; at 1px on a light ground it disappeared. */
.dbar::before{width:2px;left:calc(50% - 1px);opacity:1;background:var(--edge)}

/* --- 200% text reflow ----------------------------------------------------
   Measured: at 200% the six-tab bar alone forced scrollWidth to 658px in a
   420px viewport — it was the ONLY overflowing element on the page, and it
   overflowed in v1.9.0 too. Six fixed-basis flex items cannot share 420px once
   the type doubles, so the row wraps. A wrapped tablist is still a tablist:
   roving tabindex, aria-selected and the arrow-key handler are all unaffected
   by which visual line a tab sits on. flex-basis is released at the same time,
   or each tab keeps demanding an equal share of a width that no longer exists. */

/* At 200% text the match row still fit its box but truncated the hero name to
   two characters ("Skywrath Mage" in 56px) — no horizontal overflow, and the
   row's subject unreadable, which is the failure WCAG reflow is actually
   about. The row wraps instead: the name keeps a floor, and the numbers move
   to a second line rather than squeezing it. The row's aria-label was already
   complete, so this changes nothing for a screen reader and everything for
   someone using zoom. */
.matches li{flex-wrap:wrap}
.mh{min-width:9ch;flex:1 1 9ch}
.matches li .mkda{margin-left:auto}
.heroes li{flex-wrap:wrap}
.heroes li .hn{min-width:9ch;flex:1 1 9ch}

/* --- ladder, second render pass ------------------------------------------
   The track was 96px with "worst" and "best" printed inside it on every row:
   the labels filled it and the marker had nowhere left to be. The scale is now
   captioned once per column, and the track gets real width. */
.pct-row{grid-template-columns:1fr minmax(120px,240px) 56px}
html.surface-full .pct-row{grid-template-columns:1fr minmax(260px,520px) 64px}
.pct-head{padding-top:0;padding-bottom:2px;border-bottom:none}
.ladder-scale{display:flex;justify-content:space-between;font-size:var(--fs-xs);
  color:var(--muted);text-transform:uppercase;letter-spacing:.4px}

/* ===== v2.1-2.3: favorites, guides, ward map, share slots ====================
   Tokens only (no raw colours except the two ward-layer hues, which are also
   drawn on the card); every state that is carried by colour also carries text. */
.share-slot{margin-top:8px}
.share-slot:empty{display:none}
button.linklike{background:none;border:none;color:var(--ink);padding:2px 0;font:inherit;text-align:left;
  cursor:pointer;text-decoration:underline;text-decoration-color:var(--edge);text-underline-offset:3px;flex:1 1 9ch}
button.linklike:hover{text-decoration-color:var(--op2)}
button.star{background:none;border:1px solid var(--edge);color:var(--muted);border-radius:8px;padding:2px 9px;
  font-size:var(--fs-star);line-height:1.2;cursor:pointer}
button.star.on{color:var(--gold);border-color:var(--gold)}
button.star:hover{border-color:var(--op2)}
#favPicker button[aria-pressed="true"]{border-color:var(--gold);background:var(--bg2)}
.fav-list li{border-bottom:1px solid var(--line)}
#favReview:empty,#guideBody:empty{display:none}
.fav-rec p,.fav-form p,.fav-bench p{margin:4px 0}
.form-strip{display:flex;gap:4px;flex-wrap:wrap;margin:6px 0}
.form-strip .chip{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;
  border-radius:6px;font-weight:800;font-size:var(--fs-xs);color:var(--bg)}
.form-strip .chip.w{background:var(--win)}
.form-strip .chip.l{background:var(--lose)}
.item-art{flex:0 0 auto;width:32px;height:24px;border-radius:4px;background:var(--bg2);object-fit:cover}
.item-art.is-failed{visibility:hidden}
.build-list{list-style:none;margin:0;padding:0}
.build-list li{display:flex;align-items:center;gap:8px;padding:4px 0;font-size:var(--fs-sm);flex-wrap:wrap}
.build-list .hn{flex:1 1 9ch}

.role-chips{gap:6px;flex-wrap:wrap}
.guide-results{list-style:none;margin:0;padding:0;max-height:70vh;overflow-y:auto}
.guide-results li{border-bottom:1px solid var(--line)}
button.result{display:flex;align-items:center;gap:8px;width:100%;background:none;border:none;color:var(--ink);
  padding:8px 4px;font:inherit;text-align:left;cursor:pointer}
button.result:hover,button.result:focus-visible{background:var(--bg2)}
button.result .hn{flex:1}
.chip.t-hero,.chip.t-item,.chip.t-ability{display:inline-block;font-size:var(--fs-xs);padding:1px 7px;border-radius:999px;
  border:1px solid var(--edge);color:var(--muted);text-transform:uppercase;letter-spacing:.3px}
.chip.t-hero{border-color:var(--op2)} .chip.t-item{border-color:var(--op4)} .chip.t-ability{border-color:var(--op3)}
.guide-body{min-height:120px}
.g-head{display:flex;align-items:center;gap:12px;margin-bottom:8px}
.g-head h3{margin:0;font-size:1.05rem}
.g-head p{margin:2px 0 0}
.g-sec{margin:14px 0}
.g-sec h4{margin:0 0 6px;font-size:var(--fs-sm);text-transform:uppercase;letter-spacing:.4px;color:var(--muted)}
.g-ability{padding:8px 0;border-bottom:1px solid var(--line)}
.g-ability p{margin:4px 0 0}
.g-ability.focus{outline:2px solid var(--focus);outline-offset:2px;border-radius:6px}
.talent-row,.phase{display:grid;grid-template-columns:84px 1fr;gap:10px;align-items:start;padding:5px 0;
  border-bottom:1px solid var(--line);font-size:var(--fs-sm)}
.talent-row .lvl,.phase .lvl{color:var(--muted);font-size:var(--fs-xs);text-transform:uppercase;letter-spacing:.3px}
.pair{display:flex;flex-wrap:wrap;gap:6px}
.pair .tal{display:inline-block;padding:3px 8px;border:1px solid var(--line);border-radius:8px;background:var(--bg2)}
button.item-chip{display:inline-flex;align-items:center;gap:6px;margin-top:0}
.g-need{padding:10px 0}

.ward-map{max-width:560px;width:100%}
.ward-svg{width:100%;height:auto;display:block;border:1px solid var(--line);border-radius:10px}
.ward-spots ul,#wardSpots ul{margin:4px 0 10px;padding-left:18px;font-size:var(--fs-sm)}
#wardInfo p,#wardSpots p{margin:4px 0}
@media (forced-colors:active){
  .form-strip .chip{border:1px solid ButtonText;color:ButtonText;background:Canvas}
  button.star.on{border-color:Highlight}
  #favPicker button[aria-pressed="true"]{border-color:Highlight}
}
@media (prefers-reduced-motion:reduce){ .g-ability.focus{outline-offset:0} }


/* ===== 2.5: one-row tabs, settings drawer, fields, guides, inventory ===================================
   Tokens only. Every state carried by colour also carries text, shape or position. */
:root{--gap-label:8px;--field-h:40px}

/* ---- fields: air between a label and its control, one clean focus ring ---- */
input,select,textarea{min-height:var(--field-h);padding:9px 12px}
select{appearance:none;-webkit-appearance:none;padding-right:36px;cursor:pointer;
  background-image:linear-gradient(45deg,transparent 50%,var(--muted) 50%),linear-gradient(135deg,var(--muted) 50%,transparent 50%);
  background-position:calc(100% - 19px) 53%,calc(100% - 14px) 53%;background-size:5px 5px,5px 5px;background-repeat:no-repeat}
input:focus-visible,select:focus-visible,textarea:focus-visible{outline:2px solid var(--focus);outline-offset:2px}
.field{flex-direction:column;align-items:flex-start;gap:var(--gap-label)}
.field>select,.field>input{align-self:stretch}
.tabpane>.hint{margin:0 0 12px}
.row:has(select),.row:has(input){margin-top:10px;margin-bottom:6px}
.tabpane>.row:first-child{margin-top:0}
.format-row{gap:12px}

/* ---- one-row tab bar + More ---- */
.tabbar{display:flex;align-items:stretch;border-bottom:1px solid var(--line);padding:0 4px}
.tabs{display:flex;flex:1 1 auto;min-width:0;border:0;padding:0;overflow:hidden}
.tab{flex:0 0 auto;padding:10px 12px;white-space:nowrap}
.tab.tab-hidden{display:none}
.tab-more{position:relative;flex:0 0 auto;display:flex;align-items:center}
.tab-more-btn{background:none;border:none;border-bottom:2px solid transparent;color:var(--muted);padding:10px 12px;font-size:var(--fs-sm);
  display:inline-flex;align-items:center;gap:6px;white-space:nowrap}
.tab-more-btn::after{content:"";width:6px;height:6px;border-right:1.5px solid currentColor;border-bottom:1.5px solid currentColor;transform:translateY(-2px) rotate(45deg)}
.tab-more-btn[aria-expanded="true"]{color:var(--ink)}
.tab-more-btn:hover{color:var(--ink)}
html.surface-full .tab-more-btn{padding:12px 18px;font-size:var(--fs-base)}
.menu{position:absolute;right:0;top:100%;z-index:45;min-width:190px;background:var(--card);border:1px solid var(--line);border-radius:12px;padding:6px;
  box-shadow:0 14px 34px rgba(0,0,0,.4)}
.menu-item{display:block;width:100%;text-align:left;background:none;border:none;color:var(--ink);padding:10px 12px;border-radius:8px;font-size:var(--fs-base)}
.menu-item:hover,.menu-item:focus-visible{background:var(--bg2)}

/* ---- header: tidy icon row ---- */
.hdr-actions{gap:4px}
.icon-btn{min-width:32px;min-height:32px;border-radius:8px}
.icon-btn[aria-expanded="true"]{color:var(--ink);background:var(--bg2)}

/* ---- Settings drawer ---- */
.scrim{position:fixed;inset:0;background:rgba(5,8,18,.55);z-index:55}
.drawer{position:fixed;top:0;right:0;bottom:0;width:min(460px,100vw);z-index:60;display:flex;flex-direction:column;background:var(--bg);
  border-left:1px solid var(--line);box-shadow:-18px 0 44px rgba(0,0,0,.35)}
html.surface-popup .drawer{width:100vw;border-left:none}
.drawer-hdr{display:flex;align-items:center;justify-content:space-between;padding:14px 18px;border-bottom:1px solid var(--line);flex:0 0 auto}
.drawer-hdr h2{margin:0;font-size:1.05rem;font-weight:700;letter-spacing:.2px}
.drawer-body{flex:1 1 auto;overflow-y:auto;padding:16px 18px 28px;display:flex;flex-direction:column;gap:14px}
html.drawer-open body{overflow:hidden}
.set-card{background:var(--card);border:1px solid var(--line);border-radius:14px;padding:14px 16px}
.set-h{margin:0 0 6px;font-size:var(--fs-xs);font-weight:800;letter-spacing:1.4px;text-transform:uppercase;color:var(--muted)}
.set-row{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:10px 0;border-top:1px solid var(--line)}
.set-h+.set-row{border-top:none}
.set-txt{min-width:0;flex:1 1 auto}
.set-name{font-size:var(--fs-base);font-weight:600;color:var(--ink)}
.set-sub{margin-top:2px;font-size:var(--fs-sm);color:var(--muted);line-height:1.4}
.set-row select{flex:0 0 auto;width:212px}
.set-actions{display:flex;flex-wrap:wrap;gap:8px;padding-top:12px;border-top:1px solid var(--line)}
.set-row+.set-actions{margin-top:2px}
.set-card.danger{border-color:color-mix(in srgb,var(--lose) 45%,var(--line))}
.set-card.danger .set-h{color:var(--lose)}
.set-about{padding:2px 4px 0;font-size:var(--fs-sm);color:var(--ink);display:flex;flex-direction:column;gap:4px}
.set-about a{color:var(--op2);text-decoration:none}
.set-about a:hover{text-decoration:underline}
/* switch: a real checkbox (role=switch) drawn as a track. The knob position AND the track fill both change,
   and a forced-colors fallback keeps the state visible without colour. */
.switch{position:relative;display:inline-flex;flex:0 0 auto;cursor:pointer}
.switch input{position:absolute;inset:0;width:100%;height:100%;min-height:0;margin:0;opacity:0;cursor:pointer;z-index:1}
.switch-track{width:46px;height:26px;border-radius:13px;background:var(--bg2);border:1px solid var(--edge);position:relative;transition:background .15s}
.switch-track::after{content:"";position:absolute;top:3px;left:3px;width:18px;height:18px;border-radius:50%;background:var(--muted);transition:transform .15s,background .15s}
.switch input:checked+.switch-track{background:color-mix(in srgb,var(--op4) 28%,var(--bg2));border-color:var(--op4)}
.switch input:checked+.switch-track::after{transform:translateX(20px);background:var(--op4)}
.switch input:focus-visible+.switch-track{outline:2px solid var(--focus);outline-offset:3px}
@media (prefers-reduced-motion:reduce){.switch-track,.switch-track::after{transition:none}}
@media (forced-colors:active){.switch input:checked+.switch-track{border-color:Highlight;background:Highlight}.switch input:checked+.switch-track::after{background:HighlightText}}
button.ghost.danger{border-color:var(--lose);color:var(--lose)}

/* ---- Guides ---- */
.g-top{display:flex;flex-direction:column;gap:10px;margin-bottom:14px}
.g-lbl{font-size:var(--fs-xs);font-weight:800;letter-spacing:1.4px;text-transform:uppercase;color:var(--muted)}
.searchbox{display:flex;align-items:center;gap:10px;background:var(--bg2);border:1px solid var(--edge);border-radius:12px;padding:0 14px;min-height:46px}
.searchbox:focus-within{outline:2px solid var(--focus);outline-offset:2px}
.searchbox svg{flex:0 0 auto;color:var(--muted)}
.searchbox input{flex:1 1 auto;min-width:0;border:none;background:none;padding:10px 0;min-height:44px;font-size:var(--fs-base);outline:none}
.searchbox input:focus-visible{outline:none}
.g-data{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.g-data .hint{margin:0;flex:1 1 220px}
.role-chips{display:flex;flex-wrap:wrap;gap:6px}
.g-layout{display:grid;grid-template-columns:minmax(260px,340px) 1fr;gap:18px;align-items:start}
html.surface-popup .g-layout{grid-template-columns:1fr}
html.surface-popup .g-layout .g-detail{display:none}
html.surface-popup .g-layout.g-open .g-list{display:none}
html.surface-popup .g-layout.g-open .g-detail{display:block}
.g-back{display:none;margin:0 0 10px}
html.surface-popup .g-layout.g-open .g-back{display:inline-flex}
.g-list{min-width:0}
.guide-results{max-height:none}
button.result{gap:10px;padding:8px 8px;border-radius:10px}
button.result .hero-art,button.result .item-art{flex:0 0 auto}
button.result .rtxt{display:flex;flex-direction:column;min-width:0;flex:1 1 auto}
button.result .rtxt .hn{flex:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
button.result .rtxt .muted{font-size:var(--fs-xs);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.g-browse h4{margin:14px 0 8px;font-size:var(--fs-xs);font-weight:800;letter-spacing:1.4px;text-transform:uppercase;color:var(--muted)}
.g-browse h4:first-child{margin-top:0}
.tiles{display:grid;grid-template-columns:repeat(auto-fill,minmax(88px,1fr));gap:8px}
.tile{display:flex;flex-direction:column;gap:6px;background:var(--card);border:1px solid var(--line);border-radius:10px;padding:6px;color:var(--ink);text-align:left}
.tile:hover,.tile:focus-visible{border-color:var(--op2)}
.tile .hero-art{width:100%;height:auto;aspect-ratio:256/144}
.tile span{font-size:var(--fs-xs);line-height:1.25;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.g-empty{padding:28px 18px;text-align:center;color:var(--muted);border:1px dashed var(--line);border-radius:14px}
.g-empty strong{display:block;color:var(--ink);margin-bottom:6px;font-size:var(--fs-base)}
.guide-body{padding:0;overflow:clip}   /* clip, not hidden: hidden makes this a scroll container and the sticky header then sits 102px down INSIDE it (seen in the render) */
.g-head{position:sticky;top:0;z-index:5;background:var(--card);padding:16px 18px 10px;border-bottom:1px solid var(--line);margin:0}
html.surface-full .g-head{top:calc(57px + 45px)}
.g-nav{display:flex;gap:6px;flex-wrap:wrap;margin-top:10px}
.g-nav button{background:none;border:1px solid var(--edge);color:var(--muted);border-radius:999px;padding:3px 11px;font-size:var(--fs-xs)}
.g-nav button:hover{color:var(--ink);border-color:var(--op2)}
.g-sec{margin:0;padding:16px 18px;border-bottom:1px solid var(--line)}
.g-sec:last-child{border-bottom:none}
.g-sec h4{margin:0 0 10px}
.g-lore{line-height:1.6;color:var(--ink);max-width:68ch}
.g-ability{display:grid;grid-template-columns:44px 1fr;gap:4px 12px;padding:12px 0;border-bottom:1px solid var(--line)}
.g-ability:last-of-type{border-bottom:none}
.g-ability .item-art{grid-row:1 / span 2;width:44px;height:44px;border-radius:10px;object-fit:cover}
.g-ability .row{margin:0;flex-wrap:wrap;gap:6px 10px}
.g-ability p{margin:0;grid-column:2;line-height:1.5}
.g-meta{display:flex;flex-wrap:wrap;gap:6px}
.g-meta span{font-size:var(--fs-xs);color:var(--muted);background:var(--bg2);border:1px solid var(--line);border-radius:999px;padding:1px 9px}
.talent-row{display:grid;grid-template-columns:62px 1fr;gap:12px;align-items:stretch;padding:6px 0;border:none}
.talent-row .lvl{display:flex;align-items:center;justify-content:center;border-radius:10px;background:var(--bg2);border:1px solid var(--line);font-weight:800;color:var(--ink);font-size:var(--fs-sm);letter-spacing:0;text-transform:none}
.talent-row .pair{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.talent-row .tal{display:flex;align-items:center;padding:8px 10px;border:1px solid var(--line);border-radius:10px;background:var(--card);font-size:var(--fs-sm);line-height:1.35}
html.surface-popup .talent-row .pair{grid-template-columns:1fr}
.phase{grid-template-columns:78px 1fr;border:none;padding:6px 0}

/* ---- Inventory page: a FULL page. Its header spans the viewport while its content is a centred 1100px column,
   so the header's inner edge is computed from the same column — the title and the first card share one left
   edge at every width (they did not: header at 24px, content column centred). ---- */
body.page .hdr{padding-left:max(14px,calc((100% - 1100px) / 2 + 14px));padding-right:max(14px,calc((100% - 1100px) / 2 + 14px))}
.wrap > .onboard{margin:14px 14px}

.g-sec{scroll-margin-top:170px}
html.surface-popup .g-head{top:56px}
html.surface-popup .g-sec{scroll-margin-top:150px}
