:root{
  --navy:#1b365d; --navy2:#2b4f7e; --navy3:#4a6c98; --sky:#eaf0f7; --sky2:#f5f8fb;
  --line:#c5d1e0; --ink:#1c2330; --gray:#6b7686; --accent:#d9822b; --red:#c0392b; --green:#1e8e5a; --cream:#fbf6ec;
  --bg:#f1f4f9; --card:#fff; --radius:14px; --tabh:62px;
}
*{ box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
html,body{ margin:0; padding:0; background:var(--bg); color:var(--ink); }
body{ font-family:'Noto Sans KR',-apple-system,BlinkMacSystemFont,'Apple SD Gothic Neo','Malgun Gothic',sans-serif; font-size:15px; line-height:1.5; word-break:keep-all; overflow-wrap:anywhere; padding-bottom:calc(var(--tabh) + env(safe-area-inset-bottom)); }
.en{ font-family:'Source Serif 4','Noto Serif KR',Georgia,serif; }
button{ font:inherit; color:inherit; cursor:pointer; border:0; background:none; }
button:disabled{ opacity:.45; cursor:default; }
mark{ background:#fde8c8; color:#8a4a0b; padding:0 .15em; border-radius:3px; font-weight:600; }

.top{ background:var(--navy); color:#fff; padding:calc(10px + env(safe-area-inset-top)) 16px 10px; }
.brand{ font-size:11px; letter-spacing:.08em; opacity:.8; }
.trow{ display:flex; align-items:center; justify-content:space-between; gap:8px; }
.top h1{ margin:0; font-size:20px; font-weight:900; flex:1; }
.back{ width:34px; height:34px; margin-left:-8px; border-radius:50%; background:rgba(255,255,255,.14); color:#fff; font-size:26px; line-height:1; display:inline-flex; align-items:center; justify-content:center; padding-bottom:3px; }
.back[hidden]{ display:none; }
.back:active{ background:rgba(255,255,255,.3); }
.dday{ font-size:12px; background:rgba(255,255,255,.15); padding:2px 10px; border-radius:999px; }
.dday:empty{ display:none; }

.chips{ display:flex; gap:6px; overflow-x:auto; padding:10px 12px; background:#fff; border-bottom:1px solid var(--line); position:sticky; top:0; z-index:5; scrollbar-width:none; }
.chips::-webkit-scrollbar{ display:none; }
.chip{ flex:0 0 auto; border:1.5px solid var(--line); border-radius:999px; padding:5px 11px; font-size:13px; font-weight:700; color:var(--gray); background:#fff; position:relative; line-height:1.2; }
.chip small{ display:block; font-size:10px; font-weight:500; color:var(--gray); }
.chip.on{ background:var(--navy); border-color:var(--navy); color:#fff; }
.chip.on small{ color:#c9d8ec; }
.chip.all{ background:var(--sky); border-color:var(--sky); color:var(--navy); }
.chip.all.on{ background:var(--accent); border-color:var(--accent); color:#fff; }

main{ max-width:600px; margin:0 auto; padding:14px 14px 20px; }
.card{ background:var(--card); border-radius:var(--radius); padding:16px; box-shadow:0 1px 2px rgba(27,54,93,.06), 0 0 0 1px rgba(27,54,93,.05); margin-bottom:12px; }
.card h2{ margin:0 0 10px; font-size:15px; color:var(--navy); display:flex; align-items:center; justify-content:space-between; }
.card h2 small{ font-weight:500; color:var(--gray); font-size:12px; }
.muted{ color:var(--gray); font-size:13px; }
.row{ display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.grow{ flex:1; }
.btn{ display:inline-flex; align-items:center; justify-content:center; gap:6px; background:var(--navy); color:#fff; border-radius:12px; padding:12px 16px; font-weight:700; font-size:15px; width:100%; }
.btn.sec{ background:var(--sky); color:var(--navy); }
.btn.acc{ background:var(--accent); }
.btn.ghost{ background:transparent; color:var(--navy); border:1.5px solid var(--line); }
.btn.sm{ padding:8px 12px; font-size:13px; width:auto; border-radius:10px; }
.btn.danger{ background:#fdecea; color:var(--red); }
.pill{ white-space:nowrap; display:inline-block; font-size:11px; font-weight:700; padding:1px 8px; border-radius:999px; background:var(--sky); color:var(--navy); }
.pill.red{ background:#fdecea; color:var(--red); }
.pill.gr{ background:#e5f5ec; color:var(--green); }
.pill.or{ background:#fdebd6; color:#a85a12; }

/* 홈 */
.hero{ display:grid; grid-template-columns:120px 1fr; gap:14px; align-items:center; }
.ring{ width:120px; height:120px; position:relative; }
.ring svg{ transform:rotate(-90deg); }
.ring .c{ position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; }
.ring .c b{ font-size:26px; color:var(--navy); line-height:1; }
.ring .c span{ font-size:11px; color:var(--gray); margin-top:3px; }
.kpi{ display:grid; grid-template-columns:repeat(3,1fr); gap:6px; }
.kpi div{ background:var(--sky2); border-radius:10px; padding:8px 6px; text-align:center; }
.kpi b{ display:block; font-size:18px; color:var(--navy); }
.kpi span{ font-size:11px; color:var(--gray); }
.acts{ display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.acts .btn{ flex-direction:column; gap:2px; padding:12px 8px; line-height:1.25; }
.acts .btn small{ font-weight:500; font-size:11px; opacity:.85; }
.pbar{ display:grid; grid-template-columns:44px 1fr 56px; gap:8px; align-items:center; padding:5px 0; border-bottom:1px solid var(--sky); font-size:13px; }
.pbar:last-child{ border:0; }
.pbar .no{ font-weight:900; color:var(--navy); }
.pbar .bar{ height:8px; background:var(--sky); border-radius:99px; overflow:hidden; position:relative; }
.pbar .bar i{ display:block; height:100%; background:var(--navy3); }
.pbar .bar i.d{ position:absolute; left:0; top:0; background:var(--green); }
.pbar .n{ text-align:right; color:var(--gray); font-size:12px; }

/* 세그먼트 */
.seg{ display:flex; background:var(--sky); border-radius:10px; padding:3px; gap:2px; margin-bottom:10px; }
.seg button{ flex:1; padding:7px 4px; border-radius:8px; font-size:13px; font-weight:700; color:var(--gray); }
.seg button.on{ background:#fff; color:var(--navy); box-shadow:0 1px 2px rgba(0,0,0,.08); }
.opts{ display:flex; flex-wrap:wrap; gap:6px; margin-bottom:10px; }
.opts button{ border:1.5px solid var(--line); border-radius:999px; padding:6px 12px; font-size:13px; font-weight:700; color:var(--gray); background:#fff; }
.opts button.on{ background:var(--navy); color:#fff; border-color:var(--navy); }
.opts button.dis{ opacity:.4; }
label.lbl{ display:block; font-size:12px; font-weight:700; color:var(--navy); margin:8px 0 4px; }

/* 플래시카드 */
.fc{ perspective:1200px; height:360px; margin-bottom:10px; }
.fc .in{ position:relative; width:100%; height:100%; transition:transform .45s; transform-style:preserve-3d; cursor:pointer; }
.fc.flip .in{ transform:rotateY(180deg); }
.fc .f, .fc .b{ position:absolute; inset:0; backface-visibility:hidden; -webkit-backface-visibility:hidden; background:#fff; border-radius:var(--radius); padding:18px; box-shadow:0 2px 8px rgba(27,54,93,.1), 0 0 0 1px rgba(27,54,93,.06); display:flex; flex-direction:column; }
.fc .b{ transform:rotateY(180deg); overflow:auto; }
.fc .hd{ display:flex; justify-content:space-between; align-items:center; font-size:12px; color:var(--gray); }
.fc .f .w{ flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; gap:8px; }
.fc .f .w .en{ font-size:34px; font-weight:700; color:var(--navy); line-height:1.2; }
.fc .f .w .hint{ font-size:13px; color:var(--gray); }
.fc .tap{ text-align:center; font-size:12px; color:var(--gray); }
.fc .b .ko{ font-size:22px; font-weight:700; color:var(--navy); margin:4px 0 2px; }
.fc .b .en2{ font-size:16px; color:var(--gray); }
.rel{ display:flex; flex-wrap:wrap; gap:5px; margin:8px 0; }
.rel span{ font-size:12px; border:1px solid var(--line); border-radius:8px; padding:2px 7px; color:var(--navy); }
.rel span b{ font-weight:900; margin-right:4px; color:#2c5aa0; font-family:'Noto Sans KR'; }
.rel span.an{ color:var(--red); border-color:#ecc5c0; }
.rel span.an b{ color:var(--red); }
.ex{ background:var(--sky2); border-radius:10px; padding:10px 12px; font-size:14px; line-height:1.55; margin-top:6px; }
.ex .k{ font-size:12px; color:var(--gray); margin-top:4px; }
.spk{ width:38px; height:38px; border-radius:50%; background:var(--sky); color:var(--navy); display:inline-flex; align-items:center; justify-content:center; flex:0 0 auto; }
.spk.big{ width:48px; height:48px; }
.spk svg{ width:20px; height:20px; fill:currentColor; }
.spk.on{ background:var(--accent); color:#fff; }
.star{ font-size:20px; color:#c9c9c9; }
.star.on{ color:var(--accent); }
.judge{ display:grid; grid-template-columns:1fr 1fr 1fr; gap:8px; }
.judge .btn{ padding:14px 6px; font-size:15px; }
.judge .no{ background:#fdecea; color:var(--red); }
.judge .so{ background:var(--cream); color:#a85a12; }
.judge .ok{ background:#e5f5ec; color:var(--green); }
.navr{ display:flex; justify-content:space-between; align-items:center; margin-top:8px; font-size:13px; color:var(--gray); }
.navr button{ padding:8px 14px; border-radius:10px; background:#fff; border:1.5px solid var(--line); font-weight:700; color:var(--navy); }

/* 목록 */
.wl{ display:flex; align-items:center; gap:8px; padding:9px 0; border-bottom:1px solid var(--sky); }
.wl:last-child{ border:0; }
.wl .t{ flex:1; min-width:0; }
.wl .en{ font-weight:700; color:var(--navy); font-size:16px; }
.wl .ko{ font-size:13px; color:#3d4757; }
.wl .hid{ background:var(--sky); color:transparent; border-radius:6px; user-select:none; }
.wl .hid.show{ background:none; color:inherit; }
.wl .dots{ display:flex; gap:2px; }
.wl .dots i{ width:7px; height:7px; border-radius:50%; background:var(--line); display:block; }
.wl .dots i.on{ background:var(--green); }
.wl .dots i.x{ background:var(--red); }
.wl .no{ font-size:11px; color:var(--gray); width:30px; }

/* 퀴즈 */
.qhead{ display:flex; justify-content:space-between; align-items:center; font-size:13px; color:var(--gray); margin-bottom:8px; }
.qhead .prog{ flex:1; height:6px; background:var(--sky); border-radius:99px; margin:0 12px; overflow:hidden; }
.qhead .prog i{ display:block; height:100%; background:var(--accent); transition:width .3s; }
.q .type{ font-size:12px; font-weight:700; color:var(--accent); letter-spacing:.04em; }
.q .ask{ font-size:14px; color:var(--gray); margin:2px 0 10px; }
.q .stim{ text-align:center; padding:14px 6px 16px; }
.q .stim .en{ font-size:32px; font-weight:700; color:var(--navy); line-height:1.2; }
.q .stim .ko{ font-size:24px; font-weight:700; color:var(--navy); }
.q .stim .sub{ font-size:13px; color:var(--gray); margin-top:4px; }
.q .sent{ font-size:17px; line-height:1.75; padding:4px 2px 10px; }
.q .sent .bl{ display:inline-block; min-width:70px; border-bottom:2px solid var(--navy); margin:0 2px; text-align:center; color:var(--navy); font-weight:700; }
.q .sent .box{ display:inline-block; border:1.5px solid var(--navy); border-radius:6px; padding:0 8px; margin:0 3px; font-weight:700; color:var(--navy); }
.q .sent .box b{ color:var(--accent); font-weight:400; margin:0 5px; }
.q .trans{ font-size:13px; color:var(--gray); background:var(--sky2); border-radius:8px; padding:8px 10px; margin-bottom:8px; }
.q .trans button{ color:var(--navy); font-weight:700; text-decoration:underline; }
.ans{ display:grid; grid-template-columns:1fr; gap:8px; }
.ans.two{ grid-template-columns:1fr 1fr; }
.ans button{ text-align:left; border:1.5px solid var(--line); border-radius:12px; padding:12px 14px; font-size:16px; background:#fff; display:flex; gap:10px; align-items:center; line-height:1.4; }
.ans button .n{ width:22px; height:22px; border-radius:50%; background:var(--sky); color:var(--navy); font-size:12px; font-weight:700; display:inline-flex; align-items:center; justify-content:center; flex:0 0 auto; }
.ans button.ok{ border-color:var(--green); background:#e5f5ec; }
.ans button.ok .n{ background:var(--green); color:#fff; }
.ans button.bad{ border-color:var(--red); background:#fdecea; }
.ans button.bad .n{ background:var(--red); color:#fff; }
.ans button.dim{ opacity:.55; }
.inp{ display:flex; gap:8px; }
.inp input{ flex:1; font:inherit; font-size:18px; padding:12px 14px; border:1.5px solid var(--line); border-radius:12px; outline:none; font-family:'Source Serif 4',serif; }
.inp input:focus{ border-color:var(--navy); }
.inp input.ok{ border-color:var(--green); background:#e5f5ec; }
.inp input.bad{ border-color:var(--red); background:#fdecea; }
.fb{ margin-top:12px; border-top:1px dashed var(--line); padding-top:12px; }
.fb .res{ font-weight:900; font-size:16px; margin-bottom:6px; }
.fb .res.ok{ color:var(--green); }
.fb .res.bad{ color:var(--red); }
.fb .w{ display:flex; align-items:center; gap:8px; }
.fb .w .en{ font-size:20px; font-weight:700; color:var(--navy); }
.fb .w .ko{ font-size:14px; color:#3d4757; }
.result .big{ text-align:center; padding:10px 0 4px; }
.result .big b{ font-size:44px; color:var(--navy); }
.result .big span{ display:block; color:var(--gray); font-size:13px; }
.goal{ background:linear-gradient(135deg,#1b365d,#2b4f7e); color:#fff; }
.goal h2{ color:#fff; }
.goal .muted{ color:#c9d8ec; }
.goal .btn{ background:#fff; color:var(--navy); }
.goal .btn.acc{ background:var(--accent); color:#fff; }

/* 탭 바 */
.tabs{ position:fixed; left:0; right:0; bottom:0; height:calc(var(--tabh) + env(safe-area-inset-bottom)); padding-bottom:env(safe-area-inset-bottom); background:#fff; border-top:1px solid var(--line); display:flex; z-index:10; }
.tabs button{ flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; font-size:11px; font-weight:700; color:var(--gray); }
.tabs button i{ font-style:normal; font-size:20px; line-height:1; filter:grayscale(1); opacity:.6; }
.tabs button.on{ color:var(--navy); }
.tabs button.on i{ filter:none; opacity:1; }
.toast{ position:fixed; left:50%; bottom:calc(var(--tabh) + 16px + env(safe-area-inset-bottom)); transform:translateX(-50%) translateY(20px); background:rgba(28,35,48,.92); color:#fff; padding:9px 16px; border-radius:999px; font-size:13px; opacity:0; transition:.25s; pointer-events:none; z-index:20; white-space:nowrap; }
.toast.show{ opacity:1; transform:translateX(-50%) translateY(0); }
.set .item{ display:flex; justify-content:space-between; align-items:center; padding:12px 0; border-bottom:1px solid var(--sky); gap:10px; }
.set .item:last-child{ border:0; }
.set .item .d{ font-size:12px; color:var(--gray); }
.sw{ width:46px; height:26px; border-radius:99px; background:var(--line); position:relative; flex:0 0 auto; }
.sw::after{ content:''; position:absolute; top:3px; left:3px; width:20px; height:20px; border-radius:50%; background:#fff; transition:.2s; }
.sw.on{ background:var(--green); }
.sw.on::after{ left:23px; }
select,input[type=date],input[type=range]{ font:inherit; font-size:14px; padding:6px 8px; border:1.5px solid var(--line); border-radius:8px; background:#fff; max-width:180px; }
.empty{ text-align:center; color:var(--gray); padding:26px 10px; font-size:14px; }
@media (min-width:600px){ .fc{ height:400px; } }
