:root {
  color-scheme: light;
  --ink: #18302a;
  --muted: #6d7e78;
  --paper: #f6f3ea;
  --card: #fffdf7;
  --green: #174b3e;
  --green-2: #236b55;
  --lime: #d6f26b;
  --wine: #9d3f51;
  --gold: #d99b39;
  --line: rgba(24, 48, 42, .12);
  --shadow: 0 16px 40px rgba(29, 56, 48, .10);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { background: var(--paper); scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100dvh; color: var(--ink); background: var(--paper); font-family: 'Noto Sans KR', system-ui, sans-serif; -webkit-tap-highlight-color: transparent; }
button { color: inherit; font: inherit; }
button, summary { -webkit-user-select: none; user-select: none; }
button:focus-visible, summary:focus-visible { outline: 3px solid rgba(35, 107, 85, .3); outline-offset: 3px; }
.app-shell { width: min(100%, 640px); min-height: 100dvh; margin: 0 auto; position: relative; background: var(--paper); }
.topbar { height: 72px; padding: max(14px, env(safe-area-inset-top)) 20px 10px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--paper) 90%, transparent); backdrop-filter: blur(14px); }
.brand { display: flex; align-items: center; gap: 9px; border: 0; background: transparent; padding: 0; text-align: left; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px 11px 15px 11px; background: var(--green); color: white; font: 700 20px Georgia, serif; transform: rotate(-4deg); }
.brand strong { display: block; font: 700 20px/18px Georgia, serif; letter-spacing: .04em; }
.brand small { font-size: 7px; font-weight: 800; letter-spacing: .2em; color: var(--muted); }
.level-pill { display: flex; gap: 6px; align-items: center; padding: 8px 12px; border: 1px solid var(--line); border-radius: 99px; background: var(--card); font-size: 12px; box-shadow: 0 4px 14px rgba(29,56,48,.05); }
.level-pill span { color: var(--gold); }
main { padding: 0 18px calc(92px + var(--safe-bottom)); }
main:focus { outline: none; }
.screen { display: none; animation: screen-in .3s ease both; }
.screen.active { display: block; }
@keyframes screen-in { from { opacity: 0; transform: translateY(6px); } }
.eyebrow { margin: 0 0 6px; color: var(--green-2); font-size: 10px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.hero-card { min-height: 210px; margin-top: 4px; padding: 27px 22px; display: flex; position: relative; overflow: hidden; border-radius: 30px 30px 46px 30px; color: white; background: linear-gradient(140deg, #123c32, #235d4d); box-shadow: var(--shadow); }
.hero-card::after { content: ''; position: absolute; inset: auto -40px -80px auto; width: 210px; height: 210px; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; box-shadow: 0 0 0 28px rgba(255,255,255,.035), 0 0 0 56px rgba(255,255,255,.025); }
.hero-copy { position: relative; z-index: 2; max-width: 72%; }
.hero-copy .eyebrow { color: var(--lime); }
.hero-copy h1 { margin: 0 0 13px; font-size: clamp(27px, 7.4vw, 38px); line-height: 1.2; letter-spacing: -.06em; }
.hero-copy h1 em { color: var(--lime); font-style: normal; }
.hero-copy > p:last-child { margin: 0; color: rgba(255,255,255,.72); font-size: 12px; line-height: 1.65; }
.grape-orbit { width: 104px; height: 128px; position: absolute; right: 10px; bottom: 8px; z-index: 1; filter: drop-shadow(0 10px 18px rgba(0,0,0,.18)); }
.grape-orbit span { width: 37px; height: 42px; position: absolute; border-radius: 50%; background: linear-gradient(145deg, #dfee7e, #a7c84f); border: 1px solid rgba(255,255,255,.35); }
.grape-orbit span:nth-child(1){left:35px;top:0}.grape-orbit span:nth-child(2){left:15px;top:28px}.grape-orbit span:nth-child(3){left:55px;top:28px}.grape-orbit span:nth-child(4){left:28px;top:57px}.grape-orbit span:nth-child(5){left:60px;top:62px}.grape-orbit span:nth-child(6){left:44px;top:89px}
.grape-orbit i { position: absolute; top: 48px; left: 31px; z-index: 2; font: 700 14px Georgia, serif; color: var(--green); transform: rotate(-8deg); }
.today-card, .mastery-card, .report-card { margin-top: 16px; padding: 20px; border: 1px solid var(--line); border-radius: 24px; background: var(--card); box-shadow: 0 8px 24px rgba(29,56,48,.045); }
.section-heading { margin: 30px 2px 14px; display: flex; align-items: end; justify-content: space-between; }
.section-heading.compact { margin: 0 0 12px; align-items: center; }
.section-heading h2, .report-card h2 { margin: 0; font-size: 18px; letter-spacing: -.04em; }
.section-heading > strong { font-size: 13px; color: var(--green-2); }
.goal-track, .quiz-progress { height: 7px; overflow: hidden; border-radius: 99px; background: #e7e7dc; }
.goal-track span, .quiz-progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green-2), #7aa04d); transition: width .45s ease; }
.quick-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; margin-top: 16px; }
.quick-button { min-width: 0; min-height: 65px; padding: 10px 12px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 18px; background: #faf8f1; text-align: left; }
.quick-button > span:last-child { min-width: 0; }
.quick-button:first-child { grid-column: 1 / -1; }
.quick-button.primary { color: white; border-color: var(--green); background: var(--green); }
.quick-icon { min-width: 38px; height: 38px; display: grid; place-items: center; border-radius: 13px; background: rgba(35,107,85,.11); font-size: 11px; font-weight: 800; }
.primary .quick-icon { color: var(--green); background: var(--lime); }
.quick-button strong, .quick-button small { display: block; }
.quick-button strong { font-size: 14px; }
.quick-button small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.primary small { color: rgba(255,255,255,.7); }
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.mode-card { min-height: 134px; padding: 17px; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; border: 0; border-radius: 22px; text-align: left; overflow: hidden; }
.mode-card.review { background: #e7f1c8; }.mode-card.mock { background: #eddde1; }.mode-card.region { background: #dcebe6; }.mode-card.stats { background: #eee6d5; }
.mode-art { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 15px; color: white; background: var(--green); font-size: 21px; font-weight: 700; transform: rotate(-3deg); }
.mock .mode-art { background: var(--wine); }.stats .mode-art { background: #ad7c36; }
.mode-card strong, .mode-card small { display: block; }
.mode-card strong { font-size: 15px; }
.mode-card small { margin-top: 4px; color: #60716a; font-size: 10px; }
.mode-card small b { color: inherit; }
.mastery-card { display: flex; align-items: center; gap: 17px; margin-bottom: 12px; }
.mastery-ring { --ratio: 0deg; width: 84px; height: 84px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--green-2) var(--ratio), #e6e5da 0); position: relative; }
.mastery-ring::after { content: ''; position: absolute; inset: 7px; border-radius: 50%; background: var(--card); }
.mastery-ring span { z-index: 1; text-align: center; }.mastery-ring strong,.mastery-ring small{display:block}.mastery-ring strong{font:700 25px Georgia, serif}.mastery-ring small{font-size:9px;color:var(--muted)}
.mastery-card h2 { margin: 0 0 5px; font-size: 17px; }.mastery-card > div:last-child > p:last-child { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.bottom-nav { height: calc(72px + var(--safe-bottom)); padding: 8px 18px var(--safe-bottom); display: flex; position: fixed; bottom: 0; left: 50%; z-index: 30; width: min(100%, 640px); transform: translateX(-50%); background: rgba(255,253,247,.92); border-top: 1px solid var(--line); backdrop-filter: blur(16px); }
.bottom-nav button { flex: 1; display: grid; place-items: center; gap: 1px; border: 0; background: transparent; color: #81908b; }
.bottom-nav span { font-size: 20px; line-height: 1; }.bottom-nav small { font-size: 9px; font-weight: 700; }
.bottom-nav button.active { color: var(--green); }.bottom-nav button.active span { width: 34px; height: 27px; display: grid; place-items: center; border-radius: 12px; background: #e4eedb; }

/* Quiz */
body.quiz-mode { overflow: hidden; background: var(--card); }
body.quiz-mode .topbar, body.quiz-mode .bottom-nav { display: none; }
body.quiz-mode main { height: 100dvh; padding: 0; }
.screen[data-screen="quiz"].active { min-height: 100dvh; background: var(--card); }
.quiz-header { min-height: 70px; padding: max(15px, env(safe-area-inset-top)) 17px 12px; display: flex; gap: 12px; align-items: center; }
.icon-button { width: 38px; height: 38px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 50%; background: transparent; font-size: 25px; line-height: 1; }
.quiz-progress-wrap { flex: 1; }.quiz-progress-wrap > span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 10px; font-weight: 700; text-align: center; }.quiz-progress { height: 6px; }
.xp-chip { min-width: 57px; padding: 7px 9px; border-radius: 99px; color: var(--green); background: #eaf2d8; font-size: 10px; font-weight: 800; text-align: center; }
.question-card { padding: 14px 22px 130px; }
.question-meta { display: flex; justify-content: space-between; margin: 9px 0 16px; color: var(--green-2); font-size: 11px; font-weight: 800; }
.question-meta span:first-child { padding: 6px 10px; border-radius: 99px; background: #e7efe9; }
.question-meta span:last-child { padding: 6px 0; color: var(--muted); }
.question-card h1 { margin: 0 0 25px; font-size: clamp(21px, 6vw, 28px); line-height: 1.52; letter-spacing: -.045em; }
.choices { display: grid; gap: 11px; }
.choice { width: 100%; min-height: 63px; padding: 13px 15px; display: flex; gap: 12px; align-items: center; border: 1.5px solid #d8ddd8; border-radius: 18px; background: white; text-align: left; transition: transform .15s, border-color .15s, background .15s; }
.choice:active { transform: scale(.985); }.choice-marker { width: 32px; height: 32px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 11px; background: #f0f1eb; font-size: 12px; font-weight: 800; }.choice-text { font-size: 14px; line-height: 1.55; }
.choice.correct { border-color: #5b9a70; background: #edf7e9; }.choice.correct .choice-marker { color: white; background: #43815c; }
.choice.wrong { border-color: #c26877; background: #faedef; }.choice.wrong .choice-marker { color: white; background: var(--wine); }.choice.dimmed { opacity: .48; }
.quiz-footer { padding: 15px 22px calc(15px + var(--safe-bottom)); position: fixed; bottom: 0; left: 50%; width: min(100%, 640px); transform: translateX(-50%); background: linear-gradient(0deg, var(--card) 74%, transparent); text-align: center; }.quiz-footer p { margin: 12px 0 0; color: var(--muted); font-size: 11px; }
.feedback-panel { max-height: 62dvh; padding: 20px 22px calc(20px + var(--safe-bottom)); position: fixed; bottom: 0; left: 50%; z-index: 10; width: min(100%, 640px); overflow-y: auto; transform: translateX(-50%); border-radius: 30px 30px 0 0; background: #edf5e7; box-shadow: 0 -16px 45px rgba(24,48,42,.14); animation: panel-up .3s ease both; }
@keyframes panel-up { from { transform: translate(-50%, 100%); } }
.feedback-panel.wrong { background: #f8e8ea; }.feedback-result { display: flex; align-items: center; gap: 12px; }.feedback-result > span { width: 43px; height: 43px; display: grid; place-items: center; border-radius: 15px; color: white; background: var(--green-2); font-size: 23px; font-weight: 800; }.feedback-panel.wrong .feedback-result > span { background: var(--wine); }.feedback-result strong,.feedback-result small{display:block}.feedback-result strong{font-size:17px}.feedback-result small{color:var(--green-2);font-size:10px;font-weight:800}.feedback-panel.wrong .feedback-result small{color:var(--wine)}
.memory-tip { margin: 15px 0 11px; padding: 13px 14px; border-left: 3px solid var(--green-2); border-radius: 4px 13px 13px 4px; background: rgba(255,255,255,.55); font-size: 12px; font-weight: 600; line-height: 1.65; }.feedback-panel.wrong .memory-tip{border-color:var(--wine)}
.feedback-panel details { font-size: 11px; color: var(--muted); }.feedback-panel summary { padding: 7px 0; cursor: pointer; font-weight: 700; }.feedback-panel details p { margin: 7px 0 14px; line-height: 1.75; }
.cta-button { width: 100%; min-height: 53px; border: 0; border-radius: 17px; color: white; background: var(--green); font-size: 14px; font-weight: 800; box-shadow: 0 9px 20px rgba(23,75,62,.17); }

/* Sub screens */
.sub-screen { padding-top: 14px; }.page-title { padding: 12px 4px 10px; }.page-title h1 { margin: 0 0 8px; font: 700 35px/1.15 Georgia, 'Noto Sans KR', serif; letter-spacing: -.04em; }.page-title > p:last-child { margin: 0; max-width: 440px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.region-list { display: grid; gap: 10px; margin-top: 17px; }.region-item { padding: 17px; display: grid; grid-template-columns: 47px 1fr auto; gap: 13px; align-items: center; border: 1px solid var(--line); border-radius: 19px; background: var(--card); text-align: left; }.region-symbol { width: 47px; height: 47px; display:grid;place-items:center;border-radius:16px;color:white;background:var(--green);font:19px 'DM Serif Display'}.region-item:nth-child(3n+2) .region-symbol{background:#777c45}.region-item:nth-child(3n) .region-symbol{background:var(--wine)}.region-item strong,.region-item small{display:block}.region-item strong{font-size:14px}.region-item small{margin-top:3px;color:var(--muted);font-size:10px}.region-progress{width:48px;text-align:right}.region-progress b{display:block;font-size:12px}.region-progress span{display:block;height:4px;margin-top:6px;border-radius:9px;background:#e0e3dc;overflow:hidden}.region-progress i{display:block;height:100%;background:var(--green-2)}
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 17px; }.stat-card { min-height: 105px; padding: 17px; display: flex; flex-direction: column; justify-content: space-between; border-radius: 20px; background: var(--green); color: white; }.stat-card:nth-child(2){background:#e7f1c8;color:var(--ink)}.stat-card:nth-child(3){background:#eddde1;color:var(--ink)}.stat-card:nth-child(4){background:#eee6d5;color:var(--ink)}.stat-card small{font-size:10px}.stat-card strong{font:31px 'DM Serif Display','Noto Sans KR'}.report-card .section-heading small{color:var(--muted);font-size:10px}.week-chart{height:130px;display:flex;gap:9px;align-items:end}.day-bar{height:100%;flex:1;display:flex;flex-direction:column;align-items:center;justify-content:end;gap:6px}.day-bar i{width:100%;max-width:25px;min-height:5px;border-radius:8px 8px 3px 3px;background:#d9dfd8}.day-bar.active i{background:linear-gradient(var(--lime),var(--green-2))}.day-bar small{font-size:9px;color:var(--muted)}.weak-list{display:grid;gap:13px}.weak-row{display:grid;grid-template-columns:1fr auto;gap:7px}.weak-row strong,.weak-row small{font-size:11px}.weak-row small{color:var(--muted)}.weak-row span{grid-column:1/-1;height:5px;border-radius:8px;background:#e4e5df;overflow:hidden}.weak-row i{display:block;height:100%;background:var(--wine)}.settings-card{display:grid;gap:8px}.settings-card h2{margin-bottom:7px}.settings-card button{padding:13px;border:1px solid var(--line);border-radius:13px;background:white;font-size:11px;font-weight:700}.settings-card button.danger{color:var(--wine)}

/* Result & utilities */
.result-screen { padding: 40px 8px; text-align: center; }.result-medal { width: 95px; height: 95px; margin: 5vh auto 22px; display: grid; place-items: center; border-radius: 33px 33px 45px 33px; color: var(--green); background: var(--lime); box-shadow: 0 16px 35px rgba(95,125,50,.22); font-size: 42px; transform: rotate(-5deg); }.result-screen h1 { margin: 0 0 8px; font-size: 28px; }.result-screen > p:not(.eyebrow) { margin: 0 auto; color: var(--muted); font-size: 12px; }.result-score { width: 170px; height: 170px; margin: 28px auto; display:grid;place-items:center;align-content:center;border-radius:50%;border:12px solid #dce8d6;background:var(--card);box-shadow:var(--shadow)}.result-score strong,.result-score span{display:block}.result-score strong{font:43px 'DM Serif Display'}.result-score span{font-size:11px;color:var(--muted)}.result-rewards{display:grid;grid-template-columns:1fr 1fr;gap:9px;margin-bottom:18px}.result-rewards span{padding:16px;border-radius:17px;background:#e9efdf}.result-rewards small,.result-rewards strong{display:block}.result-rewards small{font-size:9px;color:var(--muted)}.result-rewards strong{margin-top:4px}.result-screen .cta-button{max-width:350px}.text-button{margin-top:11px;padding:12px;border:0;background:transparent;color:var(--green-2);font-size:11px;font-weight:800}
.toast { padding: 11px 16px; position: fixed; left: 50%; bottom: calc(85px + var(--safe-bottom)); z-index: 100; max-width: calc(100% - 40px); transform: translate(-50%, 20px); border-radius: 99px; color: white; background: rgba(24,48,42,.94); box-shadow: var(--shadow); font-size: 11px; font-weight: 700; opacity: 0; pointer-events: none; transition: .25s; }.toast.show{opacity:1;transform:translate(-50%,0)}
dialog{width:min(90%,380px);padding:0;border:0;border-radius:24px;background:var(--card);box-shadow:0 24px 60px rgba(0,0,0,.2)}dialog::backdrop{background:rgba(12,30,25,.48);backdrop-filter:blur(3px)}dialog form{padding:24px}dialog h2{margin:0 0 8px;font-size:19px}dialog p{margin:0 0 20px;color:var(--muted);font-size:12px;line-height:1.6}dialog form>div{display:flex;gap:8px}dialog button{flex:1;padding:12px;border:0;border-radius:13px;background:#e7e9e4;font-size:11px;font-weight:800}dialog button.danger{color:white;background:var(--wine)}
[hidden] { display: none !important; }
@media (min-width: 641px){body{padding:18px 0}.app-shell{min-height:calc(100dvh - 36px);border-radius:28px;box-shadow:0 0 0 1px var(--line),0 30px 70px rgba(24,48,42,.12);overflow:hidden}.bottom-nav{bottom:18px;border-radius:0 0 28px 28px}.feedback-panel,.quiz-footer{bottom:18px}.screen[data-screen="quiz"].active{min-height:calc(100dvh - 36px)}body.quiz-mode main{height:calc(100dvh - 36px)}}
@media (prefers-reduced-motion: reduce){*,*::before,*::after{scroll-behavior:auto!important;animation-duration:.01ms!important;transition-duration:.01ms!important}}
@media (prefers-color-scheme: dark){:root{color-scheme:dark;--ink:#e9efe9;--muted:#9eaaa5;--paper:#111a17;--card:#19241f;--green:#2e745f;--green-2:#6aae90;--line:rgba(230,244,236,.12);--shadow:0 16px 40px rgba(0,0,0,.22)}.today-card,.mastery-card,.report-card,.region-item{background:var(--card)}.quick-button,.choice,.settings-card button{background:#202c27}.goal-track,.quiz-progress,.mastery-ring span::before{background:#303a35}.mode-card{filter:brightness(.72)}.mode-card strong,.mode-card small{color:#14201b}.bottom-nav{background:rgba(25,36,31,.94)}.screen[data-screen="quiz"].active{background:var(--card)}.quiz-footer{background:linear-gradient(0deg,var(--card) 74%,transparent)}.feedback-panel{background:#21382c}.feedback-panel.wrong{background:#3b252a}.feedback-panel details,.memory-tip{color:var(--ink)}.stat-card:nth-child(n+2){filter:brightness(.75);color:#111}.result-score{background:var(--card)}dialog{background:var(--card)}}
