/* STARNET titlebar.css — custom window chrome (Windows desktop shell only).
   Rendered by app/titlebar.js when the Rust shell removes the native Windows
   titlebar (decorations(false)) and stamps __STARNET_CUSTOM_CHROME__. Everything
   rides the body.theme-* phosphor vars so MIN/MAX/CLOSE re-tint with the
   Commander's chosen theme. Inert (display:none + zero layout shift) unless
   body.sn-chrome is set, so browser preview / macOS never see it.
   Theming trap note: no composite shadow vars are minted here — every rule
   references var(--ph*) directly, so theme switches re-tint live. */

:root { --sn-tb-h: 34px; }

#sn-titlebar { display: none; }

body.sn-chrome #sn-titlebar {
  display: flex; align-items: stretch;
  position: fixed; top: 0; left: 0; right: 0; height: var(--sn-tb-h);
  /* under the CRT glass (scanlines z950 / vignette z940) so the bar reads as part
     of the same tube, above every .screen (z10) and the fixed logo's siblings */
  z-index: 930;
  background:
    linear-gradient(180deg, rgba(var(--ph-rgb), .08), rgba(var(--ph-rgb), .02) 70%),
    #050403;
  border-bottom: 1px solid var(--ph-dim);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .85), 0 0 16px var(--ph-glow2);
  font-family: 'VT323', 'Courier New', monospace;
  user-select: none; -webkit-user-select: none;
  cursor: default;
}

body.sn-chrome .sn-tb-mark {
  display: flex; align-items: center; padding: 0 14px;
  color: var(--ph); font-size: 17px; letter-spacing: 4px;
  text-shadow: 0 0 10px var(--ph-glow), 0 0 2px var(--ph-glow);
}
body.sn-chrome .sn-tb-rule { flex: 1 1 auto; } /* empty drag runway */

body.sn-chrome .sn-tb-controls { display: flex; align-items: stretch; }
body.sn-chrome .sn-tb-btn {
  width: 46px; border: none; background: transparent; cursor: pointer;
  color: var(--ph-dim); padding: 0; display: flex; align-items: center; justify-content: center;
  outline-offset: -2px;
}
body.sn-chrome .sn-tb-btn:hover {
  color: var(--ph-bright);
  background: rgba(var(--ph-rgb), .12);
  box-shadow: inset 0 -2px 0 var(--ph);
}
body.sn-chrome .sn-tb-btn:focus-visible { outline: 2px solid var(--ph); }
/* close stays phosphor at rest, goes hazard-red on hover in EVERY theme */
body.sn-chrome .sn-tb-x:hover {
  color: #ffc9c2;
  background: rgba(255, 65, 54, .24);
  box-shadow: inset 0 -2px 0 #ff4136;
}

/* pixel-drawn glyphs (no font-coverage risk; VT323 lacks the window-control set) */
body.sn-chrome .sn-ic { display: block; position: relative; width: 12px; height: 12px; }
body.sn-chrome .sn-ic-min::before {
  content: ''; position: absolute; left: 1px; right: 1px; bottom: 4px; height: 2px;
  background: currentColor;
}
/* MAX/RESTORE: inline SVG (titlebar.js), not pseudo-element bars — CSS bar art lands on
   fractional device pixels under Windows display scaling / TEXT SIZE zoom and shredded the
   restore glyph twice (2026-07-20 reports). Vector strokes rescale cleanly at any factor.
   RESTORE is the classic pair: front frame lower-left, back frame's top-right L peeking. */
body.sn-chrome .sn-ic-max svg {
  position: absolute; inset: 0; width: 12px; height: 12px;
  fill: none; stroke: currentColor; stroke-width: 1.7;
}
body.sn-chrome .sn-g-restore { display: none; }
body.sn-chrome .sn-tb-btn.is-max .sn-g-max { display: none; }
body.sn-chrome .sn-tb-btn.is-max .sn-g-restore { display: block; }
body.sn-chrome .sn-ic-close::before,
body.sn-chrome .sn-ic-close::after {
  content: ''; position: absolute; left: -1px; right: -1px; top: 5px; height: 2px;
  background: currentColor;
}
body.sn-chrome .sn-ic-close::before { transform: rotate(45deg); }
body.sn-chrome .sn-ic-close::after { transform: rotate(-45deg); }

/* ---- layout shift: every screen (fixed, inset:0) drops below the bar.
   #screen-game.active IS the game grid, so this one rule re-sizes the whole app. ---- */
body.sn-chrome .screen { top: var(--sn-tb-h); }
/* REFIT mode is its own fixed overlay (not a .screen) with its OWN top toolbar —
   without this its ✓ DONE row sits under the titlebar (z930 > z80) and is unclickable */
body.sn-chrome .refit-overlay { top: var(--sn-tb-h); }

/* fullscreen (F11): no window chrome to manage — hide the bar, reclaim the strip */
body.sn-chrome.sn-fs #sn-titlebar { display: none; }
body.sn-chrome.sn-fs .screen { top: 0; }
body.sn-chrome.sn-fs .refit-overlay { top: 0; }
