  :is(.stat-tracker, .dps-breakdown) { position: fixed; right: max(12px, env(safe-area-inset-right)); bottom: max(100px, calc(env(safe-area-inset-bottom) + 90px)); width: max-content; min-width: min(228px, calc(100vw - 24px)); max-width: calc(100vw - 24px); max-height: calc(100dvh - 24px); overflow: hidden auto; z-index: 4; pointer-events: auto; background: rgba(24, 24, 24, var(--stat-tracker-bg, .6)); color: var(--text, #f5f5e9); border: var(--hud-border) solid var(--hud-frame); border-color: color-mix(in srgb, var(--hud-frame) calc(var(--stat-tracker-ink, 1) * 100%), transparent); border-radius: var(--hud-radius-small); box-shadow: 0 2px 0 color-mix(in srgb, var(--ui-outline) calc(var(--stat-tracker-ink, 1) * 100%), transparent); outline: var(--hud-border) solid color-mix(in srgb, var(--ui-outline) calc(var(--stat-tracker-ink, 1) * 100%), transparent); outline-offset: -1px; font: 12px/1.3 "Wildstat Chat", sans-serif; font-variant-numeric: tabular-nums; }
  /* The slider fades the backdrop to nothing but keeps everything readable:
     text, frame and the slider itself bottom out at a quarter, never at zero. */
  :is(.stat-tracker, .dps-breakdown) > header, :is(.stat-tracker, .dps-breakdown) > table, :is(.stat-tracker, .dps-breakdown) > footer, :is(.stat-tracker, .dps-breakdown) > .stat-tracker-opacity { opacity: var(--stat-tracker-ink, 1); }
  /* Above HUD controls (5–8), below full-screen windows (10+). */
  #hud > :is(.stat-tracker, .dps-breakdown) { z-index: 6; }
  /* Temporary settings must stay above the floating Auto Farm/Mine/Chop control. */
  #hud > .stat-tracker-settings { z-index: 9; }
  /* Quest tracker: top left under the gem row until dragged. Three quests in play, this map's first and bright. */
  .quest-tracker { position: fixed; top: calc(var(--hud-safe-top) + var(--player-hud-visual-height) + 40px + var(--hud-secondary-wrap, 0px)); left: var(--hud-safe-left); z-index: 5; width: min(196px, 46vw); padding: 0 0 4px; border: var(--hud-border) solid var(--hud-frame); border-radius: var(--hud-radius-small); background: var(--hud-surface); box-shadow: var(--ui-shadow); outline: var(--hud-seam); outline-offset: -1px; color: #fff; font: 700 11px/1.25 "Wildstat Chat", sans-serif; pointer-events: auto; }
  .quest-tracker[hidden] { display: none; }
  /* Under the FPS readout when it shows, the same 4px apart (body.fps-status-shown, app-shell-controller.ts). */
  body.fps-status-shown .quest-tracker { top: calc(var(--hud-safe-top) + var(--player-hud-visual-height) + 74px + var(--hud-secondary-wrap, 0px)); }
  .quest-tracker .quest-tracker-header:active { cursor: grabbing; }
  .quest-tracker.is-world-gesture, .quest-tracker.is-world-gesture * { pointer-events: none; }
  .quest-tracker .quest-tracker-header { display: flex; align-items: center; gap: 6px; width: 100%; min-height: 30px; margin: 0; padding: 4px 8px; border: 0; border-radius: 0; background: transparent; box-shadow: none; color: inherit; font: inherit; font-size: 13px; text-align: left; cursor: grab; touch-action: none; }
  .quest-tracker .quest-tracker-header:active { transform: none; }
  .quest-tracker .quest-tracker-header:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
  .quest-tracker-title { font-weight: 900; letter-spacing: .03em; }
  .quest-tracker-week { margin-left: auto; color: #ffd66b; font-variant-numeric: tabular-nums; }
  .quest-tracker-chevron { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor; opacity: .8; transition: transform .15s; }
  .quest-tracker.is-collapsed { width: auto; padding-bottom: 0; }
  /* Minimized, it is the same 30px chip as the stat tracker and FPS readout, border and all. */
  .quest-tracker.is-collapsed { height: 30px; }
  .quest-tracker.is-collapsed .quest-tracker-header { height: 100%; min-height: 0; padding: 0 8px; }
  .quest-tracker.is-collapsed .quest-tracker-chevron { transform: rotate(-90deg); }
  .quest-tracker.is-collapsed .quest-tracker-list { display: none; }
  .quest-tracker-list { display: grid; gap: 5px; margin: 0; padding: 0 8px; list-style: none; }
  /* The × that turns it off, over the header's right end; it asks first and says where to turn it back on. */
  .quest-tracker { --quest-hide-size: 30px; }
  .quest-tracker.has-hide:not(.is-collapsed) .quest-tracker-header { padding-right: calc(var(--quest-hide-size) + 2px); }
  .quest-tracker .quest-tracker-hide { position: absolute; top: 0; right: 0; display: grid; place-items: center; width: var(--quest-hide-size); height: var(--quest-hide-size); min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; color: #fff; font: 700 20px/1 Arial, sans-serif; opacity: .8; }
  .quest-tracker .quest-tracker-hide:active { transform: none; opacity: 1; }
  .quest-tracker .quest-tracker-hide[hidden], .quest-tracker.is-collapsed .quest-tracker-hide, .quest-tracker.is-confirming .quest-tracker-list { display: none; }
  .quest-tracker-confirm { display: grid; gap: 6px; padding: 2px 8px 4px; font-size: 13px; }
  .quest-tracker-confirm[hidden], .quest-tracker.is-collapsed .quest-tracker-confirm { display: none; }
  .quest-tracker-confirm p { margin: 0; color: #e8ece9; font-weight: 700; }
  .quest-tracker-confirm-actions { display: flex; gap: 6px; }
  .quest-tracker .quest-tracker-confirm-actions button { flex: 1; min-height: 30px; margin: 0; padding: 4px 6px; border: 2px solid #fff; border-radius: var(--hud-radius-small); background: #111; box-shadow: none; color: #fff; font: 900 13px/1.1 var(--font-rounded); }
  .quest-tracker .quest-tracker-confirm-actions .quest-tracker-confirm-keep { border-color: rgba(255,255,255,.35); background: transparent; }
  .quest-tracker .quest-tracker-confirm-actions button:active { transform: none; background: #333; }
  .quest-tracker-item { display: grid; gap: 2px; }
  /* A quest on another map is dimmed, but not its location line: that is what says where to go. */
  .quest-tracker-item:not(.is-here) > :not(.quest-tracker-where) { opacity: .6; }
  .quest-tracker-line { display: flex; justify-content: space-between; gap: 6px; }
  .quest-tracker-enemy { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .quest-tracker-label { display: flex; align-items: baseline; gap: 5px; min-width: 0; }
  .quest-tracker-stat { flex: none; font-weight: 800; }
  .quest-tracker-count { flex: none; font-variant-numeric: tabular-nums; }
  .quest-tracker-item.is-here .quest-tracker-count { color: #ffd66b; }
  .quest-tracker-bar { height: 3px; overflow: hidden; border-radius: 2px; background: rgba(255,255,255,.18); }
  .quest-tracker-bar > span { display: block; height: 100%; background: #ffd66b; transition: width .2s; }
  .quest-tracker-where[hidden] { display: none; }
  .quest-tracker-where { overflow: hidden; color: #e8ece9; font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
  .quest-tracker-item.is-here .quest-tracker-where { color: var(--green); }
  :is(.stat-tracker, .dps-breakdown).is-world-gesture, :is(.stat-tracker, .dps-breakdown).is-world-gesture * { pointer-events: none; }
  :is(.stat-tracker, .dps-breakdown).is-collapsed { width: max-content; max-width: calc(100vw - 24px); overflow: hidden; }
  :is(.stat-tracker, .dps-breakdown)[hidden], :is(.stat-tracker, .dps-breakdown) [hidden] { display: none; }
  :is(.stat-tracker, .dps-breakdown) header, :is(.stat-tracker, .dps-breakdown) footer { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 0 8px; }
  :is(.stat-tracker, .dps-breakdown) button { color: inherit; background: transparent; border: 0; margin: 0; padding: 4px 6px; min-height: 32px; font: inherit; cursor: pointer; }
  :is(.stat-tracker, .dps-breakdown) button:active { transform: none; }
  :is(.stat-tracker, .dps-breakdown) :is(.stat-tracker-handle, .dps-breakdown-handle) { flex: 1; text-align: left; white-space: nowrap; font-weight: 800; cursor: grab; touch-action: none; }
  :is(.stat-tracker-handle, .dps-breakdown-handle):active { cursor: grabbing; }

  :is(.stat-tracker, .dps-breakdown) button:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; border-radius: 6px; }
  :is(.stat-tracker, .dps-breakdown) table { width: 100%; border-collapse: collapse; }
  :is(.stat-tracker, .dps-breakdown) th, :is(.stat-tracker, .dps-breakdown) td { padding: 3px 6px; text-align: right; white-space: nowrap; }
  :is(.stat-tracker, .dps-breakdown) th:first-child { text-align: left; }
  :is(.stat-tracker, .dps-breakdown) thead { color: var(--muted); font-size: 10px; }
  :is(.stat-tracker, .dps-breakdown) tbody tr { border-top: 1px solid var(--border); }
  .stat-tracker .positive { color: var(--green); }
  .stat-tracker .negative { color: var(--red); }
  /* DPS breakdown: the stat tracker's card, right side above it until dragged; each row's backdrop fills to its share. */
  .dps-breakdown { bottom: auto; top: calc(var(--hud-safe-top) + var(--player-hud-visual-height) + 120px + var(--hud-secondary-wrap, 0px)); min-width: min(200px, calc(100vw - 24px)); }
  .dps-breakdown tbody tr { background: linear-gradient(90deg, rgba(255, 255, 255, .14) var(--share, 0%), transparent var(--share, 0%)); }
  .dps-breakdown footer { min-height: 26px; color: var(--muted); }
  .dps-breakdown-empty { max-width: 200px; margin: 0; padding: 2px 8px 8px; color: var(--muted); opacity: var(--stat-tracker-ink, 1); }
  .stat-tracker-opacity { display: block; margin: 0 8px 7px; }
  .stat-tracker-opacity input { -webkit-appearance: none; appearance: none; width: 100%; height: 18px; background: none; cursor: pointer; }
  .stat-tracker-opacity input::-webkit-slider-runnable-track { height: 3px; border-radius: 2px; background: var(--border); }
  .stat-tracker-opacity input::-moz-range-track { height: 3px; border-radius: 2px; background: var(--border); }
  .stat-tracker-opacity input::-moz-range-progress { height: 3px; border-radius: 2px; background: var(--green); }
  .stat-tracker-opacity input::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 14px; height: 14px; margin-top: -5.5px; border: 2px solid var(--hud-frame); border-radius: 50%; background: var(--green); }
  .stat-tracker-opacity input::-moz-range-thumb { width: 14px; height: 14px; border: 2px solid var(--hud-frame); border-radius: 50%; background: var(--green); }
  .stat-tracker-reset { text-decoration: none; }
  /* The gear and the settings card it opens, drawn as the tracker is but always solid enough to read. */
  .stat-tracker .stat-tracker-gear { display: grid; flex: 0 0 auto; place-items: center; width: 32px; padding: 4px; }
  .stat-tracker-gear img { width: 18px; height: 18px; object-fit: contain; pointer-events: none; }
  .stat-tracker.stat-tracker-settings { --stat-tracker-bg: .92; --stat-tracker-ink: 1; min-width: 0; width: 220px; padding-bottom: 10px; }
  .stat-tracker-settings > * { opacity: 1; }
  .stat-tracker-settings header { padding: 0 4px 0 10px; }
  .stat-tracker-settings-title { font-weight: 800; }
  .stat-tracker-settings .stat-tracker-opacity { display: grid; gap: 2px; margin: 4px 10px 8px; color: var(--muted); font-size: 11px; }
  .stat-tracker-filters, .stat-tracker-compact-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 8px; margin: 0 10px 8px; padding: 6px 0 0; border: 0; border-top: 1px solid var(--border); }
  .stat-tracker-filters legend, .stat-tracker-compact-options legend { float: left; grid-column: 1 / -1; width: 100%; margin-bottom: 2px; padding: 0; color: var(--muted); font-size: 11px; }
  .stat-tracker-show-options { margin: 0 10px 8px; border-top: 1px solid var(--border); }
  .stat-tracker-show-options > summary { padding: 8px 0; cursor: pointer; font: inherit; font-size: 11px; color: var(--muted); }
  .stat-tracker-show-options > :is(.stat-tracker-filters, .stat-tracker-compact-options) { margin: 0; padding: 0; border: 0; }
  .stat-tracker-settings label:not(.stat-tracker-opacity) { display: flex; align-items: center; gap: 6px; min-height: 28px; cursor: pointer; }
  .stat-tracker.stat-tracker-settings [hidden] { display: none; }
  .stat-tracker-settings input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--green); cursor: pointer; }
  .stat-tracker:not(.stat-tracker-settings).is-compact { min-width: 0; width: max-content; font-size: 12px; }
  .stat-tracker-stat-icon { display: block; width: 16px; height: 16px; }
  .stat-tracker-dps { min-width: 0; contain: inline-size; border-top: 1px solid var(--border); opacity: var(--stat-tracker-ink, 1); }
  .stat-tracker .stat-tracker-view-switch { flex: 0 0 auto; min-width: 32px; padding: 4px; font-size: 18px; }
  .stat-tracker .stat-tracker-dps-toggle { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 4px 6px; font-size: 12px; }
  .stat-tracker-dps-toggle > span:first-child { min-width: 0; overflow-wrap: anywhere; }
  .stat-tracker-dps-details { padding: 0 6px 4px; min-width: 0; contain: inline-size; overflow-wrap: anywhere; }
  .stat-tracker-dps-details dl { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 3px 6px; margin: 0; }
  .stat-tracker-dps-row { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; background: linear-gradient(90deg, rgba(255, 255, 255, .14) var(--share, 0%), transparent var(--share, 0%)); }
  .stat-tracker-dps-details dt, .stat-tracker-dps-details dd { margin: 0; }
  .stat-tracker-dps-details dt { white-space: nowrap; }
  .stat-tracker.is-dps-view .stat-tracker-dps, .stat-tracker.is-dps-view .stat-tracker-dps-details { contain: none; }
  .stat-tracker.is-dps-view .stat-tracker-dps-details dl { grid-template-columns: max-content auto auto; }
  .stat-tracker.is-dps-view .stat-tracker-dps-toggle > span:first-child { white-space: nowrap; }
  .stat-tracker-dps-details p { contain: inline-size; }
  .stat-tracker-dps-details dd { text-align: right; }
  .stat-tracker-dps-heading, .stat-tracker-dps-details p { color: var(--muted); font-size: 11px; }
  .stat-tracker-dps-details p { margin: 4px 0; }
  .stat-tracker-dps-status { display: flex; align-items: center; gap: 6px; }
  .stat-tracker-dps-status p { flex: 1; min-width: 0; }
  .stat-tracker .stat-tracker-dps-back { flex: 0 0 auto; padding-inline: 2px; font-size: 11px; }
  .is-position-locked :is(.stat-tracker-handle, .dps-breakdown-handle), .mysterious-ore-timer.is-position-locked .mysterious-ore-timer-handle { cursor: default; }
  .is-position-locked :is(.stat-tracker-handle, .dps-breakdown-handle)::after, .is-position-locked .mysterious-ore-timer-handle::after { content: ""; display: inline-block; width: 10px; height: 12px; margin-left: 5px; vertical-align: -1px; background: currentColor; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 16'%3E%3Cpath d='M2 6V4a4 4 0 0 1 8 0v2h1v10H1V6zm2 0h4V4a2 2 0 0 0-4 0z'/%3E%3C/svg%3E") center / contain no-repeat; }
  .stat-tracker.is-compact header { gap: 2px; padding: 0 2px; }
  .stat-tracker.is-compact .stat-tracker-handle { padding-inline: 2px; }
  .stat-tracker.is-compact .stat-tracker-view-switch { min-width: 24px; padding-inline: 2px; }
  .stat-tracker.is-compact .stat-tracker-gear { width: 24px; padding-inline: 2px; }
  .stat-tracker.is-compact .stat-tracker-time { color: var(--muted); white-space: nowrap; }
  .stat-tracker.is-compact.is-collapsed .stat-tracker-time { display: none; }
  .stat-tracker.is-compact th, .stat-tracker.is-compact td { padding: 3px 5px; }
  .stat-tracker.is-compact footer { gap: 4px; padding: 0 5px; }
  .stat-tracker-settings .stat-tracker-compact-option { min-height: 44px; margin: 4px 10px 8px; }
  .stat-tracker-mode-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 4px 10px 8px; }
  .stat-tracker-settings .stat-tracker-mode-options label { margin: 0; white-space: nowrap; }
  .stat-tracker-settings .stat-tracker-compact-options label { min-height: 28px; margin: 0; }
  .stat-tracker-settings > .stat-tracker-reset { margin: 6px 10px 0; }
  .stat-tracker-prestige-reset { margin: 0 10px; padding-top: 6px; border-top: 1px solid var(--border); }
  @media (any-pointer: coarse) { :is(.stat-tracker, .dps-breakdown):not(.is-collapsed) button { min-height: 44px; } }
  /* Folded, it is one row the size of the folded quest tracker, not a tall touch block. */
  :is(.stat-tracker, .dps-breakdown).is-collapsed { min-width: 0; border-radius: var(--hud-radius-small); font: 700 13px/1.25 "Wildstat Chat", sans-serif; }
  :is(.stat-tracker, .dps-breakdown).is-collapsed header { padding: 0; }
  /* Minimized, it stands as tall as the gem and mail row beside it, border and all. */
  :is(.stat-tracker, .dps-breakdown).is-collapsed { box-sizing: border-box; height: 30px; }
  :is(.stat-tracker, .dps-breakdown).is-collapsed header { height: 100%; }
  :is(.stat-tracker, .dps-breakdown).is-collapsed :is(.stat-tracker-handle, .dps-breakdown-handle) { box-sizing: border-box; height: 100%; min-height: 0; padding: 0 8px; border: 0; }
  @media (max-width: 380px) { :is(.stat-tracker, .dps-breakdown) { font-size: 11px; } :is(.stat-tracker, .dps-breakdown) th, :is(.stat-tracker, .dps-breakdown) td { padding: 3px 5px; } }

  @font-face {
    font-family: "Wildstat Chat";
    font-style: normal;
    font-weight: 400 900;
    font-display: swap;
    src: url("fonts/nunito-latin-v32.20fc9b6fc618e7c3.woff2") format("woff2");
  }

  :root {
    color-scheme: dark;
    --panel: rgba(18, 18, 18, .90);
    /* One opaque off-black surface for every game window and toolbar. */
    --window-surface: #131413;
    --window-surface-neutral: var(--window-surface);
    --window-surface-green: var(--window-surface);
    --window-surface-brown: var(--window-surface);
    --window-surface-gold: var(--window-surface);
    --window-surface-red: var(--window-surface);
    --window-surface-blue: var(--window-surface);
    --window-surface-purple: var(--window-surface);
    --panel2: var(--window-surface-neutral);
    --border: rgba(255,255,255,.14);
    --text: #f5f5e9;
    --muted: #b7c5b7;
    --green: #69e56f;
    --gold: #ffd85b;
    --red: #ff6767;
    --stat-armor: #74d8ff;
    --stat-regen: #ff7ccb;
    --font-rounded: "Arial Rounded MT Bold", "Arial Rounded MT", Arial, sans-serif;
    --chat-font: "Arial Rounded MT Bold", "Arial Rounded MT", "Wildstat Chat", Arial, sans-serif;
    --player-name-font: var(--font-rounded);
    --font-readable-min: 11px;
    --font-readable-label: 12px;
    --font-readable-body: 14px;
    --font-readable-title: 17px;
    --line-height-readable: 1.3;
    --profile-portrait-sheet-size: 824%;
    --text-outline-width: .08em;
    --text-shadow: .06em .10em 0 #000;
    --text-shadow-large: .06em .10em 0 #000;
    --window-content-max-width: 420px;
    --game-window-width: min(420px, calc(100vw - 24px));
    --inventory-toolbar-color: #543822;
    --hud-surface: rgba(24, 24, 24, .60);
    --ui-outline: #0f0f0f;
    --ui-shadow: 0 2px 0 var(--ui-outline);
    --ui-seam: 2px solid var(--ui-outline);
    /* The HUD's frames (player card, gem row, minimap, trackers, timers): thinner than windows'. */
    --hud-border: 1.5px;
    --hud-seam: var(--hud-border) solid var(--ui-outline);
    --hud-frame: var(--ui-outline);
    --hud-radius: 9px;
    --hud-radius-small: 8px;
    --hud-edge-gap: 8px;
    --hud-safe-top: max(var(--hud-edge-gap), env(safe-area-inset-top, 0px));
    --hud-safe-left: max(var(--hud-edge-gap), env(safe-area-inset-left, 0px));
    --hud-safe-right: max(var(--hud-edge-gap), env(safe-area-inset-right, 0px));
    --hud-row-height: clamp(59px, 8.5vw, 63px);
    --hud-map-size: calc(var(--hud-row-height) * 2);
    --player-hud-height: calc(var(--hud-row-height) + 16px);
    --player-hud-scale: .8;
    --player-hud-visual-height: clamp(60px, calc(6.8vw + 12.8px), 63.2px);
    --mini-chat-height: 58px;
    --mini-chat-font-size: var(--font-readable-min);
    --toolbar-button-height: 58px;
    --toolbar-height: calc(var(--toolbar-button-height) + env(safe-area-inset-bottom, 0px));
    --gameplay-bottom-inset: var(--toolbar-height);
    --window-bottom-inset: var(--toolbar-height);
    --window-back-bottom-gap: 9px;
  }

  * {
    box-sizing: border-box;
    font-family: var(--font-rounded);
    -webkit-text-stroke: var(--text-outline-width) #000;
    paint-order: stroke fill;
    text-shadow: var(--text-shadow);
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    scrollbar-color: rgba(205, 216, 208, .62) transparent;
    scrollbar-width: thin;
  }
  /* Safari on a Mac lifts an image out of the page when a click drags it a
     pixel, and a firm trackpad click opens its own preview of it: a player
     tapping the settings gear saw the gear fill the screen. Images never
     drag, and an icon inside a button leaves the click to the button. */
  img { -webkit-user-drag: none; }
  button img { pointer-events: none; }

  *::-webkit-scrollbar { width: 7px; height: 7px; background: transparent; }
  *::-webkit-scrollbar-track,
  *::-webkit-scrollbar-track-piece,
  *::-webkit-scrollbar-corner { background: transparent; }
  *::-webkit-scrollbar-thumb { border-radius: 999px; background: rgba(205, 216, 208, .62); }
  *::-webkit-scrollbar-thumb:hover { background: rgba(235, 241, 237, .78); }

  .window-title { text-transform: none; }

  html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    overscroll-behavior: none;
    background: #000;
    font-family: var(--font-rounded);
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    touch-action: none;
  }

  body { position: fixed; inset: 0; }

  canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    background: #000;
  }

  canvas#game {
    bottom: var(--gameplay-bottom-inset);
    height: auto;
  }

  #gameGpu { z-index: 0; pointer-events: none; bottom: var(--gameplay-bottom-inset); height: auto; }
  #game { z-index: 1; }
  body.has-webgl-world #game { background: transparent; }

  #hud {
    position: fixed;
    inset: 0;
    pointer-events: none;
    color: var(--text);
    text-shadow: var(--text-shadow);
    z-index: 2;
  }

  .topbar {
    position: absolute;
    left: var(--hud-safe-left);
    top: var(--hud-safe-top);
    right: var(--hud-safe-right);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
  }

  .card {
    background: var(--panel);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 8px 10px;
  }

  /* Clears the minimap and the zoom column left of it (35px and its 5px gap), unless Settings hides the zoom. */
  .player-hud-stack { display: block; width: min(420px, 68vw, calc(100vw - var(--hud-safe-left) - var(--hud-safe-right) - var(--hud-map-size) - var(--hud-edge-gap) - var(--hud-zoom-reserve, 40px))); height: var(--player-hud-height); }
  body.camera-zoom-hidden { --hud-zoom-reserve: 0px; }
  /* Phones: the card runs right up to the zoom buttons (6px off), not 68% of
     the screen with a gap before them. Desktop keeps its width. */
  @media (max-width: 760px) {
    .player-hud-stack { width: calc(100vw - var(--hud-safe-left) - var(--hud-safe-right) - var(--hud-map-size) - var(--hud-zoom-reserve, 46px)); }
    body:not(.camera-zoom-hidden) { --hud-zoom-reserve: 46px; }
    body.camera-zoom-hidden { --hud-zoom-reserve: 6px; }
  }

  .player-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 7px;
    min-width: 0;
    padding: 0 3px 0 2px;
  }

  .player-hud-card { position: relative; z-index: 3; isolation: isolate; display: grid; grid-template-columns: var(--hud-row-height) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); align-items: stretch; column-gap: 8px; width: 100%; height: 100%; min-height: 0; padding: 6px 8px 6px 6px; overflow: hidden; border: var(--hud-border) solid var(--hud-frame); border-radius: var(--hud-radius); background: var(--hud-surface); box-shadow: var(--ui-shadow); outline: var(--hud-seam); outline-offset: -1px; transform: scale(var(--player-hud-scale)); transform-origin: top left; }
  .player-hud-content { display: grid; grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 4px; min-width: 0; min-height: 0; }
  .profile-icon { flex: 0 0 auto; margin: 0; padding: 0; overflow: hidden; border: 2px solid var(--ui-outline); border-radius: 7px; background-color: #fff; background-repeat: no-repeat; background-size: var(--profile-portrait-sheet-size) var(--profile-portrait-sheet-size); background-clip: padding-box; -webkit-text-stroke: 0; text-shadow: none; }
  .profile-icon-button { width: 100%; height: 100%; align-self: stretch; border-radius: 5px; cursor: pointer; }
  #playerHudProfileIcon:active { transform: none; }
  .profile-window-icon { width: 58px; min-width: 58px; height: 58px; cursor: default; }
  .profile-window-icon.is-editable { position: relative; border-color: var(--ui-outline); cursor: pointer; }
  #profileIconPicker { position: fixed; inset: 0; z-index: 13; display: grid; place-items: center; padding: 10px; background: transparent; }
  #profileIconPicker[hidden] { display: none; }
  .profile-icon-picker-modal { display: grid; grid-template-rows: minmax(0, 1fr) auto; width: var(--game-window-width); max-height: calc(100vh - 18px); padding: 12px; overflow: hidden; text-align: left; }
  .profile-icon-choices { grid-row: 4; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-content: start; gap: 8px; min-height: 0; margin: 0; padding: 4px; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; }
  .profile-icon-choice { aspect-ratio: 1; width: 100%; margin: 0; padding: 0; border: 2px solid var(--ui-outline); border-radius: 6px; background-color: #fff; background-repeat: no-repeat; background-size: var(--profile-portrait-sheet-size) var(--profile-portrait-sheet-size); background-clip: padding-box; }
  .profile-icon-choice.is-selected { border-color: var(--green); box-shadow: 0 0 0 1px rgba(105,229,111,.5); }
  .profile-icon-cropped { position: relative; }
  .profile-icon-art { position: absolute; display: block; background-repeat: no-repeat; pointer-events: none; }
  /* A snapshot wearing a galaxy piece, drawn live over the portrait's backdrop (profile-icons.ts). */
  .profile-icon-live { position: absolute; inset: 0; display: block; width: 100%; height: 100%; border-radius: inherit; background: transparent; image-rendering: auto; pointer-events: none; }

  #playerPower {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    color: var(--gold);
    font-size: 12.5px;
    letter-spacing: .035em;
    text-align: right;
  }
  .power-icon { display: inline-block; flex: 0 0 auto; object-fit: contain; }
  .power-icon-hud { width: 18px; height: 18px; }
  /* An upgrade's power jump (power-jump-effect.ts): the number glows and the gain rises above it. */
  #playerPower { position: relative; }
  #playerPower.is-power-jump .power-value { animation: power-jump-glow 1.1s ease-out; }
  .power-jump-gain { position: fixed; z-index: 60; transform-origin: right center; color: #fff; font-size: 15px; font-weight: 900; white-space: nowrap;
    -webkit-text-stroke: 3px #000; paint-order: stroke fill; pointer-events: none; animation: power-jump-rise 1.6s ease-out forwards; }
  @keyframes power-jump-glow { 0%, 40% { text-shadow: 0 0 8px #fff, 0 0 2px #fff; transform: scale(1.18); } 100% { text-shadow: none; transform: none; } }
  @keyframes power-jump-rise { 0% { opacity: 0; transform: translateY(4px) scale(.9); } 15% { opacity: 1; transform: translateY(-2px) scale(1.1); }
    70% { opacity: 1; transform: translateY(-18px); } 100% { opacity: 0; transform: translateY(-30px); } }
  @media (prefers-reduced-motion: reduce) { #playerPower.is-power-jump .power-value { animation: none; } .power-jump-gain { animation-duration: 2.4s; } }
  .player-hud-card { --prestige-badge-size: 18px; }

  .settings-wrap {
    position: fixed;
    inset: auto 0 0;
    z-index: 7;
    display: flex;
    width: 100vw;
    height: var(--toolbar-height);
    min-height: var(--toolbar-height);
    padding: 0 max(0px, env(safe-area-inset-right)) 0 max(0px, env(safe-area-inset-left));
    gap: 0;
    border: 0;
    background: rgba(8,13,10,.96);
    box-shadow: 0 -2px 0 var(--ui-outline), 0 -4px 14px rgba(0,0,0,.34);
    pointer-events: auto;
  }

  .settings-button {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    height: 100%;
    margin: 0;
    padding: 0 0 env(safe-area-inset-bottom, 0px);
    border: 0;
    border-radius: 0;
    background: var(--window-surface);
    color: var(--text);
    font: 900 24px/1 var(--font-rounded);
    text-shadow: var(--text-shadow);
    transition: box-shadow 160ms ease-in-out;
  }

  .settings-button[hidden] { display: none; }

  :root.has-fullscreen-window {
    --window-bottom-inset: 0px;
    --window-back-bottom-gap: max(9px, env(safe-area-inset-bottom, 0px));
  }
  /* Panels are children of the toolbar; hide only its navigation and chrome. */
  .has-fullscreen-window #toolbar { background: transparent; box-shadow: none; pointer-events: none; }
  .has-fullscreen-window #toolbar > .settings-button { display: none; }


  .toolbar-icon {
    display: block;
    width: 31px;
    height: 31px;
    object-fit: contain;
    pointer-events: none;
  }
  .town-button { position: relative; }
  .town-teleport-cooldown { position: absolute; top: calc((100% - env(safe-area-inset-bottom, 0px) - 44px) / 2); left: 50%; display: grid; place-items: center; width: 31px; height: 31px; transform: translateX(-50%); border-radius: 50%; background: #152c3e; color: #fff; font: 900 17px/1 var(--font-rounded); text-shadow: 0 1px 2px #000; pointer-events: none; }
  .town-teleport-cooldown::before { position: absolute; inset: -2px; border-radius: 50%; background: conic-gradient(#8bd6ff var(--cooldown-progress, 100%), rgba(139,214,255,.16) 0); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 0); mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 0); content: ""; }
  .town-teleport-cooldown[hidden] { display: none; }
  #townBtn.is-town-cooldown { opacity: 1; }
  #townBtn.is-town-cooldown .toolbar-icon { visibility: hidden; }
  .inventory-notice { position: absolute; top: 12%; left: calc(50% + 8px); width: 8px; height: 8px; border: 1px solid #fff; border-radius: 50%; background: #e63d3d; box-shadow: 0 1px 0 var(--ui-outline); pointer-events: none; }
  .inventory-notice[hidden] { display: none; }
  /* A card effect's "[40%×3]": one card's share times the copies, dimmed so the total reads first. */
  .card-effect-stack { opacity: .6; }
  /* Join requests waiting, for the guild's President and Vice President; the Guilds button uses the Inventory's dot. */
  .guild-request-dot { position: absolute; top: 3px; right: 3px; width: 8px; height: 8px; border: 1px solid #fff; border-radius: 50%; background: #e63d3d; box-shadow: 0 1px 0 var(--ui-outline); pointer-events: none; }
  .guild-request-dot[hidden] { display: none; }
  .has-guild-request-dot:not(#guildBtn) { position: relative; }

  .toolbar-label { max-width: 100%; overflow: hidden; color: #fff; font: 900 10px/1 var(--font-rounded); letter-spacing: .01em; text-align: center; text-overflow: clip; white-space: nowrap; -webkit-text-stroke: 0; text-shadow: 1px 1px 0 #000; }

  .settings-button.is-off {
    background: var(--window-surface);
    color: #f5c7c4;
  }
  .settings-button[aria-expanded="true"] {
    background: #1b1c1b;
    box-shadow: inset 0 3px 0 var(--green), inset 0 0 0 2px rgba(105,229,111,.18);
  }
  #leaderboardBtn { background: var(--window-surface); }
  #townBtn { background: var(--window-surface); }
  #inventoryBtn { background: var(--window-surface); }
  #shopBtn { background: var(--window-surface); }
  #settingsBtn { background: transparent; box-shadow: none; }
  #leaderboardBtn[aria-expanded="true"] { background: #1b1c1b; box-shadow: inset 0 3px 0 #d5bd73, inset 0 0 0 2px rgba(213,189,115,.21); }
  #townBtn[aria-expanded="true"] { background: #1b1c1b; box-shadow: inset 0 3px 0 #74c7ef, inset 0 0 0 2px rgba(116,199,239,.18); }
  #inventoryBtn[aria-expanded="true"] { background: #1b1c1b; box-shadow: inset 0 3px 0 #bf875c, inset 0 0 0 2px rgba(191,135,92,.18); }
  #settingsBtn[aria-expanded="true"] { background: transparent; box-shadow: none; }
  .settings-button:active { filter: brightness(1.16); transform: none; }

  .fps-status { position: fixed; top: calc(var(--hud-safe-top) + var(--player-hud-visual-height) + 40px + var(--hud-secondary-wrap, 0px)); bottom: auto; left: var(--hud-safe-left); z-index: 5; display: flex; align-items: center; gap: 7px; height: 30px; padding: 0 8px; border: var(--hud-border) solid var(--hud-frame); border-radius: var(--hud-radius-small); background: var(--hud-surface); box-shadow: var(--ui-shadow); outline: var(--hud-seam); outline-offset: -1px; color: #fff; font: 700 13px/1.25 "Wildstat Chat", sans-serif; white-space: nowrap; pointer-events: none; }
  .fps-status[hidden] { display: none; }

  .card.settings-panel {
    position: fixed;
    inset: 0 0 var(--window-bottom-inset);
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: auto;
    height: auto;
    max-height: none;
    padding: max(12px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left));
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: var(--window-surface-neutral);
    box-shadow: none;
    pointer-events: auto;
    transform: none;
  }

  .settings-panel[hidden] { display: none; }

  .settings-panel > * { flex: 0 0 auto; width: min(520px, 100%); }
  .settings-panel .setting-row { min-height: 40px; padding: 1px 0; }
  .settings-panel .setting-row + .setting-row { margin-top: 2px; }
  .settings-panel .setting-toggle { min-height: 36px; }
  /* Game's sections: a quiet heading over a hairline, none above the first. */
  .settings-section-title { margin: 12px 0 2px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.12); color: #9a9a9a; font: 900 13px/1 var(--font-rounded); letter-spacing: .04em; }
  .settings-section-title:first-child { margin-top: 0; padding-top: 2px; border-top: 0; }
  /* On/off settings are switches: grey off, the chat send button's green on. */
  .settings-panel .setting-toggle[aria-pressed] {
    position: relative; flex: 0 0 auto; width: 56px; min-width: 56px; height: 36px; margin: 0; padding: 0;
    border: 0; background: none; box-shadow: none; color: transparent; font-size: 0; text-shadow: none; filter: none; transform: none;
  }
  .settings-panel .setting-toggle[aria-pressed]::before {
    content: ""; position: absolute; top: 50%; left: 4px; right: 4px; height: 26px; margin-top: -13px; border-radius: 13px;
    background: #3a3a3a; box-shadow: inset 0 0 0 1px rgba(255,255,255,.14); transition: background-color .15s;
  }
  .settings-panel .setting-toggle[aria-pressed="true"]::before { background: linear-gradient(#63ad5c, #347536); box-shadow: inset 0 0 0 1px #18371b; }
  .settings-panel .setting-toggle[aria-pressed]::after {
    content: ""; position: absolute; top: 50%; left: 8px; width: 18px; height: 18px; margin-top: -9px; border-radius: 50%;
    background: #bdbdbd; box-shadow: 0 1px 2px rgba(0,0,0,.5); transition: transform .15s, background-color .15s;
  }
  .settings-panel .setting-toggle[aria-pressed="true"]::after { background: #fff; transform: translateX(22px); }
  .settings-panel .setting-toggle[aria-pressed]:hover, .settings-panel .setting-toggle[aria-pressed]:active { background: none; filter: none; transform: none; }
  .settings-panel .setting-toggle[aria-pressed]:focus-visible { outline: 2px solid rgba(255,255,255,.7); outline-offset: 0; border-radius: 18px; }
  /* Buttons that act (Enter, Sign In, Replay): the chat send green, not the bright one. */
  .settings-panel .setting-toggle:not([aria-pressed]):not(.danger) { border-color: #18371b; background: linear-gradient(#63ad5c, #347536); box-shadow: 0 3px 0 #18371b; }
  .settings-tabs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; padding-bottom: 8px; }
  .settings-tabs [hidden] { display: none; }
  .map-guide-collected-count { margin-left: 8px; font-size: 13px; font-weight: 700; color: rgba(255,255,255,.7); }
  .map-guide-collected { display: inline-block; margin-top: 4px; font-size: 13px; font-weight: 700; color: var(--gold); }
  .controls-settings { display: flex; flex-direction: column; gap: 6px; }
  .controls-status { margin: 0 0 4px; font-size: 13px; opacity: .85; }
  .controls-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 6px; font-size: 13px; }
  .controls-header { font-size: 13px; opacity: .7; }
  .controls-list { display: flex; flex-direction: column; gap: 6px; }
  .controls-settings .controls-bind { min-width: 0; min-height: 40px; font-size: 13px; background: linear-gradient(#3a3a3a, #262626); border-color: #555; color: #fff; box-shadow: none; text-shadow: none; }
  .controls-settings .controls-bind:disabled { opacity: .55; cursor: default; }
  .controls-settings .controls-bind.is-listening { border-color: var(--gold); color: var(--gold); }
  .controls-help { margin: 6px 0 0; font-size: 13px; line-height: 1.4; opacity: .75; }
  .controls-settings .controls-reset { background: linear-gradient(#3a3a3a, #262626); border-color: #555; color: #fff; box-shadow: none; text-shadow: none; }
  .controls-settings .controls-reset { align-self: flex-start; min-height: 44px; margin-top: 8px; font-size: 13px; }
  /* A controller moves focus without a keyboard, so its highlight is drawn whenever one is in use. */
  html[data-input="gamepad"] .pad-focus { outline: 3px solid var(--gold) !important; outline-offset: 2px; }
  .settings-panel .settings-connection { min-height: 28px; margin: 0 0 8px; padding-inline: 12px; font-size: 11px; opacity: .8; }
  .settings-panel > .settings-content { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; padding: 2px 12px 12px; }
  .settings-panel > .settings-content::-webkit-scrollbar { display: none; }
  .settings-tab-panel[hidden] { display: none; }
  /* Search: one box under the tabs; while it has words, every tab's matching rows show at once under the tab's name. */
  .settings-search { padding: 0 12px 8px; }
  .settings-search input { box-sizing: border-box; width: 100%; height: 38px; padding: 0 12px; border: 1px solid rgba(255,255,255,.18); border-radius: 8px; background: #111214; color: #f4f4f2; font: 800 14px/1 var(--font-rounded); }
  .settings-search input::placeholder { color: #8c919a; }
  .settings-search input:focus { outline: 2px solid rgba(255,255,255,.35); outline-offset: 1px; }
  .settings-tabs.is-searching { opacity: .45; }
  .settings-content.is-searching > .settings-tab-panel[hidden] { display: block; }
  .settings-content.is-searching > .settings-tab-panel::before { content: attr(data-search-label); display: block; margin: 12px 0 2px; color: #9a9a9a; font: 900 13px/1 var(--font-rounded); }
  .settings-content.is-searching :is(.is-search-hidden, .is-search-empty) { display: none !important; }
  .settings-search-empty { margin: 16px 0; color: #9a9a9a; font: 800 14px/1.3 var(--font-rounded); text-align: center; }
  .settings-disclosure { margin-top: 12px; border-top: 1px solid rgba(255,255,255,.12); }
  .settings-disclosure > summary { min-height: 44px; padding: 10px 0; cursor: pointer; color: inherit; font: 900 13px/1.3 var(--font-rounded); }
  .settings-disclosure > summary:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
  .settings-disclosure-description { margin-left: 10px; color: #9a9a9a; font-size: 11px; font-weight: 400; }
  @media (max-width: 600px) {
    .settings-disclosure-description { display: block; margin: 4px 0 0 14px; }
  }
  .settings-disclosure-content { padding: 0 0 6px 12px; border-left: 2px solid rgba(255,255,255,.12); }
  .mysterious-ore-timer { position: fixed; left: max(12px, env(safe-area-inset-left)); bottom: max(100px, calc(env(safe-area-inset-bottom) + 90px)); display: flex; align-items: center; height: 30px; width: max-content; max-width: calc(100vw - 24px); overflow: auto; z-index: 6; pointer-events: auto; border: var(--hud-border) solid var(--hud-frame); border-radius: var(--hud-radius-small); background: var(--hud-surface); box-shadow: var(--ui-shadow); outline: var(--hud-seam); outline-offset: -1px; color: #fff; font: 700 13px/1.25 "Wildstat Chat", sans-serif; font-variant-numeric: tabular-nums; }
  .mysterious-ore-timer[hidden], .mysterious-ore-timer [hidden] { display: none; }
  .mysterious-ore-timer.is-world-gesture, .mysterious-ore-timer.is-world-gesture * { pointer-events: none; }

  .mysterious-ore-timer button { box-sizing: border-box; height: 100%; min-height: 0; margin: 0; padding: 0 8px; border: 0; border-radius: 0; background: transparent; color: inherit; font: inherit; text-shadow: inherit; box-shadow: none; white-space: nowrap; }
  .mysterious-ore-timer button:active { transform: none; }
  .mysterious-ore-timer .mysterious-ore-timer-handle { flex: 1; text-align: left; cursor: grab; touch-action: none; }
  .settings-tab-panel .setting-reset { margin-top: 28px; }
  /* The Graphics readout: plain read-only lines, the tip dimmer. */
  .graphics-info { display: grid; gap: 4px; padding: 6px 0 2px; }
  .graphics-info p { margin: 0; font-size: 13px; line-height: 1.35; color: #e6e6e6; overflow-wrap: anywhere; }
  .graphics-info p[hidden] { display: none; }
  .graphics-info .graphics-tip { color: #a8a8a8; }

  .card.inventory-panel {
    --inventory-surface: #1e1e1e;
    --inventory-surface-deep: #111111;
    --inventory-ink: #f4f3e8;
    --inventory-muted: #aebcaf;
    --inventory-line: rgba(255,255,255,.17);
    --inventory-gold: #e0aa42;
    position: fixed;
    inset: 0 0 var(--window-bottom-inset);
    z-index: 10;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    width: auto;
    height: auto;
    max-height: none;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    outline: 0;
    background: var(--window-surface-brown);
    box-shadow: none;
    color: var(--inventory-ink);
    color-scheme: dark;
    pointer-events: auto;
    transform: none;
  }

  .inventory-panel[hidden] { display: none; }
  .inventory-panel, .inventory-panel * { -webkit-text-stroke: 0; paint-order: normal; text-shadow: none; }

  .inventory-capacity { margin: 0 auto; color: var(--inventory-muted); font-size: var(--font-readable-min); font-weight: 900; letter-spacing: .04em; text-align: center; white-space: nowrap; }

  .inventory-scroll { min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
  .inventory-tabs { margin-inline: auto; width: min(100%, 448px); justify-self: center; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; min-height: 50px; padding: 0 max(14px, env(safe-area-inset-right)) 6px max(14px, env(safe-area-inset-left)); border-bottom: 1px solid transparent; background: transparent; }
  .inventory-tab { position: relative; min-width: 0; height: 44px; min-height: 44px; margin: 0; padding: 0 10px 5px; border: 0; border-radius: 0; background: transparent; box-shadow: none; color: #aeb9b2; font: 900 var(--font-readable-label)/1 var(--font-rounded); letter-spacing: .04em; }
  .inventory-tab::after { position: absolute; bottom: 0; left: 15%; right: 15%; height: 3px; border-radius: 2px; background: transparent; content: ""; }
  .inventory-tab.is-active { background: transparent; color: #fff4d6; box-shadow: none; }
  .inventory-tab.is-active::after { background: #e8c45f; }
  .inventory-tab:focus-visible { outline: 2px solid #fff4d6; outline-offset: 1px; }

  .inventory-content { --inventory-grid-gap: 6px; --inventory-slot-size: calc(18.75% - 3.375px); --inventory-slot-row-size: calc(18.75cqi - 3.375px); position: relative; display: grid; grid-template-columns: minmax(0, var(--window-content-max-width)); grid-template-rows: auto auto; align-items: start; align-content: stretch; justify-content: center; gap: 12px; min-height: 0; padding: clamp(12px, 2.3vw, 28px) max(clamp(12px, 2.3vw, 28px), env(safe-area-inset-right)) 0 max(clamp(12px, 2.3vw, 28px), env(safe-area-inset-left)); overflow: visible; }

  .inventory-loadout {
    position: relative;
    display: grid;
    grid-column: 1;
    grid-row: 1;
    grid-template-columns: var(--inventory-slot-size) minmax(0, 160px) var(--inventory-slot-size);
    grid-auto-rows: auto;
    justify-content: center;
    gap: var(--inventory-grid-gap);
    min-height: 0;
    padding: 7px;
  }

  .character-loadout-preview {
    position: relative;
    isolation: isolate;
    border: 2px solid var(--ui-outline);
    border-radius: 7px;
    outline: 1px solid var(--ui-outline);
    outline-offset: -3px;
    background: #31945b;
    box-shadow: none;
  }

  canvas.character-preview-canvas { position: absolute; z-index: 0; inset: 0; display: block; width: 100%; height: 100%; border-radius: 5px; background: #31945b; image-rendering: pixelated; pointer-events: none; }

  .equipment-slot {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-rows: 14px minmax(0, 1fr) 20px;
    /* One column the full width of the tile. Without it the implicit column is
       sized to its widest child, so the banner had nothing to stretch to and
       stopped short of the right edge. */
    grid-template-columns: minmax(0, 1fr);
    place-items: center;
    gap: 1px;
    width: 100%;
    height: auto;
    min-width: 0;
    aspect-ratio: 1 / 1;
    margin: 0;
    padding: 3px;
    overflow: hidden;
    border: 2px solid var(--inventory-line);
    border-radius: 8px;
    background: rgba(0,0,0,.18);
    box-shadow: none;
    color: var(--inventory-muted);
    font: 900 7px var(--font-rounded);
    line-height: 1;
  }

  .equipment-slot-label { align-self: start; color: #d6dfd7; font-size: var(--font-readable-min); letter-spacing: .03em; pointer-events: none; }
  .equipment-slot-art { display: grid; min-width: 0; min-height: 0; place-items: center; pointer-events: none; }
  /* A banner across the foot of the slot, divided from the artwork above it
     and shaded a little darker, so the level reads as a label on the tile. */
  /* max-width capped this at the grid area, which is why the negative margins
     never widened it and the banner stopped short of both edges. */
  .equipment-slot-name { align-self: stretch; justify-self: stretch; display: grid; place-items: center; margin: 2px -3px -3px; padding: 3px 4px 4px; overflow: hidden; border-top: 1px solid rgba(255,255,255,.28); background: rgba(0,0,0,.46); color: #fff; font: 800 9px/1 Arial, Helvetica, sans-serif; letter-spacing: .04em; text-align: center; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 1px 0 rgba(0,0,0,.7); pointer-events: none; }
  /* A filled equipment slot names itself in the banner, so the heading above
     would only collide with the tier badge that sits in that corner. */
  .equipment-slot.is-filled > .equipment-slot-label { visibility: hidden; }
  /* The banner already carries the level; a second copy in the corner was the
     same number twice. */
  .equipment-slot > .inventory-upgrade-level { display: none; }
  .equipment-slot-empty { color: #758178; font: 500 18px/1 Arial, sans-serif; }
  .equipment-slot.is-equipped { color: var(--inventory-ink); }
  .equipment-slot.is-cosmetic-inherited { cursor: pointer; }
  .equipment-slot.is-cosmetic-inherited .inventory-item-art { opacity: .42; filter: grayscale(.32); }
  .equipment-slot.is-cosmetic-hidden { cursor: pointer; }
  .cosmetic-hidden-icon { position: relative; display: block; width: 28px; height: 20px; }
  .cosmetic-hidden-icon::before { position: absolute; inset: 4px 5px; border: 2px solid #aeb6b1; border-radius: 70% 12%; content: ""; transform: rotate(45deg); }
  .cosmetic-hidden-icon::after { position: absolute; top: 9px; left: 0; width: 28px; height: 2px; border-radius: 999px; background: #e49a9f; box-shadow: 0 1px 0 var(--ui-outline); content: ""; transform: rotate(-36deg); }
  .equipment-slot.is-selected { z-index: 2; border-color: rgba(255,255,255,.7); box-shadow: none; }
  .equipment-slot.is-equipped-now { animation: inventory-equipped-pop .34s cubic-bezier(.2, .85, .25, 1.35); }
  .equipment-slot:hover, .equipment-slot:focus-visible { border-color: rgba(255,255,255,.5); outline: 2px solid rgba(255,255,255,.2); outline-offset: 1px; }
  .equipment-slot:active, .inventory-item:active { transform: scale(.97); }

  .slot-head { grid-column: 1; grid-row: 1; }
  .slot-chest { grid-column: 1; grid-row: 2; }
  .slot-feet { grid-column: 3; grid-row: 2; }
  .slot-right-hand { grid-column: 3; grid-row: 1; }

  .inventory-character-stage { position: relative; z-index: 1; grid-column: 2; grid-row: 1 / span 2; min-width: 0; min-height: 0; overflow: hidden; border: 0; border-radius: 3px; background: transparent; box-shadow: none; pointer-events: none; }
  .bag-section { position: relative; display: grid; grid-column: 1; grid-row: 2; grid-template-rows: auto auto auto; container-type: inline-size; align-self: stretch; min-width: 0; min-height: 0; margin: 0; padding: 7px; overflow: visible; border: 2px solid transparent; border-radius: 8px; background: transparent; box-shadow: none; }
  .inventory-section-title { margin-top: 6px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; color: #f2f4ef; font-size: var(--font-readable-label); font-weight: 900; letter-spacing: .06em; }
  .inventory-bag-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-width: 0; margin-bottom: 6px; }
  .inventory-filters { display: flex; align-items: center; gap: 7px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .inventory-filter, .inventory-equip-best { flex: 0 0 auto; min-width: 0; min-height: 30px; margin: 0; padding: 4px 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; font: 800 10px/1 var(--font-rounded); white-space: nowrap; }
  .inventory-filter { color: #aeb9b2; border-bottom: 2px solid transparent; }
  .inventory-filter[aria-pressed="true"] { color: #fff; border-bottom-color: #e8c45f; }
  .inventory-equip-best { display: flex; align-items: center; justify-content: center; height: 30px; padding: 0 8px 1px; border: 2px solid #18371e; border-radius: 6px; background: linear-gradient(#61a763, #356a3d); box-shadow: 0 2px 0 #152e1a; color: #fff; font-weight: 900; -webkit-text-stroke: var(--text-outline-width) #000; paint-order: stroke fill; text-shadow: var(--text-shadow); }
  .inventory-equip-best:active { transform: translateY(1px); box-shadow: 0 1px 0 #152e1a; }
  .inventory-equip-best[hidden] { display: none; }
  .inventory-filter:focus-visible, .inventory-equip-best:focus-visible { outline: 1px solid #fff; outline-offset: 2px; }
  /*
   * Delete mode: the trash button beside Equip best turns it on and then
   * reads "Delete"; picked bag items take a red highlight, and items the
   * server will not destroy (starter gear) are dimmed and cannot be picked.
   */
  .inventory-delete-controls { display: flex; flex: 0 0 auto; align-items: center; gap: 6px; margin-left: auto; }
  .inventory-delete-controls[hidden] { display: none; }
  .inventory-delete-toggle {
    display: flex; flex: 0 0 auto; align-items: center; justify-content: center; gap: 5px;
    min-width: 30px; height: 30px; min-height: 30px; margin: 0; padding: 0 6px;
    border: 2px solid #351010; border-radius: 6px; background: linear-gradient(#c85050, #842f34); box-shadow: 0 2px 0 #351519;
    color: #fff; font: 900 10px/1 var(--font-rounded); white-space: nowrap;
    -webkit-text-stroke: var(--text-outline-width) #000; paint-order: stroke fill; text-shadow: var(--text-shadow);
  }
  .inventory-delete-toggle:active { transform: translateY(1px); box-shadow: 0 1px 0 #351519; }
  .inventory-delete-toggle:disabled { opacity: .6; }
  .inventory-delete-toggle svg { flex: none; -webkit-text-stroke: 0; }
  .inventory-delete-label:empty { display: none; }
  .inventory-delete-controls.is-active .inventory-delete-toggle { padding: 0 9px 0 7px; }
  .inventory-delete-cancel {
    flex: 0 0 auto; min-height: 30px; margin: 0; padding: 4px 2px; border: 0; background: transparent; box-shadow: none;
    color: var(--muted); font: 800 10px/1 var(--font-rounded); white-space: nowrap; cursor: pointer;
  }
  .inventory-delete-cancel[hidden] { display: none; }
  .inventory-delete-cancel:hover { color: #fff; transform: none; }
  .inventory-delete-toggle:focus-visible, .inventory-delete-cancel:focus-visible { outline: 1px solid #fff; outline-offset: 2px; }
  .is-delete-mode .inventory-item.is-delete-selected {
    border-color: #ff5a5a; background: linear-gradient(rgba(214,58,58,.42), rgba(120,24,24,.5));
    box-shadow: 0 0 0 2px #ff5a5a, 0 0 12px rgba(255,70,70,.45);
  }
  .is-delete-mode .inventory-item.is-delete-locked { opacity: .38; cursor: not-allowed; }
  .inventory-cosmetics-note { flex: 0 0 auto; margin: 2px 8px 8px; color: #b9bdb9; font: 700 12px/1.4 var(--font-rounded); letter-spacing: 0; text-align: center; -webkit-text-stroke: 0; text-shadow: none; }
  .inventory-cosmetics-note[hidden] { display: none; }
  .inventory-items { position: relative; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); grid-auto-flow: row; grid-auto-rows: max-content; align-content: start; align-items: start; justify-content: center; gap: var(--inventory-grid-gap); min-height: 0; padding-bottom: 0; overflow: visible; overscroll-behavior: contain; scrollbar-width: none; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
  /* Overlay the values inside the square slot; artwork keeps its original dimensions. */
  .inventory-item-bonuses { position: absolute; bottom: 5px; left: 0; right: 0; display: flex; align-items: center; justify-content: center; gap: 3px; width: 100%; min-width: 0; height: 12px; pointer-events: none; }
  .inventory-item-bonuses span { font: 900 10px/12px var(--font-rounded); white-space: nowrap; -webkit-text-stroke: 0; text-shadow: 0 1px 1px #000; }
  .inventory-item-bonuses [data-stat-kind="damage"] { color: #ff8b77; }
  .inventory-item-bonuses [data-stat-kind="health"] { color: #72ef58; }
  .inventory-item-bonuses [data-stat-kind="regen"] { color: var(--stat-regen); }
  .inventory-items::-webkit-scrollbar { display: none; width: 0; height: 0; }
  .inventory-items > .inventory-item { height: auto; aspect-ratio: 1 / 1; }
  @container (max-width: 343px) {
    .inventory-items { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  }
  .inventory-item.is-locked { grid-template-rows: 1fr auto; place-items: center; gap: 2px; border-color: rgba(255,255,255,.12); background: rgba(0,0,0,.18); color: #e9dfe9; }
  .inventory-item.is-locked:disabled { opacity: .72; }
  .inventory-slot-lock-symbol { align-self: end; font: 900 22px/1 Arial, sans-serif; filter: grayscale(.2); }
  .inventory-slot-unlock-cost { display: flex; align-items: center; justify-content: center; gap: 2px; color: #fff; font: 900 var(--font-readable-min)/1 var(--font-rounded); }
  .inventory-slot-unlock-cost img { display: block; width: 15px; height: 15px; object-fit: contain; }
  .inventory-item { position: relative; display: grid; grid-template-rows: minmax(0, 1fr); place-items: center; width: 100%; min-width: 0; min-height: 0; aspect-ratio: 1 / 1; margin: 0; padding: 5px; overflow: hidden; border: 2px solid rgba(255,255,255,.15); border-radius: 7px; background: rgba(0,0,0,.18); box-shadow: none; color: var(--inventory-ink); }
  .inventory-item.is-filter-placeholder { visibility: hidden; pointer-events: none; }
  .inventory-filter-empty { position: absolute; top: 20px; left: 0; right: 0; margin: 0; text-align: center; color: var(--inventory-muted); font-size: 12px; }
  .inventory-item.is-empty { border-color: rgba(255,255,255,.09); cursor: default; }
  .inventory-item.is-filled, .equipment-slot.is-equipped { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
  .inventory-item.is-filled, .equipment-slot.is-equipped { cursor: pointer; }
  .inventory-item.is-selected { z-index: 1; border-color: rgba(255,255,255,.7); box-shadow: none; }
  .inventory-item:hover, .inventory-item:focus-visible { border-color: rgba(255,255,255,.5); outline: 2px solid rgba(255,255,255,.2); outline-offset: 1px; }
  .inventory-item-art-wrap { display: grid; width: 100%; height: 100%; min-width: 0; min-height: 0; place-items: center; pointer-events: none; }
  .inventory-item-art { transform: rotate(var(--item-art-rotation, 0deg)); display: block; width: 100%; height: 100%; background-position: center; background-size: contain; background-repeat: no-repeat; image-rendering: pixelated; }
  .inventory-item-art-wrap .inventory-item-art { width: min(62px, 90%); height: min(58px, 90%); }
  .inventory-item[data-item-id="starter_stone"] .inventory-item-art { width: min(30px, 48%); height: min(30px, 48%); }
  .inventory-item-art-wrap .boot-pixel-icon { transform: scale(1.35); }
  .equipment-slot .inventory-item-art { width: var(--equipped-art-width, 34px); height: var(--equipped-art-height, 34px); }
  /* Galaxy cosmetics: the art masks a drifting sky (painted by galaxy-finish.ts).
     Over it, the art in grey for its shading (overlay; in colour, the base set's
     own colours showed through), then its outline as a solid image drawn from
     the same line rule as the characters (--galaxy-outline), so the line stays
     black and no sky shows past it. One grid cell stacks them; the sky, the art,
     the outline and the mask are set inline (galaxyArtStyle in item-presentation.ts).
     The sky is its own layer (.galaxy-sky) two tiles wider and one taller than
     the icon, slid by transform: the compositor moves it, where a drifting
     background-position restyled the page every frame. */
  .has-galaxy-finish {
    position: relative;
    display: grid; grid-template: 1fr / 1fr; isolation: isolate; overflow: hidden;
    -webkit-mask-position: center; mask-position: center;
    -webkit-mask-size: contain; mask-size: contain;
    -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
    image-rendering: auto;
  }
  .galaxy-sky {
    position: absolute; z-index: -1; top: -96px; right: 0; bottom: 0; left: -192px;
    background: var(--galaxy-sky) 0 0 / 96px 96px repeat;
    pointer-events: none;
    animation: galaxy-art-drift 40s linear infinite;
  }
  .has-galaxy-finish::before, .has-galaxy-finish::after { content: ""; grid-area: 1 / 1; pointer-events: none; }
  .has-galaxy-finish::before { background: var(--galaxy-art) center / contain no-repeat; filter: grayscale(1); mix-blend-mode: overlay; }
  .has-galaxy-finish::after { background: var(--galaxy-outline) center / contain no-repeat; }
  @keyframes galaxy-art-drift { to { transform: translate(192px, 96px); } }
  @media (prefers-reduced-motion: reduce) { .galaxy-sky { animation: none; } }
  /* Where a plain image of the item stood, its galaxy span takes the image's place and size. */
  .item-art-image.has-galaxy-finish { display: grid; }
  .map-guide-drop-art .item-art-image { width: 50px; height: 50px; }
  .developer-item-gift .claim-art .item-art-image { width: 96px; height: 96px; margin: 0 auto; }
  /* The map an item came from. In an equipped slot it takes the corner, where
     the slot's own name is not; on a loose item it sits centred over the art. */
  .item-tier-label { position: absolute; top: 5px; left: 5px; right: auto; z-index: 1; color: #fff; font: 800 9px/11px var(--font-rounded); text-align: left; -webkit-text-stroke: 2px #080b08; paint-order: stroke fill; text-shadow: none; pointer-events: none; }
  .item-tier-label.is-above { left: 50%; right: auto; top: 2px; transform: translateX(-50%); text-align: center; }
  .item-tier-label.is-grade { color: color-mix(in srgb, var(--grade, #fff) 55%, #fff); white-space: nowrap; }
  .profile-equipment-slot > .item-tier-label { top: 3px; left: 2px; font-size: 7px; line-height: 9px; }
  .item-inspection-metadata > .item-tier-label { position: static; font-size: 13px; line-height: 16px; }
  .inventory-upgrade-level { position: absolute; top: 5px; right: 5px; z-index: 2; min-width: 0; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; color: #fff; font: 800 9px/11px var(--font-rounded); text-align: center; -webkit-text-stroke: 2px #080b08; paint-order: stroke fill; text-shadow: none; pointer-events: none; }
  .inventory-item > .inventory-upgrade-level, .slot-upgrades-queue > .inventory-upgrade-level { top: 5px; right: 5px; }
  .inventory-loadout .equipment-slot-art { width: 100%; height: 100%; place-self: stretch; }
  .inventory-loadout .equipment-slot .inventory-item-art { width: 96%; height: 96%; max-width: none; max-height: none; margin-top: 5%; }
  .inventory-loadout .equipment-slot[data-item-id="starter_stone"] .inventory-item-art { width: min(30px, 48%); height: min(30px, 48%); }

  /* The loadout used to hide this because it held the item's name, which the
     artwork already showed. It carries the slot's level now, so every tile
     keeps its banner: an empty slot reading EMPTY is the same shape as a
     filled one reading its level, and the row of tiles stays even. */
  .inventory-loadout .equipment-slot { grid-template-rows: 12px minmax(0, 1fr); }
  .inventory-loadout .equipment-slot.is-equipped { grid-template-rows: minmax(0, 1fr); }
  .inventory-loadout .equipment-slot.is-equipped .equipment-slot-label { display: none; }
  .item-inspection-metadata { display: flex; justify-content: center; align-items: center; gap: 12px; min-height: 16px; }
  .item-inspection-metadata > .inventory-upgrade-level { position: static; font-size: 13px; line-height: 16px; }


  .inventory-item-empty-mark { color: #a17932; font: 900 20px/1 Arial, sans-serif; }

  .visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
  .slot-upgrades-panel { grid-template-rows: auto minmax(0, 1fr); position: fixed; inset: 0 0 var(--window-bottom-inset); z-index: 11; display: grid; place-items: center; padding: max(12px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 14px max(14px, env(safe-area-inset-left)); overflow: hidden; background: var(--window-surface-brown); color: #f4f3e8; pointer-events: auto; }
  .slot-upgrades-panel[hidden] { display: none; }
  .slot-upgrades-content { display: grid; place-items: center; align-content: center; gap: 13px; width: min(100%, 390px); min-height: 0; text-align: center; }
  .slot-upgrades-prompt { margin: 0; color: #f6f3e7; font-size: var(--font-readable-body); font-weight: 900; line-height: var(--line-height-readable); letter-spacing: .03em; }
  .slot-upgrades-queues { display: flex; align-items: center; justify-content: center; gap: 16px; }
  .inventory-item.slot-upgrades-queue { display: grid; grid-template-rows: 1fr; place-items: center; width: clamp(60px, 18.75vw, 76px); min-width: clamp(60px, 18.75vw, 76px); height: clamp(60px, 18.75vw, 76px); min-height: clamp(60px, 18.75vw, 76px); aspect-ratio: 1; padding: 5px; }
  .inventory-item.slot-upgrades-queue[hidden] { display: none; }
  .inventory-item.slot-upgrades-queue.is-selected { border-color: #b8f29d; box-shadow: 0 0 0 2px rgba(126,220,119,.42), inset 0 -3px 0 rgba(0,0,0,.32); }
  .inventory-item.slot-upgrades-queue.is-active { background: linear-gradient(#3c321f, #211a10); }
  .inventory-item.slot-upgrades-queue.is-locked { grid-template-rows: 1fr auto; gap: 1px; border-color: #70536a; background: linear-gradient(#332832, #1b161b); color: #f0d8e6; }
  .slot-upgrades-lock-symbol { align-self: end; font: 900 22px/1 Arial, sans-serif; filter: grayscale(.2); }
  .slot-upgrades-queue-cost { display: flex; align-items: center; justify-content: center; gap: 2px; min-width: 0; color: #fff; font: 900 var(--font-readable-min)/1 var(--font-rounded); }
  .slot-upgrades-queue-cost img { display: block; width: 15px; height: 15px; object-fit: contain; }
  .slot-upgrades-queue .inventory-item-art-wrap { display: grid; width: 100%; height: 100%; place-items: center; }
  .slot-upgrades-queue .inventory-item-art { width: 82%; height: 82%; }
  .slot-upgrades-stat-gain { display: grid; gap: 5px; min-height: 20px; color: #d7dfd8; font-size: var(--font-readable-label); line-height: var(--line-height-readable); }
  .slot-upgrades-stat-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; text-align: left; }
  .slot-upgrades-stat-row strong { color: #f5f2e8; font-size: var(--font-readable-label); }
  .slot-upgrades-stat-row span { color: #8deb94; font-weight: 900; white-space: nowrap; }
  .slot-upgrades-stat-row[data-stat-kind="armor"] strong, .slot-upgrades-stat-row[data-stat-kind="armor"] span,
  .slot-upgrades-picker-stat[data-stat-kind="armor"], .slot-upgrades-picker-stat[data-stat-kind="armor"] span { color: var(--stat-armor); }
  .slot-upgrades-stat-row[data-stat-kind="regen"] strong, .slot-upgrades-stat-row[data-stat-kind="regen"] span,
  .slot-upgrades-picker-stat[data-stat-kind="regen"], .slot-upgrades-picker-stat[data-stat-kind="regen"] span { color: var(--stat-regen); }
  .slot-upgrades-timer { min-height: 20px; color: #f3cf70; font-size: var(--font-readable-body); font-weight: 900; letter-spacing: .04em; }
  .slot-upgrades-action { display: flex; align-items: center; justify-content: center; width: min(220px, 80vw); height: 44px; min-height: 44px; margin: 0; padding: 0 8px 2px; border-color: #15371b; border-radius: 8px; background: linear-gradient(#72d977, #3e9f48); box-shadow: 0 3px 0 #17361c; color: #fff; font-size: var(--font-readable-body); line-height: 1; }
  .slot-upgrades-action[hidden] { display: none; }
  .slot-upgrades-action.is-cancel { border-color: #492020; background: linear-gradient(#cf6868, #953c3c); box-shadow: 0 3px 0 #431d1d; }
  .slot-upgrades-speed-up { display: flex; align-items: center; justify-content: center; gap: 6px; border-color: #65354f; background: linear-gradient(#d86f9f, #a84573); box-shadow: 0 3px 0 #53243d; }
  .slot-upgrades-speed-up img { display: block; width: 20px; height: 20px; object-fit: contain; }
  .slot-upgrades-speed-up strong { font: inherit; }
  .slot-upgrades-action:disabled { border-color: #373737; background: #4b554f; box-shadow: none; color: #9ba49e; }
  .slot-upgrades-back { position: absolute; right: 0; bottom: var(--window-back-bottom-gap); left: 0; display: flex; align-items: center; justify-content: center; width: min(220px, 80vw); height: 44px; min-height: 44px; margin: 0 auto; padding: 0 8px 2px; border-color: #351010; border-radius: 8px; background: linear-gradient(#c85050, #842f34); box-shadow: 0 3px 0 #351519; color: #fff; font-size: var(--font-readable-body); line-height: 1; }
  .slot-upgrades-back[hidden] { display: none; }
  .slot-upgrades-picker { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; padding: 16px; background: rgba(4,8,6,.76); }
  .slot-upgrades-picker[hidden] { display: none; }
  .slot-upgrades-picker-sheet { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; min-height: 0; gap: 10px; width: min(100%, 360px); height: min(calc(100dvh - var(--window-bottom-inset) - 32px), 520px); max-height: min(calc(100dvh - var(--window-bottom-inset) - 32px), 520px); padding: 12px; overflow: hidden; border: 0; border-radius: 10px; background: var(--window-surface-brown); box-shadow: 0 20px 56px rgba(0,0,0,.72); }
  .slot-upgrades-picker-heading { color: #f4f3e8; font-size: var(--font-readable-label); font-weight: 900; letter-spacing: .05em; text-align: center; }
  .slot-upgrades-picker-items { display: grid; align-content: start; gap: 7px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; touch-action: pan-y; -webkit-overflow-scrolling: touch; }
  .slot-upgrades-picker-items::-webkit-scrollbar { display: none; }
  .slot-upgrades-picker-item { display: grid; grid-template-columns: 48px minmax(0, 1fr); align-items: center; gap: 9px; height: 72px; min-height: 72px; margin: 0; padding: 5px 9px; overflow: hidden; border: 2px solid #54462f; border-radius: 8px; background: linear-gradient(#302719, #17130d); color: #f4f3e8; text-align: left; }
  .slot-upgrades-picker-item .inventory-item-art { width: 44px; height: 44px; }
  .slot-upgrades-picker-copy { display: grid; gap: 1px; min-width: 0; pointer-events: none; }
  .slot-upgrades-picker-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; min-width: 0; }
  .slot-upgrades-picker-title strong { overflow: hidden; font-size: var(--font-readable-label); text-overflow: ellipsis; white-space: nowrap; }
  .slot-upgrades-picker-title small { flex: none; color: #f3cf70; font-size: var(--font-readable-min); }
  /* The tier badge is absolutely positioned over artwork everywhere else; in
     this row it is a word beside the name. */
  /* The sheet's own gap spaces this; a margin here would double it. */
  .slot-upgrades-picker-stats { display: grid; gap: 0; min-width: 0; }
  .slot-upgrades-picker-stat { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; color: #d7dfd8; font-size: var(--font-readable-min); line-height: 1.05; }
  .slot-upgrades-picker-stat span:last-child { color: #8deb94; font-weight: 900; white-space: nowrap; }
  .slot-upgrades-picker-stat[data-stat-kind="armor"] span:last-child { color: var(--stat-armor); }
  .slot-upgrades-picker-stat[data-stat-kind="regen"] span:last-child { color: var(--stat-regen); }
  .slot-upgrades-picker-close { min-height: 44px; margin: 0; }

  .boot-pixel-icon { display: flex; justify-content: center; gap: 3px; align-items: end; height: 22px; }
  .boot-pixel-icon i { position: relative; display: block; width: 8px; height: 15px; border: 2px solid #32190d; border-radius: 2px 2px 3px 3px; background: #d58b32; box-shadow: -2px 3px 0 #ffe47b; }

  .item-inspection-panel { position: fixed; inset: 0 0 var(--window-bottom-inset); z-index: 15; display: grid; place-items: center; padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 16px max(16px, env(safe-area-inset-left)); overflow: hidden; background: rgba(0,0,0,.4); color: #f4f3e8; pointer-events: auto; }
  .item-inspection-panel[hidden] { display: none; }
  .item-inspection-window { position: relative; display: grid; grid-template-rows: minmax(0, 1fr) auto auto; width: min(320px, 100%); max-height: 100%; min-height: 0; overflow: hidden; border: 0; border-radius: 12px; background: var(--window-surface-brown); box-shadow: 0 20px 56px rgba(0,0,0,.72); }
  .item-inspection-summary { display: grid; justify-items: center; gap: 8px; width: 100%; min-width: 0; }
  .item-inspection-preview { display: grid; justify-items: center; align-content: center; gap: 6px; min-width: 0; width: 100%; }
  .item-inspection-tools { position: absolute; top: 8px; left: 8px; z-index: 1; display: flex; align-items: center; }
  .item-inspection-name { width: calc(100% - 112px); margin: 0; color: #fff; font-size: 18px; font-weight: 900; line-height: 1.2; text-align: center; overflow-wrap: anywhere; text-transform: none; }
  .item-inspection-content { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; align-content: safe center; align-items: center; text-align: center; gap: 12px; width: 100%; min-height: 0; padding: 16px 16px 6px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; color: #c9d3cb; font-size: var(--font-readable-body); line-height: var(--line-height-readable); }
  .item-inspection-content::-webkit-scrollbar { display: none; }
  .item-inspection-icon { display: grid; place-items: center; width: 150px; height: 150px; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .item-inspection-icon img { transform: rotate(var(--item-art-rotation, 0deg)); display: block; width: 140px; height: 140px; object-fit: contain; image-rendering: pixelated; }
  .item-inspection-icon.has-fallback-art { height: 100px; }
  .item-inspection-icon .boot-pixel-icon { height: 15px; transform: scale(3); transform-origin: center top; }
  /* A short phone gives the art less room, so a weapon's stats and skills fit without scrolling. */
  @media (max-height: 720px) {
    .item-inspection-icon { width: 100px; height: 100px; }
    .item-inspection-icon img { width: 92px; height: 92px; }
  }
  .item-inspection-copy { display: grid; gap: 8px; min-width: 0; }
  .item-inspection-copy p { max-width: none; margin: 0; color: #d5ddd6; font-size: var(--font-readable-body); line-height: var(--line-height-readable); }
  .item-inspection-context { color: #f0bb61; font-size: var(--font-readable-min); font-weight: 900; letter-spacing: .04em; }
  .item-inspection-stats { display: grid; justify-items: center; gap: 5px; color: #d9e0db; font-size: 16px; font-weight: 900; letter-spacing: .01em; }
  .item-inspection-stats span { padding: 0; border: 0; background: transparent; }
  .item-inspection-stats [data-stat-kind="damage"] { color: #ff8872; }
  .item-inspection-stats [data-stat-kind="health"] { color: #69e56f; }
  .item-inspection-stats [data-stat-kind="armor"] { color: var(--stat-armor); }
  .item-inspection-stats [data-stat-kind="regen"] { color: var(--stat-regen); }
  .item-inspection-actions { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr); justify-content: center; gap: 8px; width: 100%; margin-top: 6px; }
  .item-inspection-window > .window-back-footer { padding: 2px 16px 14px; min-height: 60px; }
  .item-inspection-window .item-inspection-back { width: 100%; }
  .item-inspection-actions:empty { display: none; }
  .item-inspection-actions-host { padding: 8px 16px 0; }
  .item-inspection-actions-host:empty { display: none; }
  .item-inspection-actions-host > .item-inspection-actions { margin-top: 0; }
  .item-inspection-actions button { min-width: 0; min-height: 44px; margin: 0; padding: 8px; border: 2px solid #312a22; border-radius: 8px; box-shadow: 0 3px 0 rgba(59,46,31,.36); color: #fff; font-size: var(--font-readable-min); line-height: 1.15; }
  .item-inspection-actions button:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(59,46,31,.36); }
  .item-inspection-action-primary { background: linear-gradient(#507c51, #315c38); }
  .item-inspection-action-secondary { background: linear-gradient(#918473, #655b4e); }
  .item-inspection-actions button:disabled { border-color: #a39786; background: #d4cab9; box-shadow: none; color: #827766; cursor: default; }

  @keyframes inventory-equipped-pop {
    0% { transform: scale(.94); }
    55% { transform: scale(1.07); }
    100% { transform: scale(1); }
  }

  @media (max-width: 760px) {
    .inventory-content {
      gap: 8px;
      padding: 10px max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left));
    }
  }

  @media (max-width: 460px) {
    :root { --game-window-width: min(360px, calc(100vw - 16px)); }
    .inventory-content { --inventory-grid-gap: 4px; --inventory-slot-size: calc(18.75% - 2.25px); --inventory-slot-row-size: calc(18.75cqi - 2.25px); }
    .card.inventory-panel { max-height: none; padding: 0; }
    .inventory-capacity { font-size: var(--font-readable-min); }
    .inventory-loadout { padding: 5px; }
    .equipment-slot { grid-template-rows: 14px minmax(0, 1fr) 14px; padding: 2px; }
    .equipment-slot-label { font-size: var(--font-readable-min); }
    .equipment-slot-name { font-size: var(--font-readable-min); }
    .equipment-slot .inventory-item-art { max-width: 42px; max-height: 33px; }
    .bag-section { margin: 0; padding: 5px; }
    .inventory-section-title { margin-bottom: 4px; font-size: var(--font-readable-label); }
    .inventory-item { padding: 4px; border-radius: 6px; }
    .inventory-item-art-wrap .inventory-item-art { width: min(54px, 88%); height: min(51px, 88%); }
    .item-inspection-content { grid-template-columns: 1fr; justify-items: center; align-content: safe center; gap: 12px; padding-top: 12px; padding-bottom: 6px; text-align: center; }
    .item-inspection-stats { justify-content: center; }
    .item-inspection-actions { width: 100%; }
  }

  @media (prefers-reduced-motion: reduce) {
    .equipment-slot.is-equipped-now { animation: none; }
  }

  .settings-title {
    margin-bottom: 8px;
    color: var(--gold);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .08em;
  }

  .setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 12px;
  }

  .setting-toggle {
    min-width: 58px;
    margin: 0;
    padding: 6px 8px;
    border-width: 2px;
    border-radius: 6px;
    font-size: 12px;
  }

  .setting-row[hidden] { display: none; }
  .setting-row + .setting-row { margin-top: 9px; }

  .setting-volume { align-items: center; }
  /* One label width for both volume rows: on a narrow screen the bars shrink, and they start in line. */
  .setting-volume > label { flex: 0 0 auto; min-width: 8.5em; }

  .volume-control {
    display: flex;
    align-items: center;
    gap: 6px;
    width: min(300px, 70vw);
    min-width: 0;
  }

  .volume-control input[type="range"] {
    --volume-percent: 35%;
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    max-width: 260px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    accent-color: #4f9a4a;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
  }

  .volume-control input[type="range"]::-webkit-slider-runnable-track {
    height: 8px;
    border-radius: 999px;
    background: linear-gradient(to right, #4f9a4a 0, #4f9a4a var(--volume-percent), #3a3a3a var(--volume-percent), #3a3a3a 100%);
    box-shadow: 0 0 0 2px var(--ui-outline), inset 0 1px 2px rgba(0,0,0,.55);
  }

  .volume-control input[type="range"]::-webkit-slider-thumb {
    box-sizing: border-box;
    width: 44px;
    height: 44px;
    margin-top: -18px;
    border: 3px solid var(--ui-outline);
    border-radius: 50%;
    background: linear-gradient(#a6dd9e, #4f9a4a);
    box-shadow: 0 3px 0 var(--ui-outline), 0 0 0 2px rgba(255,255,255,.18); outline: var(--ui-seam); outline-offset: -1px;
    appearance: none;
    -webkit-appearance: none;
  }

  .volume-control input[type="range"]::-moz-range-track {
    height: 8px;
    border: 0;
    border-radius: 999px;
    background: #3a3a3a;
    box-shadow: 0 0 0 2px var(--ui-outline), inset 0 1px 2px rgba(0,0,0,.55);
  }

  .volume-control input[type="range"]::-moz-range-progress {
    height: 8px;
    border-radius: 999px;
    background: #4f9a4a;
  }

  .volume-control input[type="range"]::-moz-range-thumb {
    box-sizing: border-box;
    width: 44px;
    height: 44px;
    border: 3px solid var(--ui-outline);
    border-radius: 50%;
    background: linear-gradient(#a6dd9e, #4f9a4a);
    box-shadow: 0 3px 0 var(--ui-outline), 0 0 0 2px rgba(255,255,255,.18); outline: var(--ui-seam); outline-offset: -1px;
  }

  .volume-control output {
    flex: 0 0 42px;
    width: 42px;
    color: var(--muted);
    font-size: 10px;
    text-align: right;
  }

  .setting-reset {
    display: flex;
    justify-content: flex-start;
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,.12);
  }

  .setting-reset .danger {
    min-width: 0;
    padding-inline: 10px;
  }

  .setting-toggle.danger {
    background: linear-gradient(#b95c54, #803c38);
  }

  .setting-toggle.is-off {
    background: linear-gradient(#8c5555, #683334);
  }

  .connection-status {
    color: var(--green);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .06em;
  }

  .connection-status.is-offline { color: #ff9b91; }

  .account-row { margin-top: 9px; }

  .account-button {
    min-width: 106px;
    font-size: 10px;
  }

  .account-status {
    margin-top: 5px;
    color: #a9b5ad;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .06em;
  }

  .account-status.is-signed-in { color: var(--green); }

  .account-status.is-error { color: #ff9b91; }

  .bar {
    position: relative;
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    border: var(--hud-border) solid var(--hud-frame);
    border-radius: var(--hud-radius-small);
    background: #000;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
  }

  #hpFill {
    position: absolute;
    inset: 0 auto 0 0;
    width: 100%;
    overflow: hidden;
    border-radius: 5px;
    background: linear-gradient(to bottom, #83f087 0 49%, #2fbf4b 50% 100%);
    box-shadow: none;
    transform: translateX(0);
    transition: transform .12s linear;
    will-change: transform;
  }

  #hpText {
    position: relative;
    z-index: 1;
    font-size: 12px;
    font-weight: 900;
    line-height: 13px;
    letter-spacing: .04em;
    -webkit-text-stroke: 0;
    paint-order: normal;
    text-shadow:
      -1px -1px 0 #000,
      0 -1px 0 #000,
      1px -1px 0 #000,
      -1px 0 0 #000,
      1px 0 0 #000,
      -1px 1px 0 #000,
      0 1px 0 #000,
      1px 1px 0 #000,
      1px 2px 0 #000;
  }

  #message {
    position: absolute;
    left: 50%;
    top: 24%;
    z-index: 16;
    transform: translate(-50%, -50%);
    text-align: center;
    font-weight: 900;
    letter-spacing: .04em;
    font-size: clamp(18px, 4vw, 34px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s;
  }

  .minimap-meta {
    position: absolute;
    top: calc(var(--hud-safe-top) + var(--hud-map-size) + 1px);
    right: calc(var(--hud-safe-right) + 4px);
    z-index: 4;
    display: grid;
    justify-items: center;
    width: calc(var(--hud-map-size) - 8px);
    pointer-events: none;
    text-align: center;
    text-shadow: 1px 1px 0 #000;
  }

  .minimap-players {
    color: rgba(246, 246, 232, .9);
    font: 900 11px/13px var(--font-rounded);
    white-space: nowrap;
  }

  .minimap-version {
    position: relative;
    min-height: 0;
    margin: 0;
    padding: 0 4px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    pointer-events: auto;
    cursor: pointer;
    color: rgba(246, 246, 232, .72);
    font: 900 10px/12px var(--font-rounded);
    letter-spacing: .06em;
  }

  .minimap-version[data-unread-notes="true"]::after,
  .signin-version[data-unread-notes="true"]::after { position: absolute; top: 0; right: 0; width: 5px; height: 5px; border-radius: 50%; background: #ff4b55; content: ""; pointer-events: none; }
  .signin-version[data-unread-notes="true"]::after { top: 12px; right: 34px; }
  .minimap-version:hover, .minimap-version:active { background: transparent; box-shadow: none; transform: none; }
  .minimap-version:focus-visible { outline: 1px solid #fff; outline-offset: 2px; }
  /* Beside the minimap, in its frame; + and − match its "?" mark. */
  .camera-zoom-control {
    position: absolute;
    top: var(--hud-safe-top);
    right: calc(var(--hud-safe-right) + var(--hud-map-size) + 5px);
    z-index: 4;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
    width: 35px;
    height: var(--hud-map-size);
    padding: 5px 0;
    border: var(--hud-border) solid var(--hud-frame);
    border-radius: 5px;
    background: rgba(8,13,10,.32);
    box-shadow: var(--ui-shadow); outline: var(--hud-seam); outline-offset: -1px;
    pointer-events: auto;
  }
  .camera-zoom-button {
    display: grid;
    place-items: center;
    width: 25px;
    height: 25px;
    min-width: 0;
    min-height: 0;
    margin: 0;
    padding: 0 0 1px;
    border: 2px solid rgba(255,255,255,.52);
    border-radius: 50%;
    background: rgba(8,13,10,.32);
    box-shadow: var(--ui-shadow);
    color: #fff;
    cursor: pointer;
    font: 900 17px/1 var(--font-rounded);
    text-shadow: 1px 1px 0 #000;
    transition: background-color .12s, transform .12s;
  }
  .camera-zoom-button:hover:not(:disabled),
  .camera-zoom-button:focus-visible { background: rgba(43,91,61,.48); transform: scale(1.08); }
  .camera-zoom-button:active:not(:disabled) { transform: scale(.96); }
  .camera-zoom-button:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
  .camera-zoom-button:disabled { opacity: .35; cursor: default; }
  .camera-zoom-level { color: rgba(246,246,232,.9); font: 900 10px/12px var(--font-rounded); letter-spacing: .02em; text-shadow: 1px 1px 0 #000; }
  body:is(.is-dueling, .is-replaying) .camera-zoom-control { visibility: hidden; pointer-events: none; }
  body.camera-zoom-hidden .camera-zoom-control { display: none; }

  .minimap-button {
    position: absolute;
    top: var(--hud-safe-top);
    right: var(--hud-safe-right);
    z-index: 4;
    width: var(--hud-map-size);
    height: var(--hud-map-size);
    margin: 0;
    padding: 0;
    border: var(--hud-border) solid var(--hud-frame);
    border-radius: 5px;
    background: transparent;
    box-shadow: var(--ui-shadow); outline: var(--hud-seam); outline-offset: -1px;
    color: #fff;
    cursor: pointer;
    pointer-events: auto;
    -webkit-text-stroke: 0;
    text-shadow: none;
  }
  .minimap-button:active { transform: none; }
  .minimap-button:focus-visible { outline: 2px solid #fff; outline-offset: -4px; }
  body:is(.is-dueling, .is-replaying) .minimap-button,
  body:is(.is-dueling, .is-replaying) .minimap-meta,
  body:is(.is-dueling, .is-replaying) .hud-timer-column { visibility: hidden; pointer-events: none; }

  .hud-timer-column {
    position: absolute;
    top: calc(var(--hud-safe-top) + var(--hud-map-size) + 33px);
    right: calc(var(--hud-safe-right) + 4px);
    z-index: 4;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    width: calc(var(--hud-map-size) - 8px);
    pointer-events: none;
  }

  .minimap-meta .hud-timer-column { position: static; justify-self: stretch; width: auto; margin-top: 6px; }
  /* A timer longer than the minimap is wide wraps under it rather than running off the screen. */
  .minimap-meta .hud-progress-timer { white-space: normal; }

  .hud-progress-timer {
    box-sizing: border-box;
    padding: 4px 2px;
    border: var(--hud-border) solid var(--hud-frame);
    border-radius: var(--hud-radius-small);
    background: var(--hud-surface);
    box-shadow: var(--ui-shadow); outline: var(--hud-seam); outline-offset: -1px;
    font: 900 var(--font-readable-min)/1.2 var(--font-rounded);
    letter-spacing: .025em;
    text-align: center;
    text-shadow: 1px 2px 0 #000;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
  }
  .hud-progress-timer[hidden] { display: none; }
  .hud-progress-timer-tech { color: #77caff; }
  .hud-progress-timer-slot { color: #ffd367; }
  .hud-progress-timer-run { color: #fff; font-variant-numeric: tabular-nums; }
  .hud-progress-timer.hud-server-boost { color: #fff; }
  /* Research Ready and Smith upgrades under the timers; away from the Town a tap goes there. */
  .hud-reminder { box-sizing: border-box; width: 100%; min-height: 0; margin: 0; padding: 4px 3px; border: var(--hud-border) solid var(--hud-frame); border-radius: var(--hud-radius-small); background: var(--hud-surface); box-shadow: var(--ui-shadow); outline: var(--hud-seam); outline-offset: -1px; color: #fff; font: 900 13px/1.2 var(--font-rounded); letter-spacing: .02em; text-align: center; text-shadow: 1px 2px 0 #000; white-space: normal; pointer-events: auto; cursor: pointer; }
  .hud-reminder[hidden], .hud-reminder.is-switched-off { display: none; }
  .hud-reminder:active { transform: none; background: rgba(70, 70, 70, .78); }
  .hud-reminder.is-in-town { cursor: default; }
  .hud-reminder.is-in-town:active { background: var(--hud-surface); }
  .hud-progress-timer.hud-soul-level { display: grid; gap: 3px; padding: 4px 5px; color: #e4ccff; font-size: 13px; white-space: normal; }
  .hud-progress-timer.hud-soul-level[hidden] { display: none; }
  .hud-soul-level-head { display: flex; flex-wrap: wrap; justify-content: space-between; column-gap: 4px; }
  .hud-soul-level-head strong { color: #fff; }
  .hud-soul-level-xp { color: #fff; }
  .hud-soul-level .soul-level-bar { display: block; height: 4px; overflow: hidden; border-radius: 2px; background: rgba(255,255,255,.18); }
  .hud-soul-level .soul-level-bar > span { display: block; height: 100%; background: #c48cff; transition: width .2s; }

  .respawn-ad-button {
    display: grid;
    align-self: flex-end;
    width: 42px;
    height: 34px;
    min-height: 0;
    place-items: center;
    margin: 4px 0 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: #fff;
    pointer-events: auto;
  }

  .respawn-ad-button[hidden] { display: none; }
  .respawn-ad-button:active .respawn-ad-video-icon { transform: translateY(1px) scale(.96); }
  .respawn-ad-button:disabled { cursor: default; }
  .respawn-ad-button:focus-visible { outline: 0; }
  .respawn-ad-button:hover:not(:disabled) .respawn-ad-video-icon,
  .respawn-ad-button:focus-visible .respawn-ad-video-icon { filter: brightness(1.13); transform: scale(1.06); }
  .respawn-ad-button[data-state="checking"],
  .respawn-ad-button[data-state="showing"] { opacity: .58; }

  .respawn-ad-video-icon,
  .respawn-ad-prompt-video {
    position: relative;
    display: block;
    width: 24px;
    height: 17px;
    border: 2px solid currentColor;
    border-radius: 4px;
    color: #fff;
    -webkit-text-stroke: 0;
    text-shadow: none;
  }

  .respawn-ad-video-icon {
    width: 28px;
    height: 20px;
    border-color: #fff0ad;
    border-radius: 5px;
    background: transparent;
    box-shadow: 0 0 4px rgba(255,206,67,.35), var(--ui-shadow);
    transition: filter 120ms ease, transform 120ms ease;
  }

  /* The pulse fades a wider glow in and out: opacity runs on the compositor, a box-shadow keyframe repaints every frame.
     On top (its box is empty), so the play arrow is not lifted into a layer of its own and blurred. */
  .respawn-ad-glow {
    position: absolute;
    z-index: 2;
    inset: -2px;
    border-radius: inherit;
    box-shadow: 0 0 8px rgba(255,215,79,.5);
    opacity: 0;
    pointer-events: none;
    animation: respawn-reward-glow 2.8s ease-in-out infinite;
  }

  .respawn-ad-video-icon::before {
    position: absolute;
    top: -5px;
    right: -5px;
    z-index: 1;
    width: 10px;
    height: 10px;
    background: #ffe66d;
    clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
    content: "";
    filter: drop-shadow(0 0 3px rgba(255,225,91,.8));
  }

  @keyframes respawn-reward-glow {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
  }

  .respawn-ad-video-icon::after,
  .respawn-ad-prompt-video::after {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    border-left: 6px solid currentColor;
    content: "";
    transform: translate(-35%, -50%);
  }

  /*
   * Between ads the button stays in its spot as a countdown pill, dressed like
   * the progress timers above it: the wait on one line, the day's ads left on
   * the next. The server holds the limits; this only shows them.
   */
  .respawn-ad-button:is([data-state="cooldown"], [data-state="limit"]) {
    align-self: stretch;
    width: auto;
    height: auto;
    margin: 0;
    padding: 4px 2px;
    border: var(--hud-border) solid var(--hud-frame);
    border-radius: var(--hud-radius-small);
    background: var(--hud-surface);
    box-shadow: var(--ui-shadow); outline: var(--hud-seam); outline-offset: -1px;
  }

  .respawn-ad-button:is([data-state="cooldown"], [data-state="limit"]) .respawn-ad-video-icon { display: none; }

  .respawn-ad-countdown {
    color: #fff0ad;
    font: 900 var(--font-readable-min)/1.2 var(--font-rounded);
    letter-spacing: .025em;
    text-align: center;
    text-shadow: 1px 2px 0 #000;
    white-space: pre-line;
    font-variant-numeric: tabular-nums;
  }

  .respawn-ad-countdown[hidden] { display: none; }

  .respawn-ad-prompt {
    position: fixed;
    inset: 0 0 var(--window-bottom-inset);
    z-index: 20;
    display: grid;
    place-items: center;
    padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) 18px max(18px, env(safe-area-inset-left));
    background: rgba(4,8,5,.66);
    pointer-events: auto;
  }

  .respawn-ad-prompt[hidden] { display: none; }

  .respawn-ad-prompt-card {
    display: grid;
    width: min(330px, 100%);
    justify-items: center;
    gap: 12px;
    padding: 22px;
    border: 0;
    border-radius: 12px;
    background: var(--window-surface-green);
    box-shadow: 0 20px 56px rgba(0,0,0,.72);
    color: #fff;
    text-align: center;
  }

  .respawn-ad-prompt-video { width: 48px; height: 34px; border-width: 3px; border-radius: 7px; color: #72ef58; }
  .respawn-ad-prompt-video::after { border-top-width: 7px; border-bottom-width: 7px; border-left-width: 10px; }
  .respawn-ad-prompt-card h2 { margin: 0; color: #fff; font-size: 22px; line-height: 1.05; }
  .respawn-ad-prompt-card p { margin: 0; color: rgba(255,255,255,.82); font-size: 13px; line-height: 1.4; -webkit-text-stroke: 0; text-shadow: none; }
  .respawn-ad-prompt-actions { display: grid; width: min(240px, 100%); gap: 9px; margin-top: 4px; }
  .respawn-ad-prompt-actions button { width: 100%; min-height: 46px; margin: 0; padding: 9px 15px; border-width: 2px; border-radius: 8px; font-size: 15px; line-height: 1; }
  .respawn-ad-prompt-confirm { border-color: #102d14; background: linear-gradient(#72ef58, #31bd34); box-shadow: 0 3px 0 #163c1b; }
  .respawn-ad-prompt-cancel { border-color: rgba(255,255,255,.22); background: #313131; box-shadow: none; color: rgba(255,255,255,.88); }
  .respawn-ad-prompt-actions button:focus-visible { border-color: #fff; outline: 2px solid rgba(114,239,88,.62); outline-offset: 2px; }
  .respawn-ad-prompt-actions button:active { transform: translateY(1px); }

  #duelControls {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    display: grid;
    justify-items: start;
    gap: 5px;
    align-self: center;
    pointer-events: auto;
  }

  #duelControls[hidden] { display: none; }

  #duelStatus {
    padding: 5px 8px;
    border: 1px solid rgba(255,255,255,.25);
    border-radius: 6px;
    background: rgba(20,24,24,.86);
    color: #edf1ef;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .07em;
    white-space: nowrap;
  }

  #duelCountdown {
    position: fixed;
    top: 42%;
    left: 50%;
    z-index: 7;
    transform: translate(-50%, -50%);
    color: #ff4e4e;
    font: 900 clamp(90px, 22vw, 190px)/1 var(--font-rounded);
    text-shadow: var(--text-shadow-large);
    pointer-events: none;
  }

  #pickupLog {
    position: fixed;
    /* Below the minimap and its online and version lines: on a short narrow
       phone 20% of the height put the reward toast on top of them. */
    --pickup-anchor: max(15%, calc(var(--hud-safe-top, 0px) + var(--hud-map-size) + 44px));
    /* Bottom-anchored one toast below the anchor: the newest lands where the
       first one did and pushes older ones up. */
    top: calc(var(--pickup-anchor) + 38px);
    left: 50%;
    bottom: auto;
    /* Developer Tools allows combat behind it; keep earned rewards visible. */
    z-index: 9;
    display: grid;
    justify-items: center;
    gap: 8px;
    width: min(440px, calc(100vw - 24px));
    transform: translate(-50%, -100%);
    pointer-events: none;
  }

  #itemDropReveal {
    position: fixed;
    inset: 0 0 var(--window-bottom-inset);
    z-index: 7;
    overflow: hidden;
    pointer-events: none;
  }

  #itemDropReveal:empty { display: none; }

  .item-drop-reveal {
    --item-drop-color: #ffd45c;
    position: absolute;
    top: 84%;
    left: 50%;
    display: grid;
    place-items: center;
    width: min(360px, calc(100vw - 28px));
    color: #fff;
    text-align: center;
    transform: translate(-50%, -50%) translateY(24px) scale(.72);
    animation: item-drop-reveal 3.4s cubic-bezier(.18, .72, .2, 1) forwards;
    will-change: top, opacity, transform;
  }

  .item-drop-art {
    position: relative;
    display: grid;
    place-items: center;
    width: clamp(82px, 22vw, 112px);
    height: clamp(64px, 17vw, 88px);
    -webkit-text-stroke: 0;
    text-shadow: none;
  }

  .item-drop-art::before {
    position: absolute;
    inset: 14%;
    border-radius: 50%;
    background: var(--item-drop-color);
    content: "";
    filter: blur(17px);
    opacity: .52;
    transform: scale(.7);
    animation: item-drop-glow 1.05s ease-in-out infinite alternate;
  }

  .item-drop-sprite {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: 100%;
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    filter: drop-shadow(0 0 4px var(--item-drop-color)) drop-shadow(0 0 10px var(--item-drop-color));
    image-rendering: pixelated;
  }
  .item-drop-sprite.has-galaxy-finish { image-rendering: auto; }

  .item-drop-name {
    color: var(--item-drop-color);
    font: 900 clamp(14px, 4vw, 20px)/1 var(--player-name-font);
    letter-spacing: .035em;
    -webkit-text-stroke: .09em #000;
    paint-order: stroke fill;
    text-shadow: .06em .11em 0 #000;
  }

  .item-drop-stats {
    display: grid;
    gap: 2px;
    margin-top: 5px;
    color: #fff;
    font: 900 clamp(9px, 2.4vw, 12px)/1.2 var(--font-rounded);
    letter-spacing: .02em;
    -webkit-text-stroke: .08em #000;
    paint-order: stroke fill;
    text-shadow: .06em .11em 0 #000;
  }

  @keyframes item-drop-reveal {
    0% { top: 84%; opacity: 0; transform: translate(-50%, -50%) translateY(24px) scale(.72); }
    18% { top: 32%; opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
    28%, 72% { top: 30%; opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { top: 26%; opacity: 0; transform: translate(-50%, -50%) translateY(-12px) scale(.96); }
  }

  /* A gem earned from kills: the card above, then this copy flies to the wallet. */
  .gem-drop-flight {
    position: fixed;
    z-index: 30;
    width: 28px;
    height: 28px;
    margin: -14px 0 0 -14px;
    background: center / contain no-repeat;
    pointer-events: none;
    filter: drop-shadow(0 0 6px rgba(127, 215, 255, .85));
    animation: gem-drop-flight .65s cubic-bezier(.3, .7, .3, 1) forwards;
  }
  @keyframes gem-drop-flight {
    0% { transform: translate(0, 0) scale(1.2); opacity: 1; }
    100% { transform: translate(var(--gem-flight-x), var(--gem-flight-y)) scale(.6); opacity: .9; }
  }
  #hudGemWallet.is-gem-pulse { animation: gem-wallet-pulse .5s ease-out; }
  @keyframes gem-wallet-pulse {
    0% { transform: scale(1); filter: brightness(1); }
    35% { transform: scale(1.18); filter: brightness(1.6); }
    100% { transform: scale(1); filter: brightness(1); }
  }

  @keyframes item-drop-glow {
    from { opacity: .4; transform: scale(.64); }
    to { opacity: .68; transform: scale(1); }
  }

  #topMeta {
    display: flex;
    gap: 8px;
    margin-left: auto;
    color: rgba(245,245,233,.58);
    font-size: 9px;
    letter-spacing: .05em;
    pointer-events: none;
  }

  #latencyStatus[data-quality="good"] { color: #72ef58; }
  #latencyStatus[data-quality="fair"] { color: var(--gold); }
  #latencyStatus[data-quality="poor"] { color: #ff8f86; }

  #playerName {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 3px;
    min-width: 0;
    max-width: none;
    min-height: 12px;
    overflow: hidden;
    color: #fff;
    font-size: 12.5px;
    letter-spacing: .05em;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Reads after the name and before the gender icon, and is sized the way the
     power icon beside it is sized: a set size per place rather than an em of
     whatever text surrounds it, so --prestige-badge-size is overridden at the
     same selectors the .power-icon rules use. The default is the size the
     canvas draws over a player's head, PRESTIGE_BADGE_PX in shared/prestige.ts,
     which is what the overhead power sword uses.
     Everything else is a ratio of that size, each one measured against what
     the canvas does:
       - the digit is 1/1.5625 of the box, because the canvas draws it at .64
         of the shield;
       - padding-bottom lifts the digit onto the shield's own centre, which is
         above the middle of the square because the crest tapers to a point;
       - the stroke is .3 of the digit, matching the canvas, and far heavier
         than the .08em the global text rule gives every other glyph;
       - the shadow goes, because the canvas has none and its downward offset
         read as the number sitting low on the shield.
     The name rows are flex with a gap of their own, so the margins pull back
     against it rather than adding to it. The shield widens with its level. */
  .player-prestige-badge {
    display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center;
    box-sizing: border-box;
    white-space: nowrap; overflow-wrap: normal; word-break: normal;
    width: calc(var(--prestige-badge-size, 16px) * var(--prestige-width-ratio, 1)); height: var(--prestige-badge-size, 16px);
    padding-bottom: calc(var(--prestige-badge-size, 16px) * .111);
    margin: 0 calc(var(--prestige-badge-size, 16px) * -.064);
    font-size: calc(var(--prestige-badge-size, 16px) / 1.5625);
    font-weight: 900; line-height: 1;
    color: #fff; letter-spacing: 0; text-shadow: none;
    -webkit-text-stroke-width: calc(var(--prestige-badge-size, 16px) * .192);
    background: url("ui/prestige-shield.f8a594496f5fc738.svg") center / 100% 100% no-repeat;
    vertical-align: .05em; pointer-events: none; user-select: none;
  }
  .player-gender-icon { display: inline-block; flex: 0 0 auto; width: 1.12em; height: 1.12em; object-fit: contain; vertical-align: -.16em; filter: drop-shadow(0 1px 0 rgba(0,0,0,.45)); pointer-events: none; user-select: none; }
  .player-hud-name-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .topbar > .card,
  .player-hud-card {
    cursor: pointer;
    pointer-events: auto;
  }

  #chatPanel {
    position: fixed;
    left: 0;
    right: 0;
    top: auto;
    bottom: var(--toolbar-height);
    width: 100vw;
    height: var(--mini-chat-height);
    padding: 3px 6px 5px;
    border-top: 0;
    border-bottom: 0;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    cursor: default;
    font-family: var(--chat-font);
    pointer-events: auto;
    z-index: 6;
  }

  .hud-gem-wallet { position: fixed; top: calc(var(--hud-safe-top) + var(--player-hud-visual-height) + 6px); left: var(--hud-safe-left); z-index: 5; display: flex; align-items: center; gap: 4px; min-height: 28px; padding: 3px 8px 3px 5px; border: var(--hud-border) solid var(--hud-frame); border-radius: var(--hud-radius-small); background: var(--hud-surface); box-shadow: var(--ui-shadow); outline: var(--hud-seam); outline-offset: -1px; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; line-height: 1; pointer-events: none; }
  .hud-gem-icon { display: block; width: 20px; height: 20px; object-fit: contain; }
  .hud-gem-balance { color: #fff; font-size: 11px; font-weight: 900; text-shadow: 0 1px #071c29; }
  .hud-secondary-controls { position: fixed; top: calc(var(--hud-safe-top) + var(--player-hud-visual-height) + 6px); left: var(--hud-safe-left); z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 3px; pointer-events: auto; }
  /* Wallets and toggles wrap before the zoom buttons (or the minimap, with them hidden); what sits below steps down (app-shell-controller.ts). */
  .hud-secondary-controls { max-width: calc(100vw - var(--hud-safe-left) - var(--hud-safe-right) - var(--hud-map-size) - 46px); }
  body.camera-zoom-hidden .hud-secondary-controls { max-width: calc(100vw - var(--hud-safe-left) - var(--hud-safe-right) - var(--hud-map-size) - 6px); }
  .hud-secondary-controls .hud-gem-wallet { position: static; }
  .hud-arrow-chip { margin: 0; color: #fff; cursor: pointer; pointer-events: auto; touch-action: manipulation; }
  .hud-arrow-chip[hidden] { display: none; }
  .hud-arrow-chip.is-empty { opacity: .55; }
  .hud-food-chip { margin: 0; color: #ffe7a8; border-color: rgba(255,190,74,.65); background: linear-gradient(180deg, rgba(84,46,12,.92), rgba(44,24,8,.94)); cursor: pointer; pointer-events: auto; touch-action: manipulation; }
  .hud-food-chip[hidden] { display: none; }
  .inventory-item.is-cooked-fish { border-color: rgba(255,184,64,.55); background: radial-gradient(circle at 50% 45%, rgba(255,160,40,.22), rgba(20,16,12,.92)); }
  .inventory-item.is-cooked-fish .inventory-item-art { filter: sepia(.18) saturate(1.25) drop-shadow(0 0 5px rgba(255,168,54,.5)); }
  .inventory-cooked-badge { position: absolute; left: 4px; bottom: 4px; padding: 1px 4px; border-radius: 4px; background: rgba(168,78,12,.92); border: 1px solid rgba(255,214,112,.6); color: #fff5d6; font-size: 8px; font-weight: 900; letter-spacing: .04em; line-height: 1.1; pointer-events: none; }
  .player-visibility-toggle { display: grid; place-items: center; width: 40px; height: 32px; margin: 0; padding: 6px 9px; border: 0; border-radius: 6px; background: transparent; box-shadow: none; color: #fff; cursor: pointer; touch-action: manipulation; }
  .player-visibility-toggle svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 1px 1px #000); }
  .player-visibility-toggle:disabled { opacity: .65; cursor: default; }
  .player-visibility-toggle[aria-pressed="false"]:not(:disabled) { opacity: .65; }
  .player-visibility-toggle[aria-pressed="true"] .player-visibility-slash { display: none; }
  .player-visibility-toggle:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
  /* Eye and mail sit in cards like the gem balance beside them, the same height. */
  .hud-secondary-controls .player-visibility-toggle { width: 36px; height: 30px; padding: 0; border: var(--hud-border) solid var(--hud-frame); border-radius: var(--hud-radius-small); background: var(--hud-surface); box-shadow: var(--ui-shadow); outline: var(--hud-seam); outline-offset: -1px; }
  .hud-secondary-controls .player-visibility-toggle svg { width: 18px; height: 18px; }
  .hud-secondary-controls .player-visibility-toggle[aria-pressed="false"]:not(:disabled) { opacity: 1; }
  .hud-secondary-controls .player-visibility-toggle[aria-pressed="false"]:not(:disabled) svg { opacity: .65; }

  .claim-overlay { position: fixed; inset: 0 0 var(--window-bottom-inset); z-index: 18; display: grid; place-items: center; padding: 18px; background: rgba(8, 7, 10, .78); pointer-events: auto; }
  .claim-overlay[hidden] { display: none; }
  .claim-card { position: relative; display: grid; justify-items: center; gap: 7px; width: min(330px, calc(100vw - 36px)); padding: 19px 22px 22px; overflow: hidden; border: 2px solid #e89abd; border-radius: 13px; background: var(--window-surface-purple); box-shadow: 0 12px 0 var(--ui-outline), 0 0 30px rgba(241,130,187,.2); color: #fff; text-align: center; animation: claim-card-enter .34s cubic-bezier(.2,.9,.24,1.24); }
  .claim-kicker { color: #ffc2df; font-size: 10px; font-weight: 900; letter-spacing: .18em; }
  .claim-art { position: relative; display: grid; width: 112px; height: 112px; place-items: center; }
  .claim-art::before { position: absolute; inset: 0; border-radius: 50%; background: repeating-conic-gradient(from 0deg, rgba(255,190,223,.24) 0 7deg, transparent 7deg 22deg); content: ""; animation: claim-rays 12s linear infinite; }
  .claim-art img { position: relative; display: block; width: 70px; height: 70px; object-fit: contain; animation: claim-float 1.6s ease-in-out infinite alternate; }
  .claim-card h2 { margin: -3px 0 0; color: #fff; font-size: 29px; line-height: 1; letter-spacing: .04em; }
  .claim-card p { margin: 0 0 6px; color: #d9cbd2; font-size: 9px; letter-spacing: .12em; }
  .claim-button { justify-self: center; min-width: 164px; min-height: 44px; margin: 0; border: 2px solid #ffd1e7; border-radius: 8px; background: linear-gradient(#e971aa, #a33f78); box-shadow: 0 4px 0 #55233f; color: #fff; font-size: 13px; letter-spacing: .08em; }
  .claim-button:hover:not(:disabled), .claim-button:focus-visible { border-color: #fff; background: linear-gradient(#f58abd, #bd4a8b); outline: 0; }
  .claim-button:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 #55233f; }
  .claim-overlay.is-claimed .claim-art img { animation: claim-pop .72s cubic-bezier(.2,.9,.24,1.3); }

  @keyframes claim-card-enter { from { opacity: 0; transform: scale(.76) translateY(18px); } to { opacity: 1; transform: scale(1) translateY(0); } }
  @keyframes claim-rays { to { transform: rotate(360deg); } }
  @keyframes claim-float { to { transform: translateY(-6px) scale(1.04); } }
  @keyframes claim-pop { 45% { transform: scale(1.42) rotate(-8deg); } 100% { transform: scale(1) rotate(0); } }

  .chat-message-actions {
    --chat-sheet-drag-y: 0px;
    position: fixed;
    inset: 0;
    z-index: 17;
    display: grid;
    justify-items: center;
    pointer-events: none;
  }
  .chat-message-actions[hidden] { display: none; }
  .chat-message-actions.is-open { pointer-events: auto; }
  .chat-message-actions-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; border-radius: 0; background: rgba(0,0,0,.38); opacity: 0; transition: opacity .24s ease; -webkit-text-stroke: 0; text-shadow: none; }
  .chat-message-actions.is-open .chat-message-actions-backdrop { opacity: 1; }
  .chat-message-action-sheet {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-rows: 28px auto auto minmax(0, 1fr);
    width: min(100%, 520px);
    height: clamp(360px, 55dvh, 520px);
    max-height: calc(100dvh - max(12px, env(safe-area-inset-top)));
    margin: 0 auto;
    padding: 0 max(14px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.13);
    border-bottom: 0;
    border-radius: 18px 18px 0 0;
    background: var(--window-surface-purple);
    box-shadow: 0 -12px 30px rgba(0,0,0,.38);
    color: #f7f4ed;
    contain: layout paint;
    transform: translate3d(0, 100%, 0);
    transition: transform .28s cubic-bezier(.2,.82,.24,1);
    will-change: transform;
  }
  .chat-message-actions.is-open .chat-message-action-sheet { transform: translate3d(0, var(--chat-sheet-drag-y), 0); }
  .chat-message-actions.is-dragging .chat-message-actions-backdrop,
  .chat-message-actions.is-dragging .chat-message-action-sheet { transition: none; }
  .chat-message-action-drag { display: grid; place-items: center; margin: 0 -14px; cursor: grab; touch-action: none; }
  .chat-message-actions.is-dragging .chat-message-action-drag { cursor: grabbing; }
  .chat-message-action-handle { display: block; width: 42px; height: 5px; border-radius: 999px; background: rgba(255,255,255,.34); box-shadow: none; }
  .chat-message-action-header { grid-row: 2; min-width: 0; padding: 8px 4px 14px; }
  .chat-message-action-header h2 { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 10px; margin: 0; color: #fff; font-size: 13px; line-height: 1.2; text-transform: none; }
  .chat-message-action-header time { margin-left: auto; color: rgba(255,255,255,.55); font-size: 11px; font-weight: 800; white-space: nowrap; }
  .chat-message-action-header p { max-height: min(140px, 20dvh); margin: 6px 0 0; padding: 6px 12px; border-radius: 5px; background: rgba(255,255,255,.09); overflow: auto; color: #f7f4ed; font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; white-space: pre-wrap; touch-action: pan-y; -webkit-text-stroke: 0; text-shadow: none; }
  .chat-message-action-menu, .chat-message-report-form { grid-row: 4; min-height: 0; }
  .chat-message-action-menu { display: grid; align-content: start; padding: 8px 0; overflow: auto; touch-action: pan-y; }
  .chat-message-action-menu[hidden],
  .chat-message-action-button[hidden] { display: none; }
  .chat-message-action-button { display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: center; width: 100%; min-height: 48px; margin: 0; padding: 4px 10px; border: 0; border-bottom: 1px solid rgba(255,255,255,.09); border-radius: 0; background: transparent; color: #f7f4ed; font-size: 14px; line-height: 1; text-align: left; text-transform: none; box-shadow: none; }
  .chat-message-action-button:hover,
  .chat-message-action-button:focus-visible { background: rgba(255,255,255,.07); outline: 0; }
  .chat-message-action-button > span { display: grid; width: 25px; height: 25px; place-items: center; border-radius: 7px; background: rgba(255,255,255,.1); color: #ddd9d1; font-size: 17px; -webkit-text-stroke: 0; text-shadow: none; }
  .chat-message-action-button > .chat-message-watch-replay-icon { background: center / contain no-repeat url("replay-play.7334faf3df564411.svg"); }
  .chat-message-action-button.is-danger { color: #ff9a9a; }
  .chat-message-action-button.is-danger > span { background: rgba(201,69,69,.18); color: #ff9a9a; }
  .chat-message-report-form { display: grid; grid-template-rows: minmax(0, 1fr) auto; min-height: 0; padding: 8px 0 0; }
  .chat-message-report-form[hidden] { display: none; }
  .chat-message-report-form fieldset { min-width: 0; min-height: 0; margin: 0; padding: 0 2px; overflow: hidden auto; border: 0; touch-action: pan-y; }
  .chat-message-report-form legend { width: 100%; margin: 0 0 7px; padding: 0; color: #d7d2ca; font-size: 11px; line-height: 1.25; }
  .chat-message-report-reasons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .chat-message-report-reason { min-height: 40px; margin: 0; padding: 5px 7px; border: 1px solid rgba(255,255,255,.14); border-radius: 7px; background: rgba(255,255,255,.055); color: #eeeae2; font-size: 11px; line-height: 1.15; text-transform: none; box-shadow: none; }
  .chat-message-report-reason.is-selected { border-color: #d9b8ff; background: rgba(170,110,224,.2); color: #f0dfff; }
  .chat-message-report-actions { display: grid; grid-template-columns: 1fr 1.35fr; gap: 7px; padding: 8px 2px 0; }
  .chat-message-report-actions button { min-height: 44px; margin: 0; border-radius: 7px; font-size: 11px; text-transform: none; }
  .chat-message-report-actions .danger { border-color: #67272b; background: linear-gradient(#c85050, #842f34); color: #fff; }
  .chat-message-report-actions .danger:disabled { opacity: .45; }

  #chatUnreadBadge, .chat-channel-unread { position: absolute; z-index: 2; display: grid; place-items: center; min-width: 16px; height: 16px; padding: 0 3px; border-radius: 8px; background: #d8323c; color: #fff; font: 900 10px/1 var(--chat-font); font-variant-numeric: tabular-nums; letter-spacing: 0; -webkit-text-stroke: 0; text-shadow: none; pointer-events: none; }
  #chatUnreadBadge { top: 3px; right: calc(100% - 46px); }
  #chatUnreadBadge[hidden], #chatPanel.is-large #chatUnreadBadge { display: none; }
  #chatPanel[hidden] { display: none; }
  /* Mini chat: the HUD surface, a little see-through. */
  #chatPanel:not(.is-large) { height: var(--mini-chat-height); min-height: var(--mini-chat-height); max-height: var(--mini-chat-height); border-radius: 0; background: rgba(24, 24, 24, .50); backdrop-filter: none; cursor: pointer; }
  #chatPanel:not(.is-large) #topMeta { color: #fff; }
  .chat-header,
  #chatForm {
    display: flex;
    align-items: center;
  }

  .chat-header {
    min-height: 23px;
    justify-content: flex-start;
    gap: 8px;
    color: #fff;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .08em;
    cursor: pointer;
  }

  .chat-size-toggle {
    position: relative;
    flex: 0 0 24px;
    width: 24px;
    height: 22px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    cursor: pointer;
  }

  .chat-size-icon {
    position: absolute;
    inset: 3px;
    -webkit-text-stroke: 0;
    text-shadow: none;
  }

  .chat-size-icon::before { position: absolute; inset: 2px 1px; background: #fff; content: ""; clip-path: polygon(0 0, 100% 50%, 0 100%, 22% 50%); filter: drop-shadow(1px 1px 0 #161616); transform: rotate(-45deg); }
  #chatSizeToggle[aria-expanded="true"] .chat-size-icon::before { transform: rotate(135deg); }

  #chatForm button {
    min-width: 44px;
    min-height: 44px;
    margin: 0;
    padding: 4px 7px;
    border-width: 1px;
    border-radius: 5px;
    font-size: 11px;
    line-height: 1;
  }

  #chatMessages {
    display: grid;
    align-content: safe end;
    gap: 3px;
    min-height: 38px;
    max-height: 70px;
    margin: 5px 0;
    overflow: hidden;
    font-size: 10px;
    line-height: 1.2;
  }

  #chatPanel.is-large #chatMessages {
    grid-row: 1;
    display: flex;
    flex-direction: column;
    row-gap: 0;
    min-height: 0;
    height: auto;
    max-height: none;
    /* Expand only the scroll viewport's paint gutter; keep message positions
       and usable width unchanged while allowing frames and halos to extend. */
    margin: 8px -8px 0;
    padding: 4px 12px 12px;
    overflow: hidden auto;
    align-self: stretch;
    -ms-overflow-style: none;
    scrollbar-width: none;
  }
  .chat-viewport-spacer { flex: 0 0 auto; width: 1px; pointer-events: none; }
  /* Row churn lays out only the list; a swipe at either end stays in it. */
  #chatPanel.is-large #chatMessages { overflow-anchor: none; overscroll-behavior: contain; contain: layout paint; }
  /* Frame glints repaint every frame; hold them still while the list moves. */
  #chatPanel.is-scrolling .avatar-frame-glow-mask::before { animation-play-state: paused; }
  #chatPanel.is-large #chatMessages::before { flex: 0 0 auto; margin-top: auto; content: ""; }
  #chatPanel.is-large #chatMessages::-webkit-scrollbar { display: none; width: 0; height: 0; }
  #chatPanel.is-large {
    inset: 0 0 var(--window-bottom-inset);
    z-index: 8;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    row-gap: 6px;
    width: auto;
    height: auto;
    padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left));
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: var(--window-surface-purple);
    box-shadow: none;
    backdrop-filter: none;
  }
  #chatPanel.is-large .chat-header { display: none; }
  #chatPanel.is-large .chat-size-toggle { width: 44px; height: 44px; flex-basis: 44px; }
  #chatPanel.is-large .chat-size-icon { inset: 12px; }
  #chatPanel.is-large .chat-line { flex: 0 0 auto; grid-template-columns: 66px minmax(0, 1fr); grid-template-rows: auto; width: 100%; min-height: 93px; padding: 27px 0 0; column-gap: 9px; align-self: start; }
  #chatPanel.is-large .chat-profile-icon { grid-column: 1; grid-row: 1; width: 66px; height: 66px; border-radius: 6px; }
  #chatPanel.is-large .chat-message-content { grid-column: 2; grid-row: 1; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 10px; width: min(640px, calc(100% - 50px)); max-width: 100%; min-width: 0; }
  @media (min-width: 800px) {
    /* Center the portrait + bubble together, preserving the 640px bubble cap. */
    #chatPanel.is-large .chat-line { max-width: 715px; margin-inline: auto; }
    #chatPanel.is-large .chat-message-content { width: 100%; }
  }
  #chatPanel.is-large .chat-name { grid-column: 1 / -1; grid-row: 1; font-size: 15px; }
  #chatPanel.is-large .chat-power-icon { width: 18px; height: 18px; }
  #chatPanel.is-large .chat-name-core { --prestige-badge-size: 18px; }
  #chatPanel.is-large .chat-time { grid-column: 2; grid-row: 1; justify-self: end; color: rgba(255,255,255,.45); font-size: 11px; font-weight: 800; text-align: right; }
  #chatPanel.is-large .chat-message-content.has-time .chat-name { grid-column: 1; }
  #chatPanel.is-large .chat-text { grid-column: 1 / -1; grid-row: 2; display: block; align-self: start; justify-self: stretch; width: auto; max-width: 100%; min-width: 0; min-height: 29px; height: auto; margin: 0 0 10px; padding: 6px 12px; overflow-wrap: anywhere; font-size: 15px; line-height: 1.4; }
  #chatPanel.is-large .chat-text.is-actionable { cursor: pointer; }
  #chatPanel.is-large .chat-text.is-actionable:focus-visible { outline: 2px solid rgba(217,184,255,.9); outline-offset: 2px; }
  #chatPanel.is-large #chatForm { grid-row: 2; display: grid; grid-template-columns: minmax(0, 1fr) 53px; grid-template-rows: max-content max-content max-content; grid-template-areas: "reply reply" "input send" "back back"; align-content: start; align-items: start; gap: 5px; padding: 0 0 var(--window-back-bottom-gap); }
  #chatPanel.is-large .chat-reply-composer { grid-area: reply; }
  #chatPanel.is-large #chatInput { grid-area: input; width: 100%; }
  #chatPanel.is-large #chatSendBtn { grid-area: send; }
  #chatPanel.is-large #chatBackBtn { grid-area: back; justify-self: center; width: min(150px, 44vw); height: 44px; min-height: 44px; }
  #chatPanel:not(.is-large) #chatForm { display: none; }
  #chatPanel:not(.is-large) .chat-header { display: none; }
  #chatPanel:not(.is-large) #topMeta { display: block; margin-left: auto; color: #fff; font-size: 8px; }
  #chatPanel:not(.is-large) #version { display: none; }
  #chatPanel:not(.is-large) .chat-size-toggle { margin-left: 0; }
  #chatPanel:not(.is-large) #chatMessages { display: grid; align-content: end; height: 39px; min-height: 39px; max-height: 39px; padding: 0 3px 0 43px; background: 2px center / 38px 38px no-repeat url("icons/Icon_Misc_ETC_Chat01.b8702f15a99d71b8.webp"); }
  #chatPanel:not(.is-large) .chat-line { display: flex; align-items: center; gap: 5px; min-width: 0; min-height: 18px; }
  #chatPanel:not(.is-large) .chat-message-content { display: flex; flex: 1 1 0; align-items: center; gap: 5px; min-width: 0; }
  #chatPanel:not(.is-large) .chat-time,
  #chatPanel:not(.is-large) .chat-profile-icon { display: none; }
  #chatPanel:not(.is-large) .chat-name { flex: 0 0 auto; max-width: none; overflow: visible; font-size: var(--mini-chat-font-size); text-overflow: clip; }
  #chatPanel:not(.is-large) .chat-name::after { content: ":"; }
  #chatPanel:not(.is-large) .chat-text,
  #chatPanel:not(.is-large) .chat-line.has-replay .chat-text { flex: 1 1 0; grid-column: auto; grid-row: auto; min-width: 0; min-height: 0; padding: 0; overflow: hidden; border-radius: 0; background: transparent; font-size: var(--mini-chat-font-size); line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
  #chatPanel:not(.is-large) .chat-reply-preview { display: none; }
  #chatPanel:not(.is-large) .chat-message-body { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #chatPanel:not(.is-large) .chat-replay { display: none; }
  .chat-line { display: grid; grid-template-columns: 29px minmax(0, 1fr) auto; grid-template-rows: auto auto; gap: 2px 6px; align-items: start; overflow-wrap: anywhere; }
  .chat-message-content { min-width: 0; }
  .chat-profile-icon { grid-column: 1; grid-row: 1 / 3; display: block; width: 29px; height: 29px; margin: 0; border: 1px solid var(--ui-outline); border-radius: 4px; background-color: #fff; background-repeat: no-repeat; background-size: var(--profile-portrait-sheet-size) var(--profile-portrait-sheet-size); background-clip: padding-box; cursor: pointer; -webkit-text-stroke: 0; text-shadow: none; }
  .chat-profile-icon:focus-visible, canvas.leaderboard-profile-icon:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
  .chat-time { grid-column: 3; grid-row: 1; color: var(--muted); font-size: 10px; line-height: 1.25; text-align: right; white-space: nowrap; }
  .chat-name { grid-column: 2; grid-row: 1; display: flex; align-items: center; gap: 4px; min-width: 0; margin: 0; padding: 0; overflow: hidden; border: 0; border-radius: 0; background: transparent; color: var(--gold); font-family: var(--player-name-font); font-size: 11.25px; font-weight: 900; line-height: 1.25; text-align: left; white-space: nowrap; cursor: default; }
  .player-identity-core, .chat-name-core { display: inline-flex; align-items: center; gap: 2px; min-width: 0; overflow: hidden; white-space: nowrap; }
  .player-identity-name, .chat-name-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .player-identity-power, .chat-power { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 2px; color: #fff; font-variant-numeric: tabular-nums; }
  .player-identity-power-icon, .chat-power-icon { width: 13px; height: 13px; }
  .player-identity-core, .chat-name-core { --prestige-badge-size: 13px; }
  .chat-text { grid-column: 2 / 4; grid-row: 2; min-height: 19px; padding: 3px 11px; border-radius: 5px; background: rgba(255,255,255,.09); color: var(--text); font-family: var(--player-name-font); font-size: 11.25px; font-weight: 900; line-height: 1.5; }
  .chat-message-body { display: block; min-width: 0; white-space: pre-wrap; }
  .chat-reply-prefix { font-size: .82em; -webkit-text-stroke: 0; }
  .chat-reply-preview { display: block; min-width: 0; margin: 0 0 3px; overflow: hidden; color: rgba(235,232,226,.58); font-size: .82em; font-weight: 800; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; -webkit-text-stroke: 0; text-shadow: none; }
  .chat-text.is-moderated .chat-message-body { font-style: italic; }
  .chat-line.has-replay .chat-text { grid-column: 2 / 4; }
  .chat-line.has-replay { cursor: pointer; }
  #chatForm { gap: 5px; }

  .chat-reply-composer { display: grid; grid-template-columns: minmax(0, 1fr) 44px; align-items: center; min-width: 0; min-height: 44px; overflow: hidden; border-radius: 6px; background: rgba(255,255,255,.065); }
  .chat-reply-composer[hidden] { display: none; }
  .chat-reply-composer-copy { display: grid; min-width: 0; gap: 2px; padding: 5px 9px; overflow: hidden; border-left: 3px solid rgba(201,166,255,.72); }
  .chat-reply-composer-copy strong { overflow: hidden; color: rgba(237,220,255,.78); font-size: 10px; line-height: 1.15; text-overflow: ellipsis; white-space: nowrap; }
  .chat-reply-composer-copy span { overflow: hidden; color: rgba(235,232,226,.52); font-size: 10px; line-height: 1.15; text-overflow: ellipsis; white-space: nowrap; -webkit-text-stroke: 0; text-shadow: none; }
  #chatReplyCancelBtn { width: 44px; min-width: 44px; height: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 0; background: transparent; color: rgba(255,255,255,.72); font-size: 19px; box-shadow: none; }

  #chatForm #chatSendBtn { flex: 0 0 53px; width: 53px; margin: 0; border-color: #18371b; background: linear-gradient(#63ad5c, #347536); box-shadow: 0 3px 0 #18371b; }
  #chatBackBtn[hidden] { display: none; }

  .window-back-footer { display: grid; flex: 0 0 auto; place-items: center; min-height: 60px; padding: 7px max(10px, env(safe-area-inset-right)) var(--window-back-bottom-gap) max(10px, env(safe-area-inset-left)); }
  .settings-panel > .window-back-footer { margin-top: auto; }
  #chatForm button.window-back-button,
  .window-back-button { display: flex; align-items: center; justify-content: center; width: min(150px, 44vw); min-width: 0; height: 44px; min-height: 44px; margin: 0 auto; padding: 0 8px 2px; border: 2px solid #351010; border-radius: 8px; background: linear-gradient(#c85050, #842f34); box-shadow: 0 3px 0 #351519; color: #fff; font: 900 11px/1 var(--font-rounded); -webkit-text-stroke: var(--text-outline-width) #000; paint-order: stroke fill; text-shadow: var(--text-shadow); }

  .item-inspection-tools button.item-inspection-destroy {
    width: 44px; height: 44px; min-height: 44px; margin: 0; padding: 8px;
  }
  .item-inspection-tools button.item-inspection-destroy:active { transform: translateY(2px); box-shadow: 0 1px 0 #351519; }
  .item-inspection-tools button.item-inspection-destroy:disabled,
  .item-inspection-tools button.item-inspection-destroy[aria-disabled="true"] { opacity: .55; }
  .item-inspection-destroy svg { flex: none; }

  #chatInput,
  #profileNameInput {
    min-width: 0;
    border: 1px solid rgba(255,255,255,.24);
    border-radius: 5px;
    background: rgba(0,0,0,.28);
    color: var(--text);
    font: 12px var(--font-rounded);
    padding: 6px 7px;
  }

  #chatInput {
    flex: 1;
    height: 44px;
    min-height: 44px;
    max-height: 88px;
    resize: none;
    font-family: var(--chat-font);
    line-height: 18px;
    padding: 12px 8px;
    cursor: text;
  }

  #chatForm button { cursor: pointer; }
  #chatForm button:disabled { min-width: 53px; opacity: .72; cursor: wait; }
  /* Muted: grey and inert, keeping the countdown text, until the mute ends. */
  #chatForm #chatSendBtn.is-muted,
  #chatForm #chatSendBtn.is-muted:hover,
  #chatForm #chatSendBtn.is-muted:active { border-color: #2d2d2d; background: #3e3e3e; box-shadow: none; color: rgba(236,240,236,.62); filter: none; opacity: 1; transform: none; cursor: not-allowed; }
  .pickup {
    justify-self: center;
    max-width: 100%;
    padding: 9px 13px;
    border: 2px solid rgba(6, 6, 6, .96);
    border-radius: 13px;
    background: rgba(21, 21, 21, .97);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, .08),
      0 4px 0 rgba(6, 6, 6, .82),
      0 9px 18px rgba(0, 0, 0, .30);
    color: #fff;
    font: 900 clamp(14px, 4vw, 18px)/1 var(--font-rounded);
    animation: floatout 2.3s ease forwards;
    isolation: isolate;
    will-change: opacity, transform;
  }

  .stat-reward-toast {
    --stat-reward-accent: var(--green);
    display: grid;
    grid-template-columns: minmax(0, auto) auto;
    align-items: center;
    column-gap: 6px;
    width: max-content;
    min-height: 38px;
    padding: 6px 9px;
    border-color: var(--hud-frame);
    border-radius: var(--hud-radius);
    background: var(--hud-surface);
    box-shadow: var(--ui-shadow); outline: var(--ui-seam); outline-offset: -1px;
    font-size: clamp(10px, 2.8vw, 13px);
    opacity: 1;
    animation: stat-reward-enter 280ms ease-out;
    transition: opacity 300ms ease;
  }

  .stat-reward-toast.is-expiring { opacity: 0; }
  .progress-completion-toast { grid-template-columns: 21px minmax(0, auto) auto; max-width: calc(100vw - 20px); }
  .progress-completion-toast .stat-reward-value { color: var(--stat-reward-accent); }
  .card-copy-toast { border-color: var(--stat-reward-accent); }
  .card-copy-toast .stat-reward-label { color: var(--stat-reward-accent); }
  .card-copy-toast .card-copy-art { height: 26px; border: 1px solid var(--stat-reward-accent); border-radius: 3px; background: center / cover no-repeat #0d0d0d; }

  @keyframes stat-reward-enter {
    from { opacity: 0; transform: translateY(10px) scale(.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
  }

  .stat-reward-icon {
    display: grid;
    place-items: center;
    width: 21px;
    min-width: 21px;
    color: var(--stat-reward-accent);
    font: 900 17px/1 "Apple Color Emoji", "Segoe UI Emoji", var(--font-rounded);
    -webkit-text-stroke: 0;
    text-shadow: 0 2px 2px rgba(0, 0, 0, .82);
  }

  .stat-reward-label { color: #fff; white-space: nowrap; }
  .stat-reward-value { color: var(--green); white-space: nowrap; font-variant-numeric: tabular-nums; }

  @keyframes floatout {
    0% { opacity: 0; transform: translateY(10px) scale(.95); }
    12%, 72% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-14px) scale(.98); }
  }

  #start, #gameOver {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    background: transparent;
    z-index: 5;
  }

  #start {
    top: -2px;
    right: 0;
    bottom: auto;
    left: 0;
    width: 100vw;
    height: calc(100vh + 30px);
    height: calc(100lvh + 30px);
    isolation: isolate;
    /* Plain black behind sign-in and loading: the painted artwork was cropped and out of scale on large screens. */
    background: #000;
  }

  .signin-mute-button {
    position: fixed;
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    z-index: 4;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    margin: 0;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .58);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(28, 27, 20, .76), rgba(28, 24, 20, .76));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 4px 12px rgba(0, 0, 0, .34);
    color: #fff;
    -webkit-text-stroke: 0;
    text-shadow: none;
    cursor: pointer;
    transition: border-color 120ms ease, box-shadow 120ms ease, color 120ms ease, filter 120ms ease, transform 120ms ease;
  }

  .signin-mute-button svg { display: block; width: 26px; height: 26px; overflow: visible; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .5)); pointer-events: none; }
  .signin-sound-speaker { fill: currentColor; }
  .signin-sound-waves, .signin-sound-muted { fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; }
  .signin-sound-muted { display: none; }
  .signin-mute-button:hover { border-color: rgba(255, 255, 255, .5); filter: brightness(1.12); }
  .signin-mute-button:focus-visible { outline: 3px solid rgba(255, 255, 255, .92); outline-offset: 3px; }
  .signin-mute-button[aria-pressed="true"] { border-color: rgba(255, 255, 255, .2); background: linear-gradient(180deg, rgba(35, 35, 35, .9), rgba(7, 11, 8, .9)); color: #bdc6bf; }
  .signin-mute-button[aria-pressed="true"] .signin-sound-waves { display: none; }
  .signin-mute-button[aria-pressed="true"] .signin-sound-muted { display: block; }
  .signin-mute-button:active { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 2px 6px rgba(0, 0, 0, .3); transform: translateY(1px); }

  .signin-install-button {
    position: fixed;
    top: max(12px, env(safe-area-inset-top));
    left: max(12px, env(safe-area-inset-left));
    z-index: 4;
    display: flex;
    align-items: center;
    gap: 7px;
    width: auto;
    min-width: 0;
    min-height: 48px;
    margin: 0;
    padding: 0 13px 0 10px;
    border: 1px solid rgba(255, 255, 255, .58);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(28, 27, 20, .82), rgba(28, 24, 20, .82));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 4px 12px rgba(0, 0, 0, .34);
    color: #fff;
    font: 900 10px/1 var(--font-rounded);
    letter-spacing: .06em;
    -webkit-text-stroke: 0;
    text-shadow: 0 1px 0 rgba(0, 0, 0, .72);
    cursor: pointer;
    transition: border-color 120ms ease, filter 120ms ease, transform 120ms ease;
  }

  .signin-install-button::before {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border: 2px solid currentColor;
    border-radius: 5px;
    content: "+";
    font: 900 17px/1 Arial, sans-serif;
  }

  .signin-install-button:hover { border-color: #fff; filter: brightness(1.12); }
  .signin-install-button:focus-visible { outline: 3px solid rgba(255, 255, 255, .92); outline-offset: 3px; }
  .signin-install-button:active { transform: translateY(1px); }
  .signin-install-button:disabled { opacity: .62; cursor: wait; }
  .signin-install-button[hidden], .signin-install-hint[hidden] { display: none; }

  .signin-install-hint {
    position: fixed;
    top: calc(max(12px, env(safe-area-inset-top)) + 56px);
    left: max(12px, env(safe-area-inset-left));
    z-index: 4;
    width: min(270px, calc(100vw - 24px));
    margin: 0;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, .32);
    border-radius: 7px;
    background: rgba(7, 12, 8, .9);
    color: #fff;
    font: 800 10px/1.4 var(--font-rounded);
    letter-spacing: .035em;
    text-align: left;
    text-shadow: 0 1px 0 #000;
  }

  #accountChoicePanel[hidden] ~ .signin-install-button,
  #accountChoicePanel[hidden] ~ .signin-install-hint { display: none; }

  #reconnectOverlay {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, .62);
    color: #fff;
    font: 900 clamp(18px, 4vw, 28px) var(--font-rounded);
    letter-spacing: .08em;
    pointer-events: auto;
  }

  #reconnectOverlay[hidden] { display: none; }
  /* Updates sit above every window, as the reload follows. */
  #reconnectOverlay.is-updating { z-index: 100000; }
  /* Still full-screen and still catching taps: an action sent mid-reconnect
     reaches a server that has no session for it yet. Only the look is small. */
  #reconnectOverlay.is-quiet {
    place-items: start center;
    padding-top: calc(18vh + env(safe-area-inset-top));
    background: none;
    font-size: 13px;
  }
  #reconnectOverlay.is-quiet .reconnect-content { width: auto; padding: 7px 14px; border-radius: 999px; background: rgba(0, 0, 0, .62); }
  #reconnectOverlay.is-quiet #reconnectDetail { display: none; }
  .reconnect-content {
    display: grid;
    width: min(360px, calc(100vw - 40px));
    justify-items: center;
    gap: 12px;
    text-align: center;
  }
  #reconnectDetail {
    margin: 0;
    color: rgba(255, 255, 255, .78);
    font: 700 13px/1.35 var(--font-rounded);
    letter-spacing: .02em;
  }
  #connectionRetryBtn {
    width: min(220px, 100%);
  }
  #connectionRetryBtn { margin: 12px auto 0; }
  #connectionRetryBtn[hidden] { display: none; }
  .reconnect-ellipsis::after { content: "..."; display: inline-block; width: 0; overflow: hidden; vertical-align: bottom; animation: reconnect-ellipsis 1s steps(4, end) infinite; }

  @keyframes reconnect-ellipsis { to { width: 1.15em; } }

  #browserRewardedAd {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 12px;
    background: #000;
    color: #fff;
    pointer-events: auto;
  }

  #browserRewardedAd[hidden] { display: none; }
  .browser-rewarded-ad-label { font-size: 15px; font-weight: 900; letter-spacing: .22em; }
  .browser-rewarded-ad-timer { min-width: 4ch; font: 900 clamp(38px, 12vw, 76px)/1 var(--font-rounded); font-variant-numeric: tabular-nums; text-align: center; }

  @media (prefers-reduced-motion: reduce) {
    .respawn-ad-glow,
    #connectionPanel .wildstat-wordmark-title,
    #accountChoicePanel .wildstat-wordmark-title,
    .claim-card,
    .claim-art::before,
    .claim-art img,
    .claim-overlay.is-claimed .claim-art img { animation: none; }
    .chat-message-actions-backdrop,
    .chat-message-action-sheet { transition: none; }
  }

  #gameOver {
    z-index: 80;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: transparent;
    color: #f02d3d;
    /* Taps go through to the menus and chat under it. */
    pointer-events: none;
    opacity: 0;
    transition: opacity .24s ease-out;
  }

  #gameOver.is-visible { opacity: 1; }

  #gameOver[hidden] { display: none; }

  .death-screen {
    display: grid;
    place-items: center;
    gap: 16px;
    width: 100%;
    padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
    color: #f02d3d;
    text-align: center;
    transform: translateY(-25vh);
    transform: translateY(-25dvh);
  }

  .death-screen h1 {
    margin: 0;
    color: #f02d3d;
    font-size: clamp(34px, 9.8vw, 78px);
    line-height: .9;
    letter-spacing: -.03em;
    text-shadow: none;
    -webkit-text-stroke: .09em #000;
    paint-order: stroke fill;
  }

  .death-countdown {
    margin: 0;
    color: #fff;
    font-size: clamp(12px, 3.5vw, 20px);
    font-variant-numeric: tabular-nums;
    letter-spacing: .06em;
    text-shadow: none;
  }

  #connectionPanel[hidden], #accountChoicePanel[hidden], #legalGatePanel[hidden], #newPlayerPanel[hidden] { display: none; }

  .modal.connection-modal,
  .modal.account-choice-modal {
    position: fixed;
    top: 50vh;
    top: 50lvh;
    /* Centred, but never so high that the logo (20px into the panel) runs
       under the install, Discord and sound buttons on a short phone. */
    top: max(50lvh, calc(max(12px, env(safe-area-inset-top)) + 44px + min(586px, calc(100lvh - 24px)) / 2));
    left: 50%;
    width: min(430px, calc(100vw - 36px));
    height: min(586px, calc(100vh - 24px));
    height: min(586px, calc(100lvh - 24px));
    max-height: calc(100lvh - 24px);
    margin: 0;
    overflow-y: auto;
    transform: translate(-50%, -50%);
  }

  /* A large landscape screen grows the startup panels with its height, so the logo and loading bar keep their size against it. */
  @media (min-aspect-ratio: 4/3) and (min-height: 900px) {
    .modal.connection-modal, .modal.account-choice-modal { transform: translate(-50%, -50%) scale(1.25); }
  }
  @media (min-aspect-ratio: 4/3) and (min-height: 1200px) {
    .modal.connection-modal, .modal.account-choice-modal { transform: translate(-50%, -50%) scale(1.6); }
  }
  @media (min-aspect-ratio: 4/3) and (min-height: 1600px) {
    .modal.connection-modal, .modal.account-choice-modal { transform: translate(-50%, -50%) scale(2.1); }
  }


  .modal.account-choice-modal {
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: none;
    scrollbar-width: none;
  }
  .modal.account-choice-modal::-webkit-scrollbar { display: none; width: 0; height: 0; }

  .connection-modal {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    overflow: hidden;
    overscroll-behavior: none;
    text-align: center;
  }

  /* The Terms window: once loading has finished, over the start screen, in the game's window look (as chat's age check). */
  #legalGatePanel { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); overflow-y: auto; background: rgba(0, 0, 0, .55); }
  .modal.legal-gate { display: grid; justify-items: center; gap: 12px; width: var(--game-window-width); margin: 0; padding: 20px 16px 10px; border-color: var(--ui-outline); background: var(--window-surface); text-align: center; }
  .legal-gate #legalGateIntro { margin: 0; color: #fff; font-size: 22px; font-weight: 900; line-height: 1.15; }
  .legal-gate :is(.legal-agreement, .legal-gate-status) { width: auto; max-width: 340px; margin: 0; color: #d6d6d6; font-size: 13px; font-weight: 700; letter-spacing: 0; line-height: 1.4; text-align: center; }
  .legal-gate .legal-gate-status:empty { display: none; }
  .legal-gate .legal-gate-status.is-blocked { color: #ff9b91; }
  .legal-gate #legalContinueBtn { width: min(300px, 100%); margin: 0; transform: none; }
  .legal-gate #legalContinueBtn:active:not(:disabled) { transform: translateY(2px); }
  .legal-gate .consent-sign-in {
    display: block; min-height: 44px; margin: 0 auto; padding: 8px 14px;
    border: 0; background: none; box-shadow: none; color: #d6d6d6;
    font-size: 13px; font-weight: 800; letter-spacing: 0; text-decoration: underline; text-underline-offset: 3px; text-shadow: none;
  }
  .legal-gate .consent-sign-in:disabled { opacity: .5; }
  /* A landscape phone: a shorter Play, so the whole window fits without scrolling. */
  @media (max-height: 520px) {
    .modal.legal-gate { gap: 8px; padding-top: 14px; }
    .legal-gate #legalContinueBtn { min-height: 52px; }
  }

  .legal-age-output {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 3ch;
    margin: 0;
    color: #fff;
    font: 900 clamp(34px, 10vw, 48px)/1 var(--font-rounded);
    font-variant-numeric: tabular-nums;
    -webkit-text-stroke: var(--text-outline-width) #000;
    text-shadow: var(--text-shadow);
  }

  .legal-age-control { position: relative; width: min(300px, 100%); }

  .legal-gate-footer { align-self: end; width: 100%; }

  :is(#legalAgeSlider, #chatAgeSlider) {
    width: 100%;
    height: 26px;
    margin: 0;
    padding: 0;
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    cursor: pointer;
  }

  :is(#legalAgeSlider, #chatAgeSlider)::-webkit-slider-runnable-track {
    height: 5px;
    border-radius: 999px;
    background: rgba(220, 230, 222, .24);
  }

  :is(#legalAgeSlider, #chatAgeSlider)::-moz-range-track {
    height: 5px;
    border: 0;
    border-radius: 999px;
    background: rgba(220, 230, 222, .24);
  }

  :is(#legalAgeSlider, #chatAgeSlider)::-webkit-slider-thumb {
    width: 24px;
    height: 24px;
    margin-top: -9.5px;
    border: 3px solid var(--ui-outline);
    border-radius: 50%;
    appearance: none;
    -webkit-appearance: none;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .38);
  }

  :is(#legalAgeSlider, #chatAgeSlider)::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border: 3px solid var(--ui-outline);
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .38);
  }

  :is(#legalAgeSlider, #chatAgeSlider):focus-visible { outline: none; }
  :is(#legalAgeSlider, #chatAgeSlider):focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px #fff, 0 2px 8px rgba(0, 0, 0, .38); }
  :is(#legalAgeSlider, #chatAgeSlider):focus-visible::-moz-range-thumb { box-shadow: 0 0 0 3px #fff, 0 2px 8px rgba(0, 0, 0, .38); }

  .legal-age-limits {
    display: flex;
    justify-content: space-between;
    margin-top: -2px;
    color: #77827a;
    font-size: 9px;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
  }

  .legal-agreement {
    display: block;
    width: min(330px, 100%);
    margin: 22px auto 0;
    color: #d6d6d6;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.4;
    text-align: left;
  }

  .legal-agreement a { color: #fff; text-underline-offset: 2px; }


  .legal-gate-status {
    min-height: 1.4em;
    margin: 9px 0 0;
    color: #a0a0a0;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.4;
  }

  .legal-gate-status.is-blocked { color: #ff9b91; }
  /* The start screen hides its slider (age is asked in chat), and its Terms and Continue once blocked. */
  #legalGatePanel [hidden] { display: none; }
  /* Chat's age check: the start screen's slider in a small window over the game (chat-age-gate.ts). */
  #chatAgeGate { position: fixed; inset: 0; z-index: 14; display: grid; place-items: center; padding: 16px; background: rgba(0,0,0,.55); }
  #chatAgeGate[hidden] { display: none; }
  .modal.chat-age-gate-modal { display: grid; justify-items: center; gap: 14px; width: var(--game-window-width); padding: 18px 16px 0; border-color: var(--ui-outline); background: var(--window-surface); text-align: center; transform: none; }
  .chat-age-gate-note { margin: 0; color: var(--muted); font-size: 13px; }
  .chat-age-gate-modal > .window-back-footer { justify-self: stretch; }
  .chat-age-gate-modal .legal-age-control { margin-top: 40px; }
  .chat-age-gate-modal #chatAgeContinueBtn { width: min(300px, 100%); margin: 0; transform: none; }
  .chat-age-gate-modal #chatAgeContinueBtn:active:not(:disabled) { transform: translateY(2px); }
  .chat-line.chat-age-line { display: flex; align-items: center; color: var(--gold); font-weight: 900; cursor: pointer; }

  .setting-legal {
    margin: 6px 0 2px;
    text-align: center;
  }

  .setting-legal a {
    color: var(--muted);
    font-size: 9px;
    font-weight: 800;
    text-underline-offset: 2px;
  }

  .account-choice-modal.is-signing-in #signInFromStartBtn,
  .account-choice-modal.is-signing-in #continueGuestBtn {
    visibility: hidden;
    pointer-events: none;
  }

  .signin-version {
    position: fixed;
    z-index: 3;
    left: 50%;
    bottom: 0;
    display: block;
    width: auto;
    min-width: 0;
    min-height: 0;
    margin: 0;
    padding: 15px 40px;
    border: 0;
    border-radius: 9px 9px 0 0;
    background: rgba(7, 12, 8, .58);
    box-shadow: none;
    color: #aebbb0;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: .18em;
    -webkit-text-stroke: 0;
    text-shadow: 0 -1px 0px rgba(20, 20, 20, .92);
    cursor: pointer;
    transform: translateX(-50%);
    transition: color 120ms ease, background-color 120ms ease;
  }

  #accountChoicePanel[hidden] ~ .signin-update-notice,
  #accountChoicePanel[hidden] ~ .signin-version { display: none; }
  .signin-version:hover { color: #e8eee9; background: rgba(7, 12, 8, .78); }
  .signin-version:focus-visible { outline: 2px solid rgba(255, 255, 255, .9); outline-offset: -2px; }
  .signin-version:active { transform: translateX(-50%); }
  .signin-version[aria-expanded="true"] { color: #fff; background: rgba(7, 12, 8, .9); }

  .wildstat-wordmark-title {
    width: min(390px, 100%);
    margin: 0 auto 10px;
    -webkit-text-stroke: 0;
    text-shadow: none;
  }

  .wildstat-wordmark-frame {
    display: block;
    width: 100%;
    aspect-ratio: 3 / 1;
  }

  .wildstat-wordmark-frame img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  #connectionPanel .wildstat-wordmark-title,
  #accountChoicePanel .wildstat-wordmark-title {
    position: absolute;
    top: 20px;
    left: 50%;
    translate: -50% 0;
    width: min(390px, calc(100vw - 36px));
    max-width: none;
    margin: 0;
    animation: signin-logo-float 3.2s ease-in-out infinite;
    opacity: 1;
  }

  .modal.connection-modal,
  .modal.account-choice-modal {
    padding-top: calc(30px + min(390px, calc(100vw - 36px)) / 3);
  }

  @keyframes signin-logo-float {
    0%, 100% { transform: translateY(calc(-10% + 8px)); }
    50% { transform: translateY(-10%); }
  }

  .welcome-wordmark-title {
    display: grid;
    gap: 6px;
  }

  .welcome-wordmark-prefix {
    color: #f5f5e9;
    font-size: clamp(16px, 4vw, 24px);
    line-height: 1;
    -webkit-text-stroke: var(--text-outline-width) #000;
    text-shadow: var(--text-shadow);
  }

  .account-choice-modal p:not(.loading-detail) {
    color: #d8e3d8;
    line-height: 1.55;
  }

  /* The game's own card: a dark surface inside a black frame with the solid
     drop the other panels sit on. The sign-in copy was floating loose over the
     artwork, which is the only text in the game that did. */
  .account-choice-modal .account-note-card {
    margin: 10px auto 22px;
    padding: 9px 14px 11px;
    border: 2px solid var(--hud-frame);
    border-radius: var(--hud-radius);
    /* The player HUD's colour, carried heavier: the HUD sits over the muted
       world and this sits over bright sign-in artwork, where .60 left the
       trees reading straight through the text. */
    background: rgba(24, 24, 24, .84);
    box-shadow: var(--ui-shadow); outline: var(--ui-seam); outline-offset: -1px;
    text-align: center;
  }

  /* Beside the mute button, same size and frame, one gap to its left. */
  .signin-discord-link {
    right: calc(max(12px, env(safe-area-inset-right)) + 56px);
    text-decoration: none;
  }

  .signin-discord-link svg { width: 26px; height: 26px; }

  .account-choice-modal p.account-beta-note { color: #fff; font-size: 14px; }

  .account-choice-modal p.account-move-note {
    display: none;
    margin: 3px 0 0;
    color: rgba(255, 255, 255, .92);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.3;
  }

  .account-choice-modal .account-beta-note a,
  .account-choice-modal .account-move-note a {
    color: #baff91;
    text-underline-offset: 2px;
  }

  .account-choice-modal p.account-character {
    margin: 8px 0 0;
    color: #fff;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: .035em;
  }

  .account-choice-modal .account-character strong {
    color: #86f45d;
    text-shadow: var(--text-shadow);
  }

  .account-choice-modal .account-character.is-empty strong {
    color: #ffd869;
    text-shadow: var(--text-shadow);
  }

  .account-choice-modal p.account-sign-in-hint {
    /* The card's width inside the card; the cap is for the fallback above the
       button. A fixed width ran past the card's edge on phones. */
    width: auto;
    max-width: min(360px, calc(100vw - 64px));
    margin: 8px auto 0;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.45;
    text-align: center;
  }

  .account-choice-modal p.account-sign-in-hint[hidden] { display: none; }

  /* A text line, not one of the big pill buttons above it. */
  .account-choice-modal button.account-sign-in-help,
  .account-choice-modal button.account-switch-button {
    display: inline-block;
    width: auto;
    min-height: 0;
    margin: 6px 0 0;
    padding: 4px 8px;
    border: 0;
    border-radius: 6px;
    background: none;
    box-shadow: none;
    color: #c3c5c3;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
    text-decoration: underline;
    text-underline-offset: 2px;
    text-shadow: none;
    transform: none;
  }

  .account-choice-modal button.account-sign-in-help[aria-expanded="true"] { color: #fff; }

  /* Under the character it offers, so a wrong one is never the only choice. */
  .account-choice-modal button.account-switch-button {
    display: block;
    margin: 6px auto 0;
    color: #fff;
    font-size: 13px;
  }

  .account-choice-modal button.account-switch-button[hidden] { display: none; }

  /* A known character: Sign In is the one choice, Play as Guest the small way out. */
  .account-choice-modal.is-sign-in #continueGuestBtn {
    display: block;
    width: auto;
    min-height: 44px;
    margin: 8px auto 0;
    padding: 8px 14px;
    border: 0;
    background: none;
    box-shadow: none;
    color: #d6d6d6;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.3;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-shadow: none;
    transform: none;
  }

  .account-choice-modal.is-sign-in #continueGuestBtn:active:not(:disabled) { box-shadow: none; transform: translateY(1px); }

  .account-sign-in-hint span {
    display: block;
    margin-top: 3px;
    color: #c3c5c3;
    font-size: 12px;
    font-weight: 400;
  }

  .account-choice-modal button,
  :is(#legalContinueBtn, #chatAgeContinueBtn) {
    display: block;
    width: min(360px, calc(100vw - 108px));
    max-width: none;
    min-height: 70px;
    margin: 13px 0 0 50%;
    border-width: 2px;
    border-radius: 999px;
    font-size: 24px;
    line-height: 1;
    -webkit-text-stroke: 0 rgba(255, 255, 255, 0);
    text-shadow: 0 -.7px 2px rgba(0, 0, 0, 1);
    transform: translateX(-50%);
    transition: filter 120ms ease, transform 120ms ease, box-shadow 120ms ease;
  }

  .account-choice-modal #signInFromStartBtn {
    border-color: #045801;
    background: linear-gradient(170deg, #90de2f 0%, #21c613 52%, #019804 100%);
    box-shadow:
      inset 1px 2px 3px rgba(255, 255, 255, .72),
      0 3px 0 #035701,
      0 7px 14px rgba(0, 0, 0, .28);
    color: #fff;
  }

  .account-choice-modal #continueGuestBtn,
  :is(#legalContinueBtn, #chatAgeContinueBtn) {
    border-color: #303738;
    background: linear-gradient(170deg, #676969 0%, #505d5e 52%, #425052 100%);
    box-shadow:
      inset 1px 2px 3px rgba(255, 255, 255, .42),
      0 3px 0 var(--ui-outline),
      0 7px 14px rgba(0, 0, 0, .28);
    color: #fff;
  }

  .account-choice-modal button:hover:not(:disabled),
  :is(#legalContinueBtn, #chatAgeContinueBtn):hover:not(:disabled) { filter: brightness(1.035); }

  .account-choice-modal button:focus-visible,
  :is(#legalContinueBtn, #chatAgeContinueBtn):focus-visible {
    outline: 3px solid rgba(255, 255, 255, .92);
    outline-offset: 3px;
  }

  .account-choice-modal #signInFromStartBtn:active:not(:disabled) {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, .62),
      0 1px 0 #246f19,
      0 3px 8px rgba(0, 0, 0, .24);
    transform: translate(-50%, 2px);
  }

  .account-choice-modal #continueGuestBtn:active:not(:disabled),
  :is(#legalContinueBtn, #chatAgeContinueBtn):active:not(:disabled) {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, .24),
      0 1px 0 var(--ui-outline),
      0 3px 8px rgba(0, 0, 0, .26);
    transform: translate(-50%, 2px);
  }

  .account-choice-modal button:disabled,
  :is(#legalContinueBtn, #chatAgeContinueBtn):disabled {
    filter: saturate(.6);
    opacity: .58;
    cursor: default;
  }

  #accountChoiceDetail { display: none; }

  .connection-modal p {
    color: #fff;
    font-size: 14px;
    font-weight: 900;
    letter-spacing: .08em;
  }

  .loading-track {
    height: 12px;
    overflow: hidden;
    border: 2px solid #0a0a0a;
    border-radius: 7px;
    background: #161616;
  }

  .loading-content {
    position: absolute;
    top: 50%;
    left: 20px;
    right: 20px;
    height: 12px;
    transform: translateY(-50%);
  }

  .loading-content .loading-heading {
    position: absolute;
    bottom: 100%;
    width: 100%;
    margin: 0 0 12px;
  }

  .loading-content .loading-track { height: 12px; margin: 0; }

  .loading-status { padding-top: 8px; }

  .loading-fill {
    width: 8%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #bdbdbd, #fff, #bdbdbd);
    transition: width .25s linear;
  }

  .loading-detail {
    color: #fff !important;
    font-size: 9px !important;
    line-height: 1.5;
  }

  #sessionTakeoverBtn {
    width: min(240px, 100%);
    margin: 12px auto 0;
  }

  .session-takeover-note {
    margin: 7px 0 0 !important;
    color: var(--muted) !important;
    font-size: 8px !important;
    letter-spacing: .04em !important;
  }

  .onboarding-modal {
    width: min(620px, calc(100vw - 26px));
  }

  .onboarding-name-label {
    display: block;
    margin: 14px 0 6px;
    color: #ffe777;
    font-weight: 900;
    letter-spacing: .07em;
  }

  #newPlayerNameInput {
    width: min(320px, 100%);
    box-sizing: border-box;
    border: 2px solid rgba(255,255,255,.3);
    border-radius: 7px;
    background: #0d0d0d;
    color: #fff;
    font: 900 17px var(--font-rounded);
    padding: 10px 12px;
    text-align: center;
  }

  #newPlayerNameInput:focus {
    outline: 2px solid #72ef58;
    outline-offset: 2px;
  }

  #duelResult,
  #offlineProgress,
  #playerProfile,
  #leaderboard,
  #devAudit,
  #techTreeOverlay {
    position: fixed;
    inset: 0;
    z-index: 8;
    display: grid;
    place-items: center;
    padding: 13px;
    background: transparent;
  }

  #duelResult[hidden],
  #offlineProgress[hidden],
  #playerProfile[hidden],
  #leaderboard[hidden],
  #devAudit[hidden],
  #techTreeOverlay[hidden] { display: none; }

  #leaderboard,
  #devAudit,
  #techTreeOverlay { bottom: var(--window-bottom-inset); }

  #leaderboard { place-items: stretch; padding: 0; }

  /* Let world touch controls through outside non-blocking windows. */
  #playerProfile,
  #leaderboard,
  #devAudit,
  #profileIconPicker { pointer-events: none; }
  #playerProfile .modal,
  #leaderboard .modal,
  #devAudit .modal,
  #profileIconPicker .modal { pointer-events: auto; }

  #prestigeOverlay { position: fixed; inset: 0; z-index: 13; display: grid; place-items: center; padding: max(14px, env(safe-area-inset-left)); background: rgba(0,0,0,.78); }
  #prestigeOverlay[hidden] { display: none; }
  .prestige-window { display: grid; gap: 10px; width: min(420px, 100%); max-height: 100%; overflow: auto; overscroll-behavior: contain; scrollbar-width: none; padding: 12px; background: var(--window-surface-blue); border: 2px solid #2b3a52; border-radius: 10px; }
  .prestige-window::-webkit-scrollbar { display: none; }
  /* The prestige window scrolls only its open tab: the title, tabs and Back stay on screen. */
  #prestigeOverlay > .prestige-window { display: flex; flex-direction: column; overflow: hidden; }
  #prestigeOverlay > .prestige-window > * { flex: 0 0 auto; }
  #prestigeOverlay > .prestige-window > .prestige-tab-panel { flex: 0 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
  #prestigeOverlay > .prestige-window > .prestige-tab-panel::-webkit-scrollbar { display: none; }
  .prestige-header { display: grid; justify-items: center; gap: 4px; }
  .prestige-level { color: #c2c7ce; font-size: clamp(7px, 1.7vw, 10px); letter-spacing: .06em; }
  .prestige-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; text-align: center; }
  .prestige-summary dt { color: #8c94a1; font-size: 9px; letter-spacing: .06em; }
  .prestige-summary dd { margin: 2px 0 0; color: #fff; font-size: 13px; }
  /* Perks | Challenge, underlined like the inventory tabs. */
  .prestige-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; border-bottom: 1px solid #2b3a52; }
  .prestige-tab { font-size: 13px; letter-spacing: .02em; }
  /* Runs: the live run's splits, then past runs that open to theirs. */
  .prestige-runs-live, .prestige-runs-past { display: grid; gap: 8px; }
  .prestige-runs-heading { margin: 4px 0 0; color: #c2c7ce; font-size: 13px; letter-spacing: .02em; }
  .prestige-splits { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
  .prestige-splits li, .prestige-run summary { display: grid; grid-template-columns: minmax(0, 1fr) auto 64px; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 6px; background: rgba(0,0,0,.28); color: #fff; font-size: 13px; }
  .prestige-run summary { cursor: pointer; list-style: none; }
  .prestige-run summary::-webkit-details-marker { display: none; }
  .prestige-run[open] summary { background: rgba(255,255,255,.08); }
  .prestige-run .prestige-splits { margin: 2px 0 6px 12px; }
  .prestige-split-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .prestige-split-time { font-variant-numeric: tabular-nums; }
  .prestige-split-delta { color: #8c94a1; text-align: right; font-variant-numeric: tabular-nums; }
  .prestige-split-delta.is-ahead { color: #fff4d6; }
  .prestige-splits .prestige-split-none { display: block; color: #8c94a1; }
  .prestige-runs-note { margin: 0; color: #8c94a1; font-size: 13px; line-height: 1.35; }
  .prestige-tab { position: relative; min-width: 0; height: 38px; min-height: 38px; margin: 0; padding: 0 10px 5px; border: 0; border-radius: 0; background: transparent; box-shadow: none; color: #8c94a1; font: 900 12px/1 var(--font-rounded); letter-spacing: .06em; }
  .prestige-tab::after { position: absolute; bottom: -1px; left: 18%; right: 18%; height: 3px; border-radius: 2px; background: transparent; content: ""; }
  .prestige-tab.is-active { background: transparent; color: #fff4d6; box-shadow: none; }
  .prestige-tab.is-active::after { background: #f0c674; }
  .prestige-tab:focus-visible { outline: 2px solid #fff4d6; outline-offset: 1px; }
  .prestige-tab-panel { display: grid; gap: 10px; }
  .prestige-tab-panel[hidden] { display: none; }
  .prestige-perks { display: grid; gap: 6px; }
  /* A perk closed is one tap target (name, rank, what it gives now) beside
     Spend; open, what it does and the next rank sit underneath. */
  .prestige-perk { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0 8px; padding: 4px 8px 4px 4px; background: rgba(0,0,0,.25); border-radius: 6px; }
  .prestige-perk.is-open { background: rgba(0,0,0,.38); }
  .prestige-perk-head { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: baseline; gap: 2px 8px; min-width: 0; min-height: 48px; margin: 0; padding: 6px; border: 0; border-radius: 4px; background: transparent; box-shadow: none; color: #fff; font: 900 15px/1.2 var(--font-rounded); text-align: left; text-shadow: none; }
  .prestige-perk-head:focus-visible { outline: 2px solid #fff4d6; outline-offset: -2px; }
  .prestige-perk-rank { color: #8c94a1; font-size: 13px; }
  .prestige-perk-chevron { grid-column: 4; width: 8px; height: 8px; border-right: 2px solid #8c94a1; border-bottom: 2px solid #8c94a1; transform: translateY(-3px) rotate(45deg); transition: transform .15s; }
  .prestige-perk.is-open .prestige-perk-chevron { transform: translateY(1px) rotate(-135deg); }
  .prestige-perk-value { grid-column: 1 / -1; color: #f0c674; font-size: 13px; font-weight: 700; }
  .prestige-perk.is-unowned .prestige-perk-value { color: #aab2bd; }
  .prestige-perk-more { grid-column: 1 / -1; display: grid; gap: 4px; padding: 0 6px 6px; }
  .prestige-perk-more[hidden] { display: none; }
  .prestige-perk-detail, .prestige-perk-next { margin: 0; color: #c2c7ce; font-size: 13px; line-height: 1.4; }
  .prestige-perk-next { color: #8c94a1; }
  .prestige-perk-spend { grid-column: 2; grid-row: 1; min-height: 40px; margin: 0; padding: 0 14px; font-size: 13px; }
  .prestige-perk-spend:disabled { filter: grayscale(.8); opacity: .5; }
  /* Respec: under the perks it undoes, set apart by a dashed edge because it
     costs the run's power; armed in the same amber as an armed Prestige. */
  .prestige-respec { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; padding: 6px 8px; border: 1px dashed #3a4a66; border-radius: 6px; }
  .prestige-respec[hidden] { display: none; }
  .prestige-respec-text { color: #8c94a1; font-size: 10px; line-height: 1.4; }
  .prestige-respec-btn { min-height: 36px; padding: 0 12px; font-size: 11px; }
  .prestige-respec-btn.is-armed { border-color: #8a3a1e; background: linear-gradient(#e08a3c, #a04f1c); color: #fff; }
  .prestige-respec-btn:disabled { filter: grayscale(.8); opacity: .5; }
  /* The free respec costs nothing, so it reads as a safe green beside the costly one. */
  /* Reflect Only: one card, amber while a run is under way. */
  .prestige-challenge { display: grid; gap: 10px; padding: 12px; background: rgba(0,0,0,.25); border: 1px solid #2b3a52; border-radius: 8px; }
  .prestige-challenge.is-active { border-color: #a8742a; box-shadow: inset 0 0 0 1px rgba(240,198,116,.25); }
  .prestige-challenge-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; }
  .prestige-challenge-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: rgba(90,140,220,.2); border: 2px solid #4a6a9a; font-size: 20px; }
  .prestige-challenge-title { margin: 0; color: #fff; font: 900 16px/1.1 var(--font-rounded); letter-spacing: .02em; }
  .prestige-challenge-state { margin: 2px 0 0; color: #8c94a1; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
  .prestige-challenge.is-active .prestige-challenge-state { color: #f0c674; }
  .prestige-challenge-pips { display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; }
  .prestige-challenge-pips li { width: 10px; height: 10px; border-radius: 50%; border: 2px solid #4a5a74; background: transparent; }
  .prestige-challenge-pips li.is-done { border-color: #f0c674; background: #f0c674; }
  .prestige-challenge-rule { margin: 0; color: #fff; font-size: 12px; line-height: 1.45; }
  .prestige-challenge-terms { display: grid; gap: 4px; margin: 0; padding-left: 16px; color: #aab2bf; font-size: 10px; line-height: 1.4; }
  .prestige-challenge-goal { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 2px 8px; padding: 8px 10px; border-radius: 6px; background: rgba(90,140,220,.12); border: 1px solid rgba(110,150,220,.4); }
  .prestige-challenge-goal span { color: #8c94a1; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
  .prestige-challenge-goal strong { color: #fff; font-size: 13px; }
  .prestige-challenge-goal small { grid-column: 1 / -1; color: #8c94a1; font-size: 10px; }
  .prestige-challenge-reward { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 2px 8px; padding: 8px 10px; border-radius: 6px; background: rgba(240,198,116,.1); border: 1px solid rgba(240,198,116,.35); }
  .prestige-challenge-reward span { color: #8c94a1; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
  .prestige-challenge-reward strong { color: #f0c674; font-size: 14px; }
  .prestige-challenge-reward small { grid-column: 1 / -1; color: #aab2bf; font-size: 10px; }
  .prestige-challenge-earned { margin: 0; color: #8c94a1; font-size: 10px; text-align: center; }
  .prestige-challenge-earned:empty, .prestige-challenge-status:empty, .prestige-challenge-terms:empty,
  .prestige-challenge-goal[hidden], .prestige-challenge-reward[hidden] { display: none; }
  .prestige-challenge-action { min-height: 44px; font-size: 12px; border-color: #2c4d7a; background: linear-gradient(#4f86c9, #2f5a91); color: #fff; }
  .prestige-challenge-action.is-abandon { border-color: #5a4a2a; background: linear-gradient(#7a6a4a, #4f4230); }
  .prestige-challenge-action:disabled { filter: grayscale(.8); opacity: .5; }
  .prestige-challenge-status { margin: 0; color: #f0c674; font-size: 11px; text-align: center; }
  .prestige-cost { margin: 0; color: #c2c7ce; font-size: 11px; line-height: 1.5; text-align: center; }
  .prestige-status { min-height: 16px; color: #f0c674; font-size: 11px; text-align: center; }
  .prestige-footer { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
  .prestige-footer button { min-height: 44px; margin: 0; font-size: 12px; }
  .prestige-confirm { border-color: #67272b; background: linear-gradient(#c85050, #842f34); color: #fff; }
  .prestige-confirm.is-armed { border-color: #8a3a1e; background: linear-gradient(#e08a3c, #a04f1c); }
  .prestige-confirm:disabled { filter: grayscale(.7); opacity: .6; }
  /* "Prestige N unlocked": the prestige window's frame, footer and confirm,
     raised by itself when a level opens. Same layer and dimming as that window;
     each edge clears its own safe-area inset so a notch or home bar never
     covers a button. */
  #prestigeUnlock { position: fixed; inset: 0; z-index: 13; display: grid; place-items: center; padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); background: rgba(0,0,0,.78); }
  #prestigeUnlock[hidden] { display: none; }
  .prestige-unlock-window { width: min(360px, 100%); text-align: center; }
  .prestige-unlock-window .window-banner.window-banner { margin-bottom: 0; }
  .prestige-unlock-badge { --prestige-badge-size: 56px; margin: 0 0 2px; }
  .prestige-unlock-kicker { color: #f0c674; font-size: 12px; font-weight: 900; letter-spacing: .18em; }
  .prestige-unlock-reward { margin: 0; color: #fff; font-size: 13px; line-height: 1.45; }
  .prestige-unlock-later { margin: 0; color: #8c94a1; font-size: 10px; line-height: 1.4; }
  .prestige-unlock-window .prestige-footer button { flex: 1 1 128px; width: auto; max-width: 170px; height: 44px; margin: 0; padding: 0 8px 2px; border-width: 2px; border-radius: 8px; }
  /* Landscape phones: the window scrolls rather than clip, but the badge and
     the spacing give way first so both buttons usually fit without it. */
  @media (max-height: 480px) {
    .prestige-unlock-window { gap: 6px; padding: 8px 12px; }
    .prestige-unlock-badge { --prestige-badge-size: 36px; }
    .prestige-unlock-window .window-banner.window-banner { --banner-width: min(220px, 50vw); }
  }
  .profile-own-actions { display: flex; justify-content: center; margin-top: 10px; }
  .profile-own-actions[hidden] { display: none; }
  /* The back button's shape, in the tab row's own blue. It is the one action on
     the row, so it anchors right while STATS and INFO stay left. */
  .profile-prestige-button { width: auto; min-width: 96px; height: 38px; min-height: 38px; margin: 0; padding: 0 14px 2px; border-color: #24365a; background: linear-gradient(#5f7fc0, #35508a); box-shadow: 0 3px 0 #1b2b47; }
  .profile-prestige-button:disabled { filter: grayscale(.8); opacity: .55; }
  .profile-tabs-with-action { align-items: flex-end; }
  .profile-tab-list { display: flex; gap: 7px; min-width: 0; }
  .profile-tabs-with-action .profile-own-actions { margin: 0 0 6px auto; }
  #techTreeOverlay { z-index: 12; padding: 0; background: rgba(0,0,0,.78); }
  .tech-tree-window { position: relative; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; width: 100%; height: 100%; overflow: hidden; background: var(--window-surface-blue); border: 2px solid var(--ui-outline); border-bottom: 0; color: var(--text); text-align: left; }
  .tech-tree-header { z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 62px; padding: 10px max(14px, env(safe-area-inset-right)) 10px max(14px, env(safe-area-inset-left)); border-bottom: 0; background: transparent; }
  .tech-tree-active { min-width: 0; margin: 0 auto; color: #c2c7ce; font-size: clamp(7px, 1.7vw, 10px); letter-spacing: .06em; text-align: center; }
  .tech-tree-viewport { position: relative; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: none; }
  .tech-tree-viewport[hidden], .tech-tree-categories[hidden] { display: none; }
  .tech-tree-viewport::-webkit-scrollbar { display: none; }
  .tech-tree-categories { display: grid; align-content: center; justify-items: center; gap: 18px; min-height: 0; padding: 24px; overflow: auto; }
  .tech-tree-choice { display: grid; grid-template-columns: 48px minmax(0, 1fr); column-gap: 16px; align-items: center; width: min(100%, 370px); min-height: 112px; padding: 15px 18px; border: 2px solid #858d98; border-radius: 14px; background: linear-gradient(145deg, #37404a, #171d24); color: var(--text); text-align: left; box-shadow: inset 0 0 0 2px rgba(0,0,0,.45), 0 6px 0 var(--ui-outline); }
  .tech-tree-choice:hover, .tech-tree-choice:focus-visible { border-color: #e2ebf4; background: linear-gradient(145deg, #485564, #202a34); outline: 0; }
  .tech-tree-choice-icon { grid-row: span 3; color: #e9c969; font-size: 35px; text-align: center; }
  .tech-tree-choice strong { font-size: 20px; line-height: 1; }
  .tech-tree-choice > span:not(.tech-tree-choice-icon) { color: #cbd3dc; font-size: 10px; }
  .tech-tree-choice small { color: #e9c969; font-size: 10px; }
  #techTreeCanvas { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; background: transparent; image-rendering: auto; pointer-events: none; }
  .tech-tree-map { position: relative; z-index: 1; display: grid; grid-auto-rows: 168px; min-width: 420px; min-height: calc(var(--tech-tree-row-count, 1) * 168px + var(--tech-tree-edge-space, 22px) * 2); height: auto; padding: var(--tech-tree-edge-space, 22px) clamp(24px, 7vw, 112px); }
  .tech-tree-tier { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; justify-self: center; width: min(372px, 100%); gap: 56px; }
  .tech-tree-tier-bottom { justify-content: space-between; }
  .tech-tree-node { position: relative; display: grid; place-items: center; gap: 3px; width: 112px; aspect-ratio: 1; margin: 0; padding: 9px; border: 2px solid #737a84; border-radius: 15px; background: linear-gradient(145deg, #2d333a, #12161a); box-shadow: inset 0 0 0 2px rgba(0,0,0,.5), 0 5px 0 var(--ui-outline); color: var(--text); text-align: center; }
  .tech-tree-node::before { position: absolute; inset: 4px; border: 1px solid rgba(222,227,234,.16); border-radius: 10px; content: ""; pointer-events: none; }
  .tech-tree-node.is-available { border-color: #c4cad1; background: linear-gradient(145deg, #3d444c, #171b20); }
  .tech-tree-node.is-paused { border-color: #e2b65a; box-shadow: inset 0 0 0 2px rgba(0,0,0,.5), 0 0 14px rgba(226,182,90,.3); }
  .tech-tree-actions { display: flex; justify-content: center; align-items: stretch; gap: 8px; margin-top: 3px; }
  .tech-tree-node.is-active { border-color: #f1f3f5; background: linear-gradient(145deg, #555d66, #20262c); box-shadow: inset 0 0 0 2px rgba(0,0,0,.5), 0 0 18px rgba(230,234,239,.28); }
  .tech-tree-node.is-complete { border-color: #f0c44f; background: linear-gradient(145deg, #66501d, #29200e); box-shadow: inset 0 0 0 2px rgba(54,34,4,.62), 0 0 14px rgba(240,196,79,.25), 0 5px 0 var(--ui-outline); }
  .tech-tree-node.is-complete::before { border-color: rgba(255,232,154,.42); }
  .tech-tree-node.is-complete::after { position: absolute; top: -8px; right: -8px; z-index: 2; color: #65d66d; content: "Max"; font: 900 12px/1 var(--font-rounded); text-shadow: 0 2px 0 rgba(0,0,0,.78), 0 0 4px rgba(101,214,109,.35); }
  .tech-tree-node.is-complete strong { color: #fff1b0; }
  .tech-tree-node.is-complete small { color: #ffd963; }
  .tech-tree-node.is-locked { opacity: .56; }
  .tech-tree-node strong { color: #f1f3f5; font-size: clamp(10px, 1.65vw, 15px); line-height: 1.05; }
  .tech-tree-node small { color: #c0c6cd; font-size: 14px; letter-spacing: .045em; }
  .tech-tree-node:hover, .tech-tree-node:focus-visible { border-color: #f1f3f5; box-shadow: inset 0 0 0 2px rgba(0,0,0,.5), 0 0 0 2px rgba(240,243,246,.22), 0 5px 0 var(--ui-outline); outline: 0; }
  .tech-tree-detail { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; padding: 18px; background: rgba(0,0,0,.62); }
  .tech-tree-detail[hidden] { display: none; }
  .tech-tree-detail-card { display: grid; gap: 12px; width: min(100%, 360px); padding: 14px; border: 2px solid #8c949e; border-radius: 9px; background: var(--window-surface-blue); box-shadow: 0 10px 0 var(--ui-outline); }
  .tech-tree-detail-content { display: grid; gap: 9px; }
  .tech-tree-detail-content strong { color: #f4f5f7; font-size: 16px; }
  .tech-tree-detail-content span { color: #c2c7ce; font-size: 9px; }
  .tech-tree-effect-value { color: #fff; font-size: 23px; line-height: 1; }
  .tech-tree-research-time { display: grid; gap: 3px; padding: 9px; border: 1px solid #707883; background: rgba(0,0,0,.24); }
  .tech-tree-research-time span { color: #c2c7ce; font-size: 8px; letter-spacing: .08em; }
  .tech-tree-research-time strong { color: #fff; font-size: 21px; line-height: 1; }
  .tech-tree-timer { display: grid; gap: 5px; }
  .tech-tree-timer-label { color: #e9edf1; font-size: 10px; }
  .tech-tree-timer-track { height: 13px; overflow: hidden; border: 2px solid #9ba3ad; background: #0d1013; }
  .tech-tree-timer-fill { width: calc(var(--research-progress) * 100%); height: 100%; margin-right: auto; background: #d9dde2; transform-origin: left center; transition: width .7s linear; }
  .tech-tree-action { justify-self: center; min-height: 28px; margin-top: 3px; border-color: #aeb5bd; background: #515963; color: #fff; font-size: 9px; text-align: center; }
  .tech-tree-action:hover:not(:disabled), .tech-tree-action:focus-visible { border-color: #fff; background: #68727d; }
  .tech-tree-action.is-gem-speed-up { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 38px; padding-inline: 12px; border-color: #e697bd; background: linear-gradient(#864c72, #57304b); color: #fff; }
  .tech-tree-action.is-gem-speed-up:hover:not(:disabled), .tech-tree-action.is-gem-speed-up:focus-visible { border-color: #ffd0e6; background: linear-gradient(#a35e8b, #6e3b60); }
  .tech-tree-action.is-gem-speed-up img { display: block; width: 18px; height: 18px; object-fit: contain; }
  .tech-tree-action.is-gem-speed-up strong { color: #fff; font-size: 12px; line-height: 1; }
  /* Finish Now and Pause take the Back button's shape and lettering, in their own colors. */
  .tech-tree-actions .tech-tree-action { flex: 1 1 0; max-width: 150px; height: 44px; min-height: 44px; margin: 0; padding: 0 8px 2px; border-width: 2px; border-radius: 8px; color: #fff; font: 900 11px/1 var(--font-rounded); -webkit-text-stroke: var(--text-outline-width) #000; paint-order: stroke fill; text-shadow: var(--text-shadow); }
  .tech-tree-actions .tech-tree-action.is-gem-speed-up { border-color: #3a1830; background: linear-gradient(#a35e8b, #6a3a5c); box-shadow: 0 3px 0 #2c1225; }
  .tech-tree-actions .tech-tree-action.is-gem-speed-up:hover:not(:disabled), .tech-tree-actions .tech-tree-action.is-gem-speed-up:focus-visible { border-color: #3a1830; background: linear-gradient(#b86c9d, #7b456b); }
  .tech-tree-actions .tech-tree-action.is-gem-speed-up span { color: #fff; font: inherit; letter-spacing: 0; }
  .tech-tree-actions .tech-tree-action.is-gem-speed-up strong { font-size: 13px; -webkit-text-stroke: var(--text-outline-width) #000; paint-order: stroke fill; }
  .tech-tree-actions .tech-tree-pause, .tech-tree-actions .tech-tree-action:not(.is-gem-speed-up) { border-color: #1d2227; background: linear-gradient(#6d7782, #444c55); box-shadow: 0 3px 0 #1a1e22; }
  .tech-tree-actions .tech-tree-pause:hover:not(:disabled), .tech-tree-actions .tech-tree-pause:focus-visible,
  .tech-tree-actions .tech-tree-action:not(.is-gem-speed-up):hover:not(:disabled), .tech-tree-actions .tech-tree-action:not(.is-gem-speed-up):focus-visible { border-color: #1d2227; background: linear-gradient(#7c8792, #515a64); }
  /* Can't press it yet (a requirement, every level done): the same button, dimmed and flat. */
  .tech-tree-actions .tech-tree-action:disabled { opacity: .55; box-shadow: none; cursor: default; }
  /* Alone (Start Research, or what it needs first): wider, and a long requirement wraps instead of spilling out. */
  .tech-tree-actions .tech-tree-action:only-child { max-width: 260px; height: auto; padding-block: 8px 10px; line-height: 1.15; }

  #sceneFade {
    position: fixed;
    inset: 0;
    /* Over the world and HUD, under open windows: a portal fade never blacks out the bag. */
    z-index: 9;
    background: #000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 160ms ease;
  }

  #sceneFade[hidden] { display: none; }
  #sceneFade.is-visible { opacity: 1; pointer-events: auto; }
  #cutsceneOverlay { position: fixed; inset: 0; z-index: 21; background: transparent; pointer-events: auto; }
  #cutsceneOverlay[hidden] { display: none; }
  body.is-cutscene #hud { visibility: hidden; }

  .duel-modal { width: var(--game-window-width); border-color: rgba(198,208,210,.56); }
  .duel-modal h2 { margin: 0; color: #eef1ee; font-size: clamp(22px, 6vw, 34px); }
  .duel-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 14px 0; text-align: left; font-size: 11px; }
  .duel-stat-row { padding: 8px; border: 1px solid rgba(255,255,255,.16); border-radius: 7px; background: rgba(0,0,0,.2); }
  .duel-stat-name, .duel-status-name { display: inline-flex; align-items: center; gap: 3px; color: var(--gold); font-weight: 900; }
  #shareDuelBtn { display: block; width: 100%; margin-top: 8px; }
  #watchDuelReplayBtn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; margin-top: 8px; padding: 3px 13px; border-color: transparent; background: transparent; font-size: 13px; line-height: 1; }
  .duel-replay-play-icon { display: block; width: 25px; height: 25px; background: center / contain no-repeat url("replay-play.7334faf3df564411.svg"); -webkit-text-stroke: 0; text-shadow: none; }
  #playerProfile { z-index: 9; padding: max(5px, env(safe-area-inset-top)) max(5px, env(safe-area-inset-right)) max(5px, env(safe-area-inset-bottom)) max(5px, env(safe-area-inset-left)); }
  .modal.player-profile-modal { --window-back-bottom-gap: 9px; display: flex; flex-direction: column; background: var(--window-surface); border-color: var(--ui-outline); width: var(--game-window-width); height: min(560px, calc(100dvh - max(5px, env(safe-area-inset-top)) - max(5px, env(safe-area-inset-bottom)))); max-height: 100%; padding: 8px; overflow: hidden; text-align: left; transform: none; }
  /* A framed portrait reaches past its own box, and this scroller clips: the
     header icon sits flush against the left edge, so the frame lost its outer
     rim there. The gutter is the widest overhang a frame can have. */
  .player-profile-scroll { flex: 1 1 0; min-height: 0; padding-inline: 9px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
  .player-profile-scroll::-webkit-scrollbar { display: none; }
  .profile-settings-button { flex: 0 0 44px; align-self: flex-start; display: grid; place-items: center; width: 44px; height: 44px; margin: 0; padding: 7px; border: 1px solid transparent; border-radius: 7px; background: transparent; box-shadow: none; }
  .profile-settings-button[hidden] { display: none; }
  .profile-settings-button img { width: 28px; height: 28px; object-fit: contain; }
  /* The gear rides the player HUD's summary row, beside power. It opens the same
     profile window the card does, and is the visible sign that the card is a
     button at all. */
  .hud-settings-button { flex: 0 0 auto; align-self: center; display: grid; place-items: center; width: 30px; height: 30px; min-height: 0; margin: 0; padding: 4px; border: 1px solid transparent; border-radius: 6px; background: transparent; box-shadow: none; }
  .hud-settings-button img { width: 22px; height: 22px; object-fit: contain; }
  .hud-settings-button:active { transform: none; }
  /* Locked until the Dragon is down: greyed, with a padlock over the icon. */
  .leaderboard-button.is-locked { filter: grayscale(.85); opacity: .6; cursor: default; }
  .leaderboard-button.is-locked:active { transform: none; }
  .leaderboard-button.is-locked .toolbar-icon { opacity: .5; }
  .leaderboard-button.is-locked::after { content: "\1f512"; position: absolute; right: 4px; top: 2px; font-size: 11px; line-height: 1; pointer-events: none; }
  .leaderboard-button { position: relative; }
  .player-summary #playerPower { margin-left: auto; }
  .player-profile-header { display: flex; align-items: center; gap: 10px; }
  .player-profile-title-row { min-width: 0; flex: 1; display: flex; align-items: center; gap: 10px; }
  .player-profile-identity { min-width: 0; flex: 1; }
  .player-profile-name-row { position: relative; display: flex; align-items: center; gap: 4px; min-width: 0; }
  .player-profile-guest { position: absolute; bottom: calc(100% + 1px); left: 0; color: #a9b1ad; font-family: var(--player-name-font); font-size: 8px; line-height: 1; }
  .player-profile-guest[hidden] { display: none; }
  .player-profile-header h2 { display: flex; align-items: center; gap: 3px; min-width: 0; margin: 0; color: var(--text); font-family: var(--player-name-font); font-size: clamp(12px, 2.9vw, 18px); line-height: 1.08; overflow-wrap: anywhere; }
  .player-name-guest { color: #a9b1ad; font-size: .8em; }
  .player-profile-header h2 .player-name-guest { display: none; }
  /* The same white pencil Edit Profile uses, beside the settings gear. */
  .profile-header-actions { display: flex; flex: 0 0 auto; align-self: flex-start; align-items: center; gap: 8px; }
  .profile-editor-pencil.profile-name-edit { width: 36px; min-width: 36px; height: 36px; border-radius: 8px; }
  .profile-editor-pencil.profile-name-edit svg { width: 18px; height: 18px; }
  .profile-name-edit[hidden] { display: none; }
  .player-profile-presence { margin-top: 4px; color: var(--muted); font-size: 8px; letter-spacing: .08em; }
  .player-profile-presence.is-online { color: #72ef58; }
  /* "In challenge - Aggro": under the online line, in the same size, cyan. */
  .player-profile-challenge { margin-top: 2px; color: #5fd8ff; font-size: 8px; letter-spacing: .08em; }
  .player-profile-challenge[hidden] { display: none; }
  /* The player's guild: badge and name on one line, opening the guild. */
  .player-profile-guild { display: flex; align-items: center; gap: 6px; max-width: 100%; min-height: 28px; margin: 4px 0 0; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; color: #e6e6e6; font: 800 13px/1.1 var(--font-rounded); text-align: left; text-transform: none; text-shadow: none; }
  .player-profile-guild[hidden] { display: none; }
  .player-profile-guild:disabled { opacity: 1; cursor: default; }
  .player-profile-guild-emblem { flex: 0 0 24px; width: 24px; height: 24px; }
  .player-profile-guild-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #playerProfilePower { position: absolute; z-index: 2; top: 2px; left: 62px; right: 62px; display: flex; align-items: center; justify-content: center; gap: 3px; color: #fff; font: 900 18px/1 var(--player-name-font); white-space: nowrap; -webkit-text-stroke: var(--text-outline-width) #000; paint-order: stroke fill; text-shadow: var(--text-shadow); pointer-events: none; }
  #playerProfilePower .power-icon { width: 18px; height: 18px; }
  #playerProfileName { --prestige-badge-size: 18px; }
  .power-value { color: #fff; }
  .profile-character-preview { --inventory-line: rgba(255,255,255,.17); --inventory-muted: #aebcaf; position: relative; display: grid; grid-template-columns: 54px minmax(0, 1fr) 54px; grid-template-rows: repeat(2, 54px); justify-content: center; align-content: center; align-items: stretch; gap: 2px 4px; height: 132px; min-height: 132px; margin: 5px 0 2px; padding: 4px; overflow: visible; }
  .profile-character-stage { position: relative; z-index: 1; grid-column: 2; grid-row: 1 / span 2; min-width: 0; min-height: 0; overflow: visible; border-radius: 3px; background: transparent; pointer-events: none; }
  .profile-equipment-slot { grid-template-rows: 12px minmax(0, 1fr); gap: 1px; width: 54px; height: 54px; min-height: 54px; aspect-ratio: 1; padding: 2px; border-radius: 5px; cursor: pointer; }
  .profile-equipment-slot.is-equipped { grid-template-rows: minmax(0, 1fr); gap: 0; border-color: var(--inventory-line); cursor: pointer; }
  .profile-equipment-slot:disabled { cursor: default; opacity: .72; }
  .profile-equipment-slot .equipment-slot-label { font-size: 7px; }
  .profile-equipment-slot.is-equipped .equipment-slot-label { display: none; }
  .profile-equipment-slot .equipment-slot-name { display: none; }
  .profile-equipment-slot .equipment-slot-art { place-self: stretch; }
  .profile-equipment-slot .inventory-item-art { width: 100%; height: 100%; max-width: none; max-height: none; }
  .profile-equipment-slot .boot-pixel-icon { transform: scale(1.25); }
  .profile-equipment-slot .inventory-upgrade-level { display: block; top: 3px; right: 2px; bottom: auto; font-size: 7px; line-height: 9px; }
  .profile-equipment-slot.is-cosmetic-hidden .equipment-slot-art > .inventory-item-art { opacity: .4; filter: grayscale(.45); }
  .profile-equipment-hidden-mark { position: absolute; top: 58%; left: 50%; width: 31px; height: 2px; border-radius: 999px; background: #e49a9f; box-shadow: 0 1px 0 var(--ui-outline); transform: translate(-50%, -50%) rotate(-36deg); }
  .player-sprite-selector { display: grid; place-items: center; width: 23px; min-width: 23px; height: 31px; margin: 0 auto; padding: 0; border: 2px solid var(--ui-outline); border-radius: 4px; background: #fff; }
  .player-sprite-selector[hidden] { display: none; }
  .player-sprite-selector span { width: 0; height: 0; border-top: 7px solid transparent; border-bottom: 7px solid transparent; }
  .player-sprite-selector.previous span { border-right: 10px solid var(--ui-outline); }
  .player-sprite-selector.next span { border-left: 10px solid var(--ui-outline); }
  .profile-character-stage .player-sprite-selector { position: absolute; z-index: 2; top: 50%; margin: 0; transform: translateY(-50%); pointer-events: auto; }
  .profile-character-stage .player-sprite-selector.previous { left: 5px; }
  .profile-character-stage .player-sprite-selector.next { right: 5px; }
  .player-sprite-selector:active { transform: none; box-shadow: inset 0 0 0 999px rgba(0,0,0,.12); }
  .profile-tabs { display: flex; gap: 7px; margin: 8px 0 6px; border-bottom: 2px solid rgba(255,255,255,.13); }
  .profile-tab { display: grid; place-items: center; height: 44px; min-height: 44px; margin: 0 0 -2px; padding: 8px 12px; border: 0; border-bottom: 3px solid transparent; border-radius: 5px 5px 0 0; background: transparent; color: var(--muted); font-size: 10px; }
  .profile-tab.is-active { border-bottom-color: var(--green); color: #fff; }
  /* The Bonuses tab is your own profile's: hidden on anyone else's, which display: grid above would undo. */
  .profile-tab[hidden] { display: none; }
  .profile-loading { grid-area: 1 / 1; align-self: center; justify-self: center; padding: 8px; color: var(--muted); font-size: 11px; text-align: center; z-index: 1; }
  .profile-panel[hidden], .profile-loading[hidden] { display: none; }
  .player-profile-modal .profile-panel { min-height: 0; }
  /* The fixed outer window stays steady; only the selected tab contributes scroll content. */
  .profile-tab-panels { display: grid; }
  .profile-tab-panels.is-loading { min-height: 170px; }
  .profile-tab-panels.is-loading > .profile-panel { visibility: hidden; pointer-events: none; }
  .profile-tab-panels > .profile-panel { grid-area: 1 / 1; align-self: start; }
  .profile-tab-panels > .profile-panel[hidden] { display: none; }
  /* The profile's Bonuses tab (profile-bonus-toggles.ts): All Bonuses, then a dropdown a group with a switch a bonus. */
  .profile-bonuses-panel { display: grid; gap: 10px; padding: 10px 2px 4px; }
  .bonus-toggle-intro { margin: 0; color: #c9ced6; font-size: 13px; line-height: 1.4; }
  .bonus-toggle-groups { display: grid; gap: 8px; }
  .bonus-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .bonus-toggle-all, .bonus-toggle-group { border: 1px solid rgba(255,255,255,.1); border-radius: 10px; background: rgba(255,255,255,.04); }
  .bonus-toggle-all { padding: 10px 12px; border-color: rgba(255,255,255,.18); }
  .bonus-toggle-group-head { padding: 4px 12px 4px 4px; }
  .bonus-toggle-expand { display: flex; flex: 1 1 auto; align-items: center; gap: 8px; min-width: 0; min-height: 48px; margin: 0; padding: 6px 8px;
    border: 0; border-radius: 8px; background: transparent; box-shadow: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
  .bonus-toggle-expand:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
  .bonus-toggle-caret { flex: 0 0 auto; width: 8px; height: 8px; margin: 0 4px 0 2px; border: solid #a9b0ba; border-width: 0 2px 2px 0; transform: rotate(-45deg); transition: transform .18s ease; }
  .bonus-toggle-group.is-open .bonus-toggle-caret { transform: rotate(45deg); }
  .bonus-toggle-text { display: grid; gap: 3px; min-width: 0; }
  .bonus-toggle-label { color: #fff; font-size: 15px; font-weight: 800; }
  .bonus-toggle-item-label { color: #eef0f3; font-size: 14px; font-weight: 700; }
  .bonus-toggle-detail { color: #a9b0ba; font-size: 13px; line-height: 1.3; }
  .bonus-toggle-list { display: grid; gap: 6px; margin: 0; padding: 2px 12px 10px 30px; list-style: none; }
  .bonus-toggle-list[hidden] { display: none; }
  /* Single bonuses sit inset in their own darker rows, so they read as the group switch's parts. */
  .bonus-toggle-item { padding: 8px 10px 8px 14px; border-left: 2px solid rgba(255,255,255,.14); border-radius: 0 8px 8px 0; background: rgba(0,0,0,.28); }
  .bonus-toggle-status { min-height: 1.3em; margin: 0; color: #ffb347; font-size: 13px; }
  .bonus-toggle-status:empty { display: none; }
  /* A switch: a circle that slides along a pill. Grey and left when off, green and right when on, halfway when partly on. */
  .pill-switch { --pill-w: 52px; --pill-h: 30px; --knob: 24px; position: relative; flex: 0 0 auto; width: var(--pill-w); height: var(--pill-h); min-height: 0; margin: 0; padding: 0;
    border: 0; border-radius: 999px; background: #4a4d52; box-shadow: inset 0 1px 3px rgba(0,0,0,.45); cursor: pointer; transition: background-color .2s ease; }
  .pill-switch-knob { position: absolute; top: calc((var(--pill-h) - var(--knob)) / 2); left: calc((var(--pill-h) - var(--knob)) / 2); width: var(--knob); height: var(--knob);
    border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.4); transition: transform .22s cubic-bezier(.3,1.4,.5,1); }
  .pill-switch[aria-checked="true"] { background: var(--green); }
  .pill-switch[aria-checked="true"] .pill-switch-knob { transform: translateX(calc(var(--pill-w) - var(--pill-h))); }
  .pill-switch[aria-checked="mixed"] { background: linear-gradient(90deg, var(--green) 50%, #4a4d52 50%); }
  .pill-switch[aria-checked="mixed"] .pill-switch-knob { transform: translateX(calc((var(--pill-w) - var(--pill-h)) / 2)); }
  .pill-switch:active:not(:disabled) .pill-switch-knob { width: calc(var(--knob) + 4px); }
  .pill-switch[aria-checked="true"]:active:not(:disabled) .pill-switch-knob { transform: translateX(calc(var(--pill-w) - var(--pill-h) - 4px)); }
  .pill-switch:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
  .pill-switch:disabled { opacity: .45; cursor: default; }
  .bonus-toggle-item .pill-switch { --pill-w: 46px; --pill-h: 26px; --knob: 20px; }
  @media (prefers-reduced-motion: reduce) { .pill-switch, .pill-switch-knob, .bonus-toggle-caret { transition: none; } }
  #profileStatsPanel { height: auto; max-height: none; overflow: visible; }
  .profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; }
  .profile-grid > div { min-width: 0; padding: 8px; border: 1px solid rgba(255,255,255,.14); border-radius: 7px; background: rgba(0,0,0,.2); }
  #profileInfoPanel .profile-grid > div { background: transparent; border-color: transparent; }
  .profile-grid dt { color: var(--muted); font-size: 8px; letter-spacing: .07em; }
  .profile-grid dd { margin: 5px 0 0; color: #fff; font-size: 12px; overflow-wrap: anywhere; }
  /* The profile's Skills tab (profile-skills.ts): RuneScape-style 2-column skill grid + clickable Skill Guide dialog. */
  .profile-skills-panel { display: grid; gap: 8px; padding: 6px 2px 4px; }
  .profile-skills-summary { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 0 2px; }
  .profile-skills-total { color: #f2f5f7; font-size: 12px; font-weight: 800; letter-spacing: .02em; }
  .profile-skills-hint { color: #8f98a6; font-size: 11px; font-weight: 600; }
  .profile-skill-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .profile-skill { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: center; gap: 8px; width: 100%; min-width: 0; padding: 8px 9px; border: 0; border-radius: 9px; background: rgba(0,0,0,.32); color: inherit; text-align: left; text-transform: none; box-shadow: inset 0 1px 0 rgba(255,255,255,.05); cursor: pointer; transition: background-color 120ms ease, transform 120ms ease, box-shadow 120ms ease; }
  .profile-skill:hover { background: rgba(255,255,255,.09); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--skill-accent, #cfd6df) 45%, transparent); }
  .profile-skill:active { transform: translateY(1px); }
  .profile-skill:focus-visible { outline: 2px solid var(--skill-accent, #69e56f); outline-offset: -2px; }
  .profile-skill.is-unstarted { opacity: .78; }
  .profile-skill-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: color-mix(in srgb, var(--skill-accent, #cfd6df) 16%, rgba(0,0,0,.45)); color: var(--skill-accent, #cfd6df); flex: none; }
  .profile-skill-icon svg { width: 17px; height: 17px; display: block; }
  .profile-skill-body { display: grid; gap: 3px; min-width: 0; }
  .profile-skill-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; min-width: 0; }
  .profile-skill-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #f5f7fa; font-size: 12px; font-weight: 800; line-height: 1.15; }
  .profile-skill-level { flex: none; color: #fff; font-size: 12px; font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; }
  .profile-skill.is-unstarted .profile-skill-level { color: #8f98a6; font-size: 10px; font-weight: 700; }
  .profile-skill-meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; color: #9aa3b2; font-size: 10px; font-weight: 600; line-height: 1.15; font-variant-numeric: tabular-nums; }
  .profile-skill-meta > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .profile-skill-meta > span:last-child { flex: none; color: #c7d0dc; }
  .profile-skill-bar { display: block; height: 4px; margin-top: 1px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.12); }
  .profile-skill-bar > span { display: block; height: 100%; border-radius: 99px; background: var(--skill-accent, #e6e6e6); }
  .profile-skill-heading { margin: 0; color: #a9b0ba; font-size: 13px; font-weight: 800; }

  /* Skill Guide dialog (profile-skill-guide.ts): detailed XP, bonuses, category filters, and unlock milestones. */
  .skill-guide-dialog { padding: 0; -webkit-text-stroke: 0; text-shadow: none; font-family: var(--font-rounded); font-weight: 600; line-height: 1.35; }
  .skill-guide-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 14px 10px; background: linear-gradient(180deg, color-mix(in srgb, var(--skill-accent, #cfd6df) 14%, rgba(0,0,0,.2)), rgba(0,0,0,0)); }
  .skill-guide-identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
  .skill-guide-icon { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 10px; background: color-mix(in srgb, var(--skill-accent, #cfd6df) 20%, rgba(0,0,0,.5)); color: var(--skill-accent, #cfd6df); }
  .skill-guide-icon svg { width: 22px; height: 22px; display: block; }
  .skill-guide-title-wrap { min-width: 0; }
  .skill-guide-title { margin: 0; color: #fff; font-size: 18px; font-weight: 900; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .skill-guide-subtitle { margin-top: 2px; color: #9aa3b2; font-size: 11px; font-weight: 700; }
  .skill-guide-header-right { display: flex; align-items: center; gap: 8px; flex: none; }
  .skill-guide-level-pill { padding: 4px 9px; border-radius: 99px; background: color-mix(in srgb, var(--skill-accent, #cfd6df) 18%, rgba(0,0,0,.45)); color: #fff; font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .skill-guide-close { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 8px; background: rgba(255,255,255,.08); color: #d5dce6; font-size: 20px; font-weight: 700; line-height: 1; cursor: pointer; }
  .skill-guide-close:hover { background: rgba(255,255,255,.16); color: #fff; }
  .skill-guide-body { display: flex; flex-direction: column; gap: 10px; flex: 1 1 auto; min-height: 0; padding: 0 14px 10px; overflow: hidden; }
  .skill-guide-xp-card { display: grid; gap: 8px; padding: 10px; border-radius: 10px; background: rgba(0,0,0,.32); flex: none; }
  .skill-guide-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 6px; }
  .skill-guide-metric { display: grid; gap: 2px; padding: 6px 8px; border-radius: 7px; background: rgba(255,255,255,.04); min-width: 0; }
  .skill-guide-metric-label { color: #8f98a6; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
  .skill-guide-metric-value { color: #fff; font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .skill-guide-progress { display: grid; gap: 5px; }
  .skill-guide-bar { height: 7px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.12); }
  .skill-guide-bar-fill { display: block; height: 100%; border-radius: 99px; background: var(--skill-accent, #6be088); }
  .skill-guide-progress-caption { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; color: #b7c0ce; font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
  .skill-guide-progress-caption > span:last-child { color: #e2e8f0; text-align: right; }
  .skill-guide-next-note { color: #c7d0dc; font-size: 11px; font-weight: 700; }
  .skill-guide-overview { display: grid; gap: 7px; flex: none; }
  .skill-guide-summary { margin: 0; color: #b7c0ce; font-size: 12px; line-height: 1.38; }
  .skill-guide-bonuses { display: flex; flex-wrap: wrap; gap: 5px; }
  .skill-guide-bonus-chip { padding: 3px 8px; border-radius: 6px; background: rgba(255,255,255,.06); color: #e4ebf5; font-size: 11px; font-weight: 700; }
  .skill-guide-tabs { display: flex; flex-wrap: wrap; gap: 5px; flex: none; }
  .skill-guide-tabs[hidden] { display: none; }
  .skill-guide-tab { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border: 0; border-radius: 99px; background: rgba(255,255,255,.07); color: #b7c0ce; font-size: 11px; font-weight: 800; cursor: pointer; text-transform: none; }
  .skill-guide-tab:hover { background: rgba(255,255,255,.13); color: #fff; }
  .skill-guide-tab.is-active { background: color-mix(in srgb, var(--skill-accent, #6be088) 26%, rgba(0,0,0,.45)); color: #fff; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--skill-accent, #6be088) 55%, transparent); }
  .skill-guide-tab-count { padding: 0 5px; border-radius: 99px; background: rgba(0,0,0,.35); color: inherit; font-size: 10px; font-weight: 800; opacity: .88; }
  .skill-guide-list { display: grid; align-content: start; gap: 5px; flex: 1 1 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding-right: 2px; }
  .skill-guide-unlock { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 8px; background: rgba(0,0,0,.28); }
  .skill-guide-unlock.is-unlocked { background: rgba(114,239,88,.07); }
  .skill-guide-unlock.is-next { background: color-mix(in srgb, var(--skill-accent, #f5c258) 14%, rgba(0,0,0,.36)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--skill-accent, #f5c258) 42%, transparent); }
  .skill-guide-unlock.is-locked { opacity: .66; }
  .skill-guide-unlock-lvl { flex: 0 0 46px; padding: 3px 5px; border-radius: 6px; background: rgba(255,255,255,.08); color: #d5dce6; font-size: 11px; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; }
  .skill-guide-unlock.is-unlocked .skill-guide-unlock-lvl { background: rgba(114,239,88,.18); color: #8ef27a; }
  .skill-guide-unlock.is-next .skill-guide-unlock-lvl { background: color-mix(in srgb, var(--skill-accent, #f5c258) 28%, rgba(0,0,0,.4)); color: #fff; }
  .skill-guide-unlock-img { width: 26px; height: 26px; flex: none; object-fit: contain; image-rendering: auto; }
  .skill-guide-unlock-copy { display: grid; gap: 1px; flex: 1 1 auto; min-width: 0; }
  .skill-guide-unlock-top { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
  .skill-guide-unlock-name { color: #f6f8fb; font-size: 12px; font-weight: 800; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .skill-guide-unlock-tag { flex: none; padding: 1px 5px; border-radius: 4px; background: rgba(255,255,255,.07); color: #9aa3b2; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
  .skill-guide-unlock-detail { color: #9aa3b2; font-size: 11px; line-height: 1.28; }
  .skill-guide-unlock-status { flex: none; font-size: 11px; font-weight: 900; color: #72ef58; }
  .skill-guide-unlock.is-next .skill-guide-unlock-status { padding: 2px 6px; border-radius: 99px; background: rgba(255,255,255,.12); color: #fff; font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }
  .skill-guide-footer { flex: none; padding: 8px 14px 12px; }
  @media (max-width: 375px) {
    .profile-skill { grid-template-columns: 24px minmax(0, 1fr); gap: 6px; padding: 7px 7px; }
    .profile-skill-icon { width: 24px; height: 24px; }
    .profile-skill-icon svg { width: 15px; height: 15px; }
    .profile-skill-name, .profile-skill-level { font-size: 11px; }
  }
  /* Your own soul tier kills under Info, as the Soul Portal lists them. */
  .profile-soul-tier { display: grid; gap: 6px; margin-top: 12px; }
  .profile-soul-tier[hidden] { display: none; }
  .profile-soul-tier-note { margin: 0; color: #a9b0ba; font-size: 13px; line-height: 1.35; }
  #profileSoulTier .profile-grid > div { padding: 6px 8px; border-color: rgba(255,255,255,.1); background: rgba(0,0,0,.28); }
  #profileSoulTier .profile-grid dt { color: #a9b0ba; font-size: 13px; letter-spacing: 0; }
  #profileSoulTier .profile-grid dd { margin-top: 3px; font-size: 14px; }
  #profileSoulTier .profile-grid > .is-done dd::before { content: "\2713  "; }
  .profile-stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 0; overflow: hidden; border: 0; border-radius: 6px; background: transparent; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
  .profile-stat-column { display: block; min-width: 0; margin: 0; }
  .profile-stat-column:first-child { border-right: 0; }
  .profile-stat-column > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .7fr); grid-template-rows: minmax(20px, auto); column-gap: 6px; align-content: start; align-items: center; min-width: 0; min-height: 20px; padding: 0 8px; border: 0; border-bottom: 0; border-radius: 0; background: transparent; cursor: pointer; }
  .profile-stat-column > div.is-expanded { background: transparent; }
  .profile-stat-column > div:hover { background: transparent; }
  .profile-stat-column > div:focus-visible { z-index: 1; outline: 2px solid rgba(105,229,111,.8); outline-offset: -2px; }
  .profile-stat-column > div:last-child { border-bottom: 0; }
  .profile-stat-grid dt { grid-column: 1; grid-row: 1; font-size: 11px; letter-spacing: 0; text-align: right; white-space: normal; overflow-wrap: anywhere; }
  .profile-stat-grid dd { min-width: 0; margin: 0; color: #fff; font-size: 11px; line-height: 1.35; white-space: normal; overflow-wrap: anywhere; }
  .profile-stat-summary { grid-column: 2; grid-row: 1; display: flex; align-items: center; justify-content: flex-end; gap: 5px; }
  /* The same chevron the stat tracker uses, so a row reads as openable. */
  .profile-stat-summary::after { content: "\25B8"; flex: none; color: var(--muted); font-size: 10px; line-height: 1; }
  .profile-stat-column > div.is-expanded .profile-stat-summary::after { content: "\25BE"; }
  .profile-stat-base { grid-column: 1; min-width: 0; text-align: left; }
  .profile-stat-equation-operator { min-width: 0; color: var(--muted); text-align: center; }
  .profile-stat-multiply { grid-column: 2; }
  .profile-stat-multiplier { grid-column: 3; min-width: 0; color: #f2f4ee; text-align: center; }
  .profile-stat-equals { grid-column: 4; }
  .profile-stat-total-group { display: block; min-width: 0; }
  .profile-stat-total { min-width: 0; text-align: left; }
  .profile-stat-sources { grid-column: 1 / -1; grid-row: 2; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 7px; padding: 5px 0; border-top: 0; color: #d4ddd5; text-align: center; }
  .profile-stat-equation { display: flex; flex-wrap: wrap; flex-basis: 100%; justify-content: center; gap: 4px; }
  .profile-stat-sources[hidden] { display: none; }
  .profile-stat-source strong { color: #fff; }
  .profile-stat-source-operator { color: var(--muted); }
  .profile-stat-expanded-detail { color: #fff; }
  .profile-stat-source-empty { color: var(--muted); }
  .profile-stat-health dt { color: #72ef58; }
  .profile-stat-regen dt { color: var(--stat-regen); }
  .profile-stat-damage dt { color: #ff8b77; }
  .profile-stat-armor dt { color: var(--stat-armor); }
  .profile-stat-attack dt { color: #ffe05d; }
  .profile-stat-range dt { color: #74d8ff; }
  .profile-stat-speed dt { color: #bf9cff; }
  .profile-stat-stat-gain dt, .profile-stat-critical dt { color: #f3d36b; }
  .profile-stat-mining dt { color: #e3a46b; }
  .profile-stat-double-strike dt, .profile-stat-split-shot dt, .profile-stat-riposte dt { color: #f0c674; }
  /* Edit Profile (profile-editor.ts): over the profile window, under the picture picker it opens. */
  #profileNameEditor { position: fixed; inset: 0; z-index: 12; display: grid; place-items: center; padding: max(5px, env(safe-area-inset-top)) max(5px, env(safe-area-inset-right)) max(5px, env(safe-area-inset-bottom)) max(5px, env(safe-area-inset-left)); background: rgba(0,0,0,.45); }
  #profileNameEditor[hidden] { display: none; }
  .modal.profile-editor-modal { --window-back-bottom-gap: 9px; display: flex; flex-direction: column; width: var(--game-window-width); height: min(620px, 100%); max-height: 100%; padding: 12px 12px 0; overflow: hidden; border-color: var(--ui-outline); background: var(--window-surface); text-align: left; transform: none; }
  .profile-editor-title { flex: 0 0 auto; margin: 0 0 6px; font-size: 18px; text-align: center; }
  /* A centered stack spread down the window: each thing, then its white pencil beside it. */
  .profile-editor-scroll { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: space-evenly; gap: 14px; min-height: 0; padding: 10px 0 14px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
  .profile-editor-scroll::-webkit-scrollbar { display: none; }
  .profile-editor-item { display: grid; grid-template-columns: 42px minmax(0, 250px) 42px; justify-content: center; align-items: center; gap: 12px; }
  .profile-editor-item > :first-child { grid-column: 2; }
  .profile-editor-picture { justify-self: center; width: 104px; min-width: 104px; height: 104px; border-radius: 16px; cursor: pointer; }
  /* Only the name sits in a pill. */
  .profile-editor-name-pill { display: flex; align-items: center; min-width: 0; height: 46px; padding: 0 18px; border-radius: 23px; background: #0c0c0c; box-shadow: inset 0 0 0 1px rgba(255,255,255,.1); cursor: pointer; }
  .profile-editor-preview { display: flex; align-items: center; gap: 5px; min-width: 0; overflow: hidden; font-family: var(--player-name-font); font-size: 17px; font-weight: 900; line-height: 1.25; white-space: nowrap; }
  /* Name color, gender and skin tone: one quiet line each, a small square or symbol before the text. */
  .profile-editor-visual { display: flex; align-items: center; gap: 8px; justify-self: center; cursor: pointer; }
  .profile-editor-caption { color: var(--muted); font-size: 14px; font-weight: 900; white-space: nowrap; }
  .profile-editor-caption > span { color: var(--text); }
  .profile-editor-color-dot { width: 16px; height: 16px; border-radius: 4px; box-shadow: 0 0 0 2px var(--ui-outline); }
  .profile-editor-skin-swatch { width: 16px; height: 16px; border-radius: 4px; box-shadow: 0 0 0 2px var(--ui-outline); }
  .profile-editor-gender { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; font-weight: 900; }
  .profile-editor-gender .player-gender-icon { width: 16px; height: 18px; }
  .profile-editor-pencil { display: grid; place-items: center; width: 42px; min-width: 42px; height: 42px; margin: 0; padding: 0 0 3px; border: 2px solid var(--ui-outline); border-radius: 9px; background: #3a3d40; color: #fff; box-shadow: inset 0 -4px 0 rgba(0,0,0,.35); }
  .profile-editor-pencil svg { width: 20px; height: 20px; pointer-events: none; }
  .profile-editor-pencil:active { padding: 3px 0 0; box-shadow: inset 0 2px 0 rgba(0,0,0,.35); }
  /* Each picker opens in a window of its own over Edit Profile. */
  .profile-editor-picker-overlay { position: fixed; inset: 0; z-index: 1; display: grid; place-items: center; padding: 16px; background: rgba(0,0,0,.55); }
  .profile-editor-picker-overlay[hidden] { display: none; }
  .modal.profile-editor-picker-window { --window-back-bottom-gap: 9px; display: grid; gap: 16px; width: var(--game-window-width); max-height: 100%; padding: 16px 16px 0; overflow-y: auto; border-color: var(--ui-outline); background: var(--window-surface); text-align: left; transform: none; }
  .profile-editor-picker-window > [hidden] { display: none; }
  .profile-name-editor-note { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
  .profile-name-editor-controls { display: flex; gap: 8px; }
  #profileNameInput { flex: 1; width: 0; min-height: 44px; font-size: 16px; }
  #savePlayerNameBtn { min-width: 0; margin: 0; padding: 6px 14px; border-width: 2px; border-radius: 8px; font-size: 13px; line-height: 1; text-transform: none; white-space: nowrap; }
  .profile-name-color-choices { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; padding: 4px 6px; }
  .profile-name-color-choice { width: 100%; min-width: 0; height: auto; aspect-ratio: 1; margin: 0; padding: 0; border: 0; border-radius: 50%; background: var(--name-color); box-shadow: 0 0 0 2px var(--ui-outline); }
  .profile-name-color-choice.is-auto { border-radius: 14px; color: #111; font: 900 13px/1 var(--font-rounded, Arial), sans-serif; -webkit-text-stroke: 0; text-shadow: none; }
  .profile-name-color-choice[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--ui-outline), 0 0 0 5px #fff; }
  .profile-gender-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .profile-gender-choice { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-width: 0; min-height: 120px; margin: 0; padding: 12px; border: 0; border-radius: 14px; background: rgba(255,255,255,.06); color: var(--text); font-size: 15px; text-transform: none; box-shadow: none; }
  .profile-gender-choice img { width: 40px; height: 46px; object-fit: contain; pointer-events: none; }
  .profile-gender-choice[aria-pressed="true"] { background: rgba(78,205,82,.18); box-shadow: inset 0 0 0 2px var(--green); }
  .profile-skin-tone { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; padding: 4px 6px; }
  .profile-skin-tone-choice { width: 100%; min-width: 0; height: auto; aspect-ratio: 1; margin: 0; padding: 0; border: 0; border-radius: 12px; box-shadow: 0 0 0 2px var(--ui-outline); }
  .profile-skin-tone-choice[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--ui-outline), 0 0 0 5px #fff; }
  .profile-name-color-choice:disabled, .profile-gender-choice:disabled, .profile-skin-tone-choice:disabled { opacity: .6; }
  .modal.leaderboard-modal {
    --leaderboard-content-width: min(var(--window-content-max-width), 100%);
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
    grid-template-rows: auto auto auto auto minmax(0, 1fr) auto auto;
    width: 100%;
    height: 100%;
    max-height: none;
    padding: max(12px, env(safe-area-inset-top)) max(13px, env(safe-area-inset-right)) 0 max(13px, env(safe-area-inset-left));
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: var(--window-surface-gold);
    box-shadow: none;
    text-align: left;
  }

  #mapGuide {
    position: fixed;
    inset: 0 0 var(--window-bottom-inset);
    z-index: 12;
    display: block;
    overflow: hidden;
    background: var(--window-surface);
    color: var(--text);
    pointer-events: auto;
  }
  #mapGuide[hidden] { display: none; }
  .map-guide-window {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--window-surface-green);
    text-align: left;
  }
  /* Previous map, the map's name and place, next map: solid triangles either side. */
  .map-guide-header {
    z-index: 2;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    align-items: center;
    gap: 10px;
    min-height: 62px;
    padding: max(10px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right), calc((100% - 480px) / 2)) 10px max(14px, env(safe-area-inset-left), calc((100% - 480px) / 2));
    border-bottom: 2px solid rgba(255,255,255,.15);
    background: rgba(10,15,12,.94);
    box-shadow: 0 4px 12px rgba(0,0,0,.28);
  }
  .map-guide-heading { min-width: 0; text-align: center; }
  .map-guide-kicker { margin: 0 0 4px; color: #aebcaf; font-size: 13px; font-weight: 900; line-height: 1; }
  .map-guide-header h2 { margin: 0; overflow: hidden; color: #fff; font-size: clamp(20px, 4vw, 26px); line-height: 1.1; text-overflow: ellipsis; white-space: nowrap; }
  .map-guide-arrow { display: grid; place-items: center; width: 44px; height: 44px; margin: 0; padding: 0; border: 0; border-radius: 8px; background: rgba(255,255,255,.08); box-shadow: none; }
  .map-guide-arrow::before { width: 16px; height: 22px; background: #fff4d6; clip-path: polygon(100% 0, 0 50%, 100% 100%); content: ""; }
  .map-guide-arrow.is-next::before { clip-path: polygon(0 0, 100% 50%, 0 100%); }
  .map-guide-arrow:disabled { opacity: .22; cursor: default; }
  .map-guide-arrow:focus-visible { outline: 2px solid #fff4d6; outline-offset: 2px; }
  .map-guide-scroll { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; touch-action: pan-y; }
  .map-guide-scroll::-webkit-scrollbar { display: none; width: 0; }
  /* One phone-wide column on every screen: desktop shows the same window a phone does. */
  .map-guide-content { display: grid; gap: 15px; width: min(480px, 100%); margin: 0 auto; padding: 14px max(12px, env(safe-area-inset-right)) 18px max(12px, env(safe-area-inset-left)); }
  /* The Next Goal and the shown map's Travel button, neutral black and white. */
  .map-guide-goal { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid rgba(255,255,255,.16); border-radius: 8px; background: rgba(0,0,0,.38); }
  .map-guide-goal h3 { margin: 0; color: #bdbdbd; font-size: 13px; font-weight: 900; line-height: 1; }
  .map-guide-goal p { margin: 0; }
  .map-guide-goal p[hidden], .map-guide-travel[hidden] { display: none; }
  .map-guide-goal-text { color: #fff; font-size: 15px; font-weight: 800; line-height: 1.3; }
  .map-guide-goal-prestige, .map-guide-goal-power { color: #d6d6d6; font-size: 13px; font-weight: 700; line-height: 1.3; }
  .map-guide-travel { display: grid; gap: 6px; margin-top: 2px; }
  .map-guide-travel-button { width: 100%; height: 44px; min-height: 44px; margin: 0; padding: 0 10px; border: 2px solid var(--ui-outline); border-radius: 8px; background: #f2f2f2; box-shadow: 0 3px 0 var(--ui-outline); outline: var(--ui-seam); outline-offset: -1px; color: #111; font: 900 14px/1 var(--font-rounded); -webkit-text-stroke: 0; text-shadow: none; cursor: pointer; }
  .map-guide-travel-button:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--ui-outline); }
  .map-guide-travel-button:disabled { background: #3a3a3a; color: #a8a8a8; box-shadow: none; cursor: default; }
  .map-guide-travel-hint { color: #fff; font-size: 13px; font-weight: 700; line-height: 1.35; }
  .map-guide-map-frame {
    position: relative;
    justify-self: center;
    width: min(100%, 400px);
    aspect-ratio: 1;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: #1f1f1f;
    box-shadow: none;
    isolation: isolate;
  }
  canvas#mapGuideCanvas { position: absolute; inset: 0; z-index: 0; display: block; width: 100%; height: 100%; background: transparent; image-rendering: auto; pointer-events: none; }
  .map-guide-zone-labels { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
  .map-guide-zone-label,
  .map-guide-boss-label {
    position: absolute;
    left: calc(var(--map-x) * 100%);
    top: calc(var(--map-y) * 100%);
    max-width: min(124px, 29%);
    padding: 1px 2px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: #fff;
    font-size: clamp(10px, 2.4vw, 13px);
    line-height: 1.15;
    text-align: center;
    transform: translate(-50%, -50%);
    -webkit-text-stroke: .1em #000;
    paint-order: stroke fill;
    text-shadow: 1px 1px 0 #000;
  }
  .map-guide-zone-label strong { display: block; overflow: hidden; font-size: 1em; text-overflow: ellipsis; white-space: nowrap; }
  .map-guide-zone-rewards { display: block; margin: 0; font-size: .9em; font-weight: 900; white-space: normal; }
  .map-guide-boss-label { color: #ffad9d; white-space: nowrap; }
  .map-guide-zone-label.is-place { max-width: none; font-size: 13px; }
  .map-guide-boss-label.is-defeated { opacity: .55; }
  .map-guide-enemies { display: grid; gap: 8px; }
  .map-guide-enemies h3 { margin: 0; color: #fff; font-size: var(--font-readable-title); line-height: 1; }
  .map-guide-drops { display: grid; gap: 8px; }
  .map-guide-content > section[hidden] { display: none; }
  .map-guide-drops > header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
  .map-guide-drops h3 { margin: 0; color: #fff; font-size: var(--font-readable-title); line-height: 1; }
  .map-guide-drop-items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .map-guide-drop-card {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    min-width: 0;
    min-height: 82px;
    padding: 4px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  .map-guide-drop-art { display: grid; width: 58px; height: 58px; place-items: center; border: 0; border-radius: 0; background: transparent; }
  .map-guide-drop-art img { display: block; width: 50px; height: 50px; object-fit: contain; image-rendering: pixelated; }
  .map-guide-drop-card:is([data-item-id="starter_bow"], [data-item-id="iron_bow"], [data-item-id="frost_bow"], [data-item-id="lava_bow"], [data-item-id="fire_metal_bow"]) .map-guide-drop-art img { transform: rotate(-45deg); }
  .map-guide-drop-copy { display: grid; gap: 3px; min-width: 0; }
  .map-guide-drop-copy h4 { margin: 0; overflow: hidden; color: #fff; font-size: var(--font-readable-label); line-height: 1.1; text-overflow: ellipsis; white-space: nowrap; }
  .map-guide-drop-copy p { margin: 0; color: #c5cec7; font-size: var(--font-readable-min); line-height: 1.2; }
  .map-guide-drop-stats { display: flex; flex-wrap: wrap; gap: 2px 6px; color: #f3c86f; font-size: 12px; line-height: 1.2; }
  .map-guide-drop-chance { display: grid; gap: 3px; min-width: 78px; padding-left: 8px; border-left: 0; text-align: right; }
  .map-guide-drop-chance span { color: #aebcaf; font-size: 12px; white-space: nowrap; }
  .map-guide-drop-chance strong { color: #ffe19a; font-size: 14px; white-space: nowrap; }
  .map-guide-footer { z-index: 2; display: grid; place-items: center; min-height: 60px; padding: 7px max(14px, env(safe-area-inset-right)) var(--window-back-bottom-gap) max(14px, env(safe-area-inset-left)); border-top: 2px solid rgba(255,255,255,.13); background: rgba(8,13,10,.96); }

  @media (max-width: 680px) {
    .map-guide-header { min-height: 56px; padding-top: max(8px, env(safe-area-inset-top)); padding-bottom: 8px; }
    .map-guide-kicker { font-size: 12px; }
    .map-guide-header h2 { font-size: 20px; }
    .map-guide-content { gap: 12px; padding-top: 10px; }
    .map-guide-drop-card { grid-template-columns: 48px minmax(0, 1fr); min-height: 76px; gap: 7px; padding: 7px; }
    .map-guide-drop-art { width: 48px; height: 48px; }
    .map-guide-drop-art img, .map-guide-drop-art .item-art-image { width: 42px; height: 42px; }
    .map-guide-drop-chance { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; min-width: 0; padding: 5px 0 0; border-top: 0; border-left: 0; text-align: left; }
  }
  #leaderboard[data-stat="power"] .leaderboard-modal { background: var(--window-surface-gold); }
  #leaderboard[data-stat="damage"] .leaderboard-modal { background: var(--window-surface-red); }
  #leaderboard[data-stat="health"] .leaderboard-modal { background: var(--window-surface-green); }
  #leaderboard[data-stat="armor"] .leaderboard-modal { background: var(--window-surface-blue); }
  #leaderboard[data-stat="regen"] .leaderboard-modal { background: var(--window-surface-purple); }
  #leaderboard[data-stat="time"] .leaderboard-modal { background: var(--window-surface-neutral); }
  .leaderboard-scroll { width: var(--leaderboard-content-width); margin-inline: auto; min-width: 0; max-width: 100%; min-height: 0; overflow-y: auto; overflow-x: hidden; overflow-anchor: none; overscroll-behavior: contain; touch-action: pan-y; scrollbar-width: none; }
  .leaderboard-scroll::-webkit-scrollbar { display: none; }
  .leaderboard-scroll > *,
  .leaderboard-modal > .leaderboard-prestige,
  .leaderboard-modal > .leaderboard-tabs,
  .leaderboard-modal > .leaderboard-column-headings,
  .leaderboard-modal > .leaderboard-podium,
  .leaderboard-modal > .window-back-footer { min-width: 0; max-width: 100%; width: var(--leaderboard-content-width); margin-right: auto; margin-left: auto; }
  .leaderboard-tabs { margin-top: 9px; margin-bottom: 8px; }
  /*
   * Prestige switcher, under the list: one button naming the board on screen
   * with the viewer's rank beside it. It opens a list of every level upward,
   * over the rankings, that scrolls inside itself however many levels there
   * are. Black and grey throughout; the open control and its pick turn white.
   */
  .leaderboard-prestige { position: relative; margin-top: 7px; margin-bottom: 2px; }
  .leaderboard-prestige .leaderboard-prestige-heading {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    width: 100%; min-width: 0; min-height: 40px; margin: 0; padding: 6px 12px;
    border: 2px solid rgba(255,255,255,.18); border-radius: 12px;
    background: #0008; box-shadow: none;
    color: #fff; font: 900 var(--font-readable-min) var(--font-rounded); letter-spacing: .04em; line-height: 1.2;
    text-align: left; text-shadow: 0 1px 1px #000; cursor: pointer;
  }
  .leaderboard-prestige .leaderboard-prestige-heading:hover { border-color: rgba(255,255,255,.34); transform: none; }
  .leaderboard-prestige .leaderboard-prestige-heading:active { transform: none; }
  .leaderboard-prestige .leaderboard-prestige-heading[aria-expanded="true"] { border-color: rgba(255,255,255,.6); }
  .leaderboard-prestige .leaderboard-prestige-heading:focus-visible { outline: 1px solid rgba(255,255,255,.7); outline-offset: 1px; }
  .leaderboard-prestige-title { display: inline-flex; align-items: center; gap: 7px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* A caret that points up while the list is open above it. */
  .leaderboard-prestige-title::after {
    content: ""; flex: 0 0 auto; width: 0; height: 0;
    border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 6px solid #c3cbcf;
  }
  .leaderboard-prestige-heading[aria-expanded="true"] .leaderboard-prestige-title::after { border-top: 0; border-bottom: 6px solid #c3cbcf; }
  /* Only Time Played offers account ages; on the other boards the control just says where the viewer stands. */
  .leaderboard-prestige-heading[data-filter="off"] { cursor: default; }
  .leaderboard-prestige-heading[data-filter="off"] .leaderboard-prestige-title::after { display: none; }
  .leaderboard-prestige-rank { flex: 0 0 auto; color: #c3cbcf; white-space: nowrap; }
  .leaderboard-prestige-rank[hidden] { display: none; }
  .leaderboard-prestige-chips {
    position: absolute; z-index: 5; left: 0; right: 0; bottom: calc(100% + 6px);
    display: flex; flex-direction: column; gap: 4px; max-height: min(52vh, 320px); padding: 6px;
    overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y;
    border: 2px solid rgba(255,255,255,.18); border-radius: 12px;
    background: #161616; box-shadow: 0 8px 24px #000a;
    scrollbar-width: thin;
  }
  .leaderboard-prestige-chips[hidden] { display: none; }
  .leaderboard-prestige .leaderboard-prestige-chip {
    flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 8px;
    width: 100%; min-height: 38px; margin: 0; padding: 6px 12px;
    border: 2px solid transparent; border-radius: 9px;
    background: #ffffff0a; box-shadow: none;
    color: var(--muted); font: 900 var(--font-readable-min) var(--font-rounded); line-height: 1;
    text-align: left; white-space: nowrap; text-shadow: 0 1px 1px #000; cursor: pointer;
  }
  .leaderboard-prestige .leaderboard-prestige-chip:hover { color: #fff; background: #ffffff14; transform: none; }
  .leaderboard-prestige .leaderboard-prestige-chip:active { transform: none; }
  .leaderboard-prestige .leaderboard-prestige-chip.is-active {
    border-color: rgba(255,255,255,.6); background: rgba(255,255,255,.12); color: #fff;
  }
  .leaderboard-prestige .leaderboard-prestige-chip:focus-visible { outline: 1px solid rgba(255,255,255,.7); outline-offset: 1px; }
  /* The viewer's own level: a gold dot and the word, gold like first place. */
  /*
   * Landscape phones: stacked, the podium alone is taller than what is left
   * under the banner, and the list got no height at all. The podium, with the
   * switcher under it, takes the left half and the stat tabs and the list the
   * right.
   */
  @media (max-height: 480px) and (min-width: 640px) {
    .modal.leaderboard-modal {
      grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
      grid-template-rows: auto auto auto minmax(0, 1fr) auto;
      grid-template-areas: "banner banner" "podium tabs" "podium headings" "prestige list" "footer footer";
      column-gap: 14px;
    }
    .modal.leaderboard-modal > .window-banner { grid-area: banner; }
    .leaderboard-modal > .leaderboard-prestige { grid-area: prestige; align-self: end; margin: 0 0 2px; }
    .leaderboard-modal > .leaderboard-podium { grid-area: podium; align-self: start; }
    .leaderboard-modal > .leaderboard-tabs { grid-area: tabs; align-self: start; margin-top: 2px; }
    .leaderboard-modal > .leaderboard-column-headings { grid-area: headings; }
    .leaderboard-modal > .leaderboard-scroll { grid-area: list; }
    .leaderboard-modal > .window-back-footer { grid-area: footer; min-height: 52px; }
  }
  .leaderboard-scroll > .leaderboard-loading,
  .leaderboard-scroll > #leaderboardEmpty { min-height: 60px; }
  #leaderboardRivalsTab, .leaderboard-podium[data-stat="rivals"] { --leaderboard-tab-color: #ff8a6b; }
  #leaderboardPowerTab, .leaderboard-podium[data-stat="power"] { --leaderboard-tab-color: #ffe05d; }
  #leaderboardPrestigeTab, .leaderboard-podium[data-stat="prestige"] { --leaderboard-tab-color: #c79bff; }
  #leaderboardSkillsTab, .leaderboard-podium[data-stat^="skill:"] { --leaderboard-tab-color: #6ad3ff; }
  #leaderboardTimeTab, .leaderboard-podium[data-stat="time"], .leaderboard-podium[data-stat="created"] { --leaderboard-tab-color: #c3cbcf; }
  /* Reference stage is 460 × 200; container units keep its artwork and live players aligned. */
  /* A segmented bar: five tabs of one height, the open one lit in its board's colour. */
  .leaderboard-tabs.profile-tabs {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); max-width: 100%; gap: 3px; overflow: visible;
    padding: 3px; border: 1px solid rgba(255,255,255,.09); border-radius: 11px; background: rgba(255,255,255,.035);
  }
  .leaderboard-tabs .profile-tab {
    position: relative; display: flex; align-items: center; justify-content: center; gap: 5px;
    width: 100%; height: 36px; aspect-ratio: auto; min-width: 0; min-height: 0; margin: 0; padding: 0 5px;
    border: 0; border-radius: 8px;
    background: transparent; box-shadow: none; white-space: nowrap;
    color: #a5a599; opacity: 1; font-size: 12.5px; text-shadow: 0 1px 1px #000;
    transition: background-color .15s, color .15s;
  }
  .leaderboard-tabs .profile-tab::before { content: ""; flex: 0 0 15px; width: 15px; height: 15px; background: var(--leaderboard-tab-color); opacity: .75; mask: var(--leaderboard-stat-icon) center / contain no-repeat; }
  #leaderboardRivalsTab { --leaderboard-stat-icon: url("ui/leaderboard/rivals.aaea3c0135d89b21.svg"); }
  #leaderboardPowerTab { --leaderboard-stat-icon: url("ui/leaderboard/power.4d37254866b8b2b2.svg"); }
  #leaderboardPrestigeTab { --leaderboard-stat-icon: url("ui/leaderboard/prestige.cd8aa9665e26db2b.svg"); }
  #leaderboardSkillsTab { --leaderboard-stat-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='%23000' d='M10 1.5l2.4 5.2 5.6.7-4.1 3.9 1 5.6L10 14.2 5.1 16.9l1-5.6L2 7.4l5.6-.7z'/%3E%3C/svg%3E"); }
  #leaderboardTimeTab { --leaderboard-stat-icon: url("ui/leaderboard/time.4965f0a135592da7.svg"); }
  .leaderboard-tabs .profile-tab:hover { color: #e8e8dc; background: rgba(255,255,255,.04); transform: none; }
  .leaderboard-tabs .profile-tab.is-active {
    border: 0; opacity: 1; color: var(--leaderboard-tab-color);
    background: color-mix(in srgb, var(--leaderboard-tab-color) 15%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--leaderboard-tab-color) 42%, transparent);
  }
  .leaderboard-tabs .profile-tab.is-active::before { opacity: 1; }
  .leaderboard-tabs .profile-tab:focus-visible { outline: 1px solid rgba(255,255,255,.7); outline-offset: -2px; }
  /* Five labels fit a phone cleanly without their icons. */
  @media (max-width: 520px) { .leaderboard-tabs .profile-tab::before { display: none; } }
  .leaderboard-podium {
    container-type: inline-size; position: relative; display: grid;
    grid-template-columns: 26% 31% 28%; align-items: end; justify-content: center; gap: 2.4%;
    aspect-ratio: 460 / 218; min-height: 0; margin: 0 0 7px; padding: 0;
    overflow: hidden; border: 3px solid #060b06; border-radius: 8px;
    background: #365941 url("ui/leaderboard/forest-stage.daceac3e537db7f6.svg") center calc(50% + 4px) / 100% 100% no-repeat;
  }
  .leaderboard-podium[hidden] { display: none; }
  .leaderboard-podium-player {
    position: relative; top: 4px; z-index: 1; display: grid; grid-template-rows: 3.5cqw 4cqw 21cqw auto;
    align-items: end; width: 100%; min-width: 0; height: auto; min-height: 0;
    margin: 0 0 2cqw; padding: 0; overflow: visible; border: 0; border-radius: 0;
    background: transparent; box-shadow: none; color: #fff; text-align: center;
  }
  .leaderboard-podium-player:hover, .leaderboard-podium-player:focus-visible { transform: none; filter: none; }
  .leaderboard-podium-player:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
  .leaderboard-podium-player:active { transform: none; box-shadow: none; }
  .leaderboard-podium-player.is-empty .leaderboard-podium-value,
  .leaderboard-podium-player.is-empty .leaderboard-podium-name,
  .leaderboard-podium-player.is-empty .leaderboard-podium-canvas { visibility: hidden; }
  .leaderboard-podium-player.is-empty { opacity: 1; }
  .leaderboard-podium-value { position: relative; z-index: 2; display: block; min-width: 0; overflow: hidden; padding: 3px 2px calc(.6cqw + 3px); margin: -3px -2px; color: var(--leaderboard-tab-color); font-size: 2.6cqw; font-weight: 900; line-height: 1; white-space: nowrap; text-overflow: ellipsis; -webkit-text-stroke: 4px #000; paint-order: stroke fill; text-shadow: none; }
  .leaderboard-podium-name {
    position: relative; z-index: 2; display: flex; align-items: center; justify-content: center; gap: 2px;
    min-width: 0; margin-inline: -4cqw; overflow: visible; color: #fff; font-family: var(--player-name-font);
    font-size: 3.1cqw; line-height: 1; font-weight: 900; white-space: nowrap;
    -webkit-text-stroke: 4px #000; paint-order: stroke fill; text-shadow: none;
  }
  .leaderboard-podium-name-text { min-width: 0; padding: 3px; margin: -3px; overflow: hidden; text-overflow: ellipsis; }
  .leaderboard-podium-name .player-gender-icon { flex: 0 0 auto; width: 2.5cqw; height: 3cqw; }
  canvas.leaderboard-podium-canvas { position: relative; z-index: 1; top: 2px; right: auto; bottom: auto; left: auto; display: block; width: 100%; height: 21cqw; padding: 0; background: transparent; image-rendering: pixelated; pointer-events: none; }
  .leaderboard-podium-step {
    position: relative; display: grid; place-items: center; width: 100%; border: 2px solid var(--ui-outline);
    border-radius: 6px 6px 2px 2px; box-shadow: inset 0 3px 0 rgba(255,255,255,.32), inset 0 -4px 0 rgba(0,0,0,.16);
  }
  .leaderboard-podium-step::before { content: ""; position: absolute; inset: 0; background: var(--podium-laurel-color); mask: url("ui/leaderboard/laurels.015df0acdceff68e.svg") center 75% / 74% 140% no-repeat; pointer-events: none; }
  .leaderboard-podium-rank-label { position: relative; color: #fff; font-size: 5cqw; font-weight: 900; line-height: 1; -webkit-text-stroke: 2.5px #222; paint-order: stroke fill; text-shadow: 0 2px 0 #222; }
  .leaderboard-podium-rank-1 { grid-template-rows: 3.5cqw 4.5cqw 23cqw auto; }
  .leaderboard-podium-rank-1::before { content: ""; position: absolute; bottom: 12.5cqw; left: 0; width: 100%; aspect-ratio: 2; background: url("ui/leaderboard/champion-laurels.3e0be03421b77ec4.svg") center / contain no-repeat; pointer-events: none; }
  .leaderboard-podium-rank-1::after { content: ""; position: absolute; top: 13.5cqw; left: 5%; width: 90%; height: 6cqw; background: url("ui/leaderboard/champion-rays.824887b9e6e4dfed.svg") center / 100% 100% no-repeat; pointer-events: none; }
  .leaderboard-podium-rank-1 canvas.leaderboard-podium-canvas { height: 23cqw; }
  .leaderboard-podium-rank-1 .leaderboard-podium-name { font-size: 3.4cqw; }
  .leaderboard-podium-rank-1 .leaderboard-podium-rank-label { font-size: 6.7cqw; }
  .leaderboard-podium-rank-1 .leaderboard-podium-step { height: 12cqw; background: linear-gradient(#ffdf57, #dfb52f); --podium-laurel-color: #ae841b; }
  .leaderboard-podium-rank-2 .leaderboard-podium-step { height: 9cqw; background: linear-gradient(#d4dddc, #98a6a6); --podium-laurel-color: #e5ece8; }
  .leaderboard-podium-rank-3 .leaderboard-podium-step { height: 8.2cqw; background: linear-gradient(#b58769, #8d644d); --podium-laurel-color: #cfac8e; }
  .leaderboard-podium-rank-3 .leaderboard-podium-value,
  .leaderboard-podium-rank-3 .leaderboard-podium-name { transform: translateY(1.5cqw); }
  .leaderboard-column-headings { display: grid; grid-template-columns: 29px 25px minmax(0, 1fr) auto; gap: 7px; padding: 8px 8px 5px; color: var(--muted); font-size: 8px; letter-spacing: .08em; text-align: left; white-space: nowrap; }
  .leaderboard-column-headings > span:first-child { text-align: center; }
  .leaderboard-player-heading { grid-column: 3; }
  #leaderboardValueHeading { text-align: right; }
  .leaderboard-rows { position: relative; overflow-anchor: none; overscroll-behavior: contain; display: grid; align-content: start; gap: 0; height: auto; margin: 0; padding: 0; overflow: visible; background: transparent; list-style: none; }
  .leaderboard-rows[hidden] { display: none; }
  .leaderboard-loading { display: grid; place-items: center; height: auto; margin: 0; padding: 0; background: transparent; }
  .leaderboard-loading[hidden] { display: none; }
  .leaderboard-scroll > #leaderboardEmpty { display: grid; place-items: center; height: auto; padding: 0; background: transparent; }
  .leaderboard-scroll > #leaderboardEmpty[hidden] { display: none; }
  .leaderboard-spinner { width: 24px; height: 24px; border: 3px solid rgba(255,255,255,.22); border-top-color: var(--gold); border-radius: 50%; animation: leaderboard-spin .65s linear infinite; }
  @keyframes leaderboard-spin { to { transform: rotate(1turn); } }
  .leaderboard-row { display: grid; grid-template-columns: 29px 25px minmax(0, 1fr) auto; gap: 7px; align-items: center; min-height: 44px; padding: 4px 8px; border: 0; border-radius: 0; background: transparent; }
  canvas.leaderboard-profile-icon { position: static; inset: auto; display: block; width: 25px; height: 25px; padding: 0; border: 2px solid var(--ui-outline); border-radius: 4px; background: #fff; cursor: pointer; image-rendering: auto; }
  .leaderboard-row.is-local { background: transparent; }
  /* The row a search jumped to: a gold frame that pulses once, so the eye lands on it. */
  .leaderboard-row.is-search-hit { border-radius: 8px; background: rgba(255,212,90,.16); box-shadow: inset 0 0 0 2px rgba(255,212,90,.85); animation: leaderboard-search-hit 1.1s ease-out 1; }
  @keyframes leaderboard-search-hit { 0% { background: rgba(255,212,90,.5); } 100% { background: rgba(255,212,90,.16); } }
  @media (prefers-reduced-motion: reduce) { .leaderboard-row.is-search-hit { animation: none; } }
  .leaderboard-rank { color: var(--muted); font-size: 9px; text-align: center; }
  .leaderboard-row:nth-child(1) .leaderboard-rank { color: #ffe05d; }
  .leaderboard-row:nth-child(2) .leaderboard-rank { color: #dce6e8; }
  .leaderboard-row:nth-child(3) .leaderboard-rank { color: #e4a96a; }
  /* The left padding keeps the 2px outline of a leading "[" inside the clip; without it the bracket read as "(". */
  .leaderboard-name { display: flex; align-items: center; gap: 2px; min-width: 0; margin: 0; padding: 0 0 0 2px; overflow: hidden; border: 0; background: transparent; color: #fff; font-size: 10px; text-align: left; white-space: nowrap; cursor: pointer; }
  .leaderboard-name-text { min-width: 0; padding: 3px; margin: -3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* Explicit descendants override the global * text treatment on name spans. */
  .leaderboard-podium-name, .leaderboard-podium-name *,
  .leaderboard-name, .leaderboard-name * {
    -webkit-text-stroke: 4px #000; paint-order: stroke fill; text-shadow: none;
  }
  .leaderboard-name:hover, .leaderboard-name:focus-visible { color: var(--green); }
  .leaderboard-name:active { transform: none; }
  .leaderboard-guest { color: var(--muted); font-size: .82em; }
  .leaderboard-value { color: #fff; font-size: 10px; text-align: right; white-space: nowrap; }
  #leaderboard[data-stat="power"] #leaderboardValueHeading { color: #ffe05d; }
  #leaderboard[data-stat="damage"] .leaderboard-value, #leaderboard[data-stat="damage"] #leaderboardValueHeading { color: #ff7f70; }
  #leaderboard[data-stat="health"] .leaderboard-value, #leaderboard[data-stat="health"] #leaderboardValueHeading { color: #72ef58; }
  #leaderboard[data-stat="armor"] .leaderboard-value, #leaderboard[data-stat="armor"] #leaderboardValueHeading { color: var(--stat-armor); }
  #leaderboard[data-stat="regen"] .leaderboard-value, #leaderboard[data-stat="regen"] #leaderboardValueHeading { color: var(--stat-regen); }
  .dev-badge { color: var(--gold); }
  .developer-settings-row[hidden] { display: none; }
  .dev-audit-button { min-width: 112px; background: linear-gradient(#5b4a20, #332810); color: var(--gold); font-size: 12px; }
  .modal.dev-audit-modal { display: flex; flex-direction: column; width: var(--game-window-width); max-height: calc(100vh - var(--toolbar-height) - 20px); max-height: calc(100dvh - var(--toolbar-height) - 20px); min-height: 0; box-sizing: border-box; padding: 13px; overflow: hidden; text-align: left; }
  .dev-audit-tabs { display: flex; flex: 0 0 auto; min-width: 0; gap: 5px; margin: 3px 0 7px; overflow-x: auto; scrollbar-width: none; }
  .dev-audit-tabs::-webkit-scrollbar { display: none; }
  .dev-audit-tabs .profile-tab { flex: 1 1 0; min-width: max-content; }
  .dev-audit-modal > section[role="tabpanel"]:not([hidden]) { flex: 1 1 auto; min-width: 0; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .dev-audit-modal > section[role="tabpanel"]:not([hidden])::-webkit-scrollbar { display: none; }
  #devControlsPanel > *, #devPerformancePanel > * { min-width: 0; max-width: 100%; }
  .dev-presence-control > div { min-width: 0; }
  .dev-presence-control small { overflow-wrap: anywhere; }
  #devControlsPanel[hidden] { display: none; }
  #devPerformancePanel[hidden] { display: none; }
  .dev-performance-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; margin: 0; }
  .dev-performance-stats > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; align-items: center; min-height: 28px; padding: 4px 6px; border: 1px solid rgba(145,207,160,.2); border-radius: 4px; background: rgba(0,0,0,.22); }
  .dev-performance-stats dt { min-width: 0; color: var(--muted); font-size: 7px; letter-spacing: .06em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .dev-performance-stats dd { margin: 0; color: #b8f4be; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 9px; text-align: right; white-space: nowrap; }
  .dev-presence-control { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 54px; padding: 8px; border: 1px solid rgba(145,207,160,.24); border-radius: 5px; background: rgba(0,0,0,.22); }
  .dev-presence-control > div { display: grid; gap: 4px; }
  .dev-presence-control strong { color: var(--cream); font-size: 9px; }
  .dev-presence-control small { color: var(--muted); font-size: 7px; }
  .dev-presence-control button { flex: 0 0 auto; min-height: 32px; font-size: 8px; }
  .dev-load-test-control { flex-wrap: wrap; margin-top: 8px; }
  .dev-load-test-control > :first-child { min-width: 150px; }
  .dev-presence-control > .dev-load-test-actions { display: flex; grid-auto-flow: column; align-items: center; justify-content: flex-end; gap: 6px; }
  .dev-load-test-actions label { color: var(--muted); font-size: 7px; letter-spacing: .08em; }
  .dev-load-test-actions input { width: 66px; min-height: 32px; padding: 0 6px; border: 1px solid rgba(145,207,160,.32); border-radius: 4px; color: var(--cream); background: #171717; font: inherit; font-size: 8px; }
  .dev-load-test-actions input:disabled { opacity: .5; }
  .dev-audit-help { margin: 4px 0 9px; font-size: 8px; }
  .profile-duel-button { display: flex; align-items: center; justify-content: center; width: min(150px, 44vw); height: 44px; min-height: 44px; margin: 7px auto 0; padding: 0 8px 2px; border: 2px solid #18371b; border-radius: 8px; background: linear-gradient(#63ad5c, #347536); box-shadow: 0 3px 0 #18371b; color: #fff; font: 900 11px/1 var(--font-rounded); -webkit-text-stroke: var(--text-outline-width) #000; paint-order: stroke fill; text-shadow: var(--text-shadow); }
  .profile-duel-button.is-cooling-down { border-color: #2d2d2d; background: linear-gradient(#5d6a61, #3e3e3e); box-shadow: none; color: rgba(236,240,236,.62); cursor: not-allowed; }
  .profile-duel-button[hidden] { display: none; }
  /* Half the height and roughly half the width of the full-size pair they
     replaced: these are rarely used, and they live inside the INFO tab now. */
  .setting-support[hidden] { display: none; }
  .player-safety-dialog button, #blockedPlayersList button { min-height: 44px; font-size: 12px; }
  /* Another player's ⋯ menu: their name, then one action per row. */
  .profile-actions-menu { width: min(320px, calc(100vw - 32px)); box-sizing: border-box; padding: 0 0 4px; border: 0; border-radius: 10px; color: #fff; background: var(--window-surface-neutral); box-shadow: 0 20px 56px rgba(0,0,0,.72); overflow: hidden; }
  .profile-actions-menu::backdrop { background: rgba(0,0,0,.55); }
  .profile-actions-menu h2 { margin: 0; padding: 14px 16px 10px; border-bottom: 1px solid rgba(255,255,255,.09); font-family: var(--player-name-font); font-size: 15px; line-height: 1.2; overflow-wrap: anywhere; text-transform: none; }
  .profile-actions-menu .chat-message-action-button { padding-inline: 14px; }
  .profile-actions-menu .chat-message-action-button:last-child { border-bottom: 0; }
  .setting-support { display: grid; gap: 7px; padding: 12px 0; font-size: 12px; text-align: left; }
  .setting-support a, .player-safety-dialog a { color: #bce7ff; overflow-wrap: anywhere; }
  .setting-support small { font-size: 11px; line-height: 1.5; color: var(--muted); }
  .setting-support summary { cursor: pointer; min-height: 44px; align-content: center; }
  .community-links { gap: 10px; }
  .community-links .community-link {
    display: flex; align-items: center; gap: 12px; min-height: 64px;
    padding: 10px 14px; box-sizing: border-box; border: 1px solid #ffffff24;
    border-radius: 9px; background: #1d201f; color: #fff; text-decoration: none;
    transition: background .15s ease, border-color .15s ease;
  }
  .community-link-icon { display: grid; place-items: center; flex: 0 0 32px; }
  .community-link-icon svg { width: 28px; height: 28px; }
  .community-link--discord .community-link-icon { color: #8991ff; }
  .community-link--patreon .community-link-icon { color: #ff8b73; }
  .community-link-copy { display: grid; gap: 3px; min-width: 0; }
  .community-link-copy strong { font-size: 14px; line-height: 1.3; }
  .community-links .community-link-copy small { color: #babeba; font-size: 11px; }
  .community-link-arrow { margin-left: auto; color: #b9bdb9; font-size: 19px; }
  .community-links .community-link:hover, .community-links .community-link:focus-visible { background: #292d2b; border-color: #ffffff60; }
  .community-links .community-link:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
  #blockedPlayersList > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  #blockedPlayersList span { overflow-wrap: anywhere; min-width: 0; }
  .player-safety-dialog { width: min(420px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); box-sizing: border-box; padding: 18px; border: 0; border-radius: 10px; color: #fff; background: var(--window-surface-neutral); box-shadow: 0 20px 56px rgba(0,0,0,.72); font-size: 14px; }
  .player-safety-dialog::backdrop { background: rgba(0,0,0,.65); }
  .player-safety-dialog form { display: grid; gap: 12px; }
  .player-safety-dialog h2, .player-safety-dialog p { margin: 0; overflow-wrap: anywhere; }
  .player-safety-dialog label { display: grid; gap: 6px; }
  .player-safety-dialog label[hidden] { display: none; }
  .player-safety-dialog select, .player-safety-dialog textarea { width: 100%; box-sizing: border-box; padding: 10px; border: 1px solid #627466; border-radius: 4px; background: #151515; color: #fff; font: inherit; }
  .player-safety-dialog textarea { min-height: 90px; resize: vertical; }
  .player-safety-dialog footer { display: flex; justify-content: flex-end; gap: 8px; }
  .player-safety-dialog [role="status"] { color: #ffb9aa; }
  .signin-update-notice {
    position: fixed;
    z-index: 2;
    top: 50vh;
    top: 50lvh;
    left: 50%;
    width: min(400px, calc(100vw - 24px));
    margin: 0;
    padding: 16px 17px 18px;
    overflow: hidden;
    border: 1px solid rgba(220, 230, 222, .2);
    border-radius: 15px;
    background: var(--window-surface-neutral);
    box-shadow: 0 12px 30px rgba(0, 0, 0, .46), inset 0 1px 0 rgba(255, 255, 255, .08);
    text-align: left;
    transform: translate(-50%, -50%);
  }
  .signin-update-notice[hidden] { display: none; }
  .signin-update-notice header { padding: 0 1px 11px; border-bottom: 1px solid rgba(220, 230, 222, .2); }
  .signin-update-notice header strong { color: #fff; font-size: 11px; font-weight: 900; letter-spacing: .12em; }
  .signin-update-scroll {
    max-height: min(42svh, 300px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
  }
  .signin-update-scroll::-webkit-scrollbar { display: none; }
  .signin-update-history {
    display: grid;
    gap: 22px;
    margin: 13px 0 0;
    padding: 0;
    color: #e9eeea;
    font-size: 14px;
    line-height: 1.45;
    list-style: none;
  }
  /* A rule between versions. Run together the history read as one wall of
     text and there was no telling where a release ended. */
  .update-release { margin: 0; padding: 0; }
  .update-release + .update-release { padding-top: 22px; border-top: 1px solid rgba(255,255,255,.16); }
  .update-release-heading { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
  .update-release-heading strong { color: #fff; font-size: 13px; font-weight: 900; }
  .update-release-heading time { margin-left: auto; color: #c8d0ca; font-size: 10px; font-style: normal; letter-spacing: .06em; text-align: right; }
  .update-release ul { display: grid; gap: 5px; margin: 0; padding-left: 17px; }
  .update-release li::marker { color: #fff; }
  .chat-name { cursor: pointer; }
  .chat-name:hover { filter: brightness(1.2); }
  #duelReplay { position: fixed; inset: 0; z-index: 22; background: #42494b; }
  #duelReplay[hidden] { display: none; }
  #duelReplayHud { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 12px); right: var(--hud-safe-right); left: var(--hud-safe-left); display: flex; justify-content: center; color: #eef1ee; font: 900 11px/1.5 var(--font-rounded); letter-spacing: .08em; text-align: center; }
  #duelReplayTitle { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
  .duel-replay-player-name { display: inline-flex; align-items: center; gap: 3px; max-width: 100%; }
  #duelReplay > .window-back-footer { position: absolute; right: 0; bottom: 0; left: 0; padding-bottom: calc(env(safe-area-inset-bottom, 0px) + var(--window-back-bottom-gap)); pointer-events: auto; }
  body.is-replaying #hud { display: none; }
  body.is-replaying #duelReplay { display: block; background: transparent; pointer-events: none; }
  body.is-replaying #duelReplayHud { pointer-events: auto; z-index: 11; }
  .secondary-button {
    margin-left: 6px;
    background: linear-gradient(170deg, #676969 0%, #505d5e 52%, #425052 100%);
    box-shadow: inset 1px 2px 3px rgba(255, 255, 255, .42), 0 3px 0 var(--ui-outline), 0 7px 14px rgba(0, 0, 0, .28);
  }
  .chat-replay { display: inline-grid; place-items: center; width: 25px; min-width: 25px; height: 25px; margin: 0 0 0 3px; padding: 0; border: 0; border-radius: 4px; background: transparent; line-height: 1; vertical-align: middle; }
  .chat-replay-icon { width: 25px; height: 25px; background: center / contain no-repeat url("replay-play.7334faf3df564411.svg"); -webkit-text-stroke: 0; text-shadow: none; }

  @media (max-width: 520px) {
    .duel-stats { grid-template-columns: 1fr; }
  }

  @media (max-width: 600px), (pointer: coarse) {
    .modal.player-profile-modal { border-width: 2px; border-radius: 10px; }
    .player-profile-header { gap: 7px; }
    .profile-window-icon { width: 46px; min-width: 46px; height: 46px; border-radius: 6px; }
    .player-profile-title-row { gap: 7px; }
    .player-profile-header h2 { font-size: clamp(11px, 3.8vw, 16px); }
    .player-profile-presence { margin-top: 2px; font-size: 7px; line-height: 1.15; }
    .player-profile-challenge { font-size: 7px; line-height: 1.15; }
    .player-profile-modal .profile-tabs { margin: 8px 0 5px; }
    .player-profile-modal .profile-tab { padding: 5px 9px; font-size: 9px; }
    .player-profile-modal .profile-grid { gap: 4px; }
    .player-profile-modal .profile-grid > div { padding: 6px 4px; }
    .player-profile-modal .profile-grid dt { font-size: 7px; }
    .player-profile-modal .profile-grid dd { margin-top: 2px; font-size: 10px; }
    .player-profile-modal .profile-stat-grid { gap: 0; }
    .player-profile-modal .profile-stat-column > div { column-gap: 4px; min-height: 26px; padding: 0 4px; }
    .player-profile-modal .profile-stat-sources { gap: 5px; }
    .player-profile-modal .profile-stat-grid dt, .player-profile-modal .profile-stat-grid dd { margin: 0; font-size: 9px; }
    .modal.leaderboard-modal { padding: max(9px, env(safe-area-inset-top)) max(9px, env(safe-area-inset-right)) 0 max(9px, env(safe-area-inset-left)); }
    .leaderboard-tabs { margin: 4px 0 3px; }
    .leaderboard-prestige { margin: 5px auto 2px; }
    .leaderboard-prestige .leaderboard-prestige-heading { min-height: 36px; padding: 5px 10px; }
    .leaderboard-prestige .leaderboard-prestige-chip { min-height: 34px; padding: 5px 10px; }
    .leaderboard-tabs .profile-tab { padding: 0 4px; gap: 5px; font-size: 10px; }
    .leaderboard-podium { margin-bottom: 3px; }
    .leaderboard-column-headings { padding: 8px 7px 5px; font-size: 7px; }
    .leaderboard-rows { gap: 0; padding: 0; }
    .leaderboard-row { min-height: 44px; padding: 0 7px; }
    .leaderboard-rank { font-size: 8px; }
    .leaderboard-name, .leaderboard-value { font-size: 9px; }
    .modal.dev-audit-modal { padding: 9px; }
    .dev-audit-tabs .profile-tab { flex: 0 0 auto; }
  }

  @media (max-width: 420px) {
    .player-profile-title-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
  }

  .modal {
    width: min(620px, calc(100vw - 26px));
    background: var(--panel2);
    border: 0;
    border-radius: 14px;
    box-shadow: 0 20px 56px rgba(0,0,0,.72);
    padding: 20px;
    text-align: center;
  }

  #connectionPanel,
  #accountChoicePanel {
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  h1 {
    margin: 0 0 8px;
    font-size: clamp(28px, 7vw, 54px);
    line-height: .95;
    color: #ffe777;
    text-shadow: var(--text-shadow-large);
  }

  p {
    color: var(--muted);
    margin: 8px auto;
    max-width: 540px;
    line-height: 1.45;
  }

  button {
    pointer-events: auto;
    border: 4px solid #0a0a0a;
    border-radius: 10px;
    background: linear-gradient(#72ef58, #31bd34);
    color: white;
    font: 900 20px var(--font-rounded);
    padding: 12px 24px;
    margin-top: 12px;
    cursor: pointer;
    text-shadow: var(--text-shadow);
  }

  :fullscreen,
  :-webkit-full-screen {
    width: 100%;
    height: 100%;
    background: #000;
  }


  .key {
    display: inline-block;
    min-width: 24px;
    padding: 2px 5px;
    border: 1px solid #777;
    border-bottom-width: 3px;
    border-radius: 4px;
    background: #282d2a;
    color: #fff;
    text-align: center;
  }

  #joystick {
    display: block;
    pointer-events: none;
    position: fixed;
    left: 0;
    top: 0;
    width: 118px;
    height: 118px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,.25);
    background: rgba(0,0,0,.24);
    opacity: 0;
    transform: translate3d(-160px, -160px, 0);
    will-change: transform, opacity;
    contain: layout paint;
    z-index: 4;
  }

  #stick {
    position: absolute;
    left: 36px;
    top: 36px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255,255,255,.42);
    border: 2px solid var(--ui-outline);
    transform: translate3d(0, 0, 0);
    will-change: transform;
  }

  @media (pointer: coarse), (max-width: 800px) {
    .card {
      background: rgba(18, 18, 18, .96);
      -webkit-backdrop-filter: none;
      backdrop-filter: none;
    }
    .card { padding: 6px 8px; }
    .topbar { top: var(--hud-safe-top); right: var(--hud-safe-right); left: var(--hud-safe-left); }
    .player-hud-card { column-gap: 7px; padding: 6px 7px 6px 6px; background: var(--hud-surface); }
    .profile-icon-button { border-radius: 5px; }
    .player-summary { min-width: 0; gap: 5px; padding: 0 2px; }
    .bar { width: 100%; height: 100%; margin: 0; }
    #playerName, #playerPower { font-size: 11.25px; }
    #hpText { font-size: 10px; line-height: 11px; transform: translateY(-1px); }
    .settings-button { font-size: 25px; }
    .toolbar-icon { width: 28px; height: 28px; }
    #chatPanel {
      padding-bottom: 5px;
    }
  }

  /*
   * Readability guardrails for functional UI copy. Apple recommends 17pt body
   * text and an 11pt minimum on iOS; these selectors keep compact game labels
   * at that minimum while the semantic tokens above leave room for text scaling.
   */
  #musicVolumeValue,
  #sfxVolumeValue,
  .account-button,
  .account-status,
  .hud-progress-timer,
  .respawn-ad-countdown,
  #duelStatus,
  .item-drop-stats,
  #topMeta,
  .chat-header,
  #chatMessages,
  #chatPanel:not(.is-large) #topMeta,
  #chatPanel:not(.is-large) .chat-name,
  #chatPanel:not(.is-large) .chat-text,
  #chatPanel:not(.is-large) .chat-line.has-replay .chat-text,
  .chat-time,
  .signin-version,
  .tech-tree-active,
  .tech-tree-node strong,
  .tech-tree-detail-content span,
  .tech-tree-research-time span,
  .tech-tree-timer-label,
  .tech-tree-action,
  .player-profile-presence,
  .player-profile-challenge,
  .profile-tab,
  .profile-grid dt,
  .profile-stat-grid dt,
  .profile-stat-grid dd,
  .leaderboard-podium-name,
  .leaderboard-column-headings,
  .leaderboard-rank,
  .leaderboard-name,
  .leaderboard-guest,
  .leaderboard-value,
  .dev-audit-button,
  .dev-performance-stats dt,
  .dev-performance-stats dd,
  .dev-presence-control strong,
  .dev-presence-control small,
  .dev-presence-control button,
  .dev-load-test-actions label,
  .dev-load-test-actions input,
  .dev-audit-help,
  .profile-duel-button,
  .update-release-heading time,
  #playerProfilePower,
  #hpText,
  .player-profile-modal .profile-tab,
  .player-profile-modal .profile-grid dt,
  .player-profile-modal .profile-grid dd,
  .player-profile-modal .profile-stat-grid dt,
  .player-profile-modal .profile-stat-grid dd,
  .leaderboard-tabs .profile-tab {
    font-size: var(--font-readable-min);
  }
  /* HP reads at a glance: one size for every value, the largest at which the
     widest one, "888.8M / 888.8M", still fits the 146px phone bar. The id and
     class together outrank the readable-minimum rule above and the phone rule. */
  .bar #hpText { font-size: 17px; line-height: 1; letter-spacing: .02em; transform: none; white-space: nowrap; }
  /* Narrower bars (Samsung screen zoom leaves one about 100px wide) shrink the
     text with the bar instead of wrapping it: 11.6% of the width is the size
     at which "888.8M / 888.8M" still fits. */
  @supports (container-type: inline-size) {
    .player-hud-card .bar { container-type: inline-size; }
    .bar #hpText { font-size: min(17px, 11.6cqw); }
  }
  /* The card is drawn at --player-hud-scale but was laid out at full size, so
     on a phone its contents were squeezed while the shrunken card left a gap
     before the minimap. Lay it out at the size that fills its slot once scaled. */
  @media (max-width: 760px) {
    .player-hud-card { width: calc(100% / var(--player-hud-scale)); }
  }

  .loading-detail,
  .session-takeover-note {
    font-size: var(--font-readable-min) !important;
  }

  .item-inspection-copy p,
  .chat-text,
  .loading-detail,
  .session-takeover-note {
    line-height: var(--line-height-readable);
  }

  @media (prefers-contrast: more) {
    :root {
      --border: rgba(255,255,255,.34);
      --muted: #e0e8e1;
    }

    .card,
    .item-inspection-window {
      border-color: rgba(255,255,255,.38);
      background-color: rgba(5,9,7,.98);
    }

    /* A message stays a bubble: lighter than the chat behind it, outlined, never the same black. */
    #chatPanel.is-large .chat-text {
      border: 1px solid rgba(255,255,255,.42);
      background-color: #2c2f2c;
    }

    .card.inventory-panel,
    .card.settings-panel,
    #chatPanel.is-large,
    .modal.leaderboard-modal,
    .tech-tree-window {
      --inventory-muted: #e0e8e1;
      background: #050907;
      color: #fff;
    }
  }

/* Expanded chat channels share the existing chat history and composer. */
#chatPanel:not(.is-large) .chat-channels { display: none; }
#chatPanel.is-large { grid-template-rows: auto minmax(0, 1fr) auto; }
#chatPanel.is-large .chat-channels { grid-row: 1; min-width: 0; }
#chatPanel.is-large #chatMessages { grid-row: 2; }
#chatPanel.is-large #chatForm { grid-row: 3; }
.chat-history-row {
  display: grid; place-items: center; flex: 0 0 48px;
  width: 100%; overflow-anchor: none; pointer-events: none;
}
.chat-history-spinner, .profile-loading-spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 3px solid rgba(255,255,255,.25); border-top-color: #fff;
  border-radius: 50%; pointer-events: none;
  animation: chat-history-spin .8s linear infinite;
}
.chat-history-spinner[hidden] { display: none; }
@keyframes chat-history-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .chat-history-spinner, .profile-loading-spinner { animation: none; } }
.chat-channel-navigation { display: grid; grid-template-columns: minmax(0, 1fr) 44px; align-items: center; }
.chat-discord-link { display: grid; place-items: center; width: 44px; height: 44px; color: #5865f2; border-left: 1px solid rgba(255,255,255,.2); text-decoration: none; touch-action: manipulation; }
.chat-discord-link svg { width: 22px; height: 22px; overflow: visible; }
#chatPanel.is-large .chat-discord-link svg { animation: discord-open-hop .55s ease-in-out 2 both; }
@keyframes discord-open-hop {
  0%, 100% { transform: translateY(0); }
  40% { transform: translateY(-5px); }
  72% { transform: translateY(1px); }
}
@media (prefers-reduced-motion: reduce) {
  #chatPanel.is-large .chat-discord-link svg { animation: none; }
}
.chat-discord-link:hover { color: #7983f5; }
.chat-discord-link:focus-visible { outline: 1px solid #fff; outline-offset: -3px; }
.chat-channel-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
.chat-channel-tabs button { min-width: 0; min-height: 44px; margin: 0; padding: 8px 5px; border: 0; border-radius: 0; background: transparent; box-shadow: none; color: #fff; font-size: 13px; }
.chat-channel-label { position: relative; display: inline-block; }
.chat-channel-unread { bottom: calc(100% - 6px); left: calc(100% - 1px); white-space: nowrap; }
.chat-channel-unread[hidden] { display: none; }
.chat-channel-tabs button + button { border-left: 1px solid rgba(255,255,255,.2); }
.chat-channel-tabs button:hover, .chat-channel-tabs button:active { background: transparent; box-shadow: none; transform: none; }
.chat-channel-tabs button[aria-selected="true"] { background: rgba(255,255,255,.07); box-shadow: inset 0 -2px rgba(255,255,255,.35); }
.chat-channel-tabs button:focus-visible { outline: 1px solid #fff; outline-offset: -3px; }
.chat-private-picker { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px; margin-top: 6px; }
.chat-private-picker[hidden] { display: none; }
.chat-private-picker input { min-width: 0; min-height: 40px; padding: 7px; border: 1px solid #73667c; border-radius: 6px; background: #29252d; color: #fff; font-size: 14px; }
.chat-private-picker > button { min-height: 40px; margin: 0; font-size: 14px; border-color: #18371b; background: linear-gradient(#63ad5c, #347536); box-shadow: 0 3px 0 #18371b; }
/* Player search: the recipient field in private chat and the leaderboard's magnifier. Names come from one load and filter as they are typed. */
.player-search { position: relative; min-width: 0; }
.player-search-field { position: relative; display: flex; align-items: center; min-width: 0; }
.player-search-field[hidden] { display: none; }
.player-search-icon { position: absolute; left: 11px; width: 16px; height: 16px; color: #bdb3c6; pointer-events: none; }
.player-search-icon svg, .player-search-toggle svg { display: block; width: 100%; height: 100%; }
.player-search .player-search-input { width: 100%; min-width: 0; min-height: 40px; padding: 7px 10px 7px 34px; border: 1px solid #73667c; border-radius: 8px; background: #29252d; color: #fff; font: 700 14px var(--font-rounded); appearance: none; }
.player-search-input::-webkit-search-cancel-button { display: none; }
.player-search-input::placeholder { color: #a99fb2; }
.player-search-input:focus { outline: none; border-color: #fff; }
.player-search-results { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0; max-height: min(300px, 46vh); margin: 0; padding: 4px; overflow-y: auto; overscroll-behavior: contain; list-style: none; border: 0; border-radius: 10px; background: rgba(29,26,32,.98); box-shadow: 0 14px 30px rgba(0,0,0,.68); }
.player-search-results[hidden] { display: none; }
.player-search-option { display: flex; align-items: center; min-height: 40px; padding: 0 11px; border-radius: 7px; color: #fff; font: 800 14px var(--font-rounded); cursor: pointer; }
.player-search-option + .player-search-option { margin-top: 2px; }
.player-search-option:hover, .player-search-option[aria-selected="true"] { background: rgba(255,255,255,.11); }
.player-search-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-search-name mark { padding: 0; background: none; color: #ffd45a; }
.player-search-message { padding: 11px 10px; color: #bdb3c6; font: 700 13px var(--font-rounded); text-align: center; }
/* Lined up with the board's own edge: the screen margin on a phone, the centred column on a wide screen. */
.leaderboard-search { position: absolute; z-index: 6; top: max(12px, env(safe-area-inset-top)); right: max(13px, env(safe-area-inset-right), calc((100% - var(--window-content-max-width)) / 2)); display: flex; gap: 6px; }
.leaderboard-search.is-open { left: max(13px, env(safe-area-inset-left), calc((100% - var(--window-content-max-width)) / 2)); }
.leaderboard-search .player-search-field { flex: 1; order: -1; }
/* Landscape phones split the board into two columns as wide as the screen, so the corner is the board's corner. */
@media (max-height: 480px) and (min-width: 640px) {
  .leaderboard-search { top: max(9px, env(safe-area-inset-top)); right: max(13px, env(safe-area-inset-right)); }
  .leaderboard-search.is-open { left: auto; width: min(420px, calc(100% - 26px)); }
}
.leaderboard-search .player-search-results { right: 46px; }
.player-search .player-search-toggle { flex: none; display: grid; place-items: center; width: 40px; height: 40px; min-height: 0; margin: 0; padding: 9px; border: 2px solid rgba(255,255,255,.22); border-radius: 50%; background: rgba(0,0,0,.53); color: #fff; box-shadow: none; cursor: pointer; }
.player-search .player-search-toggle:hover { border-color: rgba(255,255,255,.42); transform: none; }
.player-search .player-search-toggle:active { transform: none; }
.player-search .player-search-toggle:focus-visible { outline: 1px solid rgba(255,255,255,.7); outline-offset: 1px; }
#chatPanel .chat-conversations[hidden], .chat-conversation-heading[hidden] { display: none; }
#chatPanel:not(.is-large) .chat-conversations { display: none; }
#chatPanel.is-large.is-private-inbox #chatMessages { display: none; }
#chatPanel.is-large.is-private-inbox #chatForm { grid-template-columns: 1fr; grid-template-rows: auto; grid-template-areas: "back"; }
#chatPanel.is-large.is-private-inbox #chatForm > :not(#chatBackBtn) { display: none; }
#chatPanel.is-large .chat-conversations { grid-row: 2; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.chat-conversation-row, .chat-conversation-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 52px; margin: 0; padding: 12px 8px; border: 0; border-radius: 0; background: transparent; box-shadow: none; color: #fff; text-align: left; font-size: 15px; }
.chat-conversation-row + .chat-conversation-row { border-top: 1px solid rgba(255,255,255,.15); }
.chat-conversation-content { display: grid; gap: 5px; flex: 1; min-width: 0; }
.chat-conversation-name, .chat-conversation-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-conversation-preview { color: #aaa; font-size: 12px; font-weight: 400; text-shadow: none; -webkit-text-stroke: 0; }
#chatPanel.is-large .chat-conversation-row .chat-conversation-portrait { display: block; flex: 0 0 42px; width: 42px; height: 42px; aspect-ratio: 1; }
.chat-conversation-heading { justify-content: center; font-weight: 700; }
.chat-conversation-unread { flex-shrink: 0; color: #bce7ff; font-size: 12px; }
.chat-conversation-row:hover, .chat-conversation-heading:hover { background: rgba(255,255,255,.04); box-shadow: none; }
.chat-conversations-empty { padding: 16px 8px; color: #aaa; font-size: 13px; }
.chat-channel-status { padding: 5px 2px 0; color: #d7d2ca; font-size: 11px; line-height: 1.3; }
/* A guild invitation at the top of the inviter's private conversation. */
.chat-guild-invites { display: grid; gap: 6px; margin-top: 6px; }
.chat-guild-invites[hidden] { display: none; }
.chat-guild-invite { display: grid; gap: 8px; padding: 10px; border: 1px solid rgba(255,255,255,.16); border-radius: 8px; background: rgba(0,0,0,.38); }
.chat-guild-invite p { margin: 0; color: #fff; font: 800 14px/1.3 var(--font-rounded); -webkit-text-stroke: 0; text-shadow: none; }
.chat-guild-invite-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.chat-guild-invite-actions button { min-height: 40px; margin: 0; padding: 0 10px; border: 2px solid var(--ui-outline); border-radius: 8px; background: #3a3a3a; box-shadow: 0 3px 0 var(--ui-outline); color: #fff; font: 900 14px/1 var(--font-rounded); -webkit-text-stroke: 0; text-shadow: none; }
.chat-guild-invite-actions button.is-primary { border-color: #18371b; background: linear-gradient(#63ad5c, #347536); box-shadow: 0 3px 0 #18371b; -webkit-text-stroke: initial; text-shadow: initial; }
.chat-guild-invite-actions button:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--ui-outline); }
.chat-guild-invite-actions button:disabled { opacity: .6; }
#chatForm { position: relative; }
#chatForm #chatLatestBtn { position: absolute; right: 4px; bottom: calc(100% + 6px); z-index: 2; display: grid; place-items: center; width: 44px; min-width: 44px; height: 36px; min-height: 36px; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; color: #fff; font: 22px/1 sans-serif; -webkit-text-stroke: 0; text-shadow: 0 1px 3px #000; }
#chatForm #chatLatestBtn[hidden] { display: none; }


  /* Shop shares the fullscreen game-window bounds. */
  .gem-shop {
    position: fixed;
    inset: 0 0 var(--window-bottom-inset);
    z-index: 12;
    width: 100%;
    height: calc(100% - var(--window-bottom-inset));
    max-width: none;
    max-height: none;
    margin: 0;
    padding: max(12px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left));
    border: 0;
    background: var(--window-surface-neutral);
    color: #f5f2f5;
    overflow: hidden;
    touch-action: pan-y;
  }
  .gem-shop-content { width: min(100%, 440px); height: 100%; min-height: 0; margin: auto; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 12px; }
  .gem-shop-scroll { min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 16px; scrollbar-width: none; }
  .gem-shop-scroll::-webkit-scrollbar { display: none; }
  .gem-shop-header { text-align: center; }
  .gem-shop-header h1 { margin: 0 0 8px; font-size: 28px; }
  .gem-shop-header p, .gem-shop-notice { margin: 0; color: #bfb7bf; font-size: 12px; line-height: 1.5; text-align: center; }
  .gem-shop-packs { display: grid; gap: 10px; }
  .gem-shop-pack { display: flex; align-items: center; gap: 14px; min-height: 82px; padding: 14px; background: #151315; border: 2px solid #302830; border-radius: 10px; }
  .gem-shop-pack > img { width: 42px; height: 42px; object-fit: contain; }
  .gem-shop-amount { flex: 1; display: flex; flex-direction: column; gap: 3px; }
  .gem-shop-amount strong { font-size: 23px; color: #ff9ed5; line-height: 1; }
  .gem-shop-amount span { font-size: 12px; color: #bfb7bf; }
  .gem-shop-pack button { visibility: hidden; min-width: 90px; min-height: 44px; padding: 8px 12px; border: 2px solid #302830; border-radius: 7px; background: #352431; color: #f5f2f5; font-size: 16px; }
  .gem-shop-pack button:disabled { opacity: 1; cursor: default; }
  .gem-shop-back { align-self: center; outline: none; -webkit-tap-highlight-color: transparent; }
  .gem-shop-back:focus-visible { filter: brightness(1.12); }
  @media (max-height: 600px) {
    .gem-shop-content { gap: 12px; }
    .gem-shop-pack { min-height: 64px; padding: 9px 12px; }
  }

  /* Game Elements skinny ribbons: reusable artwork with live, accessible text.
     Color treatment applies only to the art, leaving title text unaffected. */
  .window-banner.window-banner {
    --banner-art: url("ui/window-banners/ribbon-green.94869eea6497fe6e.webp");
    --banner-filter: none;
    --banner-width: min(300px, 64vw);
    position: relative;
    isolation: isolate;
    container-type: inline-size;
    display: grid;
    place-items: center;
    align-self: start;
    flex: 0 0 auto;
    width: var(--banner-width);
    height: calc(var(--banner-width) * 157 / 1055);
    min-height: 0;
    aspect-ratio: 1055 / 157;
    margin: 0 auto 8px;
    padding: 0;
    border: 0;
    color: #fff;
    font: 900 22px / 1.05 var(--font-rounded);
    letter-spacing: .06em;
    text-align: center;
    text-transform: none;
    -webkit-text-stroke: 4px #000;
    paint-order: stroke fill;
    text-shadow: none;
  }
  .window-banner::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--banner-art) center / 100% 100% no-repeat;
    filter: var(--banner-filter);
    pointer-events: none;
  }
  .window-banner > span {
    display: block;
    max-width: 64%;
    padding-bottom: 1.5%;
    font-size: 7.3cqw;
    white-space: nowrap;
    -webkit-text-stroke: 4px #000;
    paint-order: stroke fill;
    text-shadow: none;
  }
  .window-banner.window-banner--gold { --banner-art: url("ui/window-banners/ribbon-gold.30140c8383cf40d6.webp"); }
  .window-banner.window-banner--brown { --banner-art: url("ui/window-banners/ribbon-orange.d2906c7440a1893c.webp"); --banner-filter: grayscale(1) sepia(1) saturate(2.3018) hue-rotate(-15.872deg) brightness(0.3548); }
  .window-banner.window-banner--gray { --banner-filter: grayscale(1) brightness(.85); }
  .window-banner.window-banner--purple { --banner-filter: hue-rotate(205deg) saturate(.85); }
  .inventory-panel > .window-banner,
  .guild-window > .window-banner { margin-top: max(10px, env(safe-area-inset-top)); }
  .leaderboard-modal > .window-banner { grid-row: 1; }

  .window-banner.window-banner--blue { --banner-filter: hue-rotate(90deg) saturate(.85); }

/* Native Android only: a dismissible prompt, safely above the bottom toolbar. */
#androidUpdateBanner, #appUpdateReadyBanner { position: fixed; z-index: 100010; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 108px); transform: translateX(-50%); display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; width: max-content; max-width: calc(100vw - 32px); box-sizing: border-box; padding: 12px 14px; border: 2px solid #090e13; border-radius: 12px; background: #121b24; box-shadow: 0 4px 16px #0008; color: #fff; font-size: 15px; font-weight: 900; }
#androidUpdateBanner[hidden], #appUpdateReadyBanner[hidden] { display: none; }
#androidUpdateBanner button, #appUpdateReadyBanner button { min-width: 66px; min-height: 44px; padding: 8px 12px; border: 1px solid #416980; border-radius: 8px; background: #264e68; color: #fff; font: inherit; }
#androidUpdateBanner .android-update-later { border-color: transparent; background: transparent; }
#androidUpdateBanner button:disabled { opacity: .6; }

/* Developer item gifts share the gem reward animation and layout. */
.developer-item-gift .claim-card { border-color: #d9b86a; background: var(--window-surface-gold); box-shadow: 0 12px 0 var(--ui-outline), 0 0 30px rgba(219,177,79,.2); }
.developer-item-gift .claim-kicker { color: #f4d895; }
.developer-item-gift .claim-art::before { background: repeating-conic-gradient(from 0deg, rgba(255,217,130,.24) 0 7deg, transparent 7deg 22deg); }
.developer-item-gift .claim-art img { width: 96px; height: 96px; image-rendering: pixelated; }
.developer-item-gift .claim-card h2 { max-width: 270px; font-size: 23px; line-height: 1.15; margin-bottom: 8px; }

/* Private developer history: simple rows with expandable evidence. */
.dev-audit-tabs { overflow-x: auto; }
.dev-audit-tabs .profile-tab { flex-shrink: 0; }

.dev-analytics-dashboard { min-width: 0; }
.dev-analytics-cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; margin: 0 0 10px; }
.dev-analytics-cards > div { display: grid; gap: 3px; min-width: 0; padding: 7px 6px; border: 1px solid rgba(145,207,160,.2); border-radius: 4px; background: rgba(0,0,0,.22); }
.dev-analytics-cards span { color: var(--muted); font-size: 7px; letter-spacing: .06em; white-space: nowrap; }
.dev-analytics-cards strong { color: #b8f4be; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 13px; }
.dev-analytics-section { margin: 0 0 11px; overflow-x: auto; }
.dev-analytics-section h3 { margin: 0 0 5px; color: var(--muted); font-size: 8px; letter-spacing: .08em; }
.dev-analytics-table { width: 100%; border-collapse: collapse; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 8px; white-space: nowrap; }
.dev-analytics-table th, .dev-analytics-table td { padding: 4px 5px; border-bottom: 1px solid rgba(145,207,160,.12); text-align: right; }
.dev-analytics-table th:first-child, .dev-analytics-table td:first-child { text-align: left; }
.dev-analytics-table th { color: var(--muted); font-size: 7px; font-weight: 500; letter-spacing: .05em; }
.dev-analytics-table td { color: #d5f0d8; }
.dev-analytics-note { margin: 6px 0; color: #b8f4be; font-size: 8px; letter-spacing: .04em; }
.dev-analytics-error { color: #ff9b91; }
@media (max-width: 560px) { .dev-analytics-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.moderation-history-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.moderation-history-toolbar button { width: auto; min-height: 36px; margin: 0; padding: 6px 12px; border-width: 2px; border-radius: 8px; font-size: 12px; }
.moderation-history-rows { max-height: min(55dvh, 520px); overflow-y: auto; overscroll-behavior: contain; }
.moderation-history-entry { padding: 12px 2px; border-bottom: 1px solid #ffffff26; color: #fff; font-size: 12px; line-height: 1.5; }
.moderation-history-entry summary { cursor: pointer; }
.moderation-history-entry summary > * { display: block; overflow-wrap: anywhere; }
.moderation-history-meta { color: #b9bec5; font-size: 11px; white-space: pre-wrap; overflow-wrap: anywhere; }
.moderation-history-entry pre { font: inherit; white-space: pre-wrap; overflow-wrap: anywhere; margin: 4px 0 12px; }
.moderation-history-entry[open] summary { margin-bottom: 12px; }

.chat-line.is-original-message { background: rgba(255, 255, 255, .14); border-radius: 4px; }

  .onboarding-tutorial { position: fixed; inset: 0; z-index: 35; display: flex; flex-direction: column; justify-content: flex-start; color: #fff; padding: calc(max(18px, env(safe-area-inset-top)) + 40px) env(safe-area-inset-right) max(22px, env(safe-area-inset-bottom)) env(safe-area-inset-left); pointer-events: none; text-shadow: 0 2px 3px #102518, 1px 0 #102518, -1px 0 #102518; }
  .onboarding-tutorial header { display: grid; gap: 12px; padding: 12px 18px 18px; text-align: center; justify-items: center; }
  .onboarding-instruction { color: #fff; max-width: 620px; margin: 0; font-size: clamp(20px, 5vw, 28px); font-weight: 900; line-height: 1.2; }
  .onboarding-hint { color: #fff; max-width: 560px; margin: 0; font-size: 16px; font-weight: 700; line-height: 1.35; }
  .onboarding-tutorial button { pointer-events: auto; min-width: 100px; min-height: 44px; }
  .onboarding-tutorial .onboarding-skip-tutorial { position: absolute; left: 50%; bottom: max(10px, env(safe-area-inset-bottom)); transform: translateX(-50%); padding: 12px 16px; border: 0; border-radius: 0; background: none; box-shadow: none; color: #fff; font: 400 13px var(--font-rounded); text-shadow: inherit; cursor: pointer; }
  .onboarding-tutorial .onboarding-skip-tutorial:focus-visible { outline: 1px solid #fff; outline-offset: -6px; }
  .onboarding-tutorial button[hidden] { display: none; }
  .is-onboarding #hud { visibility: hidden; pointer-events: none; }
  .is-onboarding #pickupLog { visibility: visible; }
  @media (max-height: 480px) { .onboarding-tutorial header { padding-top: 0; gap: 4px; } .onboarding-instruction { font-size: 20px; } }
  .onboarding-progress { width: 76px; height: 3px; margin: 0 auto; border-radius: 3px; background: #ffffff35; overflow: hidden; }
  .onboarding-progress::before { content: ""; display: block; width: var(--lesson-progress, 25%); height: 100%; border-radius: inherit; background: #fff; transition: width .3s ease; }
  .is-onboarding #sceneFade { z-index: 36; }

  .onboarding-tutorial[hidden] { display: none; }
  .onboarding-name { position: fixed; inset: 0; z-index: 37; display: grid; align-items: center; justify-items: center; padding: max(24px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom)); background: #000; color: #fff; }
  .onboarding-name[hidden] { display: none; }
  .onboarding-name form { width: min(320px, 100%); display: grid; gap: 14px; text-align: center; }
  .onboarding-name label { font: 900 24px/1.2 var(--font-rounded); }
  .onboarding-name input { min-width: 0; width: 100%; min-height: 48px; padding: 12px; border: 1px solid #858585; border-radius: 6px; background: #181818; color: #fff; font-size: 18px; text-align: center; }
  .onboarding-name input:focus { outline: 2px solid #fff; outline-offset: 2px; }
  .onboarding-name p { margin: 0; color: #fff; font-size: 14px; }
  .onboarding-name p:empty { display: none; }
  .onboarding-name .onboarding-skip { min-height: 44px; border: 0; background: transparent; box-shadow: none; color: white; font-size: 16px; }

.leaderboard-page-loader { display: flex; align-items: center; justify-content: center; min-height: 40px; list-style: none; }
.leaderboard-page-loader .leaderboard-spinner { width: 18px; height: 18px; }
.leaderboard-page-loader button { border: 0; background: none; box-shadow: none; color: white; padding: 10px 16px; cursor: pointer; }

/* Compact reaction chips sit beneath the bubble without changing message layout. */
.chat-message-reaction-picker { grid-row: 3; display: flex; align-items: center; justify-content: space-around; gap: 8px; padding: 2px 4px 10px; }
.chat-message-reaction-picker button { width: 48px; height: 44px; padding: 0; border: 0; border-radius: 10px; background: transparent; box-shadow: none; font-size: 26px; line-height: 1; }
.chat-message-reaction-picker button img { display: block; width: 34px; height: 34px; margin: auto; object-fit: contain; }
.chat-message-reaction-picker button[aria-pressed="true"] { background: rgba(255,255,255,.16); }
.chat-message-reaction-picker button:disabled { opacity: .45; }
#chatPanel.is-large .chat-text.has-reactions { position: relative; overflow: visible; }
.chat-bubble-reactions { position: absolute; top: calc(100% + 4px); left: 2px; right: auto; display: flex; flex-direction: row; direction: ltr; align-items: center; gap: 3px; padding: 0; line-height: 1; white-space: nowrap; pointer-events: none; }
.chat-bubble-reaction { display: inline-flex; align-items: center; justify-content: center; gap: 1px; height: 19px; padding: 0 4px; border: 1px solid rgba(255,255,255,.4); border-radius: 3px; background: transparent; box-shadow: 0 0 3px .25px rgba(255,244,214,.45), 0 0 5px rgba(255,235,190,.2), inset 0 0 3px rgba(255,244,214,.18); box-sizing: border-box; font-size: 15px; -webkit-text-stroke: 0; text-shadow: none; }
.chat-bubble-reaction img { display: block; width: 16px; height: 16px; object-fit: contain; }
.chat-reaction-count { color: #fff; font-family: var(--player-name-font); font-size: 10px; font-weight: 900; line-height: 1; }

.profile-avatar-column { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 0 0 auto; }
.profile-heart-total { display: flex; align-items: center; justify-content: center; gap: 3px; color: #fff; font-size: 10.5px; font-weight: 900; line-height: 1; white-space: nowrap; }
.profile-heart-total > span:first-child { font-size: 11.25px; -webkit-text-stroke: 0; text-shadow: none; }

/* Match the ad reward timer; countdowns never take layout space. */
.scheduled-update {
  position: fixed; top: calc(env(safe-area-inset-top, 0px) + clamp(64px, 12vh, 112px)); left: 50%;
  transform: translateX(-50%); z-index: 100000; pointer-events: none;
  color: #72ef58; font: 900 var(--font-readable-min)/1.2 var(--font-rounded); letter-spacing: .025em;
  text-align: center; text-shadow: 1px 2px 0 #000; max-width: calc(100% - 24px);
  font-variant-numeric: tabular-nums;
}
.scheduled-update[hidden] { display: none; }
.scheduled-update > span { text-shadow: inherit; }


.player-visibility-toggle { position: relative; }
.player-visibility-countdown { position: absolute; right: 0; bottom: 0; font-size: 11px; line-height: 1; color: white; text-shadow: 0 1px 2px #000, 1px 0 2px #000; pointer-events: none; }
.player-visibility-idle { position: absolute; inset: 0; display: grid; place-items: center; color: #66ef7d; font-size: 11px; font-weight: 900; line-height: 1; text-shadow: 0 1px 1px #000, 1px 0 1px #000; pointer-events: none; }

/* Supporter artwork overlays portraits without changing their size or hit area. */
.avatar-frame-portrait { position: relative; }
.avatar-frame-portrait.profile-icon { --avatar-portrait-border: 2px; }
.avatar-frame-portrait.chat-profile-icon { --avatar-portrait-border: 1px; }
.avatar-frame-portrait[data-avatar-frame="gold"],
.avatar-frame-portrait[data-avatar-frame="silver"],
.avatar-frame-portrait[data-avatar-frame="diamond"],
#chatPanel.is-large .avatar-frame-portrait[data-avatar-frame="gold"],
#chatPanel.is-large .avatar-frame-portrait[data-avatar-frame="silver"],
#chatPanel.is-large .avatar-frame-portrait[data-avatar-frame="diamond"] {
  overflow: visible; border-color: transparent; border-radius: 10%;
}
/* Each frame's metal has to straddle the portrait edge, but the artwork carries
   a baked glow around it, and how much differs between the two. The overhang is how far
   past the portrait the image reaches on each side, measured per frame so the
   metal lands where the retired single frame's did. Recompute it if the art
   changes: overhang = (108.67% / metal span - 1) / 2. Compensate for the existing border
   without changing its box, grid track, spacing, or click target. */
.avatar-frame-portrait { --avatar-frame-overhang: 5.5%; }
.avatar-frame-portrait[data-avatar-frame="silver"] { --avatar-frame-overhang: 12.8%; }
.avatar-frame-portrait[data-avatar-frame="gold"] { --avatar-frame-overhang: 10.3%; }
.avatar-frame-portrait[data-avatar-frame="diamond"] { --avatar-frame-overhang: 12.5%; }
.avatar-frame-choices [data-frame="silver"] { --avatar-frame-overhang: 12.8%; }
.avatar-frame-choices [data-frame="gold"] { --avatar-frame-overhang: 10.3%; }
.avatar-frame-choices [data-frame="diamond"] { --avatar-frame-overhang: 12.5%; }
.avatar-frame-art {
  position: absolute;
  inset: calc(-1 * var(--avatar-frame-overhang) - var(--avatar-portrait-border, 0px));
  width: calc(100% + 2 * var(--avatar-frame-overhang) + 2 * var(--avatar-portrait-border, 0px));
  height: calc(100% + 2 * var(--avatar-frame-overhang) + 2 * var(--avatar-portrait-border, 0px));
  max-width: none; margin: 0; padding: 0; border: 0; object-fit: fill;
  pointer-events: none; z-index: 1;
}
[data-avatar-frame="gold"] > .avatar-frame-art,
.avatar-frame-summary[data-frame="gold"] img,
.avatar-frame-choices [data-frame="gold"] img { filter: drop-shadow(0 0 2px rgba(255, 201, 93, .32)); }
/* Chrome on its own washes out against the world's green and the window blue.
   A dark rim gives it an edge to sit on and the contrast brings the bevels
   back; the tint stays neutral so the blue reads as the tier above it. */
[data-avatar-frame="silver"] > .avatar-frame-art,
.avatar-frame-summary[data-frame="silver"] img,
.avatar-frame-choices [data-frame="silver"] img {
  filter: contrast(1.2) drop-shadow(0 0 1px rgba(6, 10, 16, .95)) drop-shadow(0 0 3px rgba(190, 222, 255, .45));
}
[data-avatar-frame="diamond"] > .avatar-frame-art,
.avatar-frame-summary[data-frame="diamond"] img,
.avatar-frame-choices [data-frame="diamond"] img { filter: drop-shadow(0 0 2px rgba(150, 214, 255, .55)); }
/* Mask the moving light on a child, then cast its halo from the outer layer.
   A filter on the masked child itself gets clipped to the artwork. */
[data-avatar-frame="gold"], .avatar-frame-choices [data-frame="gold"] { --avatar-glow-color: #ffe1a0; --avatar-glow-halo: rgba(255, 211, 117, .7); }
[data-avatar-frame="silver"], .avatar-frame-choices [data-frame="silver"] { --avatar-glow-color: #f5faff; --avatar-glow-halo: rgba(237, 246, 255, .8); }
[data-avatar-frame="diamond"], .avatar-frame-choices [data-frame="diamond"] { --avatar-glow-color: #d8f2ff; --avatar-glow-halo: rgba(126, 203, 255, .85); }
.avatar-frame-glow {
  position: absolute;
  inset: calc(-1 * var(--avatar-frame-overhang) - var(--avatar-portrait-border, 0px));
  width: calc(100% + 2 * var(--avatar-frame-overhang) + 2 * var(--avatar-portrait-border, 0px));
  height: calc(100% + 2 * var(--avatar-frame-overhang) + 2 * var(--avatar-portrait-border, 0px));
  display: block; overflow: visible;
  filter: drop-shadow(0 0 2px var(--avatar-glow-halo));
  pointer-events: none; z-index: 2;
}
.avatar-frame-glow-mask {
  display: block; position: absolute; inset: 0; overflow: hidden;
  -webkit-mask: center / 100% 100% no-repeat;
  mask: center / 100% 100% no-repeat;
}
[data-avatar-frame="gold"] .avatar-frame-glow-mask,
.avatar-frame-choices [data-frame="gold"] .avatar-frame-glow-mask {
  -webkit-mask-image: url("avatar-frames/patreon_gold.da243bef264b947f.webp");
  mask-image: url("avatar-frames/patreon_gold.da243bef264b947f.webp");
}
[data-avatar-frame="silver"] .avatar-frame-glow-mask,
.avatar-frame-choices [data-frame="silver"] .avatar-frame-glow-mask {
  -webkit-mask-image: url("avatar-frames/patreon_silver.67b4b530c499fda9.webp");
  mask-image: url("avatar-frames/patreon_silver.67b4b530c499fda9.webp");
}
[data-avatar-frame="diamond"] .avatar-frame-glow-mask,
.avatar-frame-choices [data-frame="diamond"] .avatar-frame-glow-mask {
  -webkit-mask-image: url("avatar-frames/patreon_diamond.4af2faae00d68df2.webp");
  mask-image: url("avatar-frames/patreon_diamond.4af2faae00d68df2.webp");
}
.avatar-frame-glow-mask::before {
  content: ""; display: block; position: absolute; inset: -25%;
  /* Two highlights, half a turn apart, so opposite sides of the frame catch the
     light at once. The second band is the first shifted back 180 degrees. */
  background: conic-gradient(
    transparent 0deg 75deg,
    var(--avatar-glow-color) 120deg,
    white 132deg 145deg,
    transparent 170deg 255deg,
    var(--avatar-glow-color) 300deg,
    white 312deg 325deg,
    transparent 350deg 360deg);
  opacity: .9;
  transform: rotate(0deg);
  animation: avatar-frame-glow-orbit 10s linear infinite;
}
.avatar-frame-choice-art > .avatar-frame-glow {
  inset: 0; width: 100%; height: 100%;
}
@keyframes avatar-frame-glow-orbit { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .avatar-frame-glow-mask::before { animation: none; }
}
.leaderboard-framed-portrait { display: block; width: 25px; height: 25px; }
.leaderboard-framed-portrait[data-avatar-frame="gold"] > canvas,
.leaderboard-framed-portrait[data-avatar-frame="silver"] > canvas { border-color: transparent; border-radius: 10%; }
.profile-icon-picker-modal { grid-template-rows: auto auto auto auto minmax(0, 1fr) auto; gap: 8px; height: min(680px, calc(100vh - 18px)); height: min(680px, calc(100dvh - 18px)); }
.profile-icon-picker-modal > .window-back-footer { grid-row: 6; }
.profile-icon-picker-modal > .profile-icon-choices { grid-row: 5; }
/* "Snapshot Character": a preview of the saved character (also Use Snapshot) beside the button that takes one. */
.profile-icon-snapshot { grid-row: 2; display: flex; align-items: center; gap: 12px; padding: 8px; border: 1px solid rgba(255,255,255,.13); border-radius: 8px; background: #111; }
.profile-icon-snapshot-preview { flex: 0 0 72px; width: 72px; height: 72px; cursor: pointer; }
.profile-icon-snapshot-preview:disabled { cursor: default; opacity: .55; }
.profile-icon-snapshot-preview:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.profile-icon-snapshot-copy { display: flex; flex: 1; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.profile-icon-snapshot-title { color: #fff; font: 900 15px/1.2 var(--font-rounded); }
.profile-icon-snapshot-note { color: #bdbdbd; font-size: 13px; line-height: 1.3; }
.profile-icon-snapshot-take { min-height: 34px; margin: 2px 0 0; padding: 0 14px; font-size: 14px; text-transform: none; white-space: nowrap; }
.profile-frame-options { grid-row: 1; min-height: 0; max-height: 35dvh; overflow-y: auto; }
.profile-frame-options > summary { min-height: 32px; display: list-item; cursor: pointer; color: #ddd; font-size: 13px; }
.avatar-frame-summary { display: inline-flex; align-items: center; gap: 5px; height: 22px; vertical-align: middle; font-size: 12px; color: #fff; }
.avatar-frame-summary img { width: 20px; height: 20px; object-fit: contain; }
.profile-frame-options .avatar-frame-picker > h3 { display: none; }
/* The backdrop behind the current picture: the autofarm window's segment. */
.profile-icon-background { grid-row: 3; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 38px; }
.profile-icon-background-label { color: #bdbdbd; font-size: 14px; }
.profile-icon-background-choice { display: flex; flex: 0 0 auto; overflow: hidden; border: 2px solid rgba(255,255,255,.13); border-radius: 8px; background: #000; }
.profile-icon-background-choice button { min-width: 68px; height: 34px; margin: 0; padding: 0 12px; border: 0; border-radius: 0; background: transparent; box-shadow: none; color: #bdbdbd; font: 900 14px/1 var(--font-rounded); text-shadow: none; text-transform: none; white-space: nowrap; cursor: pointer; }
.profile-icon-background-choice button + button { border-left: 1px solid rgba(255,255,255,.13); }
.profile-icon-background-choice button[aria-checked="true"] { background: #262626; color: #fff; box-shadow: inset 0 -2px var(--green); }
.profile-icon-background-choice button:active { transform: none; }
.profile-icon-background-choice button:disabled { cursor: default; }
.profile-icon-background-choice button:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
.profile-icon-tabs { grid-row: 4; display: flex; gap: 8px; }
.profile-icon-tabs button { flex: 1; margin: 0; min-height: 42px; padding: 8px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; box-shadow: none; color: #aeb5b1; font-size: 15px; text-transform: none; }
.profile-icon-tabs button[aria-selected="true"] { color: #fff; border-bottom-color: #fff; background: rgba(255,255,255,.04); }
.profile-icon-tabs button:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
.avatar-frame-picker { min-width: 0; }
.avatar-frame-picker h3 { margin: 0 0 6px; color: #fff; font-size: 14px; }
.avatar-frame-picker p { margin: 8px 0; color: #ccc; font-size: 11px; line-height: 1.3; }
.avatar-frame-choices { display: flex; justify-content: center; gap: 12px; }
.avatar-frame-choices button { display: grid; justify-items: center; gap: 4px; min-width: 64px; margin: 0; padding: 6px; border: 1px solid transparent; border-radius: 5px; background: transparent; box-shadow: none; color: #fff; font-size: 11px; }
.avatar-frame-choices button[aria-pressed="true"] { border-color: rgba(255,255,255,.65); }
.avatar-frame-choices button:disabled { opacity: .4; }
.avatar-frame-choice-art { position: relative; display: block; width: 48px; height: 48px; border-radius: 4px; background: rgba(255,255,255,.08); }
.avatar-frame-choice-art img { width: 100%; height: 100%; }
.avatar-frame-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.avatar-frame-controls button, .avatar-frame-controls a { min-height: 44px; margin: 0; padding: 6px 10px; border: 1px solid rgba(255,255,255,.25); border-radius: 5px; background: transparent; box-shadow: none; color: #fff; font-size: 11px; }
.patreon-support-help { margin-top: 12px; color: #ddd; font-size: 12px; }
.patreon-support-help summary { cursor: pointer; min-height: 32px; }
.patreon-support-form { display: grid; gap: 8px; }
.patreon-support-form label { display: grid; gap: 4px; }
.patreon-support-form input { width: 100%; min-width: 0; box-sizing: border-box; padding: 8px; font-size: 16px; border: 1px solid #666; border-radius: 5px; background: #171717; color: #fff; }
.patreon-support-form input[readonly] { color: #bbb; }
.patreon-support-form button, .shop-patreon-connect { min-height: 44px; padding: 8px 12px; border: 1px solid #777; border-radius: 5px; background: #222; color: #fff; box-shadow: none; font-size: 12px; }
.shop-patreon-connect { display: block; margin: 12px auto; }
.shop-patreon-status { text-align: center; color: #ddd; font-size: 12px; }
.shop-patreon-status:empty { display: none; }
.shop-patreon-button { display: flex; align-items: center; gap: 13px; min-height: 74px; padding: 14px 18px; margin: 0 0 18px; border: 1px solid #c589af; border-radius: 12px; background: linear-gradient(135deg, #502b47, #241d2c); box-shadow: inset 0 1px 0 #ffffff19, 0 3px 0 #09070c; color: #fff; text-decoration: none; text-align: left; }
.shop-patreon-button:hover { border-color: #f4c8e6; background: linear-gradient(135deg, #623655, #302436); }
.shop-patreon-button:focus-visible { outline: 2px solid white; outline-offset: 3px; }
.shop-patreon-button strong { display: block; font-size: 16px; line-height: 1.25; }
.shop-patreon-button small { display: block; margin-top: 4px; font-size: 12px; line-height: 1.4; color: #ead9e4; }
.shop-patreon-heart { font-size: 28px; color: #edc1dc; text-shadow: 0 0 12px #edc1dc40; }
.shop-patreon-arrow { margin-left: auto; font-size: 22px; color: #ead9e4; }
.shop-dev-note { display: grid; gap: 10px; padding: 16px 16px 18px; border: 1px solid #ffffff1f; border-radius: 12px; background: #ffffff08; color: #fff; text-align: left; }
.shop-dev-note h2 { margin: 0; color: #f0d7e7; font-size: 14px; letter-spacing: .04em; text-transform: uppercase; }
.shop-dev-note p { margin: 0; color: #e3e6ea; font-size: 14px; font-weight: 700; line-height: 1.45; -webkit-text-stroke: 0; text-shadow: none; }
.shop-dev-note .shop-dev-sign { color: #f0d7e7; font-weight: 900; }
.shop-dev-note .shop-perks-title { margin: 8px 0 0; color: #fff; font-size: 15px; }
.shop-perks { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.shop-perks li { display: grid; gap: 2px; color: #e3e6ea; font-size: 13px; font-weight: 700; line-height: 1.4; }
.shop-perks strong { color: #fff; font-size: 14px; font-weight: 900; }
/* Server Boost: what it does, the one running, and the supporter's Start button with its wait. */
.shop-server-boost { display: grid; gap: 8px; margin: 18px 0 0; padding: 14px 16px; border: 1px solid #ffffff1f; border-radius: 12px; background: #000000b3; color: #fff; text-align: left; }
.shop-server-boost h2 { margin: 0; color: #fff; font-size: 15px; }
.shop-server-boost p { margin: 0; color: #e3e6ea; font-size: 13px; font-weight: 700; line-height: 1.4; -webkit-text-stroke: 0; text-shadow: none; }
.shop-server-boost p:empty { display: none; }
.shop-server-boost .shop-server-boost-live { color: #fff; font-variant-numeric: tabular-nums; }
.shop-server-boost-start { justify-self: start; min-height: 44px; padding: 8px 16px; border: 1px solid #777; border-radius: 6px; background: #222; color: #fff; box-shadow: none; font-size: 14px; }
.shop-server-boost-start[hidden] { display: none; }
.shop-server-boost-start:disabled { opacity: .55; cursor: default; }
.shop-server-boost .shop-server-boost-note.is-error { color: #ffb0a6; }
.shop-frame-tiers { display: flex; justify-content: space-around; align-items: start; gap: 10px; margin-top: 8px; }
.shop-frame-tier { display: grid; justify-items: center; gap: 10px; }
.shop-frame-portrait { display: block; width: 64px; height: 64px; border-radius: 8px; background-color: #2a2f36; }
.shop-frame-name { color: #fff; font-size: 12px; font-weight: 900; }
.shop-frame-tier:nth-child(1) .shop-frame-name { color: #dfe8f2; }
.shop-frame-tier:nth-child(2) .shop-frame-name { color: #ffd77a; }
.shop-frame-tier:nth-child(3) .shop-frame-name { color: #9fdcff; }
.shop-diamond-look { position: static; inset: auto; display: block; width: 80px; height: 80px; background: transparent; }
.shop-diamond-look-name { color: #fff; font-size: 13px; font-weight: 900; text-align: center; line-height: 1.2; max-width: 96px; }

/* A clipped overlay above mini chat: no reserved space or hit target. */
.game-ticker { position: fixed; left: 0; right: 0; bottom: calc(var(--toolbar-height) + var(--mini-chat-height) + 2px); height: 20px; overflow: hidden; pointer-events: none; background: none; border: 0; }
.game-ticker[hidden], #chatPanel.is-large .game-ticker { display: none; }
.game-ticker-text { position: absolute; left: 100%; top: 2px; width: max-content; white-space: nowrap; color: #fff; font: 900 var(--mini-chat-font-size)/1.4 var(--player-name-font); -webkit-text-stroke: var(--text-outline-width) #000; paint-order: stroke fill; text-shadow: var(--text-shadow); will-change: transform; animation: game-tip-scroll var(--ticker-duration, 30s) linear; }
@keyframes game-tip-scroll { from { transform: translateX(0); } to { transform: translateX(calc(-100% - 100vw)); } }


.dev-player-travel { flex-wrap: wrap; gap: 8px; }
.dev-player-travel-actions { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
.dev-player-travel-actions input { flex: 1 1 150px; min-width: 0; min-height: 36px; padding: 6px 8px; border: 1px solid #565956; border-radius: 4px; color: var(--cream); background: #131413; font: inherit; }
.dev-player-travel-actions button { flex: 0 0 auto; }

/* The overlay and frame the duel result and profile windows use. */
.offline-progress-modal { width: var(--game-window-width); max-height: calc(100dvh - 40px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; border-color: rgba(198,208,210,.56); }
.offline-progress-modal::-webkit-scrollbar { display: none; }
/* A window taller than the screen starts at its top edge rather than overflowing above it. */
#offlineProgress { align-content: safe center; }
.offline-progress-modal h2 { margin: 0; color: #eef1ee; font-size: clamp(19px, 5vw, 28px); }
.offline-progress-lead { margin: 12px 0 0; color: #d8e4d4; font-size: 12px; line-height: 1.5; }
.offline-progress-stats { display: grid; gap: 6px; margin: 14px 0; }
.offline-progress-stats:empty { display: none; }
.offline-progress-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 8px; border: 1px solid rgba(255,255,255,.16); border-radius: 7px; background: rgba(0,0,0,.2); font-size: 11px; text-align: left; }
.offline-progress-stat-name { color: var(--offline-stat-color, var(--gold)); font-weight: 900; }
.offline-progress-stat-value { color: var(--offline-stat-color, #72ef58); font-weight: 900; text-align: right; font-variant-numeric: tabular-nums; }
/* The profile window's palette, so a stat reads the same colour everywhere. */
.offline-progress-row[data-stat-kind="health"] { --offline-stat-color: #72ef58; }
.offline-progress-row[data-stat-kind="damage"] { --offline-stat-color: #ff8b77; }
.offline-progress-row[data-stat-kind="armor"] { --offline-stat-color: var(--stat-armor); }
.offline-progress-row[data-stat-kind="regen"] { --offline-stat-color: var(--stat-regen); }
.offline-progress-row[data-stat-kind="attack"] { --offline-stat-color: #ffe05d; }
.offline-progress-note { margin: 14px 0; color: #9fa89b; font-size: 11px; line-height: 1.45; }
.offline-choices { display: grid; gap: 10px; margin: 14px 0 0; }
.offline-choices:empty { display: none; }
.offline-choice { border: 1px solid rgba(255,255,255,.16); border-radius: 8px; background: rgba(0,0,0,.25); text-align: left; }
.offline-choice-head { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 0; }
.offline-choice-toggle { display: grid; flex: 1; grid-template-columns: auto minmax(0, 1fr); align-items: baseline; column-gap: 8px; min-width: 0; min-height: 44px; margin: 0; padding: 4px 4px 4px 10px; border: 0; background: transparent; box-shadow: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.offline-choice-toggle:active { transform: none; }
.offline-choice-toggle:disabled { cursor: default; }
/* The same chevron the stat tracker and profile rows use, so the row reads as openable. */
.offline-choice-toggle::before { content: "\25B8"; grid-row: 1 / 3; align-self: center; color: var(--muted); font-size: 11px; }
.offline-choice.is-open .offline-choice-toggle::before { content: "\25BE"; }
.offline-choice-toggle:disabled::before { visibility: hidden; }
.offline-choice-title { color: #eef1ee; font-size: 15px; font-weight: 900; }
.offline-choice-detail { grid-column: 2; min-width: 0; color: #c9cfc9; font-size: 13px; white-space: pre-line; overflow-wrap: anywhere; }
.offline-choice .offline-progress-stats { gap: 0; margin: 0; padding: 0 10px 8px; border-top: 1px solid rgba(255,255,255,.1); }
.offline-choice .offline-progress-stats[hidden] { display: none; }
.offline-choice .offline-progress-row { padding: 3px 2px; border: 0; border-radius: 0; background: none; font-size: 13px; }
.offline-choice-collect { flex: none; width: auto; min-width: 88px; margin: 0; border-color: #18371b; background: linear-gradient(#63ad5c, #347536); box-shadow: 0 3px 0 #18371b; }
.offline-choice-collect:disabled { border-color: #2d2d2d; background: #3e3e3e; box-shadow: none; color: rgba(236,240,236,.62); }

/* The game's own yes/no prompt, in the frame every other window uses. It is
   always raised from another window, so it clears every one of them: the item
   inspector (15), the daily gem gift (18), the prestige window (13) and the
   tutorial (35). It stops below the reconnect overlay (40), the rewarded ad,
   game over and the update gate, which should cover a prompt rather than sit
   under one. */
#gameConfirm { position: fixed; inset: 0; z-index: 39; display: grid; place-items: center; padding: 13px; background: transparent; }
#gameConfirm[hidden] { display: none; }
.game-confirm-modal { width: min(340px, 100%); border-color: rgba(198,208,210,.56); }
.game-confirm-modal.is-danger { border-color: rgba(255,155,145,.66); }
.game-confirm-message { margin: 0; color: #eef1ee; font-size: 13px; line-height: 1.45; }
.game-confirm-details { display: grid; gap: 6px; margin: 14px 0 0; }
.game-confirm-details:empty { display: none; }
.game-confirm-detail { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 7px 8px; border: 1px solid rgba(255,255,255,.16); border-radius: 7px; background: rgba(0,0,0,.2); font-size: 11px; text-align: left; }
.game-confirm-detail-label { color: #d8e4d4; font-weight: 900; }
.game-confirm-detail-value { color: var(--confirm-detail-color, var(--gold)); font-weight: 900; text-align: right; font-variant-numeric: tabular-nums; }
.game-confirm-detail[data-detail-kind="cost"] { --confirm-detail-color: #ff9b91; }
.game-confirm-detail[data-detail-kind="balance"] { --confirm-detail-color: var(--gold); }
.game-confirm-detail[data-detail-kind="after"] { --confirm-detail-color: #72ef58; }
.game-confirm-actions { display: flex; justify-content: center; gap: 10px; margin: 16px 0 0; }
.game-confirm-actions .window-back-button { width: auto; min-width: 104px; flex: 0 1 auto; margin: 0; }
.game-confirm-cancel { border-color: #2d2d2d; background: linear-gradient(#5d6a61, #3e3e3e); box-shadow: 0 3px 0 #252525; }
/* The Back-button shape sets display, which would show a hidden Cancel as a blank button. */
.game-confirm-actions [hidden] { display: none; }
/* Going ahead is green; only a dangerous confirm turns it red, below. */
.game-confirm-accept { border-color: #18371b; background: linear-gradient(#63ad5c, #347536); box-shadow: 0 3px 0 #18371b; }
.game-confirm-modal.is-danger .game-confirm-accept { border-color: #4a1414; background: linear-gradient(#d9544a, #8f2b25); box-shadow: 0 3px 0 #3d1512; }

.dev-offline-progress { flex-wrap: wrap; gap: 8px; }
.dev-offline-progress-actions { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
.dev-offline-progress-actions input { flex: 1 1 100px; min-width: 0; min-height: 36px; padding: 6px 8px; border: 1px solid #565956; border-radius: 4px; color: var(--cream); background: #131413; font: inherit; }
.dev-offline-progress-actions button { flex: 0 0 auto; }

/* Developer triage: reports, bugs and player lookup. The pending queue is the
   first thing on screen; everything wraps inside the window at 375px wide and
   scrolls inside its tab at 375px tall, with no sideways page scroll. */
.dev-access-gate { margin: 18px 4px; color: #d8e4d4; font-size: 12px; line-height: 1.5; text-align: center; }
.dev-access-gate[hidden], .dev-audit-tabs[hidden], .dev-review-panel[hidden] { display: none; }
#devAudit .dev-audit-modal:has(.dev-review-panel:not([hidden])) { width: min(560px, calc(100vw - 26px)); }
.dev-review-panel { display: grid; align-content: start; gap: 8px; min-width: 0; color: #eef1ee; font-size: 12px; line-height: 1.4; }
.dev-review-panel > * { min-width: 0; }
.dev-review-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.dev-review-filter { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; color: #d8e4d4; font-weight: 900; cursor: pointer; }
.dev-review-filter input { width: 20px; height: 20px; margin: 0; accent-color: var(--green); }
.dev-review-count { flex: 1 1 auto; min-width: 0; color: var(--muted); font-size: 11px; }
.dev-review-toolbar .dev-review-refresh { flex: 0 0 auto; width: auto; min-height: 36px; margin: 0; padding: 6px 12px; border-width: 2px; border-radius: 8px; font-size: 12px; }
.dev-review-status { margin: 0; color: var(--muted); font-size: 12px; }
.dev-review-status:empty { display: none; }
.dev-review-list { display: grid; gap: 8px; min-width: 0; }
.dev-review-card { display: grid; gap: 7px; min-width: 0; padding: 10px; border: 1px solid rgba(145,207,160,.24); border-radius: 7px; background: rgba(0,0,0,.24); overflow-wrap: anywhere; }
.dev-review-card[data-status="open"] { border-color: rgba(255,216,91,.5); }
.dev-review-card.is-busy { opacity: .6; pointer-events: none; }
.dev-review-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 8px; font-size: 11px; }
.dev-review-card-head time { margin-left: auto; color: var(--muted); }
.dev-review-pill { padding: 2px 7px; border-radius: 999px; background: #333a3f; color: #c9d1d6; font-size: 10px; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
.dev-review-pill[data-status="open"] { background: #6b5316; color: #ffe07a; }
.dev-review-pill[data-status="resolved"] { background: #1f4a26; color: #9ff29b; }
.dev-review-channel { color: #b9d6ff; font-weight: 900; }
.dev-review-who { margin: 0; color: #d8e4d4; }
.dev-review-who strong { color: #fff; }
.dev-review-text { display: block; box-sizing: border-box; width: 100%; min-height: 36px; margin: 0; padding: 8px; border: 1px solid rgba(255,255,255,.14); border-radius: 6px; background: rgba(0,0,0,.3); box-shadow: none; color: #fff; font: 500 13px/1.4 var(--font-rounded); text-align: left; text-shadow: none; white-space: pre-wrap; overflow-wrap: anywhere; cursor: pointer; }
.dev-review-text > span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.dev-review-text.is-expanded > span { display: block; -webkit-line-clamp: unset; overflow: visible; }
.dev-review-flag { margin: 0; color: #9ff29b; font-size: 11px; }
.dev-review-where { margin: 0; color: #b9d6ff; font-size: 11px; }
.dev-review-note-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 10px; }
.dev-review-mail { font-size: 12px; white-space: nowrap; }
@media (max-width: 420px) { .dev-review-note-row { grid-template-columns: minmax(0, 1fr); } }
.dev-review-text-block { display: grid; gap: 6px; min-width: 0; }
.dev-review-context { display: grid; gap: 4px; margin: 0; padding: 6px 8px; border-left: 2px solid rgba(185,214,255,.35); list-style: none; color: #c9d1d6; font-size: 12px; line-height: 1.35; overflow-wrap: anywhere; }
.dev-review-context[hidden] { display: none; }
.dev-review-context li.is-reported { color: #fff; font-weight: 900; }
.dev-review-context strong { color: #b9d6ff; }
.dev-review-context time { color: var(--muted); font-size: 10px; font-weight: 500; }
.dev-review-decisions { display: grid; gap: 3px; margin: 0; padding: 0 0 0 16px; color: var(--muted); font-size: 11px; }
.dev-review-note, .dev-player-search input { box-sizing: border-box; width: 100%; min-width: 0; min-height: 40px; padding: 6px 9px; border: 1px solid rgba(145,207,160,.32); border-radius: 6px; background: #171717; color: var(--cream); font: 13px var(--font-rounded); }
.dev-review-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 6px; }
.dev-review-action { min-width: 0; min-height: 40px; margin: 0; padding: 6px 8px; border-width: 2px; border-radius: 8px; font-size: 12px; line-height: 1.15; }
.dev-review-action.is-plain { background: linear-gradient(170deg, #676969 0%, #505d5e 52%, #425052 100%); }
.dev-review-action.is-danger { border-color: #4a1414; background: linear-gradient(#d9544a, #8f2b25); }
.dev-review-action:disabled { opacity: .45; cursor: default; }
.dev-review-ban-choices { padding-top: 7px; border-top: 1px dashed rgba(255,155,145,.45); }
.dev-player-search { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.dev-player-search .dev-review-action { padding: 6px 14px; }
.dev-player-results { display: grid; gap: 6px; }
.dev-player-results:empty { display: none; }
.dev-player-result { display: grid; gap: 2px; box-sizing: border-box; width: 100%; min-height: 44px; margin: 0; padding: 7px 10px; border: 1px solid rgba(145,207,160,.24); border-radius: 7px; background: rgba(0,0,0,.24); box-shadow: none; color: #fff; font-size: 13px; text-align: left; text-shadow: none; }
.dev-player-result span { color: var(--muted); font-size: 11px; font-weight: 500; }
.dev-player-card { display: grid; gap: 7px; min-width: 0; padding: 10px; border: 1px solid rgba(255,216,91,.4); border-radius: 7px; background: rgba(0,0,0,.28); }
.dev-player-card[hidden] { display: none; }
.dev-player-card h3 { margin: 0; color: #fff; font-size: 16px; overflow-wrap: anywhere; }
.dev-player-card h4 { margin: 4px 0 0; color: var(--muted); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.dev-player-state { margin: 0; font-weight: 900; }
.dev-player-state[data-tone="warn"] { color: #ff9b91; }
.dev-player-state[data-tone="ok"] { color: #9ff29b; }
.dev-player-history { max-height: none; overflow: visible; }
@media (max-width: 420px) {
  .dev-review-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-height: 480px) {
  .modal.dev-audit-modal { padding: 8px; }
  .dev-audit-tabs .profile-tab { height: 38px; min-height: 38px; padding: 4px 10px; }
}
/* Moderation console: headline counts, Muted/Banned rows, the player card and log filters. */
.dev-overview { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 2px 0 6px; }
.dev-overview[hidden] { display: none; }
.dev-overview-chip { display: grid; justify-items: center; gap: 1px; min-width: 0; min-height: 44px; margin: 0; padding: 4px 2px; border: 1px solid rgba(145,207,160,.24); border-radius: 7px; background: rgba(0,0,0,.24); box-shadow: none; color: var(--muted); font-size: 10px; font-weight: 900; line-height: 1.1; text-shadow: none; }
.dev-overview-chip strong { color: #d8e4d4; font-size: 16px; }
.dev-overview-chip[data-active="true"] { border-color: rgba(255,216,91,.5); }
.dev-overview-chip[data-active="true"] strong { color: #ffe07a; }
.dev-console-name { min-width: 0; color: #fff; font-size: 13px; overflow-wrap: anywhere; }
.dev-player-facts { display: grid; gap: 3px; margin: 0; font-size: 12px; }
.dev-player-facts > div { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 8px; }
.dev-player-facts dt { color: var(--muted); }
.dev-player-facts dd { margin: 0; color: #eef1ee; overflow-wrap: anywhere; }
.dev-review-actions > input { grid-column: 1 / -1; }
.dev-review-actions > .dev-player-custom { grid-column: auto; }
.dev-player-chat summary { min-height: 36px; padding: 8px 0; color: #b9d6ff; font-weight: 900; cursor: pointer; }
.dev-log-filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px; margin-bottom: 8px; }
.dev-log-filters > input[type="search"] { grid-column: 1 / -1; }
.dev-log-filters select { appearance: auto; }
@media (max-width: 420px) {
  .dev-overview-chip { font-size: 9px; }
  .dev-player-facts > div { grid-template-columns: 80px minmax(0, 1fr); }
}
#devModerationPanel .moderation-history-rows + button { min-height: 36px; margin: 8px 0 0; padding: 6px 12px; border-width: 2px; border-radius: 8px; font-size: 12px; }
@media (max-height: 480px) {
  .dev-overview { margin: 0 0 4px; }
  .dev-overview-chip { grid-auto-flow: column; align-items: center; justify-content: center; gap: 5px; min-height: 36px; }
  .dev-overview-chip strong { font-size: 13px; }
}

.inventory-lock-toggle { display:flex; flex:0 0 auto; align-items:center; justify-content:center; width:34px; min-width:34px; height:30px; min-height:30px; margin:0; padding:0; border:2px solid #173f66; border-radius:6px; background:linear-gradient(#52a5e5,#286496); color:#fff; box-shadow:0 2px 0 #12314f; }
.inventory-lock-toggle[aria-pressed="true"] { background:#73c3ff; outline:2px solid #b9e3ff; }
.inventory-lock-toggle[hidden] { display:none; }
.equipment-lock-badge { position:absolute; left:3px; bottom:20px; z-index:3; color:#79c9ff; pointer-events:none; filter:drop-shadow(0 1px 1px #000); }
.equipment-lock-badge svg { width:13px; height:13px; }
.is-lock-mode [data-item-id] { cursor:pointer; }
.is-lock-mode .is-equipment-locked { outline:2px solid #79c9ff; }

.player-identity { font-family: var(--player-name-font); font-weight: 900; line-height: 1.25; }

/* Guild chat keeps membership requests beside the conversation. */
.chat-guild-tabs { display: flex; gap: 0; width: calc((100% - 44px) * 2 / 3); margin-left: calc((100% - 44px) / 6); padding: 0; }
.chat-guild-tabs button { flex: 1; min-width: 0; min-height: 40px; margin: 0; padding: 6px 1px; font-size: 11px; background: transparent; box-shadow: none; border: 0; border-bottom: 2px solid transparent; color: #fff; }
.chat-guild-tabs button[aria-selected="true"] { border-bottom-color: #d7c7eb; }
.chat-guild-tabs[hidden], .chat-guild-requests[hidden] { display: none; }
#chatPanel.is-large .chat-guild-requests { grid-row: 2; min-height: 0; overflow-y: auto; scrollbar-width: none; padding: 8px; }
#chatPanel.is-large .chat-guild-requests[hidden] { display: none; }
#chatPanel.is-large.is-guild-requests #chatMessages { display: none; }
#chatPanel.is-large.is-guild-requests #chatForm { grid-template-columns: 1fr; grid-template-rows: auto; grid-template-areas: "back"; }
#chatPanel.is-large.is-guild-requests #chatForm > :not(#chatBackBtn) { display: none; }
.guild-request-heading { display: flex; align-items: center; justify-content: space-between; }
.guild-request-heading h3 { margin: 0; font-size: 16px; }
.guild-request-card { max-width: 600px; margin: 12px auto; padding: 12px; border: 1px solid #ffffff25; border-radius: 8px; background: #ffffff08; }
.guild-request-card .guild-member-profile { width: 100%; margin: 0; padding: 0; min-height: 44px; }
.guild-request-card .guild-member-name { display: flex; align-items: center; gap: 4px; }
.guild-request-card p { color: #bdb7c4; font-size: 12px; }
.guild-request-card label { display: grid; gap: 6px; font-size: 12px; }
.guild-request-card textarea { width: 100%; min-height: 60px; resize: vertical; box-sizing: border-box; background: #0003; border: 1px solid #ffffff30; border-radius: 6px; padding: 8px; color: #fff; font: inherit; }
.guild-request-card .guild-request-actions { margin: 10px 0 0; }
.guild-request-actions button { min-height: 44px; margin: 0; }
.chat-guild-requests .guild-requests-refresh { display: grid; place-items: center; flex: 0 0 36px; width: 36px; height: 36px; min-width: 36px; min-height: 36px; margin: 0; padding: 0; border: 0; border-radius: 6px; background: transparent; box-shadow: none; color: #fff; font: 24px/1 sans-serif; -webkit-text-stroke: 0; }
.guild-request-actions button { flex: 1; }

.guild-request-card .guild-request-online { color: #65d66d; }
.guild-request-online::before, .guild-request-offline::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: currentColor; vertical-align: 1px; }

.guild-request-actions .window-back-button { width: auto; min-width: 0; margin: 0; }
.guild-request-actions .guild-request-accept { border-color: #18371b; background: linear-gradient(#63ad5c, #347536); box-shadow: 0 3px 0 #18371b; }
.guild-request-actions .guild-request-deny { border-color: #594515; background: linear-gradient(#e0bd55, #ac812c); box-shadow: 0 3px 0 #594515; }

.chat-conversation-heading[role="button"] { cursor: pointer; }
.chat-conversation-heading[role="button"]:focus-visible,
.chat-conversation-portrait[role="button"]:focus-visible { outline: 2px solid #ece7d2; outline-offset: 3px; }

/* Map name under the minimap, above the online count and version. */
.minimap-map-name {
  color: #fff;
  font: 800 var(--font-readable-min)/1.2 var(--font-rounded);
  text-align: center;
  overflow-wrap: anywhere;
  text-shadow: 1px 2px 0 #000;
}
/* Firefox draws -webkit-text-stroke on the CPU, redrawing every outlined label
   and the icons beside it whenever something near them changes. There
   (src/ui/text-outline-mode.ts) the outline is a ring of text shadows at half
   the stroke's width, the part paint-order: stroke fill leaves visible, which
   the GPU draws. Rules with their own literal stroke get their own ring. */
html.text-outline-shadow {
  --text-outline-ring: .04em 0 0 #000, -.04em 0 0 #000, 0 .04em 0 #000, 0 -.04em 0 #000, .028em .028em 0 #000, -.028em .028em 0 #000, .028em -.028em 0 #000, -.028em -.028em 0 #000;
  --text-shadow: var(--text-outline-ring), .06em .10em 0 #000;
  --text-shadow-large: var(--text-outline-ring), .06em .10em 0 #000;
}
html.text-outline-shadow * { -webkit-text-stroke-width: 0 !important; }
html.text-outline-shadow :is(.chat-reply-prefix, .chat-guild-requests .guild-requests-refresh) { text-shadow: .06em .10em 0 #000; }
html.text-outline-shadow :is(.item-tier-label, .inventory-upgrade-level) { text-shadow: 1px 0 0 #080b08, -1px 0 0 #080b08, 0 1px 0 #080b08, 0 -1px 0 #080b08, .7px .7px 0 #080b08, -.7px .7px 0 #080b08, .7px -.7px 0 #080b08, -.7px -.7px 0 #080b08; }
html.text-outline-shadow :is(.item-drop-name, .item-drop-stats) { text-shadow: .045em 0 0 #000, -.045em 0 0 #000, 0 .045em 0 #000, 0 -.045em 0 #000, .032em .032em 0 #000, -.032em .032em 0 #000, .032em -.032em 0 #000, -.032em -.032em 0 #000, .06em .11em 0 #000; }
html.text-outline-shadow .death-screen h1 { text-shadow: .045em 0 0 #000, -.045em 0 0 #000, 0 .045em 0 #000, 0 -.045em 0 #000, .032em .032em 0 #000, -.032em .032em 0 #000, .032em -.032em 0 #000, -.032em -.032em 0 #000; }
html.text-outline-shadow :is(.map-guide-zone-label, .map-guide-boss-label) { text-shadow: .05em 0 0 #000, -.05em 0 0 #000, 0 .05em 0 #000, 0 -.05em 0 #000, .035em .035em 0 #000, -.035em .035em 0 #000, .035em -.035em 0 #000, -.035em -.035em 0 #000, 1px 1px 0 #000; }
html.text-outline-shadow :is(.leaderboard-podium-value, .leaderboard-podium-name, .leaderboard-podium-name *, .leaderboard-name, .leaderboard-name *, .window-banner.window-banner, .window-banner > span) { text-shadow: 2px 0 0 #000, -2px 0 0 #000, 0 2px 0 #000, 0 -2px 0 #000, 1.4px 1.4px 0 #000, -1.4px 1.4px 0 #000, 1.4px -1.4px 0 #000, -1.4px -1.4px 0 #000; }
html.text-outline-shadow .leaderboard-podium-rank-label { text-shadow: 1.25px 0 0 #222, -1.25px 0 0 #222, 0 1.25px 0 #222, 0 -1.25px 0 #222, .9px .9px 0 #222, -.9px .9px 0 #222, .9px -.9px 0 #222, -.9px -.9px 0 #222, 0 2px 0 #222; }
html.text-outline-shadow .player-prestige-badge { --badge-ring: calc(var(--prestige-badge-size, 16px) * .096); --badge-diag: calc(var(--prestige-badge-size, 16px) * .068);
  text-shadow: var(--badge-ring) 0 0 #000, calc(-1 * var(--badge-ring)) 0 0 #000, 0 var(--badge-ring) 0 #000, 0 calc(-1 * var(--badge-ring)) 0 #000,
    var(--badge-diag) var(--badge-diag) 0 #000, calc(-1 * var(--badge-diag)) var(--badge-diag) 0 #000, var(--badge-diag) calc(-1 * var(--badge-diag)) 0 #000, calc(-1 * var(--badge-diag)) calc(-1 * var(--badge-diag)) 0 #000; }
html.text-outline-shadow .hud-gem-balance { text-shadow: var(--text-outline-ring), 0 1px #071c29; }
html.text-outline-shadow .death-countdown { text-shadow: var(--text-outline-ring); }

/* The Enemy Index in the map window: phone-readable, one row per kind of enemy. */
.enemy-index-table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.3; }
.enemy-index-table th, .enemy-index-table td { padding: 7px 4px; border-bottom: 1px solid rgba(255,255,255,.08); text-align: right; white-space: nowrap; }
.enemy-index-table thead th { color: #8c94a1; font-size: 13px; }
.enemy-index-table th:first-child { text-align: left; white-space: normal; }
.enemy-index-table tbody th { color: #fff7e6; font-weight: 900; }
.enemy-index-table tbody th.is-elite { color: #ffe08a; }
.enemy-index-table tbody td { font-weight: 900; }
.enemy-index-table tbody td:nth-child(2) { color: #55d568; }
.enemy-index-table tbody td:nth-child(3) { color: #ff5a5a; }
.enemy-index-note { margin: 0; color: #8c94a1; font-size: 13px; line-height: 1.4; text-align: center; }
.enemy-index-table tr.is-boss th { color: #ffb347; }
.enemy-index-boss-tag { display: block; color: #ffb347; font-size: 13px; font-weight: 700; }
.enemy-index-reward { display: block; }
.enemy-index-table tr.enemy-index-attacks td { padding: 0 4px 8px; text-align: left; white-space: normal; }
.enemy-index-attack { display: inline-flex; gap: 6px; margin: 2px 14px 2px 0; color: #c2c7ce; font-size: 14px; }
.enemy-index-attack strong { color: #ff5a5a; }

/* Aggro: the stat groups the player picks to chase them. */
.aggro-picks { display: grid; gap: 8px; }
.aggro-picks[hidden] { display: none; }
.aggro-picks-label { margin: 0; color: #e8eaed; font-size: 14px; font-weight: 700; }
.aggro-picks-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.aggro-pick { min-height: 40px; margin: 0; padding: 0 14px; border: 2px solid var(--pick-color); border-radius: 8px; background: rgba(255,255,255,.05); box-shadow: none; color: var(--pick-color); font: 900 14px/1 var(--font-rounded); text-shadow: none; }
.aggro-pick[aria-pressed="true"] { background: var(--pick-color); color: #10140f; }
.aggro-pick:disabled { cursor: default; }
.aggro-pick:disabled:not([aria-pressed="true"]) { opacity: .45; }
.aggro-picks-label.is-needed { color: #ffb347; }
.aggro-pick-overlay { position: fixed; inset: 0; z-index: 14; display: grid; place-items: center; padding: max(16px, env(safe-area-inset-left)); background: rgba(0,0,0,.72); }
.aggro-pick-overlay[hidden] { display: none; }
.aggro-pick-window { display: grid; gap: 12px; width: min(420px, 100%); padding: 14px; background: var(--window-surface-neutral, #161b18); border: 2px solid #3a4636; border-radius: 10px; color: #fff; }
.aggro-pick-note { margin: 0; color: #c2c7ce; font-size: 13px; }
.aggro-pick-done { min-height: 44px; margin: 0; font-size: 16px; }
.aggro-pick-done:disabled { filter: grayscale(.8); opacity: .5; }
.enemy-index-table td.enemy-index-loading { padding: 14px 4px; color: #8c94a1; text-align: center; font-weight: 700; }

/* The pickaxe's Tool slot: small, in the character stage's free bottom-left corner. */
.inventory-loadout .equipment-slot.slot-tool { z-index: 2; grid-column: 2; grid-row: 2; align-self: end; justify-self: start; width: 44px; height: 44px; min-height: 0; margin: 0 0 4px 4px; padding: 2px; grid-template-rows: minmax(0, 1fr); }
.inventory-loadout .equipment-slot.slot-tool[hidden] { display: none; }
.inventory-loadout .equipment-slot.slot-tool > span:not(.slot-tool-art) { place-self: center; font-size: var(--font-readable-min); }
.inventory-loadout .slot-tool .slot-tool-art { grid-area: 1 / 1; width: 100%; height: 100%; margin: 0; background: center / contain no-repeat; transform: rotate(-35deg); }
.inventory-loadout .slot-tool .slot-tool-art.slot-tool-crossed { transform: rotate(35deg) scaleX(-1); }

/* Server announcements in chat (chat-announcement-line.ts): a player's line with a label and an outlined bubble. */
.chat-announcement-label { display: inline-block; margin-left: 8px; padding: 1px 8px; border: 1px solid rgba(255,255,255,.3); border-radius: 999px; color: #fff; font-size: 13px; font-weight: 900; line-height: 1.3; vertical-align: middle; -webkit-text-stroke: 0; }
#chatPanel.is-large .chat-announcement .chat-text { box-shadow: inset 0 0 0 1px rgba(255,255,255,.3); }
#chatPanel:not(.is-large) .chat-announcement-label { display: none; }

  /* The Trade Chrysanthemum: the game's own dark window, a gold banner, sand for selling, green for buying, monospace figures. */
  .exchange-sheet {
    --sand: #e9cf95; --sand-dim: #b49a66; --sand-line: rgba(233, 207, 149, .24); --buy: #8fd27c; --buy-line: rgba(143, 210, 124, .3);
    --cell: #1c1d1b; --cell-line: #3a3b37; --muted: #b3b4ae;
    box-sizing: border-box; width: var(--game-window-width); max-width: calc(100vw - 24px);
    height: min(620px, calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 32px));
    margin: auto; padding: 0; overflow: hidden; border: 0; border-radius: 14px;
    background: var(--window-surface); color: var(--text); box-shadow: 0 20px 56px rgba(0,0,0,.72);
    font: 900 var(--font-readable-body)/1.35 var(--font-rounded);
  }
  .exchange-sheet[open] { display: flex; flex-direction: column; }
  .exchange-sheet::backdrop { background: #0008; }
  .exchange-head { padding: 12px 12px 0; }
  .exchange-body { flex: 1; overflow: auto; padding: 10px 14px 14px; }
  .exchange-coin { width: 16px; height: 16px; flex: 0 0 auto; }
  .exchange-gold, .exchange-hit-price, .exchange-total-gold { display: inline-flex; align-items: center; gap: 5px; color: var(--sand);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-variant-numeric: tabular-nums; -webkit-text-stroke: 0; }
  .exchange-chip, .exchange-count, .exchange-price, .exchange-hit-amount, .exchange-market, .exchange-stepper input, .exchange-aside {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-variant-numeric: tabular-nums; -webkit-text-stroke: 0; }

  /* Each screen's heading: its name on the left, what matters on the right. */
  .exchange-screen-head { display: flex; align-items: center; justify-content: space-between; margin: 14px 0 8px; }
  .exchange-screen-head:first-child { margin-top: 2px; }
  .exchange-screen-head h3 { margin: 0; font-size: 15px; color: #e8e8e2; }
  .exchange-aside { color: var(--muted); font-size: 13px; }
  .exchange-section { margin: 14px 0 6px; color: var(--muted); font-size: 12px; letter-spacing: .04em; }

  /* Your Offers: Buy and Sell on top, then the slots as cards. */
  .exchange-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  /* The game's own buttons: green to buy (the Auto Farm Start), gold to sell (the Smith's), grey for small steps. */
  .exchange-side, .exchange-confirm, .exchange-step {
    display: flex; align-items: center; justify-content: center; padding: 0 10px 2px; border: 2px solid #103512; border-radius: 8px;
    background: linear-gradient(#5cbd5f, #2f7d38); box-shadow: 0 3px 0 #15351a; color: #fff; font: 900 15px/1 var(--font-rounded);
    -webkit-text-stroke: var(--text-outline-width) #000; paint-order: stroke fill; text-shadow: var(--text-shadow); cursor: pointer;
  }
  .exchange-side.is-sell, .exchange-confirm.is-sell, .exchange-collect .exchange-confirm {
    border-color: #5a3c00; background: linear-gradient(#d4b052, #a27a22); box-shadow: 0 3px 0 #5a3c00;
  }
  .exchange-step { border-color: #232524; background: linear-gradient(170deg, #676969 0%, #505d5e 52%, #425052 100%); box-shadow: 0 3px 0 var(--ui-outline); font-size: 14px; }
  :is(.exchange-side, .exchange-confirm, .exchange-step):active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #15351a; }
  :is(.exchange-side, .exchange-confirm, .exchange-step):disabled { opacity: .45; cursor: default; }
  .exchange-side { height: 54px; font-size: 18px; }
  /* Square cards, three across; a narrow phone lets a filled card grow taller instead of cropping it, and the rows stay even. */
  .exchange-slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: 1fr; gap: 8px; container-type: inline-size; }
  .exchange-slot { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: calc((100cqw - 16px) / 3);
    padding: 6px; border: 2px dashed var(--cell-line); border-radius: 0; background: var(--cell); color: #a3a49e; font-size: 13px; }
  .exchange-slot.is-locked { color: #8d8e88; background: #171816; }
  .exchange-slot.is-filled { border-style: solid; color: var(--text); cursor: pointer; }
  .exchange-slot.is-buy { border-color: var(--buy-line); }
  .exchange-slot.is-sell { border-color: var(--sand-line); }
  .exchange-tag { font-size: 12px; }
  .exchange-slot.is-buy .exchange-tag { color: var(--buy); }
  .exchange-slot.is-sell .exchange-tag { color: var(--sand); }
  .exchange-price { color: var(--sand); font-size: 14px; }
  .exchange-count { color: var(--muted); font-size: 11px; }
  .exchange-progress { width: 100%; height: 4px; margin-top: 2px; border-radius: 3px; background: #2a2b28; overflow: hidden; }
  .exchange-progress::after { content: ""; display: block; width: calc(var(--done, 0) * 100%); height: 100%; background: currentColor; }
  .exchange-slot.is-buy .exchange-progress { color: var(--buy); }
  .exchange-slot.is-sell .exchange-progress { color: var(--sand); }
  .exchange-collect { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 8px 10px; border: 1.5px solid var(--sand-line); border-radius: 3px; background: #26241d; }
  .exchange-collect-items { flex: 1; display: flex; align-items: center; gap: 6px; overflow: hidden; }

  /* Items: the bag's own tiles, a figure in the corner. */
  /* The bag's own tile, corners and all, so items look the same everywhere. */
  .exchange-tile { width: 56px; height: 56px; min-height: 0; padding: 0; position: relative; flex: 0 0 auto; }
  /* No tier label over a trade tile, so its refine star sits right in the corner. */
  .inventory-item.exchange-tile > .refine-badge { top: 3px; right: 4px; }
  .exchange-chip { position: absolute; right: 2px; bottom: 2px; padding: 0 3px; border-radius: 4px; background: #000b; color: var(--sand); font-size: 10px; line-height: 14px; }
  .exchange-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 8px; justify-items: center; }

  /* Buy: a search over the market; results a row per seller. */
  .exchange-search { display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1.5px solid var(--cell-line); border-radius: 3px; background: var(--cell); color: var(--muted); }
  .exchange-search-icon { width: 18px; height: 18px; flex: 0 0 auto; }
  .exchange-search input { flex: 1; min-width: 0; padding: 11px 0; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 15px; outline: none; }
  .exchange-results { margin-top: 4px; }
  .exchange-hit { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; align-items: center; column-gap: 12px; width: 100%; margin-top: 8px;
    padding: 8px 10px 8px 8px; border: 1.5px solid var(--cell-line); border-radius: 0; background: var(--cell); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
  .exchange-hit-text { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
  .exchange-hit-name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .exchange-hit-seller { color: var(--sand-dim); font-size: 12px; }
  .exchange-hit-skills { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .exchange-hit-figures { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
  .exchange-hit-price { font-size: 15px; }
  .exchange-hit-amount { color: var(--muted); font-size: 12px; }
  .exchange-none, .exchange-empty { margin: 18px 0; color: #b3b4ae; text-align: center; font-size: 13px; }

  /* An offer: the item in the middle, its market under it, then amount, price, total. */
  .exchange-hero { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 4px 0 16px; text-align: center; }
  .exchange-hero .exchange-tile { width: 72px; height: 72px; }
  .exchange-pill { padding: 2px 12px; border-radius: 3px; font-size: 12px; }
  .exchange-hero.is-buy .exchange-pill { background: #1f2a1c; color: var(--buy); border: 1px solid var(--buy-line); }
  .exchange-hero.is-sell .exchange-pill { background: #2a261c; color: var(--sand); border: 1px solid var(--sand-line); }
  .exchange-hero-name { font-size: 17px; }
  .exchange-market { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 0; color: var(--muted); font-size: 12px; }
  .exchange-market-stat { padding: 3px 7px; border-radius: 4px; background: rgba(255,255,255,.04); }
  .exchange-market-btn {
    padding: 3px 8px; border: 1px solid var(--cell-line); border-radius: 4px; background: var(--cell);
    color: var(--sand); font: inherit; cursor: pointer;
  }
  .exchange-market-btn:hover { border-color: var(--sand-line); background: #2c2a22; }
  .exchange-filters { display: flex; flex-wrap: wrap; gap: 5px; margin: 0 0 8px; }
  .exchange-filter {
    padding: 4px 10px; border: 1px solid var(--cell-line); border-radius: 999px; background: var(--cell);
    color: var(--muted); font-size: 12px; font-weight: 700; cursor: pointer;
  }
  .exchange-filter.is-active { border-color: var(--sand-line); background: #2c281c; color: var(--sand); }
  .exchange-filter-held { margin-left: auto; }
  .cooking-fire .cook-top-strip { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 6px 14px 0; flex-shrink: 0; }
  .cook-nav-pill { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 9px 11px; border: 0; border-radius: 10px; background: #1c2026; color: #fff; text-align: left; font: inherit; cursor: pointer; transition: background .14s ease, transform .1s ease; }
  .cook-nav-pill:hover:not(:disabled) { background: #242a33; }
  .cook-nav-pill:active:not(:disabled) { transform: scale(.98); }
  .cook-nav-pill:disabled { opacity: .5; cursor: default; }
  .cook-nav-kicker { font-size: 10px; font-weight: 800; color: #9ea8b3; text-transform: uppercase; letter-spacing: .05em; }
  .cook-nav-value { font-size: 13px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cook-nav-sub { font-size: 11px; font-weight: 700; color: #ffd38a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cook-mini-track { display: block; height: 5px; margin-top: 3px; border-radius: 999px; background: rgba(255,255,255,.12); overflow: hidden; }
  .cook-mini-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #f59e0b, #ffd34d); transition: width .2s ease; }
  .cook-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 14px 4px; flex-shrink: 0; }
  .cook-mode-seg { display: inline-flex; padding: 3px; border-radius: 9px; border: 0; background: #0c0e11; gap: 3px; }
  .cook-mode-btn { padding: 6px 12px; border: 0; border-radius: 6px; background: transparent; color: #b8c0c8; font: inherit; font-size: 12px; font-weight: 800; cursor: pointer; }
  .cook-mode-btn.is-active { background: #2d7a46; color: #fff; }
  .cook-bag-btn { padding: 7px 12px; border: 0; border-radius: 9px; background: linear-gradient(180deg, #9a5415, #66350c); color: #fff7e0; font: inherit; font-size: 12px; font-weight: 900; cursor: pointer; }
  .cook-bag-btn:disabled { opacity: .45; cursor: default; }
  .cooking-fire .cook-body { display: flex; flex-direction: column; gap: 8px; padding: 6px 14px 10px; scrollbar-width: none; }
  .cooking-fire .cook-body::-webkit-scrollbar { display: none; }
  .cook-fish-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  @media (max-width: 360px) { .cook-fish-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  .cook-fish-tile { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 8px 6px 7px; border: 0; border-radius: 11px; background: #1c2129; color: #fff; text-align: center; font: inherit; cursor: pointer; transition: background .14s ease, transform .1s ease; }
  .cook-fish-tile:hover:not(:disabled) { background: #252c37; }
  .cook-fish-tile:active:not(:disabled) { transform: scale(.97); }
  .cook-fish-tile:disabled { opacity: .52; cursor: default; }
  .cook-fish-tile.is-locked .cook-fish-img { filter: grayscale(.8) brightness(.65); }
  .cook-fish-art { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; height: 56px; border-radius: 8px; background: radial-gradient(circle at 50% 55%, rgba(255,211,77,.12), rgba(8,12,18,.55)); }
  .cook-fish-img { width: 48px; height: 48px; object-fit: contain; filter: drop-shadow(0 3px 5px rgba(0,0,0,.55)); pointer-events: none; }
  .cook-fish-qty { position: absolute; top: 3px; right: 4px; padding: 1px 5px; border-radius: 999px; background: rgba(10,12,16,.84); border: 0; color: #f0f4f8; font-size: 10.5px; font-weight: 800; line-height: 1.25; }
  .cook-risk-tag { position: absolute; bottom: 3px; left: 4px; padding: 1px 5px; border-radius: 999px; background: rgba(164,78,12,.92); border: 0; color: #ffe8a8; font-size: 9.5px; font-weight: 900; line-height: 1.2; }
  .cook-lock-tag { padding: 1px 6px; border-radius: 6px; background: rgba(255,107,107,.16); color: #ffb3b3; font-size: 10.5px; font-weight: 800; }
  .cook-fish-name { font-size: 12.5px; line-height: 1.15; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cook-fish-meta { display: flex; align-items: center; justify-content: center; gap: 4px; width: 100%; font-size: 10.5px; color: #aeb6be; }
  .cook-xp { color: #8be0ff; font-weight: 800; }
  .cook-batch-tag { padding: 1px 6px; border-radius: 6px; background: rgba(52,199,89,.2); color: #7ef09c; font-size: 10.5px; font-weight: 800; }
  .cook-empty { grid-column: 1 / -1; margin: 12px 0; padding: 18px 14px; border-radius: 10px; background: #1c2026; color: #b7c2bf; font-size: 13px; text-align: center; }
  .cook-cast { display: flex; flex-direction: column; gap: 10px; padding: 14px 12px; border: 0; border-radius: 12px; background: radial-gradient(100% 90% at 50% 0%, rgba(255,136,28,.22), #191614); }
  .cook-cast-head { display: flex; align-items: center; gap: 12px; }
  .cook-cast-visual { position: relative; display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; flex: 0 0 48px; border-radius: 10px; background: rgba(0,0,0,.38); border: 0; }
  .cook-cast-img { width: 38px; height: 38px; object-fit: contain; position: relative; z-index: 1; filter: drop-shadow(0 2px 4px rgba(0,0,0,.6)); }
  .cook-flame { position: absolute; inset: auto 6px 2px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 50% 65%, #fff3b0 0%, #ff9f1c 50%, #d9480f 85%, transparent 100%); opacity: .75; animation: cook-flame-pulse 1.1s ease-in-out infinite alternate; }
  @keyframes cook-flame-pulse { from { transform: scale(.92); opacity: .65; } to { transform: scale(1.08); opacity: .9; } }
  .cook-cast-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
  .cook-cast-title { font-size: 14px; color: #fff; }
  .cook-clock { font-size: 12px; color: #ffd38a; font-weight: 800; font-variant-numeric: tabular-nums; }
  .cook-cast-track { height: 10px; border-radius: 999px; background: rgba(255,255,255,.12); overflow: hidden; border: 0; }
  .cook-cast-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #ff7b00, #ffd34d); transition: width .08s linear; }
  .cook-cast-totals { padding: 7px 10px; border-radius: 8px; background: rgba(0,0,0,.34); color: #ffe7b3; font-size: 12px; font-weight: 800; text-align: center; }
  .cook-stop { width: 100%; }
  .cook-status { margin: 0; min-height: 18px; font-size: 12.5px; color: #b9f5c8; font-weight: 700; text-align: center; }
  .cook-status.is-burn { color: #ffb38a; }
  .cook-sub-body { display: flex; flex-direction: column; gap: 10px; padding: 6px 14px 12px; scrollbar-width: none; }
  .cook-sub-body::-webkit-scrollbar { display: none; }
  .cook-dish-list { display: flex; flex-direction: column; gap: 7px; }
  .cook-dish-row { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border: 0; border-radius: 10px; background: #1b1f26; color: #dbe2ea; text-align: left; font: inherit; cursor: pointer; transition: background .14s ease; }
  .cook-dish-row:hover:not(:disabled) { background: #242a34; }
  .cook-dish-row-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .cook-dish-row strong { font-size: 13.5px; }
  .cook-dish-row small { font-size: 11.5px; color: #9ea8b3; }
  .cook-dish-row-tag { padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.09); color: #cfd8e3; font-size: 11px; font-weight: 800; }
  .cook-dish-row.is-active { background: linear-gradient(180deg, rgba(132,74,20,.65), rgba(56,32,14,.85)); box-shadow: inset 0 0 0 2px rgba(255,211,77,.82); color: #fff; }
  .cook-dish-row.is-active small { color: #ffe08a; }
  .cook-dish-row.is-active .cook-dish-row-tag { background: rgba(255,211,77,.24); color: #ffd34d; }
  .cook-dish-row.is-locked { opacity: .48; cursor: default; }
  .cook-skill-meter { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 12px; border: 0; border-radius: 10px; background: linear-gradient(180deg, rgba(46,29,16,.85), #191716); }
  .cook-skill-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 14px; }
  .cook-skill-xp { color: #d6ccc0; font-size: 12px; font-weight: 700; }
  .cook-skill-track { height: 7px; border-radius: 999px; background: rgba(255,255,255,.12); overflow: hidden; }
  .cook-skill-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #f59e0b, #ffd34d); transition: width .2s ease; }
  .cook-skill-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
  .cook-skill-next { color: #c9bfb3; font-size: 12px; }
  .cook-skillet-pill { padding: 2px 8px; border-radius: 999px; border: 0; background: rgba(255,211,77,.16); color: #ffd34d; font-size: 11px; font-weight: 800; }
  .cook-unlock-list { display: flex; flex-direction: column; gap: 6px; }
  .cook-unlock-row { display: grid; grid-template-columns: 32px 1fr auto; align-items: center; gap: 8px; padding: 7px 10px; border: 0; border-radius: 9px; background: #1a1e25; opacity: .58; }
  .cook-unlock-row.is-unlocked { opacity: 1; background: #21252d; }
  .cook-unlock-img { width: 30px; height: 30px; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(0,0,0,.5)); }
  .cook-unlock-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
  .cook-unlock-row strong { font-size: 12.5px; color: #fff; }
  .cook-unlock-meta { font-size: 11px; color: #9ea8b3; }
  .cook-unlock-lvl { font-size: 10.5px; font-weight: 800; color: #8ff0a4; white-space: nowrap; }
  .cook-unlock-lvl.is-risk { color: #ffd38a; }

  /* Guild Glass Crossing: featured quest card & interactive 50/50 glass bridge arena */
  .guild-crossing-card { display: flex; flex-direction: column; gap: 8px; margin: 0 0 14px; padding: 12px; border: 1.5px solid rgba(95,227,214,.38); border-radius: 12px; background: linear-gradient(160deg, rgba(18,38,52,.85), rgba(14,18,26,.94)); box-shadow: inset 0 1px 0 rgba(160,240,255,.16); }
  .guild-crossing-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .guild-crossing-card-step { color: #ffd34d; font-size: 12.5px; font-weight: 800; }
  .guild-crossing-card-sub { color: #b7c8d4; font-size: 11.5px; }
  .guild-crossing-track { height: 6px; border-radius: 999px; background: rgba(255,255,255,.12); overflow: hidden; }
  .guild-crossing-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #34c759, #5fe3d6, #ffd34d); transition: width .25s ease; }

  .crossing-content { display: flex; flex-direction: column; gap: 8px; }
  .crossing-topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .crossing-stats { display: flex; flex-wrap: wrap; gap: 6px; }
  .crossing-pill { padding: 3px 9px; border-radius: 999px; border: 1px solid rgba(255,255,255,.16); background: rgba(16,22,30,.88); color: #eaf2f8; font-size: 12px; font-weight: 800; }
  .crossing-pill--gold { border-color: rgba(255,211,77,.42); color: #ffd34d; background: rgba(255,211,77,.1); }
  .crossing-pill--streak { border-color: rgba(95,227,214,.55); color: #7ff5e8; background: rgba(95,227,214,.14); }
  .crossing-pill--win { border-color: rgba(71,209,108,.6); color: #8af5a4; background: rgba(71,209,108,.16); }
  .crossing-tries { font-size: 12.5px; color: #c7d4df; font-weight: 700; }
  .crossing-milestones { display: flex; flex-wrap: wrap; gap: 6px; }
  .crossing-milestone { padding: 3px 8px; border-radius: 7px; border: 1px solid rgba(255,255,255,.12); background: rgba(12,16,22,.72); color: #95a4b3; font-size: 11px; font-weight: 800; }
  .crossing-milestone.is-done { border-color: rgba(255,211,77,.5); background: rgba(255,211,77,.14); color: #ffe17a; }
  .crossing-toast { margin: 0; padding: 8px 10px; border-radius: 9px; font-size: 12.5px; font-weight: 800; text-align: center; }
  .crossing-toast--safe { background: rgba(40,180,99,.2); border: 1px solid rgba(71,209,108,.55); color: #9cf8b3; }
  .crossing-toast--fell { background: rgba(220,68,68,.2); border: 1px solid rgba(255,112,112,.5); color: #ffb3b3; }
  .crossing-toast--win { background: rgba(255,211,77,.2); border: 1px solid rgba(255,211,77,.65); color: #ffe999; }
  .crossing-toast--error { background: rgba(220,68,68,.18); border: 1px solid rgba(255,120,120,.45); color: #ffc2c2; }

  .crossing-bridge-scroll { max-height: 360px; overflow-y: auto; padding: 12px 10px; border: 1.5px solid rgba(120,175,210,.22); border-radius: 12px; background: radial-gradient(80% 30% at 50% 0%, rgba(255,211,77,.14), transparent 65%), linear-gradient(180deg, #09121e 0%, #0b1019 55%, #111520 100%); }
  .crossing-bridge { display: flex; flex-direction: column; gap: 8px; max-width: 360px; margin: 0 auto; }
  .crossing-portal { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px; border: 2px solid rgba(255,211,77,.42); border-radius: 14px; background: radial-gradient(100% 100% at 50% 50%, rgba(255,211,77,.22), rgba(16,28,42,.88)); color: #fff7d6; text-align: center; }
  .crossing-portal small { color: #d8cfa8; font-size: 11.5px; }
  .crossing-portal.is-ready { border-color: #ffd34d; box-shadow: 0 0 18px rgba(255,211,77,.35); }
  .crossing-portal.is-cleared { border-color: #47d16c; background: radial-gradient(100% 100% at 50% 50%, rgba(71,209,108,.24), rgba(16,28,24,.9)); }
  .crossing-winner { display: flex; align-items: center; gap: 8px; }
  .crossing-finish-btn { width: 100%; }
  .crossing-checkpoint { text-align: center; font-size: 11px; font-weight: 900; letter-spacing: .04em; color: #c7b57a; padding: 3px 8px; border-radius: 999px; border: 1px dashed rgba(255,211,77,.3); background: rgba(255,211,77,.06); }
  .crossing-checkpoint.is-done { color: #ffd34d; border-style: solid; border-color: rgba(255,211,77,.55); background: rgba(255,211,77,.14); }
  .crossing-row { display: grid; grid-template-columns: 1fr 28px 1fr; align-items: center; gap: 8px; padding: 4px; border-radius: 12px; }
  .crossing-row.is-frontier { background: rgba(95,227,214,.09); box-shadow: 0 0 0 1.5px rgba(95,227,214,.42); }
  .crossing-step-num { text-align: center; font-size: 11px; font-weight: 900; color: #7c8ea0; font-variant-numeric: tabular-nums; }
  .crossing-row.is-frontier .crossing-step-num { color: #7ff5e8; }
  .crossing-tile { min-height: 58px; padding: 7px 8px; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-align: center; box-sizing: border-box; font: inherit; position: relative; overflow: hidden; }
  .crossing-tile-label { font-size: 13px; font-weight: 900; }
  .crossing-tile-sub { font-size: 11px; color: #9eb0c2; font-weight: 700; }
  .crossing-tile--frontier { border: 2px solid #5fe3d6; background: linear-gradient(155deg, rgba(110,235,230,.24), rgba(24,52,72,.88) 55%, rgba(16,32,48,.94)); color: #f2fffe; cursor: pointer; box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 4px 12px rgba(0,0,0,.35); transition: transform .1s ease, border-color .14s ease, box-shadow .14s ease; }
  .crossing-tile--frontier:hover:not(:disabled) { border-color: #a8fff5; box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 0 14px rgba(95,227,214,.45); }
  .crossing-tile--frontier:active:not(:disabled) { transform: scale(.97); }
  .crossing-tile--frontier:disabled { opacity: .52; cursor: default; }
  .crossing-tile--frontier.is-stepping { border-color: #ffd34d; animation: crossing-pulse .24s ease-in-out infinite alternate; }
  .crossing-tile--safe { border: 2px solid #2fb85c; background: linear-gradient(160deg, rgba(52,199,89,.26), rgba(16,44,28,.88)); color: #b9ffd0; }
  .crossing-tile--safe .crossing-tile-sub { color: #8fe3a9; }
  .crossing-tile--safe.is-flash-safe { animation: crossing-safe-pop .4s ease-out; }
  .crossing-tile--broken { border: 1.5px dashed rgba(255,105,105,.38); background: radial-gradient(circle at 50% 50%, #05070b, #170d14); color: #8e7b84; }
  .crossing-tile--broken.has-fallen { border-color: rgba(255,115,115,.62); }
  .crossing-tile--broken.is-flash-shatter { animation: crossing-shatter .38s ease-out; }
  .crossing-tile--future { border: 1.5px solid rgba(165,205,235,.15); background: rgba(20,30,44,.42); color: #64788c; }
  .crossing-fallen-badge { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 100%; }
  .crossing-fallen-portrait { position: relative; display: inline-flex; }
  .crossing-fallen-avatar { width: 28px; height: 28px; filter: grayscale(.35) brightness(.88); border-color: rgba(255,120,120,.7); }
  .crossing-skull { position: absolute; right: -5px; bottom: -3px; font-size: 12px; line-height: 1; text-shadow: 0 1px 3px #000; }
  .crossing-fallen-name { font-size: 11px; color: #ffcccc; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .crossing-start { text-align: center; padding: 10px; border: 1.5px solid rgba(255,255,255,.16); border-radius: 10px; background: rgba(24,30,40,.85); color: #dbe6f0; display: flex; flex-direction: column; gap: 2px; }
  .crossing-start small { color: #95a7b8; font-size: 11px; }
  .crossing-fallen-wall { padding: 8px 10px; border-radius: 9px; border: 1px solid rgba(255,115,115,.25); background: rgba(34,14,20,.6); color: #e2c7cd; font-size: 11.5px; line-height: 1.4; }
  .crossing-fallen-wall strong { color: #ffadad; }
  @keyframes crossing-pulse { from { transform: scale(.98); } to { transform: scale(1.03); } }
  @keyframes crossing-safe-pop { 0% { transform: scale(1.08); box-shadow: 0 0 18px rgba(71,209,108,.85); } 100% { transform: scale(1); } }
  @keyframes crossing-shatter { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
  @media (prefers-reduced-motion: reduce) {
    .crossing-tile--frontier.is-stepping, .crossing-tile--safe.is-flash-safe, .crossing-tile--broken.is-flash-shatter, .cook-flame { animation: none; }
  }
  .offline-progress-later { margin-top: 6px; width: 100%; }
  /* Label, step down, field, step up, extra: the same columns in every row, each cell the same height. */
  .exchange-stepper { display: grid; grid-template-columns: 82px 52px minmax(0, 1fr) 52px 52px; align-items: center; gap: 6px; margin-bottom: 10px; }
  .exchange-stepper-label { color: var(--muted); font-size: 13px; white-space: nowrap; }
  .exchange-stepper input { box-sizing: border-box; min-width: 0; height: 40px; margin: 0; padding: 0 8px; border: 1.5px solid var(--cell-line); border-radius: 0; background: var(--cell); color: var(--text); font-size: 16px; text-align: center; }
  .exchange-stepper .exchange-step { box-sizing: border-box; width: 52px; height: 40px; margin: 0 0 3px; padding: 0 0 2px; }
  .exchange-step { height: 40px; border-radius: 4px; }
  .exchange-total { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--cell-line); }
  .exchange-total-label { color: var(--muted); font-size: 13px; }
  .exchange-total-gold { font-size: 18px; }
  .exchange-total-gold.is-short { color: #ff9b91; }
  .exchange-timing { margin: 6px 0 12px; color: var(--muted); font-size: 12px; text-align: right; }
  .exchange-timing.is-now { color: var(--buy); }
  .exchange-confirm { width: min(240px, 100%); height: 48px; margin: 0 auto; font-size: 16px; }
  .exchange-collect .exchange-confirm { flex: 0 0 auto; align-self: center; width: auto; height: 44px; margin: 0 0 3px; padding: 0 18px 2px; }

  .exchange-item-offer { margin-top: 14px; }
  .exchange-cancel { width: 100%; height: 30px; margin: 2px 0 3px; padding: 0 0 2px; font-size: 13px; }
  .exchange-slot .exchange-tile { width: 40px; height: 40px; }
  .exchange-slot .exchange-price { font-size: 12px; }
  .exchange-slot .exchange-tag { font-size: 11px; white-space: nowrap; }
  .exchange-each { margin-left: 2px; color: var(--muted); font-size: 11px; }
  .exchange-total-label { display: flex; flex-direction: column; gap: 2px; }
  .exchange-sum { color: var(--muted); font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; -webkit-text-stroke: 0; }
  .exchange-tile.is-none { opacity: .35; }
  .exchange-foot { display: flex; justify-content: center; padding: 8px 12px 12px; }
  .exchange-foot .window-back-button { min-width: 160px; }

  /*
   * Gear tiles by grade, Crude (0) to Eternal (14), on the rarity ladder players know: grey, green, blue,
   * purple, orange, red, then sky, gold and pearl. A deepened frame, a glow rising from the bottom and a lit top edge;
   * the middle stays dark so names stay readable. Legendary on glows outside, Divine and Eternal also catch a shine.
   */
  :is(.inventory-item, .equipment-slot)[data-grade] {
    border-color: color-mix(in srgb, var(--grade) 78%, #000);
    background:
      radial-gradient(110% 70% at 50% 108%, color-mix(in srgb, var(--grade) 34%, transparent), transparent 72%),
      linear-gradient(180deg, color-mix(in srgb, var(--grade) 9%, #1d1d20), #111113);
    box-shadow: inset 0 1px 0 color-mix(in srgb, var(--grade) 30%, rgba(255,255,255,.12)), inset 0 -2px 0 rgba(0,0,0,.35);
  }
  :is(.inventory-item, .equipment-slot):is([data-grade="9"], [data-grade="10"], [data-grade="11"], [data-grade="12"], [data-grade="13"], [data-grade="14"]) {
    box-shadow: inset 0 1px 0 color-mix(in srgb, var(--grade) 40%, rgba(255,255,255,.15)), inset 0 -2px 0 rgba(0,0,0,.35),
      0 0 7px color-mix(in srgb, var(--grade) 45%, transparent);
  }
  :is(.inventory-item, .equipment-slot):is([data-grade="13"], [data-grade="14"])::after {
    content: "";
    position: absolute;
    inset: -40% auto -40% -60%;
    width: 40%;
    background: linear-gradient(100deg, transparent, rgba(255,255,255,.22), transparent);
    transform: translateX(0) rotate(12deg);
    animation: grade-shine 4.5s ease-in-out infinite;
    pointer-events: none;
  }
  @keyframes grade-shine { 0%, 62% { transform: translateX(0) rotate(12deg); } 100% { transform: translateX(520%) rotate(12deg); } }
  @media (prefers-reduced-motion: reduce) {
    :is(.inventory-item, .equipment-slot):is([data-grade="13"], [data-grade="14"])::after { animation: none; opacity: 0; }
  }
  /* Picked: a white ring outside the grade's frame, so the grade still shows. */
  .inventory-item.is-selected[data-grade] { outline: 2px solid rgba(255,255,255,.85); outline-offset: 1px; }
  :is(.inventory-item, .equipment-slot)[data-grade="0"] { --grade: #666666; } /* Crude: dark grey */
  :is(.inventory-item, .equipment-slot)[data-grade="1"] { --grade: #c9c9c9; } /* Common: light grey */
  :is(.inventory-item, .equipment-slot)[data-grade="2"] { --grade: #a8794c; } /* Sturdy: bronze */
  :is(.inventory-item, .equipment-slot)[data-grade="3"] { --grade: #9fbf2e; } /* Fine: yellow-lime */
  :is(.inventory-item, .equipment-slot)[data-grade="4"] { --grade: #2f9a4c; } /* Superior: green */
  :is(.inventory-item, .equipment-slot)[data-grade="5"] { --grade: #5ab4f0; } /* Rare: light blue */
  :is(.inventory-item, .equipment-slot)[data-grade="6"] { --grade: #2a44a8; } /* Exquisite: deep blue */
  :is(.inventory-item, .equipment-slot)[data-grade="7"] { --grade: #a77af2; } /* Epic: violet */
  :is(.inventory-item, .equipment-slot)[data-grade="8"] { --grade: #e277c8; } /* Heroic: pink */
  :is(.inventory-item, .equipment-slot)[data-grade="9"] { --grade: #f0952e; } /* Legendary: orange */
  :is(.inventory-item, .equipment-slot)[data-grade="10"] { --grade: #d9502c; } /* Mythic: red-orange */
  :is(.inventory-item, .equipment-slot)[data-grade="11"] { --grade: #a4202f; } /* Ancient: crimson */
  :is(.inventory-item, .equipment-slot)[data-grade="12"] { --grade: #5fe3d6; } /* Celestial: aqua */
  :is(.inventory-item, .equipment-slot)[data-grade="13"] { --grade: #f5dc45; } /* Divine: gold */
  :is(.inventory-item, .equipment-slot)[data-grade="14"] { --grade: #eeeaf5; } /* Eternal: pearl */
