:root {
  color-scheme: light;
  --ink: #17201b;
  --muted: #5e6962;
  --soft: #eef2ee;
  --line: #d9e0d9;
  --paper: #fbfaf6;
  --panel: #ffffff;
  --accent: #1d6f5b;
  --accent-strong: #124a3d;
  --gold: #b9822b;
  --shadow: 0 18px 60px rgba(23, 32, 27, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(135deg, rgba(29, 111, 91, 0.14), transparent 36%),
    linear-gradient(315deg, rgba(185, 130, 43, 0.16), transparent 32%),
    var(--paper);
  color: var(--ink);
}

button {
  border: 0;
  font: inherit;
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 34px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  align-items: stretch;
}

.study-panel,
.side-panel {
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(217, 224, 217, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.study-panel {
  min-height: calc(100vh - 68px);
  padding: 34px;
  display: flex;
  flex-direction: column;
  border-radius: 8px;
}

.side-panel {
  border-radius: 8px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2.4rem, 7vw, 5.8rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.cycle-badge {
  min-width: 94px;
  height: 94px;
  border: 1px solid var(--line);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--accent-strong);
  font-weight: 900;
  background: var(--soft);
}

.cycle-badge span:first-child {
  font-size: 2rem;
}

.progress-wrap {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #e4e9e4;
  margin: 28px 0;
}

.progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  transition: width 220ms ease;
}

.topic-card {
  flex: 1;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 30px 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.empty-state {
  max-width: 680px;
}

.topic-number {
  color: var(--gold);
  font-weight: 800;
  margin-bottom: 12px;
}

.topic-card h2 {
  margin-bottom: 18px;
  max-width: 820px;
  font-size: clamp(2rem, 4vw, 4.2rem);
  line-height: 1;
  letter-spacing: 0;
}

.topic-card p {
  max-width: 760px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.65;
}

.study-block {
  display: grid;
  gap: 22px;
}

.study-block h3 {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

.source-details {
  max-width: 820px;
}

.source-details summary {
  color: var(--accent);
  font-weight: 800;
  cursor: pointer;
}

.source-details p {
  margin-top: 12px;
  font-size: 0.98rem;
}

.actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
}

.primary-action,
.secondary-action,
#toggle-list {
  min-height: 48px;
  border-radius: 8px;
  padding: 0 20px;
  font-weight: 850;
}

.primary-action {
  background: var(--accent);
  color: white;
}

.secondary-action,
#toggle-list {
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--accent-strong);
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.stats-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--soft);
}

.stats-grid span {
  display: block;
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--accent-strong);
}

.stats-grid p {
  margin: 2px 0 0;
  color: var(--muted);
  font-weight: 700;
}

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

.section-heading h2,
.all-topics h2 {
  margin: 0;
  font-size: 1.05rem;
}

.history-list {
  margin: 14px 0 0;
  padding-left: 24px;
  max-height: 360px;
  overflow: auto;
}

.history-list li {
  padding: 7px 0;
  color: var(--muted);
  line-height: 1.35;
}

.history-list strong {
  color: var(--ink);
}

.remaining-list {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
}

.remaining-list span {
  width: 38px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--soft);
  color: var(--accent-strong);
  font-weight: 800;
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100% - 22px, 680px);
    grid-template-columns: 1fr;
    padding: 12px 0;
  }

  .study-panel {
    min-height: auto;
    padding: 22px;
  }

  .brand-row {
    align-items: center;
  }

  .cycle-badge {
    min-width: 74px;
    height: 74px;
  }

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

@media (max-width: 520px) {
  .actions {
    flex-direction: column;
  }

  .primary-action,
  .secondary-action {
    width: 100%;
  }
}
