:root {
  /* Weathered brass — darker, duller, with patina */
  --brass-deep:    #120a02;
  --brass-dark:    #2a1d08;
  --brass-mid:     #5a4418;
  --brass-warm:    #7a5c24;
  --brass-hilite:  #b08840;
  --brass-edge:    #d6ae5e;
  --patina:        #2d3a20;
  --grime:         #0c0a05;

  /* CRT green — poisonous, sickly */
  --screen-void:   #000804;
  --screen-bg:     #021608;
  --screen-inner:  #053018;
  --screen-line:   #0d6a30;
  --text-green:    #7dff82;
  --text-green-dim:#3f9e52;
  --text-green-hot:#e0ffcc;
  --glow-strong: 0 0 4px rgba(125, 255, 130, 0.9), 0 0 10px rgba(80, 220, 100, 0.6), 0 0 22px rgba(40, 180, 70, 0.35);

  --frame-thickness: 72px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  font-family: "Courier New", "Consolas", monospace;
  color: var(--text-green);

  /* Cavernous dim chamber */
  background:
    radial-gradient(ellipse at 50% 120%, #0a0a0a 0%, #000 70%),
    radial-gradient(ellipse at 50% -20%, #1a1408 0%, transparent 60%),
    #020100;
}

/* ============ BRASS FRAME ============ */
.frame {
  position: fixed;
  inset: 0;
  padding: var(--frame-thickness);
  border-radius: 38px;
  z-index: 1;
  pointer-events: none;

  background:
    radial-gradient(ellipse at 18% 30%, rgba(45, 58, 32, 0.55) 0%, transparent 18%),
    radial-gradient(ellipse at 78% 12%, rgba(45, 58, 32, 0.4) 0%, transparent 14%),
    radial-gradient(ellipse at 35% 88%, rgba(45, 58, 32, 0.5) 0%, transparent 20%),
    radial-gradient(ellipse at 88% 72%, rgba(45, 58, 32, 0.35) 0%, transparent 16%),
    radial-gradient(ellipse at 62% 40%, rgba(12, 10, 5, 0.7) 0%, transparent 14%),
    radial-gradient(ellipse at 12% 70%, rgba(12, 10, 5, 0.6) 0%, transparent 18%),
    radial-gradient(ellipse at 92% 42%, rgba(12, 10, 5, 0.5) 0%, transparent 12%),
    repeating-linear-gradient(
      90deg,
      transparent 0px,
      transparent 40px,
      rgba(0, 0, 0, 0.08) 42px,
      transparent 48px
    ),
    repeating-linear-gradient(
      3deg,
      var(--brass-mid) 0px,
      var(--brass-dark) 1px,
      var(--brass-warm) 2px,
      var(--brass-mid) 3px,
      var(--brass-dark) 4px
    ),
    linear-gradient(170deg, var(--brass-warm) 0%, var(--brass-mid) 40%, var(--brass-dark) 100%);
  background-blend-mode: multiply, multiply, multiply, multiply, multiply, multiply, multiply, overlay, normal, normal;

  box-shadow:
    inset 0 0 0 1px var(--brass-deep),
    inset 0 0 0 3px var(--brass-hilite),
    inset 0 0 0 4px var(--brass-deep),
    inset 0 4px 12px rgba(176, 136, 64, 0.3),
    inset 0 -20px 40px rgba(0, 0, 0, 0.85),
    inset 0 0 60px var(--grime),
    0 0 50px rgba(0, 0, 0, 0.9);
  filter: saturate(0.78) contrast(1.05);
}

/* ============ RIVETS ============ */
.rivet {
  position: fixed;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  z-index: 15;
  pointer-events: none;
  background:
    radial-gradient(circle at 35% 30%, var(--brass-edge) 0%, var(--brass-warm) 30%, var(--brass-dark) 70%, var(--brass-deep) 100%);
  box-shadow:
    0 0 0 1px var(--brass-deep),
    inset -1px -2px 2px rgba(0, 0, 0, 0.7),
    inset 1px 1px 1px rgba(214, 174, 94, 0.5),
    0 2px 3px rgba(0, 0, 0, 0.8);
  filter: saturate(0.8);
}
.rivet.tl { top: 18px; left: 18px; }
.rivet.tr { top: 18px; right: 18px; }
.rivet.bl { bottom: 18px; left: 18px; }
.rivet.br { bottom: 18px; right: 18px; }
.rivet.t1 { top: 18px; left: 25%; }
.rivet.t2 { top: 18px; right: 25%; }
.rivet.b1 { bottom: 18px; left: 25%; }
.rivet.b2 { bottom: 18px; right: 25%; }
.rivet.l1 { left: 18px; top: 35%; }
.rivet.l2 { left: 18px; top: 65%; }
.rivet.r1 { right: 18px; top: 35%; }
.rivet.r2 { right: 18px; top: 65%; }

/* ============ SCREEN ============ */
.screen {
  position: absolute;
  inset: var(--frame-thickness);
  border-radius: 36px / 44px;
  background:
    radial-gradient(ellipse 110% 90% at 50% 50%, var(--screen-inner) 0%, var(--screen-bg) 55%, var(--screen-void) 90%, #000 100%);
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow:
    inset 0 0 0 3px var(--brass-dark),
    inset 0 0 0 5px var(--brass-deep),
    inset 0 0 0 8px var(--brass-warm),
    inset 0 0 0 10px var(--brass-deep),
    inset 0 0 60px rgba(0, 0, 0, 0.95),
    inset 0 0 30px rgba(15, 90, 40, 0.2),
    0 0 40px rgba(80, 220, 100, 0.15);
  scrollbar-width: thin;
  scrollbar-color: var(--brass-warm) var(--screen-void);
  pointer-events: auto;
  z-index: 5;
}
.screen::-webkit-scrollbar { width: 8px; }
.screen::-webkit-scrollbar-track { background: var(--screen-void); }
.screen::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--brass-edge), var(--brass-warm), var(--brass-dark));
  border-radius: 4px;
  border: 1px solid var(--brass-deep);
}

/* Convex glass sheen */
.screen::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 7;
  border-radius: inherit;
  background:
    radial-gradient(ellipse 60% 35% at 30% 12%, rgba(255, 255, 255, 0.12) 0%, transparent 70%),
    radial-gradient(ellipse 50% 20% at 70% 5%,  rgba(255, 255, 255, 0.06) 0%, transparent 70%),
    radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.55) 100%);
}

/* Dense scanlines + flicker */
.screen::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 1px,
    rgba(0, 0, 0, 0.4) 2px,
    rgba(0, 0, 0, 0.4) 3px
  );
  animation: flicker 3.2s steps(60) infinite;
}
@keyframes flicker {
  0%, 92%, 100% { opacity: 1; }
  93%           { opacity: 0.75; }
  94%           { opacity: 1; }
  96%           { opacity: 0.85; }
}

/* ============ MOVING LIGHT GREEN BARS ============ */
.scan-bar {
  position: absolute;
  left: 0;
  right: 0;
  height: 80px;
  pointer-events: none;
  z-index: 2;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(80, 220, 100, 0.05) 30%,
    rgba(125, 255, 130, 0.22) 50%,
    rgba(80, 220, 100, 0.05) 70%,
    transparent 100%
  );
  animation: scan 5s linear infinite;
}
.scan-bar.slow {
  height: 180px;
  opacity: 0.4;
  animation-duration: 13s;
  animation-delay: -4s;
}
@keyframes scan {
  0%   { top: -100px; }
  100% { top: 100%; }
}

/* Side diagnostic bar */
.diag-bar {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 5px;
  bottom: 14px;
  background: rgba(13, 106, 48, 0.25);
  border: 1px solid var(--screen-line);
  border-radius: 2px;
  overflow: hidden;
  z-index: 6;
}
.diag-bar::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 18%;
  background: linear-gradient(var(--text-green-hot), var(--text-green));
  box-shadow: var(--glow-strong);
  animation: diag 4.2s ease-in-out infinite alternate;
}
@keyframes diag {
  from { top: 0%; }
  to   { top: 82%; }
}

/* Dense dim code-dump backing layer */
.codedump {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  font-family: inherit;
  font-size: 11px;
  line-height: 1.35;
  color: rgba(63, 158, 82, 0.18);
  padding: 14px;
  overflow: hidden;
  white-space: pre;
  text-shadow: 0 0 3px rgba(40, 180, 70, 0.3);
  animation: codedrift 80s linear infinite;
}
@keyframes codedrift {
  from { transform: translateY(0); }
  to   { transform: translateY(-50%); }
}

/* ============ CONTENT ============ */
.content {
  position: relative;
  z-index: 5;
  padding: 46px 60px 60px 46px;
  color: var(--text-green);
  text-shadow: var(--glow-strong);
  font-size: 14px;
  line-height: 1.65;
  letter-spacing: 0.05em;
}

.content.jiggling {
  animation: jiggle 160ms ease-in-out;
}
@keyframes jiggle {
  0%   { transform: translate(0, 0) skewX(0); }
  20%  { transform: translate(-0.6px, -1.2px) skewX(-0.2deg); }
  45%  { transform: translate(1px, 0.6px) skewX(0.15deg); }
  70%  { transform: translate(-0.8px, 1px) skewX(-0.1deg); }
  100% { transform: translate(0, 0) skewX(0); }
}

.content h1 {
  color: var(--text-green-hot);
  font-size: 22px;
  letter-spacing: 0.22em;
  border-bottom: 1px dashed var(--screen-line);
  padding-bottom: 10px;
  margin-top: 0;
  text-shadow: 0 0 6px rgba(224, 255, 204, 0.9), 0 0 16px rgba(125, 255, 130, 0.6);
}
.content h2 {
  color: var(--text-green-hot);
  font-size: 16px;
  letter-spacing: 0.18em;
  margin-top: 2em;
}
.content .dim    { color: var(--text-green-dim); }
.content .bright { color: var(--text-green-hot); }
.content .blink  { animation: blink 1.1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.content pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ============ SKULL (weathered) ============ */
.skull {
  position: fixed;
  left: 50%;
  bottom: 4px;
  transform: translateX(-50%);
  width: 88px;
  height: 88px;
  z-index: 20;
  pointer-events: none;
  filter:
    drop-shadow(0 2px 0 var(--brass-deep))
    drop-shadow(0 0 8px rgba(0, 0, 0, 0.95))
    saturate(0.78)
    brightness(0.95);
}

/* ============ INDICATOR LEDS on bottom bezel ============ */
.dials {
  position: fixed;
  bottom: 18px;
  z-index: 18;
  display: flex;
  gap: 12px;
  pointer-events: none;
}
.dials.left  { left:  calc(50% - 138px); }
.dials.right { right: calc(50% - 138px); }

.dial {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, var(--text-green-hot), var(--text-green) 40%, #063c18 85%);
  box-shadow:
    inset 0 0 0 1px var(--brass-deep),
    inset 0 1px 2px rgba(224, 255, 204, 0.7),
    0 0 6px rgba(125, 255, 130, 0.9),
    0 0 12px rgba(80, 220, 100, 0.5);
  animation: ledpulse 2.4s ease-in-out infinite alternate;
}
.dial.two   { animation-duration: 3.1s; animation-delay: -1.2s; }
.dial.three { animation-duration: 1.8s; animation-delay: -0.6s; }
.dial.four  { animation-duration: 2.7s; animation-delay: -0.3s; }
@keyframes ledpulse {
  from { filter: brightness(0.6); }
  to   { filter: brightness(1.2); }
}

/* ============ PHYSICAL BUTTONS ============ */
.btn {
  position: fixed;
  z-index: 30;
  pointer-events: auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 8px;
  font-weight: bold;
  letter-spacing: 0.15em;
  color: var(--brass-deep);
  text-shadow: 0 1px 0 var(--brass-edge);
  background:
    radial-gradient(circle at 35% 30%, var(--brass-edge) 0%, var(--brass-warm) 35%, var(--brass-mid) 70%, var(--brass-dark) 100%);
  box-shadow:
    inset 0 2px 2px rgba(214, 174, 94, 0.6),
    inset 0 -3px 4px rgba(0, 0, 0, 0.8),
    0 3px 0 var(--brass-deep),
    0 5px 10px rgba(0, 0, 0, 0.85);
  transition: transform 80ms ease, box-shadow 80ms ease, filter 120ms ease;
  filter: saturate(0.8);
}
.btn:hover { filter: saturate(0.9) brightness(1.1); }
.btn:active {
  transform: translateY(2px);
  box-shadow:
    inset 0 2px 2px rgba(214, 174, 94, 0.6),
    inset 0 -2px 3px rgba(0, 0, 0, 0.8),
    0 1px 0 var(--brass-deep),
    0 2px 4px rgba(0, 0, 0, 0.7);
}

.btn.btn-1 { bottom: 14px; left:  calc(50% - 230px); }
.btn.btn-2 { bottom: 14px; left:  calc(50% - 180px); }
.btn.btn-3 { bottom: 14px; right: calc(50% - 180px); }
.btn.btn-4 { bottom: 14px; right: calc(50% - 230px); }

/* ============ TOP BEZEL READOUT ============ */
.readout {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 0.35em;
  color: var(--brass-edge);
  text-shadow: 0 1px 0 var(--brass-deep), 0 0 4px rgba(176, 136, 64, 0.5);
  padding: 4px 22px;
  border-radius: 3px;
  background: linear-gradient(var(--brass-deep), #000);
  box-shadow:
    inset 0 0 0 1px var(--brass-dark),
    inset 0 2px 4px #000,
    0 1px 0 rgba(214, 174, 94, 0.3);
  filter: saturate(0.8);
}

.cant {
  position: fixed;
  top: 46px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 19;
  font-family: "Times New Roman", serif;
  font-style: italic;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: rgba(176, 136, 64, 0.55);
  white-space: nowrap;
  text-shadow: 0 1px 0 #000;
  pointer-events: none;
}
