/* WPMable: shared styles for the dashboard and the toolbar popup.
   Deep navy, one blue accent (Gus's mockup, 10-04). Dark only.
   No bubbles since 10-05 (Gus: "less vibe-coded"): panels are flat plates with one cut corner
   (top right) and a hairline edge that follows the cut, controls are square, type is Archivo
   with its wide cut for headings and big numbers. */
:root {
  --font: "Archivo", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --display: var(--font);
  --wide: 116%; /* font-stretch for headings and big numbers */
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --bg: #0a0d14; --side: #0b0f17; --card: #10161f; --card2: #131a26; --pop: rgba(16, 22, 33, .96);
  --fg: #eef2f8; --fg2: #9aa5b7; --fg3: #646f82;
  --line: rgba(150, 172, 212, .1); --line2: rgba(150, 172, 212, .18); --line3: rgba(150, 172, 212, .3); --sep: var(--line); --win: var(--card);
  --fill: rgba(150, 172, 212, .06); --fill2: rgba(150, 172, 212, .1); --fill3: rgba(150, 172, 212, .2);
  --accent: #4f8dff; --accent2: #86b2ff; --accent-soft: rgba(79, 141, 255, .16);
  --green: #3ddc84; --red: #ff5d6c; --orange: #ffa24a; --yellow: #ffd45e; --pink: #ff5c8a; --purple: #b18cff;
  --teal: #4fd8d0; --indigo: #7d7eff; --cyan: #5ccfff; --gray: #8a94a6;
  --heat0: rgba(150, 172, 212, .05);
  --sh-card: none;
  --sh-pop: inset 0 0 0 1px var(--line2);
  --seg-on: rgba(150, 172, 212, .17); --seg-sh: none;
  --btn: rgba(150, 172, 212, .11); --btn-sh: none;
  --sw-off: rgba(150, 172, 212, .22);
  --wall-a: #16233f; --wall-b: #1e2a4d; --wall-c: #2a2448;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 13px/1.4 var(--font); color: var(--fg); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent2); text-decoration: none; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--fg2); }
[hidden] { display: none !important; }
::selection { background: rgba(79, 141, 255, .35); }

/* ───────── plates ─────────
   One shape for every container: square, the top-right corner cut at 45°. The edge is an inset
   hairline plus a 1px band on the diagonal (a 225° gradient measures from that corner).
   Set --cut for size, --edge for the line colour, --plate for the fill. */
.plate, .panel, .card, .list, .sheet, #tip {
  --cut: 14px; --edge: var(--line2);
  border: 0; border-radius: 0;
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, 0 100%);
  background: linear-gradient(225deg, var(--edge) calc(var(--cut) * .7071 + 1px), transparent 0), var(--plate, var(--card));
  box-shadow: inset 0 0 0 1px var(--edge);
}
/* small filled shapes (buttons, chips, avatars) share the cut without an edge */
.btn, .chip, .tag {
  --cut: 7px;
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, 0 100%);
}

/* ───────── controls ───────── */
/* segmented choices read as tabs: words on a hairline, the chosen one underlined */
.seg { display: inline-flex; gap: 18px; padding: 0; background: none; box-shadow: inset 0 -1px 0 var(--line2); }
.seg button { position: relative; border: 0; background: transparent; padding: 0 1px; height: 30px; border-radius: 0; font-size: 13px; font-weight: 500; color: var(--fg2); cursor: pointer; white-space: nowrap; transition: color .15s, box-shadow .2s var(--ease); }
@media (hover: hover) { .seg button:hover:not(.on) { color: var(--fg); } }
.seg button.on { color: var(--fg); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }
.sw { position: relative; width: 38px; height: 20px; flex: none; appearance: none; -webkit-appearance: none; background: var(--sw-off); border-radius: 0; cursor: pointer; margin: 0; transition: background .2s; }
.sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; background: #d9e1ee; transition: transform .22s var(--ease), background .2s; }
.sw:checked { background: var(--accent); }
.sw:checked::after { transform: translateX(18px); background: #fff; }
.sw:focus-visible, .seg button:focus-visible { outline: 2px solid var(--accent2); outline-offset: 3px; }
.btn { height: 32px; padding: 0 16px; border: 0; border-radius: 0; background: var(--btn); box-shadow: none; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: background .15s, transform .1s; }
@media (hover: hover) { .btn:hover { background: var(--fill3); } }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: default; }
.btn:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--accent2); }
.btn.pri { background: var(--accent); color: #fff; }
@media (hover: hover) { .btn.pri:hover { background: #64a0ff; } }
.btn.pri:focus-visible { box-shadow: inset 0 0 0 2px #fff; }
.btn.danger { color: var(--red); }
.btn.subtle { background: transparent; color: var(--fg2); clip-path: none; }
@media (hover: hover) { .btn.subtle:hover { color: var(--fg); background: var(--fill); } }
.btn.big { --cut: 9px; height: 38px; padding: 0 22px; font-size: 14px; }
.btn.sq { width: 32px; padding: 0; }
.stepper { display: inline-flex; align-items: center; background: var(--fill); box-shadow: inset 0 0 0 1px var(--line2); border-radius: 0; padding: 0; }
.stepper button { width: 32px; height: 30px; border: 0; border-radius: 0; background: transparent; cursor: pointer; font-size: 15px; line-height: 1; color: var(--fg2); transition: background .15s, color .15s; }
@media (hover: hover) { .stepper button:hover { background: var(--fill2); color: var(--fg); } }
.stepper output { min-width: 76px; height: 30px; display: grid; place-items: center; font-weight: 600; font-variant-numeric: tabular-nums; box-shadow: inset 1px 0 0 var(--line2), inset -1px 0 0 var(--line2); }
.field { height: 34px; border-radius: 0; border: 0; background: var(--fill); box-shadow: inset 0 0 0 1px var(--line2); padding: 0 11px; min-width: 220px; outline: none; transition: box-shadow .15s; }
.field::placeholder { color: var(--fg3); }
.field:focus { box-shadow: inset 0 0 0 1px var(--accent), inset 0 -2px 0 var(--accent); }

/* ───────── tooltip ───────── */
#tip { --cut: 8px; --plate: var(--pop); position: fixed; z-index: 60; pointer-events: none; -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); padding: 8px 12px; font-size: 12px; line-height: 1.4; opacity: 0; transform: translateY(3px); transition: opacity .12s, transform .12s; max-width: 280px; }
#tip.on { opacity: 1; transform: none; }
#tip b { display: block; font-weight: 600; }
#tip span { display: block; color: var(--fg2); font-variant-numeric: tabular-nums; }

/* ───────── charts ───────── */
.chart { width: 100%; min-height: 40px; }
.ch { display: block; overflow: visible; }
.ch .gl { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 4; }
.ch .gl.base { stroke-dasharray: none; stroke: var(--line2); }
.ch .ax { fill: var(--fg3); font-size: 11px; font-variant-numeric: tabular-nums; }
.ch .ax.mo { fill: var(--fg2); font-size: 13px; }
.ch .xl { fill: var(--fg3); font-size: 11px; text-anchor: middle; }
.ch .xl.hi { fill: var(--fg); font-weight: 600; }
.ch .bar { transition: opacity .15s; }
@media (hover: hover) { .ch:hover .col .bar { opacity: .4; } }
@media (hover: hover) { .ch .col:hover .bar { opacity: 1; } }
.ch .avg { stroke: var(--accent2); stroke-width: 1.5; stroke-dasharray: 5 4; opacity: .8; }
.ch .avgt { fill: var(--accent2); font-size: 11px; font-weight: 600; }
.ch .dot { stroke: var(--card); stroke-width: 2; }
.ch .hov { opacity: 0; transition: opacity .1s; }
@media (hover: hover) { .ch .col:hover .hov { opacity: 1; } }
.ch .cell { transition: transform .15s var(--ease), filter .15s; transform-box: fill-box; transform-origin: center; }
@media (hover: hover) { .ch .cell:hover { transform: scale(1.2); filter: brightness(1.15); } }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--fg2); }
.legend i { display: inline-block; width: 8px; height: 8px; margin-right: 6px; vertical-align: 0; }
.legend i.dash { width: 12px; height: 0; border-top: 2px dashed; vertical-align: 3px; }

/* ───────── medals ───────── */
.ks-medal { display: block; }
.medal { text-align: center; padding: 8px 4px; transition: background .2s; }
@media (hover: hover) { .medal:hover { background: var(--fill); } }
.medal .art { display: inline-block; transition: transform .3s var(--ease); }
@media (hover: hover) { .medal:hover .art { transform: translateY(-3px); } }
.medal.locked .art { filter: grayscale(1) opacity(.3); }
.medal b { display: block; font-size: 13px; font-weight: 600; margin-top: 8px; }
.medal small { display: block; color: var(--fg2); font-size: 12px; margin-top: 1px; font-variant-numeric: tabular-nums; }
.mini-bar { height: 3px; background: var(--fill2); margin: 7px auto 0; width: 70%; overflow: hidden; }
.mini-bar i { display: block; height: 100%; background: var(--accent); }

/* the level number: an outlined plate in the accent, no gradient tile */
.lvl-badge { --cut: 9px; width: 44px; height: 44px; display: grid; place-items: center; flex: none; font: 700 19px/1 var(--font); font-stretch: var(--wide); font-variant-numeric: tabular-nums; color: var(--fg);
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, 0 100%);
  background: linear-gradient(225deg, var(--accent) calc(var(--cut) * .7071 + 1.5px), transparent 0), var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }
.xp-bar { position: relative; height: 4px; background: var(--fill2); overflow: hidden; }
.xp-bar i { position: relative; display: block; height: 100%; background: var(--accent); transition: width .9s var(--ease); }
@keyframes sheen { 0% { transform: translateX(-100%); } 55%, 100% { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ───────── logo (10-06): the W| plate + "WPMable" with WPM set heavy ───────── */
.ks-brand { display: inline-flex; align-items: center; gap: 11px; color: var(--fg); }
.ks-brand .ks-icon { display: block; flex: none; }
.ks-name { font-family: var(--display); font-stretch: var(--wide); font-weight: 500; letter-spacing: -.015em; color: var(--fg2); white-space: nowrap; }
.ks-name b { font-weight: 800; color: var(--fg); }
a:hover .ks-caret, a:focus-visible .ks-caret { animation: ks-blink 1.06s steps(1) infinite; }
@keyframes ks-blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { a:hover .ks-caret, a:focus-visible .ks-caret { animation: none; } }
