:root {
  --ink: #202039;
  --indigo: #22204d;
  --indigo-soft: #35316d;
  --cream: #f7f3e8;
  --paper: #fffdf7;
  --saffron: #f2b84b;
  --coral: #e9684a;
  --mint: #9dd6bb;
  --muted: #716e7d;
  --line: #ded8ca;
  --success: #28745b;
  --danger: #a74239;
  --shadow: 0 18px 54px rgba(42, 38, 69, 0.11);
  --radius-sm: 12px;
  --radius: 20px;
  --radius-lg: 30px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--ink);
  background: var(--cream);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--cream);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 2%, rgba(242, 184, 75, 0.26), transparent 28rem),
    radial-gradient(circle at 92% 12%, rgba(157, 214, 187, 0.2), transparent 25rem),
    var(--cream);
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(233, 104, 74, 0.45);
  outline-offset: 3px;
}

.boot-screen {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1rem;
  color: var(--muted);
}

.brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: var(--saffron);
  color: var(--indigo);
  font-family: Georgia, serif;
  font-size: 2.25rem;
  font-weight: 700;
  box-shadow: 0 12px 28px rgba(74, 59, 37, 0.17);
}

.site-shell {
  min-height: 100vh;
  padding-bottom: calc(82px + env(safe-area-inset-bottom));
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1rem max(1.25rem, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid rgba(34, 32, 77, 0.08);
  background: rgba(247, 243, 232, 0.9);
  backdrop-filter: blur(18px);
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--indigo);
  text-decoration: none;
  font-weight: 760;
  letter-spacing: -0.02em;
}

.brand-link .brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  font-size: 1.7rem;
  box-shadow: none;
}

.brand-copy {
  display: grid;
  line-height: 1.05;
}

.brand-copy small {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.desktop-nav {
  display: none;
  align-items: center;
  gap: 0.3rem;
}

.nav-link {
  position: relative;
  padding: 0.7rem 0.86rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
  text-decoration: none;
}

.nav-link:hover,
.nav-link.is-active {
  color: var(--indigo);
  background: rgba(34, 32, 77, 0.07);
}

.due-pill {
  min-width: 1.5rem;
  margin-left: 0.25rem;
  padding: 0.14rem 0.38rem;
  border-radius: 999px;
  color: white;
  background: var(--coral);
  font-size: 0.7rem;
  text-align: center;
}

.main-content {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 4rem;
}

.bottom-nav {
  position: fixed;
  z-index: 30;
  right: 0.75rem;
  bottom: calc(0.65rem + env(safe-area-inset-bottom));
  left: 0.75rem;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.2rem;
  padding: 0.48rem;
  border: 1px solid rgba(34, 32, 77, 0.09);
  border-radius: 22px;
  background: rgba(255, 253, 247, 0.94);
  box-shadow: 0 14px 44px rgba(34, 32, 77, 0.17);
  backdrop-filter: blur(22px);
}

.bottom-link {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 0.2rem;
  padding: 0.5rem 0.15rem;
  border-radius: 16px;
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 700;
  text-decoration: none;
}

.bottom-link.is-active {
  color: var(--indigo);
  background: rgba(242, 184, 75, 0.2);
}

.nav-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.bottom-link .due-pill {
  position: absolute;
  top: 0.12rem;
  left: calc(50% + 0.35rem);
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--coral);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4 {
  color: var(--indigo);
  letter-spacing: -0.035em;
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.35rem, 9vw, 5.7rem);
  font-weight: 700;
  line-height: 0.98;
}

h2 {
  margin: 0;
  font-size: clamp(1.55rem, 4vw, 2.4rem);
  line-height: 1.1;
}

h3 {
  margin: 0;
  font-size: 1.15rem;
}

p {
  line-height: 1.65;
}

.lead {
  max-width: 42rem;
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2.4vw, 1.22rem);
}

.hero {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 2rem;
  padding: clamp(1.5rem, 5vw, 4rem);
  border-radius: var(--radius-lg);
  color: white;
  background:
    linear-gradient(135deg, rgba(34, 32, 77, 0.98), rgba(53, 49, 109, 0.95)),
    var(--indigo);
  box-shadow: var(--shadow);
}

.hero::after {
  content: "न";
  position: absolute;
  right: -0.06em;
  bottom: -0.42em;
  color: rgba(242, 184, 75, 0.1);
  font-family: Georgia, serif;
  font-size: clamp(15rem, 50vw, 36rem);
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}

.hero > * {
  position: relative;
  z-index: 1;
}

.hero h1,
.hero h2 {
  color: white;
}

.hero .lead {
  color: rgba(255, 255, 255, 0.75);
}

.hero-actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.78rem 1rem;
  border: 0;
  border-radius: 14px;
  color: white;
  background: var(--indigo);
  font-weight: 760;
  text-decoration: none;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 9px 24px rgba(34, 32, 77, 0.2);
}

.button.primary {
  color: var(--indigo);
  background: var(--saffron);
}

.button.secondary {
  color: var(--indigo);
  background: var(--paper);
  border: 1px solid var(--line);
}

.button.ghost {
  color: var(--indigo);
  background: rgba(34, 32, 77, 0.07);
}

.hero .button.secondary {
  color: white;
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.1);
}

.button.danger {
  color: white;
  background: var(--danger);
}

.button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none;
}

.stat-grid,
.card-grid,
.lesson-grid,
.feature-grid {
  display: grid;
  gap: 1rem;
}

.stat-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 1rem;
}

.stat {
  padding: 1rem;
  border-radius: var(--radius);
  color: var(--indigo);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.13);
}

.stat strong {
  display: block;
  font-size: 1.55rem;
}

.stat span {
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.76rem;
}

.section {
  margin-top: 2.6rem;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-heading a {
  color: var(--coral);
  font-size: 0.88rem;
  font-weight: 750;
  text-decoration: none;
}

.surface,
.lesson-card,
.feature-card,
.dictionary-card,
.settings-card {
  border: 1px solid rgba(34, 32, 77, 0.08);
  border-radius: var(--radius);
  background: rgba(255, 253, 247, 0.87);
  box-shadow: 0 8px 28px rgba(42, 38, 69, 0.06);
}

.lesson-card,
.feature-card,
.dictionary-card,
.settings-card {
  padding: 1.25rem;
}

.lesson-card {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 0.9rem;
  min-height: 190px;
  text-decoration: none;
}

.lesson-card:hover {
  border-color: rgba(34, 32, 77, 0.2);
  transform: translateY(-2px);
}

.lesson-card.is-complete::after {
  content: "✓";
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 1.7rem;
  height: 1.7rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--success);
  font-weight: 800;
}

.lesson-meta,
.meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.lesson-number,
.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  color: var(--indigo);
  background: rgba(242, 184, 75, 0.24);
  font-size: 0.7rem;
  font-weight: 800;
}

.lesson-card p,
.feature-card p,
.dictionary-card p {
  margin: 0;
  color: var(--muted);
}

.progress-track {
  overflow: hidden;
  height: 9px;
  border-radius: 999px;
  background: rgba(34, 32, 77, 0.1);
}

.progress-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--saffron), var(--coral));
  transition: width 260ms ease;
}

.page-header {
  max-width: 48rem;
  margin: 1rem 0 2rem;
}

.lesson-layout,
.grammar-layout {
  display: grid;
  gap: 1.5rem;
}

.lesson-content {
  display: grid;
  gap: 1rem;
}

.lesson-section {
  padding: clamp(1.25rem, 4vw, 2rem);
}

.lesson-section p {
  margin-bottom: 0;
  color: var(--muted);
}

.example-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.example {
  display: grid;
  gap: 0.35rem;
  padding: 1rem;
  border-left: 4px solid var(--saffron);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: rgba(242, 184, 75, 0.1);
}

.ns-text {
  color: var(--indigo);
  font-family: "Iowan Old Style", Georgia, serif;
  font-size: 1.12rem;
  font-weight: 700;
}

.translation {
  color: var(--muted);
  font-size: 0.9rem;
}

.review-shell {
  max-width: 760px;
  margin: 0 auto;
}

.review-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.review-progress {
  flex: 1;
}

.review-card {
  min-height: min(510px, 66vh);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 1rem;
  padding: clamp(1.3rem, 5vw, 2.5rem);
}

.review-label {
  color: var(--coral);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.review-prompt {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1rem;
  text-align: center;
}

.review-prompt h2 {
  max-width: 34rem;
  font-family: "Iowan Old Style", Georgia, serif;
  font-size: clamp(2rem, 8vw, 4rem);
}

.review-answer {
  width: 100%;
  margin-top: 0.7rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
}

.review-answer strong {
  display: block;
  color: var(--indigo);
  font-family: "Iowan Old Style", Georgia, serif;
  font-size: clamp(1.35rem, 4vw, 2rem);
}

.review-answer p {
  margin-bottom: 0;
  color: var(--muted);
}

.rating-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.rating {
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--indigo);
  background: var(--paper);
  font-weight: 800;
  cursor: pointer;
}

.rating:hover {
  border-color: var(--indigo);
}

.rating.again {
  color: var(--danger);
}

.rating.good {
  color: var(--success);
  background: rgba(157, 214, 187, 0.2);
}

.review-complete {
  min-height: 460px;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 2rem;
  text-align: center;
}

.celebration {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border-radius: 25px;
  color: var(--indigo);
  background: var(--mint);
  font-size: 2.1rem;
}

.search-box {
  width: 100%;
  min-height: 52px;
  padding: 0 1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  background: var(--paper);
}

.dictionary-grid {
  display: grid;
  gap: 0.85rem;
  margin-top: 1rem;
}

.dictionary-card {
  display: grid;
  gap: 0.8rem;
}

.lexeme-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1rem;
}

.lemma {
  color: var(--indigo);
  font-family: "Iowan Old Style", Georgia, serif;
  font-size: 1.45rem;
  font-weight: 750;
}

.language {
  color: var(--coral);
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.grammar-nav {
  display: flex;
  overflow-x: auto;
  gap: 0.5rem;
  padding-bottom: 0.4rem;
  scrollbar-width: thin;
}

.grammar-nav button {
  white-space: nowrap;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--paper);
  cursor: pointer;
}

.grammar-nav button.is-active {
  color: white;
  border-color: var(--indigo);
  background: var(--indigo);
}

.markdown-body {
  padding: clamp(1.25rem, 4vw, 2.5rem);
  line-height: 1.7;
}

.markdown-body h1 {
  margin-bottom: 1.6rem;
  font-size: clamp(2rem, 7vw, 3.6rem);
}

.markdown-body h2 {
  margin-top: 2.2rem;
  margin-bottom: 0.8rem;
}

.markdown-body h3 {
  margin-top: 1.7rem;
}

.markdown-body p,
.markdown-body li {
  color: #4f4d5b;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.markdown-body th,
.markdown-body td {
  padding: 0.7rem;
  border: 1px solid var(--line);
  text-align: left;
}

.markdown-body code {
  padding: 0.12rem 0.32rem;
  border-radius: 5px;
  color: var(--indigo);
  background: rgba(34, 32, 77, 0.08);
}

.markdown-body pre {
  overflow-x: auto;
  padding: 1rem;
  border-radius: var(--radius-sm);
  background: var(--indigo);
}

.markdown-body pre code {
  padding: 0;
  color: #fff7dc;
  background: transparent;
}

.settings-grid {
  display: grid;
  gap: 1rem;
}

.settings-card {
  display: grid;
  gap: 0.8rem;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.setting-row select {
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}

.muted {
  color: var(--muted);
}

.notice {
  padding: 0.85rem 1rem;
  border: 1px solid rgba(242, 184, 75, 0.45);
  border-radius: var(--radius-sm);
  color: #654b1c;
  background: rgba(242, 184, 75, 0.16);
  font-size: 0.88rem;
}

.empty-state {
  padding: 2rem;
  text-align: center;
}

.footer {
  width: min(1180px, calc(100% - 2rem));
  margin: 1rem auto 0;
  padding: 1.5rem 0 2rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
}

@media (min-width: 700px) {
  .main-content {
    padding-top: 2.25rem;
  }

  .hero {
    grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
    align-items: end;
  }

  .stat-grid {
    grid-template-columns: 1fr 1fr;
  }

  .lesson-grid,
  .feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dictionary-grid,
  .settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rating-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  .site-shell {
    padding-bottom: 0;
  }

  .desktop-nav {
    display: flex;
  }

  .bottom-nav {
    display: none;
  }

  .lesson-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .lesson-layout {
    grid-template-columns: minmax(0, 1fr) 260px;
    align-items: start;
  }

  .lesson-aside {
    position: sticky;
    top: 92px;
    order: 2;
  }

  .grammar-layout {
    grid-template-columns: 240px minmax(0, 1fr);
    align-items: start;
  }

  .grammar-nav {
    position: sticky;
    top: 92px;
    display: grid;
    overflow: visible;
  }

  .grammar-nav button {
    white-space: normal;
    text-align: left;
  }
}

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