/* ============================================================
   Terminal Command Speedrun — Styles
   Classic green-on-black terminal aesthetic
   ============================================================ */
:root {
  --green: #00FF41;
  --green-dim: #00CC33;
  --green-glow: rgba(0, 255, 65, 0.15);
  --amber: #FFB800;
  --red: #FF4444;
  --bg: #0A0A0A;
  --bg-surface: #111111;
  --bg-card: #181818;
  --text: #00FF41;
  --text-dim: #00AA30;
  --text-muted: #336633;
  --border: rgba(0, 255, 65, 0.12);
  --font: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
  --radius: 8px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: var(--font); background: var(--bg); color: var(--text);
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  line-height: 1.6;
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,255,65,0.01) 2px, rgba(0,255,65,0.01) 4px);
}

#app {
  width: 100%; max-width: 700px; margin: 1rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: 0 0 40px rgba(0,255,65,0.05);
}

/* Header */
.terminal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.5rem 0.75rem; background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}
.header-left { display: flex; align-items: center; gap: 0.5rem; }
.term-dots { display: flex; gap: 5px; }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot.red { background: #FF5F57; }
.dot.yellow { background: #FEBC2E; }
.dot.green { background: #28C840; }
.term-title { font-size: 0.7rem; color: var(--text-muted); }
.header-stats { display: flex; gap: 0.75rem; font-size: 0.7rem; color: var(--text-dim); }

/* Terminal Body */
.terminal-body { padding: 1.25rem; min-height: 350px; display: flex; flex-direction: column; gap: 1rem; }

.ascii-art { font-size: 0.65rem; color: var(--green-dim); text-align: center; line-height: 1.4; white-space: pre; }

/* Menu */
.menu-options { display: flex; flex-direction: column; gap: 0.3rem; }
.menu-section { font-size: 0.8rem; margin-bottom: 0.3rem; }
.prompt { color: var(--amber); font-weight: 700; }
.cmd-text { color: var(--text-dim); }

.menu-btn {
  background: transparent; border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); font-family: var(--font); font-size: 0.8rem; padding: 0.5rem 0.75rem;
  cursor: pointer; text-align: left; transition: all 0.15s ease;
}
.menu-btn:hover { background: var(--green-glow); border-color: var(--green-dim); text-shadow: 0 0 8px var(--green); }
.menu-footer { margin-top: auto; }
.menu-btn-sm { background: transparent; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text-dim); font-family: var(--font); font-size: 0.7rem; padding: 0.3rem 0.6rem; cursor: pointer; }
.menu-btn-sm:hover { color: var(--text); border-color: var(--green-dim); }

/* Game */
.round-info { display: flex; justify-content: space-between; font-size: 0.7rem; color: var(--text-dim); }
.diff-badge { padding: 0.1rem 0.4rem; border-radius: 4px; background: var(--green-glow); font-size: 0.6rem; }

.command-section { margin-top: 1rem; }
.prompt-line { display: flex; gap: 0.5rem; font-size: 1rem; margin-bottom: 0.5rem; }
.target-command { color: var(--text-muted); letter-spacing: 0.02em; }
.input-line { display: flex; gap: 0.5rem; align-items: center; }
.input-prompt { color: var(--green); }
.command-input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--green); font-family: var(--font); font-size: 1rem; caret-color: var(--green);
}
.char-feedback { font-size: 1rem; margin-top: 0.3rem; letter-spacing: 0.02em; min-height: 1.5em; padding-left: 1.5rem; }
.char-correct { color: var(--green); }
.char-wrong { color: var(--red); background: rgba(255, 68, 68, 0.15); }
.char-pending { color: var(--text-muted); }

/* Ghost Racer */
.ghost-bar { margin-top: 1rem; font-size: 0.65rem; display: flex; flex-direction: column; gap: 0.3rem; }
.ghost-label, .player-label { color: var(--text-muted); min-width: 50px; }
.ghost-progress, .player-progress { height: 6px; background: rgba(255,255,255,0.05); border-radius: 3px; overflow: hidden; }
.ghost-fill { height: 100%; background: rgba(255,255,255,0.2); width: 0%; transition: width 0.3s; border-radius: 3px; }
.player-fill { height: 100%; background: var(--green); width: 0%; transition: width 0.1s; border-radius: 3px; }

/* Explanation */
.explain-header { display: flex; justify-content: space-between; align-items: center; }
.round-result { font-weight: 700; }
.round-result.correct { color: var(--green); }
.round-result.wrong { color: var(--red); }
.round-time { font-size: 0.75rem; color: var(--text-dim); }

.explain-content { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.explain-cmd { font-size: 0.9rem; font-weight: 700; color: var(--green); margin-bottom: 0.3rem; }
.explain-desc { font-size: 0.75rem; color: var(--text-dim); line-height: 1.6; }

.explain-action { text-align: center; margin-top: auto; }
.blink { animation: blink 1s step-end infinite; color: var(--text-muted); font-size: 0.75rem; }
@keyframes blink { 50% { opacity: 0; } }

/* Results */
.results-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem 1.5rem; font-size: 0.8rem; }
.result-label { color: var(--text-muted); }
.result-value { color: var(--green); font-weight: 700; }
.results-actions { display: flex; gap: 0.5rem; margin-top: 1rem; }

/* Scores Modal */
.modal { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.7); }
.modal-content { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; max-width: 400px; width: 90%; }
.modal-content h2 { font-size: 1rem; margin-bottom: 0.75rem; text-align: center; }
.scores-list { font-size: 0.75rem; max-height: 300px; overflow-y: auto; }
.score-entry { display: flex; justify-content: space-between; padding: 0.25rem 0; border-bottom: 1px solid var(--border); }

@media (max-width: 480px) {
  #app { margin: 0; border-radius: 0; border: none; }
  .terminal-body { padding: 0.75rem; }
}
