:root {
  --blue-900: #083b8f;
  --blue-700: #0b57d0;
  --blue-600: #1769e0;
  --blue-100: #eaf2ff;
  --blue-50: #f4f8ff;
  --ink: #14213d;
  --muted: #667085;
  --line: #e4e9f2;
  --surface: #ffffff;
  --canvas: #f6f8fb;
  --danger: #d92d20;
  --danger-bg: #fff1f0;
  --success: #067647;
  --success-bg: #ecfdf3;
  --warning: #b54708;
  --warning-bg: #fff7e8;
  --shadow: 0 10px 30px rgba(22, 46, 81, .08);
  --radius: 16px;
  --nav-height: 76px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background: var(--canvas);
  font-family: "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  line-height: 1.55;
}
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, [tabindex]:focus-visible { outline: 3px solid rgba(23, 105, 224, .25); outline-offset: 2px; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 17px; height: 17px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.login-page { min-height: 100vh; background: var(--surface); }
.login-brand { padding: 34px 24px 30px; background: var(--blue-900); color: #fff; }
.brand-mark { display: inline-flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 800; letter-spacing: -.03em; }
.brand-symbol { display: grid; place-items: center; width: 34px; height: 34px; background: #fff; color: var(--blue-700); border-radius: 10px 10px 10px 2px; font-weight: 900; }
.login-brand h1 { max-width: 420px; margin: 44px 0 12px; font-size: clamp(28px, 8vw, 42px); line-height: 1.2; letter-spacing: -.055em; }
.login-brand p { max-width: 390px; margin: 0; color: rgba(255,255,255,.78); font-size: 15px; }
.login-main { max-width: 520px; margin: 0 auto; padding: 34px 24px 48px; }
.login-main h2 { margin: 0 0 6px; font-size: 24px; letter-spacing: -.04em; }
.login-main > p { margin: 0 0 26px; color: var(--muted); font-size: 14px; }
.field { margin-bottom: 17px; }
.field label { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 750; }
.input-wrap { position: relative; }
.field input { width: 100%; height: 54px; padding: 0 46px 0 16px; border: 1px solid #d6deeb; border-radius: 12px; color: var(--ink); background: #fff; transition: .2s; }
.field input:hover { border-color: #a8b7cc; }
.field input:focus { border-color: var(--blue-600); }
.input-action { position: absolute; right: 8px; top: 7px; width: 40px; height: 40px; display: grid; place-items: center; border: 0; background: transparent; color: var(--muted); border-radius: 8px; cursor: pointer; }
.primary-btn, .secondary-btn, .ghost-btn { min-height: 48px; border-radius: 11px; border: 1px solid transparent; padding: 0 18px; font-weight: 760; cursor: pointer; transition: transform .15s, background .15s, border-color .15s; }
.primary-btn { color: #fff; background: var(--blue-700); }
.primary-btn:hover { background: var(--blue-900); }
.secondary-btn { color: var(--blue-700); background: #fff; border-color: #bfd2f3; }
.secondary-btn:hover { background: var(--blue-50); }
.ghost-btn { min-height: 40px; background: transparent; color: var(--muted); }
.ghost-btn:hover { color: var(--ink); background: #eef2f7; }
.full-btn { width: 100%; }
.demo-box { margin-top: 24px; padding: 16px; border: 1px solid #cfe0fb; background: var(--blue-50); border-radius: 12px; }
.demo-box strong { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--blue-900); }
.demo-credentials { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin-top: 10px; font-size: 13px; color: #41516a; }
.fill-demo { margin-top: 13px; padding: 0; border: 0; background: transparent; color: var(--blue-700); font-size: 13px; font-weight: 750; cursor: pointer; }
.login-error { min-height: 22px; margin: 9px 0 4px; color: var(--danger); font-size: 13px; font-weight: 650; }
.privacy-note { display: flex; gap: 8px; margin-top: 22px; color: var(--muted); font-size: 12px; }

.app-shell { min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 20; height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); backdrop-filter: blur(10px); }
.topbar-title { display: flex; align-items: center; gap: 10px; font-weight: 850; letter-spacing: -.035em; }
.topbar-actions { display: flex; align-items: center; gap: 7px; }
.topbar-share { width: 36px; height: 36px; border: 0; background: transparent; color: var(--blue-700); }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border: 0; background: var(--blue-100); color: var(--blue-700); border-radius: 50%; font-weight: 850; cursor: pointer; }
.content { max-width: 1120px; margin: 0 auto; padding: 22px 17px calc(var(--nav-height) + 28px); }
.content-title { margin: 0; font-size: 25px; line-height: 1.25; letter-spacing: -.045em; }
.eyebrow { margin: 0 0 5px; color: var(--blue-700); font-size: 12px; font-weight: 800; letter-spacing: .03em; }
.subtle { color: var(--muted); }

.hero { padding: 2px 2px 20px; }
.hero h1 { margin: 0 0 8px; font-size: 27px; line-height: 1.25; letter-spacing: -.05em; }
.hero p { margin: 0; color: var(--muted); font-size: 14px; }
.today-card { padding: 20px; color: #fff; background: var(--blue-900); border-radius: var(--radius); box-shadow: var(--shadow); }
.today-card .chip { background: rgba(255,255,255,.14); color: #fff; }
.today-card h2 { margin: 14px 0 8px; font-size: 22px; letter-spacing: -.04em; }
.today-card p { margin: 0 0 20px; color: rgba(255,255,255,.75); font-size: 13px; }
.today-action { width: 100%; display: flex; align-items: center; justify-content: space-between; min-height: 50px; padding: 0 15px; border: 0; border-radius: 11px; background: #fff; color: var(--blue-900); font-weight: 800; cursor: pointer; }
.chip { display: inline-flex; align-items: center; gap: 5px; width: fit-content; min-height: 27px; padding: 4px 9px; border-radius: 999px; background: var(--blue-100); color: var(--blue-700); font-size: 11px; font-weight: 800; }

.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin: 14px 0 24px; }
.stat { min-width: 0; padding: 15px 12px; background: #fff; border: 1px solid var(--line); border-radius: 13px; }
.stat span { display: block; color: var(--muted); font-size: 11px; white-space: nowrap; }
.stat strong { display: block; margin-top: 5px; font-size: 20px; letter-spacing: -.045em; }
.stat strong small { font-size: 11px; color: var(--muted); margin-left: 2px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 26px 2px 12px; }
.section-head h2 { margin: 0; font-size: 19px; letter-spacing: -.04em; }
.section-head p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.text-btn { padding: 5px 0; border: 0; background: none; color: var(--blue-700); font-size: 12px; font-weight: 800; cursor: pointer; }
.resume-card, .weak-card { display: flex; align-items: center; gap: 13px; width: 100%; padding: 15px; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 13px; cursor: pointer; }
.resume-card:hover, .weak-card:hover { border-color: #b5c9e9; }
.unit-icon { flex: 0 0 auto; display: grid; place-items: center; width: 42px; height: 42px; background: var(--blue-100); color: var(--blue-700); border-radius: 11px; }
.resume-copy { min-width: 0; flex: 1; }
.resume-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.resume-copy span { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.progress-track { height: 7px; overflow: hidden; background: #e8edf4; border-radius: 10px; }
.progress-fill { height: 100%; background: var(--blue-600); border-radius: inherit; transition: width .3s ease; }
.resume-copy .progress-track { margin-top: 9px; }
.arrow { color: #8a98aa; }

.section-switch { display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; padding: 2px 0 8px; }
.section-switch::-webkit-scrollbar { display: none; }
.segment-btn { flex: 0 0 auto; min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--muted); font-size: 13px; font-weight: 750; cursor: pointer; }
.segment-btn.active { border-color: var(--blue-700); background: var(--blue-700); color: #fff; }
.unit-list { display: grid; gap: 9px; }
.unit-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 13px; width: 100%; padding: 15px; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 13px; cursor: pointer; }
.unit-row:hover { border-color: #b5c9e9; box-shadow: 0 6px 18px rgba(23,63,112,.06); }
.unit-index { display: grid; place-items: center; width: 38px; height: 38px; background: #f0f4fa; color: #52657d; border-radius: 10px; font-size: 12px; font-weight: 850; }
.unit-copy { min-width: 0; }
.unit-copy strong { display: block; font-size: 14px; letter-spacing: -.02em; }
.unit-meta { display: flex; align-items: center; gap: 7px; margin-top: 5px; color: var(--muted); font-size: 11px; }
.mini-progress { width: 58px; height: 5px; overflow: hidden; background: #e9edf3; border-radius: 5px; }
.mini-progress i { display: block; height: 100%; background: var(--blue-600); }

.bottom-nav { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; height: calc(var(--nav-height) + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(4, 1fr); padding: 7px 8px env(safe-area-inset-bottom); background: rgba(255,255,255,.97); border-top: 1px solid var(--line); backdrop-filter: blur(12px); }
.nav-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; border-radius: 10px; background: transparent; color: #8190a4; font-size: 10px; font-weight: 750; cursor: pointer; }
.nav-btn.active { color: var(--blue-700); }
.nav-btn .icon { width: 22px; height: 22px; }

.detail-top { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; }
.icon-btn { flex: 0 0 auto; display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; }
.detail-head { flex: 1; min-width: 0; }
.detail-head h1 { margin: 0; font-size: 21px; letter-spacing: -.04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.detail-head p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
.detail-summary { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; padding: 17px; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.summary-copy strong { display: block; font-size: 13px; }
.summary-copy .progress-track { margin-top: 10px; }
.summary-score { min-width: 66px; text-align: right; }
.summary-score strong { display: block; font-size: 23px; }
.summary-score span { color: var(--muted); font-size: 10px; }
.tab-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 16px 0; padding: 4px; background: #e9eef5; border-radius: 11px; }
.tab-btn { min-height: 42px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 800; cursor: pointer; }
.tab-btn.active { color: var(--ink); background: #fff; box-shadow: 0 2px 8px rgba(25,45,75,.08); }

.card-counter { display: flex; align-items: center; justify-content: space-between; margin: 4px 2px 11px; color: var(--muted); font-size: 12px; }
.memory-card { min-height: 330px; display: flex; flex-direction: column; padding: 24px 21px; background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--blue-600); border-radius: 14px; box-shadow: var(--shadow); }
.memory-card h2 { margin: 15px 0 14px; font-size: 23px; line-height: 1.3; letter-spacing: -.045em; }
.memory-card p { margin: 0; color: #34445a; font-size: 17px; line-height: 1.8; word-break: keep-all; }
.source-tag { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 750; }
.number-highlight { display: inline; padding: 1px 4px; border-radius: 4px; background: #fff0d5; color: #a13b00; font-weight: 900; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.card-tip { margin-top: auto; padding-top: 24px; color: #8a98aa; font-size: 11px; }
.card-actions { display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: 8px; margin-top: 13px; }
.card-actions button { min-height: 49px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-weight: 750; cursor: pointer; }
.card-actions .known { color: #fff; background: var(--blue-700); border-color: var(--blue-700); }
.card-actions button:disabled { opacity: .35; cursor: default; }

.quiz-head { margin: 4px 2px 11px; }
.quiz-head-row { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; }
.quiz-head .progress-track { margin-top: 9px; }
.quiz-card { padding: 22px 19px; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.quiz-number { color: var(--blue-700); font-size: 12px; font-weight: 900; }
.quiz-question { min-height: 104px; display: flex; align-items: center; margin: 5px 0 17px; font-size: 21px; line-height: 1.55; font-weight: 800; letter-spacing: -.035em; word-break: keep-all; }
.ox-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ox-btn { min-height: 92px; display: flex; align-items: center; justify-content: center; gap: 9px; border: 1.5px solid #cad4e2; border-radius: 12px; background: #fff; font-size: 30px; font-weight: 900; cursor: pointer; }
.ox-btn span { font-size: 13px; font-weight: 800; }
.ox-btn.o { color: var(--blue-700); }
.ox-btn.x { color: var(--danger); }
.ox-btn.selected.correct { border-color: var(--success); background: var(--success-bg); color: var(--success); }
.ox-btn.selected.wrong { border-color: var(--danger); background: var(--danger-bg); color: var(--danger); }
.ox-btn.dim { opacity: .45; }
.answer-panel { margin-top: 14px; padding: 16px; border-radius: 11px; }
.answer-panel.correct { background: var(--success-bg); color: #075d3c; }
.answer-panel.wrong { background: var(--danger-bg); color: #8a1c15; }
.answer-title { display: flex; align-items: center; gap: 7px; font-weight: 850; }
.answer-panel p { margin: 7px 0 0; font-size: 13px; line-height: 1.6; }
.next-btn { width: 100%; margin-top: 12px; }
.quiz-complete { padding: 34px 22px; text-align: center; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.result-ring { display: grid; place-items: center; width: 116px; height: 116px; margin: 0 auto 18px; border-radius: 50%; border: 10px solid var(--blue-100); color: var(--blue-700); font-size: 27px; font-weight: 900; }
.quiz-complete h2 { margin: 0 0 7px; font-size: 22px; }
.quiz-complete p { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
.result-actions { display: grid; gap: 9px; }
.kakao-share-btn { min-height: 49px; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 0 18px; border: 1px solid #e6c900; border-radius: 11px; background: #fee500; color: #191919; font-weight: 850; cursor: pointer; }
.kakao-share-btn:hover { background: #f6dd00; }

.weak-list { display: grid; gap: 9px; }
.empty-state { padding: 44px 22px; text-align: center; background: #fff; border: 1px dashed #cbd5e2; border-radius: 14px; }
.empty-state .unit-icon { margin: 0 auto 14px; }
.empty-state h2 { margin: 0 0 7px; font-size: 19px; }
.empty-state p { margin: 0; color: var(--muted); font-size: 13px; }
.wrong-item { padding: 17px; background: #fff; border: 1px solid var(--line); border-radius: 13px; }
.wrong-item-top { display: flex; justify-content: space-between; gap: 8px; }
.wrong-item .chip { background: var(--danger-bg); color: var(--danger); }
.wrong-item h3 { margin: 12px 0 6px; font-size: 15px; line-height: 1.55; }
.wrong-item p { margin: 0; color: var(--muted); font-size: 12px; }
.wrong-item button { margin-top: 13px; }

.profile-card { padding: 20px; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.profile-person { display: flex; align-items: center; gap: 13px; }
.profile-person .avatar { width: 50px; height: 50px; font-size: 18px; }
.profile-person strong { display: block; }
.profile-person span { color: var(--muted); font-size: 12px; }
.profile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); text-align: center; }
.profile-grid strong { display: block; font-size: 18px; }
.profile-grid span { color: var(--muted); font-size: 10px; }
.settings-list { margin-top: 14px; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.setting-row { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 58px; padding: 0 16px; border: 0; border-bottom: 1px solid var(--line); background: #fff; text-align: left; cursor: pointer; }
.setting-row:last-child { border-bottom: 0; }
.setting-row.danger { color: var(--danger); }
.setting-label { display: inline-flex; align-items: center; gap: 9px; }
.copyright-box { margin-top: 16px; padding: 15px; background: #f0f3f7; color: var(--muted); border-radius: 12px; font-size: 11px; line-height: 1.6; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: calc(var(--nav-height) + 15px); transform: translate(-50%, 20px); min-width: 220px; max-width: calc(100vw - 34px); padding: 12px 16px; color: #fff; background: #17243a; border-radius: 10px; text-align: center; font-size: 13px; font-weight: 700; opacity: 0; pointer-events: none; transition: .25s; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (min-width: 760px) {
  .login-page { display: grid; grid-template-columns: minmax(350px, .95fr) minmax(420px, 1.05fr); }
  .login-brand { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 64px max(50px, 7vw); }
  .login-brand h1 { margin-top: 70px; }
  .login-main { align-self: center; width: 100%; padding: 60px; }
  .content { padding: 30px 30px calc(var(--nav-height) + 32px); }
  .home-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 18px; align-items: stretch; }
  .today-card { min-height: 230px; }
  .stats-grid { grid-template-columns: repeat(3, minmax(120px, 1fr)); margin-top: 0; }
  .stat { display: flex; flex-direction: column; justify-content: center; }
  .unit-list { grid-template-columns: 1fr 1fr; }
  .study-wrap { max-width: 720px; margin: 0 auto; }
  .weak-list { grid-template-columns: 1fr 1fr; }
  .wrong-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
}

@media (min-width: 1040px) {
  .app-shell { padding-left: 218px; }
  .topbar { left: 218px; padding: 0 30px; }
  .bottom-nav { top: 0; right: auto; width: 218px; height: 100vh; grid-template-columns: 1fr; grid-template-rows: auto repeat(4, 54px) 1fr; align-content: start; gap: 6px; padding: 25px 14px; border-top: 0; border-right: 1px solid var(--line); }
  .bottom-nav::before { content: "합격노트"; display: flex; align-items: center; height: 52px; margin: 0 8px 22px; color: var(--blue-900); font-size: 19px; font-weight: 900; letter-spacing: -.04em; }
  .nav-btn { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 0 13px; font-size: 13px; }
  .nav-btn.active { background: var(--blue-100); }
  .toast { bottom: 25px; }
}

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