@font-face {
  font-family: "Unispace";
  src: url("fonts/unispace/Unispace-Regular.woff2") format("woff2"),
    url("fonts/unispace/Unispace-Regular.otf") format("opentype");
  font-display: swap;
  font-style: normal;
  font-weight: 400;
}

@font-face {
  font-family: "Unispace";
  src: url("fonts/unispace/Unispace-Bold.woff2") format("woff2"),
    url("fonts/unispace/Unispace-Bold.otf") format("opentype");
  font-display: swap;
  font-style: normal;
  font-weight: 700;
}

:root {
  color-scheme: dark;
  --phosphor: #8dff8d;
  --phosphor-hot: #d8ffd8;
  --phosphor-dim: #59bd66;
  --phosphor-low: #2f6f38;
  --terminal: #010501;
  --panel: #031103;
  --panel-hard: #061b06;
  --line: rgba(141, 255, 141, 0.42);
  --line-soft: rgba(141, 255, 141, 0.18);
  --fault: #ff9b72;
  --shadow: rgba(0, 0, 0, 0.72);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; margin: 0; }

html {
  scrollbar-color: var(--phosphor) transparent;
  scrollbar-width: thin;
}

::-webkit-scrollbar {
  width: 0.82rem;
  height: 0.82rem;
  background: transparent;
}

::-webkit-scrollbar-track { background: transparent; }

::-webkit-scrollbar-thumb {
  min-height: 2.6rem;
  background: var(--phosphor);
  border: 0.26rem solid transparent;
  background-clip: content-box;
  box-shadow: 0 0 0.7rem rgba(141, 255, 141, 0.7);
}

::-webkit-scrollbar-corner { background: transparent; }

body {
  overflow-x: hidden;
  background:
    linear-gradient(90deg, rgba(3, 22, 3, 0.88), rgba(0, 0, 0, 0.96)),
    repeating-linear-gradient(90deg, rgba(141, 255, 141, 0.05) 0 1px, transparent 1px 5.8rem),
    #000;
  color: var(--phosphor);
  font-family: "Unispace", "IBM Plex Mono", "VT323", "Courier New", monospace;
  letter-spacing: 0.018em;
}

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

body::before {
  background: linear-gradient(rgba(141, 255, 141, 0.05) 50%, rgba(0, 0, 0, 0.26) 50%);
  background-size: 100% 4px;
  mix-blend-mode: screen;
}

body::after {
  background: radial-gradient(circle at center, transparent 48%, rgba(0, 0, 0, 0.52) 100%);
  animation: flicker 4.8s infinite steps(10);
}

button, input, select { font: inherit; }
button { color: inherit; }
a { color: var(--phosphor-hot); }

.crt-shell {
  min-height: 100svh;
  padding: clamp(0.7rem, 2.5vw, 2rem);
  position: relative;
  isolation: isolate;
}

.ambient-flow {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(115deg, transparent 0 42%, rgba(141, 255, 141, 0.08) 48%, transparent 56% 100%),
    radial-gradient(circle at 12% 18%, rgba(141, 255, 141, 0.08), transparent 24rem),
    radial-gradient(circle at 88% 80%, rgba(141, 255, 141, 0.07), transparent 22rem);
  animation: field-flow 16s linear infinite;
}

.pip-boy {
  width: min(82rem, 100%);
  min-height: calc(100svh - clamp(1.4rem, 5vw, 4rem));
  margin: 0 auto;
  padding: clamp(0.75rem, 2vw, 1.3rem);
  border: 2px solid var(--line);
  border-radius: 0.35rem;
  background:
    repeating-linear-gradient(0deg, transparent 0 0.95rem, rgba(141, 255, 141, 0.028) 0.95rem 1rem),
    var(--terminal);
  box-shadow: 0 0 0 0.25rem rgba(141, 255, 141, 0.04), 0 1.2rem 4rem var(--shadow);
  text-shadow: 0 0 0.45rem rgba(141, 255, 141, 0.34);
}

.top-bar,
.tab-layout,
.result-meta,
.term-row,
.panel-title,
.signal-box {
  display: flex;
  align-items: center;
}

.top-bar {
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 2px solid var(--line-soft);
  padding-bottom: clamp(0.8rem, 2vw, 1.1rem);
}

.eyebrow,
.panel-title,
.sequence,
.result-meta,
.signal-box,
.tab-subtitle {
  color: var(--phosphor-dim);
  font-size: clamp(0.67rem, 1.7vw, 0.78rem);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow { margin: 0 0 0.25rem; }

h1 {
  margin: 0;
  color: var(--phosphor-hot);
  font-size: clamp(1.35rem, 6vw, 4.2rem);
  line-height: 0.92;
  text-transform: uppercase;
}

.signal-box {
  flex: 0 0 auto;
  gap: 0.62rem;
  max-width: min(100%, 30rem);
  border: 1px solid var(--line);
  padding: 0.58rem 0.75rem;
  background: var(--panel);
}

.status-dot {
  width: 0.72rem;
  height: 0.72rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--phosphor);
  box-shadow: 0 0 0.55rem rgba(141, 255, 141, 0.9);
  animation: blink 1.5s infinite steps(2);
}

.status-dot.fault {
  background: var(--fault);
  box-shadow: 0 0 0.55rem rgba(255, 155, 114, 0.8);
}

.tab-layout {
  align-items: stretch;
  display: grid;
  grid-template-columns: minmax(10rem, 0.55fr) minmax(0, 2.45fr);
  gap: clamp(0.7rem, 1.8vw, 1.1rem);
  padding-top: clamp(0.7rem, 2vw, 1.1rem);
}

.tab-rail {
  display: grid;
  gap: 0.45rem;
  align-content: start;
}

.tab-button {
  cursor: pointer;
  width: 100%;
  min-height: 4.4rem;
  border: 1px solid var(--line-soft);
  border-left: 0.42rem solid var(--phosphor-low);
  border-radius: 0;
  background: rgba(3, 17, 3, 0.72);
  padding: 0.72rem;
  text-align: left;
}

.tab-button.active,
.tab-button:focus-visible,
.tab-button:hover {
  border-color: var(--line);
  border-left-color: var(--phosphor);
  background: var(--panel-hard);
  outline: none;
}

.tab-label,
.tab-subtitle { display: block; }
.tab-label { color: var(--phosphor-hot); font-weight: 700; }
.tab-subtitle { margin-top: 0.18rem; }

.tab-screen {
  min-width: 0;
  min-height: clamp(30rem, 72svh, 45rem);
  max-height: calc(100svh - clamp(9.5rem, 20vw, 13.5rem));
  overflow-y: auto;
  padding-right: clamp(0.2rem, 0.8vw, 0.55rem);
  scrollbar-color: var(--phosphor) transparent;
  scrollbar-width: thin;
}

.page-pane {
  display: grid;
  grid-template-columns: 1fr;
  grid-auto-rows: max-content;
  gap: clamp(0.7rem, 1.8vw, 1rem);
}

.lookup-pane,
.stream-pane,
.about-pane { min-width: 0; }

.module {
  min-width: 0;
  border: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(5, 21, 5, 0.92), rgba(1, 8, 1, 0.94));
  padding: clamp(0.8rem, 2vw, 1rem);
  position: relative;
  overflow: hidden;
}

.module::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 1.6rem, rgba(141, 255, 141, 0.03) 1.6rem 1.65rem);
  opacity: 0.75;
  pointer-events: none;
}

.panel-title {
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 0.5rem;
  position: relative;
  z-index: 1;
}

.panel-title code {
  color: var(--phosphor-hot);
  font-size: 0.72rem;
}

.command-module,
.dict-module,
.results-module,
.pulse-module,
.tape-module,
.about-card { position: relative; }

.command-module {
  display: grid;
  grid-template-columns: minmax(11rem, 1.4fr) minmax(8rem, 0.75fr) minmax(8rem, 0.55fr);
  gap: 0.9rem;
  align-items: end;
}

.command-module .panel-title { grid-column: 1 / -1; }

.field {
  display: grid;
  gap: 0.35rem;
  position: relative;
  z-index: 1;
}

.field span {
  color: var(--phosphor-dim);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.field input,
.field select,
.dict-output,
.terminal-button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #000600;
  color: var(--phosphor-hot);
  outline: none;
}

.field input,
.field select { padding: 0.8rem 0.82rem; }

.dict-output {
  display: block;
  min-height: clamp(10rem, 24svh, 18rem);
  padding: 0.8rem 0.82rem;
  resize: vertical;
  position: relative;
  z-index: 1;
  font-family: "Unispace", "IBM Plex Mono", "VT323", "Courier New", monospace;
  font-size: clamp(0.82rem, 1.7vw, 0.96rem);
  line-height: 1.45;
  white-space: pre;
  overflow: auto;
  scrollbar-color: var(--phosphor) transparent;
  scrollbar-width: thin;
}

.dict-output:focus {
  border-color: var(--phosphor-hot);
  box-shadow: inset 0 0 0 1px rgba(141, 255, 141, 0.3);
}

.field input:focus,
.field select:focus {
  border-color: var(--phosphor-hot);
  box-shadow: inset 0 0 0 1px rgba(141, 255, 141, 0.3);
}

.terminal-button {
  cursor: pointer;
  padding: 0.85rem 1rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  background: var(--panel-hard);
  position: relative;
  z-index: 1;
}

.terminal-button:hover { background: #0b2f0b; }

.data-card {
  border: 1px dashed rgba(141, 255, 141, 0.34);
  background: rgba(0, 8, 0, 0.82);
  padding: clamp(0.78rem, 2vw, 1rem);
  position: relative;
  z-index: 1;
}

.pulse-card {
  min-height: clamp(13rem, 32svh, 22rem);
  display: grid;
  align-content: center;
  gap: 0.72rem;
}

.result-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: 0.72rem;
}

.sequence { color: var(--phosphor-hot); }

.term-row {
  justify-content: space-between;
  gap: 1rem;
}

.language {
  flex: 0 0 auto;
  color: var(--phosphor-dim);
  border: 1px solid var(--line-soft);
  padding: 0.25rem 0.45rem;
  min-width: 3.2rem;
  text-align: center;
}

.term,
.result-translation {
  min-width: 0;
  color: var(--phosphor-hot);
  font-size: clamp(1.25rem, 4.2vw, 2.7rem);
  font-weight: 700;
  overflow-wrap: anywhere;
  text-align: right;
}

.translation-arrow {
  color: var(--phosphor-dim);
  font-size: 1.45rem;
  text-align: center;
  animation: blink 1.2s infinite steps(2);
}

.context,
.copy-line,
.empty-state,
.diagnostics,
.tape-lines {
  color: rgba(216, 255, 216, 0.74);
}

.context { margin: 0.35rem 0 0; }

.result-card h2 {
  margin: 0.35rem 0;
  color: var(--phosphor-hot);
  overflow-wrap: anywhere;
}

.result-meta {
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.result-translation {
  margin: 0;
  font-size: clamp(1.05rem, 3vw, 1.8rem);
  text-align: left;
}

.empty-state code { color: var(--phosphor-hot); }

.diagnostics {
  margin: 0.85rem 0 0;
  padding-left: 1.1rem;
}

.tape-lines {
  display: grid;
  gap: 0.75rem;
  position: relative;
  z-index: 1;
}

.tape-lines p,
.copy-line { margin: 0; line-height: 1.6; }

.about-list {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.8rem 1rem;
  margin: 0;
  position: relative;
  z-index: 1;
}

.about-list dt {
  color: var(--phosphor-dim);
  text-transform: uppercase;
}

.about-list dd {
  margin: 0;
  color: var(--phosphor-hot);
  overflow-wrap: anywhere;
}

@keyframes flicker {
  0%, 100% { opacity: 0.82; }
  12% { opacity: 0.62; }
  28% { opacity: 0.88; }
  48% { opacity: 0.7; }
  76% { opacity: 0.91; }
}

@keyframes field-flow {
  0% { transform: translateX(-4vw); opacity: 0.58; }
  50% { opacity: 0.92; }
  100% { transform: translateX(4vw); opacity: 0.58; }
}

@keyframes blink {
  0%, 52% { opacity: 1; }
  53%, 100% { opacity: 0.28; }
}

@media (max-width: 880px) {
  .top-bar { align-items: flex-start; flex-direction: column; }
  .signal-box { width: 100%; }
  .tab-layout, .command-module { grid-template-columns: 1fr; }
  .tab-screen { max-height: none; overflow-y: visible; padding-right: 0; }
  .tab-rail { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tab-button { min-height: 4rem; border-left-width: 1px; border-top: 0.35rem solid var(--phosphor-low); }
  .tab-button.active, .tab-button:focus-visible, .tab-button:hover { border-top-color: var(--phosphor); }
}

@media (max-width: 560px) {
  .crt-shell { padding: 0.45rem; }
  .pip-boy { min-height: calc(100svh - 0.9rem); padding: 0.58rem; }
  .tab-rail { grid-template-columns: 1fr; }
  .tab-button { min-height: auto; }
  .term-row { align-items: flex-start; flex-direction: column; }
  .term { text-align: left; }
  .about-list { grid-template-columns: 1fr; }
  .command-module { gap: 0.72rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
