:root {
  --bg:      #0a0a1a;
  --surface: #0f1535;
  --cyan:    #00f5ff;
  --magenta: #ff2d78;
  --green:   #39ff14;
  --orange:  #ff6b00;
  --text:    #e8f4ff;
  --muted:   #6b7db3;
}

* {
  box-sizing: border-box;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Share Tech Mono', 'Courier New', monospace;
  margin: 0;
  padding: 2rem;
  animation: flicker 10s infinite;
}

@keyframes flicker {
  0%, 93%, 96%, 99%, 100% { opacity: 1; }
  94% { opacity: 0.97; }
  95% { opacity: 0.99; }
  97% { opacity: 0.96; }
  98% { opacity: 0.98; }
}

#starfield {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: -1;
  pointer-events: none;
}

#scanlines {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.06) 2px,
    rgba(0, 0, 0, 0.06) 4px
  );
}

h1, h2, h3, h4 {
  color: var(--cyan);
  text-shadow: 0 0 10px var(--cyan);
}

a {
  color: var(--magenta);
  text-decoration: none;
}

a:hover {
  color: var(--cyan);
  text-shadow: 0 0 8px var(--cyan);
}

button {
  background: transparent;
  border: 2px solid var(--cyan);
  color: var(--cyan);
  padding: 0.5rem 1.2rem;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'Share Tech Mono', 'Courier New', monospace;
  font-size: 1rem;
  text-shadow: 0 0 6px var(--cyan);
  box-shadow: 0 0 10px var(--cyan)44;
  transition: background 0.2s, box-shadow 0.2s;
}

button:hover {
  background: var(--cyan)22;
  box-shadow: 0 0 18px var(--cyan);
}

button.selected {
  background: var(--cyan)33;
  border-color: var(--cyan);
  box-shadow: 0 0 18px var(--cyan), inset 0 0 10px var(--cyan)33;
  color: var(--cyan);
}

#Submit {
  border-color: var(--magenta);
  color: var(--magenta);
  text-shadow: 0 0 8px var(--magenta);
  font-size: 1.1rem;
  padding: 0.8rem 2.5rem;
  margin-top: 1rem;
  animation: launch-pulse 2s ease-in-out infinite;
  display: block;
}

#Submit:hover {
  background: var(--magenta)22;
  box-shadow: 0 0 30px var(--magenta);
}

#AbandonBtn {
  border-color: var(--muted)66;
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  padding: 0.4rem 1rem;
  margin-left: 0.5rem;
}

#AbandonBtn:hover {
  border-color: var(--red, #ff4444);
  color: var(--red, #ff4444);
  background: transparent;
  box-shadow: none;
  text-shadow: 0 0 8px var(--red, #ff4444);
}

@keyframes launch-pulse {
  0%, 100% { box-shadow: 0 0 10px var(--magenta)66; }
  50%       { box-shadow: 0 0 30px var(--magenta), 0 0 60px var(--magenta)44; }
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--cyan) 30%, var(--surface) 30%);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  cursor: pointer;
}

input[type="text"], input:not([type]) {
  background: var(--surface);
  border: 1px solid var(--muted);
  color: var(--text);
  padding: 0.4rem 0.7rem;
  border-radius: 4px;
  font-size: 1rem;
  font-family: 'Share Tech Mono', 'Courier New', monospace;
}

input[type="text"]:focus, input:not([type]):focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 8px var(--cyan)66;
}

label {
  color: var(--text);
  margin-right: 1rem;
  letter-spacing: 0.05em;
}

label.flash {
  animation: label-flash 0.35s ease-out;
}

@keyframes label-flash {
  0%   { color: var(--cyan); text-shadow: 0 0 14px var(--cyan); }
  100% { color: var(--text); text-shadow: none; }
}

.hud-panel {
  position: relative;
  border: 1px solid var(--muted)44;
  padding: 1.5rem 1.5rem 1.2rem;
  margin: 1rem 0;
  background: linear-gradient(135deg, var(--cyan)06 0%, transparent 60%);
}

.hud-panel::before {
  content: '';
  position: absolute;
  top: -2px; left: -2px;
  width: 18px; height: 18px;
  border-top: 3px solid var(--cyan);
  border-left: 3px solid var(--cyan);
}

.hud-panel::after {
  content: '';
  position: absolute;
  bottom: -2px; right: -2px;
  width: 18px; height: 18px;
  border-bottom: 3px solid var(--cyan);
  border-right: 3px solid var(--cyan);
}

.panel-label {
  position: absolute;
  top: -0.65rem;
  left: 1rem;
  background: var(--bg);
  padding: 0 0.5rem;
  font-size: 0.68rem;
  color: var(--cyan);
  letter-spacing: 0.2em;
  text-shadow: 0 0 8px var(--cyan);
}

.rank-sub {
  font-size: 0.75rem;
  color: var(--muted);
  margin-left: 4px;
}

#status-indicator {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 1.2rem 0;
  font-size: 0.82rem;
  letter-spacing: 0.1em;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.status-overall {
  margin-top: 0.3rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--muted)33;
}

.status-check {
  color: var(--green);
  text-shadow: 0 0 8px var(--green);
  flex-shrink: 0;
}

.status-arrow {
  color: var(--orange);
  flex-shrink: 0;
}

.status-item {
  color: var(--text);
}

.status-needed {
  color: var(--orange);
  font-style: italic;
}

.dot-offline, .dot-ready {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.dot-offline {
  background: var(--orange);
  box-shadow: 0 0 8px var(--orange);
  animation: blink-dot 1.4s infinite;
}

.dot-ready {
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
}

@keyframes blink-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.15; }
}

.blink-cursor {
  animation: blink 1s step-end infinite;
  color: var(--cyan);
}

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

.countdown {
  font-size: 6rem;
  text-align: center;
  color: var(--cyan);
  text-shadow: 0 0 40px var(--cyan);
  margin: 3rem 0;
  animation: countdown-pop 0.3s ease-out;
}

@keyframes countdown-pop {
  0%   { transform: scale(1.5); opacity: 0.2; }
  100% { transform: scale(1);   opacity: 1; }
}

#answer.correct {
  color: var(--green);
  text-shadow: 0 0 10px var(--green);
  font-size: 1.4rem;
}

#answer.incorrect {
  color: var(--orange);
  text-shadow: 0 0 10px var(--orange);
  font-size: 1.4rem;
}

.results-screen {
  max-width: 720px;
  margin: 0 auto;
}

.results-screen h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.results-screen h3 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  border-bottom: 2px solid var(--muted);
  padding-bottom: 0.25rem;
}

.overall-score {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin: 1.5rem 0;
}

.score-ring {
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}

.ring-bg {
  fill: none;
  stroke: var(--surface);
  stroke-width: 12;
}

.ring-fill {
  fill: none;
  stroke-width: 12;
  stroke-linecap: round;
  transition: stroke-dasharray 0.6s ease;
}

.score-text {
  display: flex;
  flex-direction: column;
}

.score-pct {
  font-size: 2.8rem;
  font-weight: bold;
  line-height: 1;
}

.score-fraction {
  font-size: 1.1rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  height: 180px;
  padding: 0 0.5rem 0.5rem;
  border-bottom: 2px solid var(--muted)66;
  margin-bottom: 1.5rem;
}

.bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  height: 100%;
  justify-content: flex-end;
}

.bar-col-pct {
  font-size: 0.78rem;
  font-weight: bold;
  margin-bottom: 4px;
}

.bar-col-track {
  width: 100%;
  height: 130px;
  background: var(--surface);
  border: 1px solid var(--muted)44;
  border-radius: 4px 4px 0 0;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.bar-col-fill {
  width: 100%;
  border-radius: 4px 4px 0 0;
  transition: height 0.6s ease;
  min-height: 2px;
}

.bar-col-label {
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 6px;
  text-align: center;
}

.subject-breakdown {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.subject-row {
  display: grid;
  grid-template-columns: 110px 1fr 90px;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 0 0.75rem;
}

.subject-label {
  font-weight: bold;
  font-size: 0.95rem;
  color: var(--cyan);
}

.bar-track {
  background: var(--surface);
  border: 1px solid var(--muted)66;
  border-radius: 6px;
  height: 18px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.5s ease;
  min-width: 2px;
  box-shadow: 0 0 8px currentColor;
}

.subject-score {
  font-size: 0.85rem;
  color: var(--muted);
  text-align: right;
}

.subject-feedback {
  grid-column: 2 / 4;
  font-size: 0.8rem;
  color: var(--muted);
  font-style: italic;
  margin-top: 2px;
}

.missed-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.missed-card {
  background: var(--surface);
  border-left: 4px solid var(--orange);
  border-radius: 4px;
  padding: 0.75rem 1rem;
  box-shadow: 0 0 10px var(--orange)33;
}

.missed-q {
  font-weight: bold;
  margin: 0 0 0.4rem;
  color: var(--text);
}

.missed-yours,
.missed-correct,
.missed-subject {
  margin: 0.15rem 0;
  font-size: 0.9rem;
}

.missed-yours span   { color: var(--orange); text-shadow: 0 0 6px var(--orange); }
.missed-correct span { color: var(--green);  text-shadow: 0 0 6px var(--green); font-weight: bold; }
.missed-subject      { color: var(--muted); font-style: italic; }
.missed-queued       { color: var(--orange, #f5a623); font-size: 0.8rem; letter-spacing: 0.08em; margin: 0.15rem 0; }

.review-queue-btn {
  background: transparent;
  border: 1px solid var(--orange, #f5a623);
  color: var(--orange, #f5a623);
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  padding: 0.55rem 1.4rem;
  cursor: pointer;
  border-radius: 2px;
  text-shadow: 0 0 8px var(--orange, #f5a623)88;
  box-shadow: 0 0 10px var(--orange, #f5a623)22;
  transition: all 0.2s;
  margin-top: 0.75rem;
  display: inline-block;
}
.review-queue-btn:hover {
  background: var(--orange, #f5a623)15;
  box-shadow: 0 0 18px var(--orange, #f5a623)55;
}
.review-queue-count {
  background: var(--orange, #f5a623);
  color: #000;
  font-size: 0.7rem;
  padding: 0.1rem 0.45rem;
  border-radius: 10px;
  margin-left: 0.4rem;
}
.review-queue-empty {
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  color: var(--muted);
  margin-top: 0.75rem;
}
.review-note {
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  color: var(--orange, #f5a623);
  text-shadow: 0 0 6px var(--orange, #f5a623)88;
  margin: 1.2rem 0 0.5rem;
  text-align: center;
}

.debrief-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 2.5rem;
  flex-wrap: wrap;
}

.debrief-btn {
  background: transparent;
  border: 1px solid var(--cyan);
  color: var(--cyan);
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  padding: 0.65rem 1.6rem;
  cursor: pointer;
  border-radius: 2px;
  text-shadow: 0 0 8px var(--cyan);
  box-shadow: 0 0 10px var(--cyan)33;
  transition: all 0.2s;
}

.debrief-btn:hover {
  background: var(--cyan)22;
  box-shadow: 0 0 18px var(--cyan)66;
}

.debrief-btn-secondary {
  border-color: var(--muted);
  color: var(--muted);
  text-shadow: none;
  box-shadow: none;
}

.debrief-btn-secondary:hover {
  border-color: var(--green);
  color: var(--green);
  text-shadow: 0 0 8px var(--green);
  box-shadow: 0 0 10px var(--green)33;
  background: var(--green)11;
}

.question-text {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: break-word;
  line-height: 1.5;
}

.mc-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

.mc-label {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  background: var(--surface);
  border: 1px solid var(--muted)44;
  border-radius: 4px;
  padding: 0.65rem 1rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  white-space: normal;
  word-break: break-word;
  line-height: 1.4;
}

.mc-label:hover {
  border-color: var(--cyan)88;
  background: var(--cyan)0d;
}

.mc-label input[type="radio"] {
  flex-shrink: 0;
  margin-top: 3px;
  accent-color: var(--cyan);
}

.opt-letter {
  color: var(--cyan);
  flex-shrink: 0;
  font-weight: bold;
}

#question-timer {
  font-size: 1rem;
  color: var(--cyan);
  text-shadow: 0 0 8px var(--cyan);
  letter-spacing: 0.1em;
  margin-bottom: 0.75rem;
}

#question-timer.timer-warning {
  color: var(--orange);
  text-shadow: 0 0 10px var(--orange);
  animation: blink-dot 0.6s infinite;
}

.time-tag {
  font-size: 0.85rem;
  color: var(--muted);
  margin-left: 0.5rem;
}

.timing-stats {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
  background: var(--surface);
  border: 1px solid var(--muted)44;
  border-radius: 4px;
  padding: 0.8rem 1rem;
}

.timing-row {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}

.timing-label {
  color: var(--cyan);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  min-width: 70px;
  flex-shrink: 0;
}

.timing-val {
  color: var(--text);
  font-size: 1rem;
  flex-shrink: 0;
}

.timing-q {
  color: var(--muted);
  font-size: 0.78rem;
  font-style: italic;
}

.option-divider {
  width: 100%;
  height: 1px;
  background: var(--muted)44;
  margin: 0.5rem 0;
}

.option-group-label {
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.15em;
  display: block;
  margin-bottom: 0.3rem;
}

#lives-display {
  justify-content: center;
  gap: 0.6rem;
  margin: 0.4rem 0 0.2rem;
}
.heart { font-size: 1.8rem; transition: all 0.2s; }
.heart-full  { color: var(--magenta); text-shadow: 0 0 12px var(--magenta); }
.heart-empty { color: var(--muted); opacity: 0.35; }

#question-counter {
  text-align: center;
  font-size: 1.3rem;
  letter-spacing: 0.2em;
  color: var(--cyan);
  text-shadow: 0 0 12px var(--cyan);
  margin: 0.6rem 0 0.2rem;
}

#streak-display {
  align-items: center;
  font-size: 1.1rem;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
}

@keyframes streak-pop {
  0%   { transform: scale(1.5); opacity: 0.5; }
  60%  { transform: scale(0.95); }
  100% { transform: scale(1); opacity: 1; }
}

.streak-pop {
  animation: streak-pop 0.4s ease-out;
}

.key-hint {
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
}

.score-streak {
  font-size: 0.85rem;
  color: var(--green);
  text-shadow: 0 0 6px var(--green);
  margin-top: 0.2rem;
}

.no-misses {
  color: var(--green);
  text-shadow: 0 0 10px var(--green);
  font-weight: bold;
  font-size: 1.1rem;
}
