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

:root {
  font-family: 'DM Sans', 'Noto Sans KR', system-ui, sans-serif;
  color: #172e3e;
  background: #dff5ff;
  font-synthesis: none;
  --sky: #8fd8f8;
  --sky-deep: #49b7ea;
  --navy: #18384d;
  --purple: #7667e8;
  --purple-deep: #6253db;
  --muted: #6d8493;
  --line: #dbe5eb;
  --mint: #29b98a;
  --red: #ee6d72;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100svh;
  background:
    radial-gradient(circle at 12% 8%, rgba(255,255,255,.7), transparent 25%),
    linear-gradient(145deg, #b9eaff 0%, #eaf9ff 62%, #d8f2fd 100%);
}

button { font: inherit; }
button:focus-visible { outline: 3px solid rgba(98,83,219,.35); outline-offset: 3px; }
[hidden] { display: none !important; }

.app-shell {
  width: min(100%, 560px);
  min-height: 100svh;
  margin: 0 auto;
  background: #f8fcfe;
  box-shadow: 0 0 60px rgba(30, 89, 119, .14);
  overflow: hidden;
  position: relative;
}

.screen { min-height: 100svh; }

.intro-screen {
  background: #f8fcfe;
  display: flex;
  flex-direction: column;
}

.intro-hero {
  min-height: 490px;
  padding: max(28px, env(safe-area-inset-top)) 28px 42px;
  position: relative;
  overflow: hidden;
  color: white;
  background:
    radial-gradient(circle at 84% 18%, rgba(255,255,255,.22) 0 2px, transparent 3px),
    radial-gradient(circle at 16% 65%, rgba(255,255,255,.18) 0 3px, transparent 4px),
    linear-gradient(145deg, #56c1ee 0%, #7c72ec 100%);
  border-radius: 0 0 40px 40px;
}

.intro-hero::before,
.intro-hero::after {
  content: '';
  position: absolute;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 50%;
}
.intro-hero::before { width: 270px; height: 270px; right: -145px; top: 80px; }
.intro-hero::after { width: 190px; height: 190px; left: -125px; bottom: -55px; }

.brand-row { display: flex; align-items: center; justify-content: space-between; position: relative; z-index: 1; }
.brand { display: flex; align-items: center; gap: 9px; font-size: 18px; font-weight: 800; letter-spacing: -.03em; }
.brand > span { width: 35px; height: 35px; display: grid; place-items: center; color: var(--purple-deep); background: white; border-radius: 11px; box-shadow: 0 7px 18px rgba(51,67,147,.2); }
.chapter-tag { padding: 7px 11px; border: 1px solid rgba(255,255,255,.3); background: rgba(255,255,255,.13); border-radius: 99px; font-size: 10px; font-weight: 800; letter-spacing: .08em; }

.eyebrow { color: var(--purple-deep); font-size: 12px; font-weight: 800; letter-spacing: .13em; margin: 20px 0 10px; }
.hero-copy { position: relative; z-index: 1; margin-top: 52px; }
.hero-kicker { margin: 0 0 13px; color: #d9f4ff; font-size: 11px; font-weight: 800; letter-spacing: .13em; }
.hero-copy h1 { font-size: clamp(41px, 11vw, 58px); line-height: 1.12; letter-spacing: -.055em; margin: 0; }
.hero-copy h1 em { color: #d8f6ff; font-style: normal; }
.hero-copy > p:last-child { margin: 18px 0 0; color: rgba(255,255,255,.82); font-size: 14px; line-height: 1.7; }

.pattern-visual { position: absolute; z-index: 1; right: 24px; bottom: 32px; display: flex; align-items: center; gap: 7px; }
.pattern-visual span { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.32); border-radius: 10px; color: rgba(255,255,255,.8); font-size: 12px; font-weight: 800; transform: rotate(5deg); }
.pattern-visual span:nth-child(even) { transform: rotate(-5deg); }
.pattern-visual strong { width: 58px; height: 58px; display: grid; place-items: center; background: white; color: var(--purple-deep); border-radius: 18px; font-size: 21px; box-shadow: 0 12px 25px rgba(52,58,132,.22); transform: rotate(-6deg); }

.intro-lower { flex: 1; display: flex; flex-direction: column; padding: 22px 28px max(26px, env(safe-area-inset-bottom)); }

.lesson-preview {
  display: flex;
  align-items: center;
  gap: 14px;
  background: white;
  border: 1px solid #e3edf2;
  border-radius: 18px;
  padding: 15px;
  box-shadow: 0 10px 30px rgba(44, 94, 120, .08);
  margin-bottom: 13px;
}
.preview-icon { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: #e9f9ff; color: var(--sky-deep); font-size: 20px; font-weight: 800; }
.lesson-preview div { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.lesson-preview small { color: var(--muted); }
.count-badge { background: #f0edff; color: var(--purple); border-radius: 99px; padding: 5px 10px; font-weight: 700; font-size: 12px; }
.intro-benefits { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; color: #718694; font-size: 12px; margin: 0 2px 23px; }
.intro-benefits span { display: flex; align-items: center; gap: 6px; }
.intro-benefits i { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 7px; background: #f0edff; color: var(--purple); font-style: normal; font-weight: 800; }
.start-button { width: 100%; margin-top: auto; display: flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.start-note { text-align: center; color: #97a6ae; font-size: 11px; margin: 20px 0 0; }

.primary-button, .secondary-button {
  border: 0;
  border-radius: 16px;
  min-height: 58px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, background .15s;
}
.primary-button { color: white; background: linear-gradient(135deg, #7c6bea, #6556dd); box-shadow: 0 9px 0 #5143c1, 0 17px 25px rgba(91,76,202,.22); font-size: 17px; }
.primary-button:not(:disabled):active { transform: translateY(5px); box-shadow: 0 4px 0 #5143c1; }
.primary-button:disabled { background: #cfd7dc; box-shadow: 0 7px 0 #b6c0c6; color: #f8fafb; cursor: not-allowed; }
.secondary-button { color: var(--purple); background: #efedff; border: 1px solid #dcd7ff; }

.quiz-screen {
  background: linear-gradient(180deg, #91dafa 0 43%, #f8fcfe 43%);
  padding: max(18px, env(safe-area-inset-top)) 20px max(25px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}
.top-bar { display: flex; align-items: center; gap: 14px; }
.icon-button { width: 40px; height: 40px; border: 0; border-radius: 13px; background: rgba(255,255,255,.65); color: white; display: grid; place-items: center; cursor: pointer; font-size: 36px; line-height: 1; }
.sound-button svg { width: 21px; fill: var(--purple); }
.back-link { text-decoration: none; }
.progress-wrap { flex: 1; }
.progress-copy { display: flex; justify-content: space-between; color: white; font-size: 12px; margin-bottom: 6px; font-weight: 700; }
.progress-track { height: 9px; background: rgba(255,255,255,.45); border-radius: 20px; overflow: hidden; }
.progress-track span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, #7768e8, #9b7cf2); border-radius: inherit; transition: width .45s ease; }
.chapter-row { display: flex; align-items: center; justify-content: space-between; color: rgba(24,56,77,.65); font-weight: 800; font-size: 11px; letter-spacing: .08em; margin: 20px 4px 10px; }
.chapter-pill { background: rgba(255,255,255,.6); padding: 7px 10px; border-radius: 99px; letter-spacing: 0; }

.question-card {
  background: rgba(255,255,255,.96);
  border-radius: 25px;
  box-shadow: 0 15px 38px rgba(28,89,119,.16);
  min-height: 275px;
  overflow: hidden;
  position: relative;
}
.question-card::after { content: ''; position: absolute; width: 140px; height: 140px; border-radius: 50%; background: #f1efff; right: -75px; bottom: -65px; }
.question-heading { display: flex; align-items: center; gap: 9px; padding: 20px 22px 10px; color: #647b89; font-size: 13px; }
.question-heading p { margin: 0; }
.question-number { color: white; background: var(--purple); border-radius: 9px; padding: 5px 8px; font-weight: 800; }
.verb-area { text-align: center; padding: 16px; }
.verb-word { font-size: clamp(52px, 15vw, 72px); font-weight: 800; color: var(--navy); letter-spacing: -.05em; margin: 0; line-height: 1; }
.verb-meaning { color: var(--muted); font-size: 16px; margin: 12px 0 16px; }
.mini-sound { display: inline-flex; align-items: center; gap: 6px; border: 1px solid #dcd7ff; color: var(--purple); background: #f5f3ff; border-radius: 20px; padding: 8px 13px; font-size: 12px; font-weight: 700; cursor: pointer; }
.mini-sound svg { width: 16px; fill: currentColor; }
.question-hint { border-top: 1px solid #edf1f3; margin: 0 22px; padding: 13px 0 17px; font-size: 12px; color: #91a2ac; }

.answer-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 18px 0; }
.answer-grid button { min-height: 65px; border: 1.5px solid var(--line); border-radius: 15px; background: white; color: var(--navy); display: flex; align-items: center; justify-content: space-between; padding: 13px 15px; cursor: pointer; box-shadow: 0 4px 0 #dce6eb; transition: .15s; }
.answer-grid button:last-child { grid-column: 1 / -1; }
.answer-grid strong { font-size: 16px; }
.answer-grid span { color: #8a9aa4; font-size: 11px; }
.answer-grid button.selected { border-color: var(--purple); background: #f2efff; color: var(--purple-deep); box-shadow: 0 4px 0 #c9c1ff; transform: translateY(-1px); }
.answer-grid button.correct { border-color: var(--mint); background: #e9fbf5; color: #12845f; box-shadow: 0 4px 0 #a6e8d2; }
.answer-grid button.wrong { border-color: var(--red); background: #fff0f0; color: #c94e54; box-shadow: 0 4px 0 #f4c0c2; }
.answer-grid button:disabled { cursor: default; opacity: .65; }
.answer-grid button.correct, .answer-grid button.wrong { opacity: 1; }

.feedback { background: white; border: 1px solid #e0e9ed; border-radius: 18px; padding: 16px; margin: 16px 0; animation: rise .25s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.feedback-title-row { display: flex; gap: 9px; align-items: center; }
.feedback-icon { width: 25px; height: 25px; border-radius: 50%; background: #dff8f0; color: var(--mint); display: grid; place-items: center; font-weight: 900; }
.feedback.wrong .feedback-icon { background: #ffe5e6; color: var(--red); }
.feedback p { color: #69808e; font-size: 13px; line-height: 1.6; margin: 8px 0 13px; }
.example-box { display: grid; grid-template-columns: auto 1fr; gap: 5px 9px; align-items: center; background: #f4f9fb; border-radius: 12px; padding: 11px 12px; font-size: 13px; }
.example-box span { color: white; background: var(--sky-deep); border-radius: 5px; font-size: 9px; font-weight: 800; padding: 3px 6px; }
.example-box small { grid-column: 1 / -1; color: #81939d; margin-top: 3px; }

.bottom-actions {
  margin-top: auto;
  display: grid;
  grid-template-columns: 1fr 1.8fr;
  gap: 11px;
  padding: 10px 0 4px;
  position: sticky;
  bottom: 0;
  z-index: 5;
  background: linear-gradient(180deg, rgba(248,252,254,0), #f8fcfe 18%);
}
.check-button { min-height: 56px; }

.result-screen { padding: max(72px, env(safe-area-inset-top)) 28px max(30px, env(safe-area-inset-bottom)); background: linear-gradient(180deg, #9ce0fb 0%, #f8fcfe 52%); text-align: center; }
.result-burst { width: 112px; height: 112px; margin: 0 auto 20px; border-radius: 34px; display: grid; place-items: center; color: #ffd95a; font-size: 56px; background: linear-gradient(145deg, #7d6deb, #5d4fd5); box-shadow: 0 17px 0 rgba(79,65,190,.22), 0 30px 45px rgba(64,88,139,.2); transform: rotate(-5deg); }
.result-screen h2 { font-size: 35px; margin: 4px 0 8px; letter-spacing: -.04em; }
.result-message { color: var(--muted); margin: 0 0 28px; }
.score-card { display: grid; grid-template-columns: 1fr 1fr; background: white; border-radius: 20px; box-shadow: 0 13px 35px rgba(42,87,111,.1); padding: 20px; margin-bottom: 14px; }
.score-card div + div { border-left: 1px solid #e5ecef; }
.score-card small, .score-card strong { display: block; }
.score-card small { color: var(--muted); margin-bottom: 7px; }
.score-card strong { font-size: 25px; color: var(--purple-deep); }
.review-card { text-align: left; background: white; border: 1px solid #e2eaee; border-radius: 20px; padding: 18px; margin-bottom: 22px; }
.review-card p { margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.review-verbs { display: grid; gap: 12px; }
.review-group { display: grid; grid-template-columns: 48px 1fr; gap: 8px; align-items: start; }
.review-group > strong { color: var(--purple-deep); font-size: 12px; padding-top: 7px; }
.review-group > div { display: flex; flex-wrap: wrap; gap: 7px; }
.review-verbs span { border-radius: 99px; background: #eaf8fe; color: #2688b5; padding: 7px 11px; font-weight: 700; font-size: 13px; }
.result-screen .primary-button { width: 100%; }
.result-link { display: flex; align-items: center; justify-content: center; text-decoration: none; }
.text-button { color: var(--muted); border: 0; background: transparent; padding: 22px; cursor: pointer; }

.toast { position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 40px); padding: 11px 16px; border-radius: 12px; background: rgba(23,46,62,.94); color: white; font-size: 13px; box-shadow: 0 10px 30px rgba(0,0,0,.18); z-index: 20; }

/* Home study modes */
.mode-heading { display: grid; gap: 3px; margin: 0 2px 12px; }
.mode-heading small { color: var(--sky-deep); font-weight: 800; font-size: 11px; letter-spacing: .08em; }
.mode-heading strong { color: var(--navy); font-size: 20px; }
.mode-grid { display: grid; gap: 11px; }
.mode-card { display: grid; grid-template-columns: 50px 1fr auto; gap: 13px; align-items: center; min-height: 82px; padding: 13px 16px; border-radius: 19px; text-decoration: none; color: var(--navy); background: white; border: 1px solid #e2ebef; box-shadow: 0 8px 24px rgba(37,88,113,.09); }
.mode-card.quiz { background: linear-gradient(135deg, #7767e7, #9c79ef); color: white; border: 0; box-shadow: 0 11px 25px rgba(94,72,196,.25); }
.mode-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 15px; background: #e9f8fe; color: #278bb8; font-size: 23px; font-weight: 900; }
.mode-card.quiz .mode-icon { background: rgba(255,255,255,.18); color: white; }
.mode-card > span:nth-child(2) { display: grid; gap: 2px; }
.mode-card small { color: #8397a2; font-size: 10px; font-weight: 800; }
.mode-card.quiz small, .mode-card.quiz em { color: rgba(255,255,255,.78); }
.mode-card strong { font-size: 16px; }
.mode-card em { color: #93a3ac; font-size: 11px; font-style: normal; }
.mode-card b { font-size: 29px; font-weight: 300; opacity: .7; }

/* Shared mode tabs */
.mode-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 5px; margin: 0 0 15px; background: rgba(255,255,255,.62); border-radius: 14px; }
.mode-tabs a { padding: 10px; border-radius: 10px; color: #748b98; text-decoration: none; text-align: center; font-size: 13px; font-weight: 800; }
.mode-tabs a.active { background: white; color: var(--purple-deep); box-shadow: 0 4px 13px rgba(40,70,90,.1); }

/* Flashcards */
.flash-screen { padding: max(18px, env(safe-area-inset-top)) 20px max(18px, env(safe-area-inset-bottom)); background: linear-gradient(180deg,#94dcfa 0%,#e9f7fc 39%,#f8fcfe 100%); }
.flash-header { display: grid; grid-template-columns: 46px 1fr 46px; align-items: center; gap: 10px; margin-bottom: 15px; }
.flash-header > div { display: grid; text-align: center; gap: 2px; color: var(--navy); }
.flash-header small { font-size: 9px; font-weight: 900; letter-spacing: .12em; opacity: .55; }
.flash-header strong { font-size: 17px; }
.shuffle-button { color: var(--purple-deep); font-size: 24px; font-weight: 700; }
.filter-row { display: flex; gap: 7px; overflow-x: auto; padding: 0 0 11px; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.filter-row button { flex: 0 0 auto; border: 1px solid rgba(92,122,139,.16); border-radius: 99px; padding: 8px 12px; color: #6e8490; background: rgba(255,255,255,.66); font-size: 11px; font-weight: 800; }
.filter-row button.active { background: var(--purple); color: white; border-color: var(--purple); }
.flash-progress-row { display: flex; justify-content: space-between; margin: 1px 2px 6px; color: #5c7787; font-size: 11px; font-weight: 800; }
.flash-progress { height: 6px; overflow: hidden; margin-bottom: 15px; background: rgba(255,255,255,.65); border-radius: 99px; }
.flash-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg,#7869e8,#a77cf0); border-radius: inherit; transition: width .25s; }
.flash-card { width: 100%; min-height: 345px; perspective: 1000px; cursor: pointer; outline: none; }
.flash-card:focus-visible { border-radius: 27px; box-shadow: 0 0 0 4px rgba(123,105,231,.25); }
.flash-card-inner { position: relative; width: 100%; min-height: 345px; transform-style: preserve-3d; transition: transform .5s cubic-bezier(.2,.75,.25,1); }
.flash-card.flipped .flash-card-inner { transform: rotateY(180deg); }
.flash-face { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 28px; backface-visibility: hidden; -webkit-backface-visibility: hidden; background: rgba(255,255,255,.97); border-radius: 27px; box-shadow: 0 18px 42px rgba(40,87,113,.17); text-align: center; overflow: hidden; }
.flash-face::before { content: ''; position: absolute; width: 160px; height: 160px; border-radius: 50%; background: #f0eeff; right: -85px; top: -85px; }
.flash-back { transform: rotateY(180deg); background: linear-gradient(145deg,#fff,#f7f4ff); }
.flash-badge { padding: 6px 11px; border-radius: 99px; background: #e8f7fd; color: #268ab7; font-size: 11px; font-weight: 900; }
.flash-back .flash-badge { background: #ece8ff; color: var(--purple-deep); }
.flash-front strong { margin-top: 23px; color: var(--navy); font-size: clamp(60px,18vw,82px); line-height: 1; letter-spacing: -.055em; }
.flash-front p { color: var(--muted); font-size: 17px; margin: 15px 0; }
.flash-back > strong { color: var(--purple-deep); font-size: clamp(27px,8vw,38px); margin: 17px 0 10px; }
.flash-back > p { color: #69808e; font-size: 13px; line-height: 1.55; margin: 0 0 17px; }
.flash-example { display: grid; gap: 5px; width: 100%; padding: 14px; border-radius: 14px; background: #edf8fc; color: var(--navy); }
.flash-example b { font-size: 15px; }
.flash-example span { color: #7e929d; font-size: 12px; }
.flip-hint { position: absolute; bottom: 20px; color: #9aacb5; font-size: 10px; }
.speak-pill { align-self: center; margin: -17px auto 12px; z-index: 2; border: 0; border-radius: 99px; padding: 10px 17px; background: white; color: var(--purple-deep); font-size: 12px; font-weight: 800; box-shadow: 0 7px 18px rgba(68,78,126,.15); }
.flash-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.flash-actions button { min-height: 50px; border-radius: 15px; font-size: 13px; font-weight: 800; }
.again-button { border: 1px solid #e1e8eb; background: white; color: #758994; }
.master-button { border: 0; background: linear-gradient(135deg,#7767e7,#9c79ef); color: white; box-shadow: 0 7px 16px rgba(91,71,192,.22); }
.master-button.done { background: linear-gradient(135deg,#27b889,#5bd0ac); }
.flash-navigation { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; margin-top: 8px; text-align: center; color: #9aabb4; font-size: 10px; }
.flash-navigation button { border: 0; background: transparent; color: #718893; font-size: 28px; }
.flash-navigation button:disabled { opacity: .3; }

@media (min-width: 700px) {
  body { padding: 26px 0; }
  .app-shell, .screen { min-height: calc(100svh - 52px); }
  .app-shell { border-radius: 32px; }
}

@media (max-height: 760px) {
  .question-card { min-height: 225px; }
  .verb-area { padding: 8px; }
  .verb-word { font-size: 48px; }
  .answer-grid button { min-height: 54px; }
  .flash-card, .flash-card-inner { min-height: 290px; }
  .flash-front strong { font-size: 54px; }
}

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