/* Rose 학습 - 웹 스타일
   원칙: 종이 느낌의 밝은 바탕, 검정 잉크, 포인트 색 하나(rose), 얇은 선. 장식 최소. */
:root {
  --paper: #f5f2ec; --card: #fffdf9; --card-2: #faf7f1;
  --ink: #1d1d1b; --ink-2: #3d3a35; --muted: #79736a; --line: #e4ded3; --line-2: #cfc7b9;
  --accent: #c8503f; --accent-ink: #8e2f24; --accent-light: #f7e7e3;
  --green: #2f6b4f; --green-light: #e9f1ec;
  --blue: #2c5f8a;
  --radius: 10px;
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  --font-ipa: "Pretendard Variable", "Segoe UI", "Arial Unicode MS", "Noto Sans", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper); color: var(--ink); font-family: var(--font);
  font-size: 15px; line-height: 1.6; letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased; padding-bottom: env(safe-area-inset-bottom);
}
a { color: inherit; }
button { font: inherit; cursor: pointer; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.02em; line-height: 1.3; }

/* ---------- 상단 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10; background: rgba(245,242,236,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px;
}
.brand { text-decoration: none; font-weight: 800; font-size: 18px; letter-spacing: -0.02em; display: flex; align-items: center; gap: 8px; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); display: inline-block; }
.brand-sub { font-weight: 500; color: var(--muted); font-size: 14px; margin-left: 2px; }
.topbar nav a { text-decoration: none; margin-left: 18px; font-weight: 600; color: var(--ink-2); font-size: 14px; }
.app { max-width: 760px; margin: 0 auto; padding: 18px 14px 48px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 24px; letter-spacing: .04em; }
.loading { text-align: center; color: var(--muted); }

/* ---------- 카드 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 16px; margin-bottom: 14px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card h2 { font-size: 16px; }
.card h2 .count { color: var(--muted); font-weight: 500; font-size: 13px; margin-left: 6px; }
.today { color: var(--muted); font-size: 13px; margin: 0 0 12px 2px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.lesson-title { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 4px; }
.meta { color: var(--muted); font-size: 13px; }
.meta b { color: var(--ink-2); font-weight: 600; }
.dday { display: inline-block; background: var(--ink); color: #fff; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 6px; margin-left: 6px; vertical-align: 1px; }
.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin: 12px 0 6px; }
.progress > i { display: block; height: 100%; background: var(--accent); }
.small { font-size: 13px; color: var(--muted); }
.center { text-align: center; }
.mt { margin-top: 12px; }

/* ---------- 버튼 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border-radius: 8px; border: 1px solid var(--ink);
  background: var(--ink); color: #fff; font-weight: 600; text-decoration: none; font-size: 14px; line-height: 1.2; white-space: nowrap;
}
.btn:hover { background: #000; }
.btn.secondary { background: transparent; color: var(--ink); }
.btn.secondary:hover { background: var(--card-2); }
.btn.accent { background: var(--accent); border-color: var(--accent); }
.btn.accent:hover { background: var(--accent-ink); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); padding-left: 4px; }
.btn.big { width: 100%; padding: 14px; font-size: 16px; }
.btn:disabled { opacity: .4; cursor: default; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.btn-grid .btn { padding: 12px 8px; flex-direction: column; gap: 2px; height: auto; }
.btn-grid .btn small { font-weight: 500; opacity: .75; font-size: 11px; }

/* ---------- 필터 탭 ---------- */
.tabs { display: inline-flex; background: var(--card-2); border: 1px solid var(--line); border-radius: 8px; padding: 3px; gap: 2px; }
.tabs button { border: none; background: transparent; padding: 5px 12px; border-radius: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.tabs button.on { background: var(--ink); color: #fff; }

/* ---------- 단어 칩: 모바일 2열, PC 3열, 높이 고정 ---------- */
.chips { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 640px) { .chips { grid-template-columns: repeat(3, 1fr); } }
.chip {
  display: flex; flex-direction: column; height: 66px; background: var(--card); border: 1px solid var(--line-2); border-radius: 8px;
  text-decoration: none; color: var(--ink); overflow: hidden; position: relative;
}
.chip:hover { border-color: var(--ink); }
.chip .top { flex: 1; display: flex; align-items: center; padding: 0 10px 0 12px; gap: 6px; min-width: 0; }
.chip .n { color: var(--muted); font-size: 11px; font-weight: 600; flex: none; width: 16px; }
.chip .w { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip .bottom { border-top: 1px dotted var(--line-2); padding: 3px 12px 4px 34px; font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.chip .bottom .ch { color: var(--line-2); }
.chip.seen { background: var(--green-light); border-color: #b9d1c4; }
.chip.seen .bottom { border-top-color: #b9d1c4; }
.chip.seen .ck { position: absolute; right: 9px; top: 9px; width: 16px; height: 16px; border-radius: 50%; background: var(--green); color: #fff; font-size: 10px; display: flex; align-items: center; justify-content: center; }
.chip .w.long { font-size: 13.5px; }

/* ---------- 목록 ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: none; }
.list a { text-decoration: none; font-weight: 600; }
.list .meta { display: block; font-weight: 400; }
.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 5px; background: var(--card-2); border: 1px solid var(--line); color: var(--ink-2); }
.tag.accent { background: var(--accent-light); border-color: #eccfc8; color: var(--accent-ink); }
.dl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dl a { display: flex; flex-direction: column; text-decoration: none; border: 1px solid var(--line-2); border-radius: 8px; padding: 10px 12px; font-weight: 600; font-size: 14px; }
.dl a small { color: var(--muted); font-weight: 400; font-size: 12px; }
.dl a:hover { border-color: var(--ink); }
.dl a.all { grid-column: 1 / -1; background: var(--ink); color: #fff; border-color: var(--ink); }
.dl a.all small { color: rgba(255,255,255,.7); }

/* ---------- 단어 상세 ---------- */
.word-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 14px; }
.word-nav a { text-decoration: none; font-weight: 600; color: var(--ink-2); }
.word-nav .pos-ind { color: var(--muted); font-size: 13px; }
.word-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 14px; }
.word-head { padding: 18px 18px 14px; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.word-head .w { font-size: 34px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.word-head .pos { font-size: 12px; font-weight: 600; color: var(--muted); border: 1px solid var(--line-2); padding: 2px 8px; border-radius: 6px; }
.word-head .sound { width: 100%; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
@media (min-width: 600px) { .word-head .sound { width: auto; margin-left: auto; } }
.ipa {
  font-family: var(--font-ipa); font-size: 16px; color: var(--ink); font-weight: 600; background: var(--card-2); border: 1px solid var(--line-2);
  border-radius: 999px; padding: 6px 16px 6px 12px; display: inline-flex; align-items: center; gap: 8px; line-height: 1.3; cursor: pointer; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.ipa .spk { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 10px; display: inline-flex; align-items: center; justify-content: center; }
.ipa.playing { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.pronko { color: var(--muted); font-size: 14px; }
.chapter { padding: 16px 18px 18px; }
.chapter.ko { background: var(--card); border-bottom: 1px dashed var(--line-2); }
.chapter.en { background: var(--card-2); }
.chapter-title { display: inline-block; font-weight: 700; font-size: 12px; letter-spacing: .04em; padding: 2px 9px; border-radius: 5px; margin-bottom: 12px; }
.ko .chapter-title { background: var(--accent-light); color: var(--accent-ink); }
.en .chapter-title { background: var(--green-light); color: var(--green); }
.row { margin-bottom: 12px; }
.row:last-child { margin-bottom: 0; }
.row .k { font-weight: 600; color: var(--muted); font-size: 12px; margin-bottom: 3px; letter-spacing: .02em; }
.meaning { font-size: 18px; font-weight: 700; color: var(--accent-ink); letter-spacing: -0.01em; }
.script { background: var(--card-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.en .script { background: var(--card); }
.script p { margin: 0 0 8px; display: flex; gap: 8px; }
.script p:last-child { margin-bottom: 0; }
.script .who { font-weight: 700; flex: none; width: 34px; font-size: 13px; padding-top: 2px; }
.script .who.parent { color: var(--accent-ink); }
.script .who.child { color: var(--blue); }
.ex { margin: 0; padding-left: 20px; }
.ex li { margin-bottom: 6px; }
.ex li b { color: var(--green); }
.ex .tr { display: block; color: var(--muted); font-size: 13px; }
.tip { background: #fbf6e6; border-left: 3px solid #e2b93b; padding: 7px 10px; border-radius: 4px; font-size: 14px; }
.def-en { font-size: 16px; font-weight: 600; }
.word-foot { display: flex; gap: 8px; justify-content: space-between; }

/* ---------- 테스트 ---------- */
.setup label { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 14px; }
.setup input[type=number] { width: 70px; font: inherit; padding: 4px 6px; border: 1px solid var(--line-2); border-radius: 6px; }
.setup input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--ink); }
.scope-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.scope-pick a { text-decoration: none; text-align: center; border: 1px solid var(--line-2); border-radius: 8px; padding: 10px 6px; font-weight: 600; font-size: 14px; }
.scope-pick a.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.scope-pick a small { display: block; font-weight: 400; font-size: 11px; opacity: .7; }
.q-head { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.q-type { font-weight: 600; color: var(--ink-2); }
.q-text { font-size: 19px; font-weight: 700; margin: 6px 0 4px; letter-spacing: -0.01em; }
.q-text .blank { color: var(--accent); }
.q-sub { color: var(--muted); font-size: 13px; }
.opts { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.opt { text-align: left; padding: 13px 14px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--card); font-size: 16px; font-weight: 600; }
.opt.sel { border-color: var(--ink); background: var(--ink); color: #fff; }
.q-input { width: 100%; font: inherit; font-size: 20px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 8px; margin-top: 12px; background: var(--card); }
.q-input:focus { outline: none; border-color: var(--ink); }
.score-big { text-align: center; padding: 8px 0 4px; }
.score-big .n { font-size: 48px; font-weight: 800; letter-spacing: -0.04em; }
.score-big .n span { color: var(--muted); font-size: 22px; font-weight: 600; }
.score-big .t { color: var(--ink-2); margin-top: 2px; }
.result-item { border: 1px solid var(--line); border-left: 3px solid var(--line-2); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.result-item.ok { border-left-color: var(--green); }
.result-item.bad { border-left-color: var(--accent); }
.result-item .st { font-weight: 700; font-size: 13px; }
.result-item.ok .st { color: var(--green); }
.result-item.bad .st { color: var(--accent-ink); }
.result-item .prompt { font-size: 14px; color: var(--ink-2); margin: 2px 0; }
.result-item .ans { font-size: 14px; margin: 4px 0 6px; }
.result-item .expl { background: var(--card-2); border-radius: 6px; padding: 8px 10px; font-size: 14px; }
.result-item .expl .w { font-weight: 700; font-size: 15px; }
.result-item .expl .m { color: var(--accent-ink); font-weight: 600; }
.result-item .expl .d { color: var(--green); font-weight: 600; }
.result-item .expl .e { color: var(--ink-2); font-style: italic; }
.result-item .expl a { font-size: 13px; color: var(--ink-2); }

/* ---------- Show & Tell ---------- */
.st-slide { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; overflow: hidden; background: var(--card); }
.st-slide .st-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--card-2); border-bottom: 1px solid var(--line); }
.st-slide .st-head .n { background: var(--ink); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 5px; }
.st-slide .st-head .h { font-weight: 700; font-size: 15px; }
.st-slide .st-body { padding: 12px 14px; display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 560px) { .st-slide .st-body.has-photo { grid-template-columns: 150px 1fr; } }
.st-photos { display: flex; gap: 6px; }
.st-photos img { width: 100%; max-width: 150px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; background: var(--line); }
.st-line { display: grid; grid-template-columns: 18px 1fr; gap: 8px; margin-bottom: 8px; }
.st-line .no { color: var(--accent); font-weight: 800; }
.st-line .en { font-size: 17px; font-weight: 700; line-height: 1.4; letter-spacing: -0.01em; }
.st-line .ko { font-size: 13px; color: var(--muted); }
.st-kw { font-size: 12px; color: var(--muted); margin-top: 4px; }
.pron { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.pron div { border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font-size: 13px; }
.pron b { display: block; font-size: 14px; }
.pron span { color: var(--muted); }

/* ---------- 주차 이동 ---------- */
.week-nav { display: flex; justify-content: space-between; align-items: center; margin: 0 2px 10px; font-size: 13px; }
.week-nav a { text-decoration: none; color: var(--ink-2); font-weight: 600; }
.week-nav a span { color: var(--muted); font-weight: 500; }
