@import url('https://fonts.googleapis.com/css2?family=Dosis:wght@400;500;600;700;800&family=Merriweather:ital,wght@0,300;0,400;0,700;1,300&display=swap');

:root {
  color-scheme: light;
  --ink: #1e1b4b;
  --muted: #64748b;
  --line: #e2e8f0;
  --surface: #ffffff;
  --soft: #F7F6F2;
  --brand: #C026D3;
  --brand-ink: #701a75;
  --accent: #d95f24;
  --answer: #0f6b3d;
  --shadow: 0 4px 20px rgba(192, 38, 211, 0.05);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--soft);
  color: var(--ink);
  font-family: 'Dosis', Inter, sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
}

.shell {
  min-height: 100vh;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar-inner,
.main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--brand);
  color: white;
  font-weight: 900;
}

.nav {
  display: flex;
  gap: 14px;
  color: var(--muted);
  font-size: 14px;
}

.main {
  padding: 34px 0 54px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 28px;
  align-items: stretch;
  margin-bottom: 26px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.intro,
.panel,
.question-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.intro {
  padding: 34px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(34px, 5vw, 64px);
  line-height: 0.95;
  letter-spacing: 0;
}

.lead {
  max-width: 700px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 18px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 30px;
}

.stat {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.stat strong {
  display: block;
  font-size: 26px;
}

.stat span {
  color: var(--muted);
  font-size: 13px;
}

.panel {
  padding: 24px;
}

.panel h2,
.section-heading h2,
.about-band h2,
.results-head h2 {
  margin: 0;
  font-size: 20px;
}

.subject-band,
.about-band {
  margin: 26px 0;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

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

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

.subject-tile {
  display: grid;
  gap: 8px;
  min-height: 118px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  text-decoration: none;
}

.subject-tile:hover {
  border-color: rgba(17, 122, 111, 0.55);
}

.subject-tile strong {
  font-size: 18px;
}

.subject-tile span {
  color: var(--muted);
  font-weight: 700;
}

.subject-tile.accent {
  background: #fff5ed;
  border-color: #f2c6a8;
}

.filter-grid {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: white;
  color: var(--ink);
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 10px 16px;
  background: var(--brand);
  color: white;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.button.secondary,
button.secondary {
  background: #e8f2f0;
  color: var(--brand-ink);
}

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

.results-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 0;
}

.results-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.question-card {
  padding: 22px;
}

.question-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.question {
  margin: 0 0 16px;
  font-size: 20px;
  font-weight: 700;
  font-family: 'Merriweather', Georgia, serif;
}

.options {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.options li {
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: start;
  gap: 10px;
  min-height: 40px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}

.options li:hover,
.options li.is-selected {
  border-color: rgba(17, 122, 111, 0.55);
  background: #f3fbf9;
}

.options li.is-correct {
  border-color: rgba(15, 107, 61, 0.55);
  background: #e9f7ef;
}

.options li.is-wrong {
  border-color: rgba(217, 95, 36, 0.55);
  background: #fff0ea;
}

.option-key {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: #e8edf4;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.answer {
  display: none;
  margin-top: 14px;
  padding: 14px;
  border-radius: 8px;
  background: #e9f7ef;
  color: var(--answer);
  font-weight: 800;
}

.is-answer-visible .answer {
  display: block;
}

.question-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 8px;
}

.empty {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: white;
  color: var(--muted);
}

footer {
  margin-top: 36px;
  color: var(--muted);
  font-size: 13px;
}

.about-band {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 24px;
  align-items: start;
}

.about-band p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.device-check {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 54px;
}

.device-hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.device-hero h1 {
  font-size: 44px;
}

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

.device-card,
.device-detail {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.device-card {
  display: grid;
  gap: 8px;
  min-height: 118px;
  padding: 18px;
}

.device-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.device-card strong {
  align-self: end;
  overflow-wrap: anywhere;
  font-size: 24px;
}

.device-detail {
  margin-top: 18px;
  padding: 22px;
}

.device-detail h2 {
  margin: 0 0 10px;
  font-size: 20px;
}

.device-detail p {
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

@media (max-width: 820px) {
  .topbar-inner,
  .results-head,
  .hero {
    display: block;
  }

  .nav {
    margin-top: 12px;
  }

  .intro,
  .panel {
    padding: 22px;
  }

  .panel {
    margin-top: 18px;
  }

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

  .subject-grid,
  .device-grid,
  .about-band {
    grid-template-columns: 1fr;
  }

  .device-hero {
    display: block;
  }

  .device-hero .button {
    margin-top: 18px;
    width: 100%;
  }

  .pager {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Book Navigation */
.book-navigation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 24px 0;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.book-navigation a {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  font-weight: 700;
}

.book-navigation .nav-prev,
.book-navigation .nav-next {
  max-width: 42%;
}

.book-navigation .nav-next {
  align-self: flex-end;
  align-items: flex-end;
  text-align: right;
}

.book-navigation .nav-label {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--brand);
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.book-navigation .nav-title {
  font-size: 14px;
  color: var(--ink);
  font-weight: 600;
}

.book-navigation .nav-up {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid var(--line);
  padding: 8px 16px;
  border-radius: 6px;
  background: var(--soft);
}

.book-navigation .nav-up:hover {
  background: var(--line);
  color: var(--ink);
}

.book-navigation .disabled {
  visibility: hidden;
  width: 42%;
}

/* Related Block */
.related-block {
  margin: 32px 0 24px;
}

.related-block h3 {
  font-size: 20px;
  margin: 0 0 16px;
  font-weight: 800;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.related-tile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: border-color 150ms ease, transform 150ms ease;
}

.related-tile:hover {
  border-color: rgba(17, 122, 111, 0.55);
  transform: translateY(-2px);
}

.rel-meta {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.rel-title {
  font-size: 15px;
  color: var(--ink);
  font-weight: 600;
  line-height: 1.4;
}

@media (max-width: 600px) {
  .book-navigation {
    flex-direction: column;
    text-align: center;
  }
  .book-navigation .nav-prev,
  .book-navigation .nav-next,
  .book-navigation .disabled {
    width: 100%;
    max-width: 100%;
  }
  .book-navigation .nav-next {
    align-items: center;
    text-align: center;
  }
}

/* Daily Quiz */
.daily-quiz-band {
  margin: 26px 0;
  padding: 28px;
  background: linear-gradient(135deg, #fdf8f5 0%, #ffffff 100%);
  border: 1px solid #f2c6a8;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.daily-quiz-band .section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
}

.daily-quiz-band .heading-left {
  display: flex;
  flex-direction: column;
}

.daily-quiz-band .badge {
  align-self: flex-start;
  display: inline-block;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 800;
  color: #d95f24;
  background: #fff0ea;
  border-radius: 4px;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.daily-quiz-band .quiz-date {
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: 6px;
}

.quiz-container {
  display: grid;
  gap: 20px;
  margin-top: 20px;
}

.quiz-card {
  border-left: 4px solid var(--accent);
}

.pill.accent {
  background: #fff0ea;
  color: #d95f24;
  border-color: #f2c6a8;
}

/* Dashboard & Custom Exam UI */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 28px;
  margin-top: 24px;
}

@media (max-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.db-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.db-card h3 {
  margin: 0 0 16px;
  font-size: 20px;
  font-weight: 800;
  border-bottom: 2px solid var(--soft);
  padding-bottom: 8px;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
}

.leaderboard-table th, 
.leaderboard-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.leaderboard-table th {
  font-weight: 700;
  color: var(--muted);
}

.leaderboard-table tr:hover {
  background: var(--soft);
}

.badge-rank {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--soft);
  font-weight: 800;
  font-size: 12px;
}

.badge-rank.rank-1 { background: #fef08a; color: #854d0e; }
.badge-rank.rank-2 { background: #e2e8f0; color: #475569; }
.badge-rank.rank-3 { background: #ffedd5; color: #c2410c; }

.weakness-list {
  display: grid;
  gap: 12px;
}

.weakness-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border-radius: 6px;
  background: var(--soft);
}

.weakness-score {
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 4px;
}

.weakness-score.poor {
  background: #fee2e2;
  color: #b91c1c;
}

.weakness-score.good {
  background: #dcfce7;
  color: #15803d;
}

.explanation-restricted {
  background: #fdf4ff;
  border: 1px dashed var(--brand);
  border-radius: 8px;
  padding: 18px;
  margin-top: 14px;
  text-align: center;
}

.explanation-restricted p {
  margin: 0 0 12px;
  font-weight: 600;
  color: var(--brand-ink);
}

.explanation-box {
  background: #f5f3ff;
  border-left: 4px solid var(--brand);
  border-radius: 0 8px 8px 0;
  padding: 16px;
  margin-top: 14px;
  font-family: 'Merriweather', serif;
  font-size: 15px;
}

.exam-timer-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--brand);
  color: white;
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  margin-bottom: 24px;
}

.timer-countdown {
  font-size: 20px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.exam-submit-btn {
  background: var(--ink);
  color: white;
}

.subject-tile strong {
  color: var(--ink);
}

.subject-tile:hover strong {
  color: var(--brand);
}

.subject-tile span {
  font-size: 13px;
  font-weight: 500;
}

