:root {
  --ink: #183153;
  --muted: #5f6c80;
  --paper: #fffdf8;
  --card: rgba(255, 255, 255, 0.82);
  --line: rgba(24, 49, 83, 0.12);
  --accent: #ff8f3d;
  --accent-strong: #e96f1d;
  --accent-soft: #fff0d9;
  --sky: #dff1ff;
  --mint: #dff8ed;
  --shadow: 0 24px 60px rgba(33, 54, 88, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Verdana", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 205, 121, 0.35), transparent 24%),
    radial-gradient(circle at right 20%, rgba(143, 220, 255, 0.4), transparent 22%),
    linear-gradient(180deg, #fff9ee 0%, #f5fbff 100%);
}

button,
input,
textarea {
  font: inherit;
}

textarea,
input {
  width: 100%;
}

.page-shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 24px;
}

.sidebar,
.card,
.hero-panel {
  backdrop-filter: blur(10px);
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow);
}

.sidebar {
  border-radius: 28px;
  padding: 28px;
  position: sticky;
  top: 24px;
  height: fit-content;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

.sidebar h1,
.hero-panel h2,
.card h3 {
  margin: 0;
}

.sidebar h1 {
  font-size: 36px;
  line-height: 1.05;
}

.intro,
.lesson-summary,
.mission-text,
.question-text,
#challengeText,
.tip-list p,
.goal-card p,
.feedback-text,
.editor-footer,
.learning-item {
  color: var(--muted);
}

.intro {
  margin: 14px 0 0;
  line-height: 1.7;
}

.goal-card {
  margin-top: 24px;
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(135deg, #fff4de, #fffdf8);
  border: 1px solid rgba(233, 111, 29, 0.14);
}

.grade-tabs {
  margin-top: 20px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.grade-tab {
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 800;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.7);
  cursor: pointer;
}

.grade-tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 12px 28px rgba(233, 111, 29, 0.22);
}

.goal-label {
  font-size: 14px;
  font-weight: 800;
  color: var(--accent-strong);
}

.goal-card p {
  margin: 8px 0 0;
  line-height: 1.6;
}

.lesson-list {
  margin-top: 24px;
  display: grid;
  gap: 10px;
}

.lesson-button {
  border: 0;
  border-radius: 18px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.lesson-button:hover,
.choice-button:hover,
.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
}

.lesson-button.active {
  background: linear-gradient(135deg, #ffedd0, #ffffff);
  box-shadow: inset 0 0 0 1px rgba(233, 111, 29, 0.22);
}

.lesson-index {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.main-panel {
  display: grid;
  gap: 20px;
}

.hero-panel {
  border-radius: 28px;
  padding: 24px 28px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
}

.lesson-summary {
  max-width: 760px;
  margin: 10px 0 0;
  line-height: 1.7;
}

.progress-box {
  min-width: 120px;
  padding: 16px 18px;
  border-radius: 20px;
  background: linear-gradient(135deg, #e3f4ff, #ffffff);
  text-align: center;
}

.progress-box span {
  display: block;
  font-size: 14px;
  color: var(--muted);
}

.progress-box strong {
  display: block;
  margin-top: 6px;
  font-size: 30px;
}

.teaching-grid,
.workspace-grid,
.bottom-grid {
  display: grid;
  gap: 20px;
}

.teaching-grid {
  grid-template-columns: 1.15fr 0.85fr;
}

.workspace-grid {
  grid-template-columns: 1fr 0.92fr;
}

.bottom-grid {
  grid-template-columns: 1fr 0.9fr;
}

.card {
  border-radius: 28px;
  padding: 24px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.tag {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.tag.soft {
  background: var(--sky);
  color: #13618f;
}

.tag.success {
  background: var(--mint);
  color: #15724b;
}

.tag.warm {
  background: #ffe6da;
  color: #b35718;
}

.tip-list {
  margin-top: 20px;
  display: grid;
  gap: 16px;
}

.tip-title {
  display: inline-block;
  margin-bottom: 6px;
  font-weight: 800;
}

.tip-list p,
.mission-text,
.question-text,
#challengeText {
  margin: 0;
  line-height: 1.7;
}

.choice-list {
  display: grid;
  gap: 10px;
}

.choice-button {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  text-align: left;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.choice-button.correct {
  border-color: rgba(21, 114, 75, 0.28);
  background: #e8fff2;
}

.choice-button.wrong {
  border-color: rgba(185, 75, 51, 0.28);
  background: #fff1ec;
}

.choice-button:disabled {
  cursor: default;
}

.feedback-text {
  min-height: 48px;
  margin: 14px 0 0;
  line-height: 1.6;
}

.button-row,
.nav-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.editor-panels {
  display: grid;
  gap: 14px;
}

.editor-panel {
  display: grid;
  gap: 10px;
}

.editor-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.editor-label {
  font-weight: 800;
}

.editor-badge {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  background: #edf5ff;
  color: #275b88;
}

.primary-button,
.secondary-button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 800;
  cursor: pointer;
}

.primary-button {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 12px 28px rgba(233, 111, 29, 0.28);
}

.secondary-button {
  color: var(--ink);
  background: #eef6ff;
}

.primary-button:disabled,
.secondary-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.code-editor {
  width: 100%;
  min-height: 300px;
  resize: vertical;
  border-radius: 22px;
  border: 1px solid rgba(24, 49, 83, 0.14);
  background: #13233d;
  color: #eff7ff;
  padding: 18px;
  line-height: 1.7;
  font-family: "SFMono-Regular", "Consolas", monospace;
}

.editor-panel:first-child .code-editor {
  min-height: 360px;
}

.editor-footer {
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  font-size: 14px;
}

#previewFrame {
  width: 100%;
  min-height: 520px;
  border: 0;
  border-radius: 24px;
  background: #fff;
}

.personal-inputs {
  display: grid;
  gap: 12px;
  margin: 18px 0 20px;
}

.input-group {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

.input-group input {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  background: #fff;
}

.learning-points {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.learning-item {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(239, 246, 255, 0.75);
  line-height: 1.6;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1120px) {
  .page-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .teaching-grid,
  .workspace-grid,
  .bottom-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .page-shell {
    padding: 14px;
    gap: 14px;
  }

  .sidebar,
  .card,
  .hero-panel {
    padding: 18px;
    border-radius: 22px;
  }

  .hero-panel,
  .editor-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .sidebar h1 {
    font-size: 30px;
  }

  .code-editor {
    min-height: 340px;
  }

  #previewFrame {
    min-height: 420px;
  }
}
