:root {
  color-scheme: light;
  --bg: #f5f7f4;
  --surface: #ffffff;
  --surface-2: #edf3ee;
  --ink: #162019;
  --muted: #5b6b62;
  --line: #d9e3dc;
  --accent: #0f7b63;
  --accent-2: #be4b2f;
  --accent-3: #225a8f;
  --accent-soft: #dff1eb;
  --warn-soft: #f7e6d8;
  --shadow: 0 14px 38px rgba(22, 32, 25, 0.1);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", Arial, sans-serif;
  line-height: 1.6;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 24px 18px;
  background: #10201a;
  color: #f5fbf7;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  background: #e8c46d;
  color: #10201a;
  font-weight: 900;
}

.brand h1,
.topbar h2,
.playground h3,
.section-heading h3 {
  margin: 0;
  letter-spacing: 0;
}

.brand h1 {
  font-size: 23px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 800;
}

.sidebar .eyebrow {
  color: #e8c46d;
}

.profile {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}

.profile > div {
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.07);
}

.profile-label {
  display: block;
  color: #b9ccc2;
  font-size: 12px;
}

.profile strong {
  display: block;
  margin-top: 2px;
  font-size: 22px;
}

.progress-wrap {
  margin-bottom: 22px;
}

.progress-top {
  display: flex;
  justify-content: space-between;
  color: #cfe0d6;
  font-size: 13px;
}

.progress-track {
  height: 10px;
  margin-top: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.progress-bar {
  width: 0;
  height: 100%;
  background: #e8c46d;
  transition: width 200ms ease;
}

.lesson-nav {
  display: grid;
  gap: 14px;
}

.part-group {
  display: grid;
  gap: 8px;
}

.part-heading {
  padding: 10px 2px 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.part-heading:first-child {
  border-top: 0;
}

.part-heading strong {
  display: block;
  color: #e8c46d;
  font-size: 14px;
}

.part-heading span {
  display: block;
  color: #b9ccc2;
  font-size: 12px;
}

.part-mini-progress {
  height: 5px;
  margin-top: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.part-mini-progress b {
  display: block;
  width: 0;
  height: 100%;
  background: #e8c46d;
}

.lesson-button {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  background: transparent;
  color: #f5fbf7;
  text-align: left;
}

.lesson-button.active {
  border-color: #e8c46d;
  background: rgba(232, 196, 109, 0.14);
}

.lesson-number {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.11);
  color: #e8c46d;
  font-weight: 800;
}

.lesson-name {
  display: block;
  color: #f7fbf8;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.3;
}

.lesson-module {
  display: block;
  color: #b9ccc2;
  font-size: 12px;
}

.lesson-check {
  color: #e8c46d;
  font-weight: 900;
}

.main {
  padding: 24px;
}

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

.topbar h2 {
  font-size: 30px;
  line-height: 1.25;
}

.topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.primary-button,
.secondary-button,
.icon-button {
  min-height: 42px;
  border: 0;
  border-radius: var(--radius);
  font-weight: 800;
}

.primary-button {
  padding: 0 18px;
  background: var(--accent);
  color: white;
}

.secondary-button {
  padding: 0 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 20px;
}

.hero-band {
  position: relative;
  min-height: 250px;
  margin-bottom: 18px;
  border-radius: var(--radius);
  overflow: hidden;
  background: #173227;
  box-shadow: var(--shadow);
}

.part-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.part-card {
  min-height: 134px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(22, 32, 25, 0.06);
}

.part-card.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.part-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 17px;
}

.part-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.part-card .part-count {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  margin-top: 12px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(15, 123, 99, 0.12);
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

#questCanvas {
  display: block;
  width: 100%;
  height: 280px;
}

.hero-copy {
  position: absolute;
  left: 24px;
  bottom: 20px;
  max-width: 680px;
  color: #f7fbf8;
}

.hero-copy p {
  max-width: 640px;
  margin: 10px 0 0;
  color: #e3eee8;
  font-size: 17px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
  font-size: 13px;
  font-weight: 800;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.8fr);
  gap: 18px;
}

.lesson-panel,
.mission-panel,
.playground,
.code-lab,
.roadmap,
.implementation-guide {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(22, 32, 25, 0.06);
}

.lesson-panel,
.mission-panel,
.playground,
.code-lab,
.roadmap,
.implementation-guide {
  padding: 20px;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
}

.section-heading:not(:first-child) {
  margin-top: 22px;
}

.section-heading h3 {
  font-size: 18px;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent-2);
}

.story-text,
.mission-text,
.code-intro {
  margin: 0;
  color: var(--muted);
}

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

.concept-card {
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface-2);
}

.concept-card strong {
  display: block;
  margin-bottom: 4px;
}

.concept-card p {
  margin: 0;
  color: var(--muted);
}

.term-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.term-list div {
  padding: 12px;
  border-left: 4px solid var(--accent);
  background: #f8faf8;
}

.term-list dt {
  font-weight: 900;
}

.term-list dd {
  margin: 4px 0 0;
  color: var(--muted);
}

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

.deep-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8faf8;
}

.deep-card strong {
  display: block;
  margin-bottom: 4px;
}

.deep-card p {
  margin: 0;
  color: var(--muted);
}

.deep-card.code-minded {
  border-left: 4px solid var(--accent-3);
}

.deep-card.warning-minded {
  border-left: 4px solid var(--accent-2);
}

.mission-steps {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}

.mission-step {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px;
  border-radius: var(--radius);
  background: #f8faf8;
}

.mission-step input {
  margin-top: 5px;
}

.result-text {
  min-height: 28px;
  margin: 12px 0 0;
  color: var(--accent-3);
  font-weight: 800;
}

.playground,
.code-lab,
.roadmap,
.implementation-guide {
  margin-top: 18px;
}

.playground-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.game-area {
  display: grid;
  gap: 14px;
}

.game-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.game-card {
  min-width: 96px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8faf8;
  color: var(--ink);
  font-weight: 900;
  text-align: center;
}

.game-card.selected {
  border-color: var(--accent-2);
  background: var(--warn-soft);
}

.game-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sequence-slot {
  min-height: 54px;
  padding: 10px;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: #f8faf8;
}

.sequence-slot strong {
  display: block;
}

.simulator {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.sim-box {
  min-height: 120px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface-2);
}

.sim-box strong {
  display: block;
  margin-bottom: 8px;
}

.meter {
  height: 14px;
  border-radius: 999px;
  background: #d7e1db;
  overflow: hidden;
}

.meter span {
  display: block;
  width: 20%;
  height: 100%;
  background: var(--accent);
  transition: width 200ms ease;
}

.code-lab pre {
  overflow-x: auto;
  margin: 14px 0;
  padding: 16px;
  border-radius: var(--radius);
  background: #10201a;
  color: #e8f2ed;
  line-height: 1.5;
}

.quiz-row {
  display: grid;
  grid-template-columns: 1fr minmax(180px, 280px) auto;
  gap: 10px;
  align-items: center;
}

.quiz-row label {
  font-weight: 800;
}

.quiz-row input {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
}

.architecture {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.arch-node {
  min-height: 92px;
  display: grid;
  place-items: center;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  text-align: center;
  font-weight: 900;
}

.arch-node small {
  color: var(--muted);
  font-weight: 700;
}

.arch-arrow {
  color: var(--accent-2);
  font-weight: 900;
}

.project-notes {
  display: grid;
  gap: 10px;
}

.project-note {
  padding: 12px;
  border-radius: var(--radius);
  background: #f8faf8;
}

.project-note strong {
  display: block;
}

.guide-lead {
  margin: 0 0 14px;
  color: var(--muted);
}

.guide-grid {
  display: grid;
  gap: 14px;
}

.guide-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8faf8;
  overflow: hidden;
}

.guide-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

.guide-card-header strong {
  font-size: 16px;
}

.guide-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(34, 90, 143, 0.12);
  color: var(--accent-3);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.guide-card-body {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.guide-item {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 12px;
  padding: 10px;
  border-radius: var(--radius);
  background: var(--surface);
}

.guide-item dt {
  font-weight: 900;
  color: var(--accent);
}

.guide-item dd {
  margin: 0;
  color: var(--muted);
}

.guide-card pre {
  overflow-x: auto;
  margin: 0;
  padding: 14px;
  border-radius: var(--radius);
  background: #10201a;
  color: #e8f2ed;
}

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

  .sidebar {
    position: relative;
    height: auto;
  }

  .lesson-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .part-group {
    display: block;
  }

  .part-heading {
    grid-column: 1 / -1;
  }

  .content-grid,
  .part-overview,
  .simulator {
    grid-template-columns: 1fr;
  }

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

  .arch-arrow {
    text-align: center;
  }
}

@media (max-width: 680px) {
  .main {
    padding: 16px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar h2 {
    font-size: 24px;
  }

  .lesson-nav {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    left: 16px;
    right: 16px;
  }

  .hero-copy p {
    font-size: 15px;
  }

  .quiz-row {
    grid-template-columns: 1fr;
  }

  .guide-item {
    grid-template-columns: 1fr;
  }
}
