:root {
  --cream: #f7f5ef;
  --paper: #fffdf8;
  --ink: #1f1f1c;
  --muted: #6f716f;
  --line: #d9d9d2;
  --orange: #f47b32;
  --orange-soft: #fff0e5;
  --navy: #213a5c;
  --navy-soft: #eaf0f6;
  --green: #2f7d59;
  --green-soft: #eaf5ef;
  --red: #c64b4b;
  --red-soft: #fbecec;
  --shadow: 0 16px 48px rgba(31, 31, 28, .08);
  --radius: 20px;
}

* { box-sizing: border-box; }

html { background: #e9e8e3; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(145deg, #ebe9e2 0%, #f5f3ed 48%, #e6eaf0 100%);
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

.app-shell {
  position: relative;
  width: min(100%, 480px);
  min-height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--cream);
  box-shadow: var(--shadow);
}

.screen { min-height: 100dvh; padding: 0 20px 104px; }
.screen.quiz-screen { padding-bottom: 32px; }

.brand-header {
  padding: 24px 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-lockup { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  color: #fff;
  background: var(--navy);
}
.brand-mark svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.brand-name { font-size: 17px; line-height: 1.25; font-weight: 850; }
.brand-name strong { color: var(--orange); font-size: 19px; }
.prototype-badge {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid #e3ae87;
  border-radius: 999px;
  color: #91491d;
  background: var(--orange-soft);
  font-size: 11px;
  font-weight: 800;
}

.page-header {
  min-height: 68px;
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
  gap: 6px;
}
.page-header h1 { margin: 0; text-align: center; font-size: 18px; }
.icon-btn {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  cursor: pointer;
  font-size: 22px;
}
.icon-btn:hover { background: rgba(33,58,92,.07); }

.home-header { min-height: 92px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.home-actions { display: flex; gap: 8px; }
.top-action { width: 43px; height: 43px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: var(--paper); cursor: pointer; }
.top-action svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.home-login, .install-strip { width: 100%; min-height: 67px; padding: 12px 15px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; text-align: left; border: 1px solid var(--line); border-radius: 17px; background: var(--paper); cursor: pointer; }
.home-login > span:nth-child(2) { display: grid; gap: 3px; }
.home-login strong, .install-strip strong { font-size: 14px; }
.home-login strong i { margin-left: 4px; padding: 3px 7px; border-radius: 99px; color: var(--muted); background: var(--navy-soft); font-size: 9px; font-style: normal; vertical-align: 2px; }
.home-login small, .install-strip small { color: var(--muted); font-size: 11px; font-weight: 650; }
.home-login em, .install-strip em { color: var(--muted); font-size: 22px; font-style: normal; }
.home-login .google-mark { width: 38px; height: 38px; }
.home-login.login-emphasis { border-color: rgba(244,123,50,.4); background: linear-gradient(135deg, var(--paper), var(--orange-soft)); box-shadow: 0 9px 24px rgba(244,123,50,.1); }
.home-login.login-emphasis strong { color: var(--orange); }
.home-quick-actions { margin: -2px 0 20px; display: flex; justify-content: flex-end; gap: 8px; }
.quick-chip { min-height: 38px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line); border-radius: 12px; color: var(--navy); background: var(--paper); cursor: pointer; font-size: 11px; font-weight: 800; }
.quick-chip.google { border-color: rgba(244,123,50,.38); color: #9a4e1d; background: var(--orange-soft); }
.quick-chip span { color: #4285f4; font-size: 14px; font-weight: 900; }
.quick-chip svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.home-quick-actions + .home-section-title { margin-top: 0; }
.install-strip { margin-top: 9px; min-height: 54px; grid-template-columns: auto auto 1fr auto; color: var(--navy); background: var(--navy-soft); border-color: transparent; }
.install-strip > span { display: grid; place-items: center; }
.install-strip svg, .install-modal-icon svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.install-strip small { justify-self: end; }
.home-section-title { margin-top: 24px; }
.continue-card { position: relative; width: 100%; min-height: 164px; padding: 23px 72px 26px 22px; overflow: hidden; display: flex; flex-direction: column; align-items: flex-start; text-align: left; border: 0; border-radius: 24px; color: #fff; background: linear-gradient(140deg, #ef6f2a 0%, #ff8f42 100%); box-shadow: 0 16px 34px rgba(244,123,50,.25); cursor: pointer; }
.continue-book { font-size: 12px; font-weight: 800; opacity: .86; }
.continue-card strong { margin-top: 9px; font-size: 25px; line-height: 1.15; letter-spacing: -.035em; }
.continue-detail { margin-top: 8px; font-size: 12px; font-weight: 700; opacity: .9; }
.continue-arrow { position: absolute; top: 50%; right: 23px; width: 47px; height: 47px; display: grid; place-items: center; transform: translateY(-50%); border-radius: 50%; color: var(--orange); background: #fff; font-size: 26px; font-weight: 900; }
.continue-arrow svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.continue-progress { position: absolute; left: 22px; right: 22px; bottom: 18px; height: 6px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.35); }
.continue-progress i { display: block; height: 100%; border-radius: inherit; background: #fff; }

.hero { padding: 26px 0 24px; }
.eyebrow { margin: 0 0 8px; color: var(--orange); font-size: 13px; font-weight: 850; letter-spacing: .04em; }
.hero h1 { margin: 0; font-size: clamp(27px, 7vw, 34px); line-height: 1.2; letter-spacing: -.045em; }
.hero p { margin: 12px 0 0; color: var(--muted); font-size: 15px; line-height: 1.65; }

.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 6px 0 12px; }
.section-head h2 { margin: 0; font-size: 18px; letter-spacing: -.025em; }
.section-head span { color: var(--muted); font-size: 12px; }

.book-grid { display: grid; gap: 12px; }
.book-card {
  width: 100%;
  padding: 18px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.book-card:hover { transform: translateY(-2px); border-color: #b8c3cf; box-shadow: 0 10px 24px rgba(33,58,92,.08); }
.book-card strong { display: block; margin-bottom: 7px; font-size: 17px; }
.book-meta { color: var(--muted); font-size: 13px; }
.book-progress { margin-top: 12px; display: flex; align-items: center; gap: 8px; color: var(--navy); font-size: 12px; font-weight: 750; }
.progress-track { width: 92px; height: 7px; overflow: hidden; border-radius: 99px; background: #e7e5df; }
.progress-fill { height: 100%; border-radius: inherit; background: var(--orange); }
.chevron { color: var(--navy); font-size: 24px; }

.info-strip {
  margin-top: 18px;
  padding: 14px 16px;
  display: flex;
  gap: 11px;
  border-radius: 16px;
  color: #4f4d48;
  background: #ece9e0;
  font-size: 13px;
  line-height: 1.55;
}
.beta-strip { color: #754319; background: var(--orange-soft); }
.beta-strip b { color: var(--orange); font-size: 16px; }

.bottom-nav {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100%, 480px);
  min-height: 78px;
  padding: 9px 12px max(9px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid rgba(217,217,210,.9);
  background: rgba(255,253,248,.94);
  backdrop-filter: blur(18px);
}
.nav-btn { border: 0; background: transparent; border-radius: 14px; cursor: pointer; color: #7c7e7b; font-size: 11px; font-weight: 750; }
.nav-btn b { display: grid; place-items: center; margin: 0 auto 4px; width: 24px; height: 24px; }
.nav-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.nav-btn.active { color: var(--navy); background: var(--navy-soft); }

.pass-tabs { padding: 4px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; border-radius: 15px; background: #eae8e1; }
.pass-tab { min-height: 44px; border: 0; border-radius: 12px; background: transparent; cursor: pointer; font-weight: 780; }
.pass-tab.active { background: var(--paper); color: var(--navy); box-shadow: 0 2px 10px rgba(31,31,28,.08); }

.summary-row { margin: 18px 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mini-stat { padding: 14px 8px; text-align: center; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); }
.mini-stat strong { display: block; font-size: 18px; color: var(--navy); }
.mini-stat span { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
.record-compare { margin-top: 18px; }

.round-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.round-btn { min-height: 62px; padding: 8px 4px; border: 1px solid var(--line); border-radius: 15px; background: var(--paper); cursor: pointer; font-weight: 780; }
.round-btn small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; font-weight: 700; }
.round-btn.completed { border-color: #a8cbb8; background: var(--green-soft); color: var(--green); }
.round-btn.draft { border-color: #efb98f; background: var(--orange-soft); color: #9a4e1d; }
.round-btn.prototype { outline: 2px solid var(--orange); outline-offset: 1px; }
.round-btn.search-target { animation: searchPulse 1.1s ease-in-out 2; outline: 3px solid var(--orange); outline-offset: 2px; }

.legend { margin: 14px 0 0; display: flex; gap: 14px; color: var(--muted); font-size: 11px; }
.legend i { display: inline-block; width: 9px; height: 9px; margin-right: 4px; border-radius: 50%; background: #d9d9d2; }
.legend .done i { background: var(--green); }
.legend .doing i { background: var(--orange); }

.guide-card, .result-card, .panel {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}
.guide-title { margin: 0 0 8px; font-size: 21px; }
.guide-meta { color: var(--navy); font-size: 14px; font-weight: 800; }
.guide-list { margin: 22px 0; padding: 0; list-style: none; display: grid; gap: 14px; }
.guide-list li { display: grid; grid-template-columns: 32px 1fr; gap: 11px; align-items: start; color: #4f514f; font-size: 14px; line-height: 1.55; }
.guide-list b { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; color: var(--navy); background: var(--navy-soft); }

.primary-btn, .secondary-btn, .danger-btn {
  min-height: 52px;
  padding: 0 18px;
  border-radius: 15px;
  font-weight: 850;
  cursor: pointer;
}
.primary-btn { border: 1px solid var(--orange); color: #fff; background: var(--orange); box-shadow: 0 8px 18px rgba(244,123,50,.22); }
.secondary-btn { border: 1px solid var(--line); background: var(--paper); }
.danger-btn { border: 1px solid #e1aaaa; color: var(--red); background: var(--red-soft); }
.wide { width: 100%; }
.button-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.quiz-top {
  margin: 0 -20px;
  padding: 12px 20px 14px;
  position: sticky;
  z-index: 10;
  top: 0;
  border-bottom: 1px solid rgba(217,217,210,.9);
  background: rgba(247,245,239,.96);
  backdrop-filter: blur(16px);
}
.quiz-meta { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.quiz-context { color: var(--muted); font-size: 12px; font-weight: 750; }
.timer { display: flex; align-items: center; gap: 7px; color: var(--navy); font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 900; }
.timer span { color: var(--ink); font-size: 18px; }
.question-strip { margin-top: 12px; padding-bottom: 3px; display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; }
.question-strip::-webkit-scrollbar { display: none; }
.q-chip { flex: 0 0 36px; height: 36px; border: 1px solid var(--line); border-radius: 11px; background: var(--paper); cursor: pointer; font-size: 12px; font-weight: 800; }
.q-chip.answered { color: var(--green); border-color: #9cc6af; background: var(--green-soft); }
.q-chip.current { color: #fff; border-color: var(--navy); background: var(--navy); }

.question-area { padding: 34px 0 24px; }
.question-kicker { color: var(--orange); font-size: 13px; font-weight: 850; }
.question-area h1 { margin: 6px 0 4px; font-size: 30px; }
.question-help { margin: 0; color: var(--muted); font-size: 14px; }
.answer-grid { margin-top: 28px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.answer-btn { min-height: 76px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); cursor: pointer; font-size: 28px; font-weight: 900; }
.answer-btn.selected { color: #fff; border-color: var(--orange); background: var(--orange); box-shadow: 0 10px 20px rgba(244,123,50,.2); }
.quiz-actions { margin-top: 26px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.submit-btn { grid-column: 1 / -1; margin-top: 5px; }
.save-note { margin: 14px 0 0; text-align: center; color: var(--muted); font-size: 11px; }

.result-hero { padding: 26px 20px; text-align: center; color: #fff; border: 0; background: var(--navy); }
.result-hero .label { color: #ced9e6; font-size: 12px; font-weight: 750; }
.score { margin: 8px 0 0; font-size: 56px; line-height: 1; font-weight: 900; letter-spacing: -.05em; }
.score small { font-size: 18px; }
.result-meta { margin-top: 15px; display: flex; justify-content: center; gap: 20px; color: #f5f8fb; font-size: 13px; }
.time-highlight { margin-top: 14px; padding: 13px; border-radius: 14px; color: var(--navy); background: #f1f5f9; font-weight: 850; }
.time-change { display: block; margin-top: 4px; color: var(--green); font-size: 12px; }
.compare-grid { margin-top: 12px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.compare-grid.two-col { grid-template-columns: repeat(2, 1fr); }
.compare-item { padding: 14px 8px; text-align: center; border-radius: 15px; background: #f0eee7; }
.compare-item strong { display: block; color: var(--navy); font-size: 18px; }
.compare-item span { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; }
.compare-item.position { background: var(--orange-soft); box-shadow: inset 0 0 0 1px rgba(244,123,50,.28); }
.compare-item.position strong { color: var(--orange); }

.tab-row { margin: 16px 0; display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); }
.result-tab { padding: 13px 8px; border: 0; border-bottom: 3px solid transparent; background: transparent; cursor: pointer; font-weight: 800; }
.result-tab.active { color: var(--navy); border-bottom-color: var(--navy); }

.item-list { display: grid; gap: 8px; }
.item-row { padding: 14px; display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.item-row.wrong { border-color: #edc2c2; background: #fff8f8; }
.item-number { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; background: #eceae3; font-weight: 850; }
.item-path { font-size: 13px; font-weight: 780; }
.item-answer { margin-top: 4px; color: var(--muted); font-size: 11px; }
.result-mark { color: var(--green); font-size: 18px; font-weight: 900; }
.wrong .result-mark { color: var(--red); }

.filter-row { margin: 2px 0 16px; display: flex; gap: 8px; overflow-x: auto; }
.filter-chip { min-height: 38px; padding: 0 14px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 99px; background: var(--paper); cursor: pointer; font-size: 12px; font-weight: 780; }
.filter-chip.active { color: #fff; border-color: var(--navy); background: var(--navy); }
.analysis-context { margin: 0 0 18px; padding: 17px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); }
.analysis-context > label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 11px; font-weight: 800; }
.analysis-select-wrap { position: relative; }
.analysis-select-wrap select { width: 100%; min-height: 48px; padding: 0 40px 0 13px; appearance: none; border: 1px solid var(--line); border-radius: 13px; color: var(--ink); background: var(--cream); font-size: 13px; font-weight: 800; cursor: pointer; }
.analysis-select-wrap > span { position: absolute; top: 50%; right: 14px; transform: translateY(-54%); color: var(--navy); pointer-events: none; font-size: 18px; }
.analysis-context-meta { margin-top: 12px; display: grid; gap: 4px; }
.analysis-context-meta strong { color: var(--navy); font-size: 13px; }
.analysis-context-meta span { color: var(--muted); font-size: 11px; }
.empty { padding: 44px 20px; text-align: center; color: var(--muted); border: 1px dashed #c9c8c1; border-radius: var(--radius); background: rgba(255,255,255,.35); }

.record-card { margin-bottom: 10px; padding: 16px; display: grid; grid-template-columns: 1fr auto; gap: 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); }
.record-card strong { font-size: 15px; }
.record-sub { margin-top: 6px; color: var(--muted); font-size: 12px; }
.record-score { color: var(--navy); font-size: 23px; font-weight: 900; }
.trend { margin: 10px 0 18px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.trend-line { margin-top: 18px; display: flex; align-items: end; gap: 9px; height: 112px; }
.trend-bar-wrap { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: end; align-items: center; gap: 5px; }
.trend-bar { width: 70%; min-height: 8px; border-radius: 8px 8px 3px 3px; background: var(--orange); }
.trend-bar.time { background: var(--navy); }
.trend-value, .trend-label { font-size: 10px; color: var(--muted); }

.weak-card { margin-bottom: 10px; padding: 17px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); }
.weak-top { display: flex; justify-content: space-between; gap: 10px; }
.weak-path { font-size: 13px; font-weight: 800; }
.weak-rate { color: var(--red); font-size: 18px; font-weight: 900; }
.rate-track { margin-top: 12px; height: 8px; overflow: hidden; border-radius: 99px; background: #eeeae5; }
.rate-fill { height: 100%; border-radius: inherit; background: var(--red); }
.weak-meta { margin-top: 7px; color: var(--muted); font-size: 11px; }
.area-analysis { margin-bottom: 22px; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); }
.area-row { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.area-row:last-child { border-bottom: 0; }
.area-row > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.area-row strong { font-size: 13px; }
.area-row span { color: var(--navy); font-size: 14px; font-weight: 900; }
.rate-fill.area { background: var(--orange); }

.settings-list { display: grid; gap: 10px; }
.setting-card { padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); }
.setting-card h3 { margin: 0 0 7px; font-size: 15px; }
.setting-card p { margin: 0 0 14px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.beta-scope { border-color: rgba(33,58,92,.2); background: linear-gradient(145deg, var(--paper), var(--navy-soft)); }
.beta-pending { padding: 11px 12px; border-radius: 12px; color: var(--muted); background: rgba(255,255,255,.48); font-size: 11px; line-height: 1.55; }
.account-emphasis { border-color: rgba(244,123,50,.42); background: linear-gradient(145deg, var(--paper), var(--orange-soft)); }
.theme-switch { padding: 4px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; border-radius: 14px; background: #eae8e1; }
.theme-option { min-height: 42px; border: 0; border-radius: 11px; background: transparent; cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 800; }
.theme-option.active { color: var(--navy); background: var(--paper); box-shadow: 0 2px 10px rgba(31,31,28,.1); }
.setting-title-row { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.setting-title-row h3 { display: inline-block; margin-right: 7px; }
.soon-badge { display: inline-block; padding: 3px 7px; border-radius: 99px; color: #8d4a20; background: var(--orange-soft); font-size: 9px; font-weight: 850; vertical-align: 2px; }
.google-mark, .google-modal-mark { display: grid; place-items: center; flex: 0 0 auto; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; color: #4285f4; background: #fff; font-size: 17px; font-weight: 900; }
.google-btn { min-height: 52px; padding: 0 18px; display: flex; align-items: center; justify-content: center; gap: 10px; border: 1px solid var(--line); border-radius: 15px; color: #303134; background: #fff; cursor: pointer; font-weight: 800; }
.google-btn span { color: #4285f4; font-size: 17px; font-weight: 900; }
.google-modal-mark { width: 42px; height: 42px; margin-bottom: 14px; }
.setting-link-list { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); }
.setting-link { width: 100%; min-height: 64px; padding: 13px 16px; display: flex; align-items: center; justify-content: space-between; gap: 14px; text-align: left; border: 0; border-bottom: 1px solid var(--line); color: var(--ink); background: transparent; cursor: pointer; }
.setting-link:last-child { border-bottom: 0; }
.setting-link span { display: grid; gap: 4px; }
.setting-link b { font-size: 14px; }
.setting-link small { color: var(--muted); font-size: 10px; }
.setting-link em { color: var(--muted); font-size: 22px; font-style: normal; }

.modal-backdrop { position: fixed; z-index: 100; inset: 0; padding: 20px; display: grid; place-items: end center; background: rgba(20,24,29,.48); }
.modal { width: min(100%, 440px); padding: 22px; border-radius: 24px 24px 18px 18px; background: var(--paper); box-shadow: 0 24px 80px rgba(0,0,0,.25); animation: rise .2s ease-out; }
.modal h2 { margin: 0; font-size: 21px; }
.modal p { margin: 10px 0 18px; color: var(--muted); line-height: 1.55; font-size: 14px; }
.unanswered { margin: -4px 0 18px; padding: 12px; border-radius: 14px; color: #8a4b1f; background: var(--orange-soft); font-size: 12px; font-weight: 750; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.prototype-note { margin: -4px 0 18px; padding: 12px; border-radius: 13px; color: var(--muted); background: var(--navy-soft); font-size: 11px; line-height: 1.55; }
.modal-title-row { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.modal-title-row h2 { margin-top: 4px; }
.modal-close { width: 38px; height: 38px; flex: 0 0 auto; border: 0; border-radius: 12px; color: var(--muted); background: var(--navy-soft); cursor: pointer; font-size: 24px; }
.modal-eyebrow { margin: 0 0 5px !important; color: var(--orange) !important; font-size: 10px !important; font-weight: 850; letter-spacing: .05em; }
.policy-modal { max-height: min(82dvh, 720px); display: flex; flex-direction: column; }
.policy-content { margin: 17px 0; padding-right: 4px; overflow-y: auto; }
.policy-content h3 { margin: 18px 0 5px; font-size: 14px; }
.policy-content h3:first-of-type { margin-top: 0; }
.policy-content p { margin: 0 0 10px; font-size: 12px; line-height: 1.65; }
.policy-content .policy-date { margin-bottom: 14px; color: var(--muted); font-size: 11px; }
.policy-content .prototype-note { margin: 16px 0 0; }
.search-modal { align-self: center; }
.search-modal form { margin-top: 20px; display: grid; gap: 10px; }
.search-field { min-height: 56px; padding: 0 14px; display: flex; align-items: center; gap: 10px; border: 2px solid var(--navy); border-radius: 15px; background: var(--paper); }
.search-field svg { width: 21px; height: 21px; fill: none; stroke: var(--navy); stroke-width: 1.8; stroke-linecap: round; }
.search-field input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 16px; font-weight: 750; }
.search-field input::placeholder { color: var(--muted); font-weight: 550; }
.search-help { margin: 13px 2px 0 !important; font-size: 11px !important; }
.install-modal-icon { width: 46px; height: 46px; margin-bottom: 14px; display: grid; place-items: center; border-radius: 15px; color: var(--navy); background: var(--navy-soft); }

.toast { position: fixed; z-index: 150; left: 50%; bottom: 92px; max-width: calc(100% - 40px); padding: 11px 16px; transform: translate(-50%, 20px); border-radius: 99px; color: #fff; background: rgba(31,31,28,.92); opacity: 0; pointer-events: none; font-size: 12px; font-weight: 750; transition: opacity .18s ease, transform .18s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes rise { from { transform: translateY(28px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes searchPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(244,123,50,.1); } 50% { box-shadow: 0 0 0 7px rgba(244,123,50,.18); } }

html[data-theme="dark"] {
  --cream: #11161f;
  --paper: #18212c;
  --ink: #f5f3ed;
  --muted: #aab3be;
  --line: #34404f;
  --orange-soft: #37261d;
  --navy: #8fb1df;
  --navy-soft: #213148;
  --green: #76c89d;
  --green-soft: #1d382d;
  --red: #ef8b8b;
  --red-soft: #3b2428;
}
html[data-theme="dark"], html[data-theme="dark"] body { background: #0b1017; }
html[data-theme="dark"] body { background: linear-gradient(145deg, #0b1017 0%, #111821 50%, #101827 100%); }
html[data-theme="dark"] .brand-mark,
html[data-theme="dark"] .result-hero,
html[data-theme="dark"] .q-chip.current,
html[data-theme="dark"] .filter-chip.active { color: #fff; background: #233f64; }
html[data-theme="dark"] .bottom-nav,
html[data-theme="dark"] .quiz-top { background: rgba(17,22,31,.94); }
html[data-theme="dark"] .progress-track,
html[data-theme="dark"] .compare-item,
html[data-theme="dark"] .theme-switch,
html[data-theme="dark"] .item-number { background: #222c38; }
html[data-theme="dark"] .compare-item.position { background: var(--orange-soft); }
html[data-theme="dark"] .time-highlight { color: #cfe1fb; background: #1c2a3b; }
html[data-theme="dark"] .info-strip { color: #c2c8cf; background: #202832; }
html[data-theme="dark"] .item-row.wrong { background: #2b1d20; }

@media (prefers-color-scheme: dark) {
  html[data-theme="system"] {
    --cream: #11161f;
    --paper: #18212c;
    --ink: #f5f3ed;
    --muted: #aab3be;
    --line: #34404f;
    --orange-soft: #37261d;
    --navy: #8fb1df;
    --navy-soft: #213148;
    --green: #76c89d;
    --green-soft: #1d382d;
    --red: #ef8b8b;
    --red-soft: #3b2428;
  }
  html[data-theme="system"], html[data-theme="system"] body { background: #0b1017; }
  html[data-theme="system"] body { background: linear-gradient(145deg, #0b1017 0%, #111821 50%, #101827 100%); }
  html[data-theme="system"] .brand-mark,
  html[data-theme="system"] .result-hero,
  html[data-theme="system"] .q-chip.current,
  html[data-theme="system"] .filter-chip.active { color: #fff; background: #233f64; }
  html[data-theme="system"] .bottom-nav,
  html[data-theme="system"] .quiz-top { background: rgba(17,22,31,.94); }
  html[data-theme="system"] .progress-track,
  html[data-theme="system"] .compare-item,
  html[data-theme="system"] .theme-switch,
  html[data-theme="system"] .item-number { background: #222c38; }
  html[data-theme="system"] .compare-item.position { background: var(--orange-soft); }
  html[data-theme="system"] .time-highlight { color: #cfe1fb; background: #1c2a3b; }
  html[data-theme="system"] .info-strip { color: #c2c8cf; background: #202832; }
  html[data-theme="system"] .item-row.wrong { background: #2b1d20; }
}

@media (min-width: 700px) {
  body { padding: 24px 0; }
  .app-shell { min-height: calc(100dvh - 48px); border-radius: 28px; }
  .screen { min-height: calc(100dvh - 48px); }
  .bottom-nav { bottom: 24px; border-radius: 0 0 28px 28px; }
  .modal-backdrop { place-items: center; }
  .modal { border-radius: 24px; }
}

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