:root {
  --bg: #fff9ef;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-strong: rgba(255, 255, 255, 0.94);
  --card: #ffffff;
  --text: #1d2935;
  --muted: #5a6872;
  --primary: #ff6b35;
  --secondary: #008891;
  --accent: #ffd166;
  --success: #248c62;
  --danger: #d1495b;
  --sky: #dff7ff;
  --border: rgba(29, 41, 53, 0.12);
  --shadow: 0 24px 60px rgba(76, 54, 25, 0.16);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Outfit', sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 209, 102, 0.45), transparent 26%),
    radial-gradient(circle at 85% 12%, rgba(0, 136, 145, 0.18), transparent 22%),
    linear-gradient(180deg, #fffdf8 0%, #fff6e7 44%, #f8efe3 100%);
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,0.08) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.08) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.35), transparent 80%);
}

.page-orb {
  position: fixed;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  filter: blur(20px);
  pointer-events: none;
  opacity: 0.6;
}

.orb-one {
  top: 60px;
  left: -80px;
  background: rgba(255, 107, 53, 0.18);
}

.orb-two {
  right: -60px;
  top: 320px;
  background: rgba(0, 136, 145, 0.16);
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
}

textarea {
  width: 100%;
  min-height: 260px;
  resize: vertical;
  border: 1px solid rgba(29, 41, 53, 0.08);
  outline: none;
  background: #fffefb;
  border-radius: 16px;
  padding: 16px;
  color: var(--text);
  line-height: 1.5;
}

.app-shell {
  width: min(1320px, calc(100% - 24px));
  margin: 0 auto;
  padding: 24px 0 40px;
  position: relative;
  z-index: 1;
}

.hero,
.dashboard,
.editor-grid,
.mission-grid {
  display: grid;
  gap: 22px;
}

.hero {
  grid-template-columns: 1.1fr 0.7fr;
}

.dashboard {
  grid-template-columns: 350px 1fr;
  margin-top: 24px;
}

.hero__content,
.hero__side,
.panel,
.studio-panel {
  background: var(--panel);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow);
  border-radius: var(--radius-xl);
}

.hero__content,
.hero__side,
.panel,
.studio-panel {
  padding: 24px;
}

.hero__side {
  display: grid;
  gap: 18px;
  align-content: start;
}

.brand-row,
.hero__actions,
.hero__badges,
.panel__header,
.challenge-header,
.studio-actions,
.quiz-options,
.lesson-meta,
.stage-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.panel__header,
.challenge-header {
  justify-content: space-between;
}

.brand-pill,
.brand-mini,
.hero__badges span,
.chip,
.difficulty-pill,
.stage-pill,
.stage-chip,
.panel__label,
.preview-label,
.stat-card span,
.mini-card span {
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.76rem;
  font-weight: 800;
}

.brand-pill,
.primary-btn,
.secondary-btn,
.ghost-btn,
.quiz-option,
.lesson-item,
.stage-chip {
  border-radius: 999px;
}

.brand-pill {
  background: linear-gradient(135deg, var(--primary), #ff9f68);
  color: white;
  padding: 10px 16px;
}

.brand-mini,
.hero__badges span,
.chip,
.difficulty-pill,
.stage-pill,
.stage-chip {
  background: rgba(255, 255, 255, 0.88);
  color: var(--muted);
  padding: 10px 14px;
  border: 1px solid rgba(29, 41, 53, 0.08);
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.05;
  font-family: 'Baloo 2', cursive;
}

h1 {
  font-size: clamp(2.6rem, 5vw, 4.8rem);
  max-width: 11ch;
}

h2 {
  font-size: clamp(1.75rem, 3vw, 2.4rem);
}

h3 {
  font-size: 1.5rem;
}

.hero__copy,
#lessonDescription,
#lessonExplanation,
#exercisePrompt,
#quizQuestion,
.auto-guide,
.feedback-box,
#celebrationMessage,
#heroSupportText,
blockquote,
.lesson-item span {
  color: var(--muted);
  line-height: 1.65;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.quiz-option {
  padding: 12px 18px;
  font-weight: 800;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.primary-btn {
  background: linear-gradient(135deg, var(--primary), #ff8d4e);
  color: white;
  box-shadow: 0 16px 32px rgba(255, 107, 53, 0.28);
}

.secondary-btn {
  background: linear-gradient(135deg, var(--secondary), #12b6bf);
  color: white;
}

.ghost-btn,
.quiz-option,
.lesson-item {
  background: white;
  color: var(--text);
  border: 1px solid var(--border);
}

.primary-btn:hover,
.secondary-btn:hover,
.ghost-btn:hover,
.quiz-option:hover,
.lesson-item:hover,
.stage-chip:hover {
  transform: translateY(-2px);
}

.stat-card,
.mini-card,
.mission-card,
.editor-card {
  background: var(--panel-strong);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.stat-card,
.mini-card,
.mission-card,
.editor-card {
  padding: 20px;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 2.7rem;
  font-family: 'Baloo 2', cursive;
}

.progress-track {
  margin-top: 12px;
  height: 14px;
  background: #f5ede0;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  border-radius: inherit;
  transition: width 0.3s ease;
}

.stage-legend {
  margin-top: 16px;
}

.stage-chip {
  background: #fff;
  border: 1px solid var(--border);
}

.lesson-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  max-height: 68vh;
  overflow: auto;
  padding-right: 6px;
}

.lesson-item {
  text-align: left;
  padding: 16px 18px;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.lesson-item strong {
  display: block;
  font-size: 1rem;
}

.lesson-item span {
  display: block;
  margin-top: 4px;
  font-size: 0.92rem;
}

.lesson-item.active {
  background: linear-gradient(135deg, rgba(255, 107, 53, 0.12), rgba(255, 209, 102, 0.32));
  border-color: rgba(255, 107, 53, 0.38);
}

.lesson-item.completed {
  box-shadow: inset 0 0 0 2px rgba(36, 140, 98, 0.22);
}

.lesson-item:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.mission-grid {
  margin-top: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.auto-guide,
.feedback-box,
.checklist,
blockquote {
  margin-top: 14px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: #fff9f2;
  border: 1px dashed rgba(29, 41, 53, 0.14);
}

blockquote {
  background: var(--sky);
  font-weight: 600;
}

.feedback-box:empty,
.checklist:empty,
blockquote:empty {
  display: none;
}

.step-list {
  margin: 14px 0 0;
  padding-left: 20px;
  line-height: 1.8;
  color: var(--muted);
}

.checklist {
  display: grid;
  gap: 10px;
}

.check-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.check-item::before {
  content: '\2713';
  color: var(--success);
  font-weight: 800;
}

.quiz-options {
  margin-top: 12px;
}

.quiz-option.correct {
  background: rgba(36, 140, 98, 0.12);
  border-color: rgba(36, 140, 98, 0.35);
}

.quiz-option.wrong {
  background: rgba(209, 73, 91, 0.12);
  border-color: rgba(209, 73, 91, 0.35);
}

.celebration-card {
  background: linear-gradient(135deg, rgba(255, 209, 102, 0.24), rgba(223, 247, 255, 0.75));
}

.practice-first-card {
  border: 1px solid rgba(255, 107, 53, 0.22);
  box-shadow: inset 0 0 0 1px rgba(255, 209, 102, 0.35);
}

.hidden {
  display: none !important;
}

.studio {
  margin-top: 24px;
}

.editor-grid {
  margin-top: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.editor-card {
  display: grid;
  gap: 12px;
}

.editor-card span {
  font-weight: 800;
}

.preview-wrap {
  margin-top: 18px;
}

iframe {
  width: 100%;
  min-height: 420px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: white;
}

.notes-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 34;
}

.notes-panel {
  position: fixed;
  top: 16px;
  right: 16px;
  bottom: 16px;
  width: min(820px, calc(100vw - 24px));
  z-index: 35;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 22px;
  display: grid;
  grid-template-rows: auto 1fr;
}

.notes-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
}

.notes-panel__close {
  flex: 0 0 auto;
  font-size: 1.15rem;
  line-height: 1;
}

.notes-panel__body {
  overflow: auto;
  display: grid;
  gap: 16px;
  padding-right: 4px;
}

.notes-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.notes-card {
  background: linear-gradient(180deg, rgba(255, 248, 235, 0.98), rgba(223, 247, 255, 0.92));
  border: 1px solid rgba(29, 41, 53, 0.1);
  border-radius: 22px;
  padding: 18px;
}

.notes-card h3 {
  margin-bottom: 10px;
}

.notes-card p,
.notes-card li,
.notes-card code {
  color: var(--muted);
  line-height: 1.65;
}

.notes-card p {
  margin: 0 0 10px;
}

.notes-card ol,
.notes-card ul {
  margin: 10px 0 0;
  padding-left: 20px;
}

.notes-label {
  display: inline-block;
  margin-bottom: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(29, 41, 53, 0.08);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.notes-section-title {
  display: inline-block;
  margin: 10px 0 6px;
  font-weight: 800;
  color: var(--text);
}

.notes-code {
  margin-top: 12px;
  background: #0f172a;
  color: #d2f7ff;
  padding: 14px;
  border-radius: 16px;
  overflow: auto;
}

.floating-action-group {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
}

.notes-fab {
  padding: 14px 18px;
  background: linear-gradient(135deg, #ffd166, #ff9f68);
  color: #4a2d00;
  border-radius: 999px;
  box-shadow: 0 18px 34px rgba(255, 107, 53, 0.28), 0 0 0 4px rgba(255, 209, 102, 0.18);
  font-weight: 800;
}

.support-bot__trigger {
  padding: 14px 18px;
  background: linear-gradient(135deg, var(--secondary), #12b6bf);
  color: white;
  border-radius: 999px;
  box-shadow: 0 18px 34px rgba(0, 136, 145, 0.24);
}

.support-bot {
  position: fixed;
  right: 18px;
  bottom: 82px;
  z-index: 30;
  width: min(320px, calc(100vw - 28px));
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.support-bot__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.support-bot__header strong {
  font-family: 'Baloo 2', cursive;
  font-size: 1.15rem;
}

.support-bot__close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fff3ef;
  color: var(--primary);
  font-weight: 800;
}

.support-bot p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

@media (max-width: 1100px) {
  .hero,
  .dashboard,
  .mission-grid,
  .editor-grid {
    grid-template-columns: 1fr;
  }

  .lesson-list {
    max-height: none;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 16px, 1320px);
    padding-top: 16px;
  }

  .hero__content,
  .hero__side,
  .panel,
  .studio-panel,
  .stat-card,
  .mini-card,
  .mission-card,
  .editor-card {
    padding: 16px;
  }

  h1 {
    font-size: 2.35rem;
  }

  textarea {
    min-height: 210px;
  }

  iframe {
    min-height: 320px;
  }

  .notes-panel {
    top: 8px;
    right: 8px;
    left: 8px;
    bottom: 8px;
    width: auto;
    padding: 16px;
  }

  .notes-grid {
    grid-template-columns: 1fr;
  }

  .floating-action-group {
    right: 12px;
    left: 12px;
    bottom: 12px;
    gap: 8px;
  }

  .floating-action-group > button {
    flex: 1 1 0;
    min-width: 0;
  }

  .support-bot {
    right: 12px;
    bottom: 72px;
  }
}
