/* Shared palette. Legacy declarations retain their exact light color as fallback.
   New UI can use --bg / --surface / --text / --border directly. */
:root{color-scheme:light;--bg:#f7f4ec;--surface:#fffefa;--surface-raised:#f0f2ec;--text:#242b2a;--text-muted:#818984;--border:#e9e6dc}
html[data-theme="dark"]{
  color-scheme:dark;
  --bg:#151d19;--surface:#202925;--surface-raised:#28332e;--text:#e8eee9;--text-muted:#b9c7be;--border:#405047;
  --ink:var(--text);--paper:var(--surface);--line:var(--border);--muted:var(--text-muted);
  --theme-canvas:var(--bg);--theme-paper:var(--surface);--theme-raised:var(--surface-raised);
  --theme-ink:var(--text);--theme-muted:var(--text-muted);--theme-line:var(--border);
  --theme-fire:#ffa38c;--theme-water:#91ccec;--theme-forest:#86dfad;--theme-gold:#e7ca79;--theme-purple:#cbb2f2;
  --theme-focus:#86dfad;
  --theme-tint-fire:#3c2b29;--theme-tint-water:#243540;--theme-tint-forest:#2b3c32;--theme-tint-gold:#3a3427;--theme-tint-purple:#342d40;
}
.theme-toggle{display:inline-flex;align-items:center;justify-content:center;flex:0 0 36px;width:36px;min-height:36px;padding:4px;border:1px solid var(--border);border-radius:9px;background:var(--surface);color:var(--text);font:inherit;font-size:19px;cursor:pointer;line-height:1}
.theme-toggle:focus-visible{outline:2px solid var(--theme-focus,var(--green,#25785d));outline-offset:3px}
.topbar{gap:8px}.topbar>.brand{min-width:0}.topbar>.prototype-tag{margin-left:auto}
@media(max-width:480px){.topbar>.prototype-tag{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.topbar>.brand{letter-spacing:.04em}.theme-toggle{flex-basis:36px}}

/* Shared navigation: brand at left, page actions / TOP / theme grouped at right.
   Page-specific header heights and navigation event handlers remain in place. */
.game-shell .topbar.site-header{justify-content:flex-start;flex-wrap:nowrap;gap:16px}
.game-shell .topbar.site-header>.brand{flex:0 0 auto;white-space:nowrap}
.game-shell .topbar.site-header>.header-actions{display:flex;align-items:center;flex:0 0 auto;gap:8px;margin-left:auto}
.game-shell .topbar.site-header .header-top-link{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;min-height:44px;margin:0;padding:8px 12px;border:1px solid var(--border);border-radius:9px;background:var(--surface);color:var(--text);font:inherit;font-size:13px;line-height:1.4;white-space:nowrap;text-decoration:none}
.game-shell .topbar.site-header .header-top-link:hover{background:var(--surface-raised);border-color:var(--theme-forest,#25785d)}
.game-shell .topbar.site-header .header-top-link:focus-visible{outline:2px solid var(--theme-focus,#25785d);outline-offset:3px}
.game-shell .topbar.site-header .theme-toggle{margin:0;flex:0 0 44px;width:44px;min-height:44px}
@media(max-width:480px){
  .game-shell .topbar.site-header{gap:8px}
  .game-shell .topbar.site-header>.brand{font-size:11px;letter-spacing:.02em;gap:5px}
  .game-shell .topbar.site-header>.brand .brand-mark{width:26px;height:26px;font-size:18px;flex-shrink:0}
  .game-shell .topbar.site-header>.header-actions{gap:6px}
  .game-shell .topbar.site-header .header-top-link{font-size:12px;padding:8px 9px}
  .game-shell .topbar.site-header #run-menu-open{font-size:12px;padding:7px;min-width:0;min-height:44px}
}
