@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;600;700;800&display=swap");

:root {
  color-scheme: dark;
  --cloud-dancer: #f0eee9;
  --bg: #111218;
  --bg-soft: #1a1b24;
  --surface: rgba(30, 30, 40, 0.62);
  --surface-strong: rgba(38, 37, 50, 0.82);
  --line: rgba(240, 238, 233, 0.14);
  --line-soft: rgba(240, 238, 233, 0.08);
  --text: #f0eee9;
  --muted: #b8b5bc;
  --subtle: #898791;
  --violet: #b7a9d6;
  --blue: #9eafd0;
  --cyan: #9bcac2;
  --green: #a9c9b4;
  --red: #e1aaa8;
  --shadow: 0 34px 90px rgba(5, 5, 10, 0.48);
  --radius: 24px;
}

[data-theme="light"] {
  color-scheme: light;
  --cloud-dancer: #f0eee9;
  --bg: #f0eee9;
  --bg-soft: #e4ebf0;
  --surface: rgba(255, 255, 255, 0.58);
  --surface-strong: rgba(255, 255, 255, 0.78);
  --line: rgba(44, 47, 71, 0.12);
  --line-soft: rgba(44, 47, 71, 0.07);
  --text: #263044;
  --muted: #697184;
  --subtle: #8a8f9d;
  --violet: #7668c2;
  --blue: #5f88b2;
  --cyan: #4c9998;
  --green: #4e9777;
  --red: #b45d6e;
  --shadow: 0 34px 90px rgba(54, 62, 94, 0.18);
}

[data-theme="light"] .ambient {
  background: linear-gradient(145deg, #f0eee9 0%, #edf1f1 52%, #f0edf6 100%);
}

[data-theme="light"] .ambient::before {
  background:
    radial-gradient(circle at 78% 12%, rgba(134, 169, 200, .25) 0 8%, transparent 27%),
    radial-gradient(circle at 92% 34%, rgba(167, 155, 232, .2) 0 7%, transparent 25%),
    radial-gradient(circle at 12% 76%, rgba(140, 207, 201, .2) 0 8%, transparent 26%),
    radial-gradient(circle at 30% 96%, rgba(240, 238, 233, .8) 0 9%, transparent 29%);
  filter: blur(86px) saturate(108%);
}

[data-theme="light"] .ambient::after {
  background:
    radial-gradient(ellipse at 50% 38%, rgba(255,255,255,.12) 0 28%, rgba(242,245,253,.26) 70%),
    linear-gradient(180deg, rgba(255,255,255,.2), transparent 36%, rgba(223,229,244,.08));
}

[data-theme="light"] .orb-a { background: #a89eff; opacity: .16; }
[data-theme="light"] .orb-b { background: #73dbe5; opacity: .15; }
[data-theme="light"] .orb-c { background: #d19cff; opacity: .08; }

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans KR", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { color: inherit; }

.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: linear-gradient(145deg, #101116 0%, #171820 52%, #121219 100%);
}

.ambient::before {
  content: "";
  position: absolute;
  inset: -12%;
  background:
    radial-gradient(circle at 78% 12%, rgba(158, 175, 208, .26) 0 8%, transparent 26%),
    radial-gradient(circle at 92% 34%, rgba(183, 169, 214, .24) 0 7%, transparent 24%),
    radial-gradient(circle at 12% 76%, rgba(155, 202, 194, .21) 0 8%, transparent 25%),
    radial-gradient(circle at 30% 96%, rgba(240, 238, 233, .1) 0 9%, transparent 28%);
  filter: blur(78px) saturate(120%);
  transform: scale(1.08);
}

.ambient::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 38%, transparent 0 28%, rgba(16,17,22,.28) 68%),
    linear-gradient(180deg, rgba(255,255,255,.018), transparent 28%, rgba(0,0,0,.12));
}

.orb {
  position: absolute;
  display: block;
  border-radius: 50%;
  filter: blur(86px);
  opacity: .22;
  animation: drift 18s ease-in-out infinite alternate;
}

.orb::before,
.orb::after {
  content: none;
}

.orb-a { width: 430px; height: 430px; top: -210px; right: -80px; background: #695cff; }
.orb-b { width: 460px; height: 460px; bottom: -250px; left: -210px; background: #32b9d0; animation-delay: -8s; }
.orb-c { width: 240px; height: 240px; top: 46%; left: 62%; opacity: .1; background: #b65cff; animation-delay: -3s; }

.grain {
  position: absolute;
  inset: 0;
  opacity: .035;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
}

@keyframes drift {
  to { transform: translate3d(34px, 28px, 0) scale(1.08); }
}

.app-shell { width: min(1440px, calc(100% - 48px)); margin: 24px auto 0; }

.glass-panel {
  position: relative;
  background: linear-gradient(145deg, rgba(255,255,255,.055), transparent 42%), var(--surface);
  box-shadow: 0 20px 60px rgba(0,0,0,.14);
  backdrop-filter: blur(52px) saturate(165%);
  -webkit-backdrop-filter: blur(52px) saturate(165%);
}

[data-theme="light"] .glass-panel {
  background: rgba(255,255,255,.53);
  box-shadow: 0 22px 64px rgba(76, 85, 125, .12);
}

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px 0 20px;
  border-radius: 22px;
  position: sticky;
  top: 16px;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark { position: relative; width: 40px; height: 40px; display: grid; place-items: center; overflow: hidden; border-radius: 14px; color: #181922; background: linear-gradient(145deg, var(--cloud-dancer) 4%, var(--violet) 58%, var(--cyan)); box-shadow: 0 10px 28px rgba(183,169,214,.24); }
.brand-mark::before { content: ""; position: absolute; width: 25px; height: 15px; left: -4px; top: -5px; border-radius: 50%; background: rgba(255,255,255,.65); filter: blur(8px); transform: rotate(-25deg); }
.brand-mark::after { content: ""; position: absolute; width: 6px; height: 6px; right: 6px; bottom: 6px; border-radius: 50%; background: var(--cloud-dancer); box-shadow: 0 0 13px rgba(240,238,233,.9); }
.brand-mark svg { position: relative; z-index: 1; width: 21px; stroke-width: 1.8; }
.brand strong { display: block; font-size: 14px; letter-spacing: -.01em; }
.brand small { display: block; margin-top: 2px; color: var(--subtle); font: 500 9px/1.1 "Noto Sans KR", sans-serif; letter-spacing: .12em; }

.top-actions { display: flex; gap: 8px; }
.icon-button { position: relative; width: 38px; height: 38px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 12px; background: rgba(255,255,255,.055); cursor: pointer; transition: .2s ease; }
.icon-button:hover { background: rgba(255,255,255,.1); transform: translateY(-1px); }
.icon-button svg { width: 17px; }
.icon-button::after { content: attr(data-tooltip); position: absolute; right: 0; top: calc(100% + 10px); width: max-content; padding: 7px 9px; border-radius: 8px; background: #161827; color: white; font-size: 11px; opacity: 0; transform: translateY(-4px); pointer-events: none; transition: .16s; }
.icon-button:hover::after, .icon-button:focus-visible::after { opacity: 1; transform: translateY(0); }

main { padding-top: 78px; }

.intro { display: grid; grid-template-columns: minmax(0, 1fr) minmax(460px, 590px); align-items: end; gap: 44px; padding: 10px 32px 70px; }
.intro > .eyebrow, .intro > h1, .intro > p { grid-column: 1; }
.eyebrow { display: flex; align-items: center; gap: 9px; color: var(--violet); font: 500 11px/1 "Noto Sans KR", sans-serif; letter-spacing: .12em; }
.eyebrow span { width: 28px; height: 1px; background: currentColor; }
.intro h1 { margin: 18px 0 18px; font-size: clamp(46px, 6vw, 82px); line-height: 1.02; letter-spacing: -.065em; font-weight: 800; }
.intro h1 em { font-style: normal; color: transparent; background: linear-gradient(92deg, var(--cloud-dancer), var(--violet) 55%, var(--cyan)); -webkit-background-clip: text; background-clip: text; }
[data-theme="light"] .intro h1 em { background: linear-gradient(92deg, var(--violet), var(--blue) 55%, var(--cyan)); -webkit-background-clip: text; background-clip: text; }
.intro > p { max-width: 570px; margin: 0; color: var(--muted); font-size: 16px; line-height: 1.8; }
.stats { grid-column: 2; grid-row: 1 / 5; align-self: end; display: grid; grid-template-columns: repeat(3, 1fr); border-radius: var(--radius); overflow: hidden; }
.stats > div { padding: 32px 26px; }
.stats > div + div { border-left: 1px solid var(--line-soft); }
.stat-value { display: block; margin-bottom: 8px; font: 500 clamp(28px, 3vw, 42px)/1 "Noto Sans KR", sans-serif; letter-spacing: -.05em; }
.stat-label { color: var(--muted); font-size: 12px; }

.study-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 22px; align-items: stretch; }
.library { min-height: 690px; padding: 24px 18px 18px; border-radius: var(--radius); }
.library-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 6px 18px; }
.library-heading span:first-child { color: var(--subtle); font: 500 10px/1 "Noto Sans KR", sans-serif; letter-spacing: .12em; }
.library-heading h2 { margin: 7px 0 0; font-size: 18px; }
.count-badge { min-width: 32px; height: 26px; display: grid; place-items: center; padding: 0 8px; border-radius: 9px; color: var(--violet); background: rgba(130,110,255,.12); font: 500 11px "Noto Sans KR", sans-serif; }

.search-box { height: 44px; display: flex; align-items: center; gap: 9px; padding: 0 11px; margin-bottom: 15px; border: 0; border-radius: 13px; background: rgba(255,255,255,.055); transition: .2s; }
.search-box:focus-within { box-shadow: 0 0 0 3px rgba(130,110,255,.13); }
.search-box > svg { width: 15px; color: var(--subtle); }
.search-box input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 12px; }
.search-box input::placeholder { color: var(--subtle); }
.search-box button { width: 26px; height: 26px; display: none; place-items: center; border: 0; border-radius: 8px; background: transparent; cursor: pointer; }
.search-box button.visible { display: grid; }
.search-box button svg { width: 13px; }

.category-list { display: flex; flex-direction: column; gap: 3px; }
.category-button { width: 100%; min-height: 45px; display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 8px; padding: 8px 10px; border: 0; border-radius: 13px; background: transparent; color: var(--muted); text-align: left; cursor: pointer; transition: .18s ease; }
.category-button:hover { color: var(--text); background: rgba(255,255,255,.04); }
.category-button.active { color: var(--text); background: linear-gradient(100deg, rgba(133,113,255,.18), rgba(95,212,220,.06)); }
.category-button svg { width: 16px; }
.category-button span { font-size: 12px; line-height: 1.35; }
.category-button small { color: var(--subtle); font: 500 10px "Noto Sans KR", sans-serif; }
.category-button.active small { color: var(--violet); }

.coverage-note { display: flex; gap: 10px; margin-top: 16px; padding: 13px; border-top: 1px solid var(--line-soft); color: var(--muted); }
.coverage-note > svg { flex: 0 0 auto; width: 16px; color: var(--green); }
.coverage-note strong, .coverage-note span { display: block; }
.coverage-note strong { margin-bottom: 4px; color: var(--text); font-size: 11px; }
.coverage-note span { font-size: 10px; line-height: 1.55; }

.study-stage { min-width: 0; padding: 26px 30px 24px; border-radius: var(--radius); background: rgba(5,6,15,.11); backdrop-filter: blur(18px); }
.stage-head { display: flex; align-items: end; justify-content: space-between; margin-bottom: 20px; }
.section-kicker { color: var(--violet); font: 500 10px/1 "Noto Sans KR", sans-serif; letter-spacing: .12em; }
.stage-head h2 { margin: 6px 0 0; font-size: 21px; letter-spacing: -.03em; }
.stage-tools { display: flex; align-items: flex-end; gap: 16px; }
.study-direction { display: flex; gap: 3px; padding: 4px; border-radius: 12px; background: rgba(255,255,255,.045); backdrop-filter: blur(20px); }
.study-direction button { height: 30px; display: flex; align-items: center; gap: 5px; padding: 0 9px; border: 0; border-radius: 9px; background: transparent; color: var(--subtle); cursor: pointer; font-size: 9px; font-weight: 600; transition: .18s ease; }
.study-direction button:hover { color: var(--text); }
.study-direction button.active { color: var(--text); background: rgba(139,121,255,.16); }
.study-direction button svg { width: 10px; }
.stage-progress { min-width: 145px; text-align: right; }
.stage-progress > span { display: block; margin-bottom: 8px; color: var(--muted); font: 500 10px "Noto Sans KR", sans-serif; }
.progress-track { width: 100%; height: 3px; overflow: hidden; border-radius: 4px; background: rgba(255,255,255,.08); }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--violet), var(--cyan)); transition: width .35s ease; }

.card-scene { width: 100%; min-height: 480px; perspective: 1600px; }
.flashcard { position: relative; width: 100%; height: 480px; display: block; padding: 0; border: 0; border-radius: 28px; background: transparent; cursor: pointer; transform-style: preserve-3d; transition: transform .72s cubic-bezier(.2,.75,.2,1), filter .2s; }
.flashcard:hover { filter: brightness(1.035); }
.flashcard.flipped { transform: rotateY(180deg); }
.flashcard:focus-visible { outline: 3px solid rgba(133,113,255,.7); outline-offset: 4px; }

.card-face { position: absolute; inset: 0; display: flex; flex-direction: column; overflow: hidden; padding: 30px 34px; border: 0; border-radius: inherit; text-align: left; backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: var(--shadow); }
.card-front { background: radial-gradient(circle at 85% 12%, rgba(155,202,194,.15), transparent 28%), radial-gradient(circle at 8% 90%, rgba(183,169,214,.19), transparent 34%), linear-gradient(135deg, rgba(240,238,233,.11), rgba(240,238,233,.025) 45%, rgba(130,113,160,.1)), var(--surface-strong); backdrop-filter: blur(60px) saturate(165%); }
.card-front::before { content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit; background: radial-gradient(circle at 78% 18%, rgba(255,255,255,.08), transparent 34%); }
.card-back { transform: rotateY(180deg); background: linear-gradient(145deg, rgba(25,26,32,.95), rgba(55,48,65,.93)); }
[data-theme="light"] .card-back { background: linear-gradient(145deg, rgba(250,251,255,.96), rgba(229,226,249,.95)); }
.card-topline { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; }
.category-tag, .level-tag, .back-label { width: fit-content; padding: 7px 10px; border-radius: 9px; font: 500 10px/1 "Noto Sans KR", sans-serif; letter-spacing: .07em; }
.category-tag { color: var(--cyan); background: rgba(90,227,215,.09); }
.level-tag { color: var(--muted); background: rgba(255,255,255,.055); }
.back-label { padding-right: 0; color: var(--subtle); }

.term-wrap { position: relative; z-index: 2; display: flex; flex-direction: column; justify-content: center; flex: 1; padding: 20px 0 8px; }
.term-number { color: var(--violet); font: 500 11px "Noto Sans KR", sans-serif; letter-spacing: .12em; }
.term-ko { display: block; margin: 13px 0 8px; font-size: clamp(40px, 5vw, 68px); line-height: 1.08; letter-spacing: -.055em; }
.term-en { color: var(--muted); font: 400 clamp(15px, 2vw, 20px)/1.4 "Noto Sans KR", sans-serif; }
.card-summary { position: relative; z-index: 2; max-width: 650px; color: var(--muted); font-size: 14px; line-height: 1.7; }
.flashcard.concept-first .term-wrap { justify-content: center; max-width: 790px; }
.flashcard.concept-first .term-number { margin-bottom: 14px; }
.flashcard.concept-first .term-ko { max-width: 780px; margin: 0 0 14px; font-size: clamp(24px, 3.2vw, 39px); line-height: 1.45; letter-spacing: -.035em; }
.flashcard.concept-first .term-en { color: var(--violet); font-size: 12px; font-weight: 600; letter-spacing: .01em; }
.flashcard.concept-first .term-en:empty { display: none; }
.flashcard.concept-first .card-summary { margin-top: 4px; font-size: 11px; }
.flip-hint { position: relative; z-index: 2; display: flex; align-items: center; gap: 7px; margin-top: 18px; color: var(--subtle); font-size: 11px; }
.flip-hint svg { width: 15px; }
kbd { min-width: 20px; display: inline-grid; place-items: center; padding: 3px 5px; border: 0; border-radius: 5px; background: rgba(255,255,255,.07); color: var(--muted); font: 500 9px "Noto Sans KR", sans-serif; box-shadow: none; }
.corner-glow { position: absolute; right: -90px; bottom: -160px; width: 430px; height: 330px; border: 0; border-radius: 48% 52% 40% 60%; background: linear-gradient(135deg, rgba(240,238,233,.12), rgba(183,169,214,.17) 48%, rgba(155,202,194,.08)); box-shadow: 0 30px 80px rgba(78, 69, 101, .18); transform: rotate(-28deg); filter: blur(8px); }
.corner-glow::before { content: ""; position: absolute; inset: 28%; border-radius: inherit; background: rgba(167,142,255,.14); filter: blur(26px); }

.back-art { position: absolute; inset: 0; overflow: hidden; opacity: .8; }
.back-art::before { content: ""; position: absolute; width: 420px; height: 420px; right: -170px; top: -190px; border: 0; border-radius: 45% 55% 50% 50%; background: radial-gradient(circle at 32% 32%, rgba(240,238,233,.14), transparent 17%), conic-gradient(from 100deg, rgba(155,202,194,.12), rgba(183,169,214,.3), rgba(225,170,168,.1), rgba(155,202,194,.12)); filter: blur(9px); }
.back-art span { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: #c4bcff; box-shadow: 0 0 22px #9e8cff; }
.back-art span::after { content: ""; position: absolute; left: 8px; top: 4px; width: 160px; height: 1px; transform-origin: left; background: linear-gradient(90deg, rgba(169,155,255,.5), transparent); }
.back-art span:nth-child(1) { right: 30%; top: 17%; }
.back-art span:nth-child(2) { right: 11%; top: 38%; }
.back-art span:nth-child(2)::after { width: 120px; transform: rotate(138deg); }
.back-art span:nth-child(3) { left: 8%; bottom: 18%; background: var(--cyan); }
.back-art span:nth-child(3)::after { width: 220px; transform: rotate(-22deg); }
.back-art span:nth-child(4) { left: 30%; bottom: 28%; }
.back-art span:nth-child(4)::after { width: 130px; transform: rotate(25deg); }

.back-body { position: relative; z-index: 2; display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(190px, .7fr); gap: 22px; align-items: center; flex: 1; }
.back-content { display: flex; min-width: 0; flex-direction: column; justify-content: center; }
.answer-label { margin-bottom: 8px; color: var(--violet); font-size: 10px; font-weight: 700; letter-spacing: .08em; }
.back-content > strong { max-width: 690px; font-size: clamp(18px, 2.2vw, 25px); line-height: 1.5; letter-spacing: -.025em; }
.answer-detail { display: none; max-width: 680px; margin-top: 8px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.flashcard.concept-first .answer-detail { display: block; }
.flashcard.concept-first .back-content > strong { font-size: clamp(24px, 3vw, 34px); }
.point-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 17px 0; }
.point-list em { padding: 6px 9px; border: 0; border-radius: 8px; background: rgba(255,255,255,.055); color: var(--muted); font-style: normal; font-size: 10px; }
.back-grid { display: grid; grid-template-columns: 1fr 1.25fr; gap: 10px; }
.back-grid > span { min-height: 60px; padding: 11px 13px; border: 0; border-radius: 13px; background: rgba(255,255,255,.05); }
.back-grid small, .back-grid b { display: block; }
.back-grid small { margin-bottom: 5px; color: var(--subtle); font-size: 9px; }
.back-grid b { font-size: 11px; line-height: 1.45; }
.caution { display: flex; align-items: flex-start; gap: 7px; margin-top: 12px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.caution svg { flex: 0 0 auto; width: 13px; color: #f1b865; }

.diagram-shell { min-height: 238px; display: flex; flex-direction: column; justify-content: space-between; padding: 14px; border-radius: 20px; background: linear-gradient(145deg, rgba(255,255,255,.075), rgba(255,255,255,.025)); box-shadow: 0 14px 36px rgba(0,0,0,.08); backdrop-filter: blur(34px); }
.diagram-shell > small { color: var(--subtle); font: 500 8px "Noto Sans KR", sans-serif; letter-spacing: .14em; }
.card-diagram { display: grid; place-items: center; flex: 1; color: var(--violet); }
.card-diagram svg { width: 100%; max-width: 250px; height: 182px; overflow: visible; }
.card-diagram .d-line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: .62; }
.card-diagram .d-line-soft { fill: none; stroke: currentColor; stroke-width: 1.3; stroke-dasharray: 4 5; opacity: .25; }
.card-diagram .d-node { fill: rgba(155,140,255,.13); stroke: currentColor; stroke-width: 1.6; }
.card-diagram .d-node-hot { fill: rgba(90,227,215,.18); stroke: var(--cyan); stroke-width: 1.8; }
.card-diagram .d-fill { fill: rgba(155,140,255,.16); stroke: none; }
.card-diagram .d-fill-hot { fill: rgba(90,227,215,.28); stroke: none; }
.card-diagram text { fill: var(--text); font-family: "Noto Sans KR", sans-serif; font-size: 9px; text-anchor: middle; dominant-baseline: middle; }
.card-diagram .d-caption { fill: var(--muted); font-size: 7px; letter-spacing: .04em; }

.study-controls { display: grid; grid-template-columns: .8fr 1fr 1fr .8fr; gap: 9px; margin-top: 18px; }
.control-button { height: 48px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 14px; background: rgba(255,255,255,.055); cursor: pointer; transition: .18s ease; font-size: 12px; font-weight: 600; backdrop-filter: blur(24px); }
.control-button:hover { transform: translateY(-1px); background: rgba(255,255,255,.08); }
.control-button:active { transform: translateY(1px); }
.control-button svg { width: 16px; }
.control-button.danger { color: var(--red); background: rgba(255,103,126,.09); }
.control-button.success { color: var(--green); background: rgba(66,220,144,.09); }
.control-button kbd { margin-left: 4px; }
.keyboard-note { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 13px 0 0; color: var(--subtle); font: 400 9px "Noto Sans KR", sans-serif; }
.keyboard-note svg { width: 12px; }

footer { display: flex; align-items: center; justify-content: space-between; padding: 28px 8px 34px; color: var(--subtle); font-size: 10px; }
footer button { display: flex; align-items: center; gap: 6px; border: 0; background: transparent; color: inherit; cursor: pointer; }
footer button:hover { color: var(--text); }
footer svg { width: 12px; }

.toast { position: fixed; left: 50%; bottom: 26px; z-index: 50; min-width: 220px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 13px; background: rgba(20,22,40,.9); color: white; box-shadow: 0 16px 50px rgba(0,0,0,.3); backdrop-filter: blur(20px); text-align: center; font-size: 11px; opacity: 0; transform: translate(-50%, 14px); pointer-events: none; transition: .25s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1080px) {
  .intro { grid-template-columns: 1fr; }
  .stats { grid-column: 1; grid-row: auto; margin-top: 24px; }
  .study-layout { grid-template-columns: 1fr; }
  .library { min-height: auto; }
  .category-list { display: grid; grid-template-columns: repeat(5, 1fr); }
  .category-button { grid-template-columns: 22px 1fr; }
  .category-button small { display: none; }
  .coverage-note { display: none; }
}

@media (max-width: 720px) {
  .app-shell { width: min(100% - 24px, 1440px); margin-top: 12px; }
  .topbar { top: 8px; height: 62px; border-radius: 18px; }
  main { padding-top: 50px; }
  .intro { padding: 8px 8px 44px; }
  .intro h1 { font-size: clamp(42px, 13vw, 64px); }
  .stats > div { padding: 22px 14px; }
  .stat-value { font-size: 27px; }
  .stat-label { font-size: 10px; }
  .library { padding: 18px 13px 14px; }
  .category-list { display: flex; flex-direction: row; overflow-x: auto; padding-bottom: 5px; scrollbar-width: none; }
  .category-list::-webkit-scrollbar { display: none; }
  .category-button { min-width: max-content; min-height: 40px; grid-template-columns: 20px auto; padding: 8px 11px; }
  .study-stage { padding: 20px 12px 18px; }
  .stage-head { padding: 0 4px; }
  .stage-tools { flex-direction: column-reverse; align-items: flex-end; gap: 8px; }
  .stage-progress { min-width: 130px; }
  .study-direction button { padding: 0 7px; }
  .card-scene, .flashcard { min-height: 500px; height: 500px; }
  .card-face { padding: 24px 22px; }
  .term-ko { font-size: clamp(38px, 12vw, 58px); }
  .back-body { grid-template-columns: 1fr; gap: 9px; }
  .back-content { width: 100%; }
  .diagram-shell { min-height: 108px; flex-direction: row; align-items: flex-start; }
  .diagram-shell > small { writing-mode: vertical-rl; }
  .card-diagram { width: 100%; }
  .card-diagram svg { height: 92px; }
  .back-content > strong { font-size: 18px; }
  .back-grid { grid-template-columns: 1fr; }
  .back-grid > span { min-height: 52px; }
  .study-controls { grid-template-columns: 1fr 1fr; }
  .control-button.secondary span { display: inline; }
  .keyboard-note { display: none; }
  footer { gap: 16px; }
}

@media (max-width: 430px) {
  .brand small { display: none; }
  .intro > p { font-size: 14px; }
  .stats { margin-left: -4px; margin-right: -4px; }
  .stats > div { padding: 19px 10px; }
  .stat-value { font-size: 23px; }
  .card-scene, .flashcard { min-height: 520px; height: 520px; }
  .card-face { padding: 22px 18px; }
  .study-controls { gap: 7px; }
  .control-button { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
