/* CYBERMOVIE — cinematic fake-hacker terminal styles
   System monospace only; no external fonts/CDNs. */

:root {
  --bg: #050805;
  --bg-pane: #0a0f0c;
  --bg-chrome: #0d1410;
  --border: #1a2e22;
  --border-bright: #2a4a38;
  --green: #33ff66;
  --green-dim: #1a9940;
  --green-glow: rgba(51, 255, 102, 0.35);
  --cyan: #40f0ff;
  --cyan-dim: #1a8899;
  --amber: #ffcc33;
  --amber-dim: #997720;
  --red: #ff4466;
  --text: #b8f5c8;
  --text-dim: #4a7a58;
  --font: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
  --chrome-h: 28px;
  --top-h: 40px;
  --foot-h: 28px;
  --gap: 4px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
}

body {
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Scanlines + vignette overlays */
#scanlines {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.12) 0px,
    rgba(0, 0, 0, 0.12) 1px,
    transparent 1px,
    transparent 3px
  );
  opacity: 0.45;
  mix-blend-mode: multiply;
}

#vignette {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 49;
  background: radial-gradient(
    ellipse at center,
    transparent 50%,
    rgba(0, 0, 0, 0.55) 100%
  );
}

/* Top bar */
#topbar {
  flex: 0 0 var(--top-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  background: linear-gradient(180deg, #0e1612 0%, #080c09 100%);
  border-bottom: 1px solid var(--border);
  z-index: 10;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.brand-mark {
  color: var(--cyan);
  text-shadow: 0 0 8px var(--cyan);
  font-size: 14px;
}

.brand-title {
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--green);
  text-shadow: 0 0 10px var(--green-glow);
}

.brand-sep {
  color: var(--text-dim);
}

.brand-sub {
  color: var(--cyan-dim);
  letter-spacing: 0.06em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.clock {
  color: var(--amber);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
}

.pill {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid var(--green-dim);
  color: var(--green);
  border-radius: 2px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.pill-dim {
  border-color: var(--border-bright);
  color: var(--text-dim);
}

/* Grid of panes */
#grid {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 1.15fr 1fr 0.95fr;
  grid-template-rows: 1fr 1fr;
  gap: var(--gap);
  padding: var(--gap);
  min-height: 0;
  background: #020403;
}

.pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  background: var(--bg-pane);
  border: 1px solid var(--border);
  box-shadow: inset 0 0 40px rgba(0, 40, 20, 0.25);
  position: relative;
  overflow: hidden;
}

.pane::after {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 1px var(--green-dim);
  opacity: 0.3;
}

.pane-chrome {
  flex: 0 0 var(--chrome-h);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  background: var(--bg-chrome);
  border-bottom: 1px solid var(--border);
  user-select: none;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  opacity: 0.7;
}
.dot.r { background: #ff5f56; }
.dot.y { background: #ffbd2e; }
.dot.g { background: #27c93f; }

.pane-title {
  margin-left: 6px;
  color: var(--text-dim);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pane-body {
  flex: 1 1 auto;
  margin: 0;
  padding: 6px 8px;
  overflow: hidden;
  white-space: pre;
  font-family: var(--font);
  font-size: 11px;
  line-height: 1.3;
  color: var(--green);
  text-shadow: 0 0 4px rgba(51, 255, 102, 0.25);
  user-select: none;
  cursor: default;
}

.pane[data-pane="hex"] .pane-body {
  color: var(--cyan);
  text-shadow: 0 0 4px rgba(64, 240, 255, 0.2);
  font-size: 10px;
}

.pane[data-pane="net"] .pane-body {
  color: #7dffb0;
  font-size: 10px;
}

.pane[data-pane="proc"] .pane-body {
  color: var(--amber);
  text-shadow: 0 0 4px rgba(255, 204, 51, 0.2);
  font-size: 10px;
}

.pane[data-pane="log"] .pane-body {
  color: #9ad4aa;
  font-size: 10px;
}

.pane-canvas {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  display: block;
  background: #020805;
}

/* Pane placement — hollywood-ish asymmetric split */
.pane[data-pane="code"]   { grid-column: 1; grid-row: 1; }
.pane[data-pane="hex"]    { grid-column: 2; grid-row: 1; }
.pane[data-pane="matrix"] { grid-column: 3; grid-row: 1; }
.pane[data-pane="net"]    { grid-column: 1; grid-row: 2; }
.pane[data-pane="proc"]   { grid-column: 2; grid-row: 2; }
.pane[data-pane="log"]    { grid-column: 3; grid-row: 2; }

/* Footer */
#footbar {
  flex: 0 0 var(--foot-h);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 10px;
  background: #080c09;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 10px;
  letter-spacing: 0.04em;
  z-index: 10;
}

#footbar em {
  font-style: normal;
  color: var(--green-dim);
}

.foot-sep {
  opacity: 0.5;
}

#lock-hint {
  color: var(--amber-dim);
}

/* Lock / cinematic keystroke banner */
.lock-banner {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.lock-banner.is-visible {
  opacity: 1;
}

.lock-banner[hidden] {
  display: none !important;
}

.lock-inner {
  border: 1px solid var(--red);
  background: rgba(10, 0, 5, 0.92);
  padding: 18px 28px;
  text-align: center;
  box-shadow: 0 0 24px rgba(255, 68, 102, 0.35);
  max-width: 90vw;
}

.lock-title {
  color: var(--red);
  font-size: 14px;
  letter-spacing: 0.2em;
  font-weight: 700;
  margin-bottom: 6px;
}

.lock-sub {
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 0.06em;
}

/* Occasional CRT flicker on body */
@keyframes flicker {
  0%, 100% { opacity: 1; }
  92% { opacity: 1; }
  93% { opacity: 0.92; }
  94% { opacity: 1; }
  97% { opacity: 0.88; }
  98% { opacity: 1; }
}

body.is-flickering #grid {
  animation: flicker 0.35s linear;
}

.noscript {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
  color: var(--green);
  text-align: center;
  font-size: 14px;
}

/* Responsive — stack on small screens */
@media (max-width: 900px) {
  #grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
  }
  .pane[data-pane="code"]   { grid-column: 1; grid-row: 1; }
  .pane[data-pane="hex"]    { grid-column: 2; grid-row: 1; }
  .pane[data-pane="net"]    { grid-column: 1; grid-row: 2; }
  .pane[data-pane="proc"]   { grid-column: 2; grid-row: 2; }
  .pane[data-pane="matrix"] { grid-column: 1; grid-row: 3; }
  .pane[data-pane="log"]    { grid-column: 2; grid-row: 3; }
  .brand-sub { display: none; }
}

@media (max-width: 560px) {
  #grid {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(6, minmax(120px, 1fr));
    overflow-y: auto;
  }
  .pane[data-pane="code"],
  .pane[data-pane="hex"],
  .pane[data-pane="net"],
  .pane[data-pane="proc"],
  .pane[data-pane="matrix"],
  .pane[data-pane="log"] {
    grid-column: 1;
  }
  .pane[data-pane="code"]   { grid-row: 1; }
  .pane[data-pane="hex"]    { grid-row: 2; }
  .pane[data-pane="net"]    { grid-row: 3; }
  .pane[data-pane="proc"]   { grid-row: 4; }
  .pane[data-pane="matrix"] { grid-row: 5; min-height: 160px; }
  .pane[data-pane="log"]    { grid-row: 6; }
  body { overflow: auto; }
  html { overflow: auto; }
  .pill-dim { display: none; }
  #footbar { font-size: 9px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  #scanlines { opacity: 0.15; }
  body.is-flickering #grid { animation: none; }
  .lock-banner { transition: none; }
}
