:root {
  --canvas: #f6f8f3;
  --surface: #ffffff;
  --surface-2: #f3f6ef;
  --line: #e3e9dc;
  --ink: #1d2a1f;
  --ink-2: #5b6a5d;
  --ink-3: #8a978c;
  --brand: #3fa34d;
  --brand-ink: #1c4d24;
  --brand-ledge: #2c7a37;
  --brand-soft: #e4f3e2;
  --c-mean: #1f5fa8;
  --c-sent: #2e8b3e;
  --c-nu: #c0392b;
  --c-ex: #8e44ad;
  --sent-text: #1f5fa8;
  --sent-strong: #0b3d75;
  --shadow: 0 1px 2px rgba(40, 70, 40, .06), 0 8px 24px rgba(40, 80, 40, .08);
  --radius: 20px;
  --radius-sm: 14px;
  --bar-h: 112px;
  --font: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Segoe UI", sans-serif;
  --font-word: ui-rounded, "SF Pro Rounded", -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  --a-again: #d64535; --a-again-bg: #fdecea;
  --a-hard: #c77800;  --a-hard-bg: #fff3e0;
  --a-good: #2e8b3e;  --a-good-bg: #e6f4e7;
  --a-easy: #1f6fc0;  --a-easy-bg: #e7f0fb;
}
@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #121611; --surface: #1b2119; --surface-2: #222a20; --line: #2f392d;
    --ink: #e9efe6; --ink-2: #aab6a8; --ink-3: #7d897b;
    --brand: #4fb85d; --brand-ink: #c9efc9; --brand-ledge: #2e7a38; --brand-soft: #1f3320;
    --c-mean: #3b7fd0; --c-sent: #3a9e4b; --c-nu: #d0503f; --c-ex: #a35cc4;
    --sent-text: #86b9f0; --sent-strong: #b9d8ff;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
    --a-again: #ff8a7a; --a-again-bg: #3a201d;
    --a-hard: #ffb74d;  --a-hard-bg: #3a2d17;
    --a-good: #7fd28a;  --a-good-bg: #1e3321;
    --a-easy: #8fc0f5;  --a-easy-bg: #1b2a3c;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: radial-gradient(1200px 500px at 50% -200px, var(--brand-soft), transparent 70%), var(--canvas);
  background-attachment: fixed;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  line-height: 1.6;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.icon { width: 22px; height: 22px; flex: none; }

.wrap {
  max-width: 560px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 12px) calc(env(safe-area-inset-right) + 18px) calc(env(safe-area-inset-bottom) + 32px) calc(env(safe-area-inset-left) + 18px);
}

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 19px; color: var(--brand-ink); letter-spacing: -.02em; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 12px; background: var(--brand-soft); font-size: 20px; }
.icon-btn {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px;
  border: 0; background: transparent; color: var(--ink-2);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.user-chip { display: flex; align-items: center; gap: 4px; color: var(--ink-2); font-size: 14px; }

/* ---------- buttons (3D ledge) ---------- */
.btn {
  --face: var(--brand); --ledge: var(--brand-ledge); --text: #fff;
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 22px; border: 0; border-radius: 16px;
  background: var(--face); color: var(--text); font-weight: 800; font-size: 17px;
  box-shadow: 0 4px 0 var(--ledge);
  transform: translateY(0); transition: transform .08s ease;
  margin-bottom: 4px;
}
.btn:hover { filter: brightness(1.04); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ledge); }
.btn[disabled] { --face: var(--surface-2); --ledge: var(--line); --text: var(--ink-3); cursor: default; }
.btn[disabled]:active { transform: none; box-shadow: 0 4px 0 var(--ledge); }
.btn-block { width: 100%; }
.btn-soft { --face: var(--surface); --ledge: var(--line); --text: var(--brand-ink); border: 1.5px solid var(--line); }
.link-btn { border: 0; background: none; color: var(--ink-3); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; padding: 8px; min-height: 44px; }
.link-btn:hover { color: var(--ink-2); }

/* ---------- login ---------- */
.login { min-height: calc(100dvh - 60px); display: grid; place-items: center; }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 24px; box-shadow: var(--shadow); padding: 36px 26px 26px; text-align: center; }
.login-logo { width: 76px; height: 76px; margin: 0 auto 14px; border-radius: 24px; display: grid; place-items: center; font-size: 42px; background: var(--brand-soft); }
.login-card h1 { margin: 0; font-size: 28px; letter-spacing: -.03em; color: var(--brand-ink); }
.login-card .tagline { margin: 4px 0 26px; color: var(--ink-2); font-size: 15px; }
.field { display: block; text-align: left; margin-bottom: 14px; }
.field span { display: block; font-size: 13px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
.field input {
  width: 100%; height: 52px; padding: 0 16px; border-radius: 14px;
  border: 1.5px solid var(--line); background: var(--surface-2); font-size: 17px;
}
.field input:focus { outline: none; border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 4px var(--brand-soft); }
.form-error { min-height: 22px; color: var(--a-again); font-size: 14px; font-weight: 600; margin: 2px 0 8px; }
.hint { margin-top: 14px; font-size: 13px; color: var(--ink-3); }
.hint code { background: var(--surface-2); padding: 2px 6px; border-radius: 6px; font-family: ui-monospace, Menlo, monospace; color: var(--ink-2); }

/* ---------- study ---------- */
.study-head { position: sticky; top: 0; z-index: 5; padding: calc(env(safe-area-inset-top) + 8px) 0 10px; background: linear-gradient(var(--canvas) 75%, transparent); margin: 0 -4px; }
.study-row { display: flex; align-items: center; gap: 8px; }
.study-title { flex: 1; min-width: 0; font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.study-count { font-weight: 800; font-variant-numeric: tabular-nums; font-size: 15px; padding-right: 6px; }
.study-head .progress { margin: 6px 4px 0; height: 8px; }
.requeue { font-size: 12px; color: var(--a-again); font-weight: 700; padding: 0 4px; min-height: 18px; }

.card-stage { perspective: 1400px; }
.card {
  background: var(--surface); border-radius: 24px; box-shadow: var(--shadow);
  transform-origin: center; will-change: transform;
}
.card.enter { animation: cardIn .32s cubic-bezier(.2,.8,.2,1); }
@keyframes cardIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }

.front {
  position: relative; min-height: min(62dvh, 520px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  padding: 28px 20px; text-align: center;
}
.flip-hit { position: absolute; inset: 0; border: 0; background: transparent; border-radius: 24px; }
.flip-hit:focus-visible { outline-offset: -3px; }
.pos-chip { font-size: 13px; font-weight: 700; color: var(--ink-2); background: var(--surface-2); padding: 3px 10px; border-radius: 999px; }
.word { font-family: var(--font-word); font-size: clamp(40px, 12vw, 60px); font-weight: 800; letter-spacing: -.02em; line-height: 1.1; overflow-wrap: anywhere; margin: 0; }
.speak {
  position: relative; z-index: 2;
  width: 52px; height: 52px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-ink);
}
.speak .icon { width: 24px; height: 24px; }
.speak.sm { width: 44px; height: 44px; background: transparent; color: var(--c-sent); margin: -10px -10px -10px auto; }
.speak.sm .icon { width: 22px; height: 22px; }
.speak.speaking { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.1); } }
.flip-hint { position: absolute; bottom: 22px; left: 0; right: 0; color: var(--ink-3); font-size: 14px; pointer-events: none; }
.flip-hint kbd { font-family: inherit; font-size: 12px; border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; }
@media (hover: none) { .flip-hint kbd { display: none; } }

.back { padding: 22px 18px 18px; }
.back-head { display: flex; align-items: baseline; justify-content: center; gap: 8px; margin-bottom: 14px; }
.back-head .word { font-size: 34px; }
.back-head .pos { color: var(--ink-3); font-size: 14px; }
.illust { display: block; width: 100%; max-width: 280px; aspect-ratio: 1; margin: 0 auto 16px; border-radius: 18px; background: #fff; object-fit: cover; outline: 1px solid var(--line); outline-offset: -1px; }
.sec { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 12px; }
.sec-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.chip { display: inline-block; color: #fff; font-size: 12px; font-weight: 800; padding: 2px 9px; border-radius: 6px; }
.chip.mean { background: var(--c-mean); } .chip.sent { background: var(--c-sent); }
.chip.nu { background: var(--c-nu); } .chip.ex { background: var(--c-ex); }
.wb-badge { font-size: 12px; font-weight: 700; color: var(--c-mean); background: color-mix(in srgb, var(--c-mean) 12%, transparent); padding: 2px 8px; border-radius: 999px; }
.meaning { font-size: 23px; font-weight: 800; letter-spacing: -.02em; line-height: 1.4; }
.sentence { font-size: 18px; font-style: italic; color: var(--sent-text); line-height: 1.5; }
.sentence b { color: var(--sent-strong); }
.sentence-ko { font-size: 14px; color: var(--ink-3); margin-top: 4px; }
.nuance { font-size: 15px; line-height: 1.8; color: var(--ink); }
.nuance.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.more { display: inline-flex; align-items: center; gap: 2px; margin-top: 4px; border: 0; background: none; color: var(--c-nu); font-weight: 700; font-size: 14px; padding: 6px 0; min-height: 36px; }
.more .icon { width: 18px; height: 18px; transition: transform .2s; }
.more[aria-expanded="true"] .icon { transform: rotate(180deg); }
.ex-line .ex-word { font-weight: 800; }
.ex-line .pos { color: var(--ink-3); font-size: 13px; margin: 0 4px; }
.ex-sent { font-style: italic; color: var(--sent-text); margin-top: 4px; }
.ex-sent b { color: var(--sent-strong); }
.spacer { height: calc(var(--bar-h) + env(safe-area-inset-bottom)); }

/* ---------- answer bar ---------- */
.answer-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  padding: 12px calc(env(safe-area-inset-right) + 14px) calc(env(safe-area-inset-bottom) + 14px) calc(env(safe-area-inset-left) + 14px);
  background: color-mix(in srgb, var(--canvas) 86%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  transform: translateY(110%); transition: transform .25s cubic-bezier(.2,.8,.2,1);
}
.answer-bar.show { transform: none; }
.answers { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ans {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 64px; padding: 6px 2px; border-radius: 14px; border: 0;
  background: var(--bg); color: var(--fg);
  box-shadow: 0 3px 0 color-mix(in srgb, var(--fg) 35%, transparent);
  transition: transform .08s ease; margin-bottom: 3px;
}
.ans:active { transform: translateY(2px); box-shadow: 0 1px 0 color-mix(in srgb, var(--fg) 35%, transparent); }
.ans small { font-size: 12px; font-weight: 600; opacity: .85; font-variant-numeric: tabular-nums; }
.ans span { font-size: 16px; font-weight: 800; }
.ans.again { --fg: var(--a-again); --bg: var(--a-again-bg); }
.ans.hard  { --fg: var(--a-hard);  --bg: var(--a-hard-bg); }
.ans.good  { --fg: var(--a-good);  --bg: var(--a-good-bg); }
.ans.easy  { --fg: var(--a-easy);  --bg: var(--a-easy-bg); }

/* ---------- done ---------- */
.done { text-align: center; padding-top: 24px; }
.sprout { width: 140px; height: 150px; margin: 0 auto 6px; position: relative; }
.sprout .pot { position: absolute; bottom: 0; left: 35px; width: 70px; height: 46px; background: #c97b4a; border-radius: 6px 6px 18px 18px; }
.sprout .pot::before { content: ""; position: absolute; top: -8px; left: -6px; right: -6px; height: 14px; background: #b46a3c; border-radius: 6px; }
.sprout .stem { position: absolute; bottom: 52px; left: 67px; width: 6px; height: 64px; background: var(--brand); border-radius: 3px; transform-origin: bottom; animation: grow .7s .1s cubic-bezier(.2,.8,.2,1) both; }
.sprout .leaf { position: absolute; width: 38px; height: 22px; background: var(--brand); border-radius: 22px 0; top: 34px; transform-origin: right bottom; animation: leafL .5s .7s cubic-bezier(.3,1.6,.5,1) both; left: 32px; }
.sprout .leaf.r { left: 72px; border-radius: 0 22px; transform-origin: left bottom; animation-name: leafR; background: #5cc06a; }
@keyframes grow { from { transform: scaleY(0); } }
@keyframes leafL { from { transform: scale(0) rotate(30deg); } to { transform: rotate(-8deg); } }
@keyframes leafR { from { transform: scale(0) rotate(-30deg); } to { transform: rotate(8deg); } }
.done h2 { margin: 6px 0 2px; font-size: 28px; letter-spacing: -.03em; color: var(--brand-ink); }
.done .sub { margin: 0 0 22px; color: var(--ink-2); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 14px 6px; }
.stat b { display: block; font-size: 24px; font-variant-numeric: tabular-nums; }
.stat small { color: var(--ink-2); font-size: 13px; }
.missed { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 16px; text-align: left; margin-bottom: 18px; }
.missed h3 { margin: 0 0 10px; font-size: 15px; }
.word-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.word-chip { background: var(--a-again-bg); color: var(--a-again); font-weight: 700; padding: 5px 12px; border-radius: 999px; font-size: 15px; }
.done-actions { display: grid; gap: 10px; }

#confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 50; }
#confetti i { position: absolute; top: -20px; width: 9px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); opacity: .6; } }

.empty { text-align: center; color: var(--ink-2); padding: 40px 0; }

@media (min-width: 720px) {
  .wrap { padding-top: 24px; }
  .front { min-height: 460px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
  #confetti { display: none; }
}

/* ---------- app shell: tabs ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 8;
  display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 6px calc(env(safe-area-inset-right) + 8px) calc(env(safe-area-inset-bottom) + 6px) calc(env(safe-area-inset-left) + 8px);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tab { text-decoration: none; border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 1px; min-height: 52px; font-size: 12px; font-weight: 700; color: var(--ink-3); border-radius: 12px; }
.tab .ti { font-size: 21px; line-height: 1.2; filter: grayscale(1) opacity(.6); }
.tab[aria-current="page"] { color: var(--brand-ink); background: var(--brand-soft); }
.tab[aria-current="page"] .ti { filter: none; }
.with-tabs { padding-bottom: calc(env(safe-area-inset-bottom) + 150px); }

/* ---------- today summary ---------- */
.today { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 16px 16px 18px; margin: 4px 0 18px; }
.today h3 { margin: 0; font-size: 16px; }
.today p { margin: 2px 0 0; color: var(--ink-2); font-size: 13px; }
.goal { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-top: 8px; }
.goal > i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), #8fd16b); transform-origin: left; }
.today .btn { min-height: 46px; padding: 0 16px; font-size: 15px; }

/* ---------- compact pack list ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 2px 8px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 3px; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 9px; font-size: 13px; font-weight: 700; color: var(--ink-2); min-height: 34px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.month { margin-top: 14px; }
.month-head { display: flex; align-items: center; gap: 6px; width: 100%; border: 0; background: none; padding: 6px 4px; font-size: 13px; font-weight: 800; color: var(--ink-2); }
.month-head .icon { width: 18px; height: 18px; transition: transform .2s; }
.month-head[aria-expanded="false"] .icon { transform: rotate(-90deg); }
.plist { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.prow { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 10px; padding: 10px 12px 10px 12px; border-top: 1px solid var(--line); cursor: pointer; }
.prow:first-child { border-top: 0; }
.prow.sub { padding-left: 34px; background: color-mix(in srgb, var(--surface-2) 60%, var(--surface)); }
.prow.sel { background: var(--brand-soft); }
.prow input { width: 22px; height: 22px; accent-color: var(--brand); margin: 0; }
.pname { font-weight: 700; font-size: 15px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pname .rtag { font-size: 11px; font-weight: 800; color: var(--a-hard); background: var(--a-hard-bg); border-radius: 999px; padding: 1px 6px; margin-right: 4px; vertical-align: 1px; }
.pmeta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.mini { flex: 0 0 64px; height: 5px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.mini > i { display: block; height: 100%; background: var(--brand); transform-origin: left; }
.pdue { text-align: right; min-width: 44px; }
.pdue b { display: block; font-size: 18px; line-height: 1.1; color: var(--brand-ink); font-variant-numeric: tabular-nums; }
.pdue small { font-size: 11px; color: var(--ink-3); }
.pdue.zero b { color: var(--ink-3); font-size: 15px; }
.select-bar {
  position: fixed; left: 0; right: 0; z-index: 9; bottom: calc(env(safe-area-inset-bottom) + 70px);
  display: flex; justify-content: center; padding: 0 14px; pointer-events: none;
  transform: translateY(20px); opacity: 0; transition: transform .2s, opacity .2s;
}
.select-bar.show { transform: none; opacity: 1; }
.select-bar .inner { pointer-events: auto; width: 100%; max-width: 560px; display: grid; grid-template-columns: 1fr auto auto auto; gap: 8px; align-items: center; background: var(--ink); color: var(--canvas); border-radius: 18px; padding: 8px 8px 8px 16px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.select-bar .count { font-weight: 800; font-size: 14px; }
.select-bar .btn { min-height: 44px; padding: 0 14px; font-size: 15px; margin-bottom: 4px; }
.select-bar .btn-soft { --face: transparent; --ledge: transparent; --text: var(--canvas); border-color: color-mix(in srgb, var(--canvas) 30%, transparent); }

/* ---------- extra examples on card back ---------- */
.more-ex { border-top: 1px dashed var(--line); margin-top: 10px; padding-top: 8px; display: grid; gap: 8px; }
.more-ex .sentence { font-size: 16px; }

/* ---------- wrong note ---------- */
.wn-list { display: grid; gap: 10px; }
.wn { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 10px 14px 10px 10px; }
.wn img, .wn .noimg { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; background: var(--surface-2); }
.wn b { font-size: 17px; }
.wn p { margin: 0; font-size: 13px; color: var(--ink-2); }
.wn .cnt { font-size: 12px; font-weight: 800; color: var(--a-again); background: var(--a-again-bg); border-radius: 999px; padding: 2px 8px; }

/* ---------- stats ---------- */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 14px 16px; }
.kpi small { display: block; color: var(--ink-2); font-size: 12px; font-weight: 700; }
.kpi b { font-size: 24px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi span { font-size: 13px; color: var(--ink-3); margin-left: 3px; }
.panel { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.panel h3 { margin: 0 0 12px; font-size: 15px; }
.bars { display: grid; grid-template-columns: repeat(28, 1fr); gap: 3px; align-items: end; height: 110px; }
.bars i { display: block; background: var(--brand); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .85; }
.bars i.zero { background: var(--surface-2); }
.bars i.today { background: var(--brand-ink); }
.bars-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-3); margin-top: 6px; }
.prow-stat { display: grid; grid-template-columns: 1fr 90px 46px; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.prow-stat:first-of-type { border-top: 0; }
.prow-stat .mini { flex: none; width: 100%; }
.prow-stat em { font-style: normal; text-align: right; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.goal-edit { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); }
.goal-edit input { width: 72px; height: 40px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface-2); padding: 0 10px; font-size: 16px; }
.toast { position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 14px); transform: translateX(-50%); z-index: 60; background: var(--ink); color: var(--canvas); padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 700; box-shadow: 0 8px 24px rgba(0,0,0,.2); }

.brand-mark { overflow: hidden; padding: 0; background: none; }
.brand-mark img { width: 100%; height: 100%; object-fit: cover; display: block; }
.login-logo { overflow: hidden; width: 96px; height: 96px; border-radius: 22px; box-shadow: var(--shadow); background: none; }
.login-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }

@media (max-width: 520px) {
  .select-bar .inner { grid-template-columns: repeat(3, 1fr); padding: 10px; }
  .select-bar .count { grid-column: 1 / -1; padding-left: 4px; }
  .select-bar .btn { padding: 0 8px; font-size: 14px; }
}

/* ---------- 빠른학습 ---------- */
.q-wrap { max-width: 1200px; padding-bottom: calc(env(safe-area-inset-bottom) + 96px); }
.q-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 8px 2px 0; }
.q-chip { border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 0 12px; min-height: 34px; font-size: 13px; font-weight: 700; }
.q-chip:hover { border-color: var(--brand); }
.q-time { margin-left: auto; font-variant-numeric: tabular-nums; font-size: 13px; }
.q-hint { font-size: 13px; margin: 6px 4px 10px; }
.q-grid { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: var(--gap, 10px); }
.qcard { position: relative; height: var(--card-h, 230px); perspective: 900px; cursor: pointer; transition: transform .22s, opacity .22s; }
.qcard.leaving { transform: scale(.6); opacity: 0; }
.qface { position: absolute; inset: 0; border-radius: 16px; backface-visibility: hidden; -webkit-backface-visibility: hidden; transition: transform .35s cubic-bezier(.2,.8,.2,1); box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 10px; text-align: center; }
.qfront { background: var(--surface); }
.qback { background: var(--surface); transform: rotateY(180deg); justify-content: space-between; gap: 4px; padding: 8px; }
.qcard.flipped .qfront { transform: rotateY(-180deg); }
.qcard.flipped .qback { transform: rotateY(0); }
.qcard.wrong .qfront { box-shadow: 0 0 0 2.5px var(--a-again), var(--shadow); }
.qcard.flipped .qback { box-shadow: 0 0 0 2.5px var(--brand), 0 10px 28px rgba(40, 80, 40, .18); }
.q-pos { font-size: 11px; font-weight: 700; color: var(--ink-3); }
.q-word { font-family: var(--font-word); font-size: clamp(20px, 5.4vw, 28px); line-height: 1.15; overflow-wrap: break-word; hyphens: auto; max-width: 100%; margin: 4px 0 6px; }
.q-word.long { font-size: clamp(17px, 4.4vw, 23px); }
.q-word.xlong { font-size: clamp(15px, 3.8vw, 19px); }
.q-word.ko { font-family: var(--font); font-size: clamp(15px, 4.2vw, 19px); }
.q-say { border: 0; background: var(--brand-soft); color: var(--brand-ink); width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; }
.q-say .icon { width: 20px; height: 20px; }
.q-say.inline { width: 30px; height: 30px; display: inline-grid; vertical-align: middle; margin-left: 4px; }
.q-say.speaking { animation: pulse 1s ease-in-out infinite; }
.q-img { height: 52%; max-height: 150px; width: auto; aspect-ratio: 1; object-fit: cover; border-radius: 12px; background: #fff; flex: 0 0 auto; }
.q-noimg { display: grid; place-items: center; font-family: var(--font-word); font-size: 44px; font-weight: 800; color: var(--brand-ink); background: var(--brand-soft); }
.q-ans { flex: 0 0 auto; font-weight: 800; font-size: 14px; line-height: 1.3; max-height: 2.6em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.q-ans:not(.ko) { font-family: var(--font-word); font-size: 18px; }
.q-o { flex: 0 0 auto; width: 100%; min-height: 40px; border: 0; border-radius: 12px; font-weight: 900; font-size: 18px; background: var(--a-good-bg); color: var(--a-good); }
.q-table { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.q-tr { display: grid; grid-template-columns: 52px minmax(0, 1fr) minmax(0, 1.15fr) 44px 48px; gap: 8px; align-items: center; padding: 8px 10px; border-top: 1px solid var(--line); }
.q-table.noimg .q-tr { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) 44px 48px; }
.q-table.noimg .q-c-img { display: none; }
.q-th { border-top: 0; font-size: 12px; font-weight: 700; color: var(--ink-3); padding-top: 10px; padding-bottom: 6px; }
.q-tr .c { text-align: center; display: grid; place-items: center; }
.q-tr.wrong { background: var(--a-again-bg); }
.q-thumb { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: #fff; display: block; }
.q-thumb.q-noimg { font-size: 22px; }
.q-hintcell { font-family: var(--font-word); font-weight: 800; font-size: clamp(14px, 3.9vw, 17px); overflow-wrap: break-word; word-break: keep-all; min-width: 0; }
.q-hintcell.ko { font-family: var(--font); font-size: 14px; font-weight: 700; }
.q-maskcell { position: relative; min-height: 44px; display: flex; align-items: center; border-radius: 10px; padding: 4px 8px; }
.q-maskcell canvas { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 10px; touch-action: none; cursor: crosshair; }
.q-masked { font-size: 14px; line-height: 1.35; }
.q-masked:not(.ko) { font-family: var(--font-word); font-weight: 800; font-size: 16px; }
.q-maskcell.open { background: var(--brand-soft); }
.q-wrongbox { width: 22px; height: 22px; accent-color: var(--a-again); }
.q-tr .q-say { width: 36px; height: 36px; }
.q-finish { position: fixed; left: 0; right: 0; bottom: 0; z-index: 9; padding: 10px 14px calc(env(safe-area-inset-bottom) + 12px); background: color-mix(in srgb, var(--canvas) 88%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
.q-finish .btn { max-width: 560px; margin: 0 auto; display: flex; }
@media (prefers-reduced-motion: reduce) { .qface, .qcard { transition: none; } }

.study-sub { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 22px; padding: 0 4px; }
.speak-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--ink-2); cursor: pointer; user-select: none; white-space: nowrap; }
.speak-toggle input { width: 18px; height: 18px; accent-color: var(--brand); margin: 0; }
.q-chip.speak-toggle { padding: 0 12px; }

/* ---------- 반응형: 태블릿·PC ---------- */
@media (min-width: 768px) {
  .wrap { max-width: 820px; }
  .with-tabs { padding-bottom: calc(env(safe-area-inset-bottom) + 120px); }
  .tabbar { max-width: 820px; margin: 0 auto; border: 1px solid var(--line); border-bottom: 0; border-radius: 20px 20px 0 0; }
  .select-bar .inner { max-width: 680px; }
  .page-head h2 { font-size: 30px; }
  .pname { font-size: 16px; }
  .prow { padding: 12px 16px; }
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .wn-list { grid-template-columns: repeat(2, 1fr); }
  .stats-panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
  .stats-panels .panel { margin-bottom: 0; }
  .study-wrap .card.front { max-width: 640px; margin: 0 auto; }
  .back-head .word { font-size: 40px; }
  .meaning { font-size: 26px; }
  .sentence { font-size: 20px; }
}

/* 넓은 화면(가로 태블릿·PC): 카드 뒷면을 그림 | 내용 두 칸으로 → 스크롤 없이 보고 바로 답하기 */
@media (min-width: 900px) {
  .study-wrap { max-width: 1080px; }
  .study-wrap .card.back {
    display: grid; grid-template-columns: minmax(260px, 38%) minmax(0, 1fr); column-gap: 28px; align-items: start; padding: 24px 28px;
  }
  .study-wrap .card.back .back-head { grid-column: 1; grid-row: 1; justify-content: flex-start; margin-bottom: 12px; }
  .study-wrap .card.back .illust { grid-column: 1; grid-row: 2 / span 8; max-width: 100%; position: sticky; top: 110px; }
  .study-wrap .card.back .sec { grid-column: 2; }
  .study-wrap .card.back .sec:first-of-type { margin-top: 4px; }
  .answers { max-width: 760px; }
  .ans { min-height: 68px; }
}
@media (min-width: 900px) and (max-height: 900px) {
  .study-wrap .card.back .illust { max-height: calc(100dvh - 300px); width: auto; aspect-ratio: 1; }
  .study-wrap .front { min-height: min(56dvh, 460px); }
}
@media (min-width: 768px) { .stats-panels .panel .kpis { grid-template-columns: repeat(2, 1fr); } }

.remember { display: flex; align-items: center; gap: 8px; margin: 2px 2px 4px; font-size: 14px; font-weight: 600; color: var(--ink-2); cursor: pointer; user-select: none; text-align: left; }
.remember input { width: 20px; height: 20px; accent-color: var(--brand); margin: 0; }

/* 빠른학습: 고정 헤더 아래로 내용이 비치지 않게 */
.q-head { background: var(--canvas); padding-bottom: 8px; }
/* 휴대폰 3열 작은 카드 */
.q-grid.compact .qface { padding: 8px 6px; border-radius: 14px; }
.q-grid.compact .q-pos { font-size: 10px; }
.q-grid.compact .q-word { font-size: 17px; margin: 2px 0 4px; }
.q-grid.compact .q-word.long { font-size: 14px; }
.q-grid.compact .q-word.xlong { font-size: 12.5px; }
.q-grid.compact .q-word.ko { font-size: 13px; }
.q-grid.compact .q-say { width: 34px; height: 34px; }
.q-grid.compact .q-say .icon { width: 17px; height: 17px; }
.q-grid.compact .qback { padding: 6px; gap: 3px; }
.q-grid.compact .q-img { height: 48%; border-radius: 9px; }
.q-grid.compact .q-noimg { font-size: 30px; }
.q-grid.compact .q-ans { font-size: 12px; }
.q-grid.compact .q-o { min-height: 32px; font-size: 16px; border-radius: 10px; }
.q-grid.compact .qcard.flipped .qback { box-shadow: 0 0 0 2px var(--brand), 0 8px 20px rgba(40, 80, 40, .16); }
.q-tools { row-gap: 8px; }

/* 2열/3열 선택은 휴대폰에서만 */
@media (min-width: 600px) { .q-colseg { display: none; } }

/* ---------- 빠른학습: 미리보기 ---------- */
.pv-list { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 720px) { .pv-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .pv-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.pv-item { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 12px; align-items: start; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 10px 12px 10px 10px; transition: box-shadow .2s, transform .2s; }
.pv-item.playing { box-shadow: 0 0 0 2.5px var(--brand), var(--shadow); transform: scale(1.01); }
.pv-item.done { opacity: .6; }
.pv-img { padding: 0; border: 0; background: none; border-radius: 12px; overflow: hidden; width: 84px; height: 84px; cursor: zoom-in; }
.pv-thumb { width: 84px; height: 84px; object-fit: cover; display: block; background: #fff; border-radius: 12px; }
.pv-thumb.q-noimg { font-size: 34px; }
.pv-top { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.pv-word { border: 0; background: none; padding: 0; font-family: var(--font-word); font-size: 22px; font-weight: 800; color: var(--ink); cursor: pointer; text-align: left; overflow-wrap: break-word; }
.pv-word:hover { color: var(--brand-ink); }
.pv-pos { font-size: 12px; font-weight: 700; color: var(--ink-3); }
.pv-ok { font-size: 11px; font-weight: 800; color: var(--a-good); background: var(--a-good-bg); border-radius: 999px; padding: 1px 7px; }
.pv-mean { font-size: 16px; font-weight: 800; line-height: 1.35; margin-top: 2px; }
.pv-sent { font-size: 14px; font-style: italic; color: var(--sent-text); line-height: 1.45; margin-top: 6px; }
.pv-sent b { color: var(--sent-strong); }
.pv-ko { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.pv-pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 16px 0 4px; font-size: 13px; }
.pv-pager .q-chip[disabled] { opacity: .4; }
.q-chip[aria-pressed="true"] { border-color: var(--brand); color: var(--brand-ink); }
.pv-zoom { position: fixed; inset: 0; z-index: 70; background: rgba(10, 18, 10, .7); display: grid; place-items: center; padding: 24px; cursor: zoom-out; }
.pv-zoom figure { margin: 0; background: var(--surface); border-radius: 20px; padding: 14px; max-width: min(92vw, 520px); box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.pv-zoom img { width: 100%; height: auto; display: block; border-radius: 14px; background: #fff; }
.pv-zoom figcaption { text-align: center; margin-top: 10px; font-size: 16px; }
.pv-zoom figcaption b { font-family: var(--font-word); font-size: 22px; margin-right: 6px; }

/* ---------- 미리보기 쇼츠 (위로 넘기며 외우기) ---------- */
body.sh-open { overflow: hidden; }
.sh { position: fixed; inset: 0; z-index: 80; background: #10150f; color: #f1f5ee; }
.sh-top { position: absolute; top: 0; left: 0; right: 0; z-index: 2; display: flex; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 10px) 14px 10px; background: linear-gradient(#10150fe6, #10150f00); pointer-events: none; }
.sh-top > * { pointer-events: auto; }
.sh-pos { font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums; background: #ffffff1f; padding: 4px 12px; border-radius: 999px; }
.sh-sp { flex: 1; }
.sh-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: #ffffff1f; color: #fff; font-size: 18px; display: grid; place-items: center; }
.sh-scroll { height: 100dvh; overflow-y: scroll; scroll-snap-type: y mandatory; overscroll-behavior: contain; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.sh-scroll::-webkit-scrollbar { display: none; }
.sh-slide { position: relative; height: 100dvh; scroll-snap-align: start; scroll-snap-stop: always; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: calc(env(safe-area-inset-top) + 70px) 22px calc(env(safe-area-inset-bottom) + 28px); text-align: center; }
.sh-art { width: min(82vw, 46dvh, 440px); aspect-ratio: 1; border-radius: 22px; overflow: hidden; background: #fff; box-shadow: 0 16px 50px #0008; flex: none; }
.sh-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sh-noimg { width: 100%; height: 100%; font-size: 90px; }
.sh-word { border: 0; background: none; color: #fff; font-family: var(--font-word); font-size: clamp(32px, 9vw, 46px); font-weight: 800; line-height: 1.1; padding: 4px 8px; margin-top: 6px; cursor: pointer; overflow-wrap: anywhere; }
.sh-word small { font-family: var(--font); font-size: 14px; font-weight: 700; color: #ffffff8c; margin-left: 4px; }
.sh-mean { font-size: clamp(19px, 5.4vw, 24px); font-weight: 800; line-height: 1.35; max-width: 560px; }
.sh-sent { font-size: 16px; font-style: italic; color: #a9cff5; line-height: 1.45; max-width: 560px; margin-top: 4px; }
.sh-sent b { color: #d7ebff; }
.sh-ko { font-size: 13.5px; color: #ffffff99; max-width: 560px; }
.sh-o { margin-top: 10px; min-width: 200px; min-height: 50px; border: 0; border-radius: 999px; background: #3fa34d; color: #fff; font-size: 17px; font-weight: 900; box-shadow: 0 4px 0 #2c7a37; }
.sh-o:active { transform: translateY(2px); box-shadow: 0 2px 0 #2c7a37; }
.sh-o.done { background: #ffffff1f; box-shadow: none; color: #b9e7bf; }
.sh-hint { position: absolute; bottom: calc(env(safe-area-inset-bottom) + 10px); left: 0; right: 0; font-size: 13px; font-weight: 700; color: #ffffff8c; animation: shHint 1.6s ease-in-out infinite; }
@keyframes shHint { 50% { transform: translateY(-6px); opacity: .6; } }
@media (max-height: 640px) { .sh-sent, .sh-ko { display: none; } }
@media (prefers-reduced-motion: reduce) { .sh-hint { animation: none; } }
