/* Rising Kingpin workspace. Chrome (panels, dialogs, controls) follows the site design system (docs/DESIGN_SYSTEM.md §9:
   light = system tokens, dark = --d-* constants); the game area itself (map, title art, fights, scenes) keeps its own
   retro night palette like any artwork. Root rules are scoped to `.uwapp-root.uwapp-risingkingpin` (the body carries the
   app class too); everything else lives under `.cc-app`. */

.uwapp-root.uwapp-risingkingpin { display: flex; flex-direction: column; min-height: calc(100dvh - 48px); }

.cc-app {
  --cc-bg: var(--canvas); --cc-surface: var(--surface); --cc-surface-2: var(--surface-2); --cc-surface-3: var(--surface-3);
  --cc-line: var(--line); --cc-line-strong: var(--line-strong); --cc-control: var(--control);
  --cc-ink: var(--ink); --cc-ink-2: var(--ink-2); --cc-muted: var(--muted);
  --cc-primary: var(--primary); --cc-primary-text: var(--primary-text); --cc-on-primary: var(--on-accent); --cc-focus: var(--focus-color);
  --cc-info-bg: var(--info-bg); --cc-info-line: var(--info-line);
  --cc-good: #1d7a3e; --cc-bad: #b3261e; --cc-warn-bg: #fff4d6; --cc-warn-ink: #5c4300;
  --cc-night: #0e1520; --cc-night-2: #16202c; --cc-neon: #ffe08a;
  flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative;
  font-family: var(--font-sans); font-size: 15px; line-height: 1.45; color: var(--cc-ink); background: var(--cc-bg);
}
.cc-app[data-theme="dark"] {
  --cc-bg: var(--d-canvas); --cc-surface: var(--d-surface); --cc-surface-2: var(--d-surface-2); --cc-surface-3: var(--d-surface-3);
  --cc-line: var(--d-line); --cc-line-strong: var(--d-line-strong); --cc-control: var(--d-control);
  --cc-ink: var(--d-ink); --cc-ink-2: var(--d-ink-2); --cc-muted: var(--d-muted);
  --cc-primary: var(--d-primary); --cc-primary-text: var(--d-primary); --cc-on-primary: var(--d-on-accent); --cc-focus: var(--d-focus);
  --cc-info-bg: var(--d-info-bg); --cc-info-line: var(--d-info-line);
  --cc-good: #7ee08a; --cc-bad: #ff8a80; --cc-warn-bg: #3a2f12; --cc-warn-ink: #ffe3a3;
  color-scheme: dark;
}
.cc-screen { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.cc-app :where(h1, h2, h3) { color: var(--cc-ink); margin: 0; }
.cc-app h1 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; font-size: 1.6rem; }
.cc-app h2 { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; }
.cc-app h3 { font-size: 1rem; }
.cc-app p { margin: 0; }
.cc-app :focus-visible { outline: 3px solid var(--cc-focus); outline-offset: 2px; }
.cc-app [hidden] { display: none !important; }
.cc-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cc-hint { color: var(--cc-muted); font-size: 0.875rem; }
.cc-app a:not(.cc-btn) { color: var(--cc-primary-text); }
.cc-error { color: var(--cc-bad); font-weight: 600; min-height: 0; }
.cc-error:empty { display: none; }
.cc-num { font-variant-numeric: tabular-nums; font-family: ui-monospace, Menlo, Consolas, monospace; }

/* ---- controls (zero-specificity resets against platform button/input styles) */
:where(.cc-app) button { width: auto; min-height: 0; margin: 0; font: inherit; letter-spacing: normal; text-transform: none; box-shadow: none; }
:where(.cc-app) :where(input, select) { font: inherit; color: var(--cc-ink); background: var(--cc-surface); border: 1.5px solid var(--cc-control); border-radius: var(--r-sm, 8px); min-height: 40px; padding: 6px 10px; width: 100%; box-sizing: border-box; }
:where(.cc-app) input[type="checkbox"], :where(.cc-app) input[type="radio"] { width: 20px; height: 20px; min-height: 0; padding: 0; accent-color: var(--cc-primary); }
:where(.cc-app) input[type="range"] { padding: 0; border: 0; background: none; accent-color: var(--cc-primary); }
.cc-app label { font-weight: 600; font-size: 0.875rem; color: var(--cc-ink-2); }
.cc-field { display: grid; gap: 4px; min-width: 0; }
.cc-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 14px; border-radius: var(--r-btn, 8px); border: 1px solid color-mix(in srgb, var(--cc-ink) 35%, transparent); background: var(--cc-surface); color: var(--cc-ink); cursor: pointer; text-decoration: none; font-weight: 600; }
.cc-btn:hover:not([disabled]) { background: var(--cc-surface-2); transition: background-color 150ms cubic-bezier(.2,.8,.2,1); }
.cc-btn:active:not([disabled]) { transform: translateY(1px); }
.cc-app .cc-btn-primary, .cc-app button[type="submit"].cc-btn-primary { background: var(--cc-primary); border-color: var(--cc-primary); color: var(--cc-on-primary); }
.cc-app .cc-btn-primary:hover:not([disabled]), .cc-app button[type="submit"].cc-btn-primary:hover:not([disabled]) { background: var(--cc-primary); filter: brightness(1.08); color: var(--cc-on-primary); }
.cc-btn-quiet { border-color: transparent; background: transparent; }
.cc-btn-lg { min-height: 48px; padding: 10px 20px; font-size: 1rem; }
.cc-app button[disabled] { cursor: not-allowed; background: var(--cc-surface-2); color: var(--cc-muted); border-color: var(--cc-line); }
.cc-app .cc-btn-primary[disabled], .cc-app .cc-btn-primary[disabled]:hover { background: var(--cc-surface-3); color: var(--cc-ink-2); border-color: var(--cc-line-strong); filter: none; }
.cc-icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: var(--r-btn, 8px); background: transparent; color: var(--cc-ink); cursor: pointer; }
.cc-icon-btn:hover { background: var(--cc-surface-2); }
.cc-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-inline-end: 6px; vertical-align: -1px; border: 1px solid rgb(0 0 0 / 0.4); }
.cc-c-red { background: #e0453a; } .cc-c-blue { background: #3d82e8; } .cc-c-green { background: #3fae5a; } .cc-c-gold { background: #e3b236; }
.cc-badge { display: inline-block; margin-inline-start: 6px; padding: 0 8px; border-radius: 999px; background: var(--cc-info-bg); border: 1px solid var(--cc-info-line); color: var(--cc-primary-text); font-size: 0.75rem; font-weight: 700; }
.cc-card { background: var(--cc-surface); border: 1px solid var(--cc-line); border-radius: var(--r-lg, 16px); padding: 16px; display: grid; gap: 12px; min-width: 0; }
.cc-note { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: var(--r-md, 12px); background: var(--cc-info-bg); border: 1px solid var(--cc-info-line); }
.cc-note-warn { background: var(--cc-warn-bg); color: var(--cc-warn-ink); border-color: transparent; }
.cc-check { display: flex; gap: 10px; align-items: center; min-height: 32px; }
.cc-check label { font-weight: 500; color: var(--cc-ink); }

/* ---- art frames: drawn fallback underneath, delivered picture on top once loaded */
.cc-art { position: relative; overflow: hidden; background: var(--cc-night); }
.cc-art > svg, .cc-art > .cc-art-img, .cc-art > .cc-item-fallback { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.cc-art > .cc-art-img { object-fit: cover; opacity: 0; }
.cc-art.cc-art-loaded > .cc-art-img { opacity: 1; }
.cc-art.cc-art-loaded > .cc-art-fallback { visibility: hidden; }
.cc-art-wide { aspect-ratio: 16 / 9; border-radius: var(--r-md, 12px); }
.cc-art-portrait { width: 44px; height: 44px; flex: none; border-radius: 6px; image-rendering: pixelated; }
.cc-art-item { display: inline-block; width: 22px; height: 22px; vertical-align: -5px; margin-inline-end: 4px; border-radius: 4px; background: transparent; color: var(--cc-ink-2); }
.cc-art-item > .cc-item-fallback { display: grid; place-items: center; }
.cc-art-title { width: 100%; height: 100%; min-height: 220px; }
.cc-inline { display: inline-flex; align-items: center; gap: 4px; }

/* ---- title */
.cc-title { flex: 1; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); min-height: 0; }
.cc-title-art { position: relative; background: var(--cc-night); }
.cc-title-art .cc-art { position: absolute; inset: 0; }
.cc-title-body { padding: 32px clamp(16px, 4vw, 48px); display: flex; flex-direction: column; gap: 18px; justify-content: center; min-width: 0; }
.cc-title-h { font-size: clamp(2rem, 4vw, 3rem) !important; }
.cc-title-lede { font-size: 1.05rem; color: var(--cc-ink-2); max-width: 36rem; }
.cc-title-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.cc-templates { display: grid; gap: 8px; }
.cc-tpl-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 8px; }
.cc-tpl { width: 100%; text-align: start; display: grid; gap: 2px; padding: 10px 12px; border-radius: var(--r-md, 12px); border: 1px solid var(--cc-line); background: var(--cc-surface); color: var(--cc-ink); cursor: pointer; }
.cc-tpl:hover { background: var(--cc-surface-2); }
.cc-tpl-t { font-weight: 700; } .cc-tpl-d { font-size: 0.85rem; color: var(--cc-muted); }

/* ---- age gate */
.cc-age { flex: 1; display: grid; place-items: center; padding: 24px 12px; background: var(--cc-night); }
.cc-age-card { width: min(100%, 520px); background: var(--cc-surface); color: var(--cc-ink); border: 1px solid var(--cc-line); border-radius: var(--r-lg, 16px); padding: clamp(16px, 4vw, 28px); display: grid; gap: 14px; box-sizing: border-box; }
.cc-age-badge { justify-self: start; font: 700 1.4rem/1 ui-monospace, Menlo, Consolas, monospace; padding: 8px 12px; border-radius: 10px; background: #b3261e; color: #fff; }
.cc-age-form { display: grid; gap: 12px; }
.cc-dob { border: 1px solid var(--cc-line); border-radius: var(--r-md, 12px); padding: 10px 12px 12px; margin: 0; min-width: 0; }
.cc-dob legend { font-weight: 700; padding: 0 4px; }
.cc-dob-row { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.6fr) minmax(0, 1fr); gap: 8px; }
.cc-dob-part { display: grid; gap: 4px; min-width: 0; }

/* ---- setup */
.cc-setup { padding: 16px clamp(12px, 3vw, 32px) 32px; display: grid; gap: 16px; max-width: 1100px; width: 100%; margin: 0 auto; box-sizing: border-box; }
.cc-setup-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cc-setup-foot { display: flex; justify-content: flex-end; }
.cc-seats { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.cc-seat { border: 1px solid var(--cc-line); border-radius: var(--r-md, 12px); padding: 12px; display: grid; gap: 10px; }
.cc-seat > .cc-btn-quiet { justify-self: start; }
.cc-seat-head { display: flex; align-items: center; gap: 8px; }
.cc-seat-head .cc-sprite { margin-inline-start: auto; image-rendering: pixelated; background: var(--cc-night); border-radius: 6px; }
.cc-seat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 10px; align-items: end; }
.cc-portraits { display: flex; flex-wrap: wrap; gap: 6px; }
.cc-portrait-pick { padding: 2px; border: 2px solid transparent; border-radius: 8px; background: none; cursor: pointer; }
.cc-portrait-pick[aria-checked="true"] { border-color: var(--cc-primary); background: var(--cc-info-bg); }
.cc-label { font-weight: 600; font-size: 0.875rem; color: var(--cc-ink-2); margin-bottom: 4px; }

/* ---- game layout */
.cc-game { flex: 1; display: grid; grid-template-rows: auto auto minmax(0, 1fr); min-height: 0; }
/* explicit rows: when the event banner is hidden the board must still take the stretching row (no empty band below) */
.cc-game > .cc-hud { grid-row: 1; } .cc-game > .cc-banner { grid-row: 2; } .cc-game > .cc-board { grid-row: 3; }
.cc-game.cc-hidden-game { visibility: hidden; }
.cc-hud { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 8px 12px; background: var(--cc-surface); border-bottom: 1px solid var(--cc-line); }
.cc-hud-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cc-hud-name { font-weight: 700; } .cc-hud-gang { font-size: 0.85rem; color: var(--cc-muted); }
.cc-hud-stats { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0; flex: 1; min-width: 0; }
.cc-hud-stats > div { display: grid; gap: 2px; min-width: 84px; }
.cc-hud-stats dt { display: flex; align-items: center; gap: 4px; font-size: 0.75rem; color: var(--cc-muted); }
.cc-hud-stats dd { margin: 0; display: grid; gap: 3px; font-weight: 700; }
.cc-up { color: var(--cc-good); } .cc-down { color: var(--cc-bad); }
.cc-hud-btns { display: flex; gap: 8px; margin-inline-start: auto; align-items: center; }
.cc-meter-goal .cc-meter-fill { background: #7a5cc4; }
.cc-meter { display: block; height: 6px; border-radius: 3px; background: var(--cc-surface-3); overflow: hidden; min-width: 60px; }
.cc-meter-fill { display: block; height: 100%; background: var(--cc-primary); }
.cc-meter-heat .cc-meter-fill, .cc-meter-bad .cc-meter-fill { background: #d9483b; }
.cc-meter-rep .cc-meter-fill, .cc-meter-mid .cc-meter-fill { background: #c99212; }
.cc-meter-good .cc-meter-fill, .cc-meter-energy .cc-meter-fill { background: #2e9a50; }
.cc-banner { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 12px; background: var(--cc-info-bg); border-bottom: 1px solid var(--cc-info-line); font-size: 0.875rem; }
.cc-banner-label { font-weight: 700; }
.cc-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; background: var(--cc-surface); border: 1px solid var(--cc-line); }
.cc-board { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 420px); min-height: 0; }
.cc-mapwrap { position: relative; padding: 10px; background: var(--cc-night); min-width: 0; overflow: auto; }
.cc-side { display: grid; grid-template-rows: auto minmax(0, 1fr); border-inline-start: 1px solid var(--cc-line); background: var(--cc-surface); min-height: 0; min-width: 0; }
.cc-tabs { display: flex; flex-wrap: wrap; gap: 2px; padding: 0 8px; border-bottom: 1px solid var(--cc-line); }
.cc-tab { display: inline-flex; align-items: center; gap: 6px; padding: 10px 10px 8px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--cc-muted); cursor: pointer; white-space: nowrap; font-weight: 600; }
.cc-tab[aria-selected="true"] { color: var(--cc-ink); border-bottom-color: var(--cc-primary); }
.cc-panel { overflow: auto; padding: 12px; position: relative; }
.cc-panel:focus { outline: none; }

/* ---- map */
.cc-map { position: relative; aspect-ratio: 16 / 10; width: 100%; border: 3px solid #05070b; box-shadow: inset 2px 2px 0 rgb(255 255 255 / 0.12); border-radius: 4px; overflow: hidden; background: #1a1f27; }
.cc-map-ground { position: absolute; inset: 0; }
.cc-map-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.cc-map-district { font: 700 30px ui-monospace, Menlo, Consolas, monospace; fill: #ffffff; fill-opacity: 0.55; letter-spacing: 2px; }
.cc-map-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4; image-rendering: pixelated; }
.cc-map-legend { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; color: #e6eef0; font-size: 0.85rem; }
.cc-map-legend li { display: inline-flex; align-items: center; gap: 6px; }
.cc-map-swatch { width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgb(255 255 255 / 0.35); }
.cc-map-places { position: absolute; inset: 0; z-index: 3; }
.cc-loc { position: absolute; width: max(26px, 5.4%); aspect-ratio: 1; padding: 0; border: 0; background: none; transform: translate(-50%, -60%); cursor: pointer; border-radius: 4px; }
.cc-loc .cc-art { width: 100%; height: 100%; background: transparent; border-radius: 3px; }
.cc-loc .cc-tile { width: 100%; height: 100%; display: block; }
.cc-loc-far { opacity: 0.55; }
.cc-loc-far:hover, .cc-loc-far:focus-visible { opacity: 1; }
.cc-loc-near .cc-art { box-shadow: 0 0 0 2px #ffe08a; }
.cc-loc-here .cc-art { box-shadow: 0 0 0 3px #ffffff, 0 0 0 5px #0d7480; }
.cc-loc-tip { display: none; position: absolute; top: 100%; left: 50%; transform: translate(-50%, 4px); white-space: nowrap; padding: 3px 8px; border-radius: 6px; background: #0b0f14; color: #fff7e0; font-size: 12px; font-weight: 600; pointer-events: none; z-index: 5; }
.cc-loc:hover .cc-loc-tip, .cc-loc:focus-visible .cc-loc-tip { display: block; }
.cc-ai { position: absolute; inset-inline: 18px; bottom: 18px; z-index: 6; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 12px; background: #0b0f14; color: #fff7e0; border: 2px solid #ffe08a; border-radius: 6px; }
.cc-ai[hidden] { display: none; }
.cc-ai-who { display: flex; gap: 8px; align-items: center; font-weight: 700; }
.cc-ai-text { flex: 1; min-width: 160px; font-size: 0.875rem; }
.cc-ai .cc-btn { background: #fff7e0; color: #0b0f14; border-color: #fff7e0; }

/* ---- place panel */
.cc-place { display: grid; gap: 12px; }
.cc-place-head { display: grid; gap: 8px; }
.cc-place-title p { color: var(--cc-muted); font-size: 0.875rem; }
.cc-actions { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.cc-act { width: 100%; display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 8px; align-items: center; text-align: start; padding: 8px 10px; border: 1px solid var(--cc-line); border-radius: var(--r-md, 12px); background: var(--cc-surface); color: var(--cc-ink); cursor: pointer; }
.cc-act:hover:not([disabled]) { background: var(--cc-surface-2); }
.cc-act-risky { border-inline-start-width: 1px; }
.cc-act-key { font: 700 12px ui-monospace, Menlo, Consolas, monospace; color: var(--cc-muted); }
.cc-act-main { display: grid; gap: 2px; min-width: 0; }
.cc-act-name { font-weight: 700; }
.cc-act-sum { font-size: 0.82rem; color: var(--cc-ink-2); }
.cc-act-steps { font-size: 0.8rem; color: var(--cc-muted); white-space: nowrap; }
.cc-app .cc-act[disabled] .cc-act-sum, .cc-app .cc-act[disabled] .cc-act-steps, .cc-app .cc-act[disabled] .cc-act-key { color: var(--cc-muted); }
.cc-act-why { display: flex; gap: 6px; align-items: center; font-size: 0.82rem; color: var(--cc-ink-2); padding: 4px 10px 0; }
.cc-result .cc-art-wide { max-height: 150px; }
.cc-result { display: grid; gap: 8px; padding: 10px; border-radius: var(--r-md, 12px); background: var(--cc-surface-2); border: 1px solid var(--cc-line); }
.cc-result-list, .cc-news, .cc-week ul { margin: 0; padding-inline-start: 18px; display: grid; gap: 4px; }
.cc-week { padding: 8px 10px; border: 1px solid var(--cc-line); border-radius: var(--r-md, 12px); }
.cc-week summary { font-weight: 700; cursor: pointer; }
.cc-travel, .cc-gang, .cc-rivals, .cc-logp { display: grid; gap: 10px; }
.cc-travel-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.cc-travel-btn { width: 100%; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: center; text-align: start; padding: 6px 8px; border: 1px solid var(--cc-line); border-radius: var(--r-sm, 8px); background: var(--cc-surface); color: var(--cc-ink); cursor: pointer; }
.cc-travel-btn:hover:not([disabled]) { background: var(--cc-surface-2); }
.cc-travel-name { display: grid; font-weight: 600; } .cc-travel-kind { font-weight: 400; font-size: 0.8rem; color: var(--cc-muted); }
.cc-app .cc-travel-btn[disabled] .cc-travel-kind { color: var(--cc-muted); }
.cc-travel-steps { font-size: 0.85rem; white-space: nowrap; }
.cc-members { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.cc-member { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 10px; padding: 8px; border: 1px solid var(--cc-line); border-radius: var(--r-md, 12px); }
.cc-member > div { display: grid; gap: 3px; }
.cc-member-name { font-weight: 700; } .cc-member-stats { font-size: 0.82rem; color: var(--cc-ink-2); }
.cc-facts { margin: 0; display: grid; gap: 6px; }
.cc-facts > div { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--cc-line); }
.cc-facts dt { color: var(--cc-muted); font-size: 0.85rem; } .cc-facts dd { margin: 0; font-size: 0.9rem; }
.cc-table-wrap { overflow-x: auto; position: relative; }
.cc-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; font-variant-numeric: tabular-nums; }
.cc-table caption { text-align: start; font-weight: 700; padding-bottom: 6px; }
.cc-table th, .cc-table td { padding: 6px 8px; border-bottom: 1px solid var(--cc-line); text-align: start; white-space: nowrap; }
.cc-table thead th { background: var(--cc-surface-2); color: var(--cc-ink); }
.cc-table .num { text-align: end; }
.cc-row-current { background: var(--cc-info-bg); }
.cc-dossier { border: 1px solid var(--cc-line); border-radius: var(--r-md, 12px); padding: 8px 10px; }
.cc-dossier summary { cursor: pointer; font-weight: 700; }
.cc-dossier-body { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 10px; margin-top: 8px; }
.cc-log-wrap { max-height: 60vh; overflow: auto; position: relative; }
.cc-log { margin: 0; padding-inline-start: 0; list-style: none; display: grid; gap: 4px; font-size: 0.85rem; }
.cc-log-item { padding: 3px 0; border-bottom: 1px dashed var(--cc-line); }
.cc-log-round { font-weight: 700; color: var(--cc-primary-text); }

/* ---- dialogs */
.cc-dlg { width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 1px solid var(--cc-line); border-radius: var(--r-lg, 16px); background: var(--cc-surface); color: var(--cc-ink); box-shadow: var(--shadow-3, 0 20px 60px rgb(0 0 0 / .35)); }
.cc-dlg-wide { width: min(860px, calc(100vw - 24px)); }
.cc-dlg::backdrop { background: var(--overlay, rgb(8 14 18 / .55)); }
.cc-dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 12px 8px 16px; border-bottom: 1px solid var(--cc-line); position: sticky; top: 0; background: var(--cc-surface); z-index: 1; }
.cc-dlg-head h2 { font-size: 1.2rem; }
.cc-dlg-body { padding: 14px 16px 16px; display: grid; gap: 12px; }
.cc-dlg-lede { padding: 0 16px; color: var(--cc-muted); }
.cc-dlg-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.cc-dlg .cc-art-wide { max-height: 220px; }
.cc-dlg-body > .cc-art-wide { aspect-ratio: auto; height: clamp(140px, 26vw, 220px); }
.cc-plan { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.cc-plan-form, .cc-plan-odds { display: grid; gap: 10px; align-content: start; min-width: 0; }
.cc-odds { display: grid; gap: 10px; padding: 12px; border-radius: var(--r-md, 12px); background: var(--cc-surface-2); border: 1px solid var(--cc-line); }
.cc-odds-big { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; align-items: center; }
.cc-odds-pct { grid-row: span 2; font: 700 2rem/1 ui-monospace, Menlo, Consolas, monospace; }
.cc-odds-list { margin: 0; display: grid; gap: 4px; }
.cc-odds-row { display: flex; justify-content: space-between; gap: 12px; font-size: 0.88rem; }
.cc-odds-row dt { color: var(--cc-ink-2); } .cc-odds-row dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; text-align: end; }
.cc-good dd { color: var(--cc-good); } .cc-bad dd { color: var(--cc-bad); }
.cc-odds-notes { margin: 0; padding-inline-start: 18px; font-size: 0.82rem; color: var(--cc-ink-2); }
.cc-crew { border: 1px solid var(--cc-line); border-radius: var(--r-md, 12px); padding: 8px 10px; margin: 0; display: grid; gap: 6px; min-width: 0; }
.cc-crew legend { font-weight: 700; padding: 0 4px; }
.cc-crew-row { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 8px; align-items: center; }
.cc-crew-row label { display: grid; grid-template-columns: 44px minmax(0, 1fr); grid-template-rows: auto auto auto; column-gap: 8px; font-weight: 400; color: var(--cc-ink); cursor: pointer; }
.cc-crew-row label .cc-art { grid-row: span 3; }
.cc-crew-name { font-weight: 700; } .cc-crew-stats { font-size: 0.78rem; color: var(--cc-ink-2); }
.cc-choices { display: grid; gap: 8px; }
.cc-choice { width: 100%; display: grid; gap: 2px; text-align: start; padding: 10px 12px; border: 1px solid var(--cc-line-strong); border-radius: var(--r-md, 12px); background: var(--cc-surface); color: var(--cc-ink); cursor: pointer; }
.cc-choice:hover:not([disabled]) { background: var(--cc-surface-2); }
.cc-choice-t { font-weight: 700; } .cc-choice-d { font-size: 0.85rem; color: var(--cc-ink-2); }
.cc-app .cc-choice[disabled] .cc-choice-d { color: var(--cc-muted); }
.cc-fight { display: grid; gap: 8px; }
.cc-fight-canvas { width: 100%; height: auto; aspect-ratio: 800 / 360; image-rendering: pixelated; border: 3px solid #05070b; border-radius: 4px; background: var(--cc-night); }
.cc-fight-log-wrap { max-height: 120px; overflow: auto; position: relative; font-size: 0.82rem; }
.cc-fight-log { margin: 0; padding-inline-start: 18px; }
.cc-fight-outcome { font-weight: 600; padding: 8px 12px; border-radius: var(--r-md, 12px); border: 1px solid var(--cc-line); background: var(--cc-surface-2); }
.cc-fight-outcome strong { margin-inline-end: 4px; }
.cc-fight-won { border-color: var(--cc-good); } .cc-fight-won strong { color: var(--cc-good); }
.cc-fight-lost { border-color: var(--cc-bad); } .cc-fight-lost strong { color: var(--cc-bad); }
.cc-fight-outcome:empty { display: none; }

/* ---- animated result scenes (fx.js resultScene) */
.cc-scene { position: relative; overflow: hidden; border-radius: var(--r-md, 12px); background: var(--cc-night); aspect-ratio: 16 / 9; }
.cc-scene > .cc-scene-art { position: absolute; inset: 0; border-radius: 0; aspect-ratio: auto; max-height: none !important; height: 100%; }
.cc-scene-anim > .cc-scene-art { animation: cc-push 2.4s cubic-bezier(.2,.8,.2,1) both; }
.cc-scene-fx { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; pointer-events: none; }
.cc-scene-cap { position: absolute; inset-inline: 0; bottom: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 18px 12px 8px; background: linear-gradient(transparent, rgb(5 7 11 / 0.85) 45%); color: #fff7e0; }
.cc-scene-cap:empty { display: none; }
.cc-scene-title { font: 800 1.15rem/1.1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: 0.02em; }
.cc-scene-amount { font-weight: 800; font-size: 1.15rem; color: #9ff0a8; }
.cc-scene-rep { font-weight: 700; font-size: 0.85rem; color: #ffe08a; }
.cc-scene-anim .cc-scene-cap { animation: cc-rise 0.5s 0.2s cubic-bezier(.2,.8,.2,1) both; }
.cc-dlg .cc-scene { max-height: none; }
.cc-result .cc-scene { max-height: 170px; aspect-ratio: auto; height: 170px; }
@keyframes cc-push { from { transform: scale(1.12); filter: brightness(0.6); } to { transform: scale(1); filter: none; } }
@keyframes cc-rise { from { transform: translateY(100%); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---- HUD number flashes and the turn banner */
.cc-bump { display: inline-block; animation: cc-bump 0.7s cubic-bezier(.2,.8,.2,1); }
@keyframes cc-bump { 0% { transform: scale(1); } 25% { transform: scale(1.22); } 100% { transform: scale(1); } }
.cc-turn-banner { position: absolute; top: 24px; inset-inline-start: 50%; z-index: 7; display: flex; align-items: center; gap: 10px; padding: 8px 18px 8px 8px; transform: translateX(-50%); background: #0b0f14; color: #fff7e0; border: 2px solid #ffe08a; border-radius: 8px; box-shadow: 0 8px 24px rgb(0 0 0 / .45); pointer-events: none; animation: cc-banner 1.9s cubic-bezier(.2,.8,.2,1) both; }
[dir="rtl"] .cc-turn-banner { transform: translateX(50%); animation-name: cc-banner-rtl; }
.cc-turn-banner > span { display: grid; }
.cc-turn-banner strong { font: 800 1.05rem/1.2 ui-monospace, Menlo, Consolas, monospace; }
.cc-turn-banner span span { font-size: 0.8rem; color: #e6eef0; }
@keyframes cc-banner { 0% { opacity: 0; transform: translate(-50%, -16px); } 15%, 80% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, -8px); } }
@keyframes cc-banner-rtl { 0% { opacity: 0; transform: translate(50%, -16px); } 15%, 80% { opacity: 1; transform: translate(50%, 0); } 100% { opacity: 0; transform: translate(50%, -8px); } }
.cc-ho-red { border-color: #e0453a !important; } .cc-ho-blue { border-color: #3d82e8 !important; } .cc-ho-green { border-color: #3fae5a !important; } .cc-ho-gold { border-color: #e3b236 !important; }
.cc-reduced *, .cc-reduced *::before, .cc-reduced *::after { animation: none !important; transition: none !important; }
.cc-opts { border: 1px solid var(--cc-line); border-radius: var(--r-md, 12px); padding: 8px 12px 12px; margin: 0; display: grid; gap: 8px; align-content: start; min-width: 0; }
.cc-opts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 12px; align-items: start; }
.cc-opts-col { display: grid; gap: 12px; align-content: start; min-width: 0; }
.cc-opts legend { font-weight: 700; padding: 0 4px; }
.cc-slots { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.cc-slot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; padding: 8px 10px; border: 1px solid var(--cc-line); border-radius: var(--r-md, 12px); }
.cc-slot-name { font-weight: 700; } .cc-slot-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.cc-save-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.cc-help { margin: 0; padding-inline-start: 20px; display: grid; gap: 6px; }
.cc-keys th { width: 7em; }
.cc-app kbd { font: 600 0.85em ui-monospace, Menlo, Consolas, monospace; padding: 1px 6px; border: 1px solid var(--cc-line-strong); border-bottom-width: 2px; border-radius: 4px; background: var(--cc-surface); color: var(--cc-ink); }
.cc-errors { margin: 0; padding-inline-start: 18px; color: var(--cc-ink); }

/* ---- menus (dom.js menuButton) */
.cc-menu-wrap { position: relative; }
.cc-menu-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 10px; border: 1px solid var(--cc-line-strong); border-radius: var(--r-btn, 8px); background: var(--cc-surface); color: var(--cc-ink); cursor: pointer; font-weight: 600; }
.cc-menu-btn:hover { background: var(--cc-surface-2); }
.cc-menu { position: fixed; z-index: 50; min-width: 240px; max-height: min(80vh, 640px); overflow: auto; padding: 4px; background: var(--cc-surface); border: 1px solid var(--cc-line); border-radius: var(--r-md, 12px); box-shadow: var(--shadow-2, 0 8px 24px rgb(0 0 0 / .2)); }
.cc-menu-item { width: 100%; display: flex; justify-content: space-between; gap: 16px; min-height: 36px; padding: 6px 10px; border: 0; border-radius: var(--r-sm, 8px); background: none; color: var(--cc-ink); text-align: start; cursor: pointer; }
.cc-menu-item:hover, .cc-menu-item:focus { background: var(--cc-surface-2); }
.cc-menu-item[aria-disabled="true"] { color: var(--cc-muted); cursor: not-allowed; }
.cc-menu-key { color: var(--cc-muted); font-family: ui-monospace, Menlo, Consolas, monospace; }
.cc-menu-sep { height: 1px; margin: 4px 6px; background: var(--cc-line); }

/* ---- hand-over, toast, victory */
.cc-handover { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; background: var(--cc-night); overflow: hidden; }
.cc-handover[hidden] { display: none; }
.cc-handover-bg { position: absolute; inset: 0; opacity: 0.45; }
.cc-handover-bg .cc-art { position: absolute; inset: 0; }
.cc-handover-card { position: relative; width: min(100%, 460px); display: grid; gap: 12px; justify-items: center; text-align: center; padding: 24px; border-radius: var(--r-lg, 16px); background: var(--cc-surface); color: var(--cc-ink); border: 3px solid var(--cc-line); box-sizing: border-box; box-shadow: 0 20px 60px rgb(0 0 0 / .5); }
.cc-handover-anim .cc-handover-card { animation: cc-rise 0.45s cubic-bezier(.2,.8,.2,1) both; }
.cc-handover-anim .cc-handover-bg .cc-art { animation: cc-push 6s ease-out both; }
.cc-handover-card .cc-art-portrait { width: 96px; height: 96px; }
.cc-ho-week { font: 800 0.85rem/1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: 0.08em; text-transform: uppercase; color: var(--cc-muted); }
.cc-ho-who { display: flex; align-items: flex-end; gap: 10px; }
.cc-ho-who .cc-sprite { image-rendering: pixelated; background: var(--cc-night); border-radius: 8px; }
.cc-toast { position: fixed; inset-inline-end: 16px; bottom: 16px; z-index: 60; max-width: min(420px, calc(100vw - 32px)); padding: 10px 14px; border-radius: var(--r-md, 12px); background: var(--cc-surface); color: var(--cc-ink); border: 1px solid var(--cc-line); box-shadow: var(--shadow-2, 0 8px 24px rgb(0 0 0 / .2)); font-weight: 600; }
.cc-toast-error { border-color: var(--cc-bad); } .cc-toast-good { border-color: var(--cc-good); }
.cc-over { padding: 16px clamp(12px, 3vw, 32px) 32px; display: grid; gap: 16px; max-width: 980px; width: 100%; margin: 0 auto; box-sizing: border-box; }
.cc-over > .cc-art-wide { max-height: 300px; aspect-ratio: auto; height: 260px; }
.cc-over > .cc-over-hero { aspect-ratio: auto; height: clamp(200px, 34vw, 320px); }
.cc-app :is(h1, h2)[tabindex="-1"]:focus { outline: none; }
.cc-replay { display: grid; gap: 10px; }
.cc-replay-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
.cc-replay-item { display: grid; gap: 6px; padding: 8px; border: 1px solid var(--cc-line); border-radius: var(--r-md, 12px); }

/* ---- polish run (w44-polish): place mood, coach tips, advisor, quick repeat, week report, charts, achievements, hall of fame */
.cc-place-mood { font-style: italic; color: var(--cc-ink-2); font-size: 0.9rem; margin-top: 2px; }
.cc-tip, .cc-hintcard { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 10px; align-items: start; padding: 10px 12px; border-radius: var(--r-md, 12px); background: var(--cc-info-bg); border: 1px solid var(--cc-info-line); }
.cc-tip > svg { color: var(--cc-primary-text); margin-top: 2px; }
.cc-tip-btns { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.cc-hintcard { grid-template-columns: minmax(0, 1fr); border-color: #7a5cc4; background: color-mix(in srgb, #7a5cc4 12%, var(--cc-surface)); }
.cc-again { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.cc-loc.cc-loc-hint .cc-art { box-shadow: 0 0 0 3px #b79cff, 0 0 0 6px rgb(122 92 196 / 0.55); }
.cc-app:not(.cc-reduced) .cc-loc.cc-loc-hint { animation: cc-hint-pulse 1.2s ease-in-out infinite alternate; }
@keyframes cc-hint-pulse { from { filter: brightness(1); } to { filter: brightness(1.35) drop-shadow(0 0 6px #b79cff); } }
.cc-end-bottom { display: none; width: 100%; margin-top: 4px; }
.cc-week { display: grid; gap: 8px; min-width: 0; grid-template-columns: minmax(0, 1fr); } /* the standings scroll inside the panel instead of widening it (seen in RTL) */
.cc-week-table td, .cc-week-table th { padding: 4px 8px; }
.cc-advice { margin-top: 4px; }
.cc-advice summary { cursor: pointer; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.cc-advice p { margin-top: 4px; }
.cc-chart-block { display: grid; gap: 8px; min-width: 0; }
.cc-chart-block .cc-field { max-width: 240px; }
.cc-chart-host { min-width: 0; }
.cc-chart { width: 100%; height: auto; display: block; background: var(--cc-surface); border: 1px solid var(--cc-line); border-radius: var(--r-md, 12px); }
.cc-chart-grid { stroke: var(--cc-line); stroke-width: 1; }
.cc-chart-label { fill: var(--cc-muted); font-size: 12px; font-family: var(--font-sans); }
.cc-chart-empty { fill: var(--cc-muted); font-size: 14px; }
.cc-chart-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.9rem; }
.cc-chart-legend li { display: inline-flex; align-items: center; gap: 6px; }
.cc-ach-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 8px; }
.cc-ach { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: var(--r-md, 12px); border: 1px solid var(--cc-line); }
.cc-ach-got { background: color-mix(in srgb, #c99212 12%, var(--cc-surface)); border-color: #c99212; }
.cc-ach-got .cc-ach-icon { color: #9a6c00; }
.cc-app[data-theme="dark"] .cc-ach-got .cc-ach-icon { color: #ffd166; }
.cc-ach-locked .cc-ach-icon { color: var(--cc-muted); }
.cc-ach-name { font-weight: 700; }
.cc-hall { display: grid; gap: 6px; }
.cc-hall-list { margin: 0; padding-inline-start: 22px; display: grid; gap: 4px; }
.cc-hall-list li { display: list-item; }
.cc-hall-who { font-weight: 600; }
.cc-hall-meta { display: block; color: var(--cc-muted); font-size: 0.85rem; }
.cc-seat-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.cc-seat-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--cc-line); border-radius: var(--r-md, 12px); }
.cc-seat-row > div:last-child { grid-column: 1 / -1; }
.cc-seat-row > div:last-child:empty { display: none; }

/* ---- responsive */
@media (max-width: 1000px) {
  .cc-end-bottom { display: flex; }
  .cc-board { grid-template-columns: minmax(0, 1fr); }
  .cc-side { border-inline-start: 0; border-top: 1px solid var(--cc-line); }
  .cc-panel { max-height: none; }
  .cc-title { grid-template-columns: minmax(0, 1fr); }
  .cc-title-art { min-height: 200px; }
}
@media (max-width: 700px) {
  .cc-hud-btns { margin-inline-start: 0; width: 100%; }
  .cc-hud-btns .cc-end { flex: 1; }
  .cc-mapwrap { padding: 6px; }
  .cc-map { min-width: 620px; }
  .cc-plan { grid-template-columns: minmax(0, 1fr); }
  .cc-hud { gap: 8px; }
  .cc-hud-who { flex: 1 1 auto; }
  .cc-hud-stats { flex: 1 1 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 10px; }
  .cc-hud-stats > div { min-width: 0; }
  .cc-btn, .cc-menu-btn { min-height: 44px; }
  .cc-save-row { grid-template-columns: minmax(0, 1fr); }
  .cc-ai { inset-inline: 8px; bottom: 8px; position: sticky; margin-top: 8px; }
}
@media (max-width: 360px) {
  .cc-dob-row { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .cc-app *, .cc-app *::before, .cc-app *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
