:root {
  --bg: #06080f;
  --fg: #f4f3ef;
  --muted: #9aa0a8;
  --accent: #5cf0d6;
  --warn: #ef476f;
  --ok: #80ed99;
  --panel-bg: rgba(8, 10, 18, 0.86);
  --panel-border: rgba(255, 255, 255, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #000;
  color: var(--fg);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

canvas#scene {
  display: block;
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
}

.hidden { display: none !important; }

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 50;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0.8) 80%);
  backdrop-filter: blur(2px);
}

.panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 32px;
  max-width: 640px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 8px;
}

h1 {
  margin: 0 0 16px;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.lede {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
  margin: 0 0 20px;
}

.controls {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 24px;
  font-size: 13px;
  color: var(--muted);
}

.controls li { line-height: 1.6; }

kbd {
  display: inline-block;
  padding: 2px 6px;
  margin-right: 4px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  color: var(--fg);
}

button {
  font-family: inherit;
  font-size: 14px;
  padding: 12px 20px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 600;
  transition: transform 80ms ease, background 80ms ease, border 80ms ease;
}

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

button.primary {
  background: var(--accent);
  color: #06080f;
}

button.primary:hover { background: #80f4dd; }

button.secondary {
  background: transparent;
  color: var(--fg);
  border-color: var(--panel-border);
}

button.secondary:hover { border-color: var(--accent); color: var(--accent); }

.hud {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 20;
  background: rgba(8, 10, 18, 0.72);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 12px;
  letter-spacing: 0.05em;
  min-width: 220px;
}

.hud-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 2px 0;
}

.hud-label {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.15em;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 48px;
  transform: translateX(-50%);
  z-index: 20;
  background: rgba(8, 10, 18, 0.85);
  border: 1px solid var(--accent);
  color: var(--fg);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
}

.dialog-panel { max-width: 720px; }

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.tag {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}

.qid {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  color: var(--muted);
}

.dialog-prompt {
  font-size: 16px;
  line-height: 1.55;
  margin: 0 0 18px;
  white-space: pre-line;
}

.dialog-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  text-align: left;
  cursor: pointer;
  color: var(--fg);
  font-size: 14px;
  line-height: 1.5;
  width: 100%;
}

.option:hover {
  border-color: var(--accent);
  background: rgba(92, 240, 214, 0.06);
}

.option .letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}

.option.correct {
  border-color: var(--ok);
  background: rgba(128, 237, 153, 0.08);
}

.option.wrong {
  border-color: var(--warn);
  background: rgba(239, 71, 111, 0.08);
}

.option.picked .letter { background: var(--accent); color: #06080f; }
.option.correct .letter { background: var(--ok); color: #06080f; }
.option.wrong .letter { background: var(--warn); color: #fff; }

.dialog-feedback {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-line;
}

.dialog-feedback.ok {
  background: rgba(128, 237, 153, 0.08);
  border: 1px solid rgba(128, 237, 153, 0.4);
  color: #d4ffe1;
}

.dialog-feedback.bad {
  background: rgba(239, 71, 111, 0.08);
  border: 1px solid rgba(239, 71, 111, 0.4);
  color: #ffd4de;
}

.dialog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.hint {
  font-size: 12px;
  color: var(--muted);
}

.summary {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  white-space: pre-line;
}

.end-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
