:root {
  color-scheme: light;
  --ink: #1d2433;
  --muted: #657087;
  --line: #d9dee8;
  --panel: #ffffff;
  --canvas: #f3f5f8;
  --accent: #16605c;
  --accent-2: #9b2f3f;
  --gold: #bd8d2f;
  --green-soft: #e2f0eb;
  --red-soft: #f7e4e7;
  --shadow: 0 14px 40px rgba(29, 36, 51, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(22, 96, 92, 0.06) 1px, transparent 1px),
    linear-gradient(180deg, rgba(155, 47, 63, 0.05) 1px, transparent 1px),
    var(--canvas);
  background-size: 32px 32px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 28px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar h1,
.hero h2,
.panel h3,
.module h3 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: 28px;
  line-height: 1.1;
}

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

.exam-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

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

select,
input {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
}

.layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 300px;
  gap: 18px;
  padding: 18px;
}

.sidebar,
.rightbar {
  display: grid;
  align-content: start;
  gap: 14px;
  position: sticky;
  top: 96px;
  max-height: calc(100vh - 112px);
  overflow: auto;
}

.panel,
.module,
.practice,
.hero {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 16px;
}

.panel.tight {
  padding: 12px;
}

.search-row input {
  width: 100%;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.filters button,
.toolbar button,
.choice {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 9px 11px;
  font-weight: 700;
}

.filters button.active,
.toolbar button:hover,
.choice:hover,
.choice.selected {
  border-color: var(--accent);
  background: var(--green-soft);
}

.chapter-list {
  display: grid;
  gap: 10px;
}

.chapter-card {
  display: grid;
  gap: 7px;
  width: 100%;
  padding: 14px;
  text-align: left;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.chapter-card.active {
  border-color: var(--accent);
  box-shadow: inset 4px 0 0 var(--accent);
}

.chapter-card .topic {
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 800;
}

.chapter-card small {
  color: var(--muted);
  line-height: 1.35;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badges span {
  border-radius: 999px;
  background: #eef1f5;
  color: #394255;
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 800;
}

.content {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  min-height: 178px;
  padding: 26px;
  background:
    linear-gradient(135deg, rgba(22, 96, 92, 0.12), rgba(189, 141, 47, 0.12)),
    #fff;
}

.hero h2 {
  font-size: 34px;
  line-height: 1.12;
  margin-bottom: 12px;
}

.hero p:last-child {
  max-width: 760px;
  margin: 0;
  color: #465064;
  font-size: 16px;
  line-height: 1.55;
}

.countdown-card {
  display: grid;
  place-items: center;
  width: 132px;
  aspect-ratio: 1;
  border-radius: 8px;
  background: var(--ink);
  color: white;
}

.countdown-card span {
  font-size: 42px;
  font-weight: 900;
  line-height: 1;
}

.countdown-card small {
  color: #dbe2ef;
  font-weight: 800;
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.study-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.module,
.practice {
  padding: 18px;
}

.module-head,
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.module-head span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
}

.clean-list,
.weak-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.clean-list li {
  padding: 10px 0;
  border-top: 1px solid var(--line);
  line-height: 1.45;
}

.warning li::before {
  content: "!";
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--red-soft);
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 900;
}

.prose p {
  margin: 0 0 12px;
  color: #3f4859;
  line-height: 1.65;
}

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

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

.calc-card h4 {
  margin: 0 0 8px;
}

code {
  display: block;
  white-space: normal;
  padding: 10px;
  border-radius: 6px;
  background: #eef1f5;
  color: #243043;
}

.calc-card ol {
  margin: 10px 0 0;
  padding-left: 20px;
  color: #465064;
}

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

.section-title h3,
.section-title span {
  margin: 0;
}

.section-title span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.question {
  margin-top: 0;
  font-size: 18px;
  line-height: 1.5;
}

.choices {
  display: grid;
  gap: 8px;
}

.choice {
  text-align: left;
}

.answer {
  margin-top: 12px;
  padding: 14px;
  border-left: 4px solid var(--accent);
  background: var(--green-soft);
  border-radius: 6px;
}

.progress-panel {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 14px;
  align-items: center;
}

.ring {
  display: grid;
  place-items: center;
  width: 88px;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #fff 0 58%, transparent 59%),
    conic-gradient(var(--accent) var(--progress, 0deg), #e7ebf1 0);
  color: var(--ink);
  font-weight: 900;
  font-size: 20px;
}

.phase-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding-left: 18px;
}

.phase-list li,
.daily-list li {
  line-height: 1.45;
}

.phase-list strong,
.daily-list strong {
  display: block;
  color: var(--accent);
}

.phase-list span,
.daily-list span,
.small,
.empty {
  color: var(--muted);
  line-height: 1.5;
}

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

.stats-list {
  display: grid;
  gap: 12px;
  margin: 0;
}

.stats-list div {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 10px;
  align-items: baseline;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.stats-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.stats-list dd {
  margin: 0;
  font-weight: 800;
}

.weak-list {
  display: grid;
  gap: 8px;
}

.weak-list button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--red-soft);
  color: var(--ink);
  padding: 10px;
  text-align: left;
  font-weight: 800;
}

.timeline {
  display: grid;
  gap: 14px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.timeline-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.timeline-nav button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 8px 11px;
  font-weight: 700;
}

.timeline-nav button:hover {
  border-color: var(--accent);
  background: var(--green-soft);
}

.timeline-nav span {
  color: var(--muted);
  font-weight: 800;
  font-size: 13px;
}

.timeline-days {
  display: grid;
  gap: 10px;
}

.day-card {
  display: grid;
  grid-template-columns: 96px 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.day-card.today {
  border-color: var(--accent);
  box-shadow: inset 4px 0 0 var(--accent);
  background: var(--green-soft);
}

.day-card.rest {
  opacity: 0.7;
}

.day-card.exam {
  border-color: var(--accent-2);
  background: var(--red-soft);
}

.day-card.past:not(.day-done) {
  opacity: 0.55;
}

.day-date {
  display: grid;
  gap: 2px;
}

.day-date strong {
  font-size: 14px;
}

.day-date span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.day-tasks {
  display: grid;
  gap: 6px;
}

.day-task {
  border: none;
  background: none;
  padding: 0;
  text-align: left;
  color: var(--ink);
  line-height: 1.45;
  font-weight: 600;
}

.day-task.clickable {
  cursor: pointer;
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: transparent;
}

.day-task.clickable:hover {
  text-decoration-color: var(--accent);
}

.day-phase {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.day-done-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  white-space: nowrap;
}

@media (max-width: 1180px) {
  .layout {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .rightbar {
    grid-column: 1 / -1;
    position: static;
    max-height: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  .topbar,
  .hero {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .topbar {
    position: static;
  }

  .layout,
  .study-grid,
  .rightbar {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .rightbar {
    position: static;
    max-height: none;
  }

  .hero h2 {
    font-size: 26px;
  }

  .countdown-card {
    width: 100%;
    aspect-ratio: auto;
    min-height: 92px;
  }

  .day-card {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}
