:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  color: #1c2234;
  background: #f5f5fa;
  --bg: #f5f5fa;
  --paper: #fff;
  --ink: #1c2234;
  --muted: #555e73;
  --line: #e1e2ee;
  --accent: #5034bd;
  --accent-hover: #3d259c;
  --accent-soft: #eeeafd;
  --green: #12664b;
  --green-bg: #e3f5eb;
  --red: #923d29;
  --red-bg: #fff1eb;
  --shadow: 0 12px 32px #2820570a;
  --radius: 20px;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 300px; }
body { margin: 0; line-height: 1.6; }
button, select, textarea, input { font: inherit; }
a { color: var(--accent); text-underline-offset: 0.2em; }
a:hover { color: var(--accent-hover); }
button { cursor: pointer; }
button:disabled { cursor: default; }
button, a, select, input, textarea, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #6d4ce0; outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.23; text-wrap: balance; }
h1 { font-size: clamp(1.85rem, 3.4vw, 2.8rem); letter-spacing: -0.049em; }
h2 { font-size: clamp(1.3rem, 2vw, 1.65rem); letter-spacing: -0.032em; }
h3 { font-size: 1.13rem; letter-spacing: -0.018em; }
img { display: block; max-width: 100%; }
p, li, dd { overflow-wrap: anywhere; }
[lang="ko"] { word-break: keep-all; overflow-wrap: anywhere; }
.skip-link { left: 16px; top: -64px; position: fixed; z-index: 20; padding: 10px 16px; background: white; }
.skip-link:focus { top: 12px; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 232px minmax(0, 1fr); }
.sidebar { background: #fbfbfe; border-right: 1px solid var(--line); padding: 29px 17px 16px; position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: var(--ink); line-height: 1.15; margin: 0 5px; width: fit-content; }
.brand strong { font-size: 1.19rem; letter-spacing: -.04em; }
.brand small { display: block; font-size: .83rem; font-weight: 500; color: var(--muted); margin-top: 4px; }
.brand-mark { display: grid; place-items: center; width: 43px; height: 43px; border-radius: 14px; flex: none; color: white; background: #563ad0; box-shadow: inset 0 -3px #2f1f8526; font-weight: 800; font-size: 1.44rem; }
.main-nav { display: grid; gap: 6px; margin-top: 44px; }
.nav-link { text-decoration: none; color: var(--muted); display: flex; align-items: center; gap: 11px; min-height: 48px; font-weight: 640; font-size: .92rem; padding: 6px 10px; border-radius: 12px; }
.nav-link:hover { background: #f0eff8; color: var(--ink); }
.nav-link[aria-current="page"] { background: var(--accent-soft); color: #4428a7; }
.nav-icon { display: grid; place-items: center; font-family: system-ui, sans-serif; flex: none; width: 24px; line-height: 1; font-size: 1.26rem; }
.sidebar-tail { margin-top: auto; border-top: 1px solid var(--line); padding-top: 12px; }
.workspace { min-width: 0; }
.topbar { max-width: 1300px; min-height: 72px; margin: 0 auto; padding: 12px clamp(22px, 4vw, 54px); display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.course-label { display: inline-flex; align-items: center; gap: 9px; font-size: .93rem; font-weight: 700; text-decoration: none; color: var(--ink); }
.course-label span { display: grid; place-content: center; width: 28px; height: 28px; border-radius: 50%; background: #efedfa; color: var(--accent); font-size: .8rem; }
.topbar-state { display: flex; align-items: center; gap: 10px; }
.status-pill { color: #38405e; background: #e8e7f2; font-size: .8rem; font-weight: 680; border-radius: 99px; padding: 5px 9px; }
.mobile-settings, .small-brand, .mobile-nav { display: none; }
#main-content { max-width: 1300px; min-height: calc(100dvh - 156px); margin: 0 auto; padding: 13px clamp(22px, 4vw, 54px) 38px; }
#main-content:focus { outline: none; }
footer { max-width: 1300px; padding: 14px clamp(22px, 4vw, 54px) 24px; color: var(--muted); font-size: .86rem; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 9px; }
footer a { color: var(--muted); }
.load-state { color: var(--muted); padding: 30px 0; }

.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .96fr); min-height: 328px; border-radius: 24px; overflow: hidden; background: #e9e4fc; box-shadow: var(--shadow); }
.hero-copy { padding: clamp(25px, 4vw, 48px); display: flex; flex-direction: column; justify-content: center; align-items: flex-start; }
.hero-copy h1 { color: #26154b; margin: 8px 0 11px; }
.hero-copy p { max-width: 39ch; color: #4a405f; }
.hero-art { position: relative; min-height: 280px; background: #a79aaa; overflow: hidden; }
.hero-art img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.hero-kicker { font-size: .88rem; font-weight: 720; color: #492ba6; }
.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.hero .button-row { margin-top: 24px; }
.primary-btn, .secondary-btn, .quiet-btn, .audio-btn, .option-btn, .tile, .jump-link, .tab-btn {
  border-radius: 12px; text-decoration: none; font-weight: 680; min-height: 44px; line-height: 1.35;
  display: inline-flex; justify-content: center; align-items: center; text-align: center; gap: 8px;
}
.primary-btn { background: var(--accent); border: 1px solid var(--accent); color: white; padding: 11px 16px; }
.primary-btn:hover { background: var(--accent-hover); color: white; }
.primary-btn:disabled { opacity: .57; }
.secondary-btn { background: var(--paper); border: 1px solid #d6d4e9; color: #382477; padding: 10px 14px; }
.secondary-btn:hover { background: #f4f1ff; color: #382477; }
.secondary-btn:disabled, .quiet-btn:disabled { opacity: .6; }
.quiet-btn { background: transparent; border: 1px solid transparent; color: var(--accent); padding: 8px 11px; }
.quiet-btn:hover { background: var(--accent-soft); }
.install-btn { min-height: 36px; border-color: #d7d4e8; padding: 6px 10px; font-size: .86rem; }

.quick-grid { display: grid; grid-template-columns: 1.12fr .9fr .9fr; gap: 13px; margin-top: 17px; }
.quick-card, .panel, .study-card, .result-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.quick-card { display: grid; grid-template-columns: 42px 1fr; align-content: center; align-items: center; text-decoration: none; color: var(--ink); gap: 11px; min-height: 95px; padding: 12px 15px; }
a.quick-card:hover { border-color: #b3a2ee; color: var(--ink); }
.quick-icon { color: #4c2aab; font-size: 1.24rem; font-weight: 720; min-height: 42px; display: grid; place-content: center; border-radius: 13px; background: var(--accent-soft); }
.quick-card:nth-child(2) .quick-icon { color: #13644c; background: #e1f3eb; }
.quick-card:nth-child(3) .quick-icon { color: #8c4838; background: #fce8e1; }
.quick-card strong, .quick-card small { display: block; }
.quick-card small { color: var(--muted); font-size: .87rem; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px; margin: 0 0 13px; }
.section-head a { font-size: .92rem; font-weight: 680; }
.units-section { margin-top: 32px; }
.unit-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.unit-card { color: var(--ink); text-decoration: none; display: flex; flex-direction: column; gap: 8px; min-width: 0; min-height: 163px; background: white; border: 1px solid var(--line); border-radius: var(--radius); padding: 17px; }
.unit-card:hover { color: var(--ink); border-color: #a995e9; }
.unit-card p, .muted { color: var(--muted); }
.unit-card p { font-size: .93rem; }
.unit-card .meter { margin-top: auto; }
.unit-level { color: #5233a8; font-size: .84rem; font-weight: 730; }
.meter { background: #e9e8f2; border-radius: 20px; height: 7px; overflow: hidden; width: 100%; }
.meter > span { display: block; height: 100%; background: #6751cf; border-radius: inherit; }
.unit-count { color: var(--muted); font-size: .81rem; }

.page-head { margin-bottom: 22px; }
.page-head p { color: var(--muted); margin-top: 9px; max-width: 65ch; }
.page-head .unit-level { margin: 0 0 6px; }
.back-link { display: inline-flex; font-weight: 700; color: var(--accent); text-decoration: none; min-height: 40px; align-items: center; margin-bottom: 8px; }
.lesson-list { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--paper); }
.lesson-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; color: var(--ink); text-decoration: none; min-height: 76px; align-items: center; gap: 12px; padding: 12px 18px; }
.lesson-row + .lesson-row { border-top: 1px solid var(--line); }
.lesson-row:hover { background: #f7f5ff; color: var(--ink); }
.row-mark { display: grid; place-items: center; min-height: 38px; border-radius: 12px; font-size: .85rem; font-weight: 750; background: #f0ecfd; color: #5136ae; }
.row-mark.done { color: var(--green); background: var(--green-bg); }
.lesson-row strong, .lesson-row small { display: block; }
.lesson-row small { font-size: .88rem; color: var(--muted); }
.row-action { color: var(--accent); font-size: .85rem; font-weight: 680; }
.content-narrow { max-width: 800px; margin: 0 auto; }
.panel { padding: clamp(16px, 3vw, 25px); margin-bottom: 13px; }
.panel h2 + p, .panel h3 + p { margin: 8px 0 11px; }
.panel p + p { margin-top: 9px; }
.panel .button-row { margin-top: 14px; }
.tabrow { margin: 10px 0 15px; display: flex; gap: 7px; flex-wrap: wrap; }
.tab-btn { background: white; color: var(--muted); border: 1px solid var(--line); padding: 8px 12px; }
.tab-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: #c7baf4; }
fieldset { min-inline-size: 0; padding: 0; margin: 0; border: 0; }
legend, label.field-label { display: block; font-weight: 720; margin-bottom: 8px; }
select, input[type="text"], textarea { width: 100%; border: 1px solid #cfcde1; background: white; color: var(--ink); border-radius: 11px; padding: 9px 11px; min-height: 44px; }
select { width: auto; max-width: 100%; }
textarea { resize: vertical; min-height: 105px; }
.inline-form { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 13px; margin-top: 13px; }
.small-text { color: var(--muted); font-size: .88rem; }
.word-table { display: grid; }
.word-row { display: grid; grid-template-columns: minmax(75px, .36fr) minmax(0, 1fr) auto; align-items: center; gap: 11px; border-top: 1px solid var(--line); padding: 10px 0; }
.word-row > [lang="ko"] { font-size: 1.15rem; }
.word-row .audio-btn { font-size: .82rem; padding: 7px 8px; }

.lesson-shell { max-width: 825px; margin: 0 auto; }
.study-top { margin-bottom: 14px; }
.study-top-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.study-top-line .back-link { margin: 0; min-height: 34px; }
.study-step { color: var(--muted); font-size: .9rem; }
.study-card, .result-card { padding: clamp(17px, 3.5vw, 32px); }
.study-card h1 { font-size: clamp(1.55rem, 3vw, 2.22rem); margin: 2px 0 13px; }
.study-card p + p { margin-top: 7px; }
.study-card .lead { color: #424962; margin-bottom: 10px; }
.study-card .meter { margin: 12px 0; }
.study-actions { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 9px; align-items: center; margin-top: 14px; }
.study-actions > .primary-btn:last-child { margin-left: auto; }
.study-notes { margin-top: 15px; display: grid; gap: 11px; }
.study-note { background: #f4f1fc; border-left: 3px solid #947bec; border-radius: 11px; padding: 12px 13px; }
.study-note h2 { font-size: 1.04rem; margin-bottom: 4px; }
.study-note p { color: #43495e; }
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.korean-card { border: 1px solid var(--line); border-radius: 15px; padding: 13px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-content: start; gap: 3px 8px; }
.korean-card .ko { font-size: clamp(1.32rem, 3vw, 1.85rem); line-height: 1.38; font-weight: 730; letter-spacing: -.025em; }
.korean-card .note { grid-column: 1 / -1; }
.korean-card .audio-btn { grid-column: 2; grid-row: 1 / span 2; align-self: start; }
.korean-card .vi { grid-column: 1; }
.audio-btn { background: #eeebfa; color: #4929a4; border: 1px solid transparent; padding: 7px 10px; font-size: .87rem; min-height: 40px; flex: none; }
.audio-btn:hover { background: #e4dcfc; }
.audio-btn[aria-pressed="true"] { background: var(--accent); color: white; }
.reading-lines { display: grid; gap: 9px; }
.reading-line { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 7px; align-items: center; background: #f7f6fc; border-radius: 13px; padding: 12px; }
.reading-line .ko { font-size: 1.14rem; }
.ai-reading-text { white-space: pre-line; }
.speaker { font-size: .82rem; color: var(--accent); font-weight: 740; }
details summary { color: var(--accent); cursor: pointer; min-height: 37px; padding: 5px 0; font-size: .88rem; font-weight: 680; }
details p { color: var(--muted); font-size: .92rem; }

.options { display: grid; gap: 8px; margin-top: 12px; }
.option-btn { text-align: left; justify-content: flex-start; min-height: 51px; padding: 9px 12px; background: white; border: 1px solid #d9d7e9; color: var(--ink); font-weight: 600; }
.option-btn:hover:enabled, .option-btn.chosen { border-color: #8268e3; background: #f3eeff; }
.option-btn.correct { background: var(--green-bg); border-color: #5c9b7f; color: var(--green); }
.option-btn.wrong { background: var(--red-bg); border-color: #d08975; color: var(--red); }
.option-key { display: grid; place-items: center; border-radius: 8px; font-size: .82rem; background: #f0eef9; min-width: 27px; min-height: 27px; flex: none; }
.feedback { border-radius: 13px; padding: 10px 12px; margin-top: 12px; background: var(--green-bg); color: #15523d; }
.feedback.wrong { background: var(--red-bg); color: #73321f; }
.feedback.neutral { background: #f0edfa; color: #312457; }
.feedback strong { display: block; }
.tile-row { display: flex; flex-wrap: wrap; gap: 7px; padding: 10px 0; }
.tile-row.selected { padding: 8px; border: 1px dashed #a8a1c7; border-radius: 12px; min-height: 60px; align-items: center; margin: 10px 0 0; }
.tile { background: white; border: 1px solid #c9c4df; color: var(--ink); padding: 6px 12px; min-width: 42px; font-size: 1.07rem; }
.tile:hover:enabled { background: var(--accent-soft); }
.tile:disabled { opacity: .55; }
.input-wrap { display: grid; gap: 8px; margin-top: 12px; }
.result-card h1 { margin: 8px 0; }
.result-card .button-row { margin-top: 15px; }
.challenge-out { margin-top: 13px; }
.challenge-out .feedback { margin: 10px 0 0; }
.lock-status { background: #efebfc; padding: 14px; border-radius: 13px; margin-top: 12px; }
.lock-status .meter { margin-top: 9px; }
.notice { position: fixed; z-index: 50; right: 22px; bottom: 21px; max-width: min(87vw, 380px); }
.notice:not(:empty) { color: white; background: #302654; border-radius: 14px; padding: 10px 14px; box-shadow: 0 9px 30px #23154833; }
.credits-list { padding-left: 20px; }
.credits-list li + li { margin-top: 7px; }
.model-progress { display: grid; gap: 8px; margin-top: 10px; }
.model-progress .meter { height: 9px; }
.hidden-audio { display: none; }
.sound-speed { align-self: center; color: var(--muted); }
.blank { text-align: center; padding: 30px 15px; }
.data-row { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }

@media (max-width: 1000px) {
  .shell { grid-template-columns: 190px minmax(0,1fr); }
  .sidebar { padding-left: 12px; padding-right: 12px; }
  .hero { min-height: 302px; }
  .quick-card { grid-template-columns: 34px 1fr; gap: 7px; padding: 10px; }
  .quick-icon { min-height: 34px; }
  .unit-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 760px) {
  .shell { display: block; }
  .sidebar, .course-label { display: none; }
  .small-brand { display: flex; margin-left: 0; }
  .small-brand .brand-mark { width: 36px; height: 36px; border-radius: 11px; font-size: 1.25rem; }
  .mobile-settings { display: grid; place-items: center; text-decoration: none; font-size: 1.25rem; min-width: 42px; min-height: 42px; border-radius: 10px; color: var(--muted); }
  .mobile-settings:hover { background: var(--accent-soft); }
  .topbar { padding: 8px 15px; min-height: 60px; }
  #main-content { min-height: calc(100dvh - 164px); padding: 8px 15px 27px; }
  footer { padding: 10px 15px calc(82px + env(safe-area-inset-bottom)); }
  .mobile-nav { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); position: fixed; bottom: 0; left: 0; width: 100%; padding: 5px 5px max(5px, env(safe-area-inset-bottom)); background: #fbfbfe; box-shadow: 0 -1px 0 var(--line); z-index: 12; }
  .mobile-nav .nav-link { justify-content: center; flex-direction: column; text-align: center; font-size: .76rem; line-height: 1.17; min-height: 51px; min-width: 0; gap: 4px; padding: 3px 1px; border-radius: 10px; }
  .mobile-nav .nav-icon { font-size: 1.12rem; }
  .notice { right: 12px; bottom: calc(68px + env(safe-area-inset-bottom)); }
  .hero { grid-template-columns: minmax(0,1fr) minmax(0,.75fr); min-height: 248px; border-radius: 18px; }
  .hero-copy { padding: 22px; }
  .hero-art { min-height: 0; }
  .quick-grid { gap: 8px; }
}
@media (max-width: 530px) {
  .hero { display: flex; flex-direction: column; }
  .hero-art { height: 150px; order: -1; }
  .hero-art img { object-position: center 51%; }
  .hero-copy { padding: 18px; }
  .hero-copy h1 { margin: 4px 0 8px; }
  .hero .button-row { margin-top: 16px; }
  .quick-grid { grid-template-columns: 1fr 1fr; }
  .quick-card:first-child { grid-column: 1 / -1; min-height: 69px; }
  .quick-card { min-height: 78px; }
  .unit-card { padding: 13px; min-height: 152px; }
  .unit-card h3 { font-size: 1.03rem; }
  .unit-card p { font-size: .87rem; }
  .lesson-row { gap: 8px; padding: 10px; grid-template-columns: 34px minmax(0,1fr); }
  .row-action { display: none; }
  .cards, .inline-form { grid-template-columns: 1fr; }
  .word-row { grid-template-columns: minmax(65px,.4fr) minmax(0,1fr) auto; gap: 6px; }
  .study-top-line { gap: 5px; }
  .study-top-line .back-link, .study-step { font-size: .86rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

.voice-practice { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 6px; }
.voice-practice .button-row { margin: 9px 0; }
.voice-practice audio { display: block; max-width: 100%; margin-top: 10px; }
