/* style.css */
:root {
  color-scheme: dark;
  --bg: #10131d;
  --surface: #181c29;
  --surface-2: #202637;
  --surface-3: #292f43;
  --paper: #f7f2e9;
  --paper-line: #d9d0c1;
  --text: #f7f5f0;
  --muted: #aeb4c6;
  --dim: #71798e;
  --ink: #263047;
  --line: rgba(255,255,255,.1);
  --lesson-accent: #78c98f;
  --shadow: 0 18px 45px rgba(0,0,0,.24);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #edf0f4;
    --surface: #ffffff;
    --surface-2: #f6f7f9;
    --surface-3: #eaedf2;
    --text: #182032;
    --muted: #5e697c;
    --dim: #8b94a4;
    --line: rgba(25,32,50,.1);
    --shadow: 0 18px 45px rgba(35,45,70,.1);
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #edf0f4;
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --surface-3: #eaedf2;
  --text: #182032;
  --muted: #5e697c;
  --dim: #8b94a4;
  --line: rgba(25,32,50,.1);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #10131d;
  --surface: #181c29;
  --surface-2: #202637;
  --surface-3: #292f43;
  --text: #f7f5f0;
  --muted: #aeb4c6;
  --dim: #71798e;
  --line: rgba(255,255,255,.1);
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 90% 2%, color-mix(in srgb, var(--lesson-accent) 12%, transparent), transparent 26rem),
    var(--bg);
  color: var(--text);
}
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .4; }

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 28px 18px 20px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border-right: 1px solid var(--line);
}

.brand, .mobile-header {
  display: flex;
  align-items: center;
  gap: 11px;
}
.brand h1 {
  margin: 1px 0 0;
  font-size: 20px;
  letter-spacing: -.6px;
}
.brand-mark {
  display: grid;
  width: 39px;
  height: 39px;
  place-items: center;
  flex: 0 0 auto;
  color: #182032;
  background: var(--lesson-accent);
  border-radius: 12px;
  font-size: 20px;
  box-shadow: 0 5px 16px color-mix(in srgb, var(--lesson-accent) 28%, transparent);
}
.eyebrow, .small-label {
  margin: 0;
  color: var(--dim);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.25px;
}
.progress-panel {
  margin: 32px 4px 23px;
  padding: 16px;
  background: var(--surface-2);
  border-radius: 14px;
}
.progress-copy { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; font-size: 12px; color: var(--muted); }
.progress-copy strong { color: var(--text); font-size: 12px; white-space: nowrap; }
.progress-track { height: 6px; margin-top: 12px; overflow: hidden; border-radius: 10px; background: var(--surface-3); }
.progress-fill { width: 0; height: 100%; border-radius: inherit; background: var(--lesson-accent); transition: width .35s ease; }

.lesson-nav { display: grid; gap: 5px; }
.lesson-item {
  width: 100%;
  min-height: 65px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px;
  color: var(--muted);
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 14px;
}
.lesson-item:hover { background: var(--surface-2); color: var(--text); }
.lesson-item.active {
  color: var(--text);
  background: var(--surface-2);
  border-color: color-mix(in srgb, var(--lesson-accent) 35%, var(--line));
}
.lesson-icon {
  display: grid;
  width: 35px;
  height: 35px;
  place-items: center;
  flex: 0 0 auto;
  color: color-mix(in srgb, var(--lesson-color) 88%, white);
  background: color-mix(in srgb, var(--lesson-color) 15%, transparent);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 800;
}
.lesson-nav-copy { display: grid; gap: 3px; min-width: 0; flex: 1; }
.lesson-nav-copy strong { font-size: 14px; text-transform: capitalize; }
.lesson-nav-copy small { color: var(--dim); font-size: 11px; }
.completion-dot {
  display: grid;
  width: 19px;
  height: 19px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: #17202d;
  font-size: 11px;
}
.completion-dot.done { background: var(--lesson-accent); border-color: var(--lesson-accent); }
.sidebar-footer { margin-top: auto; display: grid; gap: 4px; }
.text-button {
  min-height: 38px;
  padding: 8px 10px;
  color: var(--dim);
  text-align: left;
  background: none;
  border: 0;
  border-radius: 8px;
  font-size: 12px;
}
.text-button:hover { color: var(--text); background: var(--surface-2); }

.content { min-width: 0; padding: 46px clamp(20px, 5vw, 76px) 64px; }
.mobile-header { display: none; }
.hero { max-width: 1120px; margin: 0 auto 30px; }
.title-row { display: flex; justify-content: space-between; align-items: end; gap: 18px; }
.hero h2, .section-heading h2 { margin: 7px 0 8px; font-size: clamp(30px, 4vw, 48px); line-height: .98; letter-spacing: -2px; }
.hero p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: 15px; }
.lesson-meta { display: flex; gap: 8px; padding-bottom: 2px; white-space: nowrap; }
.lesson-meta span, .warmup-tag {
  padding: 7px 10px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}
.tip-card {
  display: flex;
  gap: 10px;
  max-width: 610px;
  margin-top: 24px;
  padding: 12px 14px;
  color: var(--muted);
  background: color-mix(in srgb, var(--lesson-accent) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--lesson-accent) 22%, var(--line));
  border-radius: 12px;
  font-size: 13px;
}
.tip-card p { margin: 0; }
.tip-card strong { color: var(--text); }
.tip-icon { color: var(--lesson-accent); font-size: 18px; }

.workspace {
  max-width: 1120px;
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(270px, .8fr);
  margin: 0 auto;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.drawing-panel { padding: 18px; border-right: 1px solid var(--line); }
.panel-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.step-control { display: flex; align-items: center; gap: 9px; }
.step-control strong { font-size: 13px; }
.tool-buttons { display: flex; gap: 6px; }
.tool-button, .mini-button {
  min-height: 35px;
  padding: 7px 10px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
}
.tool-button.active { color: var(--text); background: color-mix(in srgb, var(--lesson-accent) 17%, var(--surface-2)); border-color: color-mix(in srgb, var(--lesson-accent) 55%, var(--line)); }
.artboard-wrap { padding: 8px; background: var(--surface-2); border-radius: 15px; }
.artboard { position: relative; overflow: hidden; aspect-ratio: 4 / 3; border-radius: 10px; }
#drawingSvg { display: block; width: 100%; height: 100%; }
.paper-bg { fill: var(--paper); }
.svg-grid path { stroke: var(--paper-line); stroke-width: .5; opacity: .55; }
.guide-line { fill: none; stroke: #a8a294; stroke-width: 2; stroke-dasharray: 6 6; stroke-linecap: round; stroke-linejoin: round; }
.draw-line { fill: none; stroke: var(--ink); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.final-line { stroke-width: 4.4; }
.detail-line { fill: none; stroke: #506079; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.shade-line { fill: none; stroke: #8290a2; stroke-width: 2.1; stroke-linecap: round; opacity: .8; }
.heavy-line { fill: none; stroke: var(--ink); stroke-width: 6; stroke-linecap: round; }
.final-fill { fill: var(--ink); }
.corner-markers path { fill: none; stroke: var(--paper-line); stroke-width: 1.5; }
.hide-guides .guide-line { opacity: 0; }
.stage-label {
  position: absolute;
  right: 14px;
  bottom: 13px;
  padding: 6px 8px;
  color: #697487;
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(40,50,70,.1);
  border-radius: 6px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1px;
}
.step-navigation { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 16px; }
.primary-button, .secondary-button, .complete-button {
  min-height: 44px;
  padding: 10px 15px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 800;
}
.primary-button { color: #17202d; background: var(--lesson-accent); border: 1px solid var(--lesson-accent); }
.primary-button:hover, .complete-button:hover { filter: brightness(1.07); transform: translateY(-1px); }
.secondary-button { color: var(--text); background: var(--surface-2); border: 1px solid var(--line); }
.step-dots { display: flex; gap: 7px; }
.step-dot { width: 9px; height: 9px; padding: 0; background: var(--surface-3); border: 0; border-radius: 50%; }
.step-dot.active { width: 25px; border-radius: 8px; background: var(--lesson-accent); }
.step-dot.checked:not(.active) { background: color-mix(in srgb, var(--lesson-accent) 70%, var(--surface-3)); }

.instruction-panel { display: flex; flex-direction: column; padding: 28px 25px 22px; }
.instruction-heading { display: flex; align-items: center; gap: 12px; }
.step-badge { display: grid; width: 38px; height: 38px; place-items: center; color: #17202d; background: var(--lesson-accent); border-radius: 10px; font-size: 12px; font-weight: 900; }
.instruction-heading h3 { margin: 3px 0 0; font-size: 19px; letter-spacing: -.5px; }
.instruction-text { margin: 22px 0; color: var(--muted); font-size: 14px; line-height: 1.65; }
.tip-box { display: flex; gap: 10px; padding: 13px; color: var(--muted); background: var(--surface-2); border-radius: 11px; font-size: 12px; line-height: 1.5; }
.tip-box span { color: var(--lesson-accent); font-weight: 900; }
.tip-box p { margin: 0; }
.action-area { display: grid; gap: 12px; margin-top: auto; padding-top: 24px; }
.check-row { position: relative; display: flex; align-items: center; gap: 10px; min-height: 44px; color: var(--muted); cursor: pointer; font-size: 13px; }
.check-row input { position: absolute; opacity: 0; }
.custom-check { width: 21px; height: 21px; border: 2px solid var(--dim); border-radius: 6px; }
.check-row input:checked + .custom-check { background: var(--lesson-accent); border-color: var(--lesson-accent); }
.check-row input:checked + .custom-check::after { content: "✓"; display: grid; height: 100%; place-items: center; color: #182032; font-size: 14px; font-weight: 900; }
.complete-button { color: #17202d; background: var(--lesson-accent); border: 1px solid var(--lesson-accent); }

.practice-zone, .principles { max-width: 1120px; margin: 64px auto 0; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.section-heading h2 { margin-bottom: 0; font-size: clamp(24px, 3vw, 34px); }
.warmup-grid { display: grid; grid-template-columns: 1fr 1.05fr .9fr; gap: 14px; }
.warmup-card { min-height: 190px; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 17px; }
.card-number, .principle-grid article > span { color: var(--lesson-accent); font-size: 11px; font-weight: 900; letter-spacing: 1px; }
.warmup-card h3 { margin: 14px 0 9px; font-size: 17px; letter-spacing: -.4px; }
.warmup-card p, .warmup-card li { color: var(--muted); font-size: 13px; line-height: 1.55; }
.warmup-card p { margin: 0; }
.timer-card { background: color-mix(in srgb, var(--lesson-accent) 8%, var(--surface)); }
.timer-display { margin: 10px 0 13px; color: var(--text); font-size: 35px; font-weight: 850; letter-spacing: -1.7px; font-variant-numeric: tabular-nums; }
.timer-display.finished { color: var(--lesson-accent); }
.timer-actions { display: flex; gap: 8px; }
.timer-actions .primary-button { min-height: 40px; }
.material-card ul { margin: 12px 0 0; padding-left: 18px; }
.material-card li { margin-bottom: 7px; }
.principles { padding-top: 6px; }
.principle-grid { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.principle-grid article { padding: 24px 24px 8px 0; }
.principle-grid article + article { padding-left: 24px; border-left: 1px solid var(--line); }
.principle-grid h3 { margin: 12px 0 7px; font-size: 17px; }
.principle-grid p { max-width: 230px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }

.mobile-overlay { display: none; }

@media (max-width: 820px) {
  .app-shell { display: block; }
  .sidebar {
    position: fixed;
    z-index: 20;
    top: 0;
    left: 0;
    width: min(285px, 85vw);
    height: 100dvh;
    transform: translateX(-105%);
    transition: transform .25s ease;
    box-shadow: var(--shadow);
  }
  body.menu-open .sidebar { transform: translateX(0); }
  body.menu-open .mobile-overlay {
    display: block;
    position: fixed;
    z-index: 10;
    inset: 0;
    background: rgba(0,0,0,.52);
  }
  .mobile-header {
    display: flex;
    justify-content: flex-start;
    min-height: 52px;
    margin: -5px 0 32px;
  }
  .mobile-header .brand-mark { width: 34px; height: 34px; border-radius: 10px; }
  .icon-button {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    margin-left: auto;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 20px;
  }
  .content { padding: 23px 20px 48px; }
  .workspace { grid-template-columns: 1fr; }
  .drawing-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .instruction-panel { min-height: 310px; }
  .warmup-grid { grid-template-columns: 1fr 1fr; }
  .material-card { grid-column: span 2; min-height: auto; }
}

@media (max-width: 540px) {
  .content { padding-inline: 13px; }
  .mobile-header { margin-bottom: 25px; }
  .hero { margin-bottom: 20px; }
  .title-row { display: block; }
  .hero h2 { font-size: 34px; }
  .lesson-meta { margin-top: 13px; }
  .tip-card { margin-top: 17px; }
  .workspace { border-radius: 16px; }
  .drawing-panel { padding: 12px; }
  .panel-toolbar { align-items: flex-start; }
  .tool-buttons { justify-content: flex-end; flex-wrap: wrap; }
  .tool-button { min-height: 32px; padding: 6px 8px; }
  .step-navigation { gap: 7px; }
  .primary-button, .secondary-button { padding: 9px 11px; font-size: 12px; }
  .step-dots { gap: 5px; }
  .instruction-panel { padding: 22px 18px; min-height: 300px; }
  .instruction-text { margin: 17px 0; }
  .warmup-grid { grid-template-columns: 1fr; }
  .material-card { grid-column: auto; }
  .practice-zone, .principles { margin-top: 45px; }
  .section-heading { display: block; }
  .warmup-tag { display: inline-block; margin-top: 12px; }
  .principle-grid { grid-template-columns: 1fr; }
  .principle-grid article, .principle-grid article + article { padding: 20px 0; border-left: 0; border-bottom: 1px solid var(--line); }
}
