/* NEEDS IT BY FIVE - style.css : tokens, stage, FX layers, shared UI kit.
   Engine screens live in css/*.css. Modules inject their own scoped CSS with NBF.util.injectStyle(). */

:root {
  --font-ui: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
  --font-display: Impact, Haettenschweiler, "Arial Narrow Bold", "Franklin Gothic Heavy", "Arial Black", sans-serif;

  /* work (cold fluorescent) */
  --w-bg: #0b1114; --w-panel: #10191d; --w-panel2: #16252b; --w-line: #2c4750;
  --w-ink: #d6ece6; --w-dim: #8aa8a2;
  /* home (warm dusk) */
  --h-bg: #1d1426; --h-panel: #2a1f35; --h-panel2: #352845; --h-line: #5d4a6c;
  --h-ink: #f6ebdf; --h-dim: #c4aeb8;
  /* signals */
  --calm: #6ee7b7; --good: #7be0a0; --warn: #ffc857; --bad: #ff5a5a; --amber: #ff9f43;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #000; overflow: hidden; }
body { font-family: var(--font-ui); color: var(--w-ink); -webkit-font-smoothing: antialiased; }
button { font-family: inherit; }
::selection { background: #ffc85766; }

/* ---------- viewport / stage ---------- */
#viewport { position: fixed; inset: 0; background: #000; overflow: hidden; display: flex; align-items: center; justify-content: center; }
#stage { width: 1280px; height: 720px; position: relative; flex: none; overflow: hidden; background: var(--w-bg); transform-origin: center center; isolation: isolate; }
#inner { position: absolute; inset: 0; } /* needs real size: its filter makes it the containing block for the screens */
.screen { position: absolute; inset: 0; display: none; }
.screen.active { display: block; }
.fade-in { animation: nbf-fade .45s ease both; }
@keyframes nbf-fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- FX layers (above screens) ---------- */
#fx-noise { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; pointer-events: none; mix-blend-mode: screen; opacity: 0; z-index: 80; }
#fx-vignette { position: absolute; inset: 0; pointer-events: none; z-index: 81; --v: 0;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0) calc(62% - var(--v) * 26%), rgba(10,0,0,calc(.35 + var(--v) * .55)) 100%); }
#fx-red { position: absolute; inset: 0; pointer-events: none; z-index: 82; background: radial-gradient(ellipse at center, rgba(255,20,20,0) 40%, rgba(160,0,0,.55) 100%); opacity: 0; }
#fx-scan { position: absolute; inset: 0; pointer-events: none; z-index: 83; opacity: .16;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0, rgba(0,0,0,0) 2px, rgba(0,0,0,.55) 3px, rgba(0,0,0,0) 4px); }
#fx-flash { position: absolute; inset: 0; pointer-events: none; z-index: 90; background: #fff; opacity: 0; }
#fx-dark { position: absolute; inset: 0; pointer-events: none; z-index: 89; background: #000; opacity: 0; transition: opacity .25s; }

/* shake: applied to #stage-inner so FX layers stay put */
@keyframes nbf-shake-a { 0%,100% { transform: translate(0,0); } 20% { transform: translate(-7px,3px); } 40% { transform: translate(6px,-4px); } 60% { transform: translate(-4px,-3px); } 80% { transform: translate(5px,4px); } }
@keyframes nbf-shake-b { 0%,100% { transform: translate(0,0) rotate(0); } 25% { transform: translate(-2px,1px) rotate(-.15deg); } 50% { transform: translate(2px,-1px) rotate(.15deg); } 75% { transform: translate(-1px,-2px) rotate(-.1deg); } }
.shake { animation: nbf-shake-a .28s linear 3; }
.shake-soft { animation: nbf-shake-b .18s linear 2; }
.reduce-shake .shake, .reduce-shake .shake-soft { animation: none; }

/* ---------- shared keyframes modules may use ---------- */
@keyframes nbf-pop { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }
@keyframes nbf-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes nbf-wiggle { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-3deg); } 75% { transform: rotate(3deg); } }
@keyframes nbf-floatup { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-46px); opacity: 0; } }
@keyframes nbf-blink { 50% { opacity: .25; } }
@keyframes nbf-flicker { 0%,19%,21%,60%,62%,100% { opacity: 1; } 20%,61% { opacity: .35; } 63% { opacity: .7; } }

/* ---------- UI kit (use these in modules) ---------- */
.nbf-host { position: relative; overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: none; font: 500 15px/1.35 var(--font-ui); }
.theme-work { --ink: var(--w-ink); --dim: var(--w-dim); --panel: var(--w-panel); --panel2: var(--w-panel2); --line: var(--w-line); --accent: #ffc857; color: var(--ink); background: var(--panel); }
.theme-home { --ink: var(--h-ink); --dim: var(--h-dim); --panel: var(--h-panel); --panel2: var(--h-panel2); --line: var(--h-line); --accent: #ffb86b; color: var(--ink); background: var(--panel); }

.btn { font: 600 15px/1 var(--font-ui); color: var(--ink, #d6ece6); background: var(--panel2, #16252b); border: 1px solid var(--line, #2c4750); border-radius: 9px; padding: 10px 16px; cursor: pointer;
  transition: transform .08s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease; user-select: none; letter-spacing: .01em; }
.btn:hover { border-color: var(--accent, #ffc857); box-shadow: 0 0 0 2px rgba(255,200,87,.15); }
.btn:active { transform: translateY(1px) scale(.985); }
.btn.primary { background: #1f6f5c; border-color: #46c19c; color: #eafff7; }
.btn.primary:hover { background: #26856f; }
.btn.danger { background: #6f1f28; border-color: #c24655; color: #ffecee; }
.btn.big { font-size: 18px; padding: 14px 22px; }
.btn.small { font-size: 13px; padding: 7px 11px; }
.btn:disabled, .btn.disabled { opacity: .42; cursor: not-allowed; pointer-events: none; }
.btn:focus-visible { outline: 2px solid var(--accent, #ffc857); outline-offset: 2px; }

.panel { background: var(--panel2, #16252b); border: 1px solid var(--line, #2c4750); border-radius: 12px; padding: 12px 14px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; background: rgba(255,255,255,.07); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.kbd { display: inline-block; min-width: 22px; padding: 2px 6px; text-align: center; border: 1px solid var(--line, #2c4750); border-bottom-width: 2px; border-radius: 5px; background: rgba(255,255,255,.06); font: 700 12px var(--font-mono); }
.mg-title { font: 800 19px/1.2 var(--font-ui); letter-spacing: .01em; }
.mg-sub { color: var(--dim, #8aa8a2); font-size: 13px; }
.mg-ticket { background: #f3ecd2; color: #2c2618; border-radius: 4px; box-shadow: 0 6px 14px rgba(0,0,0,.45); padding: 10px 14px; font: 700 15px/1.35 var(--font-mono); transform: rotate(-.6deg); }
.mg-note { background: #ffe97a; color: #3a3210; padding: 10px 12px; font: 600 14px/1.3 "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive; box-shadow: 0 6px 12px rgba(0,0,0,.4); transform: rotate(1.2deg); }
.mg-ok { color: var(--good); } .mg-bad { color: var(--bad); }
.mg-float { position: absolute; pointer-events: none; font: 800 18px var(--font-ui); text-shadow: 0 2px 6px rgba(0,0,0,.6); animation: nbf-floatup .9s ease-out forwards; z-index: 20; }
.mg-banner { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); padding: 12px 26px; border-radius: 12px; font: 900 34px var(--font-display); letter-spacing: .06em;
  background: rgba(0,0,0,.72); border: 2px solid currentColor; animation: nbf-pop .35s ease both; z-index: 30; pointer-events: none; }
.hidden { display: none !important; }
