:root {
  --paper: #fffaf0;
  --paper-strong: #fff4d6;
  --white: #ffffff;
  --ink: #352d24;
  --muted: #746a5d;
  --line: #e8dcc7;
  --sun: #f4b942;
  --sun-deep: #c9860d;
  --leaf: #56734d;
  --leaf-soft: #e3ecdc;
  --terracotta: #b8663d;
  --rose-soft: #f8e5dc;
  --sky-soft: #dfecef;
  --shadow: 0 15px 40px rgba(82, 60, 26, 0.09);
  --radius: 22px;
}

* { box-sizing: border-box; }

html { font-size: 16px; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif;
}

button, input, textarea, select { font: inherit; }
button { color: inherit; }

.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;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 20px 22px;
  display: flex;
  flex-direction: column;
  background: #3e4d37;
  color: #fffdf8;
  z-index: 20;
}

.brand { display: flex; gap: 12px; align-items: center; padding: 0 8px 30px; }
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #513a0a;
  background: var(--sun);
  box-shadow: 0 0 0 7px rgba(244, 185, 66, .12);
  font-size: 1.3rem;
}
.brand strong { display: block; font-family: Georgia, "Times New Roman", serif; font-size: 1.15rem; }
.brand span { display: block; margin-top: 3px; color: #d8e1d4; font-size: .78rem; }

.main-nav { display: grid; gap: 7px; }
.nav-item {
  width: 100%;
  padding: 11px 13px;
  border: 0;
  border-radius: 13px;
  display: flex;
  align-items: center;
  gap: 11px;
  color: #e6ecdf;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-size: .9rem;
}
.nav-item span { width: 20px; text-align: center; font-size: 1rem; }
.nav-item:hover { background: rgba(255,255,255,.08); }
.nav-item.active { color: #302b22; background: var(--sun); font-weight: 750; }
.sidebar-footer { margin-top: auto; display: grid; gap: 8px; }

.main-content { min-width: 0; padding-bottom: 40px; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 82px;
  padding: 18px clamp(22px, 4vw, 54px);
  display: flex;
  gap: 16px;
  align-items: center;
  background: rgba(255, 250, 240, .92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(232, 220, 199, .75);
}

.search-wrap { flex: 1; max-width: 610px; }
.search-wrap input,
.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--white);
  color: var(--ink);
  outline: none;
}
.search-wrap input { height: 46px; padding: 0 17px; }
.search-wrap input:focus,
.field input:focus,
.field textarea:focus,
.field select:focus { border-color: var(--sun-deep); box-shadow: 0 0 0 3px rgba(244,185,66,.2); }

.primary-button, .secondary-button, .text-button, .icon-button {
  border: 0;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.primary-button {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 13px;
  color: #34290e;
  background: var(--sun);
  font-weight: 800;
}
.primary-button:hover { background: #efae27; transform: translateY(-1px); }
.secondary-button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: var(--white);
  font-weight: 700;
}
.sidebar .secondary-button { color: #f5f6f2; border-color: rgba(255,255,255,.18); background: rgba(255,255,255,.07); }
.secondary-button:hover { border-color: #c9b991; }
.text-button { padding: 4px; color: var(--sun-deep); background: none; font-weight: 800; }
.icon-button { width: 40px; height: 40px; border-radius: 12px; background: transparent; font-size: 1.25rem; }
.icon-button:hover { background: rgba(75,63,45,.07); }
.full { width: 100%; }
.file-label { display: grid; place-items: center; cursor: pointer; font-size: .85rem; }
.file-label input { display: none; }
.mobile-menu { display: none; }

.view-root { padding: 26px clamp(22px, 4vw, 54px); max-width: 1500px; margin: 0 auto; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.eyebrow { margin: 0 0 6px; color: var(--terracotta); font-size: .76rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, h3 { margin: 0; font-family: Georgia, "Times New Roman", serif; line-height: 1.12; }
h1 { font-size: clamp(2rem, 4vw, 3.5rem); font-weight: 500; letter-spacing: -.04em; }
h2 { font-size: clamp(1.45rem, 2.5vw, 2rem); font-weight: 550; letter-spacing: -.02em; }
h3 { font-size: 1.15rem; font-weight: 600; }
.lead { max-width: 680px; margin: 8px 0 0; color: var(--muted); line-height: 1.6; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(260px, .75fr); gap: 20px; }
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,.82);
  box-shadow: var(--shadow);
}
.card-pad { padding: 24px; }
.hero-card {
  position: relative;
  min-height: 250px;
  padding: clamp(24px, 4vw, 42px);
  overflow: hidden;
  color: #fffdf7;
  background: linear-gradient(135deg, #3f5539 0%, #59744d 72%, #809271 100%);
}
.hero-card::after {
  content: "";
  position: absolute;
  width: 230px;
  height: 230px;
  right: -58px;
  bottom: -86px;
  border-radius: 50%;
  border: 38px solid rgba(244,185,66,.88);
  box-shadow: 0 0 0 28px rgba(255,255,255,.05), 0 0 0 52px rgba(244,185,66,.10);
}
.hero-card > * { position: relative; z-index: 1; }
.hero-card .eyebrow { color: #f7cf76; }
.hero-card h1 { max-width: 650px; }
.hero-card p { color: #e1e9de; max-width: 590px; margin: 12px 0 25px; line-height: 1.6; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-actions .secondary-button { color: #fff; background: transparent; border-color: rgba(255,255,255,.28); }

.growth-card { padding: 25px; display: flex; flex-direction: column; justify-content: space-between; }
.growth-row { display: flex; align-items: center; gap: 18px; margin: 20px 0; }
.growth-ring {
  --progress: 0deg;
  width: 112px;
  height: 112px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--sun) var(--progress), var(--paper-strong) 0);
  position: relative;
}
.growth-ring::before { content: ""; position: absolute; width: 78px; height: 78px; border-radius: 50%; background: #fff; }
.growth-ring strong { position: relative; font-size: 1.45rem; }
.growth-copy strong { display: block; font-size: 1.05rem; }
.growth-copy span { display: block; margin-top: 6px; color: var(--muted); line-height: 1.45; font-size: .88rem; }

.section-block { margin-top: 28px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 15px; }
.section-title p { margin: 6px 0 0; color: var(--muted); }
.areas-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.area-card { padding: 22px; cursor: pointer; transition: transform .18s ease, box-shadow .18s ease; }
.area-card:hover { transform: translateY(-3px); box-shadow: 0 18px 42px rgba(82,60,26,.14); }
.area-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.area-icon { width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; background: var(--paper-strong); font-size: 1.1rem; font-weight: 900; }
.area-card p { color: var(--muted); margin: 8px 0 17px; }
.progress-track { height: 8px; overflow: hidden; border-radius: 99px; background: #eee6d9; }
.progress-fill { height: 100%; border-radius: inherit; background: var(--sun); }
.progress-meta { display: flex; justify-content: space-between; margin-top: 8px; color: var(--muted); font-size: .78rem; }

.agenda-list, .simple-list { display: grid; gap: 10px; }
.agenda-item, .list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--white);
}
.agenda-time { min-width: 54px; color: var(--terracotta); font-weight: 850; }
.agenda-copy { min-width: 0; flex: 1; }
.agenda-copy strong { display: block; }
.agenda-copy span { color: var(--muted); font-size: .83rem; }
.check-button { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 50%; background: #fff; cursor: pointer; }
.check-button.done { color: #fff; border-color: var(--leaf); background: var(--leaf); }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat { padding: 20px; }
.stat span { display: block; color: var(--muted); font-size: .82rem; }
.stat strong { display: block; margin-top: 6px; font-family: Georgia, serif; font-size: 1.85rem; font-weight: 500; }

.filter-row { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 19px; }
.chip { padding: 8px 13px; border: 1px solid var(--line); border-radius: 99px; background: #fff; cursor: pointer; font-size: .84rem; }
.chip.active { border-color: #d39b25; background: #fff0c9; font-weight: 750; }

.lesson-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.lesson-list { padding: 12px; position: sticky; top: 102px; }
.lesson-button { width: 100%; padding: 13px; display: flex; gap: 11px; align-items: flex-start; border: 0; border-radius: 13px; background: transparent; cursor: pointer; text-align: left; }
.lesson-button:hover { background: var(--paper); }
.lesson-button.active { background: var(--paper-strong); }
.lesson-dot { width: 26px; height: 26px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; font-size: .73rem; font-weight: 800; }
.lesson-button.done .lesson-dot { color: #fff; border-color: var(--leaf); background: var(--leaf); }
.lesson-button strong { display: block; font-family: inherit; font-size: .88rem; }
.lesson-button small { color: var(--muted); }
.lesson-content { padding: clamp(22px, 4vw, 38px); }
.lesson-content h2 { margin-bottom: 8px; }
.lesson-content .lesson-intro { color: var(--muted); line-height: 1.65; }
.lesson-block { margin-top: 25px; padding-top: 22px; border-top: 1px solid var(--line); }
.lesson-block h3 { margin-bottom: 10px; }
.lesson-block p, .lesson-block li { line-height: 1.65; }
.example-box { padding: 18px; border-left: 4px solid var(--sun); border-radius: 0 14px 14px 0; background: var(--paper-strong); }
.korean { font-size: 1.25rem; font-weight: 750; }
.lesson-notes { padding: 20px; position: sticky; top: 102px; }
.lesson-notes textarea { width: 100%; min-height: 210px; margin: 14px 0 10px; padding: 13px; resize: vertical; border: 1px solid var(--line); border-radius: 13px; background: #fffdf9; outline: none; }
.confidence { display: grid; gap: 7px; margin-top: 20px; }
.confidence button { padding: 10px; border: 1px solid var(--line); border-radius: 11px; background: #fff; cursor: pointer; text-align: left; }
.confidence button.selected { border-color: var(--sun-deep); background: var(--paper-strong); font-weight: 750; }

.week-grid { display: grid; grid-template-columns: repeat(7, minmax(130px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 10px; }
.day-column { min-height: 330px; padding: 14px; border: 1px solid var(--line); border-radius: 17px; background: rgba(255,255,255,.7); }
.day-column.today { border-color: #d69e28; background: #fff7df; }
.day-head { margin-bottom: 13px; }
.day-head strong, .day-head span { display: block; }
.day-head span { color: var(--muted); font-size: .77rem; }
.event-card { margin-top: 8px; padding: 10px; border-radius: 11px; background: var(--leaf-soft); font-size: .8rem; }
.event-card strong { display: block; margin-bottom: 3px; }

.resource-grid, .note-grid, .idea-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.resource-card, .note-card, .idea-card { padding: 20px; }
.resource-kind { display: inline-flex; padding: 5px 8px; border-radius: 8px; background: var(--sky-soft); color: #355963; font-size: .72rem; font-weight: 850; text-transform: uppercase; }
.resource-card h3, .note-card h3, .idea-card h3 { margin-top: 15px; }
.resource-card p, .note-card p, .idea-card p { color: var(--muted); line-height: 1.5; }
.card-actions { display: flex; gap: 12px; align-items: center; margin-top: 16px; }
.danger-link { color: #a84636; }
.compact { min-height: 38px; padding: 0 13px; font-size: .84rem; }
.wide-idea { grid-column: span 3; }
.topic-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.topic-tag { display: inline-flex; padding: 6px 10px; border-radius: 99px; color: #3f5638; background: var(--leaf-soft); font-size: .74rem; font-weight: 800; }
.muted-tag { color: var(--muted); background: #eee8dd; }
.germination { margin-top: 19px; padding-top: 18px; border-top: 1px solid var(--line); }
.germination-title { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.germination-title span { color: var(--muted); font-size: .82rem; }
.suggestion-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.suggestion-item { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fffdf9; }
.suggestion-copy { min-width: 0; flex: 1; }
.suggestion-item span { display: block; color: var(--terracotta); font-size: .7rem; font-weight: 850; text-transform: uppercase; letter-spacing: .07em; }
.suggestion-item strong { display: block; margin-top: 3px; font-size: .9rem; }
.suggestion-item p { margin: 5px 0 0; font-size: .8rem; }
.suggestion-actions { display: flex; flex: 0 0 190px; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
.mini-action { min-height: 31px; padding: 6px 9px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fff; cursor: pointer; font-size: .72rem; font-weight: 750; text-decoration: none; }
.mini-action:hover { border-color: var(--sun-deep); background: var(--paper-strong); }
.mini-action.highlighted { border-color: var(--leaf); color: #fff; background: var(--leaf); }
.idea-actions { flex-wrap: wrap; }

.empty-state { padding: 45px 24px; text-align: center; border: 1px dashed #d7c7a9; border-radius: var(--radius); background: rgba(255,255,255,.55); }
.empty-state p { color: var(--muted); }

dialog { width: min(590px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 24px; background: transparent; box-shadow: 0 28px 80px rgba(48,39,25,.32); }
dialog::backdrop { background: rgba(35,31,25,.48); backdrop-filter: blur(3px); }
.dialog-card { padding: 25px; border-radius: 24px; background: var(--paper); }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.field { display: grid; gap: 7px; margin-top: 14px; }
.field label { font-size: .84rem; font-weight: 800; }
.field input, .field select { height: 44px; padding: 0 12px; }
.field textarea { min-height: 110px; padding: 12px; resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-hint { margin: -2px 0 3px; color: var(--muted); font-size: .8rem; }
.topic-choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.topic-choice { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 13px; background: #fff; cursor: pointer; }
.topic-choice:has(input:checked) { border-color: var(--sun-deep); background: var(--paper-strong); }
.topic-choice input { width: 17px; height: 17px; accent-color: var(--leaf); }
.area-icon.mini { width: 34px; height: 34px; border-radius: 11px; font-size: .77rem; }
.topic-choice strong, .topic-choice small { display: block; }
.topic-choice small { margin-top: 2px; color: var(--muted); font-size: .7rem; }
.mode-picker { display: grid; gap: 8px; margin: 18px 0 0; padding: 0; border: 0; }
.mode-picker legend { margin-bottom: 8px; font-size: .84rem; font-weight: 800; }
.mode-picker label { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: #fff; cursor: pointer; }
.mode-picker label:has(input:checked) { border-color: var(--sun-deep); background: var(--paper-strong); }
.mode-picker input { margin-top: 3px; accent-color: var(--leaf); }
.mode-picker strong, .mode-picker small { display: block; }
.mode-picker small { margin-top: 3px; color: var(--muted); font-size: .76rem; }

.toast { position: fixed; right: 25px; bottom: 25px; z-index: 100; padding: 13px 17px; border-radius: 13px; color: #fff; background: #3e4d37; box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.mobile-nav { display: none; }

@media (max-width: 1120px) {
  .areas-grid, .resource-grid, .note-grid, .idea-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wide-idea { grid-column: span 2; }
  .lesson-layout { grid-template-columns: 220px minmax(0, 1fr); }
  .lesson-notes { grid-column: 2; position: static; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 820px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; transform: translateX(-105%); width: min(300px, 88vw); transition: transform .22s ease; box-shadow: 20px 0 50px rgba(31,35,26,.3); }
  .sidebar.open { transform: translateX(0); }
  .mobile-menu { display: grid; place-items: center; }
  .topbar { padding: 13px 16px; min-height: 68px; }
  .topbar .primary-button { width: 44px; padding: 0; overflow: hidden; font-size: 0; }
  .topbar .primary-button::after { content: "+"; font-size: 1.25rem; }
  .view-root { padding: 22px 16px 96px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .growth-card { min-height: 220px; }
  .lesson-layout { grid-template-columns: 1fr; }
  .lesson-list, .lesson-notes { position: static; grid-column: auto; }
  .lesson-list { display: flex; overflow-x: auto; }
  .lesson-button { min-width: 200px; }
  .mobile-nav { position: fixed; display: grid; grid-template-columns: repeat(5, 1fr); left: 10px; right: 10px; bottom: 10px; z-index: 30; padding: 7px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.94); backdrop-filter: blur(16px); box-shadow: 0 14px 40px rgba(59,45,24,.18); }
  .mobile-nav button { padding: 6px 2px; border: 0; background: transparent; color: var(--muted); font-size: .68rem; cursor: pointer; }
  .mobile-nav button span { display: block; margin-bottom: 2px; font-size: 1.05rem; }
  .mobile-nav button.active { color: var(--leaf); font-weight: 850; }
}

@media (max-width: 590px) {
  .areas-grid, .resource-grid, .note-grid, .idea-grid, .stat-grid { grid-template-columns: 1fr; }
  .wide-idea { grid-column: auto; }
  .suggestion-list, .topic-choice-grid { grid-template-columns: 1fr; }
  .suggestion-item { align-items: flex-start; flex-direction: column; }
  .suggestion-actions { width: 100%; flex: none; justify-content: flex-start; }
  .germination-title { align-items: flex-start; flex-direction: column; }
  .hero-card::after { width: 160px; height: 160px; border-width: 26px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .field-row { grid-template-columns: 1fr; }
  .growth-row { align-items: flex-start; }
  .growth-ring { width: 92px; height: 92px; }
  .growth-ring::before { width: 64px; height: 64px; }
  .dialog-actions { display: grid; grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
