/* =========================================================================
   THEMES (agT1-1109) - Dark / Light / Auto with tones, app-wide.
   index.html's inline <head> script sets two attributes on <html> before any CSS paints:
     data-theme-mode="dark|light"   (Auto is resolved there from prefers-color-scheme, and theme.js keeps it live)
     data-theme-tone="<id>"         dark: midnight | ember | grove | void   light: parchment | sandstone | mist | rose
   DEFAULT = dark + midnight = the app's original look. Midnight therefore keeps every legacy token at its original value
   (style.css :root, the --cs-* block, portal.css); every OTHER tone remaps those legacy tokens onto the shared contract below.

   Shared contract (also used by the character select):
     --t-bg --t-surf --t-surf2 --t-line --t-text --t-muted --t-accent --t-on-accent --t-p1 --t-on-p1 --t-p2 --t-on-p2
   Constant across tones (never themed): --zone-h/m/l, the ability colours (--evt-*, .ct-kw), card-type colours (--c-*), card art.

   Helper tokens (midnight values = the literals style.css used before, so the default look is unchanged):
     --glass / --glass-2 / --glass-3 / --glass-4   dark "glass" panel bases, used as color-mix(in srgb, var(--glass) 92%, transparent)
     --shade      shadow / inset colour (black on dark tones; a soft translucent ink on light tones), used the same way
     --hi         highlight colour for subtle "lighter" fills and hairlines (white on dark, ink on light)
     --scrim      modal backdrop base
     --ink-mix    0% on dark tones; on light tones pastel status/ability TEXT is mixed this far toward --text so it stays readable:
                  color-mix(in srgb, <pastel>, var(--text) var(--ink-mix))
     --on-hero-deep / --on-tide-deep   text on primary (--hero-deep) and secondary (--tide-deep) fills
   ========================================================================= */

:root {
  /* Midnight (default) - contract values from the approved Theme mockups. */
  --t-bg: #0a0f1f; --t-surf: #121a33; --t-surf2: #182246; --t-line: #2a3766;
  --t-text: #e8ecff; --t-muted: #9aa6cf;
  --t-accent: #6fd3ff; --t-on-accent: #0a0f1f;
  --t-p1: #6fd3ff; --t-on-p1: #0a0f1f; --t-p2: #b69cff; --t-on-p2: #140f1a;
  /* Constant across tones. */
  --zone-h: #ff6b5e; --zone-m: #ff9f43; --zone-l: #f5d04a;
  /* The helper tokens (--glass, --shade, --hi, --scrim, --fog, --ink-mix, --on-*) are NOT declared for Midnight: every use in
     style.css / portal.css carries the original literal as its var() fallback, so the default look cannot drift. */
}

/* ---- Dark tones ---- */
html[data-theme-tone="ember"] {
  --t-bg: #17110d; --t-surf: #231a14; --t-surf2: #2e221a; --t-line: #4a3627; --t-text: #f6ebe0; --t-muted: #c2ab96;
  --t-accent: #ff8a3d; --t-on-accent: #1a0f08; --t-p1: #ff8a3d; --t-on-p1: #1a0f08; --t-p2: #f2c14e; --t-on-p2: #1a1406;
}
html[data-theme-tone="grove"] {
  --t-bg: #10140f; --t-surf: #1a2018; --t-surf2: #222a1f; --t-line: #38452f; --t-text: #ecf0e3; --t-muted: #a9b597;
  --t-accent: #9bcf63; --t-on-accent: #10140f; --t-p1: #9bcf63; --t-on-p1: #10140f; --t-p2: #e0a95b; --t-on-p2: #1a1206;
}
html[data-theme-tone="void"] {
  --t-bg: #140f1a; --t-surf: #1f1727; --t-surf2: #291f33; --t-line: #44345a; --t-text: #f0e9f7; --t-muted: #b6a6c9;
  --t-accent: #c58cff; --t-on-accent: #140f1a; --t-p1: #c58cff; --t-on-p1: #140f1a; --t-p2: #ff7a8a; --t-on-p2: #1f0a0e;
}
/* ---- Light tones ---- */
html[data-theme-tone="parchment"] {
  --t-bg: #f3eadb; --t-surf: #fbf5ea; --t-surf2: #ece0cc; --t-line: #d5c3a5; --t-text: #2b2118; --t-muted: #6b5a47;
  /* accent/p1 deepened from the mockup's #b4471f (4.2:1 as text on surf2) to #a8401b (4.7:1) */
  --t-accent: #a8401b; --t-on-accent: #fff8f0; --t-p1: #a8401b; --t-on-p1: #fff8f0; --t-p2: #6a4a8c; --t-on-p2: #fbf5ff;
}
html[data-theme-tone="sandstone"] {
  /* deepened from the mockup so text clears 4.5:1 on every surface: muted #5d604c -> #555844, accent/p1 #4f6b2c -> #46602a,
     p2 #a35a2a -> #8a4a20 */
  --t-bg: #e8e2d2; --t-surf: #f4f0e4; --t-surf2: #ddd5c0; --t-line: #c4b99d; --t-text: #232619; --t-muted: #555844;
  --t-accent: #46602a; --t-on-accent: #f7f5ec; --t-p1: #46602a; --t-on-p1: #f7f5ec; --t-p2: #8a4a20; --t-on-p2: #fff6ef;
}
html[data-theme-tone="mist"] {
  --t-bg: #e3e8ef; --t-surf: #f2f5f9; --t-surf2: #d6dde8; --t-line: #b8c3d3; --t-text: #18202c; --t-muted: #4f5b6d;
  --t-accent: #245f9e; --t-on-accent: #ffffff; --t-p1: #245f9e; --t-on-p1: #ffffff; --t-p2: #8a3fa0; --t-on-p2: #ffffff;
}
html[data-theme-tone="rose"] {
  --t-bg: #f2e4e1; --t-surf: #fbf2f0; --t-surf2: #e7d2ce; --t-line: #d0b2ac; --t-text: #2a1b1e; --t-muted: #6c5357;
  /* p2 deepened from the mockup's #2f6a7a (4.2:1 on surf2) to #2a6070 (4.8:1) */
  --t-accent: #a3364a; --t-on-accent: #fff5f6; --t-p1: #a3364a; --t-on-p1: #fff5f6; --t-p2: #2a6070; --t-on-p2: #f2fbfd;
}

/* ---- Every tone except Midnight: the legacy tokens follow the contract ---- */
html[data-theme-tone]:not([data-theme-tone="midnight"]) {
  --ink: var(--t-bg);
  --panel: var(--t-surf);
  --panel-2: var(--t-surf2);
  --panel-3: color-mix(in srgb, var(--t-surf2), var(--t-line) 45%);
  --line: var(--t-line);
  --line-bright: color-mix(in srgb, var(--t-line), var(--t-text) 22%);
  --text: var(--t-text);
  --text-dim: var(--t-muted);
  --hero: var(--t-p1);
  --hero-deep: var(--t-accent);
  --on-hero-deep: var(--t-on-accent);
  --tide: var(--t-p2);
  --tide-deep: color-mix(in srgb, var(--t-p2) 38%, var(--t-bg));
  --on-tide-deep: var(--t-text);
  --felt: color-mix(in srgb, var(--t-bg) 60%, var(--t-surf));
  --felt-2: color-mix(in srgb, var(--t-surf) 70%, var(--t-surf2));
  --glass: var(--t-bg); --glass-2: var(--t-bg); --glass-3: var(--t-surf); --fog: var(--t-bg);
  --on-hero: var(--t-on-p1);
  --on-hero-badge: var(--t-on-p1);
  --log-ts: color-mix(in srgb, var(--t-muted) 72%, var(--t-surf));
}
/* Flow bar: each window kind keeps its constant colour (--aw: Enhance yellow, Response green, ...) on a tint of the tone's surface. */
html[data-theme-tone]:not([data-theme-tone="midnight"]) .action-panel.flow-bar[class] { --aw-bg: color-mix(in srgb, var(--aw) 13%, var(--t-surf)); }
/* The character-select block re-declares the --cs-* tokens on .char-select itself, so they are remapped there too. */
html[data-theme-tone]:not([data-theme-tone="midnight"]),
html[data-theme-tone]:not([data-theme-tone="midnight"]) .char-select {
  --cs-void: var(--t-bg);
  --cs-void-2: color-mix(in srgb, var(--t-bg) 65%, var(--t-surf));
  --cs-panel: var(--t-surf);
  --cs-panel-2: var(--t-surf2);
  --cs-panel-3: color-mix(in srgb, var(--t-surf2), var(--t-line) 45%);
  --cs-line: var(--t-line);
  --cs-line-bright: color-mix(in srgb, var(--t-line), var(--t-text) 22%);
  --cs-gold: var(--t-accent);
  --cs-gold-dim: color-mix(in srgb, var(--t-accent) 60%, var(--t-bg));
  --cs-gold-bright: color-mix(in srgb, var(--t-accent), var(--t-text) 30%);
  --cs-crimson: color-mix(in srgb, var(--t-p2) 45%, var(--t-bg)); /* a deep p2: it carries white button labels */
  --cs-crimson-bright: var(--t-p2);
  --cs-text: var(--t-text);
  --cs-text-dim: var(--t-muted);
  --cs-p1: var(--t-p1);
  --cs-p2: var(--t-p2);
}
/* Home (bento) + Meta page palettes. */
html[data-theme-tone]:not([data-theme-tone="midnight"]) #portal,
html[data-theme-tone]:not([data-theme-tone="midnight"]) #metaPage {
  --pt-bg: var(--t-bg);
  --pt-panel: var(--t-surf);
  --pt-panel-2: color-mix(in srgb, var(--t-bg) 55%, var(--t-surf));
  --pt-line: var(--t-line);
  --pt-line-2: color-mix(in srgb, var(--t-line), var(--t-text) 18%);
  --pt-line-soft: color-mix(in srgb, var(--t-text) 8%, transparent);
  --pt-ink: var(--t-text);
  --pt-dim: color-mix(in srgb, var(--t-muted), var(--t-text) 30%);
  --pt-dim2: var(--t-muted);
  --air: var(--t-accent);
  --void: var(--t-p2);
  --void-ink: color-mix(in srgb, var(--t-p2), var(--t-text) 25%);
  --pt-on-air: var(--t-on-accent);
  --pt-on-void: var(--t-on-p2);
  --pt-accent-soft: color-mix(in srgb, var(--t-accent) 16%, var(--t-surf));
  --pt-p2-line: color-mix(in srgb, var(--t-p2) 35%, var(--t-line));
  --pt-accent-line: color-mix(in srgb, var(--t-accent) 35%, var(--t-line));
  --pt-soft-ink: color-mix(in srgb, var(--t-muted), var(--t-text) 45%);
  --pt-btn: var(--t-surf2);
  --pt-art-bg: var(--t-surf2);
  --pt-newset-bg: color-mix(in srgb, var(--t-p2) 10%, var(--t-surf));
  --pt-newset-line: color-mix(in srgb, #ff8a65 40%, var(--t-line));
  --pt-foot-ink: var(--t-muted);
  --pt-pod-a: var(--t-surf);
  --pt-pod-b: var(--t-bg);
}
html[data-theme-tone]:not([data-theme-tone="midnight"]) #metaPage { --pt-panel: color-mix(in srgb, var(--t-surf) 80%, transparent); }

/* ---- Light mode (any light tone) ---- */
html[data-theme-mode="light"][data-theme-tone]:not([data-theme-tone="midnight"]) {
  color-scheme: light; /* native controls (checkboxes, scrollbars) as on a light page; dark tones keep the browser default, like Midnight always had */
  --ink-mix: 62%;
  --shade: color-mix(in srgb, var(--t-text) 38%, transparent);
  --hi: var(--t-text);
  --scrim: color-mix(in srgb, var(--t-text) 72%, transparent);
  /* Status colours are kept, only deepened so they read on light surfaces (health up/down, wins/losses). */
  --good: #136a36;
  --bad: #a82a22;
  --log-ts: var(--t-muted);
  /* "How to Play" indigo, deepened so its labels read on light surfaces (primary buttons then carry a white label) */
  --tutorial: #4f5fca;
  --on-tutorial: #fff;
  --tide-deep: var(--t-p2);
  --on-tide-deep: var(--t-on-p2);
  --fog: color-mix(in srgb, var(--t-text) 70%, transparent);
  --hp-down-bg: color-mix(in srgb, #c23a30 15%, var(--t-surf));
  --hp-up-bg: color-mix(in srgb, #1f8a4c 15%, var(--t-surf));
}
html[data-theme-mode="light"][data-theme-tone]:not([data-theme-tone="midnight"]),
html[data-theme-mode="light"][data-theme-tone]:not([data-theme-tone="midnight"]) .char-select { --cs-bad: #a82a22; --cs-crimson: var(--t-p2); }
/* Rules: the selected chapter's label on its accent tint. */
html[data-theme-mode="light"] .rules-toc button.on { color: var(--cs-gold-bright); }
html[data-theme-mode="light"] #portal, html[data-theme-mode="light"] #metaPage {
  --pt-chip-ink: #15110c;
  --pt-online-bg: color-mix(in srgb, #1f8a4c 12%, var(--t-surf));
  --pt-online-line: color-mix(in srgb, #1f8a4c 40%, var(--t-line));
  --pt-online-ink: #17603a;
}
/* Home: the public-beta ribbon becomes a light gold notice; the pastel update chips keep a dark label. */
html[data-theme-mode="light"] #portal .pt-beta { background: linear-gradient(90deg, #f1dc9f, #f6e6b6 50%, #f1dc9f); border-bottom-color: #d4b25c; color: #4a3608; }
html[data-theme-mode="light"] #portal .pt-beta b { color: #2b1e03; }
html[data-theme-mode="light"] #portal .pt-beta button { color: #7a4300; }
html[data-theme-mode="light"] #portal .pt-note .chip:is(.new, .fix, .cards, .event) { color: var(--pt-chip-ink); }
/* Meta page: resource-symbol colours as TEXT are deepened toward the ink (the symbol colours themselves are unchanged). */
html[data-theme-mode="light"] #metaPage .mp-row .sym { color: color-mix(in srgb, var(--el), var(--t-text) 55%) !important; }
html[data-theme-mode="light"] #metaPage .mp-pod .wr { color: color-mix(in srgb, var(--el), var(--t-text) 50%); }
html[data-theme-mode="light"] #metaPage :is(.mp-row .mono, .mp-pod .mono, .mp-pod .badge, .mp-pod .play, .mp-pod .rk) { color: color-mix(in srgb, var(--el) 35%, var(--t-text)); }

/* =========================================================================
   Appearance picker (theme.js) - Dark / Light / Auto + tone swatches. A centred dialog on desktop,
   a bottom sheet on phones (Theme-Picker / Theme-Mobile mockups).
   ========================================================================= */
.uvt-backdrop {
  position: fixed; inset: 0; z-index: 2147482000; display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--scrim) 55%, transparent); padding: 16px;
}
.uvt-dialog {
  width: min(880px, 100%); max-height: calc(100dvh - 32px); overflow: auto; box-sizing: border-box;
  display: grid; grid-template-columns: minmax(0, 400px) minmax(0, 1fr); gap: 28px; padding: 28px;
  border-radius: 18px; background: var(--t-bg); color: var(--t-text); border: 1px solid var(--t-line);
  box-shadow: 0 24px 60px color-mix(in srgb, var(--shade) 55%, transparent);
  font-family: "Manrope", -apple-system, "Segoe UI", system-ui, sans-serif; text-align: left;
}
.uvt-dialog * { box-sizing: border-box; }
.uvt-dialog button { font-family: inherit; cursor: pointer; }
.uvt-dialog button:focus-visible { outline: 2px solid var(--t-accent); outline-offset: 2px; }
.uvt-settings { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.uvt-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.uvt-kick { display: block; font-size: 12px; letter-spacing: 3px; color: var(--t-muted); }
.uvt-title { display: block; margin: 2px 0 4px; font-family: "Chakra Petch", "Saira Condensed", sans-serif; font-weight: 700; font-size: 34px; line-height: 1; letter-spacing: 0.02em; }
.uvt-sub { display: block; font-size: 14px; color: var(--t-muted); }
.uvt-close { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--t-line); background: var(--t-surf); color: var(--t-text); font-size: 18px; line-height: 1; padding: 0; }
.uvt-group { display: flex; flex-direction: column; gap: 8px; }
.uvt-tonecol { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.uvt-label { font-size: 13px; font-weight: 700; }
.uvt-hint { font-size: 12px; color: var(--t-muted); }
.uvt-modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 12px; background: var(--t-surf); border: 1px solid var(--t-line); }
.uvt-modes button { min-height: 44px; border-radius: 9px; border: 0; background: transparent; color: var(--t-text); font-size: 14px; font-weight: 700; padding: 0 6px; }
.uvt-modes button[aria-checked="true"] { background: var(--t-accent); color: var(--t-on-accent); }
.uvt-modes button:hover:not([aria-checked="true"]) { background: var(--t-surf2); }
.uvt-tones { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
/* Each tone card is drawn in ITS OWN colours (a live sample), so these use the tone's values set inline by theme.js. */
.uvt-tone {
  display: flex; flex-direction: column; gap: 8px; padding: 11px 12px; border-radius: 14px; text-align: left; min-width: 0;
  border: 2px solid var(--sw-line); background: var(--sw-bg); color: var(--sw-text);
}
.uvt-tone[aria-checked="true"] { border-color: var(--t-accent); box-shadow: 0 0 0 1px var(--t-accent); }
.uvt-tone .uvt-sw { display: flex; gap: 6px; }
.uvt-tone .uvt-sw i { width: 24px; height: 24px; border-radius: 7px; display: block; }
.uvt-tone .uvt-sw i:nth-child(1) { background: var(--sw-surf); border: 1px solid var(--sw-line); }
.uvt-tone .uvt-sw i:nth-child(2) { background: var(--sw-accent); }
.uvt-tone .uvt-sw i:nth-child(3) { background: var(--sw-p2); }
.uvt-tone .uvt-sw i:nth-child(4) { background: var(--sw-muted); }
.uvt-tone .uvt-nm { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.uvt-tone[aria-checked="true"] .uvt-nm::after { content: "✓"; font-size: 13px; color: var(--sw-accent); }
.uvt-tone .uvt-th { font-size: 12px; color: var(--sw-muted); }
.uvt-done { min-height: 48px; border-radius: 12px; border: 0; background: var(--t-accent); color: var(--t-on-accent); font-size: 16px; font-weight: 700; }
/* Preview: a small face-off drawn with the live tokens (the whole page behind it already follows the choice). */
.uvt-preview { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.uvt-pv { flex: 1 1 auto; display: flex; flex-direction: column; border-radius: 16px; overflow: hidden; background: var(--t-bg); border: 1px solid var(--t-line); min-height: 300px; }
.uvt-pv-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 46px; padding: 0 14px; border-bottom: 1px solid var(--t-line); }
.uvt-pv-top span { font-size: 10px; letter-spacing: 3px; color: var(--t-muted); }
.uvt-pv-top b { height: 28px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--t-line); background: var(--t-surf); font-size: 12px; font-weight: 600; display: flex; align-items: center; }
.uvt-pv-body { flex: 1 1 auto; display: grid; grid-template-columns: minmax(0, 1fr) 120px minmax(0, 1fr); gap: 12px; padding: 16px; align-items: center; }
.uvt-pv-card { aspect-ratio: 5 / 7; border-radius: 10px; padding: 8px; display: flex; flex-direction: column; justify-content: space-between; border: 3px solid var(--t-p1); background: linear-gradient(160deg, #6a3b1e, #2a1a10); }
.uvt-pv-card.p2 { border-color: var(--t-p2); background: linear-gradient(160deg, #3b2a6e, #191230); }
.uvt-pv-card em { align-self: flex-start; font-style: normal; font-size: 9px; font-weight: 700; letter-spacing: 1.5px; padding: 2px 7px; border-radius: 999px; background: var(--t-p1); color: var(--t-on-p1); }
.uvt-pv-card.p2 em { align-self: flex-end; background: var(--t-p2); color: var(--t-on-p2); }
.uvt-pv-card small { font-size: 10px; color: #f3dcc8; }
.uvt-pv-mid { display: flex; flex-direction: column; gap: 6px; }
.uvt-pv-vs { align-self: center; font-family: "Chakra Petch", "Saira Condensed", sans-serif; font-weight: 700; font-size: 40px; line-height: 0.9; color: var(--t-accent); }
.uvt-pv-opt { padding: 6px 8px; border-radius: 8px; border: 1px solid var(--t-line); background: var(--t-surf); font-size: 11px; font-weight: 600; color: var(--t-text); }
.uvt-pv-opt.on { border: 2px solid var(--t-accent); background: var(--t-surf2); font-weight: 700; }
.uvt-pv-muted { font-size: 11px; color: var(--t-muted); text-align: center; }
.uvt-pv-fight { height: 36px; border-radius: 9px; background: var(--t-accent); color: var(--t-on-accent); font-family: "Chakra Petch", "Saira Condensed", sans-serif; font-weight: 700; font-size: 18px; letter-spacing: 3px; display: flex; align-items: center; justify-content: center; }
.uvt-pv-zones { display: flex; justify-content: center; gap: 4px; }
.uvt-pv-zones i { font-style: normal; font-size: 9px; font-weight: 700; padding: 1px 6px; border-radius: 999px; color: #1a0e0e; }
.uvt-pv-zones i:nth-child(1) { background: var(--zone-h); } .uvt-pv-zones i:nth-child(2) { background: var(--zone-m); } .uvt-pv-zones i:nth-child(3) { background: var(--zone-l); }
.uvt-pv-name { margin-top: 6px; font-family: "Chakra Petch", "Saira Condensed", sans-serif; font-weight: 700; font-size: 15px; line-height: 1.1; color: var(--t-text); text-align: center; }

/* Phones: a bottom sheet, the 4 tones of a row as round swatches (Theme-Mobile). */
@media (max-width: 760px), (max-height: 560px) {
  .uvt-backdrop { align-items: flex-end; padding: 0; }
  .uvt-dialog {
    display: flex; flex-direction: column; gap: 14px; width: 100%; max-height: 92dvh; padding: 10px 16px max(16px, env(safe-area-inset-bottom));
    border-radius: 22px 22px 0 0; border-bottom: 0; background: var(--t-surf);
  }
  .uvt-dialog::before { content: ""; align-self: center; width: 40px; height: 4px; border-radius: 999px; background: var(--t-line); flex: 0 0 auto; }
  .uvt-preview { display: none; }
  .uvt-kick, .uvt-sub { display: none; }
  .uvt-title { font-size: 24px; margin: 0; }
  .uvt-close { width: 44px; height: 44px; }
  .uvt-modes { background: var(--t-surf2); }
  .uvt-modes button:hover:not([aria-checked="true"]) { background: transparent; }
  .uvt-tones { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .uvt-tone { align-items: center; gap: 6px; padding: 8px 4px; border-radius: 12px; }
  .uvt-tone .uvt-sw { display: block; }
  .uvt-tone .uvt-sw i { display: none; }
  .uvt-tone .uvt-sw i:nth-child(2) { display: block; width: 34px; height: 34px; border-radius: 999px; border: 4px solid var(--sw-surf); }
  .uvt-tone .uvt-nm { font-size: 11px; }
  .uvt-tone[aria-checked="true"] .uvt-nm::after { content: none; }
  .uvt-tone .uvt-th { display: none; }
  .uvt-sheet-hint { display: block; }
}
@media (min-width: 761px) and (min-height: 561px) { .uvt-sheet-hint { display: none; } }
@media (max-height: 420px) and (min-width: 520px) {
  /* Landscape phones: mode on the left, tones on the right, so the sheet fits without scrolling. */
  .uvt-dialog { max-height: 100dvh; border-radius: 16px 16px 0 0; gap: 8px; padding-top: 8px; }
  .uvt-settings { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 10px 18px; align-items: start; }
  .uvt-head, .uvt-mode-group, .uvt-sheet-hint, .uvt-done { grid-column: 1; }
  .uvt-tonecol { grid-column: 2; grid-row: 1 / span 4; gap: 10px; }
  .uvt-mode-group > .uvt-hint { display: none; }
  .uvt-modes button { min-height: 40px; }
  .uvt-done { min-height: 44px; }
}

/* In-match / home entry points. */
#portal .pt-appearance { display: inline-flex; align-items: center; gap: 6px; }
#portal .pt-appearance .uvt-dot { width: 14px; height: 14px; border-radius: 50%; background: conic-gradient(var(--t-accent) 0 50%, var(--t-p2) 0); border: 1px solid var(--pt-line-2, var(--t-line)); }

/* Light tones: the ⚙️ emoji is a pale grey glyph that vanishes on a light button - draw it in the ink colour instead. */
html[data-theme-mode="light"] #matchTopbar .topbar-gear { color: transparent; text-shadow: 0 0 0 var(--t-text); }
