/* 애니띵 모닝
   Layout: 링 단어장 한 장 — 날짜 머리 아래 오늘의 카드 한 장, 아래 가장자리에 탭 네 개.
   핵심 구절은 형광펜으로 긋는다. 강조는 이 한 곳에만 쓴다. */
:root {
  --paper: #f5f7fb;      /* 바탕: 차가운 아침 종이 */
  --sheet: #ffffff;      /* 카드 면 */
  --ink: #1a2140;        /* 본문: 남색 잉크 */
  --ink-2: #4b5475;
  --ink-3: #737c9b;
  --rule: #dde3ee;       /* 가는 선 */
  --ring: #b6bed2;       /* 단어장 고리 */
  --dawn: #2c3c8c;       /* 강조: 새벽 남색 */
  --dawn-soft: #e8ecf8;
  --on-dawn: #ffffff;
  --mark: #ffe25a;       /* 형광펜 */
  --trace: #c8cfe0;      /* 손글씨 노트의 따라 쓰기 글자 */
  --blank: #eef1f8;
  --avoid: #a14343;
  --good: #23704f;
  --star: #c58f00;
  --scrim: rgba(12, 16, 36, .45);
  --shadow: 0 1px 2px rgba(26, 33, 64, .06), 0 10px 28px rgba(26, 33, 64, .08);

  --font-display: 'Hahmlet', 'Noto Serif KR', 'AppleMyungjo', 'Batang', serif;
  --font-body: 'IBM Plex Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', system-ui, sans-serif;
  --font-ja: 'Noto Serif JP', 'Hiragino Mincho ProN', 'Yu Mincho', serif;
  --font-ja-sans: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Noto Sans JP', sans-serif;
  --r: 16px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f1328; --sheet: #181d38; --ink: #e8ebf7; --ink-2: #b3b9d4; --ink-3: #8a92b2;
    --rule: #2a3156; --ring: #4b5379; --dawn: #a9b6ff; --dawn-soft: #222a50; --on-dawn: #0f1328;
    --mark: rgba(255, 214, 70, .36); --blank: #232a4c; --avoid: #eb9c9c; --good: #78d3a6; --star: #f2c94c; --trace: #3a4370;
    --scrim: rgba(0, 0, 0, .6); --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 30px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0f1328; --sheet: #181d38; --ink: #e8ebf7; --ink-2: #b3b9d4; --ink-3: #8a92b2;
  --rule: #2a3156; --ring: #4b5379; --dawn: #a9b6ff; --dawn-soft: #222a50; --on-dawn: #0f1328;
  --mark: rgba(255, 214, 70, .36); --blank: #232a4c; --avoid: #eb9c9c; --good: #78d3a6; --star: #f2c94c; --trace: #3a4370;
  --scrim: rgba(0, 0, 0, .6); --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 30px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

/* ---------- 바탕 ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-tap-highlight-color: transparent;
}
body.locked { overflow: hidden; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--dawn); outline-offset: 2px; border-radius: 8px; }
h1, h2, h3, p { margin: 0; }

.ic { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- 화면 틀 ---------- */
.view {
  max-width: 560px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 20px calc(104px + env(safe-area-inset-bottom, 0px));
  display: grid;
  gap: 24px;
}
.top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.top > div { min-width: 0; }
.date { font-size: .875rem; color: var(--ink-3); letter-spacing: .02em; }
.greet { margin-top: 2px; font-family: var(--font-display); font-weight: 600; font-size: 1.75rem; line-height: 1.3; text-wrap: balance; }
.icon-btn {
  width: 44px; height: 44px; flex: none;
  display: inline-grid; place-items: center;
  border: 0; border-radius: 12px; background: transparent; color: var(--ink-2);
}
.icon-btn:hover { background: var(--dawn-soft); }
.sec-title { margin-bottom: 10px; font-size: 1rem; font-weight: 600; }
.muted, .hint { color: var(--ink-3); font-size: .9rem; }
.hint b { color: var(--ink-2); }

/* ---------- 이번 주 ---------- */
.week { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.week ol { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; }
.day { display: grid; justify-items: center; gap: 4px; font-size: .75rem; color: var(--ink-3); }
.day .dot {
  width: 28px; height: 28px; border-radius: 50%;
  border: 1.5px solid var(--rule);
  display: grid; place-items: center; color: var(--on-dawn);
}
.day .dot .ic { width: 16px; height: 16px; stroke-width: 2.4; }
.day.done .dot { background: var(--dawn); border-color: var(--dawn); }
.day.now { color: var(--ink); font-weight: 600; }
.day.now .dot { border-color: var(--dawn); border-width: 2px; }
.streak { font-size: .875rem; color: var(--ink-2); white-space: nowrap; }
.streak strong { margin-right: 2px; font-family: var(--font-display); font-size: 1.5rem; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- 링 단어장 카드 ---------- */
.deck {
  position: relative;
  background: var(--sheet);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 26px 22px 22px;
  display: grid;
  gap: 14px;
  min-width: 0;
}
.hole {
  position: absolute; top: 15px; left: 18px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--paper);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .28);
}
.hole::before {
  content: '';
  position: absolute; left: 2px; bottom: 7px;
  width: 10px; height: 24px;
  border: 2px solid var(--ring); border-bottom: 0;
  border-radius: 6px 6px 0 0;
}
.deck > .eyebrow:first-of-type { padding-left: 26px; }
.eyebrow { display: flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 600; letter-spacing: .04em; color: var(--dawn); }
.eyebrow .ic { width: 16px; height: 16px; stroke-width: 2.4; }
.deck-title { font-family: var(--font-display); font-size: 1.3rem; font-weight: 600; line-height: 1.4; text-wrap: balance; }

/* ---------- 문장과 형광펜 ---------- */
.quote { margin: 0; font-family: var(--font-display); font-size: 1.5rem; font-weight: 500; line-height: 1.6; text-wrap: pretty; }
.quote.small { font-size: 1.15rem; color: var(--ink-2); }
mark {
  color: inherit;
  background-color: transparent;
  background-image: linear-gradient(100deg, transparent .2em, var(--mark) .2em, var(--mark) calc(100% - .15em), transparent calc(100% - .15em));
  background-repeat: no-repeat;
  background-size: 100% .52em;
  background-position: 0 88%;
  padding: 0 .1em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
mark.reveal { animation: swipe .6s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes swipe { from { background-size: 0% .52em; } to { background-size: 100% .52em; } }
.blank {
  display: inline-block;
  width: calc(var(--len, 4) * .9em);
  min-width: 2.6em;
  max-width: 100%;
  height: 1.05em;
  vertical-align: -.16em;
  background: var(--blank);
  border-bottom: 2px solid var(--dawn);
  border-radius: 4px 4px 0 0;
}
.situation { color: var(--ink-2); font-size: .95rem; }
.label { display: block; margin-bottom: 4px; font-size: .78rem; font-weight: 600; letter-spacing: .03em; color: var(--ink-3); }
.avoid .label { color: var(--avoid); }
.avoid p { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--avoid); text-decoration-thickness: 1.5px; }
.better .label { color: var(--good); }
.why { border-top: 1px solid var(--rule); padding-top: 14px; }
.word { display: grid; gap: 4px; padding: 14px 16px; border-radius: 12px; background: var(--dawn-soft); }
.word .label { margin-bottom: 0; }
.word .term { font-family: var(--font-display); font-size: 1.3rem; font-weight: 600; }
.word .ex { color: var(--ink-2); font-size: .9rem; }
.intent-line { font-size: .9rem; color: var(--ink-2); }

/* ---------- 버튼 ---------- */
.btn {
  min-height: 48px; padding: 0 18px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1.5px solid var(--rule); border-radius: 12px;
  background: var(--sheet); color: var(--ink);
  font-weight: 600; text-align: center;
}
.btn .ic { width: 18px; height: 18px; }
.btn:hover { border-color: var(--dawn); }
.btn.primary { background: var(--dawn); border-color: var(--dawn); color: var(--on-dawn); }
.btn.wide { width: 100%; }
.btn.danger { color: var(--avoid); border-color: var(--avoid); background: transparent; }
.btn.danger.solid { background: var(--avoid); color: var(--sheet); }
.link {
  justify-self: start; padding: 6px 0; border: 0; background: none;
  color: var(--dawn); font-weight: 600;
  text-decoration: underline; text-underline-offset: 3px;
}
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.duo { display: grid; grid-template-columns: 1fr 1.4fr; gap: 8px; }

/* ---------- 오늘 ---------- */
.todo { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.todo li { display: flex; align-items: center; gap: 10px; color: var(--ink-2); }
.todo .box {
  width: 20px; height: 20px; flex: none; border-radius: 6px;
  border: 1.5px solid var(--rule);
  display: grid; place-items: center; color: var(--on-dawn);
}
.todo .box .ic { width: 14px; height: 14px; stroke-width: 2.6; }
.todo li.ok { color: var(--ink-3); text-decoration: line-through; }
.todo li.ok .box { background: var(--dawn); border-color: var(--dawn); }
.stats { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: .875rem; color: var(--ink-2); }
.stats b { margin-left: 6px; font-family: var(--font-display); font-size: 1.15rem; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- 칩·세그먼트 ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-height: 40px; padding: 0 14px;
  border: 1.5px solid var(--rule); border-radius: 999px;
  background: var(--sheet); color: var(--ink-2); font-size: .92rem;
}
.chip:hover { border-color: var(--dawn); }
.chip[aria-pressed="true"] { background: var(--dawn); border-color: var(--dawn); color: var(--on-dawn); font-weight: 600; }
.chips.big .chip { min-height: 48px; padding: 0 18px; font-size: 1rem; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 12px; background: var(--dawn-soft); justify-self: start; }
.seg button { min-height: 38px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; color: var(--ink-2); font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--sheet); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- 문장집 ---------- */
.lib-tools { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.lib-tools select { min-width: 0; width: 100%; }
.search {
  grid-column: 1 / -1; min-width: 0; min-height: 48px; padding: 0 12px;
  display: flex; align-items: center; gap: 8px;
  border: 1.5px solid var(--rule); border-radius: 12px;
  background: var(--sheet); color: var(--ink-3);
}
.search:focus-within { border-color: var(--dawn); }
.search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; color: var(--ink); }
select {
  min-height: 48px; padding: 0 10px;
  border: 1.5px solid var(--rule); border-radius: 12px;
  background: var(--sheet); color: var(--ink);
}
.count { font-size: .8rem; color: var(--ink-3); }
.list { list-style: none; margin: 0; padding: 0; display: grid; }
.list li { display: flex; align-items: flex-start; gap: 4px; border-bottom: 1px solid var(--rule); }
.item { flex: 1; min-width: 0; padding: 14px 0; display: grid; gap: 4px; border: 0; background: none; text-align: left; }
.item-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .78rem; color: var(--ink-3); }
.item-text { font-family: var(--font-display); font-size: 1.08rem; line-height: 1.5; color: var(--ink); }
.item-sit { font-size: .85rem; color: var(--ink-3); }
.pill { padding: 1px 8px; border: 1px solid var(--rule); border-radius: 999px; font-size: .72rem; font-weight: 600; color: var(--ink-3); }
.pill.learning { border-color: var(--dawn); color: var(--dawn); }
.pill.mastered, .pill.used { border-color: var(--good); background: var(--good); color: var(--sheet); }
.pill.mine { border-color: var(--ink-3); color: var(--ink-2); }
.pill.today { border-color: var(--dawn); background: var(--dawn); color: var(--on-dawn); }
.star { flex: none; width: 44px; height: 44px; margin-top: 6px; border: 0; background: none; color: var(--ink-3); display: grid; place-items: center; }
.star.on { color: var(--star); }
.star.on .ic { fill: currentColor; }

/* ---------- 단어장 ---------- */
.words { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.word-item {
  width: 100%; height: 100%; padding: 14px 16px;
  display: grid; align-content: start; gap: 4px;
  border: 1.5px solid var(--rule); border-radius: 12px;
  background: var(--sheet); text-align: left;
}
.word-item:hover { border-color: var(--dawn); }
.word-item .term { font-family: var(--font-display); font-size: 1.3rem; font-weight: 600; }
.word-item .meaning { color: var(--ink-2); font-size: .92rem; }
.word-item .ex { color: var(--ink-3); font-size: .85rem; }

/* ---------- 내 노트 ---------- */
.notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.note {
  width: 100%; padding: 14px 16px;
  display: grid; gap: 6px;
  border: 1.5px solid var(--rule); border-radius: 12px;
  background: var(--sheet); text-align: left;
}
.note-date { font-size: .78rem; color: var(--ink-3); }
.note-text { font-family: var(--font-display); font-size: 1.1rem; line-height: 1.55; }
.note-src { font-size: .85rem; color: var(--ink-3); }
.note .pill { justify-self: start; }
.empty {
  padding: 22px; display: grid; gap: 12px; justify-items: start;
  border: 1.5px dashed var(--rule); border-radius: 14px; color: var(--ink-2);
}

/* ---------- 탭 ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--sheet);
  border-top: 1px solid var(--rule);
  padding-top: 4px;
  padding-bottom: calc(4px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.tabs-inner { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); }
.tab {
  min-height: 56px; padding: 6px 0;
  display: grid; justify-items: center; align-content: center; gap: 2px;
  border: 0; background: none; color: var(--ink-3); font-size: .74rem;
}
.tab[aria-current="page"] { color: var(--dawn); font-weight: 600; }

/* ---------- 루틴(전체 화면) ---------- */
.session {
  position: fixed; inset: 0; z-index: 40;
  overflow-y: auto;
  background: var(--paper);
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.session-inner { max-width: 560px; min-height: 100%; margin: 0 auto; padding-block: 12px 0; display: flex; flex-direction: column; gap: 20px; }
.session-top { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.progress { flex: 1; height: 6px; border-radius: 3px; background: var(--rule); overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: 3px; background: var(--dawn); transition: width .3s ease; }
.step-count { font-size: .8rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.session-body { flex: 1; display: grid; align-content: start; gap: 16px; min-width: 0; }
.session-actions {
  position: sticky; bottom: 0;
  display: grid; gap: 10px;
  padding-block: 16px 20px;
  background: linear-gradient(to bottom, transparent, var(--paper) 28%);
}
.step-title { font-family: var(--font-display); font-size: 1.4rem; font-weight: 600; line-height: 1.45; text-wrap: balance; }
.grades { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.grade {
  min-height: 62px; padding: 6px;
  display: grid; place-content: center; gap: 2px;
  border: 1.5px solid var(--rule); border-radius: 12px;
  background: var(--sheet); color: var(--ink); font-weight: 600;
}
.grade small { font-size: .74rem; font-weight: 400; color: var(--ink-3); }
.grade.again { border-color: var(--avoid); color: var(--avoid); }
.grade.good { background: var(--dawn); border-color: var(--dawn); color: var(--on-dawn); }
.grade.good small { color: inherit; opacity: .85; }
.reads { display: inline-flex; gap: 4px; }
.reads i { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid currentColor; }
.reads i.on { background: currentColor; }
.done-wrap { display: grid; gap: 18px; }
.big-streak { font-size: 1.1rem; color: var(--ink-2); }
.big-streak strong { margin-right: 4px; font-family: var(--font-display); font-size: 3rem; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- 입력 ---------- */
textarea, input[type="text"], input[type="time"] {
  width: 100%; padding: 12px 14px;
  border: 1.5px solid var(--rule); border-radius: 12px;
  background: var(--sheet); color: var(--ink);
}
input[type="time"] { width: auto; min-height: 48px; }
textarea { min-height: 110px; resize: vertical; line-height: 1.6; }
textarea:focus, input:focus, select:focus { outline: none; border-color: var(--dawn); }
.form { display: grid; gap: 8px; }
.form .label { margin-top: 6px; }
.form-error { color: var(--avoid); font-size: .875rem; }

/* ---------- 시작 안내 ---------- */
.onb-title { font-family: var(--font-display); font-size: 2rem; font-weight: 700; line-height: 1.32; text-wrap: balance; }
.lead { color: var(--ink-2); max-width: 34em; }
.method { list-style: none; margin: 0; padding: 0; counter-reset: m; display: grid; gap: 10px; }
.method li { counter-increment: m; display: grid; grid-template-columns: 26px 1fr; gap: 8px; align-items: baseline; color: var(--ink-2); }
.method li::before { content: counter(m); font-family: var(--font-display); font-weight: 700; color: var(--dawn); }
.method b { color: var(--ink); margin-right: 4px; }
.onb-dots { display: flex; gap: 6px; }
.onb-dots i { width: 22px; height: 4px; border-radius: 2px; background: var(--rule); }
.onb-dots i.on { background: var(--dawn); }

/* ---------- 아래에서 올라오는 시트 ---------- */
.sheet { position: fixed; inset: 0; z-index: 50; display: grid; align-items: end; }
.scrim { position: absolute; inset: 0; border: 0; background: var(--scrim); cursor: default; }
.sheet-panel {
  position: relative;
  width: 100%; max-width: 600px; max-height: 88%;
  justify-self: center;
  overflow-y: auto;
  background: var(--paper);
  border-radius: 20px 20px 0 0;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
  padding-block: 0 calc(24px + env(safe-area-inset-bottom, 0px));
  outline: none;
}
.sheet-head {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-block: 12px 8px;
  background: var(--paper);
}
.sheet-head h2 { font-size: 1.05rem; }
.sheet-body { display: grid; gap: 16px; }
.group { display: grid; gap: 10px; padding-bottom: 18px; border-bottom: 1px solid var(--rule); }
.group h3 { font-size: .95rem; }
.mine-line { font-family: var(--font-display); font-size: 1.05rem; }
.confirm { display: grid; gap: 10px; padding: 14px; border: 1.5px solid var(--avoid); border-radius: 12px; background: var(--sheet); }
.about { font-size: .8rem; color: var(--ink-3); }

/* ---------- 알림 ---------- */
.toast {
  position: fixed; left: 50%; z-index: 60;
  top: calc(12px + env(safe-area-inset-top, 0px));
  transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 32px);
  padding: 10px 16px; border-radius: 12px;
  background: var(--ink); color: var(--paper);
  font-size: .9rem; box-shadow: var(--shadow);
}

/* ---------- 과정 ---------- */
:lang(ja) { font-family: var(--font-ja); }
.badge {
  width: 30px; height: 30px; flex: none;
  display: inline-grid; place-items: center;
  border-radius: 9px;
  background: var(--dawn-soft); color: var(--dawn);
  font-family: var(--font-display); font-size: 1rem; font-weight: 700; line-height: 1;
}
.badge:lang(ja) { font-family: var(--font-ja); }
.routines { display: grid; gap: 16px; }
.routine { padding-top: 20px; }
.deck-head { display: flex; align-items: center; gap: 12px; }
.deck-head > div { flex: 1; min-width: 0; }
.deck-name { font-weight: 600; }
.deck-sub { font-size: .8rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.course-prog { height: 4px; border-radius: 2px; background: var(--rule); overflow: hidden; }
.course-prog span { display: block; height: 100%; min-width: 4px; background: var(--dawn); border-radius: 2px; }
.todo-line { color: var(--ink-2); font-size: .92rem; }
.preview { display: grid; gap: 4px; }
.course-chip { display: inline-flex; align-items: center; gap: 8px; padding-left: 6px; }
.course-chip .badge { width: 26px; height: 26px; border-radius: 50%; font-size: .85rem; }
.course-chip[aria-pressed="true"] .badge { background: var(--on-dawn); color: var(--dawn); }
.course-tabs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(78px, 1fr); gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.course-tabs::-webkit-scrollbar { display: none; }
.course-tab {
  min-width: 0; padding: 8px 4px;
  display: grid; justify-items: center; gap: 4px;
  border: 1.5px solid var(--rule); border-radius: 12px;
  background: var(--sheet); color: var(--ink-2); font-size: .8rem;
}
.course-tab span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.course-tab[aria-pressed="true"] { border-color: var(--dawn); color: var(--ink); font-weight: 600; }
.course-tab[aria-pressed="true"] .badge { background: var(--dawn); color: var(--on-dawn); }

/* ---------- 낱말과 표현 ---------- */
.word-hero { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.term-big { font-family: var(--font-display); font-size: 2.6rem; font-weight: 700; line-height: 1.2; letter-spacing: .02em; }
.term-mid { font-family: var(--font-display); font-size: 1.6rem; font-weight: 600; line-height: 1.3; }
.meaning { font-size: 1.05rem; color: var(--ink); }
.meaning.big, .ko-mean.big { font-family: var(--font-display); font-size: 1.35rem; font-weight: 600; line-height: 1.5; }
.ko-mean { font-size: 1.05rem; font-weight: 500; }
.quote.small-q { font-size: 1.2rem; }
.tl { font-family: var(--font-display); font-size: 1.55rem; font-weight: 500; line-height: 1.5; overflow-wrap: anywhere; }
.tl:lang(ja) { font-family: var(--font-ja); font-weight: 600; }
.reading { margin-top: 2px; font-family: var(--font-ja-sans); font-size: .95rem; color: var(--ink-2); }
.pron { margin-top: 2px; font-size: .9rem; color: var(--ink-3); letter-spacing: .02em; }
.term-row { font-size: 1.25rem; font-weight: 600; }

/* ---------- 장면 ---------- */
.stage { display: grid; gap: 8px; }
.stage-name { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding-bottom: 6px; border-bottom: 1.5px solid var(--ink); font-size: 1rem; font-family: var(--font-display); }
.stage-name small { font-family: var(--font-body); font-size: .78rem; font-weight: 400; color: var(--ink-3); }
.units { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.unit { display: grid; gap: 8px; border-bottom: 1px solid var(--rule); padding-bottom: 8px; }
.unit.open { padding-bottom: 16px; }
.unit-head {
  width: 100%; min-height: 56px; padding: 8px 0;
  display: flex; align-items: center; gap: 12px;
  border: 0; background: none; text-align: left; color: var(--ink);
}
.unit-head > .ic { width: 18px; height: 18px; color: var(--ink-3); transition: transform .2s; }
.unit.open .unit-head > .ic { transform: rotate(90deg); }
.unit-title { flex: 1; min-width: 0; display: grid; }
.unit-title b { font-family: var(--font-display); font-size: 1.08rem; font-weight: 600; }
.unit-title small { font-size: .82rem; color: var(--ink-3); }
.unit-no {
  width: 30px; height: 30px; flex: none; display: grid; place-items: center;
  border-radius: 50%; border: 1.5px solid var(--rule); color: var(--ink-3);
  font-family: var(--font-display); font-size: .85rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.unit.current .unit-no { border-color: var(--dawn); color: var(--dawn); }
.unit-no.done { background: var(--dawn); border-color: var(--dawn); color: var(--on-dawn); }
.unit-no .ic { width: 16px; height: 16px; stroke-width: 2.6; }
.unit-prog { font-size: .85rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.btn:disabled { opacity: .5; cursor: default; }
.btn:disabled:hover { border-color: var(--rule); }

/* ---------- 역할 대화 ---------- */
.chat { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.bubble {
  position: relative; max-width: 88%;
  padding: 10px 44px 12px 14px;
  display: grid; gap: 2px;
  border-radius: 16px;
  background: var(--sheet); box-shadow: var(--shadow);
}
.bubble.them { justify-self: start; border-bottom-left-radius: 4px; }
.bubble.me { justify-self: end; background: var(--dawn-soft); box-shadow: none; border-bottom-right-radius: 4px; }
.bubble.ask { border: 1.5px dashed var(--dawn); padding-right: 14px; }
.bubble .who { font-size: .72rem; font-weight: 600; color: var(--ink-3); }
.bubble .tl { font-size: 1.2rem; }
.bubble .ko { font-size: .85rem; color: var(--ink-2); }
.say {
  position: absolute; top: 6px; right: 4px;
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 0; border-radius: 10px; background: transparent; color: var(--dawn);
}
.say .ic { width: 18px; height: 18px; }

/* ---------- 글자표와 퀴즈 ---------- */
.kana-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.kana {
  aspect-ratio: 1 / 1; max-width: 100%;
  display: grid; place-content: center; justify-items: center; gap: 0;
  border: 1.5px solid var(--rule); border-radius: 12px;
  background: var(--sheet); color: var(--ink);
}
.kana span { font-size: 1.6rem; line-height: 1.1; }
.kana small { font-size: .72rem; color: var(--ink-3); }
.kana:hover { border-color: var(--dawn); }
.kana.empty { border: 0; background: transparent; }
.kana-q { justify-self: center; font-size: 5rem; line-height: 1.1; padding-block: 8px; }
.kana-grid.yoon { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kana-grid.words { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kana-grid.words .kana, .kana-grid.yoon .kana { aspect-ratio: auto; min-height: 76px; padding: 8px 4px; }
.kana-grid.words .kana span { font-size: 1.3rem; }
.kana small.hid { visibility: hidden; }
.kana .kana-ko { font-size: .68rem; }
.session .kana-grid:not(.words):not(.yoon) .kana span { font-size: 2.2rem; }
.session .kana-grid.yoon .kana span { font-size: 1.7rem; }
.kana-q.word { font-size: 2.8rem; text-align: center; }
.hint.center { text-align: center; }
.kq-dots { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; }
.kq-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--rule); }
.kq-dots i.now { background: var(--dawn); }
.kq-dots i.ok { background: var(--good); }
.kq-dots i.bad { background: var(--avoid); }
.kq-result { display: grid; justify-items: center; gap: 2px; padding-block: 8px; text-align: center; }
.kq-score { font-family: var(--font-display); font-size: 1.2rem; color: var(--ink-3); }
.kq-score b { font-size: 3.2rem; line-height: 1.1; color: var(--ink); }
.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.choice {
  min-height: 56px; border: 1.5px solid var(--rule); border-radius: 12px;
  background: var(--sheet); font-size: 1.2rem; font-weight: 600;
}
.choice.right { border-color: var(--good); background: var(--good); color: var(--sheet); opacity: 1; }
.choice.wrong { border-color: var(--avoid); color: var(--avoid); opacity: 1; }
.choice:disabled { cursor: default; }

/* ---------- 시작 안내: 과정 고르기 ---------- */
.course-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.course-list li { display: flex; align-items: center; gap: 12px; }
.course-list div { display: grid; }
.course-list span:not(.badge) { font-size: .88rem; color: var(--ink-3); }
.pick-list { display: grid; gap: 8px; }
.pick {
  display: flex; align-items: center; gap: 12px;
  min-height: 64px; padding: 10px 14px;
  border: 1.5px solid var(--rule); border-radius: 14px;
  background: var(--sheet); text-align: left;
}
.pick-body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.pick small { color: var(--ink-3); font-size: .85rem; }
.pick .tick { width: 24px; height: 24px; flex: none; display: grid; place-items: center; border-radius: 50%; border: 1.5px solid var(--rule); color: transparent; }
.pick .tick .ic { width: 16px; height: 16px; stroke-width: 2.6; }
.pick[aria-pressed="true"] { border-color: var(--dawn); }
.pick[aria-pressed="true"] .tick { background: var(--dawn); border-color: var(--dawn); color: var(--on-dawn); }

/* ---------- 1년 장치: 오늘 ---------- */
.day-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: -12px; font-size: .88rem; color: var(--ink-2); }
.session .day-line { margin-top: 0; }
.day-chip { padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--dawn-soft); color: var(--dawn); }
.day-chip.practice { background: var(--dawn); color: var(--on-dawn); }
.day-chip.review { background: transparent; color: var(--ink-2); box-shadow: inset 0 0 0 1.5px var(--rule); }
.banner { padding: 14px 16px; border-radius: 14px; background: var(--dawn-soft); color: var(--ink-2); font-size: .92rem; }
.banner b { color: var(--ink); }
.rest-note { margin-top: -14px; }
.day.rest .dot { border-style: dashed; border-color: var(--ink-3); color: var(--ink-3); }
.day.rest .dot b { font-family: var(--font-display); font-size: 1.1rem; line-height: 1; transform: translateY(-3px); }
.quick {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 14px 16px;
  border: 1.5px dashed var(--rule); border-radius: 14px;
  background: transparent; color: var(--ink); text-align: left;
}
.quick:hover { border-color: var(--dawn); }
.quick > span { flex: 1; display: grid; }
.quick small { color: var(--ink-3); font-size: .85rem; }
.quick > .ic:first-child { color: var(--dawn); }
.quick > .ic:last-child { width: 18px; height: 18px; color: var(--ink-3); }

/* ---------- 1년 장치: 루틴 ---------- */
.milestone { display: grid; gap: 4px; padding: 16px 18px; border-radius: 14px; background: var(--mark); color: var(--ink); }
.ms-num { font-size: .95rem; font-weight: 600; }
.ms-num b { font-family: var(--font-display); font-size: 2rem; line-height: 1; margin-right: 2px; }
.recap { display: grid; gap: 8px; padding: 16px 18px; border-radius: 14px; background: var(--sheet); box-shadow: var(--shadow); }
.recap h3 { font-size: 1rem; }
.recap ul { margin: 0; padding-left: 18px; display: grid; gap: 2px; color: var(--ink-2); }
.recap ul :lang(ja) { font-family: var(--font-ja); }
.word-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.word-chips li { display: grid; padding: 8px 12px; border-radius: 12px; background: var(--dawn-soft); max-width: 100%; }
.word-chips b { font-family: var(--font-display); font-size: 1.05rem; }
.word-chips small { font-size: .78rem; color: var(--ink-2); }
.pick-text { font-family: var(--font-display); font-weight: 500; font-size: 1.02rem; line-height: 1.5; }
.shadow-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.shadow-list li { position: relative; padding: 10px 44px 10px 14px; border-radius: 14px; background: var(--sheet); box-shadow: var(--shadow); }
.shadow-list .tl { font-size: 1.15rem; }
.shadow-list .ko { font-size: .85rem; color: var(--ink-2); }

/* ---------- 인문학 ---------- */
.term-big.idea { font-size: 2.1rem; line-height: 1.25; text-wrap: balance; }
.idea-line { margin: 0; display: grid; gap: 6px; }
.idea-line figcaption { font-size: .85rem; color: var(--ink-3); }
.ask { padding: 14px 16px; border-radius: 12px; border: 1.5px dashed var(--dawn); display: grid; gap: 4px; }
.ask .label { margin-bottom: 0; color: var(--dawn); }
.ask-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ask-list li { display: grid; gap: 2px; padding: 10px 14px; border-radius: 12px; background: var(--dawn-soft); }
.ask-list b { font-family: var(--font-display); }
.ask-list span { font-size: .9rem; color: var(--ink-2); }

/* ---------- 1년 장치: 기록 ---------- */
.year-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.year-stats p { display: grid; gap: 2px; padding: 12px 10px; border-radius: 12px; background: var(--sheet); box-shadow: var(--shadow); text-align: center; }
.year-stats b { font-family: var(--font-display); font-size: 1.6rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.year-stats span { font-size: .72rem; color: var(--ink-3); }
.year-cal { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 12px; }
.month { min-width: 0; }
.mname { margin-bottom: 4px; font-size: .8rem; font-weight: 600; color: var(--ink-2); }
.mname small { margin-right: 4px; font-weight: 400; color: var(--ink-3); }
.mgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.mc { display: block; aspect-ratio: 1 / 1; border-radius: 3px; background: var(--rule); }
.mc.lead, .mc.out { background: transparent; }
.mc.out { box-shadow: inset 0 0 0 1px var(--rule); opacity: .4; }
.mc.future { background: var(--blank); }
.mc.done { background: var(--dawn); }
.mc.rest { background: transparent; box-shadow: inset 0 0 0 1.5px var(--ink-3); }
.mc.miss { background: var(--rule); }
.mc.now { background: var(--sheet); box-shadow: inset 0 0 0 2px var(--dawn); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .78rem; color: var(--ink-3); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .mc { width: 12px; }
.miles { display: flex; flex-wrap: wrap; gap: 6px; }
.mile { padding: 4px 10px; border-radius: 999px; font-size: .8rem; color: var(--ink-3); box-shadow: inset 0 0 0 1.5px var(--rule); font-variant-numeric: tabular-nums; }
.mile.got { background: var(--mark); color: var(--ink); box-shadow: none; font-weight: 600; }
.road-course { display: flex; gap: 12px; align-items: flex-start; padding-block: 6px; }
.road-course > div { flex: 1; min-width: 0; display: grid; gap: 8px; }
.road-row { display: grid; gap: 4px; }
.road-name { font-size: .78rem; color: var(--ink-3); }
.road-cells { display: grid; grid-template-columns: repeat(13, minmax(0, 1fr)); gap: 3px; }
.rc { display: block; aspect-ratio: 1 / 1; border-radius: 4px; background: var(--rule); }
.rc.half { background: var(--dawn-soft); box-shadow: inset 0 0 0 1.5px var(--dawn); }
.rc.done { background: var(--dawn); }
.rc.now { background: var(--sheet); box-shadow: inset 0 0 0 2px var(--dawn); }
.road-cells.kana-road { grid-template-columns: repeat(16, minmax(0, 1fr)); }

/* ---------- 획순 · 말해 보기 · 코치 지시어 듣기 ---------- */
.kana.on { border-color: var(--dawn); box-shadow: inset 0 0 0 1.5px var(--dawn); }
.stroke-panel { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 14px; background: var(--dawn-soft); }
.stroke-row { flex: none; display: flex; gap: 6px; }
.stroke-svg { display: block; width: clamp(92px, 30vw, 136px); aspect-ratio: 1 / 1; border-radius: 12px; background: var(--sheet); box-shadow: inset 0 0 0 1.5px var(--rule); }
.stroke-row .stroke-svg + .stroke-svg { width: clamp(76px, 24vw, 112px); }
.stroke-svg path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.stk-grid { stroke: var(--rule); stroke-width: .7; stroke-dasharray: 2.5 2.5; }
.stk-bg { stroke: var(--trace); stroke-width: 4.2; }
.stk { stroke: var(--ink); stroke-width: 4.2; stroke-dasharray: 1; stroke-dashoffset: 1; animation: stk-draw .55s ease-in-out forwards; animation-delay: calc(var(--i) * .75s + .25s); }
.stk-n { font: 700 9px var(--font-body); fill: var(--dawn); opacity: 0; animation: stk-num .2s forwards; animation-delay: calc(var(--i) * .75s + .25s); }
@keyframes stk-draw { to { stroke-dashoffset: 0; } }
@keyframes stk-num { to { opacity: 1; } }
.stroke-info { min-width: 0; display: grid; gap: 4px; }
.stroke-ch { font-size: 1.4rem; font-weight: 600; }
.stroke-ch span { font-family: var(--font-ja); }
.stroke-ch small { font-size: .9rem; color: var(--ink-2); font-weight: 500; }
.stroke-hint { font-size: .92rem; color: var(--ink-2); }
.stroke-src { font-size: .7rem; color: var(--ink-3); }
.sr-line { display: flex; align-items: center; gap: 6px; font-size: .9rem; color: var(--ink-2); }
.sr-line.ok { color: var(--good); font-weight: 600; }
.sr-line .ic { width: 18px; height: 18px; }
.onb-sub { margin-top: 8px; font-size: 1rem; }
.better.center { text-align: center; justify-items: center; }
.ls-play { display: grid; justify-items: center; gap: 12px; padding-block: 8px; }
.ls-btn { width: 96px; height: 96px; border-radius: 50%; border: 0; background: var(--dawn); color: var(--on-dawn); display: grid; place-items: center; box-shadow: var(--shadow); }
.ls-btn .ic { width: 40px; height: 40px; }
.ls-timer { width: min(240px, 70%); height: 6px; border-radius: 3px; background: var(--rule); overflow: hidden; }
.ls-timer span { display: block; height: 100%; width: 100%; background: var(--dawn); transform-origin: left; animation: ls-shrink var(--sec) linear .7s forwards; }
@keyframes ls-shrink { to { transform: scaleX(0); } }
.notes + .seg, .seg + .seg { margin-top: -12px; }

/* ---------- 손글씨 노트 ----------
   왼쪽(좁으면 위)은 읽고 생각하는 칸, 오른쪽은 펜슬로 쓰는 종이. 종이는 두 장의 캔버스(바탕·잉크)를 겹친다. */
.write-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.write-head .label { margin-bottom: 0; }
.pen-link { padding: 4px 0; font-size: .85rem; }
.pen-note { color: var(--dawn); font-weight: 600; }
.pad {
  position: fixed; inset: 0; z-index: 55;
  background: var(--paper);
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: max(12px, env(safe-area-inset-left, 0px));
  padding-right: max(12px, env(safe-area-inset-right, 0px));
}
.pad-inner { height: 100%; max-width: 1400px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px; padding-bottom: 12px; }
.pad-top { display: flex; align-items: center; gap: 6px; min-height: 52px; }
.pad-title { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pad-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; }
.pad-read { flex: none; max-height: 34%; overflow-y: auto; display: grid; align-content: start; gap: 8px; padding: 2px 2px 4px; }
.pad-read .label { margin-bottom: -4px; }
.pad-read .btn { justify-self: start; }
.pad-text { font-family: var(--font-display); font-size: 1.2rem; font-weight: 500; line-height: 1.6; }
.pad-text:lang(ja), .pad-sub:lang(ja) { font-family: var(--font-ja); }
.pad-sub { font-size: .92rem; color: var(--ink-2); }
.pad-think { padding: 10px 14px; border-radius: 12px; border: 1.5px dashed var(--dawn); font-size: .95rem; }
.pad-write { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.pad-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pad-tools .seg { margin-top: 0; }
.pad-tools .chip { min-height: 38px; }
.seg.mini { padding: 3px; gap: 2px; border-radius: 10px; }
.seg.mini button { min-height: 32px; padding: 0 10px; border-radius: 8px; font-size: .82rem; }
.pad-wrap { position: relative; flex: 1; min-height: 260px; border-radius: 14px; overflow: hidden; background: var(--sheet); box-shadow: var(--shadow); }
.pad-wrap canvas { position: absolute; top: 0; left: 0; display: block; }
#pad-ink { touch-action: none; cursor: crosshair; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.ink-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.ink-item { padding: 0; border: 0; border-radius: 12px; overflow: hidden; background: var(--sheet); box-shadow: var(--shadow); display: grid; text-align: left; }
.ink-item img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; object-position: top; background: #fff; }
.ink-item span { padding: 8px 10px; font-size: .8rem; color: var(--ink-3); }
.ink-view { margin: 0; display: grid; gap: 8px; }
.ink-view img { display: block; justify-self: center; width: auto; max-width: 100%; max-height: 64vh; border-radius: 12px; box-shadow: var(--shadow); background: #fff; }

@media (min-width: 720px) {
  .view { padding-top: 40px; }
  .quote { font-size: 1.65rem; }
}
/* 아이패드 가로·데스크톱: 루틴 두 줄, 손글씨는 읽기와 쓰기를 나란히 */
@media (min-width: 900px) {
  .view { max-width: 920px; }
  .routines { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .year-cal { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .session-inner { max-width: 680px; }
  .tabs-inner { max-width: 920px; }
  .pad-body { flex-direction: row; gap: 20px; }
  .pad-read { flex: 0 0 min(34%, 400px); max-height: none; padding-top: 8px; gap: 10px; }
  .pad-text { font-size: 1.4rem; }
}
@media (prefers-reduced-motion: reduce) {
  mark.reveal { animation: none; }
  .stk { animation: none; stroke-dashoffset: 0; }
  .stk-n { animation: none; opacity: 1; }
  .progress span { transition: none; }
}
