/* 방향: 급수가 오를수록 띠 색이 바뀌는 게임형 학습앱. 화면의 강조색이 지금 공부하는 급수 색을 따라감 */
:root {
  --bg: #EDF2FA;
  --surface: #FFFFFF;
  --ink: #18213B;
  --muted: #5D6883;
  --line: #D5DDEB;
  --seal: #D93A2B;
  --mint: #12A06A;
  --miss: #E0464B;
  --level: #F2A900;          /* 지금 급수 색 (스크립트가 바꿈) */
  --level-deep: #B57E00;
  --level-soft: #FFF4D6;

  --f-display: 'Jua', 'Gowun Dodum', system-ui, sans-serif;
  --f-body: 'Gowun Dodum', 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
  --f-hanja: 'Noto Serif KR', 'Batang', 'AppleMyungjo', serif;

  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--f-body); font-size: 16px; line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}
.wrap { max-width: 520px; margin: 0 auto; padding: 16px 16px 40px; display: flex; flex-direction: column; gap: 20px; }
.inner { padding: 0; }
.hanja { font-family: var(--f-hanja); font-weight: 900; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

/* 상단 */
.top { display: flex; align-items: center; gap: 12px; }
.brand { flex: 1; display: flex; align-items: center; gap: 12px; font-family: var(--f-display); font-size: 1.3rem; letter-spacing: -0.01em; min-width: 0; }
.brand-mark { flex: 0 0 auto; width: 32px; height: 32px; } /* 로고: 붓 */

/* 히어로 */
.hero { position: relative; background: var(--surface); border: 2px solid var(--line); border-radius: 28px; padding: 24px 20px 20px; display: grid; gap: 20px; overflow: hidden; }
.hero-eyebrow { display: block; margin: 0; font-family: var(--f-display); font-size: .875rem; color: var(--level-deep); }
.hero-title { font-family: var(--f-display); font-weight: 400; font-size: clamp(2rem, 8.6vw, 2.6rem); line-height: 1.16; margin: 12px 0 8px; letter-spacing: -0.015em; }
.hero-title mark { color: inherit; background: linear-gradient(transparent 58%, var(--level-soft) 58%); padding: 0 3px; }
.hero-sub { margin: 0; color: var(--muted); font-size: .98rem; max-width: 42ch; }
.hero-cta { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.btn.big { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 16px 12px; }
.btn.big small { font-family: var(--f-body); font-size: .8rem; opacity: .9; }
.hero-prog { margin-top: 20px; display: flex; flex-direction: column; gap: 8px; }
.hp-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: .88rem; color: var(--muted); }
.hp-row b { font-family: var(--f-display); font-weight: 400; color: var(--ink); font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.hero .prog { flex: none; height: 12px; }
.hero-art { position: absolute; right: 16px; top: 18px; }
.stairs { display: none; }
.st { position: relative; height: 24px; width: 52%; margin-left: calc(var(--i) * 4.8%); border-radius: 7px; background: var(--cs); }
.st::before { content: ''; position: absolute; inset: 0 auto 0 0; width: var(--f); background: var(--c); border-radius: 7px; }
.st-l { position: relative; padding-left: 8px; line-height: 24px; font-family: var(--f-display); font-size: .82rem; color: var(--ink); }
.st.full .st-l { color: #fff; }
.st.cur { box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--c); }
.st-now { position: absolute; right: 8px; top: 0; line-height: 24px; font-family: var(--f-display); font-size: .76rem; color: var(--ink); }
.st-b { position: absolute; right: -8px; top: -7px; width: 20px; height: 20px; border-radius: 5px; background: #fff; border: 2px solid var(--seal); color: var(--seal); font-family: var(--f-hanja); font-weight: 900; font-size: .72rem; display: grid; place-items: center; transform: rotate(-10deg); }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 8px 12px; border-radius: 999px; background: var(--surface); border: 2px solid var(--line); font-family: var(--f-display); font-size: .95rem; white-space: nowrap; }
.pill svg { width: 16px; height: 16px; }
.pill:empty { display: none; }

/* 오늘의 10자 */
.today { background: var(--surface); border-radius: 24px; border: 2px solid var(--line); overflow: hidden; }
.today-head { background: var(--level); color: #fff; padding: 16px 20px 12px; display: flex; align-items: flex-end; gap: 12px; position: relative; }
.today-head .lv { font-family: var(--f-display); font-size: 2.2rem; line-height: 1; }
.today-head .sub { font-size: .95rem; opacity: .95; padding-bottom: 3px; }
.today-head .done-seal { position: absolute; right: 14px; top: 10px; }
.today-body { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 16px; }
.today-title { font-family: var(--f-display); font-weight: 400; font-size: 1.15rem; margin: 0; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.today-title small { font-family: var(--f-body); font-size: .9rem; color: var(--muted); text-align: right; }
.chips { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.chip { aspect-ratio: 1; display: grid; place-items: center; border-radius: 14px; background: var(--level-soft); font-size: 1.9rem; color: var(--ink); position: relative; }
.chip.k::after { content: ''; position: absolute; right: 6px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--mint); }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* 누르는 버튼 */
.btn { border-radius: 16px; padding: 16px 12px; font-family: var(--f-display); font-size: 1.1rem; line-height: 1.2; background: var(--surface); border: 2px solid var(--line); transition: transform .08s ease-out; }
.btn:active { transform: scale(.98); }
.btn.main { background: var(--level); color: #fff; border-color: var(--level-deep); }
.btn.ok { background: var(--mint); color: #fff; border-color: #0B7A50; }
.btn.no { background: #fff; color: var(--miss); border-color: #F2B8BA; }
.btn.wide { grid-column: 1 / -1; }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* 복습 */
.rv { background: var(--surface); border-radius: 22px; border: 2px solid var(--line); padding: 16px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.rv-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.rv-head h2 { font-family: var(--f-display); font-weight: 400; font-size: 1.15rem; margin: 0; }
.rv-head small { font-size: .88rem; color: var(--muted); }
.rv-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rv-nums div { background: var(--bg); border-radius: 14px; padding: 8px 12px; }
.rv-nums b { display: block; font-family: var(--f-display); font-weight: 400; font-size: 1.5rem; font-variant-numeric: tabular-nums; line-height: 1.1; }
.rv-nums span { font-size: .82rem; color: var(--muted); }
.rv-nums .due.on b { color: var(--miss); }

/* 급수 지도 */
.sec-title { font-family: var(--f-display); font-weight: 400; font-size: 1.15rem; margin: 0 0 8px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.sec-title small { font-family: var(--f-body); font-size: .88rem; color: var(--muted); }
.map { display: flex; overflow-x: auto; padding: 8px 4px 12px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.station { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 8px; width: 74px; position: relative; scroll-snap-align: center; background: none; border: 0; padding: 0; }
.station::before { content: ''; position: absolute; top: 29px; left: -50%; width: 100%; height: 6px; background: var(--line); z-index: 0; }
.station:first-child::before { display: none; }
.station.passed::before { background: var(--c); }
.dot { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 5px solid var(--c); font-family: var(--f-display); font-size: .98rem; position: relative; z-index: 1; color: var(--ink); }
.station.passed .dot { background: var(--c); color: #fff; }
.station.cur .dot { box-shadow: 0 0 0 4px var(--bg), 0 0 0 7px var(--c); }
.station .cnt { font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* 일차 고르기 */
.days { display: flex; flex-wrap: wrap; gap: 8px; }
.day { min-width: 42px; height: 40px; padding: 0 8px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); font-family: var(--f-display); font-size: .98rem; font-variant-numeric: tabular-nums; }
.day.passed { background: var(--level-soft); border-color: var(--level); color: var(--level-deep); }
.day.cur { background: var(--level); border-color: var(--level-deep); color: #fff; }

.note { font-size: .85rem; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: 14px; padding: 12px 12px; margin: 0; }

/* 학습 화면 공통 */
.bar { display: flex; align-items: center; gap: 12px; }
.bar h2 { font-family: var(--f-display); font-weight: 400; font-size: 1.35rem; margin: 0; }
.backbtn { background: var(--surface); width: 42px; height: 42px; border-radius: 12px; border: 2px solid var(--line); display: grid; place-items: center; flex: 0 0 auto; padding: 0; }
.backbtn svg { width: 20px; height: 20px; }
.prog { flex: 1; height: 14px; background: var(--line); border-radius: 999px; overflow: hidden; }
.prog i { display: block; height: 100%; width: 0; background: var(--level); border-radius: 999px; transition: width .25s; }
.count { font-family: var(--f-display); font-variant-numeric: tabular-nums; min-width: 52px; text-align: right; }
.where { font-size: .9rem; color: var(--muted); margin: -8px 0 0; }

/* 카드 */
.card { display: block; perspective: 1200px; height: min(56vh, 400px); min-height: 300px; cursor: pointer; width: 100%; border-radius: 26px; }
.card-in { position: relative; width: 100%; height: 100%; transition: transform .4s cubic-bezier(.2, .7, .2, 1); transform-style: preserve-3d; }
.card.flip .card-in { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 26px; background: var(--surface); border: 2px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 20px; }
.face.front .big { font-size: clamp(7rem, 34vw, 10rem); line-height: 1; }
.face .hint { position: absolute; bottom: 16px; font-size: .88rem; color: var(--muted); }
.face.rear { transform: rotateY(180deg); background: var(--level-soft); border-color: var(--level); }
.face.rear .mid { font-size: 4.2rem; line-height: 1; }
.face.rear .he { font-family: var(--f-display); font-size: 2rem; text-align: center; line-height: 1.25; white-space: pre-line; }
.face.rear .meta { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.tag { background: var(--surface); border-radius: 999px; padding: 4px 12px; font-size: .9rem; border: 1px solid var(--line); }
.tag .hanja { font-weight: 600; }

/* 쓰기 */
.wbox { position: relative; width: min(100%, 360px); aspect-ratio: 1; margin: 0 auto; background: #fff; border: 3px solid var(--level); border-radius: 20px; overflow: hidden; container-type: inline-size; }
.wbox > * { position: absolute; inset: 0; width: 100%; height: 100%; }
.wgrid line { stroke: var(--level); stroke-opacity: .45; stroke-width: .5; stroke-dasharray: 2 2; }
.wglyph { display: grid; place-items: center; font-size: 76cqw; line-height: 1; color: #CDD4E2; user-select: none; }
.wanim { background: transparent; }
.wcanvas { touch-action: none; cursor: crosshair; }
.wanim.quiz { touch-action: none; cursor: crosshair; }
.wanim.quiz svg { touch-action: none; }
.wdone { pointer-events: none; display: flex; justify-content: flex-end; align-items: flex-start; padding: 12px; }
.wdone .seal { width: 66px; height: 66px; font-size: 2.4rem; animation: stamp .24s cubic-bezier(.2, .7, .2, 1) both; }
.wtop { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: -8px; }
.wtop .where { margin: 0; min-width: 0; }
.seg { display: inline-flex; flex: 0 0 auto; gap: 2px; padding: 3px; background: var(--surface); border: 2px solid var(--line); border-radius: 999px; }
.seg-b { border: 0; background: none; padding: 8px 12px; border-radius: 999px; font-family: var(--f-display); font-size: .92rem; color: var(--muted); }
.seg-b[aria-pressed="true"] { background: var(--level); color: #fff; }
.seg-b[disabled] { opacity: .4; pointer-events: none; }
.wstat { margin: 0; min-height: 1.5em; text-align: center; font-family: var(--f-display); font-size: 1.05rem; color: var(--ink); }
.wstat.good { color: var(--mint); }
.wstat.bad { color: var(--miss); }
.winfo { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.winfo .he { font-family: var(--f-display); font-size: 1.6rem; line-height: 1.2; }
.winfo .mt { font-size: .9rem; color: var(--muted); }
.wnotice { margin: 0; font-size: .88rem; color: var(--level-deep); background: var(--level-soft); border-radius: 12px; padding: 8px 12px; text-align: center; }
.tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tools .btn { font-size: 1rem; padding: 12px 8px; }

/* 퀴즈 */
.q { background: var(--surface); border-radius: 26px; border: 2px solid var(--line); padding: 24px 20px; text-align: center; display: flex; flex-direction: column; gap: 8px; align-items: center; min-height: 190px; justify-content: center; }
.q .ask { font-size: .95rem; color: var(--muted); }
.q .big { font-size: 6.4rem; line-height: 1.05; }
.q .he { font-family: var(--f-display); font-size: 2.2rem; line-height: 1.25; text-wrap: balance; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.opt { min-height: 64px; padding: 12px; font-family: var(--f-display); font-size: 1.12rem; line-height: 1.25; }
.opt.hz { font-family: var(--f-hanja); font-weight: 900; font-size: 2.4rem; min-height: 84px; }
.opt.right { background: var(--mint); color: #fff; border-color: #0B7A50; }
.opt.wrong { background: var(--miss); color: #fff; border-color: #A82A2E; }
.opt.dim { opacity: .5; }
.feedback { min-height: 26px; text-align: center; font-family: var(--f-display); font-size: 1.05rem; }
.feedback.good { color: var(--mint); }
.feedback.bad { color: var(--miss); }

/* 결과 */
.result { background: var(--surface); border-radius: 26px; border: 2px solid var(--line); padding: 28px 20px 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; position: relative; overflow: hidden; }
.score { font-family: var(--f-display); font-size: 3.6rem; line-height: 1; font-variant-numeric: tabular-nums; }
.score small { font-size: 1.6rem; color: var(--muted); }
.result h2 { font-family: var(--f-display); font-weight: 400; font-size: 1.7rem; margin: 4px 0 0; }
.result p { margin: 0; color: var(--muted); max-width: 32ch; }
.misses { width: 100%; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.result .misses { margin-top: 8px; }
.miss { display: flex; align-items: center; gap: 12px; background: #FFF1F1; border-radius: 12px; padding: 8px 12px; }
.miss.later { background: var(--surface); border: 1px solid var(--line); }
.miss .hanja { font-size: 1.9rem; width: 40px; text-align: center; flex: 0 0 auto; }
.miss .mt { margin-left: auto; font-size: .8rem; color: var(--muted); text-align: right; line-height: 1.35; }
.empty { font-size: .92rem; color: var(--muted); padding: 8px 2px; }

/* 도장 */
.seal { width: 92px; height: 92px; border: 5px solid var(--seal); color: var(--seal); border-radius: 14px; display: grid; place-items: center; font-family: var(--f-hanja); font-weight: 900; font-size: 3.4rem; line-height: 1; transform: rotate(-10deg); background: rgba(217, 58, 43, .06); }
.seal.sm { width: 40px; height: 40px; border-width: 3px; border-radius: 8px; font-size: 1.45rem; background: rgba(255,255,255,.92); }
.seal.stamp { animation: stamp .24s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes stamp { from { opacity: 0; transform: scale(1.15) rotate(-10deg); } to { opacity: 1; transform: scale(1) rotate(-10deg); } }
.result.noseal .seal { display: none; }

.loading { text-align: center; padding: 60px 20px; color: var(--muted); font-family: var(--f-display); font-size: 1.2rem; }
.err { background: #FFF1F1; color: #9B1C1F; border-radius: 14px; padding: 16px; }
.credit { font-size: .75rem; color: var(--muted); text-align: center; margin: 0; }

/* 모의고사 */
.mk-info { margin: 0; font-size: .92rem; color: var(--muted); }
.mk-best { font-family: var(--f-display); color: var(--ink); }
.mk-run { margin: 0; font-size: .85rem; color: var(--level-deep); }
.badges { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.badge { aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; font-family: var(--f-display); font-size: .78rem; border: 2px dashed var(--line); color: var(--muted); background: var(--bg); text-align: center; line-height: 1.1; }
.badge.on { border: 3px solid var(--seal); background: var(--c); color: #fff; box-shadow: inset 0 0 0 2px #fff; }
.b-mark { position: absolute; right: -6px; top: -6px; width: 22px; height: 22px; border-radius: 6px; background: #fff; border: 2px solid var(--seal); color: var(--seal); font-family: var(--f-hanja); font-weight: 900; font-size: .8rem; display: grid; place-items: center; transform: rotate(-10deg); }
.sec-label { display: inline-flex; align-self: flex-start; gap: 8px; align-items: center; background: var(--level-soft); color: var(--level-deep); font-family: var(--f-display); font-size: .95rem; padding: 4px 12px; border-radius: 999px; }
.q .word { font-size: clamp(3rem, 17vw, 5rem); line-height: 1.1; letter-spacing: .04em; }
.doc-row { display: flex; gap: 8px; }
.doc-row input { flex: 1; min-width: 0; font-family: var(--f-display); font-size: 1.5rem; padding: 12px 16px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); text-align: center; }
.doc-row input:focus { outline: none; border-color: var(--level); box-shadow: 0 0 0 3px var(--level-soft); }
.opt.sel { background: var(--level); color: #fff; border-color: var(--level-deep); }
.mres-sec { width: 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.mres-sec div { background: var(--bg); border-radius: 14px; padding: 8px 8px; }
.mres-sec b { display: block; font-family: var(--f-display); font-weight: 400; font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.mres-sec span { font-size: .8rem; color: var(--muted); }
.seal.two { font-size: 1.9rem; writing-mode: vertical-rl; letter-spacing: .08em; }
.miss .ans { font-size: .82rem; color: var(--muted); }
.miss .col { display: flex; flex-direction: column; }

@media (prefers-reduced-motion: reduce) {
  .panels > .panel { animation: none; }
  .card-in, .prog i, .btn { transition: none; }
  .seal.stamp, .wdone .seal { animation: none; }
}
/* 키보드 안내: 마우스·키보드를 쓰는 기기(PC)에서만 보임 */
.kbd { display: none; margin: 0; font-size: .8rem; color: var(--muted); text-align: center; }
.kbd b { display: inline-block; min-width: 22px; padding: 1px 8px; margin: 0 2px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; background: var(--surface); font-family: var(--f-body); font-weight: 400; color: var(--ink); }
.wside { display: flex; flex-direction: column; gap: 16px; }
#wPlay { width: 100%; margin: 0; } /* 글자 길이에 따라 쓰기 칸이 옆으로 밀리지 않게 */

/* 홈 내비게이션: 휴대폰·태블릿은 아래 고정 막대, PC는 위쪽 가운데 */
.tabs { display: flex; gap: 4px; }
.tab { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; padding: 8px 2px; border: 0; border-radius: 14px; background: none; color: var(--muted); font-family: var(--f-display); font-size: .74rem; line-height: 1.2; }
.tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.tab[aria-selected="true"] { color: var(--level-deep); background: var(--level-soft); }
.tab-dot { position: absolute; top: 1px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px; background: var(--miss); color: #fff; font-family: var(--f-body); font-size: .7rem; line-height: 18px; text-align: center; }
.panels > .panel { display: flex; flex-direction: column; gap: 20px; animation: panelIn .22s ease-out both; }
@keyframes panelIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
#mapSec, #daysSec, #lvSec { background: var(--surface); border: 2px solid var(--line); border-radius: 22px; padding: 16px 16px 12px; }
/* 복습 일정·단계 */
.rv-sched { display: flex; flex-direction: column; gap: 12px; border-top: 2px dashed var(--line); padding-top: 12px; }
.rv-g { display: flex; flex-direction: column; gap: 8px; }
.rv-gh { display: flex; justify-content: space-between; align-items: baseline; font-size: .85rem; color: var(--muted); }
.rv-gh b { font-family: var(--f-display); font-weight: 400; font-size: 1rem; color: var(--ink); }
.rv-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.rv-chip { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: var(--bg); font-size: 1.45rem; }
.rv-chip.due { background: #FFE9EA; color: #9B1C1F; }
.rv-empty { flex: 1; display: flex; align-items: center; justify-content: center; margin: 0; padding: 16px; border-radius: 14px; background: var(--bg); color: var(--muted); font-size: .9rem; text-align: center; }
.rv-steps { display: flex; align-items: stretch; gap: 4px; }
.rv-st { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 8px 4px; border-radius: 14px; background: var(--bg); text-align: center; }
.rv-st b { font-family: var(--f-display); font-weight: 400; font-size: 1.35rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.rv-st span { font-size: .74rem; color: var(--muted); }
.rv-st.on { background: var(--level-soft); }
.rv-st.on b { color: var(--level-deep); }
.rv-st.grad { background: #E8F7F0; }
.rv-st.grad b { color: var(--mint); }
.rv-arrow { align-self: center; flex: 0 0 auto; color: var(--line); font-size: .9rem; }
details.store summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 8px; color: var(--ink); }
details.store summary::-webkit-details-marker { display: none; }
details.store summary small { color: var(--muted); }
details.store[open] summary small { visibility: hidden; }
details.store p { margin: 8px 0 0; }
/* 급수별 진도 목록 */
.lv-list { display: flex; flex-direction: column; gap: 8px; }
.lv-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 46px; padding: 8px 12px 8px 8px; border: 2px solid var(--line); border-radius: 14px; background: var(--surface); text-align: left; font: inherit; color: inherit; }
.lv-row.cur { border-color: var(--c); background: var(--cs); }
.lv-dot { flex: 0 0 auto; width: 46px; height: 30px; display: grid; place-items: center; border-radius: 999px; border: 3px solid var(--c); background: #fff; font-family: var(--f-display); font-size: .82rem; color: var(--ink); }
.lv-row.full .lv-dot { background: var(--c); color: #fff; }
.lv-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.lv-t { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lv-row.cur .lv-t { color: var(--ink); }
.lv-bar { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.lv-bar i { display: block; height: 100%; width: var(--f); background: var(--c); border-radius: 999px; }
.lv-r { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; font-family: var(--f-display); font-size: .92rem; font-variant-numeric: tabular-nums; }
.lv-b { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; border: 2px solid var(--seal); color: var(--seal); background: #fff; font-family: var(--f-hanja); font-weight: 900; font-size: .74rem; transform: rotate(-10deg); }
@media (hover: hover) and (pointer: fine) { .lv-row:hover { border-color: var(--c); } }
@media (max-width: 959px) {
  /* 복습·급수 지도 탭도 화면 높이를 채움 */
  #p-review, #p-level { flex: 1; min-height: 0; }
  #rvCard { flex: 1; min-height: 0; }
  .rv-sched { flex: 1; min-height: 70px; overflow-y: auto; }
  #mapSec { display: none; }
  #lvSec { flex: 1; display: flex; flex-direction: column; min-height: 0; }
  #lvSec .sec-title { margin-bottom: 8px; }
  .lv-list { flex: 1; min-height: 0; overflow-y: auto; }
  .lv-row { flex: 1 1 0; max-height: 66px; }
  #p-level .note { font-size: .78rem; padding: 8px 12px; }
}
@media (max-width: 959px) {
  .tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; justify-content: center; background: var(--surface); border-top: 2px solid var(--line); padding: 8px 8px calc(6px + env(safe-area-inset-bottom)); }
  .tab { max-width: 120px; }
  /* 홈: 화면 높이에 맞춰 채움 (위쪽 막대 + 탭 내용 + 아래 내비 막대) */
  #app { --app-pt: 16px; min-height: 100vh; min-height: 100dvh; padding-bottom: 16px; }
  /* 홈은 화면 높이에 딱 맞춤: 탭 안 목록이 길면 그 목록만 안에서 넘김 */
  #v-home { flex: none; display: flex; flex-direction: column; height: calc(100vh - var(--app-pt) - 16px); height: calc(100dvh - var(--app-pt) - 16px); }
  #v-home > .inner { flex: 1; width: 100%; min-height: 0; }
  #v-home .panels { min-height: 0; }
  #p-review #rvHelp { display: none; }
  #v-home .panels { flex: 1; display: flex; flex-direction: column; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  #p-home { flex: 1; }
  #p-home .hero { flex: 1; display: flex; flex-direction: column; gap: 16px; }
  /* 휴대폰·태블릿 급수 계단: 남는 높이만큼 커지는 가로 계단 */
  .hero-art { position: static; flex: 1; display: flex; flex-direction: column; min-height: 118px; background: var(--bg); border-radius: 18px; padding: 24px 12px 8px; }
  .stairs { display: flex; flex: 1; align-items: stretch; gap: 4px; padding-bottom: 20px; }
  .st { flex: 1; width: auto; height: auto; margin: 0; background: none; border-radius: 0; }
  .st::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: calc((var(--i) + 2) * 100% / 12); background: var(--cs); border-radius: 7px 7px 4px 4px; }
  .st::before { inset: auto 0 0 0; width: auto; height: calc((var(--i) + 2) * var(--f) / 12); border-radius: 7px 7px 4px 4px; z-index: 1; }
  .st-l, .st.full .st-l { position: absolute; left: -6px; right: -6px; bottom: -19px; padding: 0; line-height: 1; text-align: center; font-size: .66rem; color: var(--muted); white-space: nowrap; }
  .st.cur { box-shadow: none; }
  .st.cur::after { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--c); }
  .st.cur .st-l { color: var(--ink); }
  .st-now { right: auto; left: 50%; top: auto; bottom: calc((var(--i) + 2) * 100% / 12 + 6px); transform: translateX(-50%); line-height: 1; white-space: nowrap; font-size: .7rem; color: var(--level-deep); z-index: 2; }
  .st-b { top: auto; right: auto; left: 50%; bottom: calc((var(--i) + 2) * 100% / 12 + 4px); transform: translateX(-50%) rotate(-10deg); width: 18px; height: 18px; font-size: .62rem; z-index: 2; }
}
/* 키가 작은 휴대폰: 홈·오늘 공부를 한 화면에 넣도록 간격을 줄임 */
@media (max-width: 959px) and (max-height: 760px) {
  #p-home .hero { padding: 20px 16px 16px; gap: 12px; }
  .hero-title { font-size: 1.85rem; margin: 8px 0 4px; }
  .hero-sub { font-size: .92rem; }
  .hero-cta { margin-top: 16px; }
  .btn.big { padding: 12px 8px; }
  .hero-prog { margin-top: 12px; gap: 4px; }
  .hero-art { min-height: 96px; padding-top: 24px; }
  .today-body { gap: 12px; padding: 16px 16px 16px; }
  .chip { font-size: 1.7rem; }
  .today-head { padding: 12px 16px 8px; }
  .lv-row { min-height: 40px; }
  .lv-list { gap: 4px; }
  .today-head .lv { font-size: 1.9rem; }
  #daysSec { padding: 12px 16px 8px; }
  .panels > .panel { gap: 16px; }
}
@media (max-width: 959px) {
  #p-today .days { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 8px; scrollbar-width: thin; }
  #p-today .day { flex: 0 0 auto; }
}

@media (min-width: 560px) { .wrap { padding-top: 24px; } #app { --app-pt: 24px; } }

/* 태블릿 (600px 이상) */
@media (min-width: 600px) {
  #app { max-width: 680px; padding-left: 24px; padding-right: 24px; }
  #app .inner { max-width: none; }
  .badges { grid-template-columns: repeat(11, minmax(0, 1fr)); gap: 4px; }
  .badge { font-size: .74rem; }
  .chip { font-size: 2.2rem; }
  #rvChips { grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 8px; }
  #rvChips .chip { font-size: 1.7rem; border-radius: 12px; }
  .hero { padding: 28px 28px 24px; }
  .hero-title { font-size: 2.7rem; }
  .q .big { font-size: 7.4rem; }
  .opt { min-height: 70px; font-size: 1.2rem; }
  .opt.hz { font-size: 2.8rem; min-height: 92px; }
}

/* PC (960px 이상) */
@media (min-width: 960px) {
  #app { max-width: 1180px; padding: 32px 36px 56px; }
  .top h1 { font-size: 1.8rem; }
  #v-home > .inner { gap: 24px; }
  .top { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; }
  .top .pill { justify-self: end; }
  .tabs { padding: 4px; background: var(--surface); border: 2px solid var(--line); border-radius: 999px; }
  .tab { flex: 0 0 auto; flex-direction: row; gap: 8px; padding: 8px 16px; border-radius: 999px; font-size: 1rem; white-space: nowrap; }
  .tab svg { width: 19px; height: 19px; }
  .tab-dot { position: static; }
  .panels > .panel { gap: 24px; }
  #p-today { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px; align-items: start; }
  #p-review, #p-mock { width: 100%; max-width: 820px; margin: 0 auto; }
  .rv-sched { max-height: 220px; overflow-y: auto; }
  .lv-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 12px; }
  .lv-row { min-height: 54px; }
  #daysSec { padding: 20px 20px 16px; }
  .brand { font-size: 1.45rem; }
  .hero { grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); gap: 40px; align-items: center; padding: 40px 44px 40px; border-radius: 32px; }
  .hero-eyebrow { margin-right: 0; font-size: .92rem; }
  .hero-title { font-size: 3.5rem; margin: 16px 0 12px; }
  .hero-sub { font-size: 1.08rem; }
  .hero-cta { margin-top: 28px; gap: 12px; }
  .btn.big { font-size: 1.2rem; padding: 16px 12px; }
  .hero-prog { margin-top: 24px; }
  .hero-art { position: relative; right: auto; top: auto; background: var(--bg); border-radius: 24px; padding: 28px 28px 24px; }
  .stairs { display: flex; flex-direction: column-reverse; gap: 8px; }
  .map { overflow: visible; padding: 8px 0 8px; }
  .station { flex: 1 1 0; width: auto; min-width: 0; }
  .today-head .lv { font-size: 2.6rem; }
  .chip { font-size: 2.5rem; border-radius: 16px; }
  .days { gap: 8px; }
  .day { min-width: 48px; height: 44px; }

  section:not(#v-home) > .wrap { width: 100%; max-width: 760px; margin: 0 auto; gap: 20px; }
  section#v-write > .wrap { max-width: 920px; }
  .card { height: min(62vh, 500px); }
  .face.front .big { font-size: 12rem; }
  .face.rear .mid { font-size: 5rem; }
  .face.rear .he { font-size: 2.4rem; }
  #wPlay { display: grid; grid-template-columns: minmax(0, 460px) minmax(0, 1fr); gap: 32px; align-items: center; }
  #wPlay .wbox { width: 100%; }
  .winfo .he { font-size: 2.1rem; }
  .q { min-height: 250px; }
  .q .big { font-size: 8.4rem; }
  .q .he { font-size: 2.6rem; }
  .opts { gap: 12px; }
  #v-note .misses, .result .misses { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .result { padding: 32px 28px 28px; }
}

/* 마우스를 쓰는 기기 */
@media (hover: hover) and (pointer: fine) and (min-width: 600px) {
  .kbd { display: block; }
}
@media (hover: hover) and (pointer: fine) {
  .btn:not(.main):not(.ok):not(.right):not(.wrong):not(.sel):hover, .day:not(.cur):hover, .backbtn:hover { border-color: var(--level); }
  .btn.main:hover, .btn.ok:hover { filter: brightness(1.05); }
  .station:hover .dot { transform: translateY(-2px); }
  .dot { transition: transform .12s ease-out; }
  .card:hover .face.front { border-color: var(--level); }
}
