/* CodePath — dark theme, single accent (amber/orange), rounded skill-tree nodes.
   Deliberately distinct from other family-server apps: near-black background,
   warm accent instead of purple/cyan, no gradients-everywhere look. */

:root {
  --bg: #0b0c0f;
  --bg-raised: #131519;
  --bg-card: #16181d;
  --line: #23262c;
  --text: #eceef1;
  --text-dim: #9a9ea6;
  --text-faint: #5c6067;
  --accent: #ff9d3d;
  --accent-dim: #a3672a;
  --accent-glow: rgba(255, 157, 61, 0.25);
  --good: #4ade80;
  --bad: #f87171;
  --locked: #2a2d33;
  --radius: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
}

#topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--line);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#brand {
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand-mark { color: var(--accent); font-family: 'Fira Code', Consolas, monospace; }

#xp-badge {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
}

#app {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 80px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 12px;
  padding: 13px 22px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform .08s ease, background .15s ease, opacity .15s ease;
  font-family: inherit;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: #17110a; }
.btn-primary:hover { background: #ffb15e; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-secondary { background: var(--bg-card); color: var(--text); border: 1px solid var(--line); }
.btn-secondary:hover { border-color: var(--accent-dim); }
.btn-block { width: 100%; }

/* ---------- Onboarding ---------- */
.onboard-screen {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-top: 40px;
  text-align: center;
  align-items: center;
}
.onboard-screen h1 { font-size: 1.6rem; font-weight: 800; }
.onboard-screen h1 .accent { color: var(--accent); }
.onboard-screen p.sub { color: var(--text-dim); max-width: 440px; line-height: 1.5; }
.option-grid { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 420px; }
.option-card {
  background: var(--bg-card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.option-card:hover { border-color: var(--accent); background: var(--bg-raised); }
.option-card .opt-title { font-weight: 700; font-size: 1rem; margin-bottom: 4px; }
.option-card .opt-desc { color: var(--text-dim); font-size: 0.85rem; }
.option-card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

.lang-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 440px;
}
.lang-card {
  background: var(--bg-card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 12px;
  cursor: pointer;
  text-align: center;
  font-weight: 700;
  transition: border-color .15s ease, transform .1s ease;
}
.lang-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.lang-card .lang-tag { display: block; font-size: 0.7rem; font-weight: 600; color: var(--accent); text-transform: uppercase; margin-top: 6px; letter-spacing: .04em; }

/* ---------- Placement quiz ---------- */
.quiz-progress { color: var(--text-faint); font-size: 0.8rem; margin-bottom: 6px; }
.quiz-question { font-size: 1.15rem; font-weight: 700; margin-bottom: 18px; }
.quiz-choices { display: flex; flex-direction: column; gap: 10px; }
.quiz-choice {
  background: var(--bg-card);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  text-align: left;
}
.quiz-choice:hover { border-color: var(--accent-dim); }
.quiz-choice.chosen { border-color: var(--accent); }
.quiz-choice.correct { border-color: var(--good); background: rgba(74,222,128,0.08); }
.quiz-choice.wrong { border-color: var(--bad); background: rgba(248,113,113,0.08); }

/* ---------- Map ---------- */
.unit-banner {
  background: linear-gradient(135deg, #1c1508, var(--bg-raised));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.unit-banner.locked { opacity: 0.45; }
.unit-banner .unit-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); font-weight: 700; }
.unit-banner .unit-title { font-size: 1.2rem; font-weight: 800; margin-top: 2px; }

.path-trail {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 16px;
}
.path-node {
  width: 74px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  background: none;
  border: none;
  color: inherit;
  font-family: inherit;
}
.path-node .node-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  color: var(--text-dim);
}
.path-node.unlocked .node-circle { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 4px var(--accent-glow); }
.path-node.completed .node-circle { background: var(--accent); color: #17110a; border-color: var(--accent); }
.path-node.locked .node-circle { background: var(--locked); color: var(--text-faint); border-color: var(--locked); }
.path-node .node-label { font-size: 0.68rem; color: var(--text-dim); text-align: center; line-height: 1.2; }

/* ---------- Lesson trail (winding path) ---------- */
.trail-header { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
.trail-header .back-btn { background: var(--bg-card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; cursor: pointer; color: var(--text); font-size: 1rem; }
.trail-header h2 { font-size: 1.3rem; font-weight: 800; }

.trail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 0;
}
.trail-node-wrap { display: flex; justify-content: center; width: 100%; }
.trail-node-wrap.align-left { justify-content: flex-start; padding-left: 8%; }
.trail-node-wrap.align-right { justify-content: flex-end; padding-right: 8%; }
.trail-node {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 3px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  cursor: pointer;
  position: relative;
  color: var(--text-dim);
}
.trail-node.unlocked { border-color: var(--accent); color: var(--accent); }
.trail-node.completed { background: var(--accent); border-color: var(--accent); color: #17110a; }
.trail-node.locked { background: var(--locked); border-color: var(--locked); color: var(--text-faint); cursor: not-allowed; }
.trail-node .checkmark { font-size: 1.3rem; }
.trail-connector { width: 4px; height: 22px; background: var(--line); }

/* ---------- Lesson screen ---------- */
.lesson-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
}
.lesson-tag { font-size: 0.72rem; font-weight: 700; letter-spacing: .08em; color: var(--accent); text-transform: uppercase; margin-bottom: 8px; }
.lesson-title { font-size: 1.45rem; font-weight: 800; margin-bottom: 18px; }
.part-indicator { display: flex; gap: 6px; margin-bottom: 20px; }
.part-dot { flex: 1; height: 5px; border-radius: 999px; background: var(--line); }
.part-dot.active { background: var(--accent); }
.part-dot.done { background: var(--accent-dim); }

.explain-box {
  background: var(--bg-raised);
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
  padding: 16px 18px;
  margin-bottom: 18px;
  line-height: 1.7;
  color: #d8dade;
}
.explain-box code { background: #1e2026; color: #ffc98a; padding: 1px 6px; border-radius: 4px; font-family: 'Fira Code', Consolas, monospace; font-size: 0.9em; }

.example-label { font-size: 0.72rem; font-weight: 700; color: var(--text-dim); letter-spacing: .05em; text-transform: uppercase; margin-bottom: 6px; }
.code-block {
  background: #08090b;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  font-family: 'Fira Code', Consolas, monospace;
  font-size: 0.87rem;
  line-height: 1.7;
  overflow-x: auto;
  margin-bottom: 18px;
  white-space: pre;
}
.code-output {
  background: #08090b;
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 12px 16px;
  font-family: 'Fira Code', Consolas, monospace;
  font-size: 0.85rem;
  margin-top: 10px;
  white-space: pre-wrap;
  min-height: 20px;
}
.code-output.ok { border-color: var(--good); color: #b7f7cd; }
.code-output.bad { border-color: var(--bad); color: #ffc9c9; }

textarea.code-editor {
  width: 100%;
  min-height: 110px;
  background: #08090b;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-family: 'Fira Code', Consolas, monospace;
  font-size: 0.87rem;
  padding: 14px;
  resize: vertical;
  outline: none;
  line-height: 1.7;
  tab-size: 2;
}
textarea.code-editor:focus { border-color: var(--accent); }

.exercise-prompt { font-size: 0.95rem; color: #d8dade; margin-bottom: 14px; line-height: 1.6; }
.btn-row { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

.next-up {
  margin-top: 22px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.next-up .next-label { font-size: 0.75rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; }
.next-up .next-title { font-weight: 700; margin-top: 2px; }

/* ---------- Coming soon / locked modal-ish inline panel ---------- */
.info-panel {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  text-align: center;
}
.info-panel .emoji { font-size: 2.2rem; margin-bottom: 10px; }
.info-panel h3 { font-size: 1.2rem; margin-bottom: 8px; }
.info-panel p { color: var(--text-dim); margin-bottom: 18px; line-height: 1.5; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--accent-dim);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  z-index: 200;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.hidden { opacity: 0; pointer-events: none; transform: translateX(-50%) translateY(10px); }

@media (max-width: 520px) {
  .lang-grid { grid-template-columns: 1fr 1fr; }
  .lesson-card { padding: 18px; }
  #app { padding: 16px 10px 70px; }
}
