:root {
  color-scheme: light;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #171820;
  background: #f7f8fc;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  --muted: #9297aa;
  --blue: #3949f5;
  --blue-light: #5364ff;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: #f7f8fc;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; }

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

.topbar, .section-heading, .progress-summary, .chapter-progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar { min-height: 52px; }
.brand { font-size: 20px; font-weight: 850; letter-spacing: -.7px; }
.brand span { color: var(--blue); }

.avatar {
  display: grid;
  width: 48px;
  height: 48px;
  padding: 12px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: #171820;
}

.avatar svg { width: 24px; fill: currentColor; }

.welcome { margin: 24px 0 24px; }
.eyebrow { margin: 0 0 4px; color: #858ba0; font-size: 16px; font-weight: 600; }
.welcome h1 { margin: 0; font-size: 36px; line-height: 1.13; letter-spacing: -1.5px; }

.progress-card {
  padding: 24px 24px 20px;
  border-radius: 23px;
  color: #fff;
  background: linear-gradient(145deg, #1b1c22, #17181d);
  box-shadow: 0 12px 26px rgb(22 24 36 / 10%);
}

.card-kicker, .chapter-kicker {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .3px;
}

.card-kicker { color: #a6a9b8; }
.progress-summary { margin-bottom: 10px; }
.progress-summary h2 { margin: 0; font-size: 31px; letter-spacing: -.8px; line-height: 1.15; }
.progress-summary strong { color: #d0d2dd; font-size: 16px; }

.progress-track, .chapter-track {
  overflow: hidden;
  height: 17px;
  border-radius: 20px;
  background: #464750;
}

.progress-track span, .chapter-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #8489ff;
  transition: width .25s ease;
}

.progress-caption { margin: 12px 0 0; color: #aaadba; font-size: 13px; line-height: 1.4; }
.continue-section { margin-top: 48px; }
.section-heading { margin-bottom: 15px; }
.section-heading h2 { margin: 0; font-size: 21px; letter-spacing: -.55px; }
.text-link { color: #353744; font-size: 32px; line-height: 1; }

.chapter-card {
  position: relative;
  display: flex;
  min-height: 216px;
  overflow: hidden;
  align-items: center;
  justify-content: space-between;
  padding: 24px 22px;
  border-radius: 23px;
  color: #fff;
  background: linear-gradient(125deg, #3947f2 0%, #4e60ff 100%);
  box-shadow: 0 14px 28px rgb(54 69 227 / 16%);
}

.chapter-card[hidden] { display: none; }
.chapter-copy { z-index: 1; width: 74%; }
.chapter-kicker { margin-bottom: 9px; }
.chapter-copy h3 { max-width: 230px; margin: 0; font-size: 27px; line-height: 1.13; letter-spacing: -.7px; }
.chapter-meta { margin: 16px 0 18px; font-size: 15px; }
.chapter-progress-row { justify-content: flex-start; gap: 12px; color: #fff; font-size: 12px; white-space: nowrap; }
.chapter-track { width: 54%; max-width: 148px; height: 13px; background: rgb(255 255 255 / 33%); }
.chapter-track span { background: #b9c1ff; }
.book-icon { position: absolute; top: 35px; right: 64px; color: rgb(226 231 255 / 66%); }
.book-icon svg { width: 62px; fill: currentColor; }
.round-arrow {
  position: absolute;
  right: 18px;
  bottom: 43px;
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 50%;
  color: var(--blue);
  background: #fff;
  font-size: 26px;
}

.state-message { margin: 4px 0 12px; color: #73788d; font-size: 14px; line-height: 1.5; }
.state-message[hidden] { display: none; }
.state-message.is-error { color: #a2323c; }

.quick-links { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.summary-card {
  position: relative;
  min-width: 0;
  min-height: 155px;
  padding: 17px 16px 16px;
  border: 1px solid #f0f1f6;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 6px 18px rgb(34 40 70 / 3%);
}

.summary-icon { display: grid; width: 48px; height: 48px; margin-bottom: 11px; place-items: center; border-radius: 16px; background: #f1f3ff; }
.summary-icon svg { width: 25px; fill: var(--blue); }
.summary-card h3 { margin: 0 0 4px; font-size: 16px; letter-spacing: -.3px; }
.summary-card p { margin: 0; color: #858ba0; font-size: 13px; }
.small-arrow { position: absolute; right: 12px; bottom: 14px; display: grid; width: 27px; height: 27px; place-items: center; border-radius: 50%; color: #323542; background: #f1f2f7; font-size: 22px; line-height: 1; }

.bottom-nav {
  position: fixed;
  z-index: 5;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(100%, 520px);
  min-height: calc(82px + env(safe-area-inset-bottom));
  margin: 0 auto;
  padding: 10px 8px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid #f0f1f6;
  background: rgb(255 255 255 / 96%);
  backdrop-filter: blur(12px);
}

.nav-item { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 5px; color: #a2a5b8; font-size: 12px; font-weight: 500; }
.nav-item svg { width: 24px; height: 24px; fill: currentColor; }
.nav-item.is-active { color: var(--blue); }

@media (max-width: 430px) {
  .app-shell { padding-top: max(50px, env(safe-area-inset-top)); }
  .topbar { min-height: 48px; }
  .avatar { width: 44px; height: 44px; }
  .welcome { margin: 10px 0 16px; }
  .eyebrow { font-size: 15px; }
  .welcome h1 { font-size: 34px; }
  .progress-card { padding: 18px 18px 15px; }
  .card-kicker { margin-bottom: 6px; font-size: 11px; }
  .progress-summary { margin-bottom: 8px; }
  .progress-summary h2 { font-size: 26px; }
  .progress-track { height: 15px; }
  .progress-caption { margin-top: 10px; font-size: 11px; }
  .continue-section { margin-top: 40px; }
  .section-heading { margin-bottom: 12px; }
  .section-heading h2 { font-size: 19px; }
  .chapter-card { min-height: 180px; padding: 20px 18px; }
  .chapter-copy h3 { max-width: 175px; font-size: 23px; }
  .chapter-meta { margin: 13px 0 15px; font-size: 14px; }
  .chapter-progress-row { gap: 10px; font-size: 11px; }
  .chapter-track { height: 12px; }
  .book-icon { top: 28px; }
  .book-icon svg { width: 54px; }
  .round-arrow { right: 15px; bottom: 23px; width: 44px; height: 44px; }
  .quick-links { gap: 12px; margin-top: 14px; }
  .summary-card { min-height: 120px; padding: 14px 13px 12px; }
  .summary-icon { width: 42px; height: 42px; margin-bottom: 9px; border-radius: 14px; }
  .summary-icon svg { width: 22px; }
  .summary-card h3 { font-size: 15px; }
  .summary-card p { font-size: 12px; }
}

@media (min-width: 520px) {
  .app-shell { min-height: calc(100vh - 18px); margin-top: 9px; border-radius: 28px; background: #fafbfe; }
  .bottom-nav { border-right: 1px solid #f0f1f6; border-left: 1px solid #f0f1f6; border-radius: 18px 18px 0 0; }
}

@media (max-width: 370px) {
  .app-shell { padding-right: 18px; padding-left: 18px; }
  .progress-card { padding-right: 19px; padding-left: 19px; }
  .chapter-copy h3 { font-size: 24px; }
  .quick-links { gap: 10px; }
  .summary-card { padding-right: 12px; padding-left: 12px; }
}
