:root {
  --ink: #17302a;
  --muted: #66736e;
  --paper: #fbfaf5;
  --cream: #f1eee3;
  --green: #1f6a55;
  --green-dark: #16372f;
  --lime: #dbe86d;
  --coral: #ef745d;
  --line: #d8ddd7;
  --white: #fff;
  --shadow: 0 18px 55px rgba(22, 55, 47, .12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 86% 5%, rgba(219, 232, 109, .28), transparent 24rem),
    var(--paper);
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
}

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

.site-header {
  width: min(1080px, calc(100% - 36px));
  margin: 0 auto;
  padding: 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(23, 48, 42, .14);
}
.brand { color: var(--ink); text-decoration: none; font-size: 1.05rem; letter-spacing: .02em; }
.brand span { font-weight: 300; }
.brand strong { margin-left: 5px; font-weight: 900; }
.site-header p { margin: 0; color: var(--muted); font-size: .9rem; }

main { width: min(1080px, calc(100% - 36px)); margin: 0 auto; }
.hero { padding: clamp(48px, 8vw, 92px) 0 42px; }
.eyebrow { margin: 0 0 15px; color: var(--green); font-size: .76rem; font-weight: 800; letter-spacing: .2em; }
.hero h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.5rem, 7vw, 5.4rem); line-height: .98; letter-spacing: -.05em; }
.hero h1 em { color: var(--green); font-weight: 400; }
.hero-copy { max-width: 540px; margin: 26px 0 0; color: var(--muted); line-height: 1.75; }

.lesson-picker { margin-bottom: 18px; }
.book-tabs, .lesson-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.lesson-tabs { margin-top: 9px; }
.tab-button {
  border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.65);
  padding: 10px 16px; cursor: pointer; transition: .18s ease;
}
.tab-button:hover { transform: translateY(-1px); border-color: var(--green); }
.tab-button.active { background: var(--green-dark); border-color: var(--green-dark); color: var(--white); }
.lesson-tabs .tab-button.active { background: var(--lime); border-color: var(--lime); color: var(--ink); }

.study-card { background: var(--white); border: 1px solid var(--line); border-radius: 28px; box-shadow: var(--shadow); overflow: hidden; }
.study-head { display: flex; justify-content: space-between; gap: 24px; padding: 28px 32px 22px; border-bottom: 1px solid var(--line); }
.lesson-meta { margin: 0 0 7px; color: var(--green); font-size: .77rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.study-head h2 { margin: 0; font-family: Georgia, serif; font-size: clamp(1.5rem, 3vw, 2.35rem); }
.progress-wrap { min-width: 136px; align-self: center; text-align: right; color: var(--muted); font-size: .82rem; }
.progress-track { height: 6px; margin-top: 8px; border-radius: 999px; background: var(--cream); overflow: hidden; }
.progress-track i { display: block; width: 0; height: 100%; background: var(--coral); transition: width .25s ease; }

.sentence-nav { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 10px; align-items: center; padding: 18px 32px; background: var(--cream); }
.sentence-nav label { display: flex; align-items: center; gap: 10px; font-size: .82rem; color: var(--muted); }
.sentence-nav select { width: 100%; border: 0; border-radius: 12px; background: var(--white); padding: 11px 12px; color: var(--ink); }
.round-button { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; background: var(--white); cursor: pointer; }
.round-button:disabled { opacity: .35; cursor: default; }

.sentence-panel { min-height: 270px; padding: clamp(30px, 6vw, 66px); display: flex; flex-direction: column; justify-content: center; }
.speaker { align-self: flex-start; margin: 0 0 14px; padding: 5px 9px; border-radius: 7px; background: var(--lime); font-size: .78rem; font-weight: 800; }
.sentence { font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.65rem, 4vw, 3.2rem); line-height: 1.55; letter-spacing: -.02em; }
.word {
  display: inline-block; margin: 2px 1px; padding: 0 3px 2px; border: 0; border-bottom: 2px solid transparent;
  background: transparent; cursor: pointer; border-radius: 5px; transition: .15s ease;
}
.word:hover { background: var(--cream); }
.word.active { background: var(--lime); border-color: var(--green); }
.word.correct { color: var(--green); border-color: var(--green); }
.word.wrong { color: #a5382d; border-color: var(--coral); }
.word.celebrate { animation: correct-sparkle .65s ease-out; position: relative; z-index: 1; }
@keyframes correct-sparkle {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(219, 232, 109, 0); }
  35% { transform: scale(1.12); background: #f7ffb9; box-shadow: 0 0 0 7px rgba(219, 232, 109, .42), 0 0 22px rgba(219, 232, 109, .9); }
  70% { transform: scale(1.04); box-shadow: 0 0 0 12px rgba(219, 232, 109, 0), 0 0 10px rgba(219, 232, 109, .25); }
  100% { transform: scale(1); box-shadow: none; }
}
.punct { white-space: pre; }
.translation { margin: 28px 0 0; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 1rem; line-height: 1.7; }

.answer-box { display: grid; grid-template-columns: minmax(150px, .8fr) minmax(170px, 1.3fr) auto auto; gap: 10px; align-items: end; padding: 22px 32px 26px; background: var(--green-dark); color: var(--white); }
.answer-box > div { min-width: 0; }
.answer-label, .pos-input-label { display: block; margin-bottom: 7px; color: rgba(255,255,255,.67); font-size: .72rem; font-weight: 700; }
#selectedWord { display: block; overflow: hidden; text-overflow: ellipsis; font-family: Georgia, serif; font-size: 1.4rem; white-space: nowrap; }
.answer-box input { width: 100%; border: 1px solid rgba(255,255,255,.24); border-radius: 11px; background: rgba(255,255,255,.1); padding: 12px 13px; color: white; outline: none; }
.answer-box input:focus { border-color: var(--lime); box-shadow: 0 0 0 3px rgba(219,232,109,.14); }
.answer-box input::placeholder { color: rgba(255,255,255,.44); }
.primary-button, .text-button { min-height: 46px; border-radius: 11px; padding: 0 16px; cursor: pointer; }
.primary-button { border: 0; background: var(--lime); font-weight: 800; }
.text-button { border: 1px solid rgba(255,255,255,.25); background: transparent; color: white; }
.primary-button:disabled, .text-button:disabled, input:disabled { opacity: .42; cursor: default; }
.feedback { grid-column: 1 / -1; min-height: 1.35em; margin: 4px 0 0; color: var(--lime); font-size: .9rem; }
.feedback.error { color: #ffac9c; }
.help { margin: 0 32px 26px; padding: 16px 0 0; border-top: 1px solid var(--line); color: var(--muted); font-size: .86rem; }
.help summary { color: var(--ink); font-weight: 700; cursor: pointer; }
.help p { margin: 10px 0 0; line-height: 1.7; }

footer { width: min(1080px, calc(100% - 36px)); margin: 42px auto 0; padding: 28px 0 42px; color: var(--muted); font-size: .78rem; }

@media (max-width: 720px) {
  .site-header { padding: 18px 0; }
  .hero { padding-top: 42px; }
  .study-card { border-radius: 20px; }
  .study-head { display: block; padding: 22px 20px 18px; }
  .progress-wrap { margin-top: 18px; text-align: left; }
  .sentence-nav { padding: 14px 16px; }
  .sentence-panel { min-height: 260px; padding: 34px 22px; }
  .answer-box { grid-template-columns: 1fr 1fr; padding: 22px 20px; }
  .answer-box > div, .pos-input-label, .answer-box input, .feedback { grid-column: 1 / -1; }
  .primary-button, .text-button { width: 100%; }
  .help { margin: 0 20px 22px; }
}

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