:root {
  --bg: #07111f;
  --bg-soft: #0d172b;
  --bg-accent: rgba(96, 165, 250, 0.18);
  --surface: rgba(10, 19, 37, 0.82);
  --surface-strong: rgba(15, 23, 42, 0.94);
  --surface-soft: rgba(19, 31, 56, 0.78);
  --border: rgba(148, 163, 184, 0.18);
  --border-strong: rgba(148, 163, 184, 0.28);
  --text: #e8eefc;
  --muted: #9fb0ce;
  --primary: #6d5efc;
  --primary-strong: #5647ef;
  --primary-soft: rgba(109, 94, 252, 0.16);
  --secondary: #22c55e;
  --secondary-soft: rgba(34, 197, 94, 0.14);
  --warning-soft: rgba(251, 191, 36, 0.16);
  --danger-soft: rgba(248, 113, 113, 0.16);
  --shadow: 0 24px 60px rgba(2, 6, 23, 0.45);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Atkinson Hyperlegible Next", Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(109, 94, 252, 0.28), transparent 34%),
    radial-gradient(circle at top right, rgba(56, 189, 248, 0.16), transparent 30%),
    linear-gradient(160deg, #0b1120 0%, #101a31 42%, #07111f 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(rgba(255, 255, 255, 0.03), transparent 30%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.35), transparent 72%);
}

.page-shell {
  position: relative;
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 20px 56px;
}

.topbar,
.card,
.hero-copy,
.hero-panel,
.deck-card,
.study-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--surface);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 20px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark__copy {
  min-width: 0;
}

.brand-mark strong,
.brand-mark small {
  display: block;
}

.brand-mark strong {
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.brand-mark small {
  margin-top: 3px;
  color: var(--muted);
}

.brand-mark__media,
.hero-brand__media,
.hero-panel__brand {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: radial-gradient(circle at top, rgba(255, 255, 255, 0.2), rgba(8, 15, 30, 0.94) 60%);
}

.brand-mark__media {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  border-radius: 18px;
  border: 1px solid rgba(191, 219, 254, 0.26);
  box-shadow: 0 18px 36px rgba(76, 112, 255, 0.22);
}

.brand-mark__image,
.hero-brand__image,
.hero-panel__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.topbar-nav a {
  padding: 8px 10px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  border-radius: 10px;
  transition: background 0.18s ease, color 0.18s ease;
}

.topbar-nav a:hover {
  color: var(--text);
  background: rgba(148, 163, 184, 0.08);
}

.topbar-nav form {
  margin: 0;
}

.page-content {
  padding-top: 28px;
}

.site-footer {
  padding: 22px 0 8px;
  text-align: center;
  color: var(--muted);
}

.site-footer small {
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.site-footer--review {
  padding-top: 8px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.9fr);
  gap: 28px;
  align-items: stretch;
}

.hero-copy,
.hero-panel,
.card {
  isolation: isolate;
}

.hero-copy {
  padding: 52px;
}

.hero-brand {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
}

.hero-brand__media {
  width: clamp(96px, 14vw, 136px);
  aspect-ratio: 1;
  flex: 0 0 auto;
  border-radius: 30px;
  border: 1px solid rgba(191, 219, 254, 0.2);
  box-shadow: 0 28px 50px rgba(15, 23, 42, 0.36);
}

.hero-brand__copy {
  display: grid;
  gap: 8px;
}

.hero-brand__copy .eyebrow {
  margin-bottom: 0;
}

.hero-brand__caption {
  margin: 0;
  max-width: 34ch;
  color: #d4def4;
  line-height: 1.6;
}

.hero-copy::after,
.dashboard-hero::after,
.section-heading-card::after {
  content: "";
  position: absolute;
  inset: auto -40px -40px auto;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.16), transparent 64%);
  z-index: -1;
}

.eyebrow,
.panel-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #c7bfff;
}

.hero h1,
.section-title {
  margin: 0;
  letter-spacing: -0.04em;
}

.hero h1 {
  max-width: 11ch;
  font-size: clamp(2.8rem, 5vw, 4.6rem);
  line-height: 0.98;
}

.hero h1 span,
.section-title span {
  color: #bfdbfe;
}

.section-title {
  font-size: clamp(2rem, 3vw, 2.8rem);
  line-height: 1.05;
}

.section-subtitle {
  margin: 0;
  font-size: clamp(1.3rem, 2vw, 1.7rem);
  letter-spacing: -0.03em;
}

.section-copy,
.hero-text {
  max-width: 62ch;
  margin: 18px 0 0;
  line-height: 1.8;
  color: var(--muted);
}

.hero-text {
  font-size: 1.08rem;
  margin-top: 22px;
}

.hero-actions,
.review-rating-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.hero-actions {
  margin-top: 30px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 12px 18px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: white;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease, border-color 0.18s ease;
  box-shadow: 0 18px 35px rgba(86, 71, 239, 0.3);
}

.button:hover {
  transform: translateY(-1px);
}

.button-secondary {
  background: rgba(148, 163, 184, 0.1);
  color: var(--text);
  border-color: rgba(148, 163, 184, 0.14);
  box-shadow: none;
}

.button-danger {
  border-color: rgba(248, 113, 113, 0.22);
  background: rgba(127, 29, 29, 0.26);
  color: #ffe2e2;
}

.button-small {
  min-height: 40px;
  padding: 10px 14px;
  font-size: 0.94rem;
}

.hero-stats,
.dashboard-grid,
.highlights,
.deck-grid,
.study-card-grid {
  display: grid;
  gap: 18px;
}

.hero-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 34px;
}

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

.dashboard-grid--triple {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.deck-grid,
.study-card-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.bulk-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.bulk-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.bulk-actions__controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.bulk-actions__toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.bulk-actions__count {
  font-size: 0.95rem;
  color: var(--muted);
}

.study-card__select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 12px;
}

.hero-stats article,
.info-card,
.metric-pill,
.study-card,
.deck-card {
  padding: 20px;
  background: var(--surface-soft);
}

.hero-stats strong,
.info-card h3,
.metric-pill strong,
.deck-card h3,
.study-card__label {
  display: block;
}

.hero-stats strong,
.deck-card h3,
.deck-card__title {
  margin-bottom: 8px;
  font-size: 1rem;
}

.hero-stats span,
.muted,
.deck-card p,
.study-card p {
  color: var(--muted);
}

.hero-panel {
  padding: 30px;
  background: linear-gradient(180deg, rgba(16, 26, 49, 0.96), rgba(9, 18, 36, 0.92));
}

.hero-panel__brand {
  width: min(100%, 220px);
  aspect-ratio: 1;
  margin-bottom: 22px;
  border-radius: 28px;
  border: 1px solid rgba(191, 219, 254, 0.22);
  background:
    radial-gradient(circle at top, rgba(109, 94, 252, 0.2), transparent 48%),
    rgba(6, 12, 26, 0.96);
}

.hero-panel--accent {
  border-color: rgba(109, 94, 252, 0.26);
}

.hero-panel__glow {
  position: absolute;
  inset: auto -60px -80px auto;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.28), transparent 60%);
}

.hero-panel h2 {
  margin: 0 0 18px;
  font-size: 1.9rem;
  line-height: 1.2;
}

.feature-list {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.8;
}

.feature-list--tight {
  line-height: 1.65;
}

.panel-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.panel-strip span,
.metric-pill,
.deck-card__meta {
  border-radius: 999px;
  font-size: 0.92rem;
}

.panel-strip span {
  padding: 8px 12px;
  background: rgba(109, 94, 252, 0.16);
  color: #ddd6fe;
}

.card {
  padding: 26px;
}

.stack-lg,
.stack-md {
  display: grid;
}

.stack-lg {
  gap: 24px;
}

.stack-md {
  gap: 16px;
}

.dashboard-hero,
.section-heading,
.section-heading-card,
.dashboard-hero__meta {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.dashboard-hero,
.section-heading-card {
  align-items: center;
}

.dashboard-hero__meta {
  align-items: center;
  flex-wrap: wrap;
}

.metric-pill {
  padding: 14px 18px;
  min-width: 110px;
  text-align: center;
  border: 1px solid rgba(109, 94, 252, 0.16);
  background: rgba(109, 94, 252, 0.12);
}

.metric-pill strong {
  font-size: 1.45rem;
  margin-bottom: 4px;
}

.metric-pill span,
.deck-card__meta {
  color: #d7def1;
}

.dashboard-decks__heading,
.dashboard-actions,
.deck-card__actions,
.deck-section-nav,
.deck-card__stats,
.modal__surface {
  display: grid;
}

.dashboard-decks__heading {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.dashboard-actions {
  gap: 12px;
  justify-items: end;
}

.form-card {
  border-color: rgba(109, 94, 252, 0.18);
}

.dashboard-note {
  background: linear-gradient(180deg, rgba(14, 27, 47, 0.92), rgba(10, 19, 37, 0.88));
}

.deck-card,
.study-card {
  display: grid;
  gap: 14px;
  text-decoration: none;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.deck-card__eyebrow,
.deck-highlight,
.csv-highlight,
.deck-name-highlight,
.light-strong-copy {
  color: #e6efff;
  font-weight: 700;
}

.deck-card__eyebrow {
  margin: 0 0 8px;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.deck-card__title {
  color: #f4f8ff;
  font-size: 1.16rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.csv-form-card {
  border-color: rgba(191, 219, 254, 0.24);
  background: linear-gradient(180deg, rgba(16, 31, 58, 0.95), rgba(10, 19, 37, 0.9));
}

.deck-card:hover,
.study-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  background: rgba(22, 36, 62, 0.94);
}

.deck-card p,
.study-card p {
  margin: 0;
  line-height: 1.7;
}

.deck-search {
  margin-bottom: 18px;
}

.deck-search input {
  width: 100%;
  max-width: 400px;
}

.deck-grid--dashboard {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.deck-card--dashboard {
  align-content: start;
}

.deck-card--simple {
  grid-template-rows: 1fr auto;
  align-items: stretch;
}

.deck-card--simple .deck-card__content {
  min-width: 0;
}

.deck-card--simple .deck-card__title {
  margin-bottom: 0;
  font-size: 1.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.deck-card__actions--inline {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.button-review {
  border-color: rgba(34, 197, 94, 0.36) !important;
  background: rgba(34, 197, 94, 0.1);
  color: #86efac;
}

.button-review:hover {
  background: rgba(34, 197, 94, 0.18);
  border-color: rgba(34, 197, 94, 0.52) !important;
}

.button-test {
  border-color: rgba(109, 94, 252, 0.36) !important;
  background: rgba(109, 94, 252, 0.1);
  color: #c4b5fd;
}

.button-test:hover {
  background: rgba(109, 94, 252, 0.18);
  border-color: rgba(109, 94, 252, 0.52) !important;
}

.deck-card__content {
  display: grid;
  gap: 10px;
}

.deck-card__stats {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.deck-card__meta {
  display: inline-flex;
  width: 100%;
  padding: 8px 12px;
  background: rgba(148, 163, 184, 0.12);
  line-height: 1.5;
}

.deck-card__actions {
  grid-template-columns: repeat(auto-fit, minmax(110px, max-content));
  gap: 10px;
  align-items: center;
}

.deck-card__actions form {
  margin: 0;
}

.deck-section-nav {
  grid-template-columns: repeat(auto-fit, minmax(140px, max-content));
  gap: 10px;
}

.deck-section-nav__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 14px;
  background: rgba(148, 163, 184, 0.08);
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.deck-section-nav__link:hover,
.deck-section-nav__link.is-active {
  color: var(--text);
  border-color: rgba(109, 94, 252, 0.22);
  background: rgba(109, 94, 252, 0.16);
}

.deck-section-nav__link:hover {
  transform: translateY(-1px);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-row input {
  width: auto;
}

.modal {
  width: min(100%, 680px);
  max-width: calc(100vw - 24px);
  padding: 0;
  border: 0;
  background: transparent;
  display: none;
}

.modal[open] {
  display: grid;
  place-items: center;
}

.modal--open {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: rgba(2, 6, 23, 0.7);
  backdrop-filter: blur(4px);
}

.modal::backdrop {
  background: rgba(2, 6, 23, 0.7);
  backdrop-filter: blur(4px);
}

.modal__surface {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 18px;
  width: min(100%, 680px);
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.study-card {
  min-height: 100%;
}

.study-card__label {
  margin-bottom: -4px;
  color: #d8e2f8;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.review-card {
  max-width: 820px;
}

.review-card__body {
  display: grid;
  gap: 22px;
}

.review-card__text {
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(11, 21, 39, 0.74);
  white-space: pre-wrap;
  line-height: 1.8;
}

.review-card__text--answer {
  background: rgba(34, 197, 94, 0.08);
}

.review-answer {
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.review-answer summary {
  cursor: pointer;
  font-weight: 700;
}

.review-rating-row {
  margin-top: 28px;
}

.review-body {
  color: #1f2937;
  background:
    radial-gradient(circle at top, rgba(120, 113, 108, 0.1), transparent 36%),
    linear-gradient(180deg, #f8f3e8 0%, #f3ede1 48%, #efe7d8 100%);
}

.review-body::before,
.review-body::after {
  display: none;
}

.review-shell {
  max-width: 860px;
  margin: 0 auto;
  padding: 18px 20px 40px;
}

.review-topbar {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.review-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #1f2937;
  text-decoration: none;
}

.review-brand__media {
  width: 50px;
  height: 50px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid rgba(120, 113, 108, 0.16);
  background: rgba(255, 251, 245, 0.94);
  box-shadow: 0 14px 32px rgba(120, 113, 108, 0.08);
}

.review-brand__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.review-brand__copy {
  display: grid;
  gap: 3px;
}

.review-brand__copy strong,
.review-brand__copy small {
  display: block;
}

.review-brand__copy strong {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.review-brand__copy small {
  color: #6b7280;
}

.review-main {
  display: block;
}

.review-area {
  display: grid;
  justify-items: center;
  min-height: calc(100vh - 110px);
  align-items: center;
}

.review-focus-card,
.review-empty-state {
  width: 100%;
  max-width: 720px;
  border-radius: 28px;
  border: 1px solid rgba(120, 113, 108, 0.14);
  background: rgba(255, 251, 245, 0.9);
  backdrop-filter: blur(14px);
  box-shadow: 0 24px 56px rgba(120, 113, 108, 0.1);
}

.review-card__text {
  padding: 26px 28px;
  border-color: rgba(120, 113, 108, 0.1);
  background: #fffdfa;
  color: #111827;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 650;
  line-height: 1.68;
  letter-spacing: -0.01em;
}

.review-card__text--prompt {
  min-height: 220px;
  display: grid;
  align-items: center;
  font-weight: 700;
}

.review-card__text--answer {
  background: #f2efe8;
  color: #0f172a;
}

.review-answer {
  padding: 0;
  background: transparent;
  border: 0;
}

.review-answer summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid rgba(120, 113, 108, 0.16);
  background: rgba(247, 242, 232, 0.94);
  color: #1f2937;
  list-style: none;
}

.review-answer[open] summary {
  margin-bottom: 14px;
}

.review-answer summary::-webkit-details-marker {
  display: none;
}

.review-rating-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.button-rating {
  min-height: 54px;
  width: 100%;
  padding-inline: 14px;
  box-shadow: none;
}

.review-empty-state {
  justify-items: center;
  text-align: center;
}

.review-empty-state__copy {
  margin: 0;
  color: #111827;
  font-size: clamp(1.4rem, 2.6vw, 1.8rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.button-rating--muted {
  background: linear-gradient(135deg, #475569, #334155);
}

.button-rating--warm {
  background: linear-gradient(135deg, #d97706, #b45309);
}

.button-rating--cool {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

.button-rating--bright {
  background: linear-gradient(135deg, #16a34a, #15803d);
}

.status-banner {
  display: grid;
  gap: 6px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(15, 23, 42, 0.84);
}

.status-banner--success {
  border-color: rgba(34, 197, 94, 0.28);
  background: rgba(20, 83, 45, 0.2);
}

.status-banner--error {
  border-color: rgba(248, 113, 113, 0.32);
  background: rgba(127, 29, 29, 0.22);
}

.compact-copy {
  font-size: 0.94rem;
  line-height: 1.7;
}

.empty-state {
  display: grid;
  gap: 10px;
  justify-items: start;
}

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

label {
  display: block;
  margin: 0 0 8px;
  font-weight: 600;
  color: #d8e3f8;
}

textarea,
input {
  width: 100%;
  padding: 12px 14px;
  margin: 0;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.72);
  color: var(--text);
  font: inherit;
}

textarea {
  resize: vertical;
}

textarea::placeholder,
input::placeholder {
  color: #7f91b3;
}

textarea:focus,
input:focus {
  outline: 2px solid rgba(96, 165, 250, 0.34);
  border-color: rgba(96, 165, 250, 0.42);
}

ul {
  padding-left: 20px;
}

@media (max-width: 900px) {
  .hero,
  .highlights,
  .dashboard-grid,
  .dashboard-hero,
  .section-heading,
  .section-heading-card,
  .dashboard-decks__heading {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-copy {
    padding: 34px;
  }

  .hero-brand {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .deck-card__stats {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .page-shell {
    padding-inline: 14px;
  }

  .review-shell {
    padding: 18px 14px 32px;
  }

  .topbar,
  .hero-copy,
  .hero-panel,
  .card,
  .deck-card,
  .study-card,
  .modal__surface {
    border-radius: 22px;
  }

  .hero-copy,
  .card,
  .modal__surface {
    padding: 22px;
  }

  .hero-panel {
    padding: 24px;
  }

  .hero h1 {
    max-width: none;
    font-size: 2.6rem;
  }

  .topbar {
    padding: 14px;
  }

  .review-topbar {
    margin-bottom: 16px;
  }

  .review-focus-card,
  .review-empty-state {
    border-radius: 24px;
  }

  .topbar-nav {
    gap: 10px 14px;
  }

  .brand-mark {
    align-items: flex-start;
  }

  .brand-mark__media {
    width: 52px;
    height: 52px;
  }

  .button,
  .button-rating {
    width: 100%;
  }

  .dashboard-actions,
  .deck-card__actions {
    width: 100%;
    justify-items: stretch;
  }

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

/* Test-taking styles */
.test-question-card {
  max-width: 820px;
}

.test-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.test-counter {
  font-size: 0.92rem;
  font-weight: 700;
  color: #6b7280;
  background: rgba(120, 113, 108, 0.1);
  padding: 6px 12px;
  border-radius: 999px;
}

.test-question-slide {
  display: none;
}

.test-question-text {
  font-size: clamp(1.3rem, 2.4vw, 1.7rem);
  font-weight: 700;
  color: #111827;
  margin-bottom: 24px;
  line-height: 1.5;
}

.test-options {
  display: grid;
  gap: 12px;
  margin-bottom: 24px;
}

.test-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid rgba(120, 113, 108, 0.16);
  background: rgba(255, 251, 245, 0.6);
  cursor: pointer;
  transition: all 0.15s ease;
}

.test-option:hover {
  background: rgba(255, 251, 245, 0.9);
  border-color: rgba(120, 113, 108, 0.28);
}

.test-option input[type="radio"] {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  cursor: pointer;
  accent-color: #6d5efc;
}

.test-option-text {
  font-size: 1.05rem;
  color: #1f2937;
  line-height: 1.5;
}

.test-nav {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 8px;
}

.test-nav .button {
  min-width: 120px;
}

.test-nav .button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Test report styles */
.test-report-card {
  max-width: 820px;
}

.test-report-header {
  text-align: center;
  margin-bottom: 20px;
}

.test-score-display {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 12px;
  margin: 16px 0;
}

.test-score-label {
  font-size: 0.92rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.test-score-value {
  font-size: 2.2rem;
  font-weight: 800;
  color: #111827;
  letter-spacing: -0.03em;
}

.test-score-percent {
  font-size: 1.4rem;
  font-weight: 700;
  color: #22c55e;
}

.test-report-meta {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.test-report-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.test-report-stat-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.test-report-stat-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1f2937;
}

.test-report-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 20px;
}

.test-report-counter {
  font-size: 0.92rem;
  font-weight: 700;
  color: #6b7280;
  background: rgba(120, 113, 108, 0.1);
  padding: 6px 12px;
  border-radius: 999px;
}

.test-report-slides {
  margin-bottom: 20px;
}

.test-report-slide {
  display: none;
}

.test-report-question {
  margin-bottom: 20px;
}

.test-report-status {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.test-correct {
  background: rgba(34, 197, 94, 0.14);
  color: #15803d;
}

.test-incorrect {
  background: rgba(239, 68, 68, 0.14);
  color: #b91c1c;
}

.test-report-question-text {
  font-size: 1.25rem;
  font-weight: 700;
  color: #111827;
  line-height: 1.5;
}

.test-report-options {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.test-report-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(120, 113, 108, 0.12);
  background: rgba(255, 251, 245, 0.5);
}

.test-correct-option {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.28);
}

.test-incorrect-option {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.28);
}

.test-report-option-text {
  font-size: 1rem;
  color: #1f2937;
  line-height: 1.5;
}

.test-report-option-badge {
  flex: 0 0 auto;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}

.test-correct-badge {
  background: rgba(34, 197, 94, 0.16);
  color: #15803d;
}

.test-incorrect-badge {
  background: rgba(239, 68, 68, 0.16);
  color: #b91c1c;
}

.test-report-explanation {
  padding: 16px 18px;
  border-radius: 12px;
  background: rgba(120, 113, 108, 0.08);
  border: 1px solid rgba(120, 113, 108, 0.12);
}

.test-report-explanation p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.7;
  color: #4b5563;
}

.test-report-footer {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}

.test-report-filter {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
}

.button-filter {
  min-height: 36px;
  padding: 8px 16px;
  font-size: 0.88rem;
  background: rgba(120, 113, 108, 0.1);
  color: #1f2937;
  border: 1px solid rgba(120, 113, 108, 0.18);
  box-shadow: none;
}

.button-filter:hover {
  background: rgba(120, 113, 108, 0.16);
}

.button-filter.active {
  background: rgba(109, 94, 252, 0.16);
  border-color: rgba(109, 94, 252, 0.32);
  color: #5647ef;
}

/* Modal overlay */
.modal-count-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 12px;
}

.modal-count-btn {
  min-height: 54px;
  font-size: 1.1rem;
  font-weight: 700;
}

/* Test attempt cards */
.study-card__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.study-card__test-title {
  font-weight: 700;
  color: #e6efff;
  font-size: 0.92rem;
  letter-spacing: 0.04em;
}

.study-card__date {
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
}

.study-card__score-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.study-card__score {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.study-card__percent {
  font-size: 0.92rem;
  font-weight: 700;
  color: #86efac;
}

/* Overview page nav items */
.overview-nav {
  display: grid;
  gap: 10px;
}

.overview-nav__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(148, 163, 184, 0.06);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.overview-nav__item:hover {
  background: rgba(109, 94, 252, 0.12);
  border-color: rgba(109, 94, 252, 0.24);
  transform: translateY(-1px);
}

.overview-nav__icon {
  font-size: 1.2rem;
  width: 28px;
  text-align: center;
  flex: 0 0 auto;
}

.overview-nav__text {
  flex: 1;
}

.overview-nav__count {
  font-size: 0.82rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(109, 94, 252, 0.16);
  color: #c4b5fd;
}

.overview-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.overview-action-btn {
  flex: 1;
  min-width: 120px;
}

/* Back to overview link */
.back-to-overview {
  margin-bottom: -4px;
}

/* Fix button text visibility in review theme */
.review-body .button-secondary {
  color: #1f2937 !important;
  border-color: rgba(120, 113, 108, 0.28);
}

.review-body .button-secondary:hover {
  background: rgba(120, 113, 108, 0.12);
}

/* Ensure Previous/Next button text is visible in test module within review theme */
.review-body .test-nav .button-secondary {
  color: #1f2937 !important;
}

@media (max-width: 640px) {
  .test-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .test-score-display {
    flex-direction: column;
    gap: 6px;
  }

  .test-score-value {
    font-size: 1.8rem;
  }

  .test-report-meta {
    gap: 16px;
  }

  .test-report-option {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .test-report-option-badge {
    align-self: flex-start;
  }

  .test-nav {
    flex-direction: column;
  }

  .test-nav .button {
    width: 100%;
  }

  .test-report-nav {
    flex-direction: column;
    gap: 12px;
  }
}
