:root {
  --bg: #eef3f6;
  --panel: #ffffff;
  --panel-soft: #edf5f6;
  --text: #172033;
  --muted: #64748b;
  --line: #d2dde7;
  --brand: #0f766e;
  --brand-dark: #0b5258;
  --accent: #d95f3f;
  --ok: #16734a;
  --bad: #b42318;
  --warn: #9a6700;
  --shadow: 0 14px 35px rgba(15, 23, 42, 0.1), 0 2px 8px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.13), transparent 34rem),
    linear-gradient(135deg, #f7fafc 0%, var(--bg) 46%, #f7f4ed 100%);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.boot {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.boot__mark,
.brand__mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: 0;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: rgba(251, 252, 254, 0.92);
  backdrop-filter: blur(14px);
  overflow: auto;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.search {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.search:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.side-section {
  margin-top: 18px;
}

.side-section__title {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.provider-list {
  display: grid;
  gap: 4px;
}

.provider-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.provider-button__name {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}

.provider-icon {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: #e2edf0;
  color: var(--brand-dark);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
}

.provider-logo {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid #d8e3ec;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.provider-logo svg {
  width: 22px;
  height: 22px;
  display: block;
}

.provider-icon--all {
  background: #172033;
  color: #fff;
}

.provider-button mark {
  padding: 0 2px;
  border-radius: 4px;
  background: #fff0a8;
  color: inherit;
}

.provider-button:hover,
.provider-button.is-active {
  border-color: #bcd5d8;
  background: #e8f3f3;
  transform: translateX(2px);
}

.provider-count {
  min-width: 30px;
  min-height: 22px;
  display: inline-grid;
  place-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3150a3;
  font-size: 12px;
  font-weight: 800;
}

.main {
  min-width: 0;
}

.sidebar-toggle {
  display: none;
}

.sidebar-scrim {
  display: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 249, 251, 0.88);
  backdrop-filter: blur(12px);
}

.topbar__title {
  margin: 0;
  font-size: 18px;
}

.topbar__meta {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.button,
.icon-button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.button:hover,
.icon-button:hover {
  border-color: #9eb6c3;
  background: #f7fafc;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.button--primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.button--primary:hover {
  border-color: var(--brand-dark);
  background: var(--brand-dark);
}

.content {
  padding: 22px;
}

.practice-strip {
  position: sticky;
  top: 64px;
  z-index: 4;
  min-height: 42px;
  border-bottom: 1px solid #c8dbe0;
  background: #eef7f5;
  overflow: hidden;
}

.practice-strip__bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--practice-progress);
  background: linear-gradient(90deg, rgba(15, 118, 110, 0.2), rgba(15, 118, 110, 0.34));
  transition: width 220ms ease;
}

.practice-strip__content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 42px;
  padding: 8px 22px;
  color: #18303b;
  font-size: 13px;
  white-space: nowrap;
  overflow-x: auto;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat {
  min-height: 76px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.stat__value {
  font-size: 23px;
  font-weight: 800;
}

.stat__label {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.exam-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}

.exam-card {
  display: grid;
  gap: 10px;
  min-height: 160px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background 180ms ease;
}

.exam-card:hover {
  border-color: #86b9bb;
  background: linear-gradient(180deg, #f0fbfa 0%, #ffffff 70%);
  box-shadow: var(--shadow);
  transform: translateY(-3px);
}

.exam-card__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.exam-card h2 {
  margin: 0;
  font-size: 18px;
  overflow-wrap: anywhere;
  line-height: 1.28;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  max-width: 100%;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #e8f3f3;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pill--warn {
  background: #fff4d6;
  color: var(--warn);
}

.exam-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.exam-card__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-self: end;
}

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

.question-card,
.side-panel,
.report-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.question-card {
  padding: 20px;
}

.question-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.question-head h2 {
  margin: 0;
  font-size: 20px;
}

.question-text {
  white-space: pre-wrap;
  line-height: 1.62;
}

.media-list {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.media-list img {
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.choices {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.choice {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  width: 100%;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.choice:hover {
  border-color: #94aabd;
  transform: translateX(2px);
}

.choice.is-selected {
  border-color: var(--brand);
  background: #ecf7f6;
}

.choice.is-correct {
  border-color: #7cb99c;
  background: #edf8f2;
}

.choice.is-wrong {
  border-color: #e3a39c;
  background: #fff0ee;
}

.choice__key {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #e2e8f0;
  font-weight: 800;
}

.answer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.answer-panel {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid #cfdbe6;
  border-radius: 8px;
  background: #f8fbfd;
}

.answer-panel--structured {
  display: grid;
  gap: 12px;
  padding: 0;
  border: 0;
  background: transparent;
}

.answer-section {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.answer-section--correct {
  border-color: #9dceb5;
  background: linear-gradient(180deg, #f0faf4 0%, #ffffff 100%);
}

.answer-section--explanation {
  border-color: #d6c7ac;
  background: linear-gradient(180deg, #fffaf0 0%, #ffffff 100%);
}

.answer-section__eyebrow {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.answer-panel h3,
.discussion h3,
.side-panel h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.answer-line {
  margin: 0 0 8px;
}

.explanation {
  white-space: pre-wrap;
  line-height: 1.58;
}

.discussion {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.comment {
  margin: 0 0 10px;
  padding: 10px;
  border-left: 3px solid #cbd8e1;
  background: #f8fafc;
}

.discussion-card {
  border: 1px solid #d9e3ec;
  border-left: 3px solid #8eb4c2;
  border-radius: 8px;
  background: #fbfdff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.comment__meta {
  color: var(--muted);
  font-size: 12px;
}

.comment__content {
  margin-top: 5px;
  white-space: pre-wrap;
  line-height: 1.5;
}

.side-panel {
  position: sticky;
  top: 86px;
  max-height: calc(100vh - 108px);
  padding: 14px;
  overflow: auto;
}

.side-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.side-panel__head h3 {
  margin: 0;
}

.order-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 10px 0 12px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.order-toggle button {
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.order-toggle button.is-active {
  background: #fff;
  color: var(--brand-dark);
  font-weight: 800;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.button--small {
  min-height: 28px;
  padding: 0 9px;
  font-size: 12px;
}

.inline-link {
  color: var(--brand-dark);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.question-jump {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: 6px;
}

.jump-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.jump-button.is-active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.jump-button.is-done {
  border-color: #91b8a4;
  background: #ecf8f1;
}

.jump-button.is-wrong {
  border-color: #e3a39c;
  background: #fff0ee;
  color: var(--bad);
  font-weight: 800;
}

.jump-button.is-review {
  border-color: #efb3aa;
  background: #fff1ef;
}

.mode-tabs {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.mode-tabs button {
  min-height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  transition: background 150ms ease, color 150ms ease;
}

.mode-tabs button.is-active {
  background: var(--brand);
  color: #fff;
}

.flash-wrap {
  display: grid;
  gap: 12px;
  max-width: 900px;
  margin: 0 auto;
  perspective: 1400px;
}

.flash-card {
  min-height: 360px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  transform-style: preserve-3d;
}

.flash-card__surface {
  min-height: 360px;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  animation: cardFlipIn 260ms ease both;
}

.flash-card--front .flash-card__surface {
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.14), transparent 42%),
    #ffffff;
  border-color: #b6d8d7;
}

.flash-card--back .flash-card__surface {
  background:
    linear-gradient(135deg, rgba(217, 95, 63, 0.15), transparent 42%),
    #fffaf6;
  border-color: #f0b79f;
}

.flash-card__label {
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.flash-card--back .flash-card__label {
  color: #9a3b27;
}

.flash-card__body {
  margin-top: 14px;
  white-space: pre-wrap;
  line-height: 1.62;
}

.flash-card__answer {
  display: grid;
  gap: 6px;
  margin-top: 18px;
  padding: 14px;
  border-radius: 8px;
  background: #fff4ea;
  border: 1px solid #edc1a7;
}

.flash-card__answer span {
  color: #9a3b27;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.flash-card__answer strong {
  font-size: 22px;
}

.flash-rating {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  max-width: 620px;
  margin: 12px auto 0;
}

.flash-rating button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
}

.flash-rating button:hover,
.flash-rating button.is-active {
  border-color: var(--brand);
  background: #eaf7f5;
  color: var(--brand-dark);
}

@keyframes cardFlipIn {
  from {
    opacity: 0.55;
    transform: rotateY(-12deg) translateY(4px);
  }
  to {
    opacity: 1;
    transform: rotateY(0deg) translateY(0);
  }
}

.report-panel {
  padding: 16px;
  white-space: pre-wrap;
  overflow: auto;
}

.empty {
  padding: 38px;
  border: 1px dashed #bac7d3;
  border-radius: 8px;
  background: #fff;
  text-align: center;
}

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

.link {
  color: var(--brand-dark);
}

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

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 20;
    width: min(86vw, 320px);
    height: 100vh;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    transform: translateX(-105%);
    transition: transform 200ms ease;
  }

  .shell.is-sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-toggle {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
  }

  .sidebar-scrim {
    position: fixed;
    inset: 0;
    z-index: 15;
    display: block;
    border: 0;
    background: rgba(15, 23, 42, 0.34);
  }

  .exam-layout {
    grid-template-columns: 1fr;
  }

  .side-panel {
    position: static;
    max-height: none;
  }

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

@media (max-width: 760px) {
  .practice-strip__content {
    padding: 8px 14px;
    gap: 12px;
  }

  .question-card {
    padding: 15px;
  }

  .question-head {
    display: grid;
  }

  .flash-card__surface {
    min-height: min(62vh, 520px);
    padding: 22px;
  }

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

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    flex-direction: row;
  }

  .toolbar {
    justify-content: flex-start;
  }

  .content {
    padding: 14px;
  }

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

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

  .mode-tabs {
    width: 100%;
  }

  .mode-tabs button {
    flex: 1;
  }
}
