:root {
  color-scheme: dark;
  --bg: #080c18;
  --surface: #10172a;
  --surface-2: #17213a;
  --line: #26334f;
  --text: #f7f8fb;
  --muted: #9ca9c2;
  --accent: #f8ca4d;
  --accent-ink: #161203;
  --good: #55d6a0;
  --bad: #ff7c82;
  --blue: #71a8ff;
  --radius: 22px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 100% 0, rgba(70, 108, 184, .20), transparent 34rem),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; }

button:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .94rem;
  font-weight: 750;
  letter-spacing: .02em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: var(--accent);
  color: var(--accent-ink);
  font: 800 1rem/1 ui-monospace, monospace;
}

.streak-pill {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: .86rem;
}

.streak-pill strong { color: var(--text); }

.hero {
  padding: 28px 0 18px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  max-width: 12ch;
  margin-bottom: 12px;
  font-size: clamp(2rem, 9vw, 3rem);
  line-height: 1.06;
  letter-spacing: -.045em;
}

.hero-copy {
  max-width: 32rem;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.today-card {
  position: relative;
  overflow: hidden;
  padding: 22px;
  border: 1px solid #34435f;
  border-radius: 28px;
  background: linear-gradient(145deg, #1b2742, #11182b 66%);
  box-shadow: 0 22px 60px rgba(0, 0, 0, .28);
}

.today-card::after {
  content: "</>";
  position: absolute;
  right: -14px;
  top: 10px;
  color: rgba(248, 202, 77, .08);
  font: 900 5.5rem/1 ui-monospace, monospace;
  transform: rotate(-7deg);
}

.card-meta, .stats-grid, .lesson-head, .result-score, .progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.card-meta {
  position: relative;
  z-index: 1;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: .86rem;
}

.lesson-number {
  color: var(--accent);
  font-weight: 800;
}

.today-card h2 {
  position: relative;
  z-index: 1;
  max-width: 13ch;
  margin-bottom: 8px;
  font-size: 1.65rem;
  line-height: 1.2;
}

.today-card p {
  position: relative;
  z-index: 1;
  color: var(--muted);
  line-height: 1.55;
}

.primary-button, .secondary-button, .option-button {
  width: 100%;
  min-height: 54px;
  border: 0;
  border-radius: 17px;
  cursor: pointer;
  font-weight: 760;
}

.primary-button {
  position: relative;
  z-index: 1;
  margin-top: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 9px 24px rgba(248, 202, 77, .18);
}

.primary-button:active { transform: translateY(1px); }

.secondary-button {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
}

.section-title {
  margin: 28px 0 14px;
  font-size: 1rem;
}

.stats-grid { align-items: stretch; }

.stat {
  flex: 1;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(16, 23, 42, .78);
}

.stat strong {
  display: block;
  margin-bottom: 5px;
  font-size: 1.35rem;
}

.stat span { color: var(--muted); font-size: .78rem; }

.day-list { display: grid; gap: 11px; }

.day-item {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

.day-item:not(:disabled) { cursor: pointer; }
.day-item:disabled { opacity: .5; }

.day-badge {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 800;
}

.day-item.done .day-badge { background: rgba(85, 214, 160, .13); color: var(--good); }
.day-item.active .day-badge { background: var(--accent); color: var(--accent-ink); }
.day-copy strong, .day-copy span { display: block; }
.day-copy strong { margin-bottom: 4px; font-size: .92rem; }
.day-copy span, .day-status { color: var(--muted); font-size: .76rem; }

.bottom-nav {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: min(100%, 480px);
  padding: 9px 18px calc(9px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(8, 12, 24, .92);
  backdrop-filter: blur(18px);
  transform: translateX(-50%);
}

.nav-button {
  min-height: 48px;
  border: 0;
  border-radius: 15px;
  background: transparent;
  color: var(--muted);
  font-size: .82rem;
}

.nav-button.active { background: var(--surface-2); color: var(--text); }
.nav-icon { display: block; margin-bottom: 3px; font-size: 1rem; }

.lesson-screen { min-height: calc(100vh - 28px); padding-top: 12px; }

.icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.progress-track {
  flex: 1;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width .25s ease;
}

.progress-count { min-width: 42px; color: var(--muted); font-size: .84rem; text-align: right; }

.question-card { padding: 30px 0 20px; }

.question-tag {
  display: inline-flex;
  margin-bottom: 16px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(113, 168, 255, .12);
  color: var(--blue);
  font-size: .76rem;
  font-weight: 800;
}

.prompt-box {
  margin-bottom: 24px;
  padding: 22px 18px;
  border-left: 4px solid var(--accent);
  border-radius: 4px 18px 18px 4px;
  background: var(--surface);
  font: 650 1.12rem/1.65 ui-monospace, "SFMono-Regular", Consolas, monospace;
  overflow-wrap: anywhere;
}

.question-card h1 {
  max-width: none;
  margin-bottom: 22px;
  font-size: 1.45rem;
  line-height: 1.4;
  letter-spacing: -.02em;
}

.options { display: grid; gap: 11px; }

.option-button {
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  line-height: 1.45;
}

.option-key {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: .78rem;
}

.option-button.correct { border-color: var(--good); background: rgba(85, 214, 160, .11); }
.option-button.wrong { border-color: var(--bad); background: rgba(255, 124, 130, .1); }
.option-button.correct .option-key { background: var(--good); color: #05140e; }
.option-button.wrong .option-key { background: var(--bad); color: #1f0507; }
.option-button:disabled { cursor: default; opacity: 1; }

.feedback {
  margin-top: 18px;
  padding: 17px;
  border-radius: 18px;
  background: var(--surface-2);
  animation: rise .2s ease-out;
}

.feedback strong { display: block; margin-bottom: 7px; color: var(--good); }
.feedback.is-wrong strong { color: var(--bad); }
.feedback p { margin-bottom: 15px; color: #c7d0e2; font-size: .94rem; line-height: 1.65; }

.result-screen { padding: 44px 0 20px; text-align: center; }
.result-icon { display: grid; place-items: center; width: 86px; height: 86px; margin: 0 auto 24px; border-radius: 28px; background: var(--accent); color: var(--accent-ink); font-size: 2.3rem; font-weight: 900; transform: rotate(-3deg); }
.result-screen h1 { max-width: none; margin-bottom: 10px; }
.result-screen > p { color: var(--muted); line-height: 1.6; }
.result-score { margin: 28px 0; padding: 20px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); text-align: left; }
.score-main strong { display: block; font-size: 2rem; }
.score-main span, .score-detail { color: var(--muted); font-size: .86rem; }
.result-actions { display: grid; gap: 10px; }

.empty-card, .progress-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
}

.empty-card { margin-top: 20px; text-align: center; }
.empty-symbol { margin: 10px 0 16px; color: var(--accent); font: 800 2rem/1 ui-monospace, monospace; }
.empty-card p, .progress-card p { color: var(--muted); line-height: 1.6; }
.progress-card { margin-bottom: 12px; }
.progress-card h3 { margin-bottom: 5px; }
.progress-ring { display: grid; place-items: center; width: 58px; height: 58px; border: 6px solid var(--surface-2); border-top-color: var(--accent); border-radius: 50%; font-weight: 800; }

.settings-link {
  width: 100%;
  margin-top: 30px;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: transparent;
  color: var(--muted);
}

.install-note {
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid rgba(248, 202, 77, .3);
  border-radius: 17px;
  background: rgba(248, 202, 77, .07);
  color: #e9dca7;
  font-size: .84rem;
  line-height: 1.55;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (min-width: 720px) {
  .app-shell { padding-top: 20px; }
  body { background-color: #060914; }
}

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