/* McKarts web panel. No external resources: fonts and images ship inside the plugin. */

/* ------------------------------------------------------------------ fonts (SIL OFL, see fonts/) */
@font-face { font-family: "Saira"; font-style: normal; font-display: swap; font-weight: 100 900; font-stretch: 50% 125%;
  src: url(fonts/saira-latin-wdth-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Saira"; font-style: normal; font-display: swap; font-weight: 100 900; font-stretch: 50% 125%;
  src: url(fonts/saira-latin-ext-wdth-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Plex"; font-style: normal; font-display: swap; font-weight: 100 700; font-stretch: 85% 100%;
  src: url(fonts/ibm-plex-sans-latin-wdth-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Plex"; font-style: normal; font-display: swap; font-weight: 100 700; font-stretch: 85% 100%;
  src: url(fonts/ibm-plex-sans-latin-ext-wdth-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Plex"; font-style: normal; font-display: swap; font-weight: 100 700; font-stretch: 85% 100%;
  src: url(fonts/ibm-plex-sans-cyrillic-wdth-normal.woff2) format("woff2");
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: "Plex"; font-style: normal; font-display: swap; font-weight: 100 700; font-stretch: 85% 100%;
  src: url(fonts/ibm-plex-sans-cyrillic-ext-wdth-normal.woff2) format("woff2");
  unicode-range: U+0460-052F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F; }
@font-face { font-family: "Plex"; font-style: normal; font-display: swap; font-weight: 100 700; font-stretch: 85% 100%;
  src: url(fonts/ibm-plex-sans-greek-wdth-normal.woff2) format("woff2");
  unicode-range: U+0370-0377,U+037A-037F,U+0384-038A,U+038C,U+038E-03A1,U+03A3-03FF; }
@font-face { font-family: "Plex Mono"; font-style: normal; font-display: swap; font-weight: 400;
  src: url(fonts/ibm-plex-mono-latin-400-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Plex Mono"; font-style: normal; font-display: swap; font-weight: 400;
  src: url(fonts/ibm-plex-mono-latin-ext-400-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Plex Mono"; font-style: normal; font-display: swap; font-weight: 400;
  src: url(fonts/ibm-plex-mono-cyrillic-400-normal.woff2) format("woff2");
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: "Plex Mono"; font-style: normal; font-display: swap; font-weight: 600;
  src: url(fonts/ibm-plex-mono-latin-600-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

/* ------------------------------------------------------------------ tokens */
:root {
  --font-ui: "Plex", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Saira", "Plex", system-ui, sans-serif;
  --font-mono: "Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* light: "pit garage" */
  --bg: #eceef2;
  --surface: #ffffff;
  --surface-2: #f5f6f9;
  --sunken: #e3e6ec;
  --line: #d3d8e1;
  --line-strong: #b4bcc9;
  --ink: #121620;
  --ink-2: #353d4d;
  --muted: #5a6376;
  /* brand "Plakette": signal orange #ff5a1f, ink #14161d, cream #f5efe4. Text needs a darker orange on light ground. */
  --signal: #ff5a1f;
  --cream: #f5efe4;
  --brand: #c2410c;
  --brand-hover: #a8360a;
  --brand-ink: #ffffff;
  --brand-soft: #fde9df;
  --kerb: #d42a24;
  --ok: #12764a;
  --ok-soft: #ddf3e8;
  --warn: #8f5d00;
  --warn-soft: #fbefd6;
  --bad: #bf2229;
  --bad-soft: #fbe3e3;
  --best: #7436d6;
  --best-soft: #efe5fd;
  --focus: #c2410c;
  --shadow: 0 1px 2px rgba(18, 22, 32, .06), 0 6px 20px -8px rgba(18, 22, 32, .18);
  --shadow-pop: 0 10px 40px -10px rgba(18, 22, 32, .35);

  /* the rail is asphalt in both themes */
  --rail-bg: #141925;
  --rail-ink: #e6e9f1;
  --rail-muted: #97a0b4;
  --rail-hover: #1e2433;
  --rail-line: #262d3d;

  /* track map */
  --map-bg: #dfe4ea;
  --map-grid: rgba(30, 40, 60, .08);
  --map-grid-major: rgba(30, 40, 60, .15);
  --road: #4a5163;
  --road-edge: #2c313d;
  --road-mark: rgba(255, 255, 255, .7);
  --gate: #2747d8;
  --slot: #12764a;
  --itembox: #c27400;
  --pin: #121620;

  --radius-s: 6px;
  --radius: 10px;
  --radius-l: 16px;
  --rail-w: 252px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1219; --surface: #161b25; --surface-2: #1b2130; --sunken: #0b0e14; --line: #272f40; --line-strong: #3a4459;
    --ink: #e8ebf2; --ink-2: #c4cad7; --muted: #8e97aa;
    --brand: #ff6a33; --brand-hover: #ff8a5c; --brand-ink: #14161d; --brand-soft: #3a1e12;
    --kerb: #ff5148; --ok: #3ed48c; --ok-soft: #12291f; --warn: #f2b53a; --warn-soft: #2c2312; --bad: #ff6b6e; --bad-soft: #321619;
    --best: #b68cff; --best-soft: #261b3d; --focus: #ff8a5c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -10px rgba(0, 0, 0, .6);
    --shadow-pop: 0 12px 48px -12px rgba(0, 0, 0, .8);
    --rail-bg: #0a0d13; --rail-hover: #151a25; --rail-line: #1c2230;
    --map-bg: #121722; --map-grid: rgba(200, 210, 240, .05); --map-grid-major: rgba(200, 210, 240, .1);
    --road: #39404f; --road-edge: #1a1f2a; --road-mark: rgba(255, 255, 255, .55);
    --gate: #7189ff; --slot: #3ed48c; --itembox: #f2b53a; --pin: #e8ebf2;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1219; --surface: #161b25; --surface-2: #1b2130; --sunken: #0b0e14; --line: #272f40; --line-strong: #3a4459;
  --ink: #e8ebf2; --ink-2: #c4cad7; --muted: #8e97aa;
  --brand: #ff6a33; --brand-hover: #ff8a5c; --brand-ink: #14161d; --brand-soft: #3a1e12;
  --kerb: #ff5148; --ok: #3ed48c; --ok-soft: #12291f; --warn: #f2b53a; --warn-soft: #2c2312; --bad: #ff6b6e; --bad-soft: #321619;
  --best: #b68cff; --best-soft: #261b3d; --focus: #ff8a5c;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -10px rgba(0, 0, 0, .6);
  --shadow-pop: 0 12px 48px -12px rgba(0, 0, 0, .8);
  --rail-bg: #0a0d13; --rail-hover: #151a25; --rail-line: #1c2230;
  --map-bg: #121722; --map-grid: rgba(200, 210, 240, .05); --map-grid-major: rgba(200, 210, 240, .1);
  --road: #39404f; --road-edge: #1a1f2a; --road-mark: rgba(255, 255, 255, .55);
  --gate: #7189ff; --slot: #3ed48c; --itembox: #f2b53a; --pin: #e8ebf2;
  color-scheme: dark;
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--ink); font: 400 15px/1.55 var(--font-ui); font-stretch: 100%;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
[hidden] { display: none !important; }
img, svg { display: block; max-width: 100%; }
a { color: var(--brand); text-underline-offset: .18em; }
a:hover { color: var(--brand-hover); }
code, kbd { font-family: var(--font-mono); font-size: .86em; }
::selection { background: var(--brand); color: var(--brand-ink); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 100; background: var(--brand); color: var(--brand-ink);
  padding: .5rem .9rem; border-radius: var(--radius-s); font-weight: 600; text-decoration: none; }
.skip:focus { top: 12px; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; margin: 0; letter-spacing: -.005em; }

/* the wordmark is an SVG mask, so it takes the text colour of its place; its box is the cap height
   (tools/web_logo.py prints the aspect ratio). Next to the mark it is half as high as the mark. */
.wordmark { display: inline-block; height: 19px; aspect-ratio: 752.4 / 102.4; background: currentColor;
  -webkit-mask: url(img/wordmark.svg) no-repeat center / contain; mask: url(img/wordmark.svg) no-repeat center / contain; }
.wordmark-xl { height: 40px; }

/* ------------------------------------------------------------------ buttons and fields */
.btn { font: 500 14px/1 var(--font-ui); display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 36px; padding: 0 .9rem; border-radius: var(--radius-s); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .12s, border-color .12s, color .12s; }
.btn:hover { border-color: var(--ink-2); color: var(--ink); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: var(--brand-ink); }
.btn-danger { color: var(--bad); }
.btn-danger:hover { border-color: var(--bad); color: var(--bad); background: var(--bad-soft); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-quiet:hover { background: var(--sunken); border-color: transparent; }
.btn-icon { width: 36px; padding: 0; background: transparent; border-color: transparent; color: inherit; }
.btn-icon:hover { background: var(--sunken); border-color: transparent; color: inherit; }
.btn-small { min-height: 30px; padding: 0 .65rem; font-size: 13px; }
.btn-block { width: 100%; min-height: 44px; font-size: 15px; }
.btn[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-s); min-height: 36px; padding: .35rem .6rem; width: 100%; }
input:hover, select:hover, textarea:hover { border-color: var(--ink-2); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--bad); background: var(--bad-soft); }
input[type="number"] { font-variant-numeric: tabular-nums; }
input[readonly] { background: var(--sunken); color: var(--muted); }
select { padding-right: 1.8rem; appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(-45deg, transparent 50%, var(--muted) 50%);
  background-position: right .85rem center, right .55rem center; background-size: 5px 5px; background-repeat: no-repeat; }
.select-quiet { width: auto; min-height: 32px; border-color: transparent; background-color: transparent; color: inherit; font-size: 13px; }
.select-quiet:hover { border-color: currentColor; }
.select-quiet option { color: #121620; background: #fff; }
textarea { font: 13px/1.6 var(--font-mono); tab-size: 2; white-space: pre; resize: vertical; }
.field { display: grid; gap: .3rem; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.form-error { color: var(--bad); margin: 0; min-height: 1.4em; font-size: 14px; }

/* switch: a checkbox styled as a toggle */
.switch { appearance: none; width: 40px; height: 24px; min-height: 0; padding: 0; border-radius: 999px; position: relative; cursor: pointer;
  background: var(--line-strong); border: 0; transition: background-color .15s; flex: none; }
.switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: transform .15s; }
.switch:checked { background: var(--ok); }
.switch:checked::after { transform: translateX(16px); }
.switch:hover { background: var(--muted); }
.switch:checked:hover { background: var(--ok); filter: brightness(1.08); }

/* chips */
.chip { display: inline-flex; align-items: center; gap: .35rem; font: 600 12px/1 var(--font-ui); padding: .32rem .55rem;
  border-radius: 999px; background: var(--sunken); color: var(--ink-2); white-space: nowrap; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .9; }
.chip.plain::before { display: none; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.best { background: var(--best-soft); color: var(--best); }
.chip.brand { background: var(--brand-soft); color: var(--brand); }
.chip.live::before { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }

/* ------------------------------------------------------------------ login */
.login { min-height: 100vh; min-height: 100dvh; position: relative; overflow: hidden; display: grid; place-items: center;
  padding: 2rem 1rem; background: var(--rail-bg); color: var(--rail-ink); }
.login-line { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; }
.login-line path { fill: none; }
.login-line .road { stroke: #1d2434; stroke-width: 80; stroke-linecap: butt; }
.login-line .kerb-a { stroke: var(--cream); stroke-width: 12; }
.login-line .kerb-b { stroke: var(--signal); stroke-width: 12; stroke-dasharray: 22 22; }
.login-line .line { stroke: var(--signal); stroke-width: 3; stroke-dasharray: 2600; stroke-dashoffset: 2600; animation: draw 2.4s .2s cubic-bezier(.6, .1, .2, 1) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.login-inner { position: relative; z-index: 1; width: min(980px, 100%); display: grid; grid-template-columns: 1.1fr 1fr; gap: 3rem; align-items: center; }
.login-brand { display: grid; gap: 1.1rem; justify-items: start; }
.login-brand .wordmark { color: var(--cream); }
.login-tagline { font: 500 1.05rem/1.5 var(--font-ui); color: var(--rail-muted); margin: 0; max-width: 28ch; }
.login-card { background: var(--surface); color: var(--ink); border-radius: var(--radius-l); padding: 1.8rem; display: grid; gap: 1rem; box-shadow: var(--shadow-pop); }
.login-card h1 { font-size: 1.6rem; font-stretch: 112%; font-weight: 750; }
.login-card p { margin: 0; }
.or { display: grid; grid-template-columns: 1fr auto 1fr; gap: .7rem; align-items: center; color: var(--muted); font-size: 13px; }
.or::before, .or::after { content: ""; height: 1px; background: var(--line); }
.login-foot { display: flex; justify-content: space-between; align-items: center; gap: .5rem; color: var(--ink-2); }
@media (max-width: 760px) {
  .login-inner { grid-template-columns: 1fr; gap: 1.6rem; }
  .login-brand { justify-items: center; text-align: center; }
  .wordmark-xl { height: 30px; }
  .login-card { padding: 1.3rem; }
}

/* ------------------------------------------------------------------ shell */
.shell { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); min-height: 100vh;
  background: linear-gradient(90deg, var(--rail-bg) calc(var(--rail-w) - 5px), transparent 0); }
.rail { position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; background: var(--rail-bg);
  color: var(--rail-ink); padding: 1rem .75rem .75rem; overflow-y: auto; overscroll-behavior: contain; }
/* the kerb along the edge of the rail in the brand colours: the one loud element of the chrome */
.rail::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 5px;
  background: repeating-linear-gradient(180deg, var(--signal) 0 18px, var(--cream) 18px 36px); }
.rail-head { display: flex; align-items: center; justify-content: space-between; padding: .2rem .4rem 1.2rem; }
.brand { display: inline-flex; align-items: center; gap: .5rem; color: inherit; text-decoration: none; }
.brand:hover { color: inherit; }
.brand .wordmark { height: 17px; }
.rail-close { display: none; color: var(--rail-ink); }
.nav { display: grid; gap: 1.1rem; flex: 1; align-content: start; padding-right: 5px; }
.nav-group { display: grid; gap: 1px; }
.nav-title { font: 600 12px/1 var(--font-ui); color: var(--rail-muted); padding: 0 .65rem .45rem; }
.nav a { display: flex; align-items: center; gap: .7rem; padding: .52rem .65rem; border-radius: var(--radius-s); color: var(--rail-ink);
  text-decoration: none; font-size: 14px; font-weight: 500; position: relative; }
.nav a svg { width: 18px; height: 18px; color: var(--rail-muted); flex: none; }
.nav a:hover { background: var(--rail-hover); }
.nav a[aria-current="page"] { background: var(--rail-hover); font-weight: 600; }
.nav a[aria-current="page"]::before { content: ""; position: absolute; left: -.75rem; top: 6px; bottom: 6px; width: 3px; border-radius: 0 3px 3px 0; background: var(--signal); }
.nav a[aria-current="page"] svg { color: #ff9a70; }
.nav .badge { margin-left: auto; font: 600 11px/1 var(--font-ui); background: #d42a24; color: #fff; border-radius: 999px; padding: .2rem .45rem; }
.rail-foot { border-top: 1px solid var(--rail-line); padding: .8rem .2rem 0; margin-right: 5px; display: grid; gap: .5rem; }
.server-line { font-size: 12px; color: var(--rail-muted); padding: 0 .45rem; line-height: 1.45; }
.server-line strong { color: var(--rail-ink); font-weight: 600; }
.rail-tools { display: flex; align-items: center; gap: .2rem; }
.rail-tools select { flex: 1; color: var(--rail-ink); }
.rail .btn-icon { color: var(--rail-ink); }
.rail .btn-icon:hover { background: var(--rail-hover); }
.stage { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
main { padding: 2rem clamp(1rem, 3vw, 2.6rem) 4rem; width: 100%; max-width: 1320px; outline: none; }
.scrim { position: fixed; inset: 0; background: rgba(5, 8, 14, .55); z-index: 40; }

@media (max-width: 980px) {
  .shell { grid-template-columns: minmax(0, 1fr); background: none; }
  .rail { position: fixed; z-index: 50; left: 0; top: 0; width: min(300px, 86vw); transform: translateX(-102%); transition: transform .22s ease; }
  .rail.open { transform: none; box-shadow: var(--shadow-pop); }
  .rail-close { display: inline-flex; }
  .topbar { display: flex; align-items: center; gap: .5rem; position: sticky; top: 0; z-index: 30; padding: .5rem .75rem;
    background: var(--rail-bg); color: var(--rail-ink); border-bottom: 4px solid transparent;
    border-image: repeating-linear-gradient(90deg, var(--signal) 0 18px, var(--cream) 18px 36px) 4; }
  .topbar .btn-icon { color: var(--rail-ink); }
  .topbar .btn-icon:hover { background: var(--rail-hover); }
  .brand-small .wordmark { height: 14px; }
  main { padding-top: 1.3rem; }
}

/* ------------------------------------------------------------------ page parts */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem 1.5rem; margin-bottom: 1.6rem; }
.page-head h1 { font-size: clamp(1.7rem, 2.6vw, 2.25rem); font-weight: 760; font-stretch: 116%; }
.page-head p { margin: .35rem 0 0; color: var(--muted); max-width: 70ch; }
.page-head .actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.crumb { display: inline-flex; align-items: center; gap: .3rem; font-size: 13px; font-weight: 600; color: var(--muted); text-decoration: none; margin-bottom: .5rem; }
.crumb svg { width: 15px; height: 15px; }
.crumb:hover { color: var(--ink); }
.section { margin-top: 2.2rem; }
.section > h2, .section-head h2 { font-size: 1.2rem; font-weight: 700; font-stretch: 108%; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .9rem; flex-wrap: wrap; }
.section > h2 { margin-bottom: .9rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-pad { padding: 1.1rem 1.2rem; }
.empty { border: 1.5px dashed var(--line-strong); border-radius: var(--radius); padding: 1.6rem; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-size: 1.05rem; margin-bottom: .25rem; }
.empty code { background: var(--sunken); padding: .1rem .35rem; border-radius: 4px; color: var(--ink-2); }
.cols { display: grid; gap: 1.2rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); align-items: start; }

/* status strip: one band split by rules, not a wall of cards */
.strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.strip > div { padding: 1rem 1.15rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 0 -1px -1px 0; min-width: 0; }
.strip dt { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.strip dd { margin: .2rem 0 0; font: 650 1.45rem/1.2 var(--font-display); font-stretch: 92%; font-variant-numeric: tabular-nums;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strip dd small { font: 500 13px var(--font-ui); color: var(--muted); margin-left: .25rem; }
.strip dd small.below { display: block; margin: .15rem 0 0; font-size: 12.5px; white-space: normal; }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: .65rem .9rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12.5px; font-weight: 600; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
td.r, th.r { text-align: right; }
td.time { font: 600 15px var(--font-display); font-stretch: 85%; font-variant-numeric: tabular-nums; }
td.time.best { color: var(--best); }

/* bars */
.bar { height: 6px; border-radius: 3px; background: var(--sunken); overflow: hidden; min-width: 60px; }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 3px; width: 0; transition: width .4s ease; }

/* toasts */
.toasts { position: fixed; right: 1rem; bottom: 1rem; z-index: 90; display: grid; gap: .5rem; justify-items: end; pointer-events: none; }
.toast { pointer-events: auto; background: var(--ink); color: var(--bg); padding: .75rem 1rem; border-radius: var(--radius); box-shadow: var(--shadow-pop);
  max-width: min(30rem, calc(100vw - 2rem)); font-size: 14px; display: flex; gap: .6rem; align-items: flex-start; animation: toast-in .2s ease; }
.toast.bad { background: var(--bad); color: #fff; }
.toast svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* problem list */
.problems { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .4rem; }
.problems li { display: grid; grid-template-columns: auto 1fr; gap: .2rem .7rem; padding: .65rem .8rem; border-radius: var(--radius-s);
  background: var(--bad-soft); border-left: 3px solid var(--bad); font-size: 14px; }
.problems li.warn { background: var(--warn-soft); border-color: var(--warn); }
.problems li > strong { color: var(--bad); }
.problems li.warn > strong { color: var(--warn); }
.problems .where { grid-column: 2; font-size: 12.5px; color: var(--ink-2); }
.problems button.where { background: none; border: 0; padding: 0; text-align: left; cursor: pointer; text-decoration: underline; text-underline-offset: .15em; font: inherit; font-size: 12.5px; color: var(--ink-2); }
.result-ok { display: flex; align-items: center; gap: .5rem; color: var(--ok); font-weight: 600; margin: 0 0 1rem; }
.result-ok svg { width: 18px; height: 18px; }

/* tooltips: a small info button that shows the help text of a setting */
.tip { position: relative; display: inline-flex; }
.tip > button { width: 22px; height: 22px; min-height: 0; padding: 0; border-radius: 50%; border: 0; background: transparent; color: var(--muted); cursor: help; display: inline-grid; place-items: center; }
.tip > button:hover, .tip > button[aria-expanded="true"] { color: var(--brand); background: var(--brand-soft); }
.tip > button svg { width: 16px; height: 16px; }
.tip [role="tooltip"] { position: absolute; z-index: 20; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); width: max-content; max-width: min(340px, 80vw);
  background: var(--ink); color: var(--bg); font-size: 13px; line-height: 1.5; font-weight: 400; padding: .6rem .75rem; border-radius: var(--radius-s);
  box-shadow: var(--shadow-pop); display: none; pointer-events: none; white-space: normal; text-transform: none; letter-spacing: 0; font-family: var(--font-ui); }
.tip:hover [role="tooltip"], .tip > button:focus-visible + [role="tooltip"], .tip > button[aria-expanded="true"] + [role="tooltip"] { display: block; animation: tip-in .12s ease; }
@keyframes tip-in { from { opacity: 0; } }
.tip.left [role="tooltip"] { left: 0; transform: none; }

/* segmented control */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--sunken); border-radius: 8px; }
.seg button { border: 0; background: transparent; font: 500 13px var(--font-ui); color: var(--ink-2); padding: .4rem .8rem; border-radius: 6px; cursor: pointer; min-height: 30px; }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); font-weight: 600; }

/* ------------------------------------------------------------------ overview */
.hero-race { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 0; overflow: hidden; }
.hero-race .map-box { min-height: 260px; border-right: 1px solid var(--line); }
.todo { list-style: none; margin: 0; padding: 0; display: grid; }
.todo li { display: flex; gap: .8rem; align-items: flex-start; padding: .8rem 1.1rem; border-bottom: 1px solid var(--line); }
.todo li:last-child { border-bottom: 0; }
.todo li svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.todo li.warn svg { color: var(--warn); }
.todo li.bad svg { color: var(--bad); }
.todo li.ok svg { color: var(--ok); }
.todo a { font-weight: 600; }
.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: .8rem; }
.quick a { display: grid; gap: .2rem; padding: 1rem 1.1rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
  color: var(--ink); text-decoration: none; box-shadow: var(--shadow); position: relative; }
.quick a:hover { border-color: var(--brand); }
.quick a strong { font: 700 1.02rem var(--font-display); font-stretch: 108%; }
.quick a span { font-size: 13.5px; color: var(--muted); }
.quick a svg { width: 22px; height: 22px; color: var(--brand); margin-bottom: .4rem; }

/* ------------------------------------------------------------------ live */
.race { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, 1fr); overflow: hidden; }
.race + .race { margin-top: 1.4rem; }
.race-head { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .6rem 1.2rem; align-items: center; padding: .9rem 1.15rem; border-bottom: 1px solid var(--line); }
.race-head h2 { font-size: 1.3rem; font-weight: 720; font-stretch: 110%; }
.race-head .clock { font: 650 1.5rem/1 var(--font-display); font-stretch: 80%; font-variant-numeric: tabular-nums; margin-left: auto; }
.race-head .actions { display: flex; gap: .4rem; }
.race .map-box { border-right: 1px solid var(--line); min-height: 320px; }
.tower { list-style: none; margin: 0; padding: .35rem 0; }
.tower li { display: grid; grid-template-columns: 2.2rem minmax(0, 1fr) auto auto; gap: .2rem .8rem; align-items: center; padding: .5rem 1.1rem; border-bottom: 1px solid var(--line); }
.tower li:last-child { border-bottom: 0; }
.tower .pos { font: 750 1.25rem/1 var(--font-display); font-stretch: 80%; text-align: center; color: var(--ink-2); }
.tower li:first-child .pos { color: var(--brand); }
.tower .who { min-width: 0; }
.tower .who strong { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tower .who span { font-size: 12.5px; color: var(--muted); }
.tower .lap { font: 600 14px var(--font-display); font-stretch: 85%; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tower .t { font: 650 15px var(--font-display); font-stretch: 82%; font-variant-numeric: tabular-nums; min-width: 4.8rem; text-align: right; }
.tower .t.best { color: var(--best); }
.tower .done { color: var(--ok); }
.racer-dot circle { transition: cx .9s linear, cy .9s linear; }
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: 12.5px; color: var(--muted); padding: .6rem 1.1rem; border-top: 1px solid var(--line); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: .35rem; vertical-align: -1px; }
.legend i.best { background: var(--best); }
.legend i.ok { background: var(--ok); }

/* ------------------------------------------------------------------ track map (shared) */
.map-box { position: relative; background: var(--map-bg); min-height: 240px; overflow: hidden; }
.map-box svg.map { width: 100%; height: 100%; position: absolute; inset: 0; touch-action: none; user-select: none; -webkit-user-select: none; }
.map .road { fill: none; stroke: var(--road); stroke-linejoin: round; stroke-linecap: round; }
.map .road-edge { fill: none; stroke: var(--road-edge); stroke-linejoin: round; stroke-linecap: round; }
.map .road-mark { fill: none; stroke: var(--road-mark); }
.map .gridline { stroke: var(--map-grid); }
.map .gridline.major { stroke: var(--map-grid-major); }
.map .gate-line { stroke: var(--gate); stroke-linecap: round; }
.map .sel-glow { stroke: var(--kerb); opacity: .3; stroke-linecap: round; pointer-events: none; }
.map .sel-line { stroke: var(--kerb); fill: none; pointer-events: none; }
.map .gate-hit { stroke: transparent; stroke-linecap: round; cursor: grab; }
.map .cpbox { fill: color-mix(in srgb, var(--gate) 18%, transparent); stroke: var(--gate); stroke-dasharray: 4 3; cursor: grab; }
.map .badge circle { fill: var(--gate); }
.map .badge text { fill: #fff; font: 700 11px var(--font-ui); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.map .badge.finish circle { fill: var(--ink); }
.map .badge.finish text { fill: var(--bg); }
.map .arrow { fill: var(--gate); pointer-events: none; }
.map .slot { cursor: grab; }
.map .slot path { fill: var(--slot); stroke: var(--surface); stroke-width: 1.5; }
.map .slot text { fill: #fff; font: 700 9px var(--font-ui); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.map .ibox rect { fill: var(--itembox); stroke: var(--surface); stroke-width: 1.5; }
.map .ibox { cursor: grab; }
.map .pin path { fill: var(--pin); }
.map .pin text { fill: var(--bg); font: 700 10px var(--font-ui); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.map .pin { cursor: grab; }
.map .sel { stroke: var(--kerb); stroke-width: 2; fill: none; stroke-dasharray: 4 3; pointer-events: none; }
.map .handle { fill: var(--surface); stroke: var(--kerb); stroke-width: 2; cursor: grab; }
.map .handle.rot { cursor: alias; }
.map .ghost circle { fill: var(--kerb); stroke: #fff; stroke-width: 2; }
.map .racer circle { stroke: #fff; stroke-width: 2.5; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .45)); }
.map .racer text { fill: #fff; font: 700 11px var(--font-ui); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.map.dragging, .map.dragging * { cursor: grabbing !important; }
.map.panning { cursor: move; }
.map-tools { position: absolute; right: .6rem; top: .6rem; display: grid; gap: 1px; background: var(--line); border-radius: 8px; overflow: hidden; box-shadow: var(--shadow); z-index: 2; }
.map-tools button { width: 34px; height: 34px; border: 0; background: var(--surface); color: var(--ink); display: grid; place-items: center; cursor: pointer; }
.map-tools button:hover { background: var(--surface-2); }
.map-tools svg { width: 17px; height: 17px; }
.map-scale { position: absolute; left: .7rem; bottom: .6rem; font: 600 11px var(--font-ui); color: var(--muted); display: flex; align-items: center; gap: .4rem; pointer-events: none; }
.map-scale i { display: block; height: 6px; border: 1.5px solid var(--muted); border-top: 0; }
.map-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--muted); padding: 1rem; font-size: 14px; }

/* ------------------------------------------------------------------ track list */
.tracks { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.track-card { display: grid; grid-template-rows: 170px auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; color: var(--ink); text-decoration: none; box-shadow: var(--shadow); }
.track-card:hover { border-color: var(--brand); color: var(--ink); }
.track-card .map-box { min-height: 0; }
.track-card .body { padding: .85rem 1rem 1rem; display: grid; gap: .5rem; }
.track-card h2 { font-size: 1.15rem; font-weight: 700; font-stretch: 108%; }
.track-card .meta { display: flex; flex-wrap: wrap; gap: .35rem; }
.track-card .facts { font-size: 13px; color: var(--muted); }

/* ------------------------------------------------------------------ track editor */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 0; overflow: hidden; min-height: 640px; }
.editor .map-box { min-height: 640px; border-right: 1px solid var(--line); }
.editor .side { display: flex; flex-direction: column; min-width: 0; max-height: 760px; }
.editor .tabs { display: flex; border-bottom: 1px solid var(--line); overflow-x: auto; }
.editor .tabs button { flex: 1; border: 0; background: none; padding: .8rem .5rem; font: 600 13px var(--font-ui); color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.editor .tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--brand); }
.editor .tabs button .n { font-weight: 500; color: var(--muted); margin-left: .25rem; }
.editor .tabpanel { overflow-y: auto; flex: 1; padding: .8rem; }
.elist { list-style: none; margin: 0 0 .7rem; padding: 0; display: grid; gap: 4px; }
.elist li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .5rem; align-items: center; padding: .4rem .5rem; border-radius: var(--radius-s);
  border: 1px solid transparent; background: var(--surface-2); }
.elist li.selected { border-color: var(--brand); background: var(--brand-soft); }
.elist li.drop-before { box-shadow: 0 -3px 0 var(--brand); }
.elist li.dragging { opacity: .4; }
.elist .grip { cursor: grab; color: var(--muted); padding: 2px; display: grid; border: 0; background: none; }
.elist .grip svg { width: 16px; height: 16px; }
.elist .pick { border: 0; background: none; text-align: left; font: inherit; color: var(--ink); cursor: pointer; padding: .1rem 0; min-width: 0; display: flex; gap: .55rem; align-items: center; }
.elist .pick .no { font: 700 13px var(--font-display); font-stretch: 85%; width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center; background: var(--gate); color: #fff; flex: none; }
.elist .pick .no.finish { background: var(--ink); color: var(--bg); }
.elist .pick .no.slot { background: var(--slot); border-radius: 5px; }
.elist .pick .no.ibox { background: var(--itembox); border-radius: 3px; }
.elist .pick small { color: var(--muted); font-size: 12px; display: block; }
.elist .ops { display: flex; gap: 0; }
.elist .ops .btn-icon { width: 28px; min-height: 28px; color: var(--muted); }
.elist .ops .btn-icon svg { width: 15px; height: 15px; }
.inspector { border-top: 1px solid var(--line); padding: .8rem; display: grid; gap: .6rem; background: var(--surface-2); }
.inspector h3 { font-size: .98rem; font-weight: 700; display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.inspector .grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
.inspector .field > label { font-size: 12px; }
.inspector input { min-height: 32px; padding: .25rem .45rem; }
.inspector .hint { font-size: 12.5px; color: var(--muted); margin: 0; }
.ed-toolbar { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; padding: .6rem .8rem; border-bottom: 1px solid var(--line); grid-column: 1 / -1; background: var(--surface); }
.ed-toolbar .spacer { flex: 1; }
.ed-toolbar .dirty { font-size: 13px; color: var(--warn); font-weight: 600; }
.ed-settings { display: grid; gap: .8rem; }
.ed-settings .two { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.mm-preview { font: 600 15px var(--font-ui); padding: .45rem .6rem; border-radius: var(--radius-s); background: #1b2030; color: #fff; min-height: 34px; overflow-wrap: anywhere; }
.issues { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; font-size: 13.5px; }
.issues li { display: flex; gap: .5rem; align-items: flex-start; }
.issues li svg { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--warn); }
.issues li.ok svg { color: var(--ok); }
@media (max-width: 1100px) {
  .editor { grid-template-columns: minmax(0, 1fr); }
  .editor .map-box { min-height: 58vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .editor .side { max-height: none; }
}

/* ------------------------------------------------------------------ karts */
.karts { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); }
.kart-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  display: grid; grid-template-rows: auto 1fr; color: var(--ink); text-decoration: none; }
.kart-card:hover { border-color: var(--brand); color: var(--ink); }
.kart-stage { position: relative; aspect-ratio: 16 / 10; display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(ellipse 60% 40% at 50% 78%, rgba(0, 0, 0, .18), transparent 70%),
              linear-gradient(180deg, var(--surface-2), var(--sunken)); }
.kart-stage img, .kart-stage svg { width: 82%; height: 92%; object-fit: contain; }
.kart-stage .tag { position: absolute; left: .6rem; top: .6rem; }
.kart-stage .no { position: absolute; right: .7rem; top: .45rem; font: 800 2.1rem/1 var(--font-display); font-stretch: 70%; color: var(--line-strong); font-style: italic; }
.kart-card .body { padding: .9rem 1rem 1rem; display: grid; gap: .55rem; align-content: start; }
.kart-card h2 { font-size: 1.2rem; font-weight: 720; font-stretch: 110%; }
.kart-card .desc { font-size: 13.5px; color: var(--muted); margin: 0; min-height: 2.6em; }
.stats { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .35rem .6rem; align-items: center; font-size: 12.5px; }
.stats dt { color: var(--muted); }
.stats dd { margin: 0; font: 600 13px var(--font-display); font-stretch: 85%; text-align: right; font-variant-numeric: tabular-nums; }
.kart-card .foot { display: flex; justify-content: space-between; align-items: center; gap: .5rem; border-top: 1px solid var(--line); padding-top: .6rem; margin-top: .2rem; font-size: 13px; }
.price { font: 700 15px var(--font-display); font-stretch: 95%; }
.kart-editor { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 1.2rem; align-items: start; }
.kart-editor .kart-stage { border-radius: var(--radius); border: 1px solid var(--line); aspect-ratio: 4 / 3; }
.kart-editor .preview-col { position: sticky; top: 1rem; display: grid; gap: .7rem; }
@media (max-width: 980px) { .kart-editor { grid-template-columns: minmax(0, 1fr); } .kart-editor .preview-col { position: static; } }
.items-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: .6rem; margin-bottom: 1.4rem; }
.items-strip figure { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem .5rem .55rem; text-align: center; font-size: 12.5px; font-weight: 600; }
.items-strip img { width: 72px; height: 72px; margin: 0 auto .3rem; object-fit: contain; }

/* ------------------------------------------------------------------ config form */
.cfg { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 1.6rem; align-items: start; }
.cfg-toc { position: sticky; top: 1rem; display: grid; gap: 1px; font-size: 13.5px; max-height: calc(100vh - 2rem); overflow-y: auto; }
.cfg-toc a { color: var(--ink-2); text-decoration: none; padding: .32rem .6rem; border-radius: var(--radius-s); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cfg-toc a:hover { background: var(--sunken); color: var(--ink); }
.cfg-toc a.has-error { color: var(--bad); font-weight: 600; }
.cfg-toc a.has-change::after { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--warn); margin-left: .4rem; vertical-align: 2px; }
@media (max-width: 1100px) { .cfg { grid-template-columns: minmax(0, 1fr); } .cfg-toc { display: none; } }
.cfg-search { position: relative; margin-bottom: 1rem; }
.cfg-search svg { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.cfg-search input { padding-left: 2.2rem; }
.group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1rem; scroll-margin-top: 1rem; }
.group > .group-head { display: flex; align-items: center; gap: .6rem; padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
.group > .group-head h2 { font-size: 1.05rem; font-weight: 700; font-stretch: 106%; }
.group > .group-head .spacer { flex: 1; }
.group > .group-help { margin: 0; padding: .7rem 1rem 0; font-size: 13.5px; color: var(--muted); max-width: 80ch; }
.group > .rows { padding: .3rem 1rem .6rem; }
.sub { border: 1px solid var(--line); border-radius: var(--radius-s); margin: .5rem 0; background: var(--surface-2); }
.sub > .sub-head { display: flex; align-items: center; gap: .5rem; padding: .5rem .75rem; border-bottom: 1px solid var(--line); font-weight: 650; font-size: 14px; }
.sub > .sub-head .spacer { flex: 1; }
.sub > .group-help { margin: 0; padding: .5rem .75rem 0; font-size: 13px; color: var(--muted); }
.sub > .rows { padding: .2rem .75rem .5rem; }
.sub .sub { background: var(--surface); }
.row { display: grid; grid-template-columns: minmax(10rem, 17rem) minmax(0, 1fr); gap: .3rem 1rem; align-items: center; padding: .55rem 0; border-bottom: 1px solid var(--line); position: relative; scroll-margin-top: 5rem; }
.rows > .row:last-child { border-bottom: 0; }
.row.changed::before { content: ""; position: absolute; left: -1rem; top: .5rem; bottom: .5rem; width: 3px; border-radius: 0 3px 3px 0; background: var(--warn); }
.row.invalid::before { content: ""; position: absolute; left: -1rem; top: .5rem; bottom: .5rem; width: 3px; border-radius: 0 3px 3px 0; background: var(--bad); }
.row .key { display: flex; align-items: center; gap: .3rem; min-width: 0; flex-wrap: wrap; }
.row .key .lbl { font-weight: 550; font-size: 14px; overflow-wrap: anywhere; }
.row .key code { font-size: 11.5px; color: var(--muted); }
.row .ctl { min-width: 0; display: grid; gap: .3rem; }
.row .ctl .msg { font-size: 12.5px; color: var(--bad); }
.row .ctl .locked { font-size: 12.5px; color: var(--muted); display: flex; gap: .35rem; align-items: center; }
.row .ctl .locked svg { width: 14px; height: 14px; }
.row.wide { grid-template-columns: minmax(0, 1fr); }
.row.flagged { animation: flag 1.6s ease; }
@keyframes flag { 0%, 30% { background: var(--warn-soft); } }
.row.hidden-by-filter, .group.hidden-by-filter, .sub.hidden-by-filter { display: none; }
@media (max-width: 640px) { .row { grid-template-columns: minmax(0, 1fr); } }
.list { display: grid; gap: .35rem; }
.list .item { display: flex; gap: .35rem; align-items: center; }
.list .item > :first-child { flex: 1; min-width: 0; }
.vec { display: grid; grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); gap: .35rem; }
.mm { font: 600 13px var(--font-ui); padding: .3rem .5rem; border-radius: 5px; background: #1b2030; color: #e8ebf2; overflow-wrap: anywhere; white-space: pre-wrap; }
.savebar { position: sticky; bottom: 0; z-index: 10; margin-top: 1rem; display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; padding: .7rem 1rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-pop); }
.savebar .state { font-size: 13.5px; color: var(--muted); margin-right: auto; }
.savebar .state.dirty { color: var(--warn); font-weight: 600; }
.yaml-wrap { display: grid; grid-template-columns: auto minmax(0, 1fr); border: 1px solid var(--line-strong); border-radius: var(--radius-s); overflow: hidden; background: var(--surface); }
.yaml-wrap .gutter { font: 13px/1.6 var(--font-mono); color: var(--muted); text-align: right; padding: .35rem .5rem; background: var(--surface-2); border-right: 1px solid var(--line);
  user-select: none; overflow: hidden; white-space: pre; }
.yaml-wrap textarea { border: 0; border-radius: 0; min-height: 60vh; resize: vertical; }
.yaml-wrap textarea:focus-visible { outline-offset: -2px; }

/* ------------------------------------------------------------------ stats / economy */
.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.podium > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; box-shadow: var(--shadow); min-width: 0; }
.podium .p { font: 800 2rem/1 var(--font-display); font-stretch: 70%; font-style: italic; color: var(--line-strong); }
.podium > div:first-child .p { color: var(--best); }
.podium strong { display: block; font-size: 1.05rem; margin-top: .3rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium span { font-size: 13px; color: var(--muted); }
@media (max-width: 640px) { .podium { grid-template-columns: minmax(0, 1fr); } }
.rate { display: flex; align-items: center; gap: .6rem; }
.rate .bar { flex: 1; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); margin-right: .45rem; vertical-align: 1px; }
.dot.ok { background: var(--ok); }
.dot.bad { background: var(--bad); }
.dot.warn { background: var(--warn); }


/* ------------------------------------------------------------------ small parts */
.section-gap { margin-bottom: 1.4rem; display: grid; gap: .9rem; }
.h-small { font-size: 1.15rem; font-weight: 700; font-stretch: 106%; }
.h-section { font-size: 1.2rem; font-weight: 700; font-stretch: 108%; margin-bottom: .9rem; }
.form-grid { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.form-actions { display: flex; gap: .5rem; justify-content: flex-end; flex-wrap: wrap; }
.form-actions.left { justify-content: flex-start; }
.drop { display: flex; align-items: center; justify-content: center; gap: .6rem; padding: 1.1rem; border: 1.5px dashed var(--line-strong); border-radius: var(--radius);
  color: var(--muted); cursor: pointer; font-weight: 500; background: var(--surface-2); }
.drop svg { width: 20px; height: 20px; }
.drop:hover, .drop.over { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
input.sr-only:focus-visible + .drop { outline: 2px solid var(--focus); outline-offset: 2px; }
.tsep { width: 1px; height: 22px; background: var(--line); margin: 0 .2rem; }
.small-print { font-size: 13px; margin: .6rem 0 0; }
.switch-row { display: grid; grid-template-columns: auto 1fr; gap: .15rem .7rem; align-items: center; }
.switch-row label { font-weight: 600; font-size: 14px; }
.switch-row .muted { grid-column: 2; font-size: 12.5px; }
.head-chips { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-top: .6rem; font-size: 13px; }
.pins { margin-top: .2rem; }
.kv { display: grid; gap: 0; padding: .3rem 1.1rem; }
.kv-row { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv-row:last-child { border-bottom: 0; }
.kv-row strong { font-weight: 600; text-align: right; }
.warn-text { color: var(--warn); }
.record-card { overflow: hidden; }
.record-card table { font-size: 13.5px; }
.record-card th, .record-card td { padding: .5rem .8rem; }
.record-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; padding: .8rem .9rem; border-bottom: 1px solid var(--line); }
.record-head h3 { font-size: 1.05rem; font-weight: 700; font-stretch: 106%; }
.legend-inline { font-size: 13px; display: inline-flex; align-items: center; gap: .4rem; }
.legend-inline i { width: 10px; height: 10px; border-radius: 2px; background: var(--best); display: inline-block; }
.records li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .8rem; align-items: baseline; }
.rec-track { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-who { color: var(--muted); font-size: 13.5px; }
.rec-time { font: 650 15px var(--font-display); font-stretch: 82%; color: var(--best); font-variant-numeric: tabular-nums; }
.tower-col { display: flex; flex-direction: column; min-width: 0; }
.tower-col .tower { flex: 1; }
.race.compact .map-box { min-height: 260px; }
.crumb-file { margin-bottom: .5rem; font-size: 13px; color: var(--muted); }
.add-row { padding: .6rem 0 .2rem; }
.kart-card { --accent: var(--brand); }
.kart-card .kart-stage::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--accent); }
@media (max-width: 860px) {
  .race, .hero-race { grid-template-columns: minmax(0, 1fr); }
  .race .map-box { border-right: 0; border-bottom: 1px solid var(--line); min-height: 280px; }
  .race-head .clock { margin-left: 0; }
}

/* ------------------------------------------------------------------ motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .login-line .line { stroke-dashoffset: 0; }
}

/* MiniMessage colours: as in game on dark backgrounds, mixed towards the text colour on light ones */
.mmc { color: var(--mm); }
:root:not([data-theme="dark"]) .mmc { color: color-mix(in oklab, var(--mm) 62%, #10131c); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mmc { color: var(--mm); } }
.mm .mmc, .mm-preview .mmc, .rail .mmc { color: var(--mm) !important; }
@media (max-width: 640px) {
  .savebar { padding: .55rem .6rem; gap: .4rem; }
  .savebar .state { flex-basis: 100%; font-size: 12.5px; }
  .savebar .btn { min-height: 34px; padding: 0 .7rem; }
  .savebar .btn-primary { flex: 1; }
  .page-head h1 { font-size: 1.6rem; }
}
@media (max-width: 640px) {
  .rate .bar { display: none; }
  .rate { min-width: 0; }
}
