:root {
  --bg: #010301;
  --green: #43ff52;
  --green-soft: #32d842;
  --green-dim: #146d20;
  --panel: rgba(0, 12, 2, 0.55);
  --line: rgba(67, 255, 82, 0.42);
  --glow: 0 0 4px rgba(67, 255, 82, 0.78), 0 0 14px rgba(67, 255, 82, 0.2);
  --font: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--green);
  background:
    radial-gradient(circle at 68% 47%, rgba(18, 92, 26, 0.18), transparent 38rem),
    radial-gradient(circle at 17% 35%, rgba(29, 112, 38, 0.12), transparent 27rem),
    linear-gradient(180deg, #020702 0%, #000 100%);
  font-family: var(--font);
  letter-spacing: 0;
}

body::before,
body::after {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
}

body::before {
  z-index: 5;
  background:
    repeating-linear-gradient(
      180deg,
      rgba(67, 255, 82, 0.035) 0,
      rgba(67, 255, 82, 0.035) 1px,
      transparent 1px,
      transparent 4px
    );
  mix-blend-mode: overlay;
  opacity: 0.34;
}

body::after {
  z-index: 6;
  background:
    linear-gradient(90deg, rgba(255, 0, 0, 0.018), rgba(0, 255, 80, 0.02), rgba(0, 72, 255, 0.018)),
    radial-gradient(ellipse at center, transparent 38%, rgba(0, 0, 0, 0.54) 100%);
  animation: phosphor 5.8s steps(2, end) infinite;
}

.node-label {
  position: fixed;
  top: clamp(1rem, 2.1vw, 1.85rem);
  left: clamp(1rem, 1.9vw, 1.8rem);
  z-index: 2;
  display: inline-flex;
  gap: 0.55rem;
  align-items: center;
  color: var(--green);
  font-size: clamp(0.95rem, 1.35vw, 1.28rem);
  line-height: 1;
  text-shadow: var(--glow);
}

.block-cursor {
  display: inline-block;
  width: 0.64em;
  height: 1.05em;
  background: var(--green);
  box-shadow: var(--glow);
  animation: blink 1.12s steps(2, end) infinite;
}

.node {
  position: relative;
  display: grid;
  grid-template-columns: minmax(27rem, 0.76fr) minmax(38rem, 1fr);
  gap: clamp(1.2rem, 2.35vw, 3rem);
  width: calc(100vw - clamp(2rem, 3.7vw, 3.6rem));
  min-height: calc(100vh - 4.7rem);
  margin: 0 auto;
  padding: clamp(4.35rem, 5vw, 5.25rem) 0 4.35rem;
  align-items: stretch;
}

.terminal {
  position: relative;
  display: flex;
  flex-direction: column;
  grid-column: 1;
  grid-row: 1;
  min-height: calc(100vh - clamp(9.1rem, 9.8vw, 9.7rem));
  padding: clamp(1.15rem, 1.7vw, 1.75rem);
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(0, 15, 3, 0.52), rgba(0, 5, 1, 0.64)),
    var(--panel);
  box-shadow:
    inset 0 0 28px rgba(67, 255, 82, 0.045),
    0 0 26px rgba(67, 255, 82, 0.065);
  text-shadow: var(--glow);
}

.terminal::before {
  position: absolute;
  inset: -1px;
  border: 1px solid rgba(67, 255, 82, 0.16);
  box-shadow: inset 0 0 0 1px rgba(67, 255, 82, 0.05);
  content: "";
  pointer-events: none;
}

.terminal-output {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: clamp(0.9rem, 1.05vw, 1.08rem);
  line-height: 1.45;
}

.terminal-input {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  margin-top: 0.35rem;
}

.terminal.is-booting .terminal-input {
  visibility: hidden;
}

.prompt {
  flex: 0 0 auto;
  color: var(--green);
}

#command-input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--green);
  background: transparent;
  font: inherit;
  line-height: 1.6;
  text-shadow: var(--glow);
  caret-color: var(--green);
}

.image-panel {
  position: relative;
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  justify-self: stretch;
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - clamp(10.4rem, 12vw, 12rem));
  filter: drop-shadow(0 0 8px rgba(67, 255, 82, 0.36)) drop-shadow(0 0 26px rgba(67, 255, 82, 0.14));
}

.crt-photo {
  position: relative;
  width: 100%;
  max-height: calc(100vh - 10rem);
  overflow: hidden;
  opacity: 0;
  transform: translateY(0.35rem);
  background: #000;
  animation: imageOn 1.4s ease-out 0.15s forwards, photoFlicker 6.5s steps(2, end) infinite;
}

.crt-photo img {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(100vh - 10rem);
  object-fit: contain;
  opacity: 0.92;
  filter: grayscale(1) contrast(1.95) brightness(0.7) sepia(1) hue-rotate(62deg) saturate(8.5);
  mix-blend-mode: screen;
}

.crt-photo::before,
.crt-photo::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
}

.crt-photo::before {
  background:
    radial-gradient(circle at 50% 42%, rgba(76, 255, 88, 0.22), transparent 43%),
    linear-gradient(90deg, rgba(67, 255, 82, 0.12), rgba(67, 255, 82, 0.28));
  mix-blend-mode: color;
}

.crt-photo::after {
  background:
    repeating-linear-gradient(
      180deg,
      rgba(0, 0, 0, 0.18) 0,
      rgba(0, 0, 0, 0.18) 1px,
      transparent 1px,
      transparent 4px
    ),
    radial-gradient(ellipse at center, transparent 48%, rgba(0, 0, 0, 0.38) 100%);
  opacity: 0.62;
  mix-blend-mode: multiply;
}

.crt-photo img::selection,
.terminal ::selection {
  color: #001801;
  background: var(--green);
  text-shadow: none;
}

.terminal a {
  color: var(--green);
  text-decoration: none;
  border-bottom: 1px solid rgba(140, 255, 155, 0.55);
}

.terminal a:hover,
.terminal a:focus {
  color: #caffd1;
  border-bottom-color: currentColor;
}

.status-bar {
  position: fixed;
  z-index: 10;
  right: clamp(1rem, 1.9vw, 1.8rem);
  bottom: clamp(0.7rem, 1vw, 1rem);
  left: clamp(1rem, 1.9vw, 1.8rem);
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  gap: clamp(0.7rem, 2vw, 2.2rem);
  align-items: center;
  min-height: 2.8rem;
  padding: 0.45rem clamp(0.75rem, 1.4vw, 1.3rem);
  border: 1px solid rgba(67, 255, 82, 0.35);
  color: var(--green-soft);
  background: rgba(0, 8, 2, 0.82);
  box-shadow: 0 0 22px rgba(67, 255, 82, 0.075);
  font-size: clamp(0.7rem, 1.05vw, 0.98rem);
  line-height: 1.2;
  text-shadow: 0 0 6px rgba(106, 255, 128, 0.42);
}

.muted {
  color: rgba(208, 220, 210, 0.78);
}

.status-bar > span:nth-child(1)::after,
.status-bar > span:nth-child(2)::after,
.status-bar > span:nth-child(3)::after {
  display: inline-block;
  width: 1px;
  height: 1.05rem;
  margin-left: clamp(0.8rem, 2.5vw, 3rem);
  vertical-align: -0.22rem;
  background: rgba(67, 255, 82, 0.55);
  content: "";
}

.status-bar > span:nth-child(3) {
  justify-self: end;
}

.live {
  position: relative;
  padding-left: 0.8rem;
  color: #c8ffd0;
}

.live::before {
  position: absolute;
  top: 50%;
  left: 0;
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 9px rgba(140, 255, 155, 0.92);
  transform: translateY(-50%);
  content: "";
}

@keyframes drawIn {
  to {
    opacity: 0.86;
    transform: translateY(0);
  }
}

@keyframes imageOn {
  to {
    opacity: 0.96;
    transform: translateY(0);
  }
}

@keyframes flicker {
  0%, 100% { opacity: 0.86; }
  41% { opacity: 0.82; }
  42% { opacity: 0.94; }
  43% { opacity: 0.78; }
  44% { opacity: 0.88; }
  71% { opacity: 0.84; }
}

@keyframes photoFlicker {
  0%, 100% { opacity: 0.96; }
  38% { opacity: 0.93; }
  39% { opacity: 0.98; }
  40% { opacity: 0.94; }
  74% { opacity: 0.95; }
}

@keyframes phosphor {
  0%, 100% { opacity: 0.86; }
  50% { opacity: 0.76; }
}

@keyframes blink {
  0%, 48% { opacity: 1; }
  49%, 100% { opacity: 0; }
}

@media (max-width: 820px) {
  .node-label {
    position: static;
    margin: 1rem 1rem 0;
  }

  .node {
    grid-template-columns: 1fr;
    gap: 1.35rem;
    width: min(92vw, 43rem);
    min-height: auto;
    padding-top: 1rem;
    align-items: start;
  }

  .image-panel {
    grid-column: 1;
    grid-row: auto;
    order: -1;
    min-height: auto;
  }

  .crt-photo,
  .crt-photo img {
    width: 100%;
    max-height: 44vh;
  }

  .terminal {
    grid-column: 1;
    grid-row: auto;
    min-height: 22rem;
  }

  .terminal-output {
    min-height: 16.5rem;
  }

  .status-bar {
    grid-template-columns: 1fr auto;
    gap: 0.32rem 0.7rem;
    right: 1rem;
    left: 1rem;
  }

  .status-bar > span:nth-child(3) {
    grid-column: auto;
    justify-self: start;
  }

  .status-bar > span:nth-child(1)::after,
  .status-bar > span:nth-child(2)::after,
  .status-bar > span:nth-child(3)::after {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  body::after,
  .crt-photo {
    animation: none;
  }

  .crt-photo {
    opacity: 0.96;
    transform: none;
  }
}
