/* 电话汉语 학습장 — 먹(ink) + 인주(seal) 디자인 */
:root {
  --paper: #F7F7F4;
  --card: #FFFFFF;
  --ink: #242A31;
  --sub: #5C6B78;
  --seal: #C0392B;
  --seal-soft: #F3E1DD;
  --line: #E3E4DF;
  --track: #ECEDE8;
  --abs: #E14434;
  --pp: #8B5CF6;
  --rp: #2E7DD6;
  --sun: #C0392B;
  --sat: #2E7DD6;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1B1F24; --card: #23282F; --ink: #E8E6E1; --sub: #9AA7B1;
    --seal: #E06A55; --seal-soft: #3B2A27; --line: #343A42; --track: #2C323A;
    --abs: #F0756A; --pp: #A78BFA; --rp: #60A5FA; --sun: #F0756A; --sat: #60A5FA;
  }
}
:root[data-theme="dark"] {
  --paper: #1B1F24; --card: #23282F; --ink: #E8E6E1; --sub: #9AA7B1;
  --seal: #E06A55; --seal-soft: #3B2A27; --line: #343A42; --track: #2C323A;
  --abs: #F0756A; --pp: #A78BFA; --rp: #60A5FA; --sun: #F0756A; --sat: #60A5FA;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "IBM Plex Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: 15.5px;
  line-height: 1.65;
}
.hanzi { font-family: "Noto Serif SC", "Songti SC", serif; }
button { font: inherit; color: inherit; }

/* ---- top nav ---- */
.topnav {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 24px;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); }
.seal-mark {
  color: #fff; background: var(--seal);
  font-weight: 700; font-size: 0.95rem;
  padding: 3px 8px; border-radius: 5px; letter-spacing: 0.05em;
}
.brand-ko { font-weight: 700; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs a {
  text-decoration: none; color: var(--sub);
  padding: 6px 14px; border-radius: 999px; font-size: 0.92rem; font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.tabs a:hover { color: var(--ink); background: var(--track); }
.tabs a.active { color: #fff; background: var(--seal); font-weight: 700; }
.tabs a:focus-visible { outline: 2px solid var(--seal); outline-offset: 2px; }

main { max-width: 880px; margin: 0 auto; padding: 36px 20px 72px; }
.view { display: flex; flex-direction: column; gap: 22px; }
.view[hidden] { display: none; }

h2 { font-size: 1.05rem; font-weight: 700; margin: 18px 0 0; display: flex; align-items: center; gap: 10px; }
.stamp {
  font-family: "Noto Serif SC", serif;
  font-size: 0.78rem; font-weight: 700; color: var(--seal);
  border: 1.5px solid var(--seal); border-radius: 4px;
  padding: 1px 7px; letter-spacing: 0.1em;
}
.note { color: var(--sub); font-size: 0.85rem; margin: 0; }
.note b { color: var(--ink); font-weight: 700; }
.src-tag { font-size: 0.72rem; font-weight: 500; color: var(--sub); border: 1px solid var(--line); border-radius: 999px; padding: 1px 9px; letter-spacing: 0; }

/* ---- hero ---- */
.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 32px; align-items: start; }
@media (max-width: 720px) { .hero { grid-template-columns: 1fr; } }
.eyebrow { color: var(--sub); font-size: 0.82rem; letter-spacing: 0.04em; margin: 0 0 10px; }
.hero h1 {
  font-size: 2rem; line-height: 1.3; margin: 0 0 14px;
  font-weight: 700; text-wrap: balance;
}
.hero h1 .accent { color: var(--seal); font-weight: 900; }
.hero-desc { color: var(--sub); margin: 0; max-width: 40ch; }
.hero-right { display: flex; flex-direction: column; gap: 12px; }

.progress-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 18px 20px; display: flex; flex-direction: column; gap: 10px;
}
.progress-top { display: flex; justify-content: space-between; align-items: baseline; }
.progress-top .label { font-size: 0.78rem; letter-spacing: 0.06em; color: var(--sub); }
.pnum { font-variant-numeric: tabular-nums; font-weight: 700; }
.pnum strong { color: var(--seal); font-size: 1.4rem; }
.bar { height: 10px; background: var(--track); border-radius: 5px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--seal); border-radius: 5px; transition: width 0.6s ease; }
.progress-foot { display: flex; justify-content: space-between; color: var(--sub); font-size: 0.82rem; font-variant-numeric: tabular-nums; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; display: flex; flex-direction: column; gap: 2px;
}
.stat b { font-size: 1.25rem; font-variant-numeric: tabular-nums; color: var(--seal); }
.stat span { font-size: 0.75rem; color: var(--sub); }

/* ---- calendars ---- */
.cal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.calwrap { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.calwrap h3 { margin: 0 0 10px; font-size: 0.9rem; display: flex; justify-content: space-between; align-items: baseline; }
.calwrap h3 .cnt { color: var(--seal); font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .dow { text-align: center; font-size: 0.66rem; color: var(--sub); letter-spacing: 0.06em; padding-bottom: 2px; }
.cal .dow.sun { color: var(--sun); }
.cal .dow.sat { color: var(--sat); }
.day {
  min-height: 42px; border-radius: 6px; padding: 3px 0 2px;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  font-variant-numeric: tabular-nums; border: 1px solid transparent;
}
.day .d { font-weight: 700; font-size: 0.78rem; line-height: 1.2; }
.day .d.sun { color: var(--sun); }
.day .d.sat { color: var(--sat); }
.day .tag { font-size: 0.58rem; line-height: 1.25; }
.day.empty { border: none; }
.day.att { background: var(--seal); }
.day.att .d, .day.att .d.sun, .day.att .d.sat { color: #fff; }
.day.att .tag { color: #fff; opacity: 0.92; }
.day.abs { border-color: var(--abs); background: color-mix(in srgb, var(--abs) 8%, transparent); }
.day.abs .tag { color: var(--abs); font-weight: 700; }
.day.cancel { border-color: var(--line); background: var(--track); }
.day.cancel .tag { color: var(--sub); }
.day.pp { border-color: var(--pp); background: color-mix(in srgb, var(--pp) 8%, transparent); }
.day.pp .tag { color: var(--pp); font-weight: 700; }
.day.rp { border-color: var(--rp); background: color-mix(in srgb, var(--rp) 10%, transparent); }
.day.rp .tag { color: var(--rp); font-weight: 700; }
.start-badge { font-size: 0.5rem; background: var(--seal); color: #fff; border-radius: 3px; padding: 0 3px; font-weight: 700; margin-bottom: 1px; }
.legend { display: flex; gap: 12px 16px; flex-wrap: wrap; font-size: 0.8rem; color: var(--sub); }
.legend span { display: inline-flex; align-items: center; }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 5px; }
.legend .l-att i { background: var(--seal); }
.legend .l-abs i { border: 1.5px solid var(--abs); background: color-mix(in srgb, var(--abs) 10%, transparent); }
.legend .l-cancel i { background: var(--track); border: 1px solid var(--line); }
.legend .l-pp i { border: 1.5px solid var(--pp); background: color-mix(in srgb, var(--pp) 10%, transparent); }
.legend .l-rp i { border: 1.5px solid var(--rp); background: color-mix(in srgb, var(--rp) 12%, transparent); }

/* ---- toolbar ---- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar input[type="search"] {
  flex: 1; min-width: 220px;
  background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 9px 18px; font: inherit; font-size: 0.92rem;
}
.toolbar input[type="search"]:focus-visible { outline: 2px solid var(--seal); outline-offset: 1px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button {
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 14px; font-size: 0.88rem; cursor: pointer; color: var(--sub);
}
.chips button:hover { color: var(--ink); }
.chips button.active { background: var(--seal); border-color: var(--seal); color: #fff; font-weight: 700; }
.chips button:focus-visible { outline: 2px solid var(--seal); outline-offset: 2px; }
.result-count { color: var(--sub); font-size: 0.82rem; margin: 0; }

/* ---- lesson cards ---- */
.lesson-list { display: flex; flex-direction: column; gap: 12px; }
.month-head {
  font-size: 0.85rem; font-weight: 700; color: var(--sub);
  letter-spacing: 0.05em; margin: 14px 0 0; display: flex; align-items: center; gap: 10px;
}
.month-head::after { content: ""; flex: 1; height: 1px; background: var(--line); }
details.lesson { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
details.lesson summary {
  cursor: pointer; list-style: none;
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  padding: 13px 18px;
}
details.lesson summary::-webkit-details-marker { display: none; }
details.lesson summary::before { content: "▸"; color: var(--seal); font-size: 0.8rem; }
details.lesson[open] summary::before { content: "▾"; }
details.lesson summary:focus-visible { outline: 2px solid var(--seal); outline-offset: -2px; }
summary .date { font-weight: 700; font-variant-numeric: tabular-nums; }
summary .cnt { color: var(--seal); font-weight: 700; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
summary .theme { color: var(--sub); font-size: 0.88rem; }
.lbody { border-top: 1px solid var(--line); padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 14px; }
.sent { display: flex; flex-direction: column; gap: 2px; }
.sent .gr {
  align-self: flex-start;
  background: var(--seal-soft); color: var(--seal);
  font-weight: 700; font-size: 0.78rem;
  border-radius: 999px; padding: 1px 10px; margin-bottom: 3px;
}
.sent .zh { font-family: "Noto Serif SC", serif; font-size: 1.18rem; font-weight: 700; line-height: 1.5; }
.sent .zh .bad { opacity: 0.45; text-decoration: line-through; }
.sent .zh .good { color: var(--seal); }
.sent .py { color: var(--sub); font-style: italic; font-size: 0.85rem; }
.sent .ko { font-size: 0.92rem; color: var(--sub); }
.words { display: flex; flex-wrap: wrap; gap: 6px 8px; border-top: 1px dashed var(--line); padding-top: 12px; }
.words span {
  font-size: 0.85rem; color: var(--sub);
  border: 1px solid var(--line); border-radius: 6px; padding: 2px 9px;
}
.words span b { color: var(--ink); font-family: "Noto Serif SC", serif; font-weight: 700; margin-right: 5px; }
mark { background: color-mix(in srgb, var(--seal) 22%, transparent); color: inherit; border-radius: 2px; padding: 0 1px; }

/* ---- vocab ---- */
.quiz-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; align-items: center;
  text-align: center;
}
.quiz-head { display: flex; align-items: center; gap: 10px; color: var(--sub); font-size: 0.85rem; align-self: flex-start; }
.quiz-word {
  background: none; border: none; cursor: pointer;
  font-family: "Noto Serif SC", serif; font-weight: 900;
  font-size: clamp(2rem, 7vw, 3.2rem); line-height: 1.3; padding: 6px 12px;
}
.quiz-word:focus-visible { outline: 2px solid var(--seal); outline-offset: 4px; border-radius: 8px; }
.quiz-answer { display: flex; flex-direction: column; gap: 2px; }
.quiz-answer .py { color: var(--seal); font-style: italic; font-weight: 700; }
.quiz-answer .ko { font-size: 1.05rem; }
.quiz-actions { display: flex; gap: 8px; }
.btn {
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 18px; cursor: pointer; font-size: 0.9rem;
}
.btn:hover { border-color: var(--sub); }
.btn.primary { background: var(--seal); border-color: var(--seal); color: #fff; font-weight: 700; }
.btn:focus-visible { outline: 2px solid var(--seal); outline-offset: 2px; }

.tablewrap {
  overflow-x: auto; border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); max-height: 600px; overflow-y: auto;
}
table { border-collapse: collapse; width: 100%; min-width: 520px; }
th, td { text-align: left; padding: 8px 16px; }
thead th {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--sub); border-bottom: 1px solid var(--line); font-weight: 500;
  position: sticky; top: 0; background: var(--card); z-index: 1;
}
tbody tr + tr td { border-top: 1px solid var(--line); }
td.zh { font-family: "Noto Serif SC", serif; font-size: 1.1rem; font-weight: 700; white-space: nowrap; }
td.py { color: var(--sub); font-style: italic; white-space: nowrap; }
td.date { color: var(--sub); font-size: 0.85rem; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---- fix list ---- */
.fix-list { display: flex; flex-direction: column; gap: 10px; }
.fix-item {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 18px; display: flex; flex-direction: column; gap: 4px;
}
.fix-item .pair { font-family: "Noto Serif SC", serif; font-size: 1.15rem; font-weight: 700; line-height: 1.6; }
.fix-item .pair .bad { opacity: 0.45; text-decoration: line-through; margin-right: 8px; }
.fix-item .pair .arrow { color: var(--sub); font-family: "IBM Plex Sans KR", sans-serif; font-weight: 400; margin-right: 8px; }
.fix-item .pair .good { color: var(--seal); }
.fix-item .why { color: var(--sub); font-size: 0.88rem; }
.fix-item .src { color: var(--sub); font-size: 0.78rem; font-variant-numeric: tabular-nums; }

footer {
  border-top: 1px solid var(--line);
  color: var(--sub); font-size: 0.82rem;
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  max-width: 880px; margin: 0 auto; padding: 18px 20px 40px;
}
