:root {
  color-scheme: light;
  --ink: #18263d;
  --muted: #6b7890;
  --navy: #10233f;
  --blue: #3268d5;
  --line: #e2e8f0;
  --surface: #ffffff;
  --canvas: #f4f7fb;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
  scroll-behavior: smooth;
}

body.home {
  min-height: 100vh;
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: "Noto Sans Devanagari", "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid #8bb4ff;
  outline-offset: 3px;
}

.site-header {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 82px;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 14px max(28px, calc((100vw - 1220px) / 2));
  background: var(--navy);
  color: #fff;
  box-shadow: 0 4px 18px rgb(16 35 63 / 12%);
}

.brand {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 28%);
  border-radius: 13px;
  background: linear-gradient(145deg, #6994f0, #3766ce);
  font-family: Georgia, serif;
  font-size: 26px;
  font-weight: 700;
}

.brand-copy {
  display: grid;
  gap: 3px;
}

.brand-copy strong {
  font-size: 16px;
  letter-spacing: .01em;
}

.brand-copy > span {
  color: #bcc9dc;
  font-size: 12px;
}

.subject-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.subject-btn {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid rgb(255 255 255 / 20%);
  border-radius: 9px;
  background: transparent;
  color: #e8eef8;
  cursor: pointer;
  font-size: 13px;
  transition: background .18s ease, border-color .18s ease, color .18s ease;
}

.subject-btn:hover,
.subject-btn[aria-pressed="true"] {
  border-color: #7196ed;
  background: #274775;
  color: #fff;
}

.app-shell {
  width: min(1220px, calc(100% - 56px));
  min-height: calc(100vh - 150px);
  margin: 0 auto;
  padding: 42px 0 52px;
}

.welcome-panel {
  position: relative;
  display: flex;
  min-height: 264px;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  padding: 34px clamp(24px, 5vw, 62px);
  border: 1px solid #233f68;
  border-radius: 22px;
  background:
    radial-gradient(ellipse at 83% 5%, rgb(87 123 205 / 35%), transparent 33%),
    linear-gradient(112deg, #10233f 0%, #18365c 62%, #284a78 100%);
  color: #fff;
  box-shadow: 0 16px 36px rgb(16 35 63 / 16%);
}

.welcome-copy {
  position: relative;
  z-index: 1;
  max-width: 690px;
}

.eyebrow {
  margin: 0 0 10px;
  color: #7595dd;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .13em;
}

.welcome-panel .eyebrow {
  color: #b6cbff;
}

.welcome-panel h1 {
  margin: 0;
  font-size: clamp(27px, 4vw, 42px);
  font-weight: 750;
  line-height: 1.45;
}

.welcome-panel h1 span {
  color: #b8ccff;
}

.welcome-description {
  max-width: 580px;
  margin: 14px 0 0;
  color: #d0daea;
  font-size: 15px;
  line-height: 1.9;
}

.welcome-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 22px;
  color: #d9e4f4;
  font-size: 13px;
}

.welcome-meta strong {
  color: #fff;
  font-size: 16px;
}

.meta-divider {
  width: 1px;
  height: 20px;
  background: rgb(255 255 255 / 28%);
}

.welcome-art {
  position: relative;
  width: 190px;
  height: 190px;
  flex: 0 0 190px;
  margin: 0 24px 0 36px;
  transform: rotate(-5deg);
}

.book {
  position: absolute;
  width: 114px;
  height: 144px;
  border: 1px solid rgb(255 255 255 / 35%);
  border-radius: 8px 13px 13px 8px;
  box-shadow: 7px 13px 24px rgb(0 0 0 / 22%);
}

.book-back {
  top: 24px;
  left: 57px;
  background: #f2b65c;
  transform: rotate(13deg);
}

.book-front {
  top: 19px;
  left: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 25px 16px;
  background: linear-gradient(145deg, #7899ec, #4269c1);
}

.book-front span {
  margin-bottom: 2px;
  color: white;
  font-family: Georgia, serif;
  font-size: 21px;
  font-weight: 700;
}

.book-front i {
  width: 69px;
  height: 3px;
  border-radius: 3px;
  background: rgb(255 255 255 / 70%);
}

.book-front i:last-child {
  width: 46px;
}

.art-spark {
  position: absolute;
  color: #c8d6ff;
}

.spark-one {
  top: 3px;
  right: 9px;
  font-size: 26px;
}

.spark-two {
  bottom: 14px;
  left: 7px;
  font-size: 33px;
}

.subject-section {
  margin-top: 40px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 17px;
}

.section-heading .eyebrow {
  margin-bottom: 4px;
}

.section-heading h2 {
  margin: 0;
  color: var(--ink);
  font-size: 23px;
}

.section-heading > p {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 13px;
}

.subject-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.subject-card {
  position: relative;
  display: flex;
  min-height: 124px;
  align-items: center;
  gap: 16px;
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 3px 12px rgb(26 47 78 / 4%);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.subject-card:hover {
  transform: translateY(-3px);
  border-color: #b6c8ef;
  box-shadow: 0 12px 25px rgb(26 47 78 / 9%);
}

.subject-icon {
  display: grid;
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  place-items: center;
  border-radius: 15px;
  background: var(--subject-tint, #edf2ff);
  color: var(--subject-color, #3268d5);
  font-size: 14px;
  font-weight: 800;
}

.subject-card-copy {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.subject-card-copy strong {
  font-size: 16px;
  line-height: 1.5;
}

.subject-card-copy > span {
  color: var(--muted);
  font-size: 12px;
}

.card-arrow {
  margin-left: auto;
  color: #8493aa;
  font-size: 23px;
}

.workspace {
  display: grid;
  grid-template-columns: 282px minmax(0, 1fr);
  align-items: start;
  gap: 24px;
  scroll-margin-top: 16px;
}

.workspace[hidden] {
  display: none;
}

.sidebar-panel,
.content-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 4px 16px rgb(26 47 78 / 5%);
}

.sidebar-panel {
  position: sticky;
  top: 18px;
  overflow: hidden;
}

.sidebar-heading {
  padding: 20px 18px 12px;
}

.sidebar-heading .eyebrow {
  margin-bottom: 5px;
}

.sidebar-heading h2 {
  margin: 0;
  color: var(--ink);
  font-size: 19px;
}

.topic-count {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.topic-search {
  display: flex;
  height: 42px;
  align-items: center;
  gap: 8px;
  margin: 4px 14px 12px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafd;
  color: var(--muted);
}

.search-icon {
  font-size: 22px;
  line-height: 1;
}

.topic-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
}

.topic-list {
  max-height: calc(100vh - 260px);
  overflow-y: auto;
  padding: 0 9px 10px;
  scrollbar-color: #bdc9da transparent;
  scrollbar-width: thin;
}

.sidebar button.topic-btn,
.back-home {
  width: 100%;
  border: 0;
  background: transparent;
  color: #4a5870;
  text-align: left;
  cursor: pointer;
}

.sidebar button.topic-btn {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.55;
}

.topic-number {
  flex: 0 0 21px;
  color: #9aa6b9;
  font-size: 11px;
  text-align: right;
}

.sidebar button.topic-btn:hover {
  background: #f1f5fc;
  color: var(--blue);
}

.sidebar button.topic-btn[aria-current="page"] {
  background: #edf3ff;
  color: #285bb9;
  font-weight: 700;
}

.topic-empty {
  padding: 14px 10px;
  color: var(--muted);
  font-size: 13px;
}

.back-home {
  padding: 13px 18px;
  border-top: 1px solid var(--line);
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
}

.back-home:hover {
  background: #f6f8fc;
}

.content-panel {
  min-height: 420px;
  padding: 22px;
}

.content-empty {
  display: flex;
  min-height: 370px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 26px;
  text-align: center;
}

.empty-mark {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  margin-bottom: 17px;
  border-radius: 18px;
  background: #edf3ff;
  color: var(--blue);
  font-size: 27px;
}

.content-empty .eyebrow {
  margin-bottom: 7px;
}

.content-empty h2 {
  margin: 0;
  color: var(--ink);
  font-size: 23px;
}

.content-empty > p:last-child {
  max-width: 420px;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}

.topic-frame {
  display: block;
  width: 100%;
  height: 70vh;
  min-height: 600px;
  border: 0;
  background: #fff;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 19px max(28px, calc((100vw - 1220px) / 2));
  border-top: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 920px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
    padding: 16px 24px;
  }

  .subject-nav {
    justify-content: flex-start;
  }

  .app-shell {
    width: min(100% - 40px, 760px);
    padding-top: 28px;
  }

  .subject-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace {
    grid-template-columns: 245px minmax(0, 1fr);
    gap: 16px;
  }
}

@media (max-width: 640px) {
  .site-header {
    gap: 13px;
    padding: 14px 16px;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
  }

  .brand-copy strong {
    font-size: 15px;
  }

  .subject-nav {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }

  .subject-btn {
    min-height: 38px;
    padding: 7px 5px;
    font-size: 11px;
  }

  .app-shell {
    width: calc(100% - 28px);
    padding: 19px 0 34px;
  }

  .welcome-panel {
    min-height: 0;
    padding: 25px 20px;
    border-radius: 17px;
  }

  .welcome-panel h1 {
    font-size: clamp(25px, 7vw, 34px);
  }

  .welcome-description {
    max-width: 100%;
    font-size: 13px;
  }

  .welcome-art {
    display: none;
  }

  .welcome-meta {
    gap: 11px;
    font-size: 12px;
  }

  .subject-section {
    margin-top: 28px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .section-heading h2 {
    font-size: 21px;
  }

  .subject-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .subject-card {
    min-height: 84px;
    gap: 12px;
    padding: 14px;
  }

  .subject-icon {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
    border-radius: 12px;
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr);
    gap: 13px;
  }

  .sidebar-panel {
    position: static;
  }

  .sidebar-heading {
    padding: 15px 15px 8px;
  }

  .topic-search {
    margin: 4px 12px 10px;
  }

  .topic-list {
    max-height: none;
    padding-bottom: 8px;
  }

  .content-panel {
    min-height: 300px;
    padding: 13px;
  }

  .content-empty {
    min-height: 270px;
    padding: 16px;
  }

  .content-empty h2 {
    font-size: 20px;
  }

  .topic-frame {
    height: 70vh;
    min-height: 500px;
  }

  .site-footer {
    flex-direction: column;
    gap: 5px;
    padding: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
