:root {
  --wine: #183f4d;
  --wine-dark: #102a34;
  --forest: #315e50;
  --gold: #c49a4a;
  --paper: #f2f0e9;
  --panel: #fbfaf6;
  --ink: #172126;
  --muted: #617077;
  --line: #cfd6d4;
  --ok: #2f6f54;
  --bad: #a3483f;
  --radius: 14px;
  --shadow: 0 14px 34px rgba(19, 48, 58, .09);
  font-family: "Segoe UI", "Noto Sans KR", "Noto Sans", "Apple SD Gothic Neo", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; overflow-x: hidden; color: var(--ink); background: var(--paper); -webkit-tap-highlight-color: transparent; }
button, input, textarea, select { font: inherit; }
button, a { touch-action: manipulation; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid rgba(170, 130, 66, .38); outline-offset: 2px; }
#app { min-height: 100dvh; }
.shell { width: min(100%, 880px); min-height: 100dvh; margin: 0 auto; padding: 18px 18px calc(34px + env(safe-area-inset-bottom)); }
.brand { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 48px; }
.brand strong { color: var(--wine-dark); letter-spacing: .04em; }
.brand small { display: block; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.brand-actions { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.ghost-button, .text-button { border: 0; color: var(--wine); background: transparent; font-weight: 800; cursor: pointer; }
.hero { position: relative; isolation: isolate; margin-top: 18px; padding: 30px 26px; overflow: hidden; border-radius: 18px; color: #f7fbfa; background: linear-gradient(135deg, var(--wine), var(--wine-dark)); box-shadow: var(--shadow); }
.hero::before { position: absolute; z-index: -1; top: -85px; right: -70px; width: 330px; height: 330px; border: 1px solid rgba(255,255,255,.14); border-radius: 42% 58% 52% 48%; box-shadow: 0 0 0 28px rgba(255,255,255,.035), 0 0 0 56px rgba(255,255,255,.025), 0 0 0 84px rgba(255,255,255,.018); content: ""; transform: rotate(24deg); }
.eyebrow { margin: 0 0 10px; color: #d9b26b; font-size: 12px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
h1, h2, h3, p { word-break: keep-all; overflow-wrap: break-word; }
h1 { margin: 0; font-size: clamp(32px, 8vw, 54px); line-height: 1.03; }
.hero h1 { max-width: 620px; letter-spacing: -.045em; }
.hero .lead { max-width: 650px; margin: 18px 0 0; color: #dce8e8; line-height: 1.7; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 24px; }
.stats span { min-width: 0; padding: 11px 5px; border: 1px solid rgba(255,255,255,.16); border-radius: 12px; text-align: center; background: rgba(255,255,255,.06); }
.stats strong, .stats small { display: block; }
.stats strong { font-size: 20px; }
.stats small { margin-top: 3px; color: #c7d8d9; font-size: 11px; }
.level-track { height: 5px; margin-top: 10px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.13); }
.level-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #d5ad63, #fff0bd); }
.section { margin-top: 24px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.section-heading h2 { margin: 0; font-size: 21px; }
.mode-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.mode-card { min-height: 170px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); text-align: left; color: var(--ink); background: var(--panel); box-shadow: var(--shadow); cursor: pointer; }
.mode-card.is-primary { color: #fff; border-color: var(--wine); background: linear-gradient(145deg, var(--wine), #24566a); }
.mode-card .tag { display: inline-flex; padding: 5px 8px; border-radius: 999px; color: var(--wine); background: #f2e7dd; font-size: 11px; font-weight: 900; }
.mode-card.is-primary .tag { color: var(--wine-dark); background: #e4c787; }
.mode-card h3 { margin: 18px 0 7px; font-size: 20px; }
.mode-card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.mode-card.is-primary p { color: #d6e4e6; }
.preset-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.preset-button { min-height: 54px; border: 1px solid var(--line); border-radius: 12px; color: var(--wine); background: var(--panel); font-weight: 900; cursor: pointer; }
.notice { padding: 17px 18px; border-left: 3px solid var(--gold); border-radius: 0 10px 10px 0; color: var(--muted); background: #e8ece8; font-size: 13px; line-height: 1.65; }
.notice strong { color: var(--ink); }
.resume { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 14px; padding: 16px; border: 1px solid #cbb28a; border-radius: 14px; background: #fff8ea; }
.resume p { margin: 0; font-size: 14px; }
.primary-button, .secondary-button { min-height: 50px; padding: 12px 18px; border-radius: 13px; font-weight: 900; cursor: pointer; }
.primary-button { border: 1px solid var(--wine); color: #fff; background: var(--wine); }
.secondary-button { border: 1px solid var(--line); color: var(--wine); background: var(--panel); }
.exam-shell { width: min(100%, 760px); min-height: 100dvh; margin: 0 auto; padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
.exam-header { position: sticky; top: 0; z-index: 10; padding: max(10px, env(safe-area-inset-top)) 16px 12px; border-bottom: 1px solid var(--line); background: rgba(247,243,237,.96); backdrop-filter: blur(12px); }
.exam-top { display: grid; grid-template-columns: 44px minmax(0,1fr) auto; align-items: center; gap: 10px; }
.round-button { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; color: var(--wine); background: var(--panel); font-weight: 900; cursor: pointer; }
.exam-title { min-width: 0; }
.exam-title strong, .exam-title small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exam-title small { color: var(--muted); font-size: 11px; }
.timer { min-width: 66px; color: var(--wine); font-variant-numeric: tabular-nums; font-weight: 900; text-align: right; }
.progress { height: 5px; margin-top: 10px; overflow: hidden; border-radius: 99px; background: #e6ddd3; }
.progress span { display: block; height: 100%; background: var(--wine); transition: width .2s ease; }
.question-wrap { padding: 18px 16px 24px; }
.question-card { padding: 23px 20px; border: 1px solid var(--line); border-top: 4px solid var(--forest); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
.question-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.pill { display: inline-flex; min-height: 27px; align-items: center; padding: 5px 9px; border-radius: 999px; color: var(--wine); background: #e3eceb; font-weight: 900; }
.pill.is-warning { color: #765018; background: #fff0c9; }
.question-card h1 { margin: 20px 0 24px; font-family: inherit; font-size: clamp(21px, 5.5vw, 28px); line-height: 1.55; }
.choice-list { display: grid; gap: 10px; }
.choice { display: grid; grid-template-columns: 34px minmax(0,1fr); align-items: center; gap: 10px; width: 100%; min-height: 58px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 14px; text-align: left; color: var(--ink); background: #fff; cursor: pointer; }
.choice b { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 7px; color: var(--wine); background: #e6eceb; }
.choice.is-selected { border-color: var(--wine); background: #eaf2f3; box-shadow: 0 0 0 1px var(--wine); }
.choice:disabled, .ox-button:disabled { cursor: default; opacity: 1; }
.ox-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ox-button { min-height: 100px; border: 1px solid var(--line); border-radius: 17px; color: var(--wine); background: #fff; font-size: 35px; font-weight: 900; cursor: pointer; }
.ox-button small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.ox-button.is-selected { color: #fff; border-color: var(--wine); background: var(--wine); }
.ox-button.is-selected small { color: #eadfd6; }
.answer-input { width: 100%; min-height: 54px; padding: 14px; border: 1px solid var(--line); border-radius: 13px; color: var(--ink); background: #fff; }
textarea.answer-input { min-height: 180px; resize: vertical; line-height: 1.65; }
.hint-panel { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.hint-panel p { margin: 10px 0 0; padding: 12px; border-radius: 10px; color: #584b3c; background: #fbf1dc; font-size: 14px; line-height: 1.55; }
.hint-button { min-height: 42px; border: 1px solid #cfb680; border-radius: 10px; color: #73521e; background: #fff9eb; font-weight: 850; cursor: pointer; }
.exam-bottom { position: fixed; right: 0; bottom: 0; left: 0; z-index: 12; padding: 10px max(14px, calc((100vw - 730px) / 2)) calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,253,249,.97); backdrop-filter: blur(12px); }
.bottom-inner { display: grid; grid-template-columns: 1fr 1.45fr; gap: 10px; width: min(100%, 730px); margin: 0 auto; }
.answer-sheet { margin-top: 14px; }
.daily-card { display: grid; grid-template-columns: 56px minmax(0,1fr) auto; align-items: center; gap: 14px; width: 100%; padding: 17px; border: 1px solid #c9a96e; border-radius: var(--radius); text-align: left; color: var(--ink); background: linear-gradient(120deg, #fff9ea, #fffdf9); box-shadow: var(--shadow); cursor: pointer; }
.daily-card.is-complete { border-color: #91bda7; background: #f0f8f4; }
.daily-orbit { display: grid; width: 54px; height: 54px; place-items: center; border-radius: 50%; color: #fff; background: linear-gradient(145deg, var(--gold), #765018); font-size: 22px; font-weight: 950; box-shadow: inset 0 0 0 5px rgba(255,255,255,.18); }
.daily-card.is-complete .daily-orbit { background: var(--ok); }
.daily-card strong, .daily-card small { display: block; }
.daily-card small { margin-top: 4px; color: var(--muted); line-height: 1.45; }
.daily-card > b { color: var(--wine); font-size: 30px; }
.answer-sheet summary { color: var(--wine); font-weight: 900; cursor: pointer; }
.number-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; margin-top: 12px; }
.number-button { aspect-ratio: 1; min-width: 0; padding: 0; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: #fff; font-size: 11px; cursor: pointer; }
.number-button.is-current { color: #fff; border-color: var(--wine); background: var(--wine); }
.number-button.is-answered:not(.is-current) { color: var(--ok); border-color: #8dbca5; background: #edf7f1; }
.grade-shell, .result-shell { width: min(100%, 760px); margin: 0 auto; padding: 22px 16px calc(40px + env(safe-area-inset-bottom)); }
.page-heading h1 { margin: 8px 0 10px; color: var(--wine-dark); font-size: clamp(32px, 8vw, 48px); letter-spacing: -.035em; }
.page-heading p { margin: 0; color: var(--muted); line-height: 1.65; }
.rubric-card, .result-card, .review-card { margin-top: 16px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
.rubric-card h2 { font-size: 18px; line-height: 1.5; }
.rubric-item { display: grid; grid-template-columns: 28px minmax(0,1fr); gap: 10px; align-items: start; margin-top: 10px; }
.rubric-item input { width: 22px; height: 22px; accent-color: var(--wine); }
.model-answer { margin-top: 14px; padding: 14px; border-radius: 12px; color: #514942; background: #f2ede7; font-size: 13px; line-height: 1.65; }
.instant-feedback { margin-top: 16px; padding: 15px; border-radius: 13px; font-size: 13px; line-height: 1.55; }
.instant-feedback.is-correct { color: #174c34; background: #eaf7f0; }
.instant-feedback.is-wrong { color: #752323; background: #fbeaea; }
.instant-feedback p { margin: 7px 0; }
.instant-feedback small { display: block; opacity: .78; }
.score-hero { padding: 28px 22px; border-radius: 18px; color: #fff; text-align: center; background: linear-gradient(145deg, var(--wine), var(--wine-dark)); }
.score-hero strong { display: block; font-size: 64px; line-height: 1; }
.score-hero span { color: #e2c78f; font-weight: 900; }
.score-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.score-grid div { padding: 13px 8px; border: 1px solid var(--line); border-radius: 12px; text-align: center; background: var(--panel); }
.score-grid strong, .score-grid small { display: block; }
.score-grid small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.badge-panel { margin-top: 15px; padding: 18px; border: 1px solid #d6bd87; border-radius: var(--radius); background: #fff8e8; }
.achievement { display: inline-flex; margin: 4px 6px 0 0; padding: 8px 11px; border-radius: 999px; color: #654616; background: #ead29e; font-size: 12px; font-weight: 900; }
.mastery-list { display: grid; gap: 12px; }
.mastery-list > div { display: grid; grid-template-columns: minmax(90px, .7fr) minmax(100px, 1fr) 42px; align-items: center; gap: 10px; font-size: 13px; }
.mastery-list > div > div { height: 7px; overflow: hidden; border-radius: 99px; background: #e8dfd6; }
.mastery-list i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--wine), var(--gold)); }
.mastery-list strong { text-align: right; }
.review-card h3 { margin: 0; font-size: 16px; line-height: 1.5; }
.review-card .answer-line { margin-top: 10px; font-size: 13px; }
.review-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.source-line { padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; line-height: 1.6; }
.history-list { display: grid; gap: 10px; margin-top: 20px; }
.history-list article { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 17px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); box-shadow: var(--shadow); }
.history-list strong, .history-list small, .history-list span { display: block; }
.history-list small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.history-list span { text-align: right; font-size: 13px; }
.history-list b { color: var(--wine); font-size: 21px; }
.empty-state { margin-top: 20px; padding: 30px 20px; border: 1px dashed var(--line); border-radius: var(--radius); text-align: center; color: var(--muted); background: var(--panel); }
.empty-state p { margin-bottom: 0; }
.history-home { width: 100%; margin-top: 18px; }
.correct { color: var(--ok); }
.incorrect { color: var(--bad); }
.muted { color: var(--muted); }
.loading { min-height: 100dvh; display: grid; place-items: center; padding: 24px; text-align: center; }
.loading strong { color: var(--wine); font-size: 20px; }

.language-gate { width: min(100%, 760px); min-height: 100dvh; margin: 0 auto; padding: max(24px, env(safe-area-inset-top)) 18px calc(34px + env(safe-area-inset-bottom)); display: grid; align-content: center; }
.gate-mark { width: 72px; height: 72px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.2); border-radius: 18px; color: #fff; background: linear-gradient(145deg, var(--wine), var(--forest)); font-size: 24px; font-weight: 950; letter-spacing: -.05em; box-shadow: var(--shadow); }
.language-gate h1 { margin-top: 24px; color: var(--wine-dark); letter-spacing: -.045em; }
.language-gate > p { max-width: 630px; margin: 15px 0 0; color: var(--muted); line-height: 1.75; }
.language-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 28px; }
.language-option { min-height: 132px; padding: 20px; border: 1px solid var(--line); border-top: 5px solid var(--forest); border-radius: var(--radius); text-align: left; color: var(--ink); background: var(--panel); box-shadow: var(--shadow); cursor: pointer; }
.language-option:last-child { border-top-color: var(--wine); }
.language-option strong, .language-option small { display: block; }
.language-option strong { font-size: 21px; }
.language-option small { margin-top: 8px; color: var(--muted); line-height: 1.5; }
.gate-note { margin-top: 20px !important; padding: 14px 16px; border-left: 3px solid var(--gold); background: #e7ece9; font-size: 12px; }
.locale-switch { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: #e7ecea; }
.locale-switch button { min-height: 32px; padding: 5px 9px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; font-size: 11px; font-weight: 900; cursor: pointer; }
.locale-switch button.is-active { color: #fff; background: var(--wine); }
.exam-standard { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 22px; }
.exam-standard span { padding: 12px 8px; border: 1px solid rgba(255,255,255,.16); border-radius: 9px; text-align: center; background: rgba(255,255,255,.06); }
.exam-standard strong, .exam-standard small { display: block; }
.exam-standard strong { font-size: 18px; }
.exam-standard small { margin-top: 3px; color: #c7d8d9; font-size: 10px; }
.chapter-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.chapter-button { min-height: 48px; padding: 8px; border: 1px solid var(--line); border-radius: 9px; color: var(--wine); background: var(--panel); font-size: 12px; font-weight: 850; cursor: pointer; }
.chapter-button:first-child { grid-column: span 2; color: #fff; border-color: var(--forest); background: var(--forest); }
.format-note { margin-top: 10px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.result-band { display: inline-flex; margin: 13px 0 0; padding: 8px 13px; border: 1px solid rgba(255,255,255,.28); border-radius: 999px; color: #fff; background: rgba(255,255,255,.1); font-weight: 950; letter-spacing: .04em; }
.source-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.source-links a, .source-links span { display: inline-flex; padding: 5px 7px; border-radius: 7px; color: var(--wine); background: #e6eceb; font-size: 10px; font-weight: 800; text-decoration: none; }
.source-links .is-unofficial { color: #7b5d27; background: #f3ead8; }
.high-yield-toolbar { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 18px; }
.filter-button { min-height: 38px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 9px; color: var(--wine); background: var(--panel); font-size: 12px; font-weight: 900; cursor: pointer; }
.filter-button.is-active { color: #fff; border-color: var(--wine); background: var(--wine); }
.high-yield-list { display: grid; gap: 13px; margin-top: 16px; }
.high-yield-card { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); box-shadow: var(--shadow); }
.high-yield-card > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 13px; color: #fff; background: var(--forest); }
.high-yield-card > header span { font-size: 11px; font-weight: 900; }
.high-yield-card > div { padding: 17px; }
.high-yield-card h2 { margin: 0 0 13px; color: var(--wine-dark); font-size: 18px; }
.study-line { margin-top: 8px; padding: 11px 12px; border-radius: 9px; font-size: 13px; line-height: 1.6; }
.study-line strong { display: block; margin-bottom: 3px; color: var(--ink); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.study-line.fact { background: #e8f0ee; }
.study-line.trap { background: #f8edda; }
.study-line.contrast { background: #e8edf2; }
.study-line.cue { background: #f0ece9; }
.high-yield-disclaimer { margin-top: 17px; padding: 14px; border-left: 3px solid var(--gold); color: var(--muted); background: #e8ece8; font-size: 12px; line-height: 1.6; }
.loading-error { max-width: 520px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }

@media (max-width: 620px) {
  .shell { padding-right: 14px; padding-left: 14px; }
  .hero { padding: 26px 20px; }
  .mode-grid { grid-template-columns: 1fr; }
  .mode-card { min-height: 148px; }
  .preset-grid { grid-template-columns: repeat(5, 1fr); }
  .number-grid { grid-template-columns: repeat(5, 1fr); gap: 7px; }
  .question-card { padding: 20px 16px; }
  .score-grid { grid-template-columns: 1fr 1fr; }
  .language-options { grid-template-columns: 1fr; }
  .exam-standard { grid-template-columns: 1fr 1fr; }
  .chapter-grid { grid-template-columns: repeat(3, 1fr); }
  .chapter-button:first-child { grid-column: span 3; }
}

@media (max-width: 380px) {
  .stats strong { font-size: 17px; }
  .stats small { font-size: 10px; }
  .preset-button { min-height: 48px; }
  .exam-title small { display: none; }
}

@media (min-width: 900px) {
  .shell { padding-top: 28px; }
  .hero { padding: 42px; }
}

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