/* === MUNO LABS BRAND — ORGANIC WARM === */
:root {
  --bg: #0D0F1B;
  --bg-window: #14172B;
  --bg-input: #101325;
  --bg-titlebar: #1A1E3A;
  --border: #2A2E4A;
  --border-light: #3D4168;
  --text: #F0EDE6;
  --text-muted: #B8B5AC;
  --text-dim: #8A877E;
  --cream: #F0EDE6;
  --cream-dim: #D5D2C8;
  --orange: #8DEDCF;
  --orange-dim: #42CFA0;
  --orange-glow: rgba(141, 237, 207, 0.12);
  --blue: #0052CC;
  --green: #8DEDCF;
  --green-dim: #2DAF84;
  --red: #FF8FA3;
}

/* === LIGHT MODE — WARM CREAM === */
:root.light {
  --bg: #FAF8F3;
  --bg-window: #FFFFFF;
  --bg-input: #F5F2EB;
  --bg-titlebar: #EDE9E0;
  --border: #DDD8CC;
  --border-light: #CCC7BB;
  --text: #0C0E19;
  --text-muted: #4D5279;
  --text-dim: #6F7390;
  --cream: #0C0E19;
  --cream-dim: #2C3162;
  --orange: #047857;
  --orange-dim: #2DAF84;
  --orange-glow: rgba(4, 120, 87, 0.1);
  --green: #047857;
  --green-dim: #2DAF84;
  --red: #E5677E;
}

* { box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Geist', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.7;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

/* === TERMINAL FRAME === */
.terminal-frame {
  position: fixed;
  top: 12px;
  left: 60px;
  bottom: 12px;
  right: 372px;
  transition: right 0.25s ease;
  display: flex;
  flex-direction: column;
  background: var(--bg-window);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  overflow: hidden;
  box-shadow:
    0 8px 40px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}

.terminal-titlebar {
  background: var(--bg-titlebar);
  border-bottom: 1px solid var(--border);
  padding: 0 0.75rem;
  height: 38px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  -webkit-app-region: drag;
}

.terminal-dots {
  display: flex;
  gap: 7px;
  flex-shrink: 0;
}

.terminal-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: none;
  display: block;
}

.terminal-dot.red { background: var(--red); cursor: pointer; }
.terminal-dot.red:hover { background: #e05555; }
.terminal-dot.yellow { background: #e0a94d; }
.terminal-dot.green { background: var(--green); }

.terminal-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 1;
  min-width: 0;
}

.terminal-tab {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--cream);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.terminal-tab.active {
  color: var(--cream);
}

.tab-icon {
  color: var(--orange);
  font-size: 0.7rem;
}

.terminal-tab-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.tab-time {
  font-size: 0.7rem;
  color: var(--text-dim);
}

.terminal-toolbar {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0.35rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  font-size: 0.7rem;
}

/* Breadcrumbs */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
}

.bc-link {
  color: var(--text-dim);
  text-decoration: none;
  white-space: nowrap;
  font-size: 0.68rem;
  transition: color 0.12s;
}

.bc-link:hover { color: var(--orange); text-decoration: none; }
.bc-module { cursor: default; }

.bc-sep {
  color: var(--border-light);
  font-size: 0.75rem;
  flex-shrink: 0;
}

.bc-current {
  color: var(--cream);
  font-size: 0.68rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Step dots */
.step-dots {
  display: flex;
  align-items: center;
  gap: 4px;
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  display: block;
  transition: all 0.15s;
  text-decoration: none;
}

.step-dot:hover { border-color: var(--orange); }
.step-dot.current { background: var(--orange); border-color: var(--orange); }
.step-dot.done { background: var(--green); border-color: var(--green); }

.step-label {
  font-size: 0.6rem;
  color: var(--text-dim);
  white-space: nowrap;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.terminal-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg);
  scroll-behavior: smooth;
}

.terminal-statusbar {
  background: var(--bg-titlebar);
  border-top: 1px solid var(--border);
  padding: 0.3rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  font-size: 0.65rem;
}

.statusbar-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.statusbar-lesson {
  color: var(--text-dim);
}

/* === LAYOUT === */
.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 1rem 1.5rem 4rem;
}

.hub-container {
  max-width: 880px;
  margin: 0 auto;
  padding: 1rem 1.5rem 4rem;
}

/* === WINDOW CHROME (retro Mac feel) === */
.window {
  background: var(--bg-window);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 1.25rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.window-titlebar {
  background: var(--bg-titlebar);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  user-select: none;
}

.window-dots {
  display: flex;
  gap: 6px;
}

.window-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.3);
}

.window-dot.red { background: var(--red); }
.window-dot.yellow { background: #e0a94d; }
.window-dot.green { background: var(--green); }

.window-body {
  padding: 1.25rem;
}

/* === TYPOGRAPHY === */
h1 {
  font-family: 'Geist', system-ui, sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--orange);
  margin: 0 0 0.5rem;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--cream);
  margin: 2rem 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px dashed var(--border);
}

h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--cream-dim);
  margin: 1.5rem 0 0.5rem;
}

p { margin: 0 0 0.85rem; color: var(--cream-dim); font-size: 0.9rem; }

a { color: var(--orange); text-decoration: none; }
a:hover { text-decoration: underline; }

strong { color: var(--cream); font-weight: 600; }
em { color: var(--text-muted); }

/* === XP & CELEBRATIONS === */
.rail-xp {
  font-size: 0.55rem;
  color: var(--orange);
  font-weight: 700;
  text-align: center;
  padding: 2px 0;
}

.rail-level {
  font-size: 0.5rem;
  color: var(--text-dim);
  text-align: center;
  display: block;
  margin-bottom: 4px;
}

/* XP gain popup */
.xp-gain {
  position: fixed;
  bottom: 70px;
  right: 24px;
  background: var(--orange);
  color: var(--bg);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  z-index: 500;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.xp-gain.show {
  opacity: 1;
  transform: translateY(0);
}

/* Emoji celebration particles */
.emoji-particle {
  position: fixed;
  bottom: 40%;
  font-size: 1.3rem;
  z-index: 500;
  pointer-events: none;
  opacity: 0;
  animation: emoji-rise ease-out forwards;
}

.emoji-particle.big {
  font-size: 1.8rem;
  bottom: 50%;
}

@keyframes emoji-rise {
  0% { opacity: 0; transform: translateY(0) translateX(0) scale(0.3) rotate(0deg); }
  15% { opacity: 1; transform: translateY(-30px) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-180px) translateX(var(--end-x)) scale(0.6) rotate(25deg); }
}

/* Correct answer glow */
.quiz-option.correct,
.decision-option.chosen.best {
  animation: correct-glow 0.6s ease;
}

@keyframes correct-glow {
  0% { box-shadow: 0 0 0 0 rgba(120, 140, 93, 0.4); }
  50% { box-shadow: 0 0 12px 4px rgba(120, 140, 93, 0.2); }
  100% { box-shadow: none; }
}

/* === ANNOTATION PINS === */
.annotation-pin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  font-size: 0.65rem;
  cursor: pointer;
  position: relative;
  vertical-align: super;
  margin-left: 2px;
  opacity: 0.6;
  transition: opacity 0.15s;
  z-index: 5;
}

.annotation-pin:hover { opacity: 1; }

.annotation-popover {
  display: none;
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: 260px;
  background: var(--bg-window);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
  z-index: 50;
  cursor: default;
}

.annotation-pin.open .annotation-popover { display: block; }

/* Arrow */
.annotation-popover::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: var(--bg-window);
  border-left: 1px solid var(--border-light);
  border-top: 1px solid var(--border-light);
}

.ann-question {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--orange);
  margin-bottom: 8px;
  line-height: 1.4;
}

.ann-answer {
  font-size: 0.72rem;
  color: var(--cream-dim);
  line-height: 1.6;
  max-height: 160px;
  overflow-y: auto;
}

.ann-answer code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.1em 0.3em;
  font-size: 0.65rem;
  color: var(--orange);
}

.ann-meta {
  font-size: 0.55rem;
  color: var(--text-dim);
  margin-top: 8px;
  text-align: right;
}

/* === HIGHLIGHTS === */
.user-highlight {
  background: linear-gradient(to bottom, transparent 55%, rgba(217, 119, 87, 0.35) 55%, rgba(217, 119, 87, 0.35) 90%, transparent 90%);
  padding: 0 1px;
  border-radius: 1px;
  cursor: default;
  transition: background 0.2s;
  position: relative;
}

.user-highlight:hover {
  background: linear-gradient(to bottom, transparent 55%, rgba(217, 119, 87, 0.5) 55%, rgba(217, 119, 87, 0.5) 90%, transparent 90%);
}

.hl-remove {
  display: none;
  position: absolute;
  top: -8px;
  right: -6px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg-window);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.5rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  line-height: 1;
  z-index: 10;
  transition: all 0.1s;
}

.user-highlight:hover .hl-remove { display: flex; }
.hl-remove:hover { background: var(--red); color: white; border-color: var(--red); }

:root.light .user-highlight {
  background: linear-gradient(to bottom, transparent 55%, rgba(217, 119, 87, 0.25) 55%, rgba(217, 119, 87, 0.25) 90%, transparent 90%);
}

/* Floating toolbar on text selection */
.hl-toolbar {
  position: fixed;
  display: none;
  align-items: center;
  gap: 2px;
  padding: 3px 4px;
  background: var(--bg-window);
  border: 1px solid var(--border);
  border-radius: 8px;
  z-index: 400;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  transform: translateX(-50%);
}

.hl-toolbar.show { display: flex; }

.hl-toolbar-btn {
  width: 30px;
  height: 28px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: all 0.1s;
  background: none;
}

.hl-toolbar-btn:hover { background: var(--orange-glow); }

/* Highlight color button — shows a marker stroke */
.hl-btn-mark {
  color: var(--orange);
  position: relative;
}

.hl-btn-mark::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 6px;
  right: 6px;
  height: 3px;
  background: var(--orange);
  border-radius: 1px;
  opacity: 0.7;
}

/* Copy button */
.hl-btn-copy { color: var(--text-muted); }
.hl-btn-copy:hover { color: var(--cream); }

/* Ask tutor button */
.hl-btn-ask { color: var(--text-muted); }
.hl-btn-ask:hover { color: var(--orange); }

.hl-toolbar-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 2px;
}

.highlight-toast {
  position: fixed;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-window);
  border: 1px solid var(--orange);
  color: var(--orange);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  z-index: 500;
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
}

.highlight-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Light mode fine-tuning */
:root.light pre { background: #ebe8e0; }
:root.light :not(pre) > code { background: #ebe8e0; }
:root.light .quiz-option.correct { background: rgba(90, 122, 61, 0.1); }
:root.light .quiz-option.wrong { background: rgba(199, 80, 80, 0.08); }
:root.light .decision-scenario { background: rgba(217, 119, 87, 0.06); }
:root.light .terminal-frame { box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08); }
:root.light .chat-msg.user { background: rgba(217, 119, 87, 0.08); border-color: rgba(217, 119, 87, 0.2); }
:root.light .game-header { background: linear-gradient(135deg, #9b82c0, #7a5eaa); }

/* === CONTENT SECTIONS === */
.reveal-section {
  margin-bottom: 0.5rem;
}

.reveal-section h2 {
  margin-top: 1.5rem;
}

/* Give code-heavy sections a card feel */
.reveal-section pre + p,
.reveal-section p + pre {
  margin-top: 0.5rem;
}

/* === CODE (retro terminal feel) === */
pre {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin: 0.75rem 0 1.25rem;
  font-size: 0.78rem;
  line-height: 1.7;
  position: relative;
}

pre::before {
  content: '>';
  position: absolute;
  top: 0.35rem;
  right: 0.6rem;
  color: var(--text-dim);
  font-size: 0.7rem;
}

code {
  font-family: 'SF Mono', 'Monaco', 'Menlo', monospace;
  font-size: 0.85em;
}

:not(pre) > code {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.1em 0.35em;
  color: var(--orange);
}

/* === BLOCKQUOTE === */
blockquote {
  border-left: 2px solid var(--orange);
  margin: 1rem 0;
  padding: 0.5rem 1rem;
  background: var(--orange-glow);
  border-radius: 0 6px 6px 0;
}

blockquote p { margin: 0; color: var(--text-muted); font-size: 0.85rem; }

/* === LISTS === */
ul, ol { padding-left: 1.25rem; margin: 0.4rem 0 0.85rem; }
li { margin: 0.2rem 0; color: var(--cream-dim); font-size: 0.9rem; }
li::marker { color: var(--orange); }

/* === TABLES === */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0 1.25rem;
  font-size: 0.8rem;
}

th, td {
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  text-align: left;
}

th {
  background: var(--bg-titlebar);
  font-weight: 600;
  color: var(--orange);
}

td { color: var(--text-muted); }

/* === TOP BAR (hidden in lesson, used by hub) === */
.top-bar {
  background: var(--bg-titlebar);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  font-size: 0.8rem;
}

.top-bar a { color: var(--text-muted); font-size: 0.8rem; }
.top-bar a:hover { color: var(--orange); text-decoration: none; }

.progress-track {
  flex: 1;
  max-width: 160px;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 1rem;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--orange);
  border-radius: 2px;
  transition: width 0.5s ease;
}

#progress-label { color: var(--text-dim); font-size: 0.7rem; white-space: nowrap; }

/* === LESSON META === */
.lesson-meta {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.meta-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 500;
  border: 1px solid var(--border);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.meta-badge.concept { border-color: var(--orange-dim); color: var(--orange); }
.meta-badge.exercise { border-color: var(--green-dim); color: var(--green); }
.meta-badge.build { border-color: #6a5aa8; color: #a78bfa; }

/* === QUIZ (retro window style) === */
.quiz-block {
  background: var(--bg-window);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin: 1.5rem 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.quiz-header {
  background: var(--bg-titlebar);
  border-bottom: 1px solid var(--border);
  padding: 0.4rem 0.75rem;
  font-weight: 600;
  color: var(--orange);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.quiz-question {
  padding: 1rem 1.25rem 0.75rem;
  font-size: 0.95rem;
  color: var(--cream);
  line-height: 1.5;
}

.quiz-option {
  display: block;
  width: calc(100% - 2.5rem);
  margin: 0.3rem 1.25rem;
  padding: 0.6rem 0.85rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--cream-dim);
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  font-size: 0.85rem;
  font-family: inherit;
}

.quiz-option:hover:not(.correct):not(.wrong) {
  border-color: var(--orange);
  background: var(--orange-glow);
  color: var(--cream);
}

.quiz-option.correct {
  border-color: var(--green);
  background: rgba(120, 140, 93, 0.15);
  color: var(--green);
}

.quiz-option.wrong {
  border-color: var(--red);
  background: rgba(199, 80, 80, 0.12);
  color: var(--red);
}

.answered .quiz-option { cursor: default; }

.quiz-feedback {
  padding: 0 1.25rem;
  margin-top: 0.5rem;
  font-weight: 600;
  font-size: 0.85rem;
  opacity: 0;
  transition: opacity 0.3s;
}

.quiz-feedback.show { opacity: 1; }
.quiz-feedback.correct { color: var(--green); }
.quiz-feedback.wrong { color: var(--red); }

.quiz-explanation {
  margin: 0.5rem 1.25rem 0;
  padding: 0.6rem 0.85rem;
  background: var(--orange-glow);
  border-left: 2px solid var(--orange);
  border-radius: 0 4px 4px 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: all 0.4s ease;
}

.quiz-explanation.show {
  opacity: 1;
  max-height: 200px;
  margin-bottom: 1rem;
}

/* === DECISION (scenario card) === */
.decision-block {
  background: var(--bg-window);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin: 1.5rem 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.decision-header {
  background: linear-gradient(135deg, var(--orange-dim), #8b4a30);
  border-bottom: 1px solid var(--border);
  padding: 0.4rem 0.75rem;
  font-weight: 600;
  color: var(--cream);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.decision-scenario {
  padding: 1rem 1.25rem;
  color: var(--cream);
  font-size: 0.95rem;
  line-height: 1.5;
  border-bottom: 1px dashed var(--border);
  background: var(--orange-glow);
}

.decision-options {
  padding: 0.75rem 1.25rem;
}

.decision-option {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  width: 100%;
  padding: 0.7rem 0.85rem;
  margin: 0.35rem 0;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--cream-dim);
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  font-size: 0.85rem;
  font-family: inherit;
  line-height: 1.4;
}

.decision-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  border-radius: 4px;
  background: var(--bg-titlebar);
  border: 1px solid var(--border);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}

.decision-option:hover:not(.chosen) {
  border-color: var(--orange);
  background: var(--orange-glow);
}

.decision-option.chosen {
  border-color: var(--orange);
  background: var(--orange-glow);
  color: var(--cream);
}

.decision-option.chosen .decision-label {
  background: var(--orange);
  color: var(--bg);
  border-color: var(--orange);
}

.decision-option.chosen.best {
  border-color: var(--green);
  background: rgba(120, 140, 93, 0.12);
}

.decision-option.chosen.best .decision-label {
  background: var(--green);
  border-color: var(--green);
}

.answered .decision-option { cursor: default; }

.decision-tradeoffs {
  padding: 0 1.25rem;
  max-height: 0;
  overflow: hidden;
  transition: all 0.5s ease;
}

.decision-block.answered .decision-tradeoffs {
  max-height: 600px;
  padding: 0.75rem 1.25rem 1rem;
  border-top: 1px dashed var(--border);
}

.tradeoff {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.5rem 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.tradeoff-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 20px;
  border-radius: 3px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-dim);
  flex-shrink: 0;
}

.tradeoff[data-idx].best-tradeoff .tradeoff-label {
  color: var(--green);
  border-color: var(--green-dim);
}

/* === GAMES === */
.game-block {
  background: var(--bg-window);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin: 1.5rem 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.game-header {
  background: linear-gradient(135deg, #4a3a6a, #6a4a8a);
  border-bottom: 1px solid var(--border);
  padding: 0.4rem 0.75rem;
  font-weight: 600;
  color: var(--cream);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.game-instruction {
  padding: 0.75rem 1rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-bottom: 1px dashed var(--border);
}

.game-score {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  display: none;
}

.game-score.show { display: block; }
.game-score.correct { color: var(--green); }

.game-check-btn {
  margin: 0.5rem 1rem 0.75rem;
  padding: 0.45rem 1rem;
  background: var(--bg-titlebar);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--cream-dim);
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
}

.game-check-btn:hover {
  border-color: var(--orange);
  color: var(--orange);
}

/* Match game */
.match-container {
  display: flex;
  gap: 1.5rem;
  padding: 1rem;
}

.match-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.match-item {
  padding: 0.5rem 0.7rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--cream-dim);
}

.match-item:hover:not(.matched) {
  border-color: var(--orange);
}

.match-left.selected {
  border-color: var(--orange);
  background: var(--orange-glow);
  color: var(--cream);
}

.match-item.matched {
  border-color: var(--green);
  background: rgba(120, 140, 93, 0.12);
  color: var(--green);
  cursor: default;
  opacity: 0.7;
}

.match-item.wrong {
  border-color: var(--red);
  background: rgba(199, 80, 80, 0.12);
  animation: shake 0.35s ease;
}

/* Order game */
.order-container {
  padding: 0.75rem 1rem;
}

.order-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.7rem;
  margin: 0.3rem 0;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: grab;
  transition: all 0.15s;
  color: var(--cream-dim);
  user-select: none;
}

.order-item:active { cursor: grabbing; }
.order-item.dragging { opacity: 0.4; }

.order-handle {
  color: var(--text-dim);
  font-size: 0.7rem;
  flex-shrink: 0;
}

.order-item.correct {
  border-color: var(--green);
  background: rgba(120, 140, 93, 0.12);
  color: var(--green);
}

.order-item.wrong {
  border-color: var(--red);
  background: rgba(199, 80, 80, 0.12);
  color: var(--red);
}

/* Classify game */
.classify-pool {
  padding: 0.75rem 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-height: 40px;
  border-bottom: 1px dashed var(--border);
}

.classify-chip {
  padding: 0.35rem 0.65rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.75rem;
  cursor: grab;
  transition: all 0.15s;
  color: var(--cream-dim);
  user-select: none;
}

.classify-chip:hover { border-color: var(--orange); }
.classify-chip.dragging { opacity: 0.4; }

.classify-chip.correct {
  border-color: var(--green);
  color: var(--green);
  background: rgba(120, 140, 93, 0.1);
}

.classify-chip.wrong {
  border-color: var(--red);
  color: var(--red);
  background: rgba(199, 80, 80, 0.1);
}

.classify-buckets {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
}

.classify-bucket {
  flex: 1;
  border: 1px dashed var(--border);
  border-radius: 8px;
  min-height: 80px;
  transition: all 0.15s;
}

.classify-bucket.drag-over {
  border-color: var(--orange);
  background: var(--orange-glow);
}

.classify-bucket-label {
  padding: 0.35rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--orange);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px dashed var(--border);
}

.classify-bucket-items {
  padding: 0.4rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

/* === EXERCISE (retro window) === */
.exercise-block {
  background: var(--bg-window);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin: 1.5rem 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.exercise-header {
  background: var(--bg-titlebar);
  border-bottom: 1px solid var(--border);
  padding: 0.4rem 0.75rem;
  font-weight: 600;
  color: var(--green);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.exercise-prompt {
  padding: 1rem 1.25rem 0.75rem;
  color: var(--cream-dim);
  font-size: 0.9rem;
  line-height: 1.5;
}

.exercise-block textarea {
  width: calc(100% - 2.5rem);
  margin: 0 1.25rem 1rem;
  min-height: 100px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--cream);
  padding: 0.6rem 0.85rem;
  font-family: inherit;
  font-size: 0.85rem;
  line-height: 1.6;
  resize: vertical;
  transition: border-color 0.2s;
}

.exercise-block textarea:focus {
  outline: none;
  border-color: var(--orange);
}

.save-indicator {
  font-size: 0.7rem;
  color: var(--green);
  opacity: 0;
  transition: opacity 0.3s;
  padding: 0 1.25rem 0.75rem;
}

.save-indicator.show { opacity: 1; }

/* === COMPLETION BADGE === */
#completion-badge {
  position: fixed;
  bottom: 52px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg-window);
  border: 1px solid var(--green);
  color: var(--green);
  padding: 0.6rem 1.25rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.8rem;
  z-index: 200;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

#completion-badge.show { transform: translateX(-50%) translateY(0); }
.badge-icon { font-size: 1rem; }

/* === NAVIGATION === */
.lesson-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px dashed var(--border);
  /* progressive reveal overrides opacity/pointer-events */
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  background: var(--bg-window);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.8rem;
  font-family: inherit;
  transition: all 0.15s;
}

.nav-btn:hover {
  border-color: var(--orange);
  color: var(--orange);
  text-decoration: none;
}

.nav-btn.primary {
  background: var(--orange-dim);
  border-color: var(--orange);
  color: var(--cream);
}

.nav-btn.primary:hover {
  background: var(--orange);
  color: var(--bg);
}

/* === HUB PAGE === */
.hero {
  text-align: center;
  padding: 2.5rem 0 1.5rem;
}

.hero h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.hero p {
  color: var(--text-muted);
  font-size: 0.9rem;
  max-width: 500px;
  margin: 0 auto 1.5rem;
}

.stats-row {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.stat-card {
  background: var(--bg-window);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  text-align: center;
  min-width: 120px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--orange); }
.stat-label { font-size: 0.7rem; color: var(--text-dim); margin-top: 0.15rem; text-transform: uppercase; letter-spacing: 0.04em; }

.module-card {
  background: var(--bg-window);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 0.85rem;
  transition: all 0.15s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.module-card:hover {
  border-color: var(--orange-dim);
}

.module-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--bg-titlebar);
  border-bottom: 1px solid var(--border);
}

.module-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--cream);
}

.module-progress-badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--text-dim);
}

.module-progress-badge.complete {
  border-color: var(--green);
  color: var(--green);
  background: rgba(120, 140, 93, 0.15);
}

.module-bar {
  height: 2px;
  background: var(--border);
  overflow: hidden;
}

.module-bar-fill {
  height: 100%;
  background: var(--orange);
  transition: width 0.5s;
}

.lesson-list { list-style: none; padding: 0.5rem 1rem; margin: 0; }

.lesson-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.lesson-item a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.8rem;
  width: 100%;
  transition: color 0.15s;
}

.lesson-item a:hover { color: var(--orange); }

.lesson-check {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  flex-shrink: 0;
  color: transparent;
}

.lesson-check.done {
  border-color: var(--green);
  color: var(--green);
  background: rgba(120, 140, 93, 0.15);
}

/* === PROGRESSIVE REVEAL === */
.reveal-section {
  opacity: 0;
  transform: translateY(16px);
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.4s ease, transform 0.4s ease, max-height 0.5s ease;
  pointer-events: none;
}

.reveal-section.visible {
  opacity: 1;
  transform: translateY(0);
  max-height: 5000px;
  overflow: visible;
  pointer-events: auto;
}

/* Continue button — floats inside terminal body */
#continue-btn {
  position: fixed;
  bottom: 52px;
  right: 28px;
  background: var(--orange-dim);
  border: 1px solid var(--orange);
  color: var(--cream);
  padding: 0.55rem 1.25rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  z-index: 150;
  transition: all 0.15s;
  font-family: inherit;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
}

#continue-btn:hover {
  background: var(--orange);
  color: var(--bg);
}

/* Step counter + progress in status bar */
#step-counter {
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 500;
}

.local-progress-track {
  width: 50px;
  height: 2px;
  background: var(--border);
  border-radius: 1px;
  overflow: hidden;
}

.local-progress-fill {
  height: 100%;
  background: var(--orange);
  border-radius: 1px;
  transition: width 0.4s ease;
  width: 0%;
}

/* Continue hint after quiz */
.continue-hint {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.7rem;
  padding: 0.5rem 1.25rem 0.75rem;
  opacity: 0;
  transition: opacity 0.4s;
}

.continue-hint.show { opacity: 1; }

/* Inline (skippable) blocks get a subtle skip hint */
.quiz-block:not([data-required]) .continue-hint,
.game-block:not([data-required]) .continue-hint,
.decision-block:not([data-required]) .continue-hint {
  display: none;
}

.quiz-block:not([data-required])::after,
.game-block:not([data-required])::after,
.decision-block:not([data-required])::after {
  content: '→ to skip';
  display: block;
  text-align: right;
  font-size: 0.6rem;
  color: var(--text-dim);
  padding: 0.3rem 1rem 0.5rem;
  opacity: 0.5;
}

/* Shake for unanswered quiz */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

.quiz-block.shake { animation: shake 0.35s ease; }

/* Nav hidden until end */
.lesson-nav {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: none;
}

.lesson-nav.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* === ICON RAIL (left sidebar) === */
.icon-rail {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 48px;
  background: var(--bg-window);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 4px;
  z-index: 350;
}

.rail-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--text-dim);
  background: none;
  border: none;
  cursor: pointer;
  transition: all 0.12s;
  text-decoration: none;
}

.rail-icon:hover {
  background: rgba(217, 119, 87, 0.08);
  color: var(--cream);
}

.rail-spacer { flex: 1; }

.rail-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--orange-dim);
  color: var(--cream);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 700;
  margin-top: 4px;
}

/* === LESSON DRAWER (left panel) === */
.lesson-drawer {
  position: fixed;
  top: 0;
  left: 48px;
  bottom: 0;
  width: 220px;
  background: var(--bg-window);
  border-right: 1px solid var(--border);
  z-index: 300;
  transform: translateX(-100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
}

.lesson-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: var(--bg-titlebar);
}

.drawer-title {
  font-size: 0.75rem;
  color: var(--cream);
  font-weight: 600;
}

.drawer-close {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.7rem;
  padding: 1px 6px;
  font-family: inherit;
}

.drawer-close:hover { border-color: var(--orange); color: var(--orange); }

.drawer-modules {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.drawer-module {
  padding: 0 0 4px;
}

.drawer-module-title {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 8px 12px 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.drawer-lesson {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px 4px 20px;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.1s;
}

.drawer-lesson:hover { background: rgba(217, 119, 87, 0.06); color: var(--cream); text-decoration: none; }
.drawer-lesson.active { color: var(--orange); font-weight: 600; }

.drawer-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.drawer-dot.done { background: var(--green); border-color: var(--green); }
.drawer-lesson.active .drawer-dot { background: var(--orange); border-color: var(--orange); }

/* === CHAT PANEL (toggleable) === */
#chat-panel.hidden {
  transform: translateX(400px);
}

/* === CHAT PANEL (sidebar) === */
#chat-panel {
  position: fixed;
  top: 12px;
  right: 12px;
  bottom: 12px;
  width: 348px;
  background: var(--bg-window);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  z-index: 250;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-titlebar {
  background: var(--bg-titlebar);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  height: 38px;
}

.chat-titlebar-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--orange);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.chat-title {
  font-size: 0.75rem;
  color: var(--cream);
  font-weight: 500;
}

.chat-close {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  font-family: inherit;
  transition: all 0.15s;
}

.chat-close:hover {
  border-color: var(--orange);
  color: var(--orange);
}

#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.chat-msg {
  padding: 0.5rem 0.7rem;
  border-radius: 6px;
  font-size: 0.8rem;
  line-height: 1.5;
  max-width: 90%;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-msg.user {
  background: var(--orange-glow);
  border: 1px solid var(--orange-dim);
  color: var(--cream);
  align-self: flex-end;
}

.chat-msg.assistant {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--cream-dim);
  align-self: flex-start;
}

/* Chat rendered markdown */
.chat-msg p {
  margin: 0 0 0.75rem;
  line-height: 1.65;
}
.chat-msg p:last-child { margin: 0; }
.chat-msg p + p { margin-top: 0.5rem; }
.chat-msg p + ul, .chat-msg p + ol { margin-top: 0.3rem; }
.chat-msg ul + p, .chat-msg ol + p { margin-top: 0.5rem; }
.chat-msg pre + p { margin-top: 0.5rem; }
.chat-msg strong { color: var(--cream); font-weight: 600; }
.chat-msg em { color: var(--text-muted); font-style: italic; }

.chat-msg ul, .chat-msg ol {
  margin: 0.5rem 0;
  padding-left: 0.2rem;
  list-style: none;
}

.chat-msg li {
  margin: 0.3rem 0;
  font-size: 0.78rem;
  line-height: 1.5;
  padding-left: 1rem;
  position: relative;
}

.chat-msg li::before {
  content: '→';
  color: var(--orange);
  position: absolute;
  left: 0;
}

.chat-msg ol li { list-style: decimal; padding-left: 0.5rem; }
.chat-msg ol li::before { content: none; }

.chat-code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
  margin: 0.6rem 0;
  font-size: 0.68rem;
  line-height: 1.6;
  overflow-x: auto;
  display: block;
}

.chat-code code {
  font-family: 'JetBrains Mono', 'SF Mono', 'Monaco', monospace;
  color: var(--cream-dim);
}

.chat-inline-code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.1em 0.35em;
  font-size: 0.72rem;
  color: var(--orange);
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
}

/* Typing animation */
.chat-typing-dots {
  display: inline-flex;
  gap: 2px;
}

.chat-typing-dots span {
  animation: typing-bounce 1.2s infinite;
  color: var(--text-dim);
  font-size: 1.2rem;
  line-height: 1;
}

.chat-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.3; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.chat-error {
  color: var(--red);
  font-size: 0.75rem;
}

.chat-error code {
  color: var(--orange);
  font-size: 0.7rem;
}

.chat-welcome {
  color: var(--text-dim);
  font-size: 0.75rem;
  text-align: center;
  padding: 1rem;
  line-height: 1.6;
}

.chat-input-area {
  border-top: 1px solid var(--border);
  padding: 0.5rem;
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

#chat-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--cream);
  padding: 0.45rem 0.6rem;
  font-family: inherit;
  font-size: 0.8rem;
  resize: none;
  outline: none;
}

#chat-input:focus {
  border-color: var(--orange);
}

#chat-send {
  background: var(--orange-dim);
  border: 1px solid var(--orange);
  border-radius: 6px;
  color: var(--cream);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  padding: 0.4rem 0.7rem;
  transition: all 0.15s;
  flex-shrink: 0;
}

#chat-send:hover {
  background: var(--orange);
  color: var(--bg);
}

/* Chat toggle button — hidden (always open) */
#chat-toggle { display: none; }

/* Selection context chip */
.chat-context {
  margin: 0 0.5rem;
  padding: 0.4rem 0.6rem;
  background: var(--orange-glow);
  border: 1px solid var(--orange-dim);
  border-radius: 6px;
  font-size: 0.7rem;
  color: var(--cream-dim);
  display: none;
  align-items: flex-start;
  gap: 0.4rem;
  line-height: 1.4;
  flex-shrink: 0;
}

.chat-context.show { display: flex; }

.chat-context-text {
  flex: 1;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

.chat-context-label {
  color: var(--orange);
  font-weight: 600;
  white-space: nowrap;
  font-size: 0.65rem;
}

.chat-context-dismiss {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}

.chat-context-dismiss:hover { color: var(--orange); }

.chat-msg-context {
  font-size: 0.7rem;
  color: var(--orange);
  background: rgba(217, 119, 87, 0.1);
  border-left: 2px solid var(--orange);
  padding: 3px 6px;
  margin-bottom: 4px;
  border-radius: 3px;
  line-height: 1.3;
  word-break: break-word;
}

/* === SHORTCUTS OVERLAY === */
#shortcuts-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.shortcuts-window {
  background: var(--bg-window);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 380px;
  max-width: 90vw;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.shortcuts-body {
  padding: 1rem 1.25rem;
}

.shortcut-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.shortcut-row span:last-child {
  margin-left: auto;
  color: var(--cream-dim);
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 22px;
  padding: 0 0.35rem;
  background: var(--bg-titlebar);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.7rem;
  color: var(--orange);
  box-shadow: 0 1px 0 var(--border);
}

/* Shortcuts hint in bottom bar */
.shortcuts-hint {
  color: var(--text-dim);
  font-size: 0.65rem;
  opacity: 0.6;
}

/* === RESPONSIVE === */
@media (max-width: 640px) {
  .hero h1 { font-size: 1.5rem; }
  .stats-row { gap: 0.75rem; }
  .stat-card { min-width: 90px; padding: 0.75rem; }
  .container { padding: 0.75rem 1rem 3rem; }
  #continue-btn { bottom: 1rem; right: 1rem; font-size: 0.75rem; }
  .bottom-bar { bottom: 1rem; left: 1rem; }
}
