:root {
  --bg0: #020403;
  --bg1: #0a1114;

  --crt-bg: #000000;
  --crt-bg-tint: #020403;
  --phosphor: #39ff7a;
  --phosphor-bright: #56ff92;
  --phosphor-dim: rgba(57, 255, 122, 0.70);
  --phosphor-line: rgba(57, 255, 122, 0.55);
  --link: #56ff92;
  --link-hover: #7affb3;
  --glow-1: rgba(57, 255, 122, 0.42);
  --glow-2: rgba(57, 255, 122, 0.20);

  --bezel: #101318;
  --bezel2: #0a0d11;

  --glass: rgba(255, 255, 255, 0.06);
  --shadow: rgba(0, 0, 0, 0.55);

  --radius: 26px;
  --radius-inner: 18px;
  --laggy-font-base: 16px;
  --laggy-font-scale: 1;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background:
    radial-gradient(1200px 700px at 50% 35%, #0b1a10 0%, var(--bg0) 55%, #000 100%);
  color: var(--phosphor);
}

/* Accessibility: Skip link for keyboard navigation */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--phosphor);
  color: var(--bg0);
  padding: 8px;
  text-decoration: none;
  z-index: 100;
}

.skip-link:focus {
  top: 0;
}

/* Screen reader only content for SEO */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

body {
  display: grid;
  place-items: center;
  padding: 20px;
  font-family: "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: var(--laggy-font-base);
}

a {
  color: var(--link);
  text-decoration: none;
  transition: color 0.2s ease, text-shadow 0.2s ease;
}

a:visited {
  color: var(--link);
}

a:hover,
a:focus-visible {
  color: var(--link-hover);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
  text-shadow: 0 0 8px var(--glow-1), 0 0 16px var(--glow-2);
  outline: none;
}

a:focus-visible {
  outline: 2px solid rgba(86, 255, 146, 0.8);
  outline-offset: 2px;
  border-radius: 2px;
}

.terminal {
  font-size: calc(var(--laggy-font-base) * var(--laggy-font-scale));
}

.stage {
  width: min(1080px, 100%);
}

.crt {
  filter: drop-shadow(0 30px 60px var(--shadow));
}

.crt__bezel {
  background: linear-gradient(145deg, var(--bezel), var(--bezel2));
  border-radius: var(--radius);
  padding: 18px;
  position: relative;
  overflow: hidden;
}

.crt__bezel::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(255,255,255,0.14), rgba(255,255,255,0));
  pointer-events: none;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 8px 14px 8px;
  min-height: 52px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  font-family: "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.brand__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--phosphor);
  box-shadow: 0 0 16px var(--phosphor-soft);
}

.brand__text {
  font-weight: 700;
  letter-spacing: 0.08em;
  opacity: 0.95;
}

.status {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.font-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.font-control-btn {
  min-width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(77, 255, 123, 0.18);
  background: rgba(0, 0, 0, 0.35);
  color: var(--phosphor);
  font-family: "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.35);
}

.font-control-btn:hover {
  background: rgba(77, 255, 123, 0.12);
}

.font-control-btn:focus-visible {
  outline: 2px solid #56ff92;
  outline-offset: 2px;
}

.status__pill {
  display: inline-block;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(77, 255, 123, 0.18);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.35);
  opacity: 0.92;
  min-width: 12ch;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.sound-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(77, 255, 123, 0.18);
  background: rgba(0, 0, 0, 0.35);
  color: var(--phosphor);
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.35);
}

.sound-toggle__icon {
  width: 18px;
  height: 18px;
}

.sound-toggle__speaker {
  fill: var(--phosphor);
}

.sound-toggle__wave,
.sound-toggle__slash {
  fill: none;
  stroke: var(--phosphor);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sound-toggle__slash {
  opacity: 0;
}

.sound-toggle.is-muted .sound-toggle__wave {
  opacity: 0.2;
}

.sound-toggle.is-muted .sound-toggle__slash {
  opacity: 1;
}

.screen {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-inner);
  background: var(--crt-bg);
  padding: 22px 22px 16px 22px;
  min-height: 700px;
  height: clamp(700px, 88vh, 920px);
  max-width: 1080px;
  margin: 0 auto;
  overflow: hidden;

  transform: none;
  box-shadow:
    inset 0 0 0 1px rgba(77, 255, 123, 0.12),
    inset 0 0 80px rgba(0, 0, 0, 0.88),
    0 10px 60px rgba(0, 0, 0, 0.55);
}

.screen::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: var(--radius-inner);
  box-shadow:
    inset 0 0 30px rgba(57, 255, 122, 0.06),
    inset 0 0 60px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  mix-blend-mode: screen;
}

.crt-layer-base,
.crt-layer-scanlines,
.crt-layer-phosphor,
.crt-layer-reflection,
.crt-layer-footerScrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.crt-layer-base {
  z-index: 0;
  background: radial-gradient(120% 90% at 50% 45%, rgba(7,20,12,0.40) 0%, rgba(0,0,0,1) 62%, rgba(0,0,0,1) 100%);
}

.crt-layer-scanlines {
  z-index: 1;
  opacity: 0.30;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0,0,0,0.24) 0px,
    rgba(0,0,0,0.24) 1px,
    rgba(0,0,0,0) 2px,
    rgba(0,0,0,0) 4px
  );
}

.crt-layer-phosphor {
  z-index: 2;
  opacity: 0.14;
  background:
    repeating-linear-gradient(
      to right,
      rgba(57,255,122,0.10) 0px,
      rgba(57,255,122,0.10) 1px,
      rgba(0,0,0,0) 3px,
      rgba(0,0,0,0) 4px
    ),
    repeating-linear-gradient(
      to bottom,
      rgba(255,255,255,0.02) 0px,
      rgba(255,255,255,0.02) 1px,
      rgba(0,0,0,0) 6px,
      rgba(0,0,0,0) 7px
    );
  mix-blend-mode: screen;
}

.crt-layer-reflection {
  z-index: 3;
  opacity: 1;
  background:
    radial-gradient(60% 45% at 18% 14%, rgba(255,255,255,0.22) 0%, rgba(255,255,255,0.10) 22%, rgba(255,255,255,0) 55%),
    linear-gradient(125deg, rgba(255,255,255,0.16) 0%, rgba(255,255,255,0.07) 16%, rgba(255,255,255,0) 40%),
    linear-gradient(90deg, rgba(255,255,255,0) 70%, rgba(255,255,255,0.06) 84%, rgba(255,255,255,0) 100%),
    radial-gradient(ellipse at center, rgba(0,0,0,0) 42%, rgba(0,0,0,0.26) 74%, rgba(0,0,0,0.58) 100%);
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,1) 60%, rgba(0,0,0,0) 78%);
  mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,1) 60%, rgba(0,0,0,0) 78%);
}

.crt-layer-footerScrim {
  z-index: 4;
  background: linear-gradient(to top, rgba(0,0,0,0.96) 0%, rgba(0,0,0,0.72) 55%, rgba(0,0,0,0.00) 100%);
}

.crt-content {
  position: relative;
  z-index: 10;
  color: var(--phosphor);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.screen.break-active .crt-content {
  opacity: 0;
  pointer-events: none;
}

.screen__overlay {
  display: none;
}

.crt-noise {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.05;
  background-image:
    repeating-linear-gradient(
      0deg,
      rgba(255,255,255,0.03),
      rgba(255,255,255,0.03) 1px,
      rgba(0,0,0,0) 2px,
      rgba(0,0,0,0) 3px
    );
  animation: crtFlicker 2.4s infinite;
}

@keyframes crtFlicker {
  0%, 100% { opacity: 0.045; }
  50% { opacity: 0.065; }
}

.crt-footer-scrim {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 32%;
  pointer-events: none;
  background: linear-gradient(to top, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0.72) 45%, rgba(0,0,0,0.00) 100%);
}

.screen__overlay {
  will-change: transform;
}

.feedback-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(0, 0, 0, 0.86);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.feedback-panel {
  width: min(640px, 100%);
  background: rgba(0, 0, 0, 0.92);
  border: 1px solid var(--phosphor-line);
  box-shadow: 0 0 18px rgba(57, 255, 122, 0.18);
  padding: 16px;
  color: var(--phosphor);
  font-family: "VT323", "Share Tech Mono", monospace;
}

.feedback-panel h2 {
  margin: 0 0 8px 0;
  font-size: 18px;
  text-shadow: 0 0 6px var(--glow-1), 0 0 12px var(--glow-2);
}

.feedback-panel textarea {
  width: 100%;
  min-height: 180px;
  background: rgba(2, 4, 3, 0.9);
  color: var(--phosphor);
  border: 1px solid var(--phosphor-line);
  padding: 10px;
  font-family: "VT323", "Share Tech Mono", monospace;
  font-size: 16px;
  outline: none;
  resize: vertical;
  text-shadow: 0 0 6px var(--glow-1), 0 0 12px var(--glow-2);
}

.feedback-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  justify-content: flex-end;
}

.feedback-actions button {
  background: rgba(0, 0, 0, 0.7);
  color: var(--phosphor);
  border: 1px solid var(--phosphor-line);
  padding: 8px 12px;
  cursor: pointer;
  font-family: "Share Tech Mono", monospace;
  text-shadow: 0 0 6px var(--glow-1), 0 0 12px var(--glow-2);
}

.feedback-actions button:hover {
  background: rgba(57, 255, 122, 0.12);
}

.consent-shell {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.78);
  z-index: 1300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.consent-shell.is-open {
  opacity: 1;
  pointer-events: auto;
}

.consent-panel {
  width: min(560px, 94vw);
  background: rgba(0, 0, 0, 0.92);
  border: 1px solid var(--phosphor-line);
  box-shadow: 0 0 18px rgba(57, 255, 122, 0.22);
  padding: 16px;
  color: var(--phosphor);
  font-family: "Share Tech Mono", monospace;
}

.consent-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.consent-title {
  font-size: 18px;
  font-weight: 700;
  text-shadow: 0 0 6px var(--glow-1), 0 0 12px var(--glow-2);
}

.consent-subtitle {
  font-size: 13px;
  color: var(--phosphor-dim);
}

.consent-copy {
  margin-top: 6px;
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--phosphor-bright);
  line-height: 1.5;
}

.consent-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}

.consent-btn {
  flex: 1;
  min-width: 120px;
}

.consent-accept-primary {
  background: #39FF14;
  border: 1px solid #2ECC40;
  box-shadow:
    0 0 20px rgba(57, 255, 20, 0.8),
    0 0 40px rgba(57, 255, 20, 0.4),
    inset 0 0 10px rgba(255, 255, 255, 0.1);
  color: #000;
  font-weight: 700;
  padding: 14px 24px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.consent-primary {
  display: block;
  width: 100%;
  max-width: 720px;
  margin: 16px auto 10px;
  padding: 18px 18px;
  font-size: 18px;
  letter-spacing: 0.5px;
  border-radius: 14px;
  border: 1px solid rgba(80, 255, 160, 0.55);
  background: rgba(0, 0, 0, 0.55);
  box-shadow:
    0 0 0 1px rgba(80, 255, 160, 0.25) inset,
    0 10px 26px rgba(0, 0, 0, 0.55),
    0 0 28px rgba(80, 255, 160, 0.35);
  color: var(--phosphor-bright);
  text-transform: none;
}

.consent-primary-note {
  margin: -2px auto 6px;
  max-width: 720px;
  font-size: 13px;
  color: var(--phosphor-dim);
  text-align: center;
  line-height: 1.4;
}

.consent-primary:hover {
  box-shadow:
    0 0 0 1px rgba(80, 255, 160, 0.35) inset,
    0 12px 30px rgba(0, 0, 0, 0.60),
    0 0 34px rgba(80, 255, 160, 0.50);
  transform: translateY(-1px);
}

.consent-primary:active {
  transform: translateY(0);
  box-shadow:
    0 0 0 1px rgba(80, 255, 160, 0.30) inset,
    0 8px 22px rgba(0, 0, 0, 0.55),
    0 0 26px rgba(80, 255, 160, 0.38);
}

.consent-primary:focus-visible {
  outline: 2px solid rgba(120, 255, 190, 0.95);
  outline-offset: 3px;
}

.consent-accept-primary:hover {
  background: #4AFF2E;
  box-shadow:
    0 0 25px rgba(57, 255, 20, 1),
    0 0 50px rgba(57, 255, 20, 0.6),
    inset 0 0 10px rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.consent-accept-primary:focus-visible {
  outline: 2px solid #56ff92;
  outline-offset: 2px;
}

.consent-accept-primary:active {
  transform: translateY(0);
}

.consent-links {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 4px;
}

.consent-link {
  color: var(--phosphor-bright);
  text-decoration: underline;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.consent-link:hover {
  color: #7affb3;
  text-shadow: 0 0 8px var(--glow-1), 0 0 16px var(--glow-2);
}

.consent-link:focus-visible {
  outline: 2px solid #56ff92;
  outline-offset: 2px;
  border-radius: 2px;
}

.consent-command {
  font-family: "Share Tech Mono", monospace;
  color: var(--phosphor-bright);
  font-weight: 600;
  text-shadow: 0 0 6px var(--glow-1);
}

.consent-customise {
  display: none;
  border-top: 1px solid rgba(77, 255, 123, 0.18);
  padding-top: 10px;
  margin-top: 6px;
}

.consent-customise.is-visible {
  display: block;
}

.consent-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 14px;
}

.consent-toggle input {
  accent-color: var(--phosphor);
  width: 18px;
  height: 18px;
}

.consent-note {
  font-size: 12px;
  color: var(--phosphor-dim);
  margin: 8px 0 12px 0;
}

.consent-save-row {
  display: none;
}

.consent-close {
  background: transparent;
  border: 1px solid var(--phosphor-line);
  color: var(--phosphor);
  font-size: 18px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
}

@keyframes scan {
  0% { transform: translateY(-6px); }
  100% { transform: translateY(6px); }
}

.speed-readout {
  text-align: center;
  padding: 20px 0 24px 0;
  border-bottom: 1px solid rgba(77, 255, 123, 0.15);
  margin-bottom: 16px;
}

.speed-readout--stats {
  min-height: 56px;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.speed-readout--stats.is-visible {
  visibility: visible;
  opacity: 1;
}

.speed-readout__label {
  font-size: 1em;
  font-family: "Share Tech Mono", monospace;
  letter-spacing: 0.1em;
  opacity: 0.85;
  margin-bottom: 8px;
  text-shadow: 0 0 6px var(--glow-1), 0 0 18px var(--glow-2);
}

.speed-readout__value {
  font-size: 5.5em;
  font-family: "VT323", "Share Tech Mono", monospace;
  font-weight: normal;
  line-height: 1;
  text-shadow:
    0 0 10px rgba(57, 255, 122, 0.45),
    0 0 26px rgba(57, 255, 122, 0.22);
  letter-spacing: 0.05em;
  margin: 8px 0;
  transition: opacity 0.1s ease;
}

.speed-readout__value--flickering {
  animation: speedFlicker 0.1s steps(2) infinite;
}

.speed-readout__value--flip {
  animation: flipClock 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: center bottom;
}

@keyframes speedFlicker {
  0%, 49% { opacity: 1; filter: brightness(1); }
  50%, 100% { opacity: 0.85; filter: brightness(1.1); }
}

@keyframes flipClock {
  0%   { transform: rotateX(0deg) scale(1); filter: brightness(1.05); }
  40%  { transform: rotateX(-86deg) scale(0.96); filter: brightness(0.9); }
  70%  { transform: rotateX(12deg) scale(1.01); filter: brightness(1.15); }
  100% { transform: rotateX(0deg) scale(1); filter: brightness(1); }
}

.speed-readout__unit {
  font-size: 1.25em;
  font-family: "Share Tech Mono", monospace;
  letter-spacing: 0.1em;
  opacity: 0.80;
  margin-top: 4px;
  text-shadow: 0 0 10px rgba(77, 255, 123, 0.25);
}

.progress {
  display: grid;
  grid-auto-flow: column;
  gap: 6px;
  margin: 8px 0 18px 0;
  min-height: 12px;
}

.progress__segment {
  height: 12px;
  background: rgba(57, 255, 122, 0.16);
  border: 1px solid var(--phosphor-line);
  border-radius: 4px;
  box-shadow: inset 0 0 8px rgba(77, 255, 123, 0.2);
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.progress__segment--active {
  background: rgba(77, 255, 123, 0.28);
  box-shadow:
    0 0 8px rgba(77, 255, 123, 0.45),
    inset 0 0 12px rgba(77, 255, 123, 0.35);
}

/* BREAK overlay */
.break-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 999;
  overflow: hidden;
  pointer-events: none;
}

.break-char {
  position: absolute;
  color: var(--phosphor);
  font-family: "VT323", "Share Tech Mono", monospace;
  font-size: 18px;
  text-shadow:
    0 0 6px rgba(77, 255, 123, 0.7),
    0 0 12px rgba(77, 255, 123, 0.35);
  will-change: transform;
  user-select: none;
}

.break-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 45% 35%, rgba(57,255,122,0.28), rgba(0,0,0,0));
  opacity: 0;
  transition: opacity 120ms ease-out;
  pointer-events: none;
}

.break-tear {
  position: absolute;
  inset: 0;
  pointer-events: none;
  mix-blend-mode: screen;
}

.break-tear__slice {
  position: absolute;
  left: -8%;
  width: 116%;
  height: 6px;
  background: linear-gradient(90deg, rgba(57,255,122,0) 0%, rgba(57,255,122,0.18) 30%, rgba(57,255,122,0.12) 60%, rgba(57,255,122,0) 100%);
  opacity: 0;
}

.break-countdown {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 16px;
  font-family: "VT323", "Share Tech Mono", monospace;
  font-size: 18px;
  color: var(--phosphor);
  text-shadow: 0 0 8px var(--glow-1), 0 0 18px var(--glow-2);
  pointer-events: none;
}

.output {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.25;
  font-size: 1.25em;
  font-family: "VT323", "Share Tech Mono", monospace;
  text-shadow: 0 0 6px var(--glow-1), 0 0 18px var(--glow-2);
  letter-spacing: 0.02em;
  padding: 0 8px 16px 2px;
  max-width: 92%;
  color: var(--phosphor);
}

.terminal-viewport {
  flex: 1;
  overflow: auto;
  margin-top: 10px;
  padding-right: 10px;
  padding-left: 6px;
  padding-bottom: calc(84px + env(safe-area-inset-bottom)); /* keep latest typed line visible above prompt/footer */
  min-height: 400px; /* ensure minimum visible area for terminal output */
  mask-image: linear-gradient(to bottom, transparent 0px, rgba(0,0,0,0.9) 16px, rgba(0,0,0,1) calc(100% - 12px), transparent 100%);
  scrollbar-gutter: stable;
}

.insights-viewport {
  padding-bottom: 10px;
  min-height: 360px;
}

.insights-intro {
  margin-bottom: 10px;
  padding: 6px 6px 8px 6px;
  border: 1px solid rgba(77, 255, 123, 0.25);
  background: rgba(0, 0, 0, 0.4);
}

.insights-intro__title {
  font-family: "VT323", "Share Tech Mono", monospace;
  font-size: clamp(18px, 1.2vw, 22px);
  text-shadow: 0 0 6px var(--glow-1), 0 0 12px var(--glow-2);
}

.insights-intro__desc {
  margin-top: 4px;
  font-family: "VT323", "Share Tech Mono", monospace;
  font-size: clamp(12px, 0.85vw, 15px);
  color: var(--phosphor-bright);
  text-shadow: 0 0 6px var(--glow-1);
}

.insights-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.insights-panel {
  margin: 0;
  padding: 8px 8px 6px 8px;
  border: 1px solid rgba(77, 255, 123, 0.25);
  background: rgba(0, 0, 0, 0.42);
  font-family: "VT323", "Share Tech Mono", monospace;
  font-size: clamp(12px, 0.85vw, 15px);
  line-height: 1.1;
  position: relative;
  min-height: 168px;
  text-shadow: 0 0 6px var(--glow-1), 0 0 12px var(--glow-2);
}

.insights-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.insights-panel__title {
  font-size: 16px;
  letter-spacing: 0.06em;
}

.insights-info {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid rgba(77, 255, 123, 0.4);
  background: rgba(0, 0, 0, 0.7);
  color: var(--phosphor-bright);
  font-family: "Share Tech Mono", monospace;
  font-size: 12px;
  line-height: 18px;
  cursor: pointer;
  padding: 0;
}

.insights-info:focus-visible {
  outline: 2px solid rgba(86, 255, 146, 0.8);
  outline-offset: 2px;
}

.insights-tooltip {
  position: absolute;
  top: 30px;
  right: 10px;
  width: 220px;
  background: rgba(0, 0, 0, 0.95);
  border: 1px solid rgba(77, 255, 123, 0.6);
  padding: 8px;
  font-size: 12px;
  line-height: 1.25;
  color: var(--phosphor-bright);
  box-shadow: 0 0 12px rgba(57, 255, 122, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
  z-index: 20;
}

.insights-info:hover + .insights-tooltip,
.insights-info:focus + .insights-tooltip,
.insights-tooltip.is-open {
  opacity: 1;
  pointer-events: auto;
}

.insights-panel__primary {
  font-size: clamp(20px, 1.7vw, 26px);
  color: var(--phosphor-bright);
  margin-bottom: 4px;
}

.insights-panel__primary--grade {
  letter-spacing: 0.08em;
}

.insights-panel__values {
  white-space: pre-line;
  font-size: clamp(12px, 0.8vw, 14px);
  color: var(--phosphor);
  margin-bottom: 6px;
}

.insights-panel__meta {
  font-size: clamp(11px, 0.75vw, 13px);
  color: var(--phosphor-dim);
  margin-top: 2px;
}

.insights-panel__note {
  font-size: clamp(11px, 0.75vw, 12px);
  color: rgba(57, 255, 122, 0.6);
  margin-top: 4px;
}

.insights-panel__chart {
  display: block;
  width: 100%;
  height: 80px;
  margin: 4px 0 6px 0;
  image-rendering: pixelated;
  opacity: 0.9;
  border: 1px solid rgba(57, 255, 122, 0.15);
  background: #000;
}

.insights-status {
  margin-top: 8px;
  white-space: pre;
  font-family: "VT323", "Share Tech Mono", monospace;
  font-size: clamp(12px, 0.85vw, 15px);
  line-height: 1.08;
  text-shadow: 0 0 6px var(--glow-1), 0 0 12px var(--glow-2);
}

@media (max-width: 960px) {
  .insights-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .insights-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-height: 900px) {
  .insights-panel {
    font-size: clamp(11px, 0.8vw, 14px);
    min-height: 158px;
  }
  .insights-intro__title {
    font-size: clamp(16px, 1vw, 19px);
  }
  .insights-panel__chart {
    height: 70px;
  }
}

.terminal-viewport::-webkit-scrollbar {
  width: 8px;
}
.terminal-viewport::-webkit-scrollbar-thumb {
  background: rgba(77, 255, 123, 0.25);
  border-radius: 6px;
}
.terminal-viewport::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.35);
}

.prompt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0 10px 0;
  border-top: 1px solid rgba(77, 255, 123, 0.12);
}

.prompt__label {
  opacity: 0.95;
  text-shadow: 0 0 6px var(--glow-1), 0 0 18px var(--glow-2);
}

.prompt__input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--phosphor);
  font: inherit;
  font-family: "VT323", "Share Tech Mono", monospace;
  font-size: 1.375em;
  letter-spacing: 0.03em;
  text-shadow:
    0 0 6px var(--glow-1),
    0 0 18px var(--glow-2);
  caret-color: transparent;
}

.prompt__input--ghost {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.prompt__mirror {
  min-width: 1ch;
  white-space: pre-wrap;
  font-family: "VT323", "Share Tech Mono", monospace;
  font-size: 1.375em;
  letter-spacing: 0.03em;
  color: var(--phosphor-bright);
  text-shadow: 0 0 6px var(--glow-1), 0 0 18px var(--glow-2);
}

.blockCaret {
  display: inline-block;
  width: 0.7em;
  height: 1.05em;
  margin-left: 0;
  background: rgba(57,255,122,0.85);
  box-shadow: 0 0 10px rgba(57,255,122,0.35);
  vertical-align: baseline;
  animation: caretBlink 1s steps(1) infinite;
}

@keyframes caretBlink {
  50% { opacity: 0; }
}

.prompt__caret {
  display: none;
}

@keyframes blink {
  0%, 49% { opacity: 0.0; }
  50%, 100% { opacity: 0.85; }
}

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(57, 255, 122, 0.22);
  background: rgba(0,0,0,0.72);
  flex-wrap: wrap;
  min-height: 52px;
}

.font-toast {
  opacity: 0;
  font-size: 0.75em;
  color: var(--phosphor-bright);
  letter-spacing: 0.04em;
  transition: opacity 200ms ease;
}

.font-toast.is-visible {
  opacity: 0.9;
}

.insights-footer {
  justify-content: space-between;
  gap: 16px;
}

.footer__hint {
  font-size: 0.8125em;
  color: var(--phosphor-bright);
  opacity: 0.85;
}

.footer__version {
  font-size: 0.75em;
  color: var(--phosphor-bright);
  letter-spacing: 0.08em;
  opacity: 0.8;
}

.footer__note {
  font-size: 0.6875em;
  color: var(--phosphor-dim);
  text-shadow: 0 0 6px var(--glow-1), 0 0 12px var(--glow-2);
}

.footer__cta {
  font-size: 0.75em;
  color: var(--phosphor-bright);
  text-decoration: none;
  text-shadow: 0 0 6px var(--glow-1), 0 0 12px var(--glow-2);
}

.footer__cta:hover {
  text-decoration: underline;
}

.footer__links {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.footer__menu {
  position: relative;
  border: 1px solid rgba(77, 255, 123, 0.28);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  padding: 4px 8px;
}

.footer__menu summary {
  list-style: none;
  cursor: pointer;
  color: var(--phosphor-bright);
  font-size: 0.75em;
  text-shadow: 0 0 6px var(--glow-1), 0 0 14px var(--glow-2);
  padding: 6px 8px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.footer__menu summary::-webkit-details-marker {
  display: none;
}

.footer__menu summary:focus-visible {
  outline: 2px solid rgba(86, 255, 146, 0.8);
  outline-offset: 2px;
  border-radius: 6px;
}

.footer__menu-links {
  display: grid;
  gap: 6px;
  padding: 8px 6px 4px;
}

.footer__link {
  color: var(--phosphor-bright);
  text-decoration: none;
  font-size: 0.75em;
  text-shadow: 0 0 6px var(--glow-1), 0 0 14px var(--glow-2);
  white-space: nowrap;
}

.footer__link:visited,
.nav-link:visited {
  color: var(--phosphor-bright);
}

.footer__link--button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
  color: var(--phosphor-bright);
  text-shadow: 0 0 6px var(--glow-1), 0 0 14px var(--glow-2);
}

.seo-section {
  max-width: 980px;
  margin: 18px auto 0;
  padding: 12px 14px;
  border: 1px solid var(--phosphor-line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.45);
  font-family: "VT323", "Share Tech Mono", monospace;
  color: var(--phosphor);
  font-size: 0.95em;
}

.seo-section h2 {
  margin: 0 0 8px 0;
  color: var(--phosphor-bright);
  text-shadow: 0 0 8px var(--glow-1), 0 0 16px var(--glow-2);
  letter-spacing: 0.05em;
  font-size: 1.1em;
}

.seo-section h1 {
  margin: 0 0 8px 0;
  color: var(--phosphor-bright);
  text-shadow: 0 0 8px var(--glow-1), 0 0 16px var(--glow-2);
  letter-spacing: 0.05em;
  font-size: 1.2em;
}

.seo-section p {
  margin: 0 0 10px 0;
  color: var(--phosphor-dim);
}

.seo-details {
  margin-top: 10px;
  border: 1px solid var(--phosphor-line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  padding: 10px 12px;
}

.seo-details summary {
  cursor: pointer;
  color: var(--phosphor-bright);
  text-shadow: 0 0 6px var(--glow-1);
  letter-spacing: 0.04em;
}

.seo-details summary:focus-visible {
  outline: 2px solid rgba(86, 255, 146, 0.8);
  outline-offset: 2px;
  border-radius: 4px;
}

.seo-details ul,
.seo-details dl {
  margin: 8px 0 0 18px;
  color: var(--phosphor);
}

.seo-details h3 {
  margin: 12px 0 6px 0;
  color: var(--phosphor-bright);
  font-size: 1.05em;
  text-shadow: 0 0 6px var(--glow-1);
}

.seo-details h4 {
  margin: 10px 0 4px 0;
  color: var(--phosphor-bright);
  font-size: 0.98em;
  text-shadow: 0 0 6px var(--glow-1);
}

.seo-details dt {
  color: var(--phosphor-bright);
  margin-top: 8px;
}

.seo-details dd {
  margin: 4px 0 0 0;
  color: var(--phosphor-dim);
}

.help-details[open] {
  max-height: 520px;
  overflow: auto;
}

.help-details .meta {
  margin-top: 8px;
  color: var(--phosphor-dim);
  font-size: 0.95em;
}

.interpret-wrap {
  max-width: 980px;
  margin: 18px auto 0;
  padding: 0 6px;
}

.interpret-details {
  border: 1px solid var(--phosphor-line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.45);
  padding: 10px 14px;
  font-family: "VT323", "Share Tech Mono", monospace;
  color: var(--phosphor);
  font-size: 0.95em;
}

.interpret-details summary {
  cursor: pointer;
  color: var(--phosphor-bright);
  text-shadow: 0 0 6px var(--glow-1);
  letter-spacing: 0.04em;
  font-size: 0.95em;
}

.interpret-details summary:focus-visible {
  outline: 2px solid rgba(86, 255, 146, 0.8);
  outline-offset: 2px;
  border-radius: 4px;
}

.interpret-details[open] {
  box-shadow: 0 0 12px rgba(77, 255, 123, 0.18);
}

.interpret-details h3 {
  margin: 12px 0 6px 0;
  color: var(--phosphor-bright);
  font-size: 1.1em;
  text-shadow: 0 0 6px var(--glow-1);
}

.interpret-details p {
  margin: 6px 0 10px 0;
  color: var(--phosphor-dim);
}

.interpret-details .meta {
  margin-top: 8px;
  color: var(--phosphor-dim);
  font-size: 0.95em;
}

.interpret-details ul,
.interpret-details dl {
  margin: 6px 0 10px 18px;
}

.interpret-details dt {
  color: var(--phosphor-bright);
  margin-top: 8px;
}

.interpret-details dd {
  margin: 4px 0 0 0;
  color: var(--phosphor-dim);
}

.interpret-details a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
}

.interpret-details a:hover,
.interpret-details a:focus-visible {
  color: var(--link-hover);
}

.seo-section,
.interpret-wrap {
  content-visibility: auto;
  contain-intrinsic-size: 1px 520px;
}

.terminal-link {
  color: var(--phosphor);
  text-decoration: underline;
  text-shadow: 0 0 6px var(--glow-1), 0 0 12px var(--glow-2);
}

.terminal-link-line {
  display: block;
  padding-left: 2ch;
  margin-bottom: 4px;
  font-family: "VT323", "Share Tech Mono", monospace;
}

.footer__indicator {
  display: none;
  font-size: 11px;
  padding: 4px 8px;
  border: 1px solid rgba(77, 255, 123, 0.35);
  border-radius: 10px;
  background: rgba(77, 255, 123, 0.12);
  box-shadow: 0 0 10px rgba(77, 255, 123, 0.25);
}

.footer__indicator.is-visible {
  display: inline-block;
}

.btn {
  background: rgba(2, 4, 3, 0.85);
  color: var(--phosphor);
  border: 1px solid var(--ui-line, var(--phosphor-line));
  border-radius: 10px;
  padding: 10px 16px;
  font-family: "Share Tech Mono", monospace;
  font-size: 0.8125em;
  letter-spacing: 0.06em;
  cursor: pointer;
  user-select: none;
}

.btn:hover {
  background: rgba(77, 255, 123, 0.10);
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  border-color: rgba(57, 255, 122, 0.6);
  background: radial-gradient(circle at 30% 30%, rgba(57, 255, 122, 0.24), rgba(57, 255, 122, 0.12));
  box-shadow:
    0 0 14px rgba(57, 255, 122, 0.35),
    inset 0 0 10px rgba(57, 255, 122, 0.25);
  font-weight: 600;
  padding: 12px 18px;
}

.btn:disabled {
  opacity: 0.7;
}

.crt__bezel,
.screen {
  animation: flicker 6.5s infinite;
}

@keyframes flicker {
  0% { filter: brightness(1) contrast(1); }
  40% { filter: brightness(1.02) contrast(1.02); }
  41% { filter: brightness(0.98) contrast(1.02); }
  42% { filter: brightness(1.03) contrast(1.01); }
  100% { filter: brightness(1) contrast(1); }
}

.screen__overlay {
  will-change: transform;
}

@media (max-width: 640px) {
  .screen {
    min-height: 520px;
    padding: 16px;
    height: auto;
    box-shadow:
      inset 0 0 0 1px rgba(77, 255, 123, 0.12),
      0 8px 24px rgba(0, 0, 0, 0.45);
  }
  .screen::after {
    box-shadow: none;
  }
  .crt {
    filter: none;
  }
  .crt__bezel,
  .screen {
    animation: none;
  }
  .crt-layer-scanlines,
  .crt-layer-phosphor,
  .crt-layer-reflection,
  .crt-noise {
    opacity: 0.05;
    animation: none;
  }
  .speed-readout__value { font-size: 3.2em; }
  .speed-readout__label { font-size: 0.9em; }
  .speed-readout__unit { font-size: 1em; }
  button,
  select,
  .btn,
  .font-control-btn,
  .sound-toggle,
  .consent-btn,
  .interpret-details summary {
    min-width: 44px;
    min-height: 44px;
  }
  .footer__link,
  .nav-link {
    display: inline-flex;
    align-items: center;
    padding: 6px 8px;
  }
  .topbar__right {
    gap: 10px;
  }
  .font-controls {
    gap: 8px;
  }
  .footer__links {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .footer__menu {
    width: 100%;
  }
  .footer__menu-links {
    grid-template-columns: 1fr;
  }
  .footer__note {
    line-height: 1.5;
    font-size: 0.75em;
  }
  .footer__hint {
    font-size: 0.85em;
  }
  .footer__link {
    font-size: 0.85em;
  }
}

@media (max-width: 520px) {
  .output { font-size: 1.125em; }
  .speed-readout__value { font-size: 3em; }
}

@media (max-width: 480px) {
  .consent-primary {
    padding: 20px 16px;
    font-size: 19px;
  }
}

@media (max-height: 760px) {
  html, body {
    height: auto;
    min-height: 100%;
  }

  body {
    display: block;
    padding: 12px;
  }

  .screen {
    min-height: 0;
    height: auto;
    overflow: visible;
  }

  .crt-content {
    height: auto;
  }

  .terminal-viewport {
    min-height: 240px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .screen__overlay {
    animation: none;
  }
  .crt__bezel,
  .screen {
    animation: none;
  }
  .crt-noise {
    animation: none;
    opacity: 0.03;
  }
}

@media (max-width: 520px), (prefers-reduced-motion: reduce) {
  .crt__bezel,
  .crt__bezel * {
    text-shadow: none !important;
    filter: none !important;
  }
  .crt-layer-scanlines,
  .crt-layer-phosphor,
  .crt-layer-reflection,
  .crt-noise {
    opacity: 0 !important;
    animation: none !important;
  }
  .screen {
    animation: none !important;
    filter: none !important;
  }
}

/* Print styles */
@media print {
  @page {
    margin: 1cm;
  }

  html, body {
    background: white;
    color: black;
    height: auto;
  }

  .skip-link,
  .topbar,
  .crt-layer-base,
  .crt-layer-scanlines,
  .crt-layer-phosphor,
  .crt-layer-reflection,
  .crt-layer-footerScrim,
  .crt-noise,
  .speed-readout,
  .progress,
  .prompt,
  .footer,
  .break-overlay,
  .feedback-overlay {
    display: none !important;
  }

  .crt__bezel,
  .screen {
    background: white;
    border: none;
    box-shadow: none;
    padding: 0;
    margin: 0;
    height: auto;
    min-height: auto;
  }

  .crt-content {
    color: black;
  }

  .output {
    color: black;
    text-shadow: none;
    font-size: 12pt;
    line-height: 1.4;
    padding: 0;
    max-width: 100%;
  }

  .terminal-viewport {
    overflow: visible;
    padding: 0;
    margin: 0;
  }

  /* Print header */
  .print-header {
    display: block !important;
    font-size: 10pt;
    margin-bottom: 1em;
    color: #666;
    font-family: "Share Tech Mono", monospace;
    padding-bottom: 0.5em;
    border-bottom: 1px solid #ccc;
  }

  .terminal-link {
    color: black;
    text-decoration: underline;
  }

  .terminal-link-line {
    color: black;
  }
}

/* Hide print header in normal view */
.print-header {
  display: none;
}
