/* App-specific styles for /app — Luminary curriculum agent UI */

.app-nav { border-bottom: 1px solid var(--border); }

.app-main {
  min-height: 100vh;
  padding-top: 5rem;
}

/* START SCREEN */
.screen {
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 2.5rem;
}

.start-hero { max-width: 640px; }
.start-headline {
  font-family: 'Instrument Serif', serif;
  font-size: clamp(2rem, 3.5vw, 3rem);
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 1rem 0 1.25rem;
}
.start-lede {
  font-size: 1.0625rem;
  color: var(--muted);
  line-height: 1.65;
  margin-bottom: 2.5rem;
  max-width: 52ch;
}

.topic-input-wrap {
  display: flex;
  gap: 0.75rem;
  align-items: stretch;
  margin-bottom: 1.5rem;
}
.topic-input {
  flex: 1;
  padding: 0.875rem 1.25rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: 'Instrument Sans', sans-serif;
  font-size: 1rem;
  color: var(--fg);
  background: var(--bg);
  transition: border-color 0.2s;
}
.topic-input:focus {
  outline: none;
  border-color: var(--accent);
}
.topic-input::placeholder { color: var(--muted); opacity: 0.7; }

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  background: var(--fg);
  color: var(--bg);
  border: none;
  border-radius: 8px;
  font-family: 'Instrument Sans', sans-serif;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  white-space: nowrap;
}
.btn-primary:hover { background: #2e2e2e; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--bg);
  color: var(--fg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: 'Instrument Sans', sans-serif;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.btn-secondary:hover { border-color: var(--accent); }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background: transparent;
  color: var(--muted);
  border: none;
  border-radius: 8px;
  font-family: 'Instrument Sans', sans-serif;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
}
.btn-ghost:hover { color: var(--fg); }

.recent-label {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-right: 0.5rem;
}
.recent-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.recent-chip {
  padding: 0.375rem 0.875rem;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.8125rem;
  color: var(--fg);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.recent-chip:hover { background: #e8e5df; border-color: var(--accent); }

/* ASSESSMENT SCREEN */
.assessment-layout {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 3rem;
  align-items: start;
}

.session-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.875rem;
  background: rgba(200, 135, 58, 0.1);
  border: 1px solid rgba(200, 135, 58, 0.3);
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1.5rem;
}
.session-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: blink 1.5s ease-in-out infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.question-text {
  font-family: 'Instrument Serif', serif;
  font-size: clamp(1.25rem, 2vw, 1.75rem);
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin-bottom: 0.75rem;
  color: var(--fg);
}
.question-context {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 1.75rem;
  line-height: 1.5;
}
.question-context strong { color: var(--accent); font-weight: 600; }

.answer-input {
  width: 100%;
  padding: 1rem 1.25rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: 'Instrument Sans', sans-serif;
  font-size: 1rem;
  color: var(--fg);
  background: var(--bg);
  resize: vertical;
  min-height: 100px;
  transition: border-color 0.2s;
  line-height: 1.6;
}
.answer-input:focus {
  outline: none;
  border-color: var(--accent);
}

.answer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.75rem;
}
.char-count {
  font-size: 0.75rem;
  color: var(--muted);
}

.progress-bar-wrap {
  margin-top: 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.progress-bar-track {
  flex: 1;
  height: 3px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.5s ease;
  width: 0%;
}
.progress-label {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}

/* GAP MAP PANEL */
.gap-map-panel {
  background: #F2EFE9;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  position: sticky;
  top: 5rem;
}
.gap-map-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.gap-map-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.gap-count-badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.625rem;
  background: var(--node-gapping);
  color: white;
  border-radius: 12px;
}

.gap-map-canvas {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 0.875rem;
}

.gap-map-legend {
  display: flex;
  gap: 1rem;
  font-size: 0.7rem;
  color: var(--muted);
  margin-bottom: 1rem;
}
.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.3rem;
}
.legend-dot.known { background: var(--node-known); }
.legend-dot.gap { background: var(--node-gapping); }
.legend-dot.probing { background: #888; animation: blink 1.5s infinite; }

.gap-list { display: flex; flex-direction: column; gap: 0.5rem; }
.gap-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.8125rem;
}
.gap-item-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--node-gapping);
  flex-shrink: 0;
}

/* RESULTS SCREEN */
.results-layout { max-width: 800px; margin: 0 auto; }

.results-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.875rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1.25rem;
}
.results-badge.mastered { background: rgba(168, 196, 176, 0.3); color: #4a7a4a; }
.results-badge.gaps { background: rgba(200, 135, 58, 0.15); color: var(--accent); }

.results-headline {
  font-family: 'Instrument Serif', serif;
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}
.results-body { font-size: 1rem; color: var(--muted); line-height: 1.65; margin-bottom: 2.5rem; }

/* CURRICULUM */
.curriculum-container {
  background: #F2EFE9;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 2rem;
}
.curriculum-header {
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid var(--border);
  background: #e8e5de;
}
.curriculum-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.curriculum-stages { padding: 0.5rem 0; }

.stage-item {
  padding: 1.5rem 1.75rem;
  border-bottom: 1px solid var(--border);
}
.stage-item:last-child { border-bottom: none; }

.stage-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}
.stage-num {
  font-family: 'Instrument Serif', serif;
  font-size: 1.75rem;
  color: var(--accent);
  line-height: 1;
  flex-shrink: 0;
  width: 2rem;
}
.stage-title {
  font-family: 'Instrument Serif', serif;
  font-size: 1.125rem;
  line-height: 1.2;
}
.stage-desc {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 1rem;
  padding-left: 3rem;
  line-height: 1.5;
}
.stage-steps { padding-left: 3rem; display: flex; flex-direction: column; gap: 0.5rem; }
.step-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: var(--fg);
}
.step-type-badge {
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
  min-width: 3.5rem;
  text-align: center;
}
.step-type-badge.read { background: #e8f0fe; color: #1a73e8; }
.step-type-badge.watch { background: #e6f4ea; color: #137333; }
.step-type-badge.practice { background: #fef7e0; color: #b06000; }
.step-type-badge.build { background: #f3e8fd; color: #7c3aed; }
.step-type-badge.explain { background: #fce8e6; color: #c5221f; }

.step-label { font-weight: 500; }
.step-meta { margin-left: auto; font-size: 0.75rem; color: var(--muted); white-space: nowrap; }

.results-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* LOADING OVERLAY */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(250, 248, 245, 0.85);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.thinking-indicator { text-align: center; }
.thinking-dots {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
  margin-bottom: 1rem;
}
.thinking-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.2s ease-in-out infinite;
}
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes pulse {
  0%, 100% { transform: scale(0.8); opacity: 0.4; }
  50% { transform: scale(1.2); opacity: 1; }
}
#loadingMessage { font-size: 0.875rem; color: var(--muted); }

/* Responsive */
@media (max-width: 900px) {
  .assessment-layout { grid-template-columns: 1fr; }
  .gap-map-panel { position: static; }
}
@media (max-width: 768px) {
  .screen { padding: 2rem 1.25rem; }
  .topic-input-wrap { flex-direction: column; }
  .btn-primary { width: 100%; justify-content: center; }
  .gap-map-panel { margin-top: 1rem; }
}