/* THE EMBER UI - BASE (2026-10-19, the design overhaul; DESIGN.md is the spec;
 * MODERNIZED 2026-10-20 - Eric chose "Ember, modernized": the same warm look
 * and pixel titles, bigger and higher-contrast text, no all-caps labels, and
 * the accessibility settings - text size, high contrast, colourblind tiers).
 *
 * One look for every DOM screen: charcoal panels, ember-and-gold accents with
 * soft glows, Pixelify Sans for display type, Inter for everything a player
 * reads. This file holds the TOKENS (custom properties), the FONTS, and the
 * shared CONTROLS (.ed-*); each area's own layout is in its own file beside
 * this one (login.css, select.css, hud.css, ...), all linked from index.html.
 *
 * Rules of the house:
 *  - Classes are prefixed `ed-` (block), `ed-block__part`, `ed-block--variant`,
 *    and states are `is-*` (is-selected, is-locked, is-busy).
 *  - Colours come from the tokens below - a new colour is a new token.
 *  - Behaviour stays inline in the JS (pointer-events, display toggles,
 *    positions the code computes); LOOK lives here. The suites read the
 *    inline half, so what they pin keeps working.
 *  - No backdrop-filter and no animation on anything that sits over the live
 *    game world: the canvas under it changes every frame, and a software-
 *    drawn browser (Firefox's fallback) would pay for both every frame.
 *  - No url() images: the page's CSP (src/host/StaticHost.cjs) allows images
 *    from this origin only, and data: URIs are refused - shapes are drawn
 *    with gradients, borders and clip-path instead.
 */

/* ---- Fonts (assets/fonts - OFL 1.1, see assets/fonts/README.txt) ---- */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('../../assets/fonts/Inter-Regular.woff') format('woff'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap; src: url('../../assets/fonts/Inter-Medium.woff') format('woff'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url('../../assets/fonts/Inter-SemiBold.woff') format('woff'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap; src: url('../../assets/fonts/Inter-Bold.woff') format('woff'); }
/* The display faces BLOCK (up to ~3 s) rather than flash a fallback: they are
 * preloaded by index.html and tiny, and a title drawn in Inter for a frame
 * then swapped reads as a glitch. */
@font-face { font-family: 'Pixelify Sans'; font-style: normal; font-weight: 500; font-display: block; src: url('../../assets/fonts/PixelifySans-Medium.woff') format('woff'); }
@font-face { font-family: 'Silkscreen'; font-style: normal; font-weight: 400; font-display: block; src: url('../../assets/fonts/Silkscreen-Regular.woff') format('woff'); }

/* ---- Tokens ---- */
:root {
  /* page and surfaces - warm charcoal, never blue-black */
  --ed-bg-0: #070609;
  --ed-bg-1: #0d0b10;
  --ed-bg-2: #141117;
  --ed-surface: rgba(22, 18, 23, 0.94);
  --ed-surface-top: rgba(32, 26, 32, 0.96);
  --ed-surface-raised: #1d181e;
  --ed-surface-sunken: rgba(6, 5, 8, 0.72);
  --ed-scrim: rgba(5, 4, 7, 0.72);

  /* hairlines */
  --ed-line-faint: rgba(255, 236, 214, 0.06);
  --ed-line: rgba(255, 176, 110, 0.14);
  --ed-line-strong: rgba(255, 176, 110, 0.30);
  --ed-line-hot: rgba(255, 154, 82, 0.70);

  /* text */
  --ed-text: #f7efe6;
  --ed-text-2: #ddd0c2;  /* ~11:1 on a panel (was #c0b2a3) */
  --ed-text-3: #b3a495;  /* ~7:1 - secondary text stays readable (was #8b7c6e, ~4:1) */
  --ed-text-4: #857869;  /* disabled and placeholders only */
  --ed-text-on-ember: #1f0e04;

  /* ember and gold - the accents */
  --ed-ember-200: #ffd6b0;
  --ed-ember-300: #ffbc85;
  --ed-ember-400: #ff9a52;
  --ed-ember-500: #ff7a2f;
  --ed-ember-600: #e2581c;
  --ed-ember-700: #9c3a0e;
  --ed-gold-200: #ffeccc;
  --ed-gold-300: #ffdca6;
  --ed-gold-400: #f1c27b;
  --ed-gold-500: #d4a256;

  /* meaning */
  --ed-danger: #ff6257;
  --ed-danger-text: #ff9a90;
  --ed-success: #63d69a;
  /* better and worse on the item card with colorblind-friendly colors on
   * (hud.css .is-cb): Okabe-Ito's blue and orange */
  --ed-better-cb: #56b4e9;
  --ed-worse-cb: #e69f00;
  --ed-info: #8fc0ff;
  --ed-warning: #ffcf6e;

  /* vitals (the canvas HUD reads the same values from Theme.js) */
  --ed-hp: #e5423b;
  --ed-hp-hi: #ff6f61;
  --ed-mp: #3c7fe3;
  --ed-mp-hi: #74b0ff;
  --ed-xp: #f2b33d;

  /* type */
  --ed-font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --ed-font-display: 'Pixelify Sans', 'Inter', system-ui, sans-serif;
  --ed-font-pixel: 'Silkscreen', 'Pixelify Sans', monospace;

  /* shape */
  --ed-r-xs: 3px;
  --ed-r-sm: 4px;
  --ed-r: 8px;
  --ed-r-lg: 12px;
  --ed-r-xl: 16px;

  /* THE TEXT SCALE (Settings > Display > Text size, 2026-10-20): every
   * font-size in the stylesheets is calc(Npx * var(--ed-fs)). Settings sets
   * a class on #ui-root (ed-text-large / ed-text-larger), never the value. */
  --ed-fs: 1;

  /* depth */
  --ed-shadow-1: inset 0 1px 0 rgba(255, 226, 196, 0.04), 0 6px 18px rgba(0, 0, 0, 0.38);
  --ed-shadow-2: inset 0 1px 0 rgba(255, 226, 196, 0.05), 0 22px 60px rgba(0, 0, 0, 0.58), 0 2px 8px rgba(0, 0, 0, 0.4);
  --ed-glow-ember: 0 0 0 1px rgba(255, 154, 82, 0.45), 0 0 22px rgba(255, 110, 40, 0.30);

  /* motion */
  --ed-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ed-fast: 120ms;
  --ed-med: 200ms;
  --ed-slow: 360ms;
}

/* ---- Base ---- */
#ui-root.ed-text-large { --ed-fs: 1.15; }
#ui-root.ed-text-larger { --ed-fs: 1.3; }
/* THE LANGUAGE (round 2 part 26a - core/Lang.js LANG_DEVICE_CLASS): the two
 * pixel faces have no letters for Japanese, Chinese or Hindi, and a title
 * with one face for its digits and another for its words reads as a fault.
 * So while one of those three is the language, titles and pixel labels use
 * the UI face's stack, which ends in the device's own face (question 156).
 * Sizes are untouched: nothing here goes under 12px. */
#ui-root.ed-lang-device { --ed-font-display: var(--ed-font-ui); --ed-font-pixel: var(--ed-font-ui); }
/* NAMES KEEP THEIR FACE (round 2 part 26c): the game's own name, and a
 * class's name on character select, are names. They stay as they are in
 * every language (question 157), their letters are Latin, and the pixel
 * faces can draw them. So these get the two faces back, as :root has them. */
#ui-root.ed-lang-device .ed-logo,
#ui-root.ed-lang-device .ed-class-card__name,
#ui-root.ed-lang-device .character-card__name,
#ui-root.ed-lang-device .ed-charsel__pick-name { --ed-font-display: 'Pixelify Sans', 'Inter', system-ui, sans-serif; --ed-font-pixel: 'Silkscreen', 'Pixelify Sans', monospace; }
/* PHOTO MODE (2026-11-16 - game/ui/PhotoMode.js): none of the page's cards.
 * A class on #ui-root while the mode is on. Hidden, not removed: nothing
 * moves, and it is all back the moment the class goes. */
#ui-root.ed-photo, #ui-root.ed-photo * { visibility: hidden !important; pointer-events: none !important; }

/* HIGH CONTRAST (Settings > Display, 2026-10-20): brighter text, stronger
 * edges, solid cards - none of the world shows through them. A class on
 * #ui-root (Settings applies it); the canvas half is Theme.setHighContrast. */
#ui-root.ed-hc {
  --ed-text: #ffffff;
  --ed-text-2: #f3e9de;
  --ed-text-3: #dccfc1;
  --ed-text-4: #b5a797;
  --ed-line-faint: rgba(255, 236, 214, 0.22);
  --ed-line: rgba(255, 196, 140, 0.45);
  --ed-line-strong: rgba(255, 210, 160, 0.70);
  --ed-surface: #120e13;
  --ed-surface-top: #1a1419;
  --ed-surface-sunken: #050406;
}
#ui-root.ed-hc :focus-visible { outline-width: 3px; }
#ui-root.ed-hc .ed-hud-card, #ui-root.ed-hc .ed-tooltip, #ui-root.ed-hc .ed-train, #ui-root.ed-hc .ed-tip, #ui-root.ed-hc .ed-boonpick,
#ui-root.ed-hc .ed-class-card, #ui-root.ed-hc .character-card { background: #120e13; }
#ui-root.ed-hc .ed-slot { border-color: rgba(255, 236, 214, 0.38); background: #050406; }
#ui-root.ed-hc .ed-slot.has-item { border-width: 2px; border-color: var(--ed-tier); }
/* THE INTERFACE'S SIZE (round 3 part 27c - ui/UiScale.js; Settings > Display
 * > Interface size). While the factor is not 1 the root carries this class
 * and `--ed-ui`: it is made that much smaller and scaled back up from its
 * top left corner, so it still covers the window and everything in it is
 * laid out in INTERFACE pixels - the ones the canvas's interface pass is
 * drawn in, so the two stay pinned to each other. `--ed-vw` and `--ed-vh`
 * are the window in those pixels: the stylesheets read them where they
 * would say 100vw / 100vh (and fall back to those at 100%, when neither is
 * set). */
#ui-root.ed-ui-scaled {
  width: calc(100% / var(--ed-ui, 1));
  height: calc(100% / var(--ed-ui, 1));
  transform: scale(var(--ed-ui, 1));
  transform-origin: 0 0;
}
#ui-root {
  font-family: var(--ed-font-ui);
  font-size: calc(15px * var(--ed-fs));
  line-height: 1.4;
  color: var(--ed-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
/* Element defaults carry NO specificity (:where), so any .ed-* class wins. */
:where(#ui-root) :where(button, input, select, textarea) {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}
:where(#ui-root) ::selection { background: rgba(255, 138, 61, 0.38); color: #fff; }
:where(#ui-root) :focus { outline: none; }
:where(#ui-root) :focus-visible { outline: 2px solid var(--ed-gold-300); outline-offset: 2px; }
/* Tabs over a long window's page (ui/Tabs.js): Settings, the event board. */
#ui-root .ed-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 10px 24px 0;
  border-bottom: 1px solid var(--ed-line-faint);
}
#ui-root .ed-tab {
  padding: 7px 14px 8px;
  cursor: pointer;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--ed-text-3);
  font-size: calc(14px * var(--ed-fs));
  font-weight: 600;
}
/* What a tab is not showing: off the page, whatever its own class says. */
#ui-root .ed-tab-off { display: none !important; }
#ui-root .ed-tab:hover { color: var(--ed-text); }
#ui-root .ed-tab.is-on {
  border-color: var(--ed-line);
  background: rgba(255, 140, 60, 0.1);
  color: var(--ed-gold-300);
}
/* The ring a controller's d-pad moves, and the line that says its buttons
 * (ui/PadMenu.js). The ring is a class, not :focus-visible: a browser does
 * not always show that for a focus set by script. */
#ui-root .ed-padfocus { outline: 3px solid var(--ed-gold-300); outline-offset: 2px; }
/* an item lifted by the pad's Y (2026-11-20 - ui/PadMenu.js pick and place):
   faded, with a dashed ring, until A puts it down */
#ui-root .ed-padlift { outline: 2px dashed var(--ed-gold-300); outline-offset: 2px; opacity: 0.55; }
#ui-root .ed-padbar {
  padding: 4px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 196, 140, 0.32);
  background: rgba(14, 10, 8, 0.86);
  color: var(--ed-gold-300);
  font-size: calc(12px * var(--ed-fs));
  white-space: nowrap;
}
/* `hidden` means hidden, whatever display a class gives the element. */
#ui-root [hidden] { display: none !important; }
#ui-root * {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 170, 90, 0.30) transparent;
}
#ui-root ::-webkit-scrollbar { width: 8px; height: 8px; }
#ui-root ::-webkit-scrollbar-track { background: transparent; }
#ui-root ::-webkit-scrollbar-thumb {
  background: rgba(255, 170, 90, 0.26);
  border: 2px solid transparent;
  border-radius: 8px;
  background-clip: padding-box;
}
#ui-root ::-webkit-scrollbar-thumb:hover { background-color: rgba(255, 170, 90, 0.42); }

/* ---- Type ---- */
.ed-display {
  font-family: var(--ed-font-display);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.ed-eyebrow {
  font-size: calc(13px * var(--ed-fs));
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ed-gold-400);
}
.ed-pixel {
  font-family: var(--ed-font-pixel);
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.ed-muted { color: var(--ed-text-3); }
.ed-num { font-variant-numeric: tabular-nums; }

/* The game's name, in the display face with the ember fill. */
.ed-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  user-select: none;
}
.ed-logo__into {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--ed-font-pixel);
  font-size: 16px;
  letter-spacing: 0.5em;
  padding-left: 0.5em; /* letter-spacing trails the last glyph - balance it */
  color: var(--ed-gold-400);
  text-shadow: 0 0 12px rgba(255, 170, 80, 0.35);
}
.ed-logo__into::before, .ed-logo__into::after {
  content: '';
  width: 56px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 176, 110, 0.65));
}
.ed-logo__into::after { background: linear-gradient(90deg, rgba(255, 176, 110, 0.65), transparent); }
.ed-logo__name {
  font-family: var(--ed-font-display);
  font-weight: 500;
  font-size: 64px;
  line-height: 0.95;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  background: linear-gradient(180deg, #fff3dc 0%, #ffd08a 30%, #ff9a4a 62%, #e2581c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 0 rgba(70, 18, 0, 0.9)) drop-shadow(0 0 22px rgba(255, 110, 40, 0.38));
}
.ed-logo--sm .ed-logo__name { font-size: 40px; }
.ed-logo--sm .ed-logo__into { font-size: 12px; }
.ed-logo--sm .ed-logo__into::before, .ed-logo--sm .ed-logo__into::after { width: 36px; }

/* ---- Surfaces ---- */
.ed-panel {
  position: relative;
  background: linear-gradient(180deg, var(--ed-surface-top), var(--ed-surface));
  border: 1px solid var(--ed-line);
  border-radius: var(--ed-r-lg);
  box-shadow: var(--ed-shadow-2);
}
/* the ember hairline along a panel's top edge */
.ed-panel--lit::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 14%;
  right: 14%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 170, 90, 0.75), transparent);
  pointer-events: none;
}
.ed-well {
  background: var(--ed-surface-sunken);
  border: 1px solid var(--ed-line-faint);
  border-radius: var(--ed-r);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.45);
}
.ed-divider {
  height: 1px;
  border: 0;
  margin: 0;
  background: linear-gradient(90deg, transparent, var(--ed-line-strong), transparent);
}
.ed-section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: calc(16px * var(--ed-fs));
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--ed-gold-300);
}
.ed-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--ed-line-strong), transparent);
}

/* A full-screen menu layer (sign-in, character select, death). Transparent:
 * the canvas under it draws the ember backdrop (ui/EmberBackdrop.js). Its
 * content is centred by auto margins, not justify-content, so a window too
 * short for it scrolls to the top instead of cutting the top off. */
.ed-screen {
  position: absolute;
  inset: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px;
  overflow: auto;
  animation: ed-fade-in var(--ed-slow) var(--ed-ease) both;
}
.ed-screen > :first-child { margin-top: auto; }
.ed-screen > :last-child { margin-bottom: auto; }

/* A dialog over the game: the scrim, then the box. */
.ed-scrim {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, rgba(8, 6, 10, 0.55), rgba(4, 3, 6, 0.80));
  animation: ed-fade-in var(--ed-med) var(--ed-ease) both;
}
.ed-modal {
  position: relative;
  display: flex;
  flex-direction: column;
  max-height: calc(var(--ed-vh, 100vh) - 48px);
  background: linear-gradient(180deg, var(--ed-surface-top), var(--ed-surface));
  border: 1px solid var(--ed-line-strong);
  border-radius: var(--ed-r-xl);
  box-shadow: var(--ed-shadow-2);
  animation: ed-pop-in 240ms var(--ed-ease) both;
}
.ed-modal::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 16%;
  right: 16%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 170, 90, 0.8), transparent);
  pointer-events: none;
}
.ed-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px 12px;
}
.ed-modal__title {
  margin: 0;
  font-family: var(--ed-font-display);
  font-weight: 500;
  font-size: calc(24px * var(--ed-fs));
  line-height: 1.1;
  letter-spacing: 0.03em;
  color: var(--ed-gold-300);
  text-shadow: 0 0 16px rgba(255, 160, 70, 0.25);
}
.ed-modal__body {
  padding: 4px 22px 18px;
  overflow: auto;
}
.ed-modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--ed-line-faint);
}
.ed-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--ed-r);
  background: transparent;
  color: var(--ed-text-3);
  font-size: calc(18px * var(--ed-fs));
  line-height: 1;
  cursor: pointer;
  transition: color var(--ed-fast) var(--ed-ease), background-color var(--ed-fast) var(--ed-ease), border-color var(--ed-fast) var(--ed-ease);
}
.ed-close:hover { color: var(--ed-text); background: rgba(255, 176, 110, 0.08); border-color: var(--ed-line); }

/* ---- Buttons ---- */
.ed-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 20px;
  box-sizing: border-box;
  border: 1px solid var(--ed-line-strong);
  border-radius: var(--ed-r);
  background: linear-gradient(180deg, rgba(255, 236, 214, 0.06), rgba(255, 236, 214, 0.015)), var(--ed-surface-raised);
  color: var(--ed-text);
  font-family: var(--ed-font-ui);
  font-size: calc(15px * var(--ed-fs));
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  box-shadow: inset 0 1px 0 rgba(255, 236, 214, 0.05), 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: background-color var(--ed-fast) var(--ed-ease), border-color var(--ed-fast) var(--ed-ease),
    color var(--ed-fast) var(--ed-ease), box-shadow var(--ed-med) var(--ed-ease), transform var(--ed-fast) var(--ed-ease),
    filter var(--ed-fast) var(--ed-ease), opacity var(--ed-fast) var(--ed-ease);
}
.ed-btn:hover { border-color: rgba(255, 176, 110, 0.55); color: #fff; background-color: #251e26; }
.ed-btn:active { transform: translateY(1px); }
.ed-btn:disabled, .ed-btn.is-disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
  filter: saturate(0.35);
}
.ed-btn--primary {
  border-color: rgba(255, 196, 140, 0.6);
  background: linear-gradient(180deg, #ffad66 0%, #ff8238 52%, #e75e1f 100%);
  color: var(--ed-text-on-ember);
  text-shadow: 0 1px 0 rgba(255, 222, 186, 0.4);
  box-shadow: inset 0 1px 0 rgba(255, 240, 220, 0.6), inset 0 -2px 0 rgba(120, 36, 0, 0.35), 0 6px 22px rgba(255, 100, 28, 0.30);
}
.ed-btn--primary:hover {
  color: var(--ed-text-on-ember);
  border-color: rgba(255, 214, 170, 0.85);
  filter: brightness(1.07);
  box-shadow: inset 0 1px 0 rgba(255, 240, 220, 0.6), inset 0 -2px 0 rgba(120, 36, 0, 0.35), 0 8px 30px rgba(255, 100, 28, 0.46);
}
.ed-btn--primary:disabled, .ed-btn--primary.is-disabled { box-shadow: none; }
.ed-btn--danger {
  border-color: rgba(255, 98, 87, 0.42);
  background: rgba(255, 98, 87, 0.06);
  color: var(--ed-danger-text);
  box-shadow: none;
}
.ed-btn--danger:hover { border-color: rgba(255, 98, 87, 0.78); background: rgba(255, 98, 87, 0.15); color: #ffc4be; }
/* a destructive action the player has already been asked about (the confirm) */
.ed-btn.ed-btn--danger-solid {
  border-color: rgba(255, 150, 140, 0.75);
  background: linear-gradient(180deg, #ff6a5c, #c9362c);
  color: #fff;
  box-shadow: 0 4px 16px rgba(201, 54, 44, 0.35);
}
.ed-btn.ed-btn--danger-solid:hover { filter: brightness(1.08); color: #fff; }
/* the death screen's one way forward - a primary in blood, not ember */
.ed-btn.ed-btn--crimson {
  border-color: rgba(255, 160, 150, 0.6);
  background: linear-gradient(180deg, #ff7465 0%, #e0402f 52%, #a8261c 100%);
  color: #fff;
  text-shadow: 0 1px 0 rgba(80, 0, 0, 0.45);
  box-shadow: inset 0 1px 0 rgba(255, 220, 210, 0.45), inset 0 -2px 0 rgba(80, 0, 0, 0.35), 0 6px 24px rgba(224, 64, 47, 0.32);
}
.ed-btn.ed-btn--crimson:hover {
  color: #fff;
  border-color: rgba(255, 190, 180, 0.85);
  box-shadow: inset 0 1px 0 rgba(255, 220, 210, 0.45), inset 0 -2px 0 rgba(80, 0, 0, 0.35), 0 8px 30px rgba(224, 64, 47, 0.48);
}
.ed-btn--ghost {
  border-color: transparent;
  background: transparent;
  color: var(--ed-text-2);
  box-shadow: none;
}
.ed-btn--ghost:hover { border-color: var(--ed-line); background: rgba(255, 176, 110, 0.07); color: var(--ed-text); }
.ed-btn--sm { min-height: 34px; padding: 0 14px; font-size: calc(13px * var(--ed-fs)); letter-spacing: 0.01em; }
/* the big primary (BEGIN RUN, PLAY) speaks in the game's own face */
.ed-btn--lg { min-height: 52px; padding: 0 32px; font-family: var(--ed-font-display); font-size: calc(19px * var(--ed-fs)); font-weight: 500; letter-spacing: 0.04em; border-radius: var(--ed-r); }
.ed-btn--block { display: flex; width: 100%; }
.ed-btn.is-busy { cursor: progress; }

/* ---- Fields ---- */
.ed-field { display: flex; flex-direction: column; gap: 7px; }
.ed-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: calc(13px * var(--ed-fs));
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ed-text-2);
}
.ed-label__hint {
  font-size: calc(12px * var(--ed-fs));
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ed-text-3);
  text-align: right;
}
.ed-input {
  display: block;
  width: 100%;
  height: 42px;
  box-sizing: border-box;
  padding: 0 14px;
  border: 1px solid var(--ed-line);
  border-radius: var(--ed-r);
  background: var(--ed-surface-sunken);
  color: var(--ed-text);
  font-size: calc(15px * var(--ed-fs));
  font-weight: 500;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.45);
  transition: border-color var(--ed-fast) var(--ed-ease), box-shadow var(--ed-med) var(--ed-ease), background-color var(--ed-fast) var(--ed-ease);
}
.ed-input::placeholder { color: var(--ed-text-4); font-weight: 400; }
.ed-input:hover { border-color: rgba(255, 176, 110, 0.26); }
#ui-root .ed-input:focus, #ui-root .ed-input:focus-visible {
  outline: none;
  border-color: var(--ed-line-hot);
  background: rgba(12, 9, 13, 0.88);
  box-shadow: 0 0 0 3px rgba(255, 122, 47, 0.18), inset 0 1px 2px rgba(0, 0, 0, 0.45);
}
.ed-input.is-invalid { border-color: rgba(255, 98, 87, 0.7); }
.ed-input:-webkit-autofill,
.ed-input:-webkit-autofill:hover,
.ed-input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--ed-text);
  caret-color: var(--ed-text);
  box-shadow: 0 0 0 1000px #0e0b10 inset;
  transition: background-color 600000s 0s;
}
.ed-input--sm { height: 34px; font-size: calc(14px * var(--ed-fs)); padding: 0 10px; }
/* an input with a small button inside its right edge (show/hide password) */
.ed-input-wrap { position: relative; }
.ed-input-wrap .ed-input { padding-right: 64px; }
.ed-input-wrap__btn {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--ed-r-sm);
  background: transparent;
  color: var(--ed-text-3);
  font-size: calc(12px * var(--ed-fs));
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: color var(--ed-fast) var(--ed-ease), background-color var(--ed-fast) var(--ed-ease);
}
.ed-input-wrap__btn:hover { color: var(--ed-ember-300); background: rgba(255, 176, 110, 0.08); }
.ed-error { min-height: 16px; font-size: calc(13px * var(--ed-fs)); color: var(--ed-danger-text); }
.ed-error:empty { display: none; }

/* Checkbox rows - <label class="ed-check"><input type=checkbox><span>text</span></label> */
.ed-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: calc(14px * var(--ed-fs));
  line-height: 1.4;
  color: var(--ed-text-2);
  cursor: pointer;
  transition: color var(--ed-fast) var(--ed-ease);
}
.ed-check:hover { color: var(--ed-text); }
.ed-check input[type='checkbox'], .ed-checkbox {
  -webkit-appearance: none;
  appearance: none;
  flex: 0 0 auto;
  display: grid;
  place-content: center;
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  border: 1px solid rgba(255, 176, 110, 0.38);
  border-radius: 5px;
  background: var(--ed-surface-sunken);
  cursor: pointer;
  transition: background-color var(--ed-fast) var(--ed-ease), border-color var(--ed-fast) var(--ed-ease), box-shadow var(--ed-med) var(--ed-ease);
}
.ed-check input[type='checkbox']::before, .ed-checkbox::before {
  content: '';
  width: 10px;
  height: 10px;
  background: var(--ed-text-on-ember);
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
  transform: scale(0);
  transition: transform var(--ed-fast) var(--ed-ease);
}
.ed-check:hover input[type='checkbox'], .ed-checkbox:hover { border-color: rgba(255, 176, 110, 0.6); }
.ed-check input[type='checkbox']:checked, .ed-checkbox:checked {
  border-color: #ffbd85;
  background: linear-gradient(180deg, #ffad66, #ff7a2f);
  box-shadow: 0 0 10px rgba(255, 122, 47, 0.38);
}
.ed-check input[type='checkbox']:checked::before, .ed-checkbox:checked::before { transform: scale(1); }

/* An on/off switch - <input type=checkbox class="ed-toggle"> */
.ed-toggle {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  flex: 0 0 auto;
  width: 38px;
  height: 22px;
  margin: 0;
  border: 1px solid var(--ed-line-strong);
  border-radius: 999px;
  background: rgba(255, 236, 214, 0.07);
  cursor: pointer;
  transition: background-color var(--ed-med) var(--ed-ease), border-color var(--ed-med) var(--ed-ease), box-shadow var(--ed-med) var(--ed-ease);
}
.ed-toggle::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #c9bdb1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
  transition: transform var(--ed-med) var(--ed-ease), background-color var(--ed-med) var(--ed-ease);
}
.ed-toggle:hover { border-color: rgba(255, 176, 110, 0.55); }
.ed-toggle:checked {
  border-color: #ffbd85;
  background: linear-gradient(180deg, #ff9f58, #e8611f);
  box-shadow: 0 0 12px rgba(255, 110, 40, 0.30);
}
.ed-toggle:checked::before { transform: translateX(16px); background: #fff6ec; }

/* A slider - <input type=range class="ed-range">; Theme.syncRange paints the
 * filled part in Chromium (--fill), Firefox draws it with -moz-range-progress. */
/* (round 2 part 25i1: HUD opacity's slider is off while high contrast is on) */
.ed-range:disabled { opacity: 0.45; cursor: default; }
.ed-range {
  -webkit-appearance: none;
  appearance: none;
  --fill: 50%;
  width: 100%;
  height: 22px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
.ed-range::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--ed-ember-400) 0, var(--ed-ember-500) var(--fill), rgba(255, 236, 214, 0.10) var(--fill));
}
.ed-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -5px;
  border: 2px solid var(--ed-ember-400);
  border-radius: 50%;
  background: #fff4e8;
  box-shadow: 0 0 0 3px rgba(255, 122, 47, 0.16), 0 2px 6px rgba(0, 0, 0, 0.55);
  transition: box-shadow var(--ed-med) var(--ed-ease);
}
.ed-range:hover::-webkit-slider-thumb { box-shadow: 0 0 0 5px rgba(255, 122, 47, 0.22), 0 2px 6px rgba(0, 0, 0, 0.55); }
.ed-range::-moz-range-track { height: 6px; border-radius: 999px; background: rgba(255, 236, 214, 0.10); }
.ed-range::-moz-range-progress { height: 6px; border-radius: 999px; background: linear-gradient(90deg, var(--ed-ember-400), var(--ed-ember-500)); }
.ed-range::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 2px solid var(--ed-ember-400);
  border-radius: 50%;
  background: #fff4e8;
  box-shadow: 0 0 0 3px rgba(255, 122, 47, 0.16), 0 2px 6px rgba(0, 0, 0, 0.55);
}

/* A dropdown - <select class="ed-select">; the chevron is two gradients. */
.ed-select {
  -webkit-appearance: none;
  appearance: none;
  min-height: 34px;
  box-sizing: border-box;
  padding: 0 34px 0 12px;
  border: 1px solid var(--ed-line-strong);
  border-radius: var(--ed-r);
  background-color: var(--ed-surface-sunken);
  background-image: linear-gradient(45deg, transparent 50%, var(--ed-text-2) 50%), linear-gradient(135deg, var(--ed-text-2) 50%, transparent 50%);
  background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  color: var(--ed-text);
  font-size: calc(14px * var(--ed-fs));
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--ed-fast) var(--ed-ease);
}
.ed-select:hover { border-color: rgba(255, 176, 110, 0.55); }
.ed-select option { background: #18131a; color: var(--ed-text); }

/* ---- Small things ---- */
.ed-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 0 13px;
  box-sizing: border-box;
  border: 1px solid var(--ed-line-strong);
  border-radius: 999px;
  background: rgba(255, 236, 214, 0.025);
  color: var(--ed-text-2);
  font-size: calc(13px * var(--ed-fs));
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--ed-fast) var(--ed-ease), border-color var(--ed-fast) var(--ed-ease), color var(--ed-fast) var(--ed-ease), box-shadow var(--ed-med) var(--ed-ease);
}
.ed-chip:hover { border-color: rgba(255, 176, 110, 0.6); color: var(--ed-text); background: rgba(255, 176, 110, 0.07); }
.ed-chip.is-selected {
  border-color: #ffc08a;
  background: linear-gradient(180deg, rgba(255, 166, 98, 0.30), rgba(255, 122, 47, 0.16));
  color: var(--ed-gold-200);
  box-shadow: 0 0 14px rgba(255, 110, 40, 0.25);
}
.ed-chip.is-locked { color: var(--ed-text-3); border-style: dashed; }
.ed-chip:disabled, .ed-chip[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }

.ed-kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  min-height: calc(20px * var(--ed-fs));
  padding: 1px 6px;
  box-sizing: border-box;
  border: 1px solid rgba(255, 196, 140, 0.32);
  border-bottom-width: 2px;
  border-radius: var(--ed-r-sm);
  background: rgba(255, 236, 214, 0.05);
  color: var(--ed-gold-300);
  font-family: var(--ed-font-ui);
  font-size: calc(12px * var(--ed-fs));
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  vertical-align: 1px;
  white-space: nowrap;
}

.ed-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--ed-line-strong);
  background: rgba(255, 236, 214, 0.04);
  color: var(--ed-text-2);
  font-size: calc(12px * var(--ed-fs)); /* (11 until 2026-11-02 - DESIGN.md's floor is 12) */
  font-weight: 700;
  letter-spacing: 0.01em;
}
.ed-badge--ember { border-color: rgba(255, 170, 100, 0.55); background: rgba(255, 122, 47, 0.14); color: var(--ed-ember-200); }
.ed-badge--danger { border-color: rgba(255, 98, 87, 0.5); background: rgba(255, 98, 87, 0.12); color: var(--ed-danger-text); }

/* The Embers balance as a pill. The icon is a small ember-cut diamond. */
.ed-embers {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 0 14px 0 12px;
  box-sizing: border-box;
  border: 1px solid rgba(255, 170, 100, 0.40);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 140, 60, 0.15), rgba(255, 110, 40, 0.05));
  box-shadow: inset 0 1px 0 rgba(255, 220, 180, 0.08);
  color: var(--ed-gold-200);
  font-size: calc(15px * var(--ed-fs));
  font-weight: 700;
}
.ed-embers__value { font-variant-numeric: tabular-nums; }
.ed-embers__label {
  font-size: calc(12px * var(--ed-fs));
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ed-text-3);
}
.ed-embers__icon {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  transform: rotate(45deg);
  background: linear-gradient(135deg, #fff0cf 0%, #ffb062 38%, #ff7a2f 62%, #b8400f 100%);
  box-shadow: 0 0 8px rgba(255, 122, 47, 0.75);
}

.ed-link {
  color: var(--ed-text-3);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color var(--ed-fast) var(--ed-ease), border-color var(--ed-fast) var(--ed-ease);
  cursor: pointer;
}
.ed-link:hover { color: var(--ed-ember-300); border-bottom-color: rgba(255, 176, 110, 0.45); }

/* A status line under a form: info while working, error when refused. */
.ed-status {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  min-height: 18px;
  font-size: calc(14px * var(--ed-fs));
  line-height: 1.4;
  text-align: center;
  color: var(--ed-text-2);
}
.ed-status--error { color: var(--ed-danger-text); }
.ed-status--info { color: var(--ed-info); }
.ed-status--success { color: var(--ed-success); }

.ed-spinner {
  display: inline-block;
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
  box-sizing: border-box;
  border: 2px solid rgba(255, 176, 110, 0.22);
  border-top-color: var(--ed-ember-400);
  border-radius: 50%;
  animation: ed-spin 0.8s linear infinite;
}

/* A hovering info card (item tooltips and the like). */
.ed-tooltip {
  box-sizing: border-box;
  min-width: 190px;
  max-width: 300px;
  padding: 10px 12px 11px;
  border: 1px solid var(--ed-line-strong);
  border-radius: var(--ed-r-lg);
  background: linear-gradient(180deg, rgba(34, 27, 34, 0.98), rgba(17, 13, 18, 0.98));
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 226, 196, 0.05);
  color: var(--ed-text-2);
  font-size: calc(13px * var(--ed-fs));
  line-height: 1.45;
}

/* A short-lived toast (an announcement that is DOM, not canvas). */
.ed-toast {
  padding: 9px 16px;
  border: 1px solid var(--ed-line-strong);
  border-radius: 999px;
  background: rgba(20, 16, 21, 0.92);
  box-shadow: var(--ed-shadow-1);
  color: var(--ed-text);
  font-size: calc(14px * var(--ed-fs));
  font-weight: 500;
  animation: ed-rise-in var(--ed-med) var(--ed-ease) both;
}

/* ---- Motion ---- */
@keyframes ed-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes ed-rise-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes ed-pop-in { from { opacity: 0; transform: translateY(8px) scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes ed-spin { to { transform: rotate(360deg); } }
@keyframes ed-breathe { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; } }
.ed-rise-in { animation: ed-rise-in var(--ed-slow) var(--ed-ease) both; }

@media (prefers-reduced-motion: reduce) {
  #ui-root *, #ui-root *::before, #ui-root *::after {
    animation-duration: 1ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
  .ed-spinner { animation-duration: 1.6s !important; animation-iteration-count: infinite !important; }
}
