:root {
  --blue-950: #061b44;
  --blue-900: #08275e;
  --blue-700: #0b5cff;
  --blue-600: #2875ff;
  --blue-100: #eaf2ff;
  --blue-050: #f5f9ff;
  --ink: #0d1830;
  --muted: #60708f;
  --white: #ffffff;
  --success: #087a55;
  --success-bg: #e8f8f1;
  --error: #b42318;
  --error-bg: #fff0ee;
  --radius-xl: 28px;
  --radius-lg: 22px;
  --shadow: 0 18px 50px rgba(13, 64, 158, 0.11);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 100% 0%, rgba(40,117,255,.15), transparent 35%),
    linear-gradient(180deg, #f8fbff 0%, #eef5ff 100%);
}
button, input { font: inherit; }
button { cursor: pointer; }

.app-shell {
  width: min(100%, 880px);
  min-height: 100vh;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 18px calc(30px + env(safe-area-inset-bottom));
}

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--blue-950);
  font-weight: 800;
  text-decoration: none;
  letter-spacing: -0.03em;
}
.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: white;
  background: linear-gradient(145deg, var(--blue-600), var(--blue-900));
  box-shadow: 0 8px 22px rgba(11,92,255,.25);
}
.wallet {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 11px;
  border: 1px solid rgba(11,92,255,.12);
  border-radius: 999px;
  background: rgba(255,255,255,.8);
  font-size: 12px;
  color: var(--muted);
  backdrop-filter: blur(10px);
}
.wallet strong { color: var(--blue-900); font-size: 14px; }
.wallet-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--blue-600);
  box-shadow: 0 0 0 4px var(--blue-100);
}

.view { display: none; }
.view.active { display: block; animation: enter .24s ease both; }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } }

.hero {
  padding: 48px 4px 26px;
  max-width: 650px;
}
.eyebrow {
  margin: 0 0 10px;
  color: var(--blue-700);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 11px;
}
h1, h2, p { margin-top: 0; }
h1 {
  margin-bottom: 16px;
  font-size: clamp(36px, 9vw, 68px);
  line-height: .98;
  letter-spacing: -0.06em;
}
.hero-copy {
  max-width: 580px;
  color: var(--muted);
  line-height: 1.65;
  font-size: 16px;
}

.training-grid {
  display: grid;
  gap: 14px;
}
.training-card {
  width: 100%;
  min-height: 160px;
  padding: 20px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 16px;
  text-align: left;
  border: 1px solid rgba(11,92,255,.11);
  border-radius: var(--radius-xl);
  color: inherit;
  background: rgba(255,255,255,.9);
  box-shadow: var(--shadow);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.training-card:active { transform: scale(.985); }
.training-card:hover { border-color: rgba(11,92,255,.35); box-shadow: 0 22px 60px rgba(13,64,158,.16); }
.card-number {
  color: var(--blue-700);
  font-size: 12px;
  font-weight: 800;
}
.card-body { display: grid; gap: 6px; }
.card-body strong {
  font-size: 48px;
  line-height: 1;
  letter-spacing: -0.06em;
  color: var(--blue-950);
}
.card-label { font-weight: 800; }
.card-body > span:last-child { color: var(--muted); line-height: 1.45; }
.card-arrow {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: white;
  background: var(--blue-700);
  font-size: 20px;
}

.shop-preview {
  margin-top: 18px;
  padding: 24px;
  display: grid;
  gap: 20px;
  border-radius: var(--radius-xl);
  color: white;
  background: linear-gradient(135deg, var(--blue-950), #0d4bc0 72%, #2c7cff);
  box-shadow: var(--shadow);
}
.shop-preview .eyebrow { color: #9dc1ff; }
.shop-preview h2 { margin-bottom: 8px; letter-spacing: -0.04em; }
.shop-preview p:last-child { margin-bottom: 0; color: #c9dafa; line-height: 1.55; }
.theme-swatches { display: flex; gap: 10px; }
.swatch {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.35);
  box-shadow: inset 0 0 0 4px rgba(255,255,255,.08);
}
.swatch-sky { background: linear-gradient(145deg, #dbeaff, #4e8fff); }
.swatch-midnight { background: linear-gradient(145deg, #020914, #143b75); }
.swatch-frost { background: linear-gradient(145deg, #ffffff, #b8d7ff); }

#exercise { padding-top: 22px; }
.exercise-topline {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 30px;
}
.icon-button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  color: var(--blue-950);
  background: white;
  font-size: 26px;
  box-shadow: 0 8px 20px rgba(13,64,158,.1);
}
.progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #dbe7f8;
}
.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue-700), #56a1ff);
  transition: width .25s ease;
}
.progress-text { min-width: 36px; color: var(--muted); font-weight: 700; font-size: 13px; }

.exercise-card, .result-card {
  width: min(100%, 650px);
  margin: 0 auto;
  padding: 26px;
  border: 1px solid rgba(11,92,255,.11);
  border-radius: var(--radius-xl);
  background: rgba(255,255,255,.94);
  box-shadow: var(--shadow);
}
.mode-pill, .result-badge {
  width: fit-content;
  margin-bottom: 30px;
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--blue-700);
  background: var(--blue-100);
  font-weight: 900;
  font-size: 12px;
  letter-spacing: .08em;
}
.question-label { margin-bottom: 8px; color: var(--muted); font-size: 13px; font-weight: 700; }
.question-sentence {
  margin-bottom: 8px;
  font-size: clamp(28px, 8vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.045em;
}
.verb-hint { margin-bottom: 28px; color: var(--blue-700); font-weight: 800; }
#answerForm { display: grid; gap: 12px; }
#answerInput {
  width: 100%;
  min-height: 58px;
  padding: 0 17px;
  border: 2px solid #d9e5f6;
  border-radius: 17px;
  outline: none;
  background: var(--blue-050);
  color: var(--ink);
  font-size: 18px;
  transition: border-color .18s ease, box-shadow .18s ease;
}
#answerInput:focus { border-color: var(--blue-600); box-shadow: 0 0 0 4px rgba(40,117,255,.11); }
.primary-button, .secondary-button {
  width: 100%;
  min-height: 56px;
  border-radius: 17px;
  font-weight: 850;
}
.primary-button {
  border: 0;
  color: white;
  background: linear-gradient(135deg, var(--blue-700), #247cff);
  box-shadow: 0 12px 26px rgba(11,92,255,.22);
}
.secondary-button {
  margin-top: 10px;
  border: 1px solid #d9e5f6;
  color: var(--blue-900);
  background: white;
}
.feedback {
  display: none;
  margin-top: 16px;
  padding: 15px;
  border-radius: 16px;
  line-height: 1.45;
  font-weight: 700;
}
.feedback.correct { display: block; color: var(--success); background: var(--success-bg); }
.feedback.wrong { display: block; color: var(--error); background: var(--error-bg); }
#nextButton { margin-top: 12px; }
.hidden { display: none !important; }

#result { padding-top: 55px; }
.result-card { text-align: center; }
.result-badge { margin-left: auto; margin-right: auto; }
.result-card h2 { margin-bottom: 8px; font-size: 34px; letter-spacing: -0.045em; }
.result-score { color: var(--muted); }
.earned-card {
  margin: 24px 0;
  padding: 20px;
  display: grid;
  gap: 5px;
  border-radius: 20px;
  background: var(--blue-100);
  color: var(--blue-900);
}
.earned-card span { font-size: 13px; font-weight: 700; color: var(--muted); }
.earned-card strong { font-size: 28px; letter-spacing: -0.04em; }

.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;
}

@media (min-width: 720px) {
  .app-shell { padding-left: 28px; padding-right: 28px; }
  .training-grid { grid-template-columns: 1fr 1fr; }
  .shop-preview { grid-template-columns: 1fr auto; align-items: center; }
  .exercise-card, .result-card { padding: 38px; }
}
