/* Region Map — the shared look for every page.
   Colours live here as variables, day and night, so a page never needs its
   own dark-mode overrides. Page <style> blocks use these variables; the
   components below use an `rm-` prefix so they never collide with the
   older per-page class names (.header, .nav, .card …). */

@font-face {
  font-family: 'Nunito';
  src: url('/static/fonts/nunito-var.woff2') format('woff2');
  font-weight: 200 1000;
  font-style: normal;
  font-display: swap;
}

:root {
  --font: 'Nunito', ui-rounded, 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, 'Cascadia Mono', 'SF Mono', Menlo, Consolas, monospace;

  --bg: #F6F3EA;          /* page */
  --surface: #FFFFFF;     /* panels */
  --surface-2: #FBF9F3;   /* quiet fill inside a panel */
  --surface-3: #F1EDE2;   /* hover, inset, image placeholder */
  --line: #E3DDCF;
  --line-2: #D2C9B4;
  --ink: #1F2A44;         /* main text: deep navy, never pure black */
  --ink-2: #3E475E;
  --ink-3: #5C6479;       /* secondary text, passes AA on --bg */
  --ink-4: #8A90A0;       /* disabled / decorative only */

  --accent: #1F2A44;      /* primary buttons, active states */
  --accent-hover: #2C3A5C;
  --accent-ink: #FFFFFF;
  --accent-soft: #E8ECF4;
  --accent-line: #BFC8DB;
  --hl: #FFE9A8;          /* the "you are here" halo */
  --link: #2364A8;

  --good: #1F6B3A;  --good-bg: #E4F3E7;  --good-solid: #2E7D45;
  --bad: #A3324F;   --bad-bg: #FBE7EC;   --bad-solid: #C2415E;
  --warn: #835400;  --warn-bg: #FFF3D6;  --warn-solid: #D9952B;
  --info: #2364A8;  --info-bg: #E5F0FB;
  --good-line: #BFE0C8; --warn-line: #EBCF8F; --bad-line: #EBC3CD;

  /* Area colours: the "towns" on the region map. */
  --nova: #9FD3A9;  --nova-deep: #2E7D45;
  --dc: #F4C2CF;    --dc-deep: #B03A5B;
  --md: #F6C08A;    --md-deep: #A9581A;
  --rva: #A9CFEE;   --rva-deep: #2364A8;
  --tide: #9ADBD2;  --tide-deep: #127A70;

  /* Heatmap: none → lots. */
  --heat-0: #F1F4EE; --heat-1: #CFE8D2; --heat-2: #93CC9F; --heat-3: #4FA265; --heat-4: #2E7D45;
  --heat-ink-lo: #1F4D2C; --heat-ink-hi: #FFFFFF;

  --r-xs: 6px; --r-sm: 10px; --r-md: 14px; --r-lg: 18px;
  --shadow-1: 0 1px 2px rgba(31,42,68,.05), 0 2px 10px rgba(31,42,68,.05);
  --shadow-pop: 0 14px 32px rgba(31,42,68,.18), 0 2px 6px rgba(31,42,68,.08);
  --overlay: rgba(31,42,68,.38);
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #121A2B;
  --surface: #1B2540;
  --surface-2: #18213A;
  --surface-3: #232E4D;
  --line: #2C385A;
  --line-2: #3A4769;
  --ink: #E9EDF7;
  --ink-2: #CBD2E2;
  --ink-3: #A8B2CC;
  --ink-4: #76809C;

  --accent: #3D6BC4;
  --accent-hover: #4A78D2;
  --accent-ink: #FFFFFF;
  --accent-soft: #24335A;
  --accent-line: #3F5487;
  --hl: #FFE9A8;
  --link: #9CC8F2;

  --good: #9BE3B0;  --good-bg: #1E3A2E;  --good-solid: #3E9A5E;
  --bad: #F7B3C4;   --bad-bg: #3A2233;   --bad-solid: #D0506E;
  --warn: #FFD98A;  --warn-bg: #3A3020;  --warn-solid: #D9952B;
  --info: #9CC8F2;  --info-bg: #1E2F4D;
  --good-line: #2F5C40; --warn-line: #6B5426; --bad-line: #6A3448;

  --nova: #4E9A60;  --nova-deep: #9BE3B0;
  --dc: #A65A72;    --dc-deep: #F7B3C4;
  --md: #B07A3E;    --md-deep: #FFD2A0;
  --rva: #4F7FB0;   --rva-deep: #BFDDF7;
  --tide: #3E968C;  --tide-deep: #A6EDE3;

  --heat-0: #1F2A44; --heat-1: #24493A; --heat-2: #2F6B4A; --heat-3: #4C9A66; --heat-4: #8FD9A5;
  --heat-ink-lo: #CFEBD6; --heat-ink-hi: #0E2318;

  --shadow-1: 0 1px 2px rgba(0,0,0,.25), 0 2px 10px rgba(0,0,0,.2);
  --shadow-pop: 0 14px 32px rgba(0,0,0,.45), 0 2px 6px rgba(0,0,0,.3);
  --overlay: rgba(5,9,18,.6);
  color-scheme: dark;
}

/* Morning: a warm sunrise version of the day look (time-of-day switch). */
html[data-theme="morning"] {
  --bg: #FBEEE2;
  --surface: #FFFBF6;
  --surface-2: #FFF5EB;
  --surface-3: #F5E4D3;
  --line: #EED9C5;
  --line-2: #E0C4A8;
  --ink: #2A2547;
  --ink-2: #47405F;
  --ink-3: #635B78;
  --ink-4: #958CA3;
  --accent: #3B3466;
  --accent-hover: #4A4279;
  --accent-ink: #FFFFFF;
  --accent-soft: #EEE8F4;
  --accent-line: #CFC4DE;
  --hl: #FFD3A3;
  --link: #3559A3;
  --info: #3559A3;
  --shadow-1: 0 1px 2px rgba(42,37,71,.05), 0 2px 10px rgba(42,37,71,.06);
  --shadow-pop: 0 14px 32px rgba(42,37,71,.18), 0 2px 6px rgba(42,37,71,.08);
  --overlay: rgba(42,37,71,.38);
  color-scheme: light;
}

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; }
a { color: var(--link); }
:focus-visible { outline: 2.5px solid var(--link); outline-offset: 2px; }
::selection { background: var(--hl); color: #1F2A44; }

/* Loading spinner: replaces the old ball-shaped one on every page. */
html body .tcg-spinner {
  display: inline-block; width: 18px; height: 18px; box-sizing: border-box;
  border-radius: 50%; border: 2.5px solid var(--line-2); border-top-color: var(--ink);
  background: none !important; animation: rm-spin .8s linear infinite; vertical-align: middle;
}
@keyframes rm-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { html body .tcg-spinner { animation-duration: 2.4s; } }

/* ── Top bar ─────────────────────────────────────────────── */
.rm-top {
  position: sticky; top: 0; z-index: 500;
  background: var(--surface); border-bottom: 1px solid var(--line);
  font-family: var(--font); color: var(--ink);
}
.rm-top-row {
  display: flex; align-items: center; gap: 8px 20px;
  max-width: 1440px; margin: 0 auto; padding: 0 20px; min-height: 64px;
}
.rm-brand {
  display: flex; align-items: center; gap: 10px; flex: none;
  color: var(--ink); text-decoration: none; font-weight: 900; font-size: 18px; letter-spacing: -.01em;
}
.rm-brand svg { flex: none; }
.rm-brand .rm-mark-bg { fill: var(--ink); }
.rm-brand .rm-mark-path { stroke: var(--hl); }
html[data-theme="dark"] .rm-brand .rm-mark-path { stroke: #121A2B; }

/* The route: each section is a stop on a dashed path. */
.rm-route { position: relative; display: flex; justify-content: center; flex: 1 1 auto; min-width: 0; }
.rm-route-path { position: absolute; left: 44px; right: 44px; top: 17px; border-top: 2.5px dashed var(--line-2); pointer-events: none; }
.rm-stop {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px;
  min-width: 78px; padding: 11px 6px 8px; color: var(--ink-3); text-decoration: none;
  font-weight: 700; font-size: 14px; white-space: nowrap; border-radius: var(--r-sm);
}
.rm-stop:hover { color: var(--ink); }
.rm-stop i {
  width: 12px; height: 12px; border-radius: 50%; box-sizing: border-box; position: relative; z-index: 1;
  background: var(--surface); border: 2.5px solid var(--line-2); transition: transform .15s ease;
}
.rm-stop:hover i { transform: scale(1.15); border-color: var(--ink-3); }
.rm-stop.on { color: var(--ink); font-weight: 800; }
.rm-stop.on i { width: 16px; height: 16px; margin-top: -2px; background: var(--ink); border-color: var(--ink); box-shadow: 0 0 0 4px var(--hl); }
html[data-theme="dark"] .rm-stop.on i { background: var(--hl); border-color: var(--hl); box-shadow: 0 0 0 4px rgba(255,233,168,.22); }
.rm-stop.rm-staff i { border-style: dotted; }

.rm-right { display: flex; align-items: center; gap: 10px; flex: none; margin-left: auto; }
/* .rm-btn-quiet and .rm-btn-solid live in the Controls section at the end. */
.rm-theme .rm-night, html[data-theme="dark"] .rm-theme .rm-day { display: none; }
html[data-theme="dark"] .rm-theme .rm-night { display: inline-flex; }
.rm-theme span { align-items: center; gap: 6px; }
.rm-theme .rm-day { display: inline-flex; }
.rm-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none; overflow: hidden;
  background: var(--rva); color: #1F2A44; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px;
}
.rm-avatar img { width: 100%; height: 100%; object-fit: cover; }
.rm-username { font-size: 13px; color: var(--ink-3); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Second row: tabs for Card prices and Staff. */
.rm-tabs { border-top: 1px solid var(--line); background: var(--surface); }
.rm-tabs-row {
  display: flex; justify-content: flex-start; gap: 2px; max-width: 1440px; margin: 0 auto; padding: 0 16px;
  overflow-x: auto; scrollbar-width: none;
}
/* Centred when it fits, scrolls from the left edge when it doesn't. */
.rm-tabs-row > .rm-tab:first-child { margin-left: auto; }
.rm-tabs-row > .rm-tab:last-child { margin-right: auto; }
.rm-tabs-row::-webkit-scrollbar { display: none; }
.rm-tab {
  display: flex; align-items: center; min-height: 46px; padding: 0 14px; flex: none;
  color: var(--ink-3); text-decoration: none; font-weight: 700; font-size: 15px;
  border-bottom: 3px solid transparent; white-space: nowrap;
}
.rm-tab:hover { color: var(--ink); }
.rm-tab.on { color: var(--ink); font-weight: 800; border-bottom-color: var(--ink); }
html[data-theme="dark"] .rm-tab.on { border-bottom-color: var(--hl); }

/* Mid-size screens: tighten the route so the labels never run together. */
@media (min-width: 861px) and (max-width: 1200px) {
  .rm-top-row { gap: 8px 12px; padding: 0 14px; }
  .rm-username, .rm-theme .rm-label { display: none; }
  .rm-stop { min-width: 0; padding: 11px 9px 8px; font-size: 13px; }
  .rm-brand { font-size: 16px; }
}
@media (min-width: 861px) and (max-width: 1000px) { .rm-brand span { display: none; } }

/* Phone: the route becomes a bottom tab bar. */
.rm-bottom { display: none; }
.rm-sheet { display: none; }
@media (max-width: 860px) {
  .rm-route, .rm-username { display: none; }
  .rm-top-row { min-height: 56px; padding: 0 14px; }
  .rm-theme .rm-label { display: none; }
  .rm-tabs-row { justify-content: flex-start; }
  .rm-bottom {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 600;
    background: var(--surface); border-top: 1px solid var(--line);
    padding: 4px 4px max(10px, env(safe-area-inset-bottom));
  }
  body { padding-bottom: 76px; }
  .rm-bt {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: 56px; color: var(--ink-3); text-decoration: none; font-size: 11px; font-weight: 700;
    background: none; border: none; cursor: pointer; padding: 0;
  }
  .rm-bt span { display: flex; align-items: center; justify-content: center; width: 52px; height: 28px; border-radius: 14px; }
  .rm-bt.on { color: var(--ink); font-weight: 800; }
  .rm-bt.on span { background: var(--hl); color: #1F2A44; }
  .rm-sheet.open {
    display: block; position: fixed; inset: 0; z-index: 700; background: var(--overlay);
  }
  .rm-sheet-panel {
    position: absolute; left: 0; right: 0; bottom: 0; max-height: 80vh; overflow-y: auto;
    background: var(--surface); border-radius: 20px 20px 0 0; padding: 10px 16px max(20px, env(safe-area-inset-bottom));
    box-shadow: var(--shadow-pop);
  }
  .rm-sheet-grip { width: 44px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 4px auto 10px; }
  .rm-sheet h2 { margin: 14px 0 4px; font-size: 12px; font-weight: 800; letter-spacing: .05em; color: var(--ink-3); text-transform: uppercase; }
  .rm-sheet a, .rm-sheet button.rm-sheet-item {
    display: flex; align-items: center; width: 100%; min-height: 46px; padding: 0 12px; box-sizing: border-box;
    border-radius: var(--r-sm); color: var(--ink); text-decoration: none; font-weight: 700; font-size: 16px;
    background: none; border: none; text-align: left; cursor: pointer;
  }
  .rm-sheet a.on { background: var(--hl); color: #1F2A44; }
  .rm-sheet a:hover, .rm-sheet button.rm-sheet-item:hover { background: var(--surface-3); }
}

/* ── Page building blocks ───────────────────────────────── */
.rm-pagehead { max-width: 1440px; margin: 0 auto; padding: 24px 20px 4px; box-sizing: border-box; }
.rm-pagehead h1 { margin: 0; font-weight: 900; font-size: 34px; line-height: 1.1; letter-spacing: -.02em; color: var(--ink); }
.rm-pagehead p { margin: 4px 0 0; color: var(--ink-3); font-size: 16px; }
@media (max-width: 860px) { .rm-pagehead { padding: 16px 14px 2px; } .rm-pagehead h1 { font-size: 28px; } }

.rm-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }

/* The old game menu box: double navy border. Used sparingly — plain-English
   summaries, tooltips, notices — so it keeps meaning something. */
.rm-frame {
  background: var(--surface); border: 2px solid var(--ink); border-radius: var(--r-md);
  box-shadow: inset 0 0 0 3px var(--surface), inset 0 0 0 4.5px var(--ink);
}
.rm-frame-pop { box-shadow: inset 0 0 0 3px var(--surface), inset 0 0 0 4.5px var(--ink), var(--shadow-pop); }

.rm-summary { padding: 16px 22px; font-size: 18px; line-height: 1.45; }
.rm-summary b, .rm-summary strong { font-weight: 800; }
.rm-mark { background: linear-gradient(transparent 60%, var(--hl) 60%); color: inherit; padding: 0 1px; }
html[data-theme="dark"] .rm-mark { background: none; color: var(--hl); }

.rm-chip { display: inline-flex; align-items: center; gap: 4px; border-radius: 8px; padding: 2px 8px; font-size: 13px; font-weight: 800; }
.rm-chip.up { color: var(--good); background: var(--good-bg); }
.rm-chip.down { color: var(--bad); background: var(--bad-bg); }

/* Area map (dashboard area picker). */
.rm-map { position: relative; height: 260px; border-radius: var(--r-md); background: #EEF2E3; overflow: hidden; }
html[data-theme="dark"] .rm-map { background: #19243A; }
html[data-theme="morning"] .rm-map { background: #F5EBD7; }
.rm-map-water { position: absolute; background: #D3E9F2; pointer-events: none; }
html[data-theme="dark"] .rm-map-water { background: #1E3550; }
html[data-theme="morning"] .rm-map-water { background: #D5E5EE; }
.rm-map svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.rm-map .rm-road { stroke: #D8C79A; }
html[data-theme="dark"] .rm-map .rm-road { stroke: #3A4A6A; }
.rm-town {
  position: absolute; transform: translate(-50%,-50%);
  display: flex; flex-direction: column; align-items: center; min-width: 96px; padding: 7px 12px 8px;
  border-radius: var(--r-md); border: none; color: #1F2A44; cursor: pointer;
  box-shadow: 0 2px 0 rgba(31,42,68,.18); transition: transform .12s ease;
}
.rm-town:hover { transform: translate(-50%,-52%); }
.rm-town b { font-size: 15px; font-weight: 800; }
.rm-town span { font-size: 12px; font-weight: 700; }
.rm-town.on { box-shadow: 0 0 0 3px var(--surface), 0 0 0 6px var(--ink); }
.rm-town[disabled] { opacity: .45; cursor: default; }
html[data-theme="dark"] .rm-town { color: #fff; }
@media (max-width: 600px) { .rm-map { height: 200px; } .rm-town { min-width: 0; padding: 6px 10px; } .rm-town b { font-size: 13px; } }

.rm-visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Public pages: landing, guest home, sign in, membership ─ */
.rm-pubbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 1120px; margin: 0 auto; padding: 14px 20px; }
body.rm-public { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); }
.rm-public .wrap { width: 100%; max-width: 560px; margin: 0 auto; padding: 24px 20px 56px; box-sizing: border-box; }
.rm-public .title { font-size: 34px; font-weight: 900; letter-spacing: -.02em; line-height: 1.1; }
.rm-public .lede { font-size: 17px; line-height: 1.55; color: var(--ink-2); margin: 10px 0 24px; }
.rm-public .email { color: var(--ink-3); font-size: 15px; margin: 6px 0 20px; }
.rm-public .card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px 24px; box-shadow: var(--shadow-1); }
.rm-public .card h2 { margin: 0 0 6px; font-size: 19px; font-weight: 800; }
.rm-public .card p { margin: 0 0 14px; font-size: 15px; line-height: 1.55; color: var(--ink-2); }
.rm-public .card ul { margin: 0 0 16px; padding-left: 20px; line-height: 1.7; font-size: 15px; }
.rm-public form { display: flex; flex-direction: column; gap: 10px; }
.rm-public input[type=email] { min-height: 46px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font-size: 16px; }
.rm-public button.primary, .rm-public .btn, .rm-public .upsell-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px;
  border: none; border-radius: var(--r-md); background: var(--accent); color: var(--accent-ink);
  font-weight: 800; font-size: 16px; text-decoration: none; cursor: pointer; box-sizing: border-box;
}
.rm-public button.primary { width: 100%; }
.rm-public button.primary:hover, .rm-public .btn:hover, .rm-public .upsell-btn:hover { background: var(--accent-hover); }
.rm-public button:disabled { opacity: .6; cursor: not-allowed; }
.rm-public button.secondary, .rm-public .btn-outline {
  display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 20px; margin-top: 10px;
  border: 1.5px solid var(--line-2); border-radius: var(--r-md); background: var(--surface); color: var(--ink);
  font-weight: 700; font-size: 15px; text-decoration: none; cursor: pointer; box-sizing: border-box;
}
.rm-public button.secondary { width: 100%; }
.rm-public .btn-outline:hover, .rm-public button.secondary:hover { background: var(--surface-3); }
.rm-public .divider { display: flex; align-items: center; gap: 12px; margin: 22px 0 14px; color: var(--ink-3); font-size: 14px; font-weight: 700; }
.rm-public .divider::before, .rm-public .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.rm-public .msg { margin-top: 10px; font-size: 15px; }
.rm-public .ok { color: var(--good); font-weight: 700; }
.rm-public .err { color: var(--bad); font-weight: 700; }
.rm-public .fine, .rm-public .note { font-size: 14px; line-height: 1.6; color: var(--ink-3); }
.rm-public .note { margin-top: 24px; }
.rm-public .status { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 14px; border-radius: 8px; padding: 4px 10px; margin-bottom: 12px; }
.rm-public .status.on { color: var(--good); background: var(--good-bg); }
.rm-public .status.off { color: var(--ink-2); background: var(--surface-3); }
.rm-public .plans { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 14px; }
.rm-public .plan { display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: var(--r-md); cursor: pointer; }
.rm-public .plan.sel { border-color: var(--ink); box-shadow: 0 0 0 3px var(--hl); }
.rm-public .plan input { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; }
.rm-public .plan-name { font-weight: 800; }
.rm-public .plan-price { margin-left: auto; font-weight: 800; }
.rm-public .plan-save { font-size: 12px; font-weight: 800; color: var(--good); background: var(--good-bg); border-radius: 6px; padding: 2px 7px; }
.rm-public .links { display: flex; gap: 18px; margin-top: 20px; font-weight: 700; }
.rm-public .tools { display: flex; flex-direction: column; gap: 10px; }
.rm-public .tool { display: block; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); color: var(--ink); text-decoration: none; transition: border-color .15s, transform .15s; }
.rm-public .tool:hover { border-color: var(--ink-3); transform: translateY(-1px); }
.rm-public .tool-name { font-weight: 800; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.rm-public .tool-desc { margin-top: 3px; font-size: 14px; line-height: 1.5; color: var(--ink-3); }
.rm-public .upsell { margin-top: 22px; }
.rm-public .upsell-title { font-weight: 800; font-size: 18px; }
.rm-public .upsell-desc { font-size: 15px; line-height: 1.55; color: var(--ink-2); margin: 6px 0 14px; }
.rm-badge { font-size: 11px; font-weight: 800; letter-spacing: .05em; color: #6B4A00; background: var(--hl); border-radius: 6px; padding: 2px 7px; vertical-align: middle; }

/* Landing */
.rm-hero { max-width: 1120px; margin: 0 auto; padding: 28px 20px 12px; display: flex; flex-wrap: wrap; gap: 28px 40px; align-items: center; }
.rm-hero-text { flex: 1 1 380px; }
.rm-hero h1 { margin: 0; font-size: 46px; line-height: 1.05; font-weight: 900; letter-spacing: -.025em; }
.rm-hero .lede { font-size: 18px; line-height: 1.55; color: var(--ink-2); margin: 14px 0 22px; max-width: 34em; }
.rm-hero-map { flex: 1 1 420px; }
.rm-hero-map .rm-map { height: 300px; }
.rm-hero-map .rm-town { cursor: default; }
.rm-hero-map .rm-town:hover { transform: translate(-50%,-50%); }
.rm-btnrow { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.rm-section { max-width: 1120px; margin: 0 auto; padding: 22px 20px; }
.rm-section > h2 { margin: 0 0 12px; font-size: 22px; font-weight: 900; }
.rm-tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.rm-tier-col { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 6px 20px 10px; }
.rm-tier-col > h3 { margin: 12px 0 2px; font-size: 13px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); }
.rm-tier { padding: 12px 0; border-top: 1px solid var(--line); }
.rm-tier-col > h3 + .rm-tier { border-top: none; }
.rm-tier-name { font-weight: 800; font-size: 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rm-tier-desc { font-size: 14px; line-height: 1.55; color: var(--ink-2); margin-top: 3px; }
.rm-tier ul { margin: 6px 0 0; padding-left: 18px; font-size: 14px; line-height: 1.6; color: var(--ink-2); }
.rm-tier-prices { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.rm-tier-price { font-size: 13px; font-weight: 700; background: var(--surface-3); border-radius: 8px; padding: 3px 9px; }
.rm-tier.hl { margin: 6px -12px; padding: 12px; border-top: none; border-radius: var(--r-md); background: var(--surface-2); box-shadow: inset 0 0 0 2px var(--ink); }
@media (max-width: 600px) { .rm-hero h1 { font-size: 36px; } .rm-hero-map .rm-map { height: 230px; } }


/* ── Round 3 field kit ─────────────────────────────────── */

/* Time-of-day switch: Morning / Day / Night, in the top bar. */
.rm-tod { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--surface-3); border: 1.5px solid var(--line-2); }
.rm-tod button {
  width: 40px; height: 34px; border: 2px solid transparent; border-radius: 999px; background: transparent; color: var(--ink-3);
  display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0;
}
.rm-tod button:hover { color: var(--ink); }
.rm-tod button[aria-pressed="true"] { background: var(--surface); color: var(--ink); border-color: var(--ctl-rim); box-shadow: inset 0 0 0 2px var(--surface), inset 0 0 0 3.5px var(--ctl-rim); }
/* "Follow the clock" is on: the picked look gets a dashed frame instead. */
.rm-tod.auto button[aria-pressed="true"] { border-style: dashed; box-shadow: none; }
@media (max-width: 860px) { .rm-top .rm-tod { display: none; } }
.rm-tod-auto { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 12px; font-weight: 700; font-size: 15px; color: var(--ink); }
.rm-tod-auto input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }

/* Pointer menu: a pointer sits beside the item you're on. */
.rm-ptr a, .rm-ptr button { position: relative; padding-left: 30px !important; }
.rm-ptr a.on::before, .rm-ptr a:focus-visible::before, .rm-ptr a:hover::before,
.rm-ptr button[aria-pressed="true"]::before, .rm-ptr button:focus-visible::before, .rm-ptr button:hover::before {
  content: ""; position: absolute; left: 12px; top: 50%; margin-top: -6px;
  border-top: 6px solid transparent; border-bottom: 6px solid transparent; border-left: 8px solid currentColor;
}
.rm-ptr button[aria-pressed="true"] { background: var(--hl); color: #1F2A44; }

/* Meter bars: ten notches, green, amber, red, with the number always written out. */
.rm-meter-row { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; font-weight: 800; color: var(--ink); }
.rm-meter { position: relative; height: 16px; margin-top: 6px; border-radius: 9px; background: var(--surface-3); box-shadow: inset 0 0 0 2px var(--ink); overflow: hidden; }
.rm-meter > b { position: absolute; left: 2px; top: 2px; bottom: 2px; border-radius: 7px; background: #3E9B57; max-width: calc(100% - 4px); }
.rm-meter > b::after { content: ""; position: absolute; left: 5px; right: 5px; top: 2px; height: 3px; border-radius: 2px; background: rgba(255,255,255,.5); }
.rm-meter.mid > b { background: #E0A526; }
.rm-meter.low > b { background: #D2556B; }
.rm-meter::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0, transparent calc(10% - 1.5px), rgba(31,42,68,.16) calc(10% - 1.5px), rgba(31,42,68,.16) 10%); pointer-events: none; }
html[data-theme="dark"] .rm-meter::after { background: repeating-linear-gradient(90deg, transparent 0, transparent calc(10% - 1.5px), rgba(0,0,0,.3) calc(10% - 1.5px), rgba(0,0,0,.3) 10%); }

/* Signpost headings. */
.rm-post-row { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 4px 12px; }
.rm-post { display: inline-flex; flex-direction: column; align-items: center; margin: 0; }
.rm-post > span:first-child {
  background: var(--surface); border: 2px solid var(--ink); border-radius: 10px; padding: 5px 13px;
  font-weight: 900; font-size: 17px; line-height: 1.25; color: var(--ink); box-shadow: 0 3px 0 var(--ink);
}
.rm-post > span:last-child { width: 6px; height: 12px; background: var(--ink); border-radius: 0 0 3px 3px; }
.rm-post.hl > span:first-child { background: var(--hl); color: #1F2A44; }
.rm-post-note { margin-bottom: 8px; font-size: 14px; font-weight: 700; color: var(--ink-3); }

/* Yes / No prompt, opened next to the button that asked. */
.rm-ask { position: absolute; z-index: 1100; display: flex; align-items: flex-end; gap: 8px; width: min(420px, calc(100vw - 24px)); }
.rm-ask-msg { flex: 1; padding: 12px 14px; font-size: 16px; font-weight: 700; line-height: 1.4; color: var(--ink); white-space: pre-line; }
.rm-ask-pick { flex: none; width: 104px; padding: 5px; }
.rm-ask-pick button {
  display: flex; align-items: center; width: 100%; min-height: 40px; padding: 0 10px 0 28px; border: none; border-radius: 9px;
  background: none; color: var(--ink); font-weight: 800; font-size: 15px; cursor: pointer; position: relative;
}
.rm-ask-pick button:focus { outline: none; }
.rm-ask-pick button:focus-visible, .rm-ask-pick button:hover { background: var(--hl); color: #1F2A44; }
.rm-ask-pick button:focus-visible::before, .rm-ask-pick button:hover::before {
  content: ""; position: absolute; left: 11px; top: 50%; margin-top: -6px;
  border-top: 6px solid transparent; border-bottom: 6px solid transparent; border-left: 8px solid currentColor;
}
.rm-ask .rm-frame { box-shadow: inset 0 0 0 3px var(--surface), inset 0 0 0 4.5px var(--ink), var(--shadow-pop); }

/* Area sign: drops in under the top bar for a moment when you switch area. */
.rm-sign {
  position: fixed; left: 20px; top: 80px; z-index: 650; width: 300px; max-width: calc(100vw - 40px);
  background: var(--surface); border: 2px solid var(--ink); border-radius: 12px; overflow: hidden;
  box-shadow: var(--shadow-pop); transform: translateY(-140%); opacity: 0;
  transition: transform .35s cubic-bezier(.2,.9,.3,1.2), opacity .2s ease; pointer-events: none;
}
.rm-sign.show { transform: none; opacity: 1; }
.rm-sign-band { height: 8px; border-bottom: 2px solid var(--ink); background: var(--hl); }
.rm-sign-body { display: flex; align-items: center; gap: 12px; padding: 10px 14px 12px; }
.rm-sign-body i { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); box-shadow: 0 0 0 1.5px var(--ink); flex: none; }
.rm-sign-body div { flex: 1; min-width: 0; }
.rm-sign-name { font-size: 20px; font-weight: 900; line-height: 1.15; color: var(--ink); }
.rm-sign-sub { font-size: 14px; font-weight: 700; color: var(--ink-2); }
@media (max-width: 860px) { .rm-sign { top: 66px; left: 12px; } }
@media (prefers-reduced-motion: reduce) { .rm-sign { transition: opacity .2s ease; transform: none; } }

/* Arrow settings: step through choices instead of a slider or dropdown. */
.rm-step { display: inline-flex; align-items: center; gap: 6px; }
.rm-step button {
  width: var(--ctl-h); height: var(--ctl-h); border-radius: 50%; border: 2px solid var(--ctl-rim); background: var(--surface);
  color: var(--ink); display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; flex: none;
  box-shadow: inset 0 0 0 2px var(--surface), inset 0 0 0 3.5px var(--ctl-rim); transition: transform .12s ease, box-shadow .12s ease;
}
.rm-step button:hover:not(:disabled) { transform: translateY(-1px); box-shadow: inset 0 0 0 2px var(--surface), inset 0 0 0 3.5px var(--ctl-rim), 0 5px 12px var(--ctl-lift); }
.rm-step button:active:not(:disabled) { transform: translateY(1px) scale(.97); }
.rm-step button:disabled { border: 2px dashed var(--line-2); box-shadow: none; background: var(--surface-3); color: var(--ink-4); cursor: default; }
.rm-step output { min-width: 112px; text-align: center; font-weight: 900; font-size: 15px; color: var(--ink); }
.rm-tri-l, .rm-tri-r { display: inline-block; width: 0; height: 0; border-top: 6px solid transparent; border-bottom: 6px solid transparent; }
.rm-tri-l { border-right: 8px solid currentColor; }
.rm-tri-r { border-left: 8px solid currentColor; }

/* Game switcher: step between games with dots, phones only. */
.rm-switch { display: none; }
@media (max-width: 860px) {
  .rm-switch { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px; margin: 8px 0; }
  .rm-switch-name { font-weight: 900; font-size: 18px; text-align: center; color: var(--ink); }
  .rm-switch-dots { display: flex; gap: 5px; justify-content: center; margin-top: 5px; }
  .rm-switch-dots i { width: 7px; height: 7px; border-radius: 4px; background: var(--line-2); }
  .rm-switch-dots i.on { width: 18px; background: var(--ink); }
  .rm-switch button { width: 44px; height: 44px; }
  .rm-switch-hide { display: none !important; }
}

/* Map pointer and info strip. */
.rm-map-strip {
  position: absolute; left: 0; right: 0; top: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px;
  padding: 9px 14px; background: color-mix(in srgb, var(--surface) 94%, transparent); border-bottom: 2px solid var(--ink);
}
.rm-map-strip i { width: 14px; height: 14px; border-radius: 4px; box-shadow: 0 0 0 2px var(--ink); flex: none; }
.rm-map-strip b { font-weight: 900; font-size: 17px; color: var(--ink); }
.rm-map-strip span { font-size: 14px; font-weight: 700; color: var(--ink-2); }
.rm-map-strip em { margin-left: auto; font-style: normal; font-size: 13px; font-weight: 800; color: var(--ink-3); }
.rm-town.on::after {
  content: ""; position: absolute; inset: -9px; border-radius: 18px; border: 3px dashed var(--ink);
  animation: rm-pulse 1.6s ease-in-out infinite; pointer-events: none;
}
@keyframes rm-pulse { 50% { transform: scale(1.06); opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .rm-town.on::after { animation: none; } }
.rm-map .rm-town:focus-visible { outline: 3px solid var(--link); outline-offset: 4px; }
.rm-map-extra { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* Card tracker binder view. */
.rm-binder { display: flex; border-radius: 20px; background: #1F2A44; padding: 12px; }
.rm-binder-page { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 12px; border-radius: 12px; background: #A9CFEE; align-content: start; }
.rm-binder-rings { flex: none; width: 18px; display: flex; flex-direction: column; justify-content: space-around; align-items: center; }
.rm-binder-rings i { width: 12px; height: 26px; border-radius: 6px; background: #D2C9B4; box-shadow: inset 0 0 0 2px #8A90A0; }
.rm-pocket {
  position: relative; display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 6px; border-radius: 10px;
  background: rgba(255,255,255,.6); border: 1.5px solid rgba(31,42,68,.3); color: #1F2A44; text-align: left; cursor: pointer; font: inherit;
}
.rm-pocket:hover { background: #fff; }
.rm-pocket.on { background: #fff; outline: 3px solid #1F2A44; outline-offset: 3px; }
.rm-pocket:focus-visible { outline: 3px solid #1F2A44; outline-offset: 3px; }
.rm-pocket-art { display: block; width: 100%; aspect-ratio: 5 / 7; object-fit: contain; border-radius: 6px; background: rgba(31,42,68,.08); }
.rm-pocket-name { font-size: 13px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rm-pocket-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 2px 4px; font-size: 12px; font-weight: 800; }
.rm-pocket-row .up { color: #1F5A32; background: #E4F3E7; border-radius: 6px; padding: 0 5px; }
.rm-pocket-row .down { color: #8A2440; background: #FBE7EC; border-radius: 6px; padding: 0 5px; }
.rm-pocket-empty { border-style: dashed; background: rgba(255,255,255,.25); cursor: default; }
.rm-binder-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 12px; }
.rm-binder-title { text-align: center; font-weight: 900; font-size: 17px; color: var(--ink); }
.rm-binder-sub { font-size: 13px; font-weight: 700; color: var(--ink-3); }
.rm-binder-empty { padding: 28px; text-align: center; font-weight: 700; color: #1F2A44; }
@media (max-width: 860px) { .rm-binder-rings, .rm-binder-page.second { display: none; } .rm-binder { padding: 8px; } .rm-binder-page { padding: 8px; gap: 6px; } }

/* Alerts as contact cards. */
.rm-contacts { display: flex; flex-direction: column; gap: 8px; }
.rm-contact { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); }
.rm-contact-icon { flex: none; width: 42px; height: 42px; border-radius: 12px; background: var(--nova); color: #1F2A44; display: flex; align-items: center; justify-content: center; }
.rm-contact-main { flex: 1; min-width: 0; }
.rm-contact-name { font-weight: 900; font-size: 16px; color: var(--ink); overflow-wrap: anywhere; }
.rm-contact-when { font-size: 14px; font-weight: 600; color: var(--ink-2); overflow-wrap: anywhere; }
.rm-contact-acts { display: flex; gap: 6px; flex: none; }
@media (max-width: 600px) { .rm-contact { flex-wrap: wrap; } .rm-contact-acts { width: 100%; justify-content: flex-end; } }

/* Binder pocket fronts. The binder keeps the same colours in every look,
   so these are fixed rather than theme tokens. */
.rm-pocket-art { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 6px; aspect-ratio: 5 / 6; background: #EEF1F6; box-shadow: inset 0 0 0 2px rgba(31,42,68,.18); text-align: center; }
.rm-pocket-game-pokemon { background: #FBE7A1; }
.rm-pocket-game-one_piece { background: #F4C2CF; }
.rm-pocket-game-riftbound { background: #D9CCF3; }
.rm-pocket-game-lorcana { background: #BFDDF7; }
.rm-pocket-game-gundam { background: #C9E8D0; }
.rm-pocket-game { font-size: 12px; font-weight: 900; letter-spacing: .02em; color: #1F2A44; }
.rm-pocket-score { font-size: 12px; font-weight: 900; padding: 2px 8px; border-radius: 8px; background: rgba(255,255,255,.75); color: #47405F; }
.rm-pocket-score.hi { background: #1F5A32; color: #fff; }
.rm-pocket-score.mid { background: #FFF3C9; color: #6B4A00; box-shadow: inset 0 0 0 1.5px #A07A14; }
.rm-pocket-score.low { background: #fff; color: #8A2440; box-shadow: inset 0 0 0 1.5px #C9798E; }
.rm-binder-nav output, .rm-binder-nav > div { flex: 1; text-align: center; }
.rm-binder-view { padding: 14px 16px 16px; }
@media (max-width: 860px) { .rm-pocket-art { aspect-ratio: 1 / 1; } .rm-pocket-score { font-size: 11px; padding: 2px 5px; } .rm-pocket-row { flex-wrap: wrap; } }
@media (max-width: 860px) { .rm-switch { flex: 1 1 100%; width: 100%; box-sizing: border-box; } }


/* ── Round 4 · Controls: "Framed" ─────────────────────────────
   One set of buttons, fields and pickers for every page: pill shapes
   wearing the Field notes double outline. Hover lifts a button a little;
   the keyboard gets the yellow "you are here" halo. Pages keep only
   layout (width, margins) in their own styles, never the look.

   Sizes: 40px on desktop, 44px on phones. The compact size (.btn-sm,
   toolbar buttons) is 34px on desktop and 40px on phones. */
:root { --ctl-h: 40px; --ctl-h-sm: 34px; --ctl-rim: var(--ink); --ctl-lift: rgba(31,42,68,.2); }
html[data-theme="dark"] { --ctl-rim: #9AA6C6; --ctl-lift: rgba(0,0,0,.5); }
@media (max-width: 768px) { :root { --ctl-h: 44px; --ctl-h-sm: 40px; } }

/* Buttons. Plain .btn is the outlined (secondary) one; .btn-primary is
   filled. The older page names are kept as aliases. */
.btn, .btn-plain, .btn-quiet, .btn-ghost, .btn-scratch, .btn-trade,
.btn-primary, .btn-spin, .btn-danger, .refresh-btn, .rm-btn-quiet, .rm-btn-solid {
  --b-bg: var(--surface); --b-ink: var(--ink); --b-edge: var(--ctl-rim);
  --b-inner: var(--b-bg); --b-hair: var(--ctl-rim); --b-glow: 0 0 0 0 transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  box-sizing: border-box; min-height: var(--ctl-h); height: auto; padding: 0 18px; margin: 0;
  border: 2px solid var(--b-edge); border-radius: 999px; background: var(--b-bg); color: var(--b-ink);
  box-shadow: inset 0 0 0 2px var(--b-inner), inset 0 0 0 3.5px var(--b-hair), var(--b-glow);
  font: inherit; font-size: 14px; font-weight: 800; line-height: 1.15; letter-spacing: 0;
  text-decoration: none; white-space: nowrap; cursor: pointer; opacity: 1;
  transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease;
}
.btn-primary, .btn-spin, .refresh-btn, .rm-btn-solid {
  --b-bg: var(--accent); --b-ink: var(--accent-ink); --b-edge: var(--accent); --b-hair: rgba(255,255,255,.75);
}
.btn-danger { --b-ink: var(--bad); --b-edge: var(--bad-solid); --b-hair: var(--bad-solid); }

:is(.btn, .btn-plain, .btn-quiet, .btn-ghost, .btn-scratch, .btn-trade, .btn-primary, .btn-spin, .btn-danger, .refresh-btn, .rm-btn-quiet, .rm-btn-solid):hover:not(:disabled) {
  transform: translateY(-1px); --b-glow: 0 5px 12px var(--ctl-lift);
}
:is(.btn-primary, .btn-spin, .refresh-btn, .rm-btn-solid):hover:not(:disabled) { --b-bg: var(--accent-hover); --b-edge: var(--accent-hover); }
.btn-danger:hover:not(:disabled) { --b-bg: var(--bad-bg); }
:is(.btn, .btn-plain, .btn-quiet, .btn-ghost, .btn-scratch, .btn-trade, .btn-primary, .btn-spin, .btn-danger, .refresh-btn, .rm-btn-quiet, .rm-btn-solid):active:not(:disabled) {
  transform: translateY(1px) scale(.97); --b-glow: 0 0 0 0 transparent;
}
:is(.btn, .btn-plain, .btn-quiet, .btn-ghost, .btn-scratch, .btn-trade, .btn-primary, .btn-spin, .btn-danger, .refresh-btn, .rm-btn-quiet, .rm-btn-solid):focus-visible {
  --b-glow: 0 0 0 4px var(--hl); outline: 2.5px solid var(--link); outline-offset: 5px;
}
/* Not ready yet: dashed and grey, whatever the button's colour. */
:is(.btn, .btn-plain, .btn-quiet, .btn-ghost, .btn-scratch, .btn-trade, .btn-primary, .btn-spin, .btn-danger, .refresh-btn, .rm-btn-quiet, .rm-btn-solid):disabled {
  --b-bg: var(--surface-3); --b-ink: var(--ink-4); --b-edge: var(--line-2); --b-hair: transparent;
  border-style: dashed; cursor: not-allowed; transform: none;
}
.btn-sm, .refresh-btn { min-height: var(--ctl-h-sm); padding: 0 14px; font-size: 13px; }
.btn-block { display: flex; width: 100%; }
@media (prefers-reduced-motion: reduce) {
  :is(.btn, .btn-plain, .btn-quiet, .btn-ghost, .btn-scratch, .btn-trade, .btn-primary, .btn-spin, .btn-danger, .refresh-btn, .rm-btn-quiet, .rm-btn-solid) { transition: none; transform: none !important; }
}

/* Text-only button ("Clear filters"). */
.clear-filters-btn {
  display: inline-flex; align-items: center; min-height: var(--ctl-h-sm); padding: 0 8px; margin: 0;
  border: none; border-radius: 10px; background: none; color: var(--link); cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 700; white-space: nowrap;
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px;
}
.clear-filters-btn:hover { background: var(--surface-3); }

/* Pick one: a pill track; the picked one wears the double outline. */
.btn-group, .view-toggle, .rm-viewswitch, .seg {
  display: inline-flex; gap: 2px; padding: 3px; box-sizing: border-box; max-width: 100%;
  border: 1.5px solid var(--line-2); border-radius: 999px; background: var(--surface-3);
}
/* Long tracks scroll sideways on phones; the cut-off last choice shows there's more. */
.btn-group, .view-toggle, .rm-viewswitch, .seg { scrollbar-width: none; }
.btn-group::-webkit-scrollbar, .view-toggle::-webkit-scrollbar, .rm-viewswitch::-webkit-scrollbar, .seg::-webkit-scrollbar { display: none; }
.btn-group button, .view-toggle button, .rm-viewswitch button, .seg button {
  min-height: calc(var(--ctl-h) - 9px); height: auto; padding: 0 14px; margin: 0; flex-shrink: 0;
  border: 2px solid transparent; border-radius: 999px; background: transparent; color: var(--ink-3);
  font: inherit; font-size: 13px; font-weight: 800; white-space: nowrap; cursor: pointer; box-shadow: none;
}
.btn-group button:hover, .view-toggle button:hover, .rm-viewswitch button:hover, .seg button:hover { color: var(--ink); }
.btn-group button.active, .view-toggle button.on, .rm-viewswitch button[aria-pressed="true"], .seg button.on {
  background: var(--surface); color: var(--ink); border-color: var(--ctl-rim);
  box-shadow: inset 0 0 0 2px var(--surface), inset 0 0 0 3.5px var(--ctl-rim);
}

/* Tabs: pills; the open one is filled. */
.cat-tab {
  display: inline-flex; align-items: center; gap: 6px; box-sizing: border-box;
  min-height: var(--ctl-h); padding: 0 16px; margin: 0;
  border: 1.5px solid var(--line-2); border-radius: 999px; background: var(--surface); color: var(--ink-2);
  font: inherit; font-size: 14px; font-weight: 800; white-space: nowrap; cursor: pointer;
}
.cat-tab:hover { border-color: var(--ctl-rim); color: var(--ink); }
.cat-tab.on, .cat-tab.active {
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent);
  box-shadow: inset 0 0 0 2px var(--accent), inset 0 0 0 3.5px rgba(255,255,255,.75);
}

/* Fields. :where() keeps these at zero weight, so a page's own sizing for
   a special field (a price box inside a table, say) still wins. */
:where(input:not([type]), input[type=text], input[type=search], input[type=number], input[type=email],
       input[type=url], input[type=tel], input[type=date], input[type=datetime-local], input[type=password], select, textarea) {
  box-sizing: border-box; max-width: 100%;
  border: 2px solid var(--line-2); border-radius: 14px; background: var(--surface); color: var(--ink);
  font: inherit; font-size: 14px; font-weight: 600;
  transition: border-color .12s ease, box-shadow .12s ease;
}
:where(input:not([type]), input[type=text], input[type=search], input[type=number], input[type=email],
       input[type=url], input[type=tel], input[type=date], input[type=datetime-local], input[type=password], select) {
  height: var(--ctl-h); padding: 0 14px;
}
:where(textarea) { padding: 10px 14px; line-height: 1.45; }
/* Hint text: same readable grey, but regular weight so it never looks like a typed value. */
:where(input, select, textarea)::placeholder { color: var(--ink-3); font-weight: 400; opacity: 1; }
:where(input:not([type]), input[type=text], input[type=search], input[type=number], input[type=email],
       input[type=url], input[type=tel], input[type=date], input[type=datetime-local], input[type=password], select, textarea):hover:not(:disabled) {
  border-color: var(--ink-3);
}
:where(input:not([type]), input[type=text], input[type=search], input[type=number], input[type=email],
       input[type=url], input[type=tel], input[type=date], input[type=datetime-local], input[type=password], select, textarea):focus {
  border-color: var(--ctl-rim); outline: 2.5px solid var(--link); outline-offset: 4px;
  box-shadow: inset 0 0 0 2px var(--surface), inset 0 0 0 3.5px var(--ctl-rim), 0 0 0 4px var(--hl);
}
:where(input, select, textarea):disabled { background: var(--surface-3); color: var(--ink-4); border-style: dashed; cursor: not-allowed; }
:where(input, select, textarea)[aria-invalid="true"] { border-color: var(--bad-solid); }

/* Tick boxes and round choices. Sizes set by a page still apply; the tick
   scales with the box. */
:where(input[type=checkbox]:not([hidden]), input[type=radio]:not([hidden])) {
  -webkit-appearance: none; appearance: none; box-sizing: border-box; flex: none;
  width: 20px; height: 20px; margin: 0; display: inline-grid; place-items: center; vertical-align: middle;
  border: 2px solid var(--ctl-rim); background: var(--surface); cursor: pointer;
}
:where(input[type=checkbox]) { border-radius: 30%; }
:where(input[type=radio]) { border-radius: 50%; }
:where(input[type=checkbox], input[type=radio]):is(:checked, :indeterminate) { background: var(--accent); border-color: var(--accent); }
:where(input[type=checkbox]):checked::after {
  content: ""; box-sizing: border-box; width: 32%; height: 58%;
  border: solid var(--accent-ink); border-width: 0 2px 2px 0; transform: translateY(-12%) rotate(45deg);
}
:where(input[type=checkbox]):indeterminate::after { content: ""; width: 55%; height: 2px; background: var(--accent-ink); border-radius: 1px; }
:where(input[type=radio]):checked::after { content: ""; width: 40%; height: 40%; border-radius: 50%; background: var(--accent-ink); }
:where(input[type=checkbox], input[type=radio]):disabled { opacity: .45; cursor: not-allowed; }

/* Sliders: a framed track and a framed knob. */
:where(input[type=range]) { -webkit-appearance: none; appearance: none; height: 28px; margin: 0; background: transparent; cursor: pointer; }
:where(input[type=range])::-webkit-slider-runnable-track {
  box-sizing: border-box; height: 12px; border-radius: 999px; border: 2px solid var(--ctl-rim); background: var(--surface-3);
}
:where(input[type=range])::-moz-range-track {
  box-sizing: border-box; height: 12px; border-radius: 999px; border: 2px solid var(--ctl-rim); background: var(--surface-3);
}
:where(input[type=range])::-moz-range-progress { height: 8px; border-radius: 999px; background: var(--accent); }
:where(input[type=range])::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; box-sizing: border-box; width: 24px; height: 24px; margin-top: -8px;
  border-radius: 50%; border: 2px solid var(--ctl-rim); background: var(--surface);
  box-shadow: inset 0 0 0 2px var(--surface), inset 0 0 0 3.5px var(--ctl-rim);
}
:where(input[type=range])::-moz-range-thumb {
  box-sizing: border-box; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--ctl-rim); background: var(--surface);
  box-shadow: inset 0 0 0 2px var(--surface), inset 0 0 0 3.5px var(--ctl-rim);
}
:where(input[type=range]):focus-visible { outline: 2.5px solid var(--link); outline-offset: 3px; border-radius: 999px; }

/* The styles above give these a display value, which would otherwise beat
   the hidden attribute. Keep hidden meaning hidden. */
:is(.btn, .btn-plain, .btn-quiet, .btn-ghost, .btn-scratch, .btn-trade, .btn-primary, .btn-spin, .btn-danger,
    .refresh-btn, .rm-btn-quiet, .rm-btn-solid, .clear-filters-btn, .btn-group, .view-toggle, .rm-viewswitch, .seg, .cat-tab)[hidden] { display: none; }
