:root {
  --bg: #f6f7f9; --card: #ffffff; --text: #1c1f24; --muted: #6b7280; --line: #e5e7eb;
  --accent: #2563eb; --accent-2: #1d4ed8; --ok: #16a34a; --bad: #dc2626; --warn: #d97706;
  --soft: #eef2ff; --radius: 14px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.04);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1115; --card: #171a21; --text: #e7e9ee; --muted: #9aa3b2; --line: #262b35;
          --accent: #60a5fa; --accent-2: #3b82f6; --soft: #1e2433; --shadow: none; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", Roboto, sans-serif;
  font-size: 16px; line-height: 1.5; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.25; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.wrap { max-width: 860px; margin: 0 auto; padding: 1rem; }

/* nav */
.nav { position: sticky; top: 0; z-index: 10; background: var(--card); border-bottom: 1px solid var(--line); }
.nav .wrap { display: flex; align-items: center; gap: .75rem; padding: .6rem 1rem; }
.nav .brand { font-weight: 700; font-size: 1.05rem; color: var(--text); white-space: nowrap; }
.nav .links { display: flex; gap: .25rem; margin-left: auto; overflow-x: auto; }
.nav .links a { padding: .35rem .6rem; border-radius: 8px; color: var(--muted); white-space: nowrap; font-size: .92rem; }
.nav .links a.active, .nav .links a:hover { background: var(--soft); color: var(--accent); text-decoration: none; }

/* cards & layout */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.grid { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat { text-align: center; padding: .9rem .5rem; }
.stat .num { font-size: 1.8rem; font-weight: 700; }
.stat .lbl { font-size: .8rem; color: var(--muted); }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.flash { padding: .6rem .9rem; border-radius: 10px; margin-bottom: .8rem; font-size: .95rem; }
.flash.ok { background: #dcfce7; color: #166534; } .flash.error { background: #fee2e2; color: #991b1b; }
@media (prefers-color-scheme: dark) { .flash.ok { background: #14532d; color: #dcfce7; } .flash.error { background: #7f1d1d; color: #fee2e2; } }

/* buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .6rem 1rem; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--text); font-size: 1rem; cursor: pointer; text-decoration: none; }
.btn:hover { text-decoration: none; border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--accent-2); }
.btn.big { padding: .9rem 1.3rem; font-size: 1.1rem; width: 100%; }
.btn.sm { padding: .35rem .7rem; font-size: .88rem; border-radius: 8px; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text); font-size: 1rem; }
label { display: block; font-size: .9rem; color: var(--muted); margin: .6rem 0 .25rem; }
form.inline { display: inline; }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip { padding: .3rem .7rem; border-radius: 999px; background: var(--soft); color: var(--accent); font-size: .85rem; border: 1px solid transparent; }
.chip.active { border-color: var(--accent); font-weight: 600; }
.tag { display: inline-block; white-space: nowrap; padding: .1rem .5rem; border-radius: 6px; font-size: .78rem; background: var(--soft); color: var(--muted); }
.tag.new { background: #e0f2fe; color: #075985; } .tag.learning { background: #fef3c7; color: #92400e; }
.tag.review { background: #dbeafe; color: #1e40af; } .tag.mastered { background: #dcfce7; color: #166534; } .tag.burned { background: #ede9fe; color: #5b21b6; }
.tag.leech { background: #fee2e2; color: #991b1b; }

/* tables/lists */
.card { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: .5rem .4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; color: var(--muted); font-weight: 600; }
.wordlist .hw { font-weight: 600; font-size: 1.05rem; }
.wordlist .mean { color: var(--muted); }
.pager { display: flex; gap: .5rem; justify-content: center; margin: 1rem 0; }

/* progress bar */
.bar { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; display: flex; }
.bar > span { display: block; height: 100%; }
.bar .learning { background: #f59e0b; } .bar .review { background: #3b82f6; } .bar .mastered { background: #22c55e; } .bar .burned { background: #8b5cf6; }
.legend { display: flex; gap: .8rem; flex-wrap: wrap; font-size: .82rem; color: var(--muted); margin-top: .4rem; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; }

/* study */
.study-top { display: flex; align-items: center; gap: .6rem; margin-bottom: .8rem; }
.study-top .progress { flex: 1; height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.study-top .progress > span { display: block; height: 100%; background: var(--accent); transition: width .2s; }
.qcard { min-height: 300px; display: flex; flex-direction: column; }
.qcard .mode { font-size: .8rem; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.qcard .prompt { text-align: center; padding: 1.4rem .5rem 1rem; }
.qcard .prompt .big { font-size: 2rem; font-weight: 700; letter-spacing: .01em; }
.qcard .prompt .mid { font-size: 1.35rem; font-weight: 600; }
.qcard .prompt .pron { color: var(--muted); font-size: 1rem; margin-top: .2rem; }
.qcard .prompt .sentence { font-size: 1.15rem; line-height: 1.6; }
.qcard .prompt .sentence b { color: var(--accent); letter-spacing: .15em; }
.options { display: grid; gap: .5rem; grid-template-columns: 1fr; }
@media (min-width: 560px) { .options { grid-template-columns: 1fr 1fr; } }
.opt { padding: .8rem .9rem; border: 1px solid var(--line); border-radius: 12px; background: var(--card); text-align: left; font-size: 1rem; cursor: pointer; color: var(--text); }
.opt:hover { border-color: var(--accent); }
.opt.correct { border-color: var(--ok); background: #dcfce7; color: #14532d; }
.opt.wrong { border-color: var(--bad); background: #fee2e2; color: #7f1d1d; }
.opt:disabled { cursor: default; }
.typing { display: flex; gap: .5rem; }
.typing input { font-size: 1.15rem; }
.hintline { color: var(--muted); text-align: center; margin: .4rem 0; min-height: 1.4em; }
.hintline .shape { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .25em; font-size: 1.1rem; }
.hintline .hintmean { font-size: .95rem; margin-top: .2rem; }
.typing .btn { white-space: nowrap; }
.feedback { border-top: 1px dashed var(--line); margin-top: 1rem; padding-top: .9rem; }
.feedback .verdict { font-weight: 700; font-size: 1.1rem; }
.feedback .verdict.ok { color: var(--ok); } .feedback .verdict.bad { color: var(--bad); }
.feedback .hw { font-size: 1.5rem; font-weight: 700; }
.feedback ul { margin: .3rem 0 0 1rem; padding: 0; }
.feedback .ex { color: var(--muted); font-size: .92rem; margin-top: .3rem; }
.rate { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; margin-top: .8rem; }
.rate button { padding: .7rem .2rem; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer; }
.rate button small { display: block; color: var(--muted); font-size: .72rem; }
.rate .again { border-color: var(--bad); } .rate .easy { border-color: var(--ok); }
.speak { border: none; background: var(--soft); color: var(--accent); border-radius: 999px; width: 2.4rem; height: 2.4rem; cursor: pointer; font-size: 1.1rem; }
.speak.lg { width: 4.5rem; height: 4.5rem; font-size: 2rem; }
.speak.xs { width: 1.7rem; height: 1.7rem; font-size: .85rem; vertical-align: middle; }
.kbd { font-family: ui-monospace, monospace; font-size: .8rem; color: var(--muted); }
.summary .num { font-size: 2.2rem; font-weight: 800; }
.spark { display: flex; align-items: flex-end; gap: 2px; height: 90px; }
.spark span { flex: 1; background: var(--accent); border-radius: 2px 2px 0 0; min-height: 2px; opacity: .85; }
.spark span.today { background: var(--ok); }
.note-box textarea { min-height: 60px; }
.hidden { display: none !important; }
.center { text-align: center; }
.mt { margin-top: 1rem; } .mb0 { margin-bottom: 0; }
.example-list li { margin-bottom: .35rem; }
.example-list .ko { color: var(--muted); font-size: .92rem; }
