:root {
  color-scheme: dark;
  --bg: radial-gradient(circle at 30% 20%, #3b1b68, #090611 72%);
  --panel: rgba(43, 25, 68, 0.76);
  --panel-top: rgba(94, 55, 155, 0.74);
  --panel-bottom: rgba(16, 9, 30, 0.94);
  --line: rgba(185, 152, 255, 0.30);
  --text: #fff4ff;
  --muted: #d6c6ee;
  --gold: #ffe0f7;
  --accent: #ff72cf;
  --accent-2: #52f2e5;
  --tile-accent: #b8ff34;
  --green: #55f0ad;
  --orange: #c084fc;
  --red: #ff5d72;
  --blue: #70d6ff;
  --dark-ink: #080711;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.58);
  --glow: 0 0 22px rgba(255, 114, 207, 0.45), 0 0 38px rgba(82, 242, 229, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  width: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  letter-spacing: 0;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

.app-shell {
  min-height: 100dvh;
  overflow-x: hidden;
  padding: calc(env(safe-area-inset-top) + 18px) 14px calc(env(safe-area-inset-bottom) + 18px);
  background:
    radial-gradient(circle at 82% 12%, rgba(255, 114, 207, 0.18), transparent 30%),
    radial-gradient(circle at 12% 82%, rgba(82, 242, 229, 0.12), transparent 34%),
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(180deg, #090611 0%, #14102a 48%, #080711 100%);
  background-size: auto, auto, 46px 46px, 46px 46px, auto;
}

.screen {
  width: min(760px, 100%);
  min-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 36px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 66px;
  display: grid;
  grid-template-columns: 56px 1fr 56px;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.title {
  margin: 0;
  text-align: center;
  font-size: clamp(1.3rem, 5vw, 2rem);
  font-weight: 950;
  line-height: 1.08;
  overflow-wrap: anywhere;
  text-shadow: 0 0 18px rgba(255, 114, 207, 0.28), 0 0 26px rgba(82, 242, 229, 0.14);
}

.subtitle {
  max-width: min(32rem, 100%);
  margin: -8px auto 20px;
  padding: 0 4px;
  color: var(--muted);
  text-align: center;
  font-size: clamp(1.03rem, 4.2vw, 1.35rem);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.icon-button {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 114, 207, 0.16), rgba(12, 8, 27, 0.90));
  border: 1px solid rgba(185, 152, 255, 0.32);
  box-shadow: var(--shadow), inset 0 0 14px rgba(255, 255, 255, 0.08);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.icon-button:hover,
.icon-button:active {
  transform: scale(1.06);
  box-shadow: var(--glow);
  color: var(--accent);
}

.icon-button.gold {
  color: var(--accent);
  border-color: rgba(255, 114, 207, 0.48);
}

.icon-button svg,
.topic-icon svg,
.mini-icon svg,
.bookmark-star svg,
.quiz-actions svg,
.bottom-nav svg {
  width: 30px;
  height: 30px;
  stroke: currentColor;
  stroke-width: 2.35;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hero-stat {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
  align-items: start;
}

.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.stat-card span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
  text-transform: lowercase;
}

@keyframes pulseGlow {
  0% { box-shadow: 0 0 14px rgba(255, 114, 207, 0.18); }
  50% { box-shadow: 0 0 30px rgba(255, 114, 207, 0.38), 0 0 34px rgba(82, 242, 229, 0.12); }
  100% { box-shadow: 0 0 14px rgba(255, 114, 207, 0.18); }
}

.stat-ring {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--accent) 0deg, rgba(255,255,255,0.08) 0deg);
  box-shadow: 0 0 18px rgba(255, 114, 207, 0.22), 0 0 24px rgba(82, 242, 229, 0.10), inset 0 0 18px rgba(255, 255, 255, 0.04);
  animation: pulseGlow 3s infinite ease-in-out;
  transition: background 1.2s ease;
}

.stat-ring-inner {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(8, 7, 17, 0.92);
  border: 1px solid rgba(255,255,255,0.12);
}

.stat-ring strong {
  font-size: 1.02rem;
  font-weight: 900;
}

.study-dashboard {
  display: grid;
  gap: 12px;
  margin: 4px 0 18px;
}

.readiness-card,
.bookmark-panel,
.search-panel {
  border-radius: 24px;
  border: 1px solid rgba(185, 152, 255, 0.24);
  background:
    linear-gradient(180deg, rgba(94, 55, 155, 0.24), rgba(12, 8, 27, 0.76)),
    rgba(255, 255, 255, 0.04);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.28);
}

.readiness-card {
  min-height: 96px;
  display: grid;
  grid-template-columns: 1fr 78px;
  gap: 12px;
  align-items: center;
  padding: 14px;
}

.readiness-card span,
.readiness-card small {
  display: block;
  color: var(--muted);
  font-weight: 750;
}

.readiness-card span {
  font-size: 0.78rem;
  text-transform: uppercase;
}

.readiness-card strong {
  display: block;
  margin: 3px 0;
  color: var(--text);
  font-size: clamp(1.18rem, 5vw, 1.55rem);
  line-height: 1.05;
}

.readiness-card small {
  font-size: 0.86rem;
  line-height: 1.25;
}

.mini-action {
  min-height: 52px;
  border-radius: 18px;
  background: linear-gradient(180deg, #ff9fda, #72f3e7);
  color: var(--dark-ink);
  font-weight: 950;
  box-shadow: 0 10px 28px rgba(255, 114, 207, 0.20), 0 0 22px rgba(82, 242, 229, 0.12);
}

.topic-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding-bottom: 14px;
}

.authorship-notice {
  margin: 6px 0 0;
  padding-bottom: 6px;
  color: rgba(214, 198, 238, 0.72);
  text-align: center;
  font-size: 0.82rem;
  font-weight: 750;
}

.topic-card {
  min-height: 138px;
  padding: 14px 9px 12px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, var(--panel-top), var(--panel-bottom)),
    rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(185, 152, 255, 0.26);
  box-shadow: var(--shadow);
  color: var(--gold);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.25s ease;
}

.topic-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: var(--glow);
}

.topic-card:active {
  transform: scale(0.97);
}

.topic-icon {
  width: 58px;
  height: 58px;
  border-radius: 26px;
  position: relative;
  display: grid;
  place-items: center;
  border: 3px solid var(--tile-accent);
  color: var(--tile-accent);
  background: radial-gradient(circle, rgba(184, 255, 52, 0.24), rgba(11, 9, 25, 0.94));
  box-shadow: 0 0 25px rgba(184, 255, 52, 0.28), 0 0 22px rgba(255, 114, 207, 0.12), 0 10px 30px rgba(0, 0, 0, 0.5);
}

.topic-card span:last-child {
  display: block;
  max-width: 100%;
  color: var(--gold);
  font-size: clamp(0.78rem, 3.1vw, 1.03rem);
  line-height: 1.08;
  font-weight: 950;
  overflow-wrap: anywhere;
}

.feature-card {
  background:
    linear-gradient(180deg, rgba(122, 72, 176, 0.78), rgba(20, 12, 42, 0.94)),
    rgba(255, 255, 255, 0.05);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-heading h2 {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
}

.section-heading span {
  color: var(--accent);
  font-weight: 950;
}

.bookmark-panel {
  display: grid;
  gap: 10px;
  margin: 2px 0 18px;
  padding: 14px;
}

.bookmark-list {
  display: grid;
  gap: 9px;
}

.bookmark-row,
.search-row {
  min-height: 58px;
  display: grid;
  grid-template-columns: 42px 1fr 24px;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 18px;
  border: 1px solid rgba(185, 152, 255, 0.20);
  background: rgba(255, 255, 255, 0.05);
  text-align: left;
}

.bookmark-row strong,
.search-row strong {
  display: block;
}

.bookmark-row small,
.search-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.bookmark-star {
  color: var(--accent);
}

.list {
  display: grid;
  gap: 14px;
}

.lesson-row {
  min-height: 112px;
  display: grid;
  grid-template-columns: 74px 1fr 22px;
  gap: 18px;
  align-items: center;
  padding: 18px;
  border-radius: 28px;
  border: 1px solid rgba(185, 152, 255, 0.24);
  background: linear-gradient(180deg, rgba(94, 55, 155, 0.78), rgba(16, 9, 30, 0.94));
  box-shadow: var(--shadow);
  text-align: left;
}

.lesson-row .mini-icon {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: rgba(8, 7, 17, 0.82);
  color: var(--tile-accent);
  border: 1px solid rgba(184, 255, 52, 0.34);
  box-shadow: 0 0 18px rgba(184, 255, 52, 0.18);
  font-size: 1.45rem;
  font-weight: 950;
}

.lesson-row strong {
  font-size: clamp(1.18rem, 4.8vw, 1.72rem);
  line-height: 1.08;
}

.chevron,
.subject-count {
  color: rgba(255, 244, 255, 0.55);
  font-size: 2.4rem;
  font-weight: 900;
}

.subject-count {
  font-size: 1.2rem;
  color: var(--accent);
}

.reader {
  padding-bottom: 132px;
}

.reader-card {
  flex: 1;
  padding: 28px 10px 14px;
}

.reader-card h2 {
  margin: 0 0 24px;
  color: var(--accent);
  font-size: clamp(2.35rem, 8.5vw, 4.2rem);
  line-height: 1.04;
  font-weight: 950;
}

.reader-card h3 {
  margin: 20px 0 10px;
  color: var(--gold);
  font-size: 1.16rem;
}

.reader-card p,
.reader-card li {
  color: rgba(255, 244, 255, 0.92);
  font-size: clamp(1.23rem, 5.2vw, 2rem);
  line-height: 1.34;
}

.reader-card ul {
  margin: 8px 0 0;
  padding-left: 28px;
}

.lesson-section {
  margin: 18px 0;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(185, 152, 255, 0.20);
  background: rgba(255, 255, 255, 0.045);
}

.lesson-section li {
  font-size: clamp(1.02rem, 4.4vw, 1.34rem);
}

.memory-box {
  margin: 26px 0 0;
  padding: 18px 22px;
  border-left: 7px solid var(--accent);
  background: rgba(255, 255, 255, 0.07);
  color: #ffe8fb;
  font-size: clamp(1.2rem, 4.8vw, 1.66rem);
  line-height: 1.35;
}

.code-strip {
  overflow-x: auto;
  margin: 22px 0 0;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(82, 242, 229, 0.26);
  background: rgba(0, 0, 0, 0.42);
  color: #d8fff9;
  font-size: 1rem;
  line-height: 1.45;
}

.progress-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin: auto 0 20px;
  padding-top: 20px;
}

.progress-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
}

.progress-dot.active {
  background: var(--accent);
  box-shadow: 0 0 18px rgba(255, 114, 207, 0.44), 0 0 28px rgba(82, 242, 229, 0.14);
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 16px);
  width: min(760px, calc(100% - 28px));
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: 58px 1fr 1fr 58px;
  gap: 12px;
  align-items: center;
  z-index: 20;
}

.pill-button {
  min-height: 58px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ff9fda, #72f3e7);
  color: var(--dark-ink);
  font-size: clamp(1rem, 4.4vw, 1.28rem);
  font-weight: 950;
  box-shadow: 0 10px 24px rgba(255, 114, 207, 0.18), 0 0 22px rgba(82, 242, 229, 0.10);
}

.pill-button.secondary {
  color: var(--text);
  background: rgba(12, 8, 27, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.quiz-panel {
  flex: 1;
  padding: 10px 4px 118px;
}

.quiz-circles {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 10px 0 28px;
}

.quiz-circles span {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.55);
  color: #cfe4ff;
  font-size: 1.3rem;
  font-weight: 950;
}

.quiz-circles span.active {
  color: var(--accent);
  border-color: var(--accent);
}

.quiz-circles span.done {
  color: var(--text);
  border-color: var(--green);
}

.quiz-panel .question {
  margin: 0 0 28px;
  color: var(--text);
  font-size: clamp(1.65rem, 6vw, 2.65rem);
  line-height: 1.22;
  font-weight: 950;
}

.answer-list {
  display: grid;
  gap: 20px;
}

.answer {
  min-height: 86px;
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 18px;
  align-items: center;
  background: transparent;
  text-align: left;
}

.answer-letter {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 7px solid var(--gold);
  color: transparent;
}

.answer-text {
  color: rgba(255, 244, 255, 0.94);
  font-size: clamp(1.28rem, 5.2vw, 2rem);
  line-height: 1.18;
}

.answer.selected .answer-letter {
  color: var(--dark-ink);
  background: var(--accent);
}

.answer.correct .answer-letter {
  color: var(--dark-ink);
  background: var(--green);
  border-color: var(--green);
}

.answer.wrong .answer-letter {
  color: white;
  background: var(--red);
  border-color: var(--red);
}

.feedback {
  margin-top: 22px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 114, 207, 0.24);
  background: rgba(255, 114, 207, 0.09);
  color: #ffe8fb;
  font-size: 1.05rem;
  line-height: 1.35;
}

.quiz-actions {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 16px);
  width: min(760px, calc(100% - 28px));
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: 58px 1fr 1fr 58px;
  gap: 10px;
  z-index: 20;
}

.quiz-actions button {
  min-height: 58px;
  border-radius: 999px;
  font-weight: 950;
}

.quiz-nav-button,
.quiz-ghost {
  background: rgba(12, 8, 27, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.quiz-nav-button {
  display: grid;
  place-items: center;
}

.quiz-nav-button span {
  display: none;
}

.quiz-primary {
  background: linear-gradient(180deg, #ff9fda, #72f3e7);
  color: var(--dark-ink);
}

.quiz-primary.correct {
  background: linear-gradient(180deg, #68ffad, #18be67);
}

.quiz-primary.wrong {
  background: linear-gradient(180deg, #ff8897, #e63d57);
  color: white;
}

.score-card {
  margin: auto 0;
  padding: 28px 18px;
  border-radius: 28px;
  border: 1px solid rgba(185, 152, 255, 0.24);
  background: linear-gradient(180deg, rgba(94, 55, 155, 0.24), rgba(12, 8, 27, 0.84));
  box-shadow: var(--shadow);
  text-align: center;
}

.score-card .score {
  margin: 8px 0;
  color: var(--accent);
  font-size: clamp(4rem, 18vw, 7rem);
  font-weight: 950;
  line-height: 1;
}

.score-card p {
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.35;
}

.score-card .pill-button {
  width: min(360px, 100%);
  margin: 8px auto;
  display: block;
}

.flash-meta,
.flash-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  margin-bottom: 12px;
  color: var(--muted);
  font-weight: 850;
}

.flash-tool {
  min-height: 36px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(185, 152, 255, 0.22);
}

.flash-tool.saved {
  color: var(--dark-ink);
  background: var(--accent);
}

.flash-card {
  flex: 1;
  min-height: 420px;
  display: grid;
  align-content: center;
  gap: 18px;
  padding: 28px;
  border-radius: 30px;
  border: 1px solid rgba(185, 152, 255, 0.24);
  background: linear-gradient(180deg, rgba(94, 55, 155, 0.48), rgba(16, 9, 30, 0.94));
  box-shadow: var(--shadow);
  text-align: center;
}

.flash-label {
  color: var(--accent);
  font-weight: 950;
  text-transform: uppercase;
}

.flash-card strong {
  font-size: clamp(2rem, 8vw, 3.5rem);
  line-height: 1.12;
}

.flash-card small {
  color: var(--muted);
  font-size: 1rem;
}

.search-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.search-input {
  width: 100%;
  min-height: 54px;
  padding: 0 16px;
  border-radius: 18px;
  border: 1px solid rgba(185, 152, 255, 0.24);
  background: rgba(0, 0, 0, 0.34);
  color: var(--text);
}

.search-results {
  display: grid;
  gap: 10px;
}

.empty-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
}

@media (max-width: 620px) {
  .app-shell {
    padding: calc(env(safe-area-inset-top) + 12px) 10px calc(env(safe-area-inset-bottom) + 12px);
    background-size: auto, auto, 36px 36px, 36px 36px, auto;
  }

  .screen {
    min-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px);
  }

  .topbar {
    min-height: 52px;
    grid-template-columns: 46px minmax(0, 1fr) 46px;
    gap: 7px;
    margin-bottom: 8px;
  }

  .title {
    font-size: clamp(1.1rem, 6.4vw, 1.62rem);
    line-height: 1.05;
  }

  .subtitle {
    margin: -2px auto 14px;
    font-size: clamp(0.95rem, 4.6vw, 1.12rem);
    line-height: 1.28;
  }

  .icon-button {
    width: 44px;
    height: 44px;
  }

  .icon-button svg,
  .topic-icon svg,
  .mini-icon svg,
  .bookmark-star svg,
  .quiz-actions svg,
  .bottom-nav svg {
    width: 25px;
    height: 25px;
  }

  .hero-stat {
    gap: 6px;
    margin-bottom: 12px;
  }

  .stat-ring {
    width: 62px;
    height: 62px;
  }

  .stat-ring-inner {
    width: 48px;
    height: 48px;
  }

  .stat-ring strong {
    font-size: 0.86rem;
  }

  .stat-card span {
    font-size: 0.72rem;
  }

  .study-dashboard {
    margin: 2px 0 14px;
  }

  .readiness-card {
    min-height: 86px;
    grid-template-columns: minmax(0, 1fr) 64px;
    gap: 10px;
    padding: 12px;
    border-radius: 20px;
  }

  .readiness-card span {
    font-size: 0.7rem;
  }

  .readiness-card strong {
    font-size: clamp(1.05rem, 5.7vw, 1.32rem);
  }

  .readiness-card small {
    font-size: 0.78rem;
    line-height: 1.28;
  }

  .mini-action {
    min-height: 46px;
    border-radius: 16px;
    font-size: 0.95rem;
  }

  .topic-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding-bottom: 10px;
  }

  .topic-card {
    min-height: 118px;
    padding: 12px 8px 10px;
    border-radius: 20px;
    gap: 8px;
  }

  .topic-icon {
    width: 48px;
    height: 48px;
    border-radius: 20px;
    border-width: 2px;
  }

  .topic-card span:last-child {
    font-size: clamp(0.86rem, 3.7vw, 0.98rem);
    line-height: 1.12;
  }

  .authorship-notice {
    padding-bottom: 12px;
    font-size: 0.75rem;
  }

  .list {
    gap: 10px;
  }

  .lesson-row {
    grid-template-columns: 52px minmax(0, 1fr) 16px;
    min-height: 84px;
    padding: 12px;
    gap: 10px;
    border-radius: 20px;
  }

  .lesson-row .mini-icon {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    font-size: 1rem;
  }

  .lesson-row strong {
    font-size: clamp(1rem, 4.7vw, 1.2rem);
    line-height: 1.15;
  }

  .chevron {
    font-size: 1.75rem;
  }

  .subject-count {
    font-size: 1rem;
  }

  .reader {
    padding-bottom: calc(122px + env(safe-area-inset-bottom));
  }

  .reader-card {
    padding: 12px 2px 8px;
  }

  .reader-card h2 {
    margin-bottom: 14px;
    font-size: clamp(1.62rem, 8.2vw, 2.28rem);
    line-height: 1.08;
  }

  .reader-card h3 {
    margin: 16px 0 8px;
    font-size: 1.02rem;
  }

  .reader-card p,
  .reader-card li {
    font-size: clamp(1.03rem, 4.7vw, 1.18rem);
    line-height: 1.5;
  }

  .reader-card ul {
    padding-left: 22px;
  }

  .lesson-section {
    margin: 14px 0;
    padding: 12px;
    border-radius: 16px;
  }

  .lesson-section li {
    font-size: clamp(0.96rem, 4.1vw, 1.06rem);
    line-height: 1.46;
  }

  .memory-box {
    margin-top: 18px;
    padding: 14px;
    border-left-width: 5px;
    font-size: clamp(1rem, 4.4vw, 1.14rem);
    line-height: 1.42;
  }

  .code-strip {
    margin-top: 16px;
    padding: 12px;
    border-radius: 14px;
    font-size: 0.82rem;
  }

  .progress-strip {
    gap: 8px;
    margin: 8px 0 98px;
    padding-top: 8px;
  }

  .progress-dot {
    width: 11px;
    height: 11px;
  }

  .bottom-nav,
  .quiz-actions {
    width: calc(100% - 20px);
    bottom: calc(env(safe-area-inset-bottom) + 8px);
    grid-template-columns: 44px minmax(0, 1fr) minmax(0, 1fr) 44px;
    gap: 8px;
    padding: 8px;
    border-radius: 28px;
    border: 1px solid rgba(185, 152, 255, 0.22);
    background: rgba(10, 7, 22, 0.82);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.46);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }

  .bottom-nav .icon-button,
  .quiz-nav-button {
    width: 44px;
    min-height: 48px;
  }

  .pill-button,
  .quiz-actions button {
    min-height: 48px;
    font-size: 0.94rem;
  }

  .quiz-panel {
    padding: 4px 0 calc(126px + env(safe-area-inset-bottom));
  }

  .quiz-circles {
    gap: 6px;
    margin: 4px 0 18px;
  }

  .quiz-circles span {
    width: 30px;
    height: 30px;
    border-width: 2px;
    font-size: 0.78rem;
  }

  .quiz-panel .question {
    margin-bottom: 18px;
    font-size: clamp(1.25rem, 5.8vw, 1.68rem);
    line-height: 1.28;
  }

  .answer-list {
    gap: 12px;
  }

  .answer {
    min-height: 64px;
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 10px;
  }

  .answer-letter {
    width: 42px;
    height: 42px;
    border-width: 4px;
  }

  .answer-text {
    font-size: clamp(1rem, 4.7vw, 1.18rem);
    line-height: 1.26;
  }

  .feedback {
    margin-top: 14px;
    padding: 12px;
    font-size: 0.95rem;
  }

  .quiz-ghost {
    font-size: 0.86rem;
  }

  .score-card {
    margin: 10px 0;
    padding: 22px 14px;
    border-radius: 22px;
  }

  .score-card .score {
    font-size: clamp(3.6rem, 18vw, 5.2rem);
  }

  .score-card p {
    font-size: 1rem;
  }

  .flash-meta,
  .flash-tools {
    gap: 7px;
    margin-bottom: 10px;
  }

  .flash-tool {
    flex: 1 1 auto;
    min-height: 40px;
    padding: 8px 10px;
    font-size: 0.9rem;
  }

  .flash-card {
    min-height: 320px;
    padding: 20px;
    border-radius: 24px;
  }

  .flash-card strong {
    font-size: clamp(1.5rem, 8.6vw, 2.35rem);
    line-height: 1.14;
  }

  .search-panel {
    gap: 12px;
    padding: 12px;
  }

  .search-input {
    min-height: 50px;
    border-radius: 16px;
  }

  .bookmark-row,
  .search-row {
    min-height: 54px;
    grid-template-columns: 34px minmax(0, 1fr) 18px;
    gap: 8px;
    padding: 10px;
    border-radius: 16px;
  }
}

@media (max-width: 380px) {
  .app-shell {
    padding-left: 8px;
    padding-right: 8px;
  }

  .topbar {
    grid-template-columns: 42px minmax(0, 1fr) 42px;
  }

  .icon-button {
    width: 40px;
    height: 40px;
  }

  .topic-card {
    min-height: 110px;
  }

  .topic-icon {
    width: 44px;
    height: 44px;
  }

  .readiness-card {
    grid-template-columns: minmax(0, 1fr) 58px;
  }

  .bottom-nav,
  .quiz-actions {
    width: calc(100% - 16px);
    grid-template-columns: 40px minmax(0, 1fr) minmax(0, 1fr) 40px;
    gap: 6px;
  }

  .bottom-nav .icon-button,
  .quiz-nav-button {
    width: 40px;
  }

  .pill-button,
  .quiz-actions button {
    font-size: 0.86rem;
  }
}
