:root {
  --ink: #d9ffe1;
  --ink-hot: #f2fff4;
  --muted: #6f9a78;
  --dim: #385d43;
  --bg: #020503;
  --hull: #06100b;
  --panel: #091810;
  --panel-2: #0d2116;
  --screen: #021006;
  --line: rgba(157, 255, 179, 0.26);
  --line-hard: rgba(199, 255, 208, 0.68);
  --amber: #ffbf4a;
  --red: #ff5848;
  --green: #9dffb3;
  --bank-accent: var(--green);
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.72);
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --title: "Space Grotesk", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

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

body.typing-standalone {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 16px;
  letter-spacing: 0;
  line-height: 1.5;
  background:
    repeating-linear-gradient(90deg, rgba(157, 255, 179, 0.06) 0 1px, transparent 1px 68px),
    repeating-linear-gradient(0deg, rgba(157, 255, 179, 0.045) 0 1px, transparent 1px 54px),
    linear-gradient(135deg, #020503 0%, #06130d 46%, #010302 100%);
  overflow-x: hidden;
}

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

body.typing-standalone::before {
  background: repeating-linear-gradient(0deg, rgba(217, 255, 225, 0.035) 0 1px, transparent 1px 4px);
  mix-blend-mode: screen;
  opacity: 0.72;
}

body.typing-standalone::after {
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.72), transparent 9%, transparent 91%, rgba(0, 0, 0, 0.72)),
    linear-gradient(180deg, rgba(0, 0, 0, 0.5), transparent 12%, transparent 88%, rgba(0, 0, 0, 0.74));
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
}

.typing-station {
  width: min(1420px, calc(100% - 28px));
  min-height: calc(100vh - 28px);
  min-height: calc(100svh - 28px);
  margin: 14px auto;
  padding: 12px;
  position: relative;
  display: grid;
  grid-template-rows: auto auto auto auto minmax(0, 1fr);
  gap: 10px;
  background:
    linear-gradient(90deg, rgba(255, 191, 74, 0.2) 0 8px, transparent 8px calc(100% - 8px), rgba(255, 88, 72, 0.18) calc(100% - 8px)),
    linear-gradient(180deg, #08130d, #030805);
  border: 1px solid var(--line-hard);
  border-radius: 2px;
  box-shadow: var(--shadow), inset 0 0 42px rgba(157, 255, 179, 0.06);
  overflow: hidden;
}

.typing-station::before {
  content: "UTILITY TERMINAL / INPUT DIAGNOSTIC / OPTIONAL RSS NEWS LINK";
  min-height: 26px;
  padding: 5px 14px;
  display: block;
  color: var(--amber);
  background:
    repeating-linear-gradient(135deg, transparent 0 18px, rgba(255, 191, 74, 0.2) 18px 30px, transparent 30px 46px),
    #070906;
  border: 1px solid rgba(255, 191, 74, 0.75);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  text-transform: uppercase;
  text-shadow: 0 0 8px rgba(255, 191, 74, 0.36);
}

.typing-station::after {
  content: "";
  position: absolute;
  inset: 44px 14px 14px;
  border: 1px solid rgba(157, 255, 179, 0.09);
  pointer-events: none;
}

.station-header,
.control-board,
.news-board,
.typing-metrics,
.typing-deck {
  position: relative;
  background: linear-gradient(180deg, rgba(18, 43, 28, 0.9), rgba(4, 14, 8, 0.94));
  border: 1px solid var(--line);
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.65), inset 0 0 24px rgba(0, 0, 0, 0.35);
}

.station-header::before,
.control-board::before,
.news-board::before,
.typing-metrics::before,
.typing-deck::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(157, 255, 179, 0.08) 0 1px, transparent 1px),
    linear-gradient(180deg, rgba(157, 255, 179, 0.045) 0 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.5;
  pointer-events: none;
}

.station-header > *,
.control-board > *,
.news-board > *,
.typing-metrics > *,
.typing-deck > * {
  position: relative;
  z-index: 1;
}

.station-header {
  min-height: 118px;
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 154px;
  gap: 10px;
  align-items: stretch;
}

.brand-lockup {
  min-width: 0;
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.brand-mark {
  width: 82px;
  height: 82px;
  display: grid;
  place-items: center;
  color: var(--ink-hot);
  background:
    linear-gradient(180deg, rgba(157, 255, 179, 0.13), transparent),
    #020604;
  border: 1px solid var(--line-hard);
  border-radius: 2px;
  font-family: var(--title);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0;
  text-shadow: 0 0 10px rgba(157, 255, 179, 0.72);
  box-shadow: inset 0 0 24px rgba(157, 255, 179, 0.11), 0 0 0 4px rgba(255, 191, 74, 0.08);
}

.brand-copy {
  min-width: 0;
}

.brand-copy p,
.control-label,
.clock-module span,
.clock-module small,
.typing-metric span,
.paper-strip,
.typing-result,
.control-status,
.terminal-ribbon {
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand-copy p,
.control-label,
.typing-metric span,
.paper-strip,
.control-status strong,
.terminal-ribbon {
  color: var(--muted);
}

.brand-copy h1 {
  margin: 0;
  color: var(--ink-hot);
  font-family: var(--title);
  font-size: 3.35rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 0.95;
  text-shadow: 0 0 18px rgba(157, 255, 179, 0.45);
}

.terminal-ribbon {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.terminal-ribbon span {
  min-height: 24px;
  padding: 4px 8px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(157, 255, 179, 0.19);
  background: rgba(2, 16, 6, 0.72);
}

.clock-module {
  min-width: 0;
  padding: 10px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-items: center;
  justify-items: center;
  color: var(--ink);
  background:
    repeating-linear-gradient(0deg, rgba(157, 255, 179, 0.08) 0 1px, transparent 1px 6px),
    #020604;
  border: 1px solid var(--line-hard);
  border-radius: 2px;
  box-shadow: inset 0 0 32px rgba(157, 255, 179, 0.1);
}

.clock-module strong {
  font-family: var(--title);
  font-size: 3.25rem;
  line-height: 1;
  color: var(--bank-accent);
  text-shadow: 0 0 16px color-mix(in srgb, var(--bank-accent), transparent 35%);
}

.control-board {
  padding: 10px;
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr) 270px;
  gap: 10px;
  align-items: stretch;
}

.control-group,
.control-status,
.news-control,
.news-status {
  min-width: 0;
  padding: 10px;
  display: grid;
  gap: 8px;
  align-content: start;
  background: rgba(2, 10, 5, 0.78);
  border: 1px solid rgba(157, 255, 179, 0.18);
  border-radius: 2px;
}

.typing-chip-row {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bank-group .typing-chip-row {
  max-height: 94px;
  overflow-y: auto;
  padding-right: 2px;
}

.typing-chip {
  min-width: 68px;
  min-height: 38px;
  padding: 0 10px;
  color: var(--ink);
  background: #06110b;
  border: 1px solid rgba(157, 255, 179, 0.28);
  border-radius: 2px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.42);
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.typing-chip:hover,
.typing-chip:focus-visible {
  color: var(--ink-hot);
  background: #0c2113;
  border-color: var(--bank-accent);
  outline: 2px solid rgba(255, 191, 74, 0.65);
  outline-offset: 2px;
}

.typing-chip:active {
  transform: translateY(1px);
}

.typing-chip.is-active {
  color: #020604;
  background: var(--bank-accent);
  border-color: var(--bank-accent);
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.28), 0 0 18px color-mix(in srgb, var(--bank-accent), transparent 62%);
}

.control-status {
  align-content: center;
  gap: 4px;
  color: var(--ink-hot);
}

.control-status span {
  font-size: 1rem;
}

.news-board {
  padding: 10px;
  display: grid;
  grid-template-columns: 220px minmax(260px, 1fr) 280px;
  gap: 10px;
  align-items: stretch;
}

.news-url-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto auto;
  gap: 6px;
}

.news-input,
.news-select {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 0 10px;
  color: var(--ink-hot);
  background: #020604;
  border: 1px solid rgba(157, 255, 179, 0.28);
  border-radius: 2px;
  outline: none;
  box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.58);
}

.news-input:focus,
.news-select:focus {
  border-color: var(--bank-accent);
  box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.58), 0 0 0 3px color-mix(in srgb, var(--bank-accent), transparent 84%);
}

.news-status {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  color: var(--amber);
}

.news-status span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.is-hidden {
  display: none !important;
}

.typing-metrics {
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.typing-metric {
  min-width: 0;
  min-height: 82px;
  padding: 10px;
  display: grid;
  align-content: space-between;
  gap: 8px;
  background:
    linear-gradient(180deg, rgba(157, 255, 179, 0.05), transparent),
    #020b05;
  border: 1px solid rgba(157, 255, 179, 0.18);
  border-radius: 2px;
}

.typing-metric strong {
  min-width: 0;
  color: var(--ink-hot);
  font-family: var(--title);
  font-size: 2rem;
  line-height: 1;
  text-shadow: 0 0 12px rgba(157, 255, 179, 0.36);
  overflow-wrap: anywhere;
}

.typing-deck {
  min-width: 0;
  min-height: 0;
  padding: 12px;
  display: grid;
  grid-template-rows: auto auto minmax(180px, 1fr) minmax(126px, auto) auto auto;
  gap: 10px;
  background:
    linear-gradient(180deg, rgba(157, 255, 179, 0.08), transparent 140px),
    #020905;
}

.paper-strip {
  min-height: 34px;
  padding: 0 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(157, 255, 179, 0.14);
}

.paper-strip span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.typing-progress {
  height: 15px;
  overflow: hidden;
  background: #010402;
  border: 1px solid rgba(157, 255, 179, 0.34);
  border-radius: 1px;
}

.typing-progress span {
  display: block;
  width: 0%;
  height: 100%;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.36) 0 8px, transparent 8px 15px),
    var(--bank-accent);
  box-shadow: 0 0 16px color-mix(in srgb, var(--bank-accent), transparent 46%);
  transition: width 0.12s ease;
}

.typing-prompt {
  min-width: 0;
  min-height: 180px;
  max-height: 330px;
  overflow-y: auto;
  padding: 18px;
  color: rgba(217, 255, 225, 0.36);
  background:
    repeating-linear-gradient(0deg, rgba(157, 255, 179, 0.055) 0 1px, transparent 1px 31px),
    linear-gradient(180deg, rgba(157, 255, 179, 0.04), transparent 50%),
    var(--screen);
  border: 1px solid var(--line-hard);
  border-radius: 2px;
  font-size: 1.08rem;
  line-height: 2;
  text-shadow: 0 0 8px rgba(157, 255, 179, 0.18);
  box-shadow: inset 0 0 38px rgba(0, 0, 0, 0.76), inset 0 0 18px rgba(157, 255, 179, 0.08);
  overflow-wrap: anywhere;
}

.typing-char {
  border-radius: 1px;
  transition: background 0.08s ease, color 0.08s ease;
}

.typing-char.is-correct {
  color: var(--ink-hot);
  text-shadow: 0 0 10px rgba(157, 255, 179, 0.62);
}

.typing-char.is-incorrect {
  color: #160503;
  background: var(--red);
  text-shadow: none;
}

.typing-char.is-current {
  color: var(--ink-hot);
  background: color-mix(in srgb, var(--bank-accent), transparent 72%);
  box-shadow:
    inset 0 -2px 0 var(--bank-accent),
    0 0 14px color-mix(in srgb, var(--bank-accent), transparent 50%);
  text-shadow: 0 0 8px rgba(242, 255, 244, 0.62);
}

.typing-input {
  width: 100%;
  min-width: 0;
  min-height: 126px;
  padding: 14px;
  resize: vertical;
  color: var(--ink-hot);
  background:
    repeating-linear-gradient(0deg, rgba(157, 255, 179, 0.045) 0 1px, transparent 1px 28px),
    #020604;
  border: 1px solid var(--line-hard);
  border-radius: 2px;
  outline: none;
  font-size: 1rem;
  line-height: 1.7;
  caret-color: var(--amber);
  text-shadow: 0 0 8px rgba(157, 255, 179, 0.34);
  box-shadow: inset 0 0 26px rgba(0, 0, 0, 0.78);
}

.typing-input:focus {
  border-color: var(--amber);
  box-shadow: inset 0 0 26px rgba(0, 0, 0, 0.78), 0 0 0 3px rgba(255, 191, 74, 0.16);
}

.typing-input:disabled {
  opacity: 0.72;
}

.typing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.action-button {
  min-height: 42px;
  min-width: 112px;
  padding: 0 14px;
  color: var(--ink);
  background: #07120b;
  border: 1px solid rgba(157, 255, 179, 0.34);
  border-radius: 2px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.42);
  transition: transform 0.16s ease, color 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.action-button:hover,
.action-button:focus-visible {
  color: var(--ink-hot);
  background: #0d2314;
  border-color: var(--amber);
  outline: 2px solid rgba(255, 191, 74, 0.52);
  outline-offset: 2px;
}

.action-button:active {
  transform: translateY(1px);
}

.action-button.is-primary {
  color: #020604;
  background: var(--bank-accent);
  border-color: var(--bank-accent);
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.25), 0 0 18px color-mix(in srgb, var(--bank-accent), transparent 62%);
}

.typing-result {
  min-height: 46px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  color: var(--amber);
  background: rgba(255, 191, 74, 0.08);
  border: 1px solid rgba(255, 191, 74, 0.32);
  border-left: 8px solid var(--amber);
  border-radius: 2px;
  overflow-wrap: anywhere;
}

@media (max-width: 980px) {
  .typing-station {
    min-height: auto;
  }

  .control-board,
  .news-board {
    grid-template-columns: 1fr;
  }

  .typing-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .bank-group .typing-chip-row {
    max-height: none;
  }
}

@media (max-width: 640px) {
  body.typing-standalone {
    background:
      repeating-linear-gradient(90deg, rgba(157, 255, 179, 0.05) 0 1px, transparent 1px 44px),
      linear-gradient(135deg, #020503, #07120c);
  }

  .typing-station {
    width: min(100% - 16px, 1420px);
    margin: 8px auto;
    padding: 8px;
    gap: 8px;
  }

  .typing-station::before {
    font-size: 0.64rem;
  }

  .station-header {
    min-height: auto;
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .brand-lockup {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 10px;
  }

  .brand-mark {
    width: 58px;
    height: 58px;
    font-size: 1.2rem;
  }

  .brand-copy h1 {
    font-size: 2.15rem;
  }

  .terminal-ribbon {
    display: none;
  }

  .clock-module {
    min-height: 72px;
    grid-template-columns: 1fr auto auto;
    grid-template-rows: 1fr;
    justify-items: start;
    gap: 8px;
  }

  .clock-module strong {
    font-size: 2.45rem;
  }

  .typing-metrics {
    order: 5;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 8px;
  }

  .control-board {
    order: 2;
  }

  .news-board {
    order: 3;
    padding: 8px;
  }

  .news-url-row {
    grid-template-columns: 1fr;
  }

  .typing-deck {
    order: 4;
    padding: 8px;
    grid-template-rows: auto auto minmax(210px, auto) minmax(146px, auto) auto auto;
  }

  .bank-group .typing-chip-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .bank-group .typing-chip {
    flex: 0 0 auto;
  }

  .typing-metric {
    min-height: 72px;
  }

  .typing-metric strong {
    font-size: 1.58rem;
  }

  .typing-prompt {
    min-height: 210px;
    max-height: 360px;
    padding: 14px;
    font-size: 1rem;
  }

  .typing-input {
    min-height: 146px;
  }

  .typing-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .action-button {
    width: 100%;
  }
}
