: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 {
  color: var(--muted);
  text-decoration: none;
}

.topbar-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  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-link:hover {
  color: var(--text);
  background: rgba(148, 163, 184, 0.08);
}

.topbar-link__icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.topbar-link__icon svg {
  width: 18px;
  height: 18px;
}

.topbar-link__text {
  line-height: 1;
}

.topbar-nav form {
  margin: 0;
}

.user-menu {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding: 4px 6px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.22);
}

.user-menu__meta--inline {
  display: inline-flex;
  align-items: center;
  gap: 0;
  max-width: 240px;
}

.user-menu__text {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-weight: 700;
}

.user-menu__logout--inline {
  width: auto;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(248, 113, 113, 0.4);
  background: rgba(127, 29, 29, 0.75);
  color: #fecaca;
  font-weight: 700;
  cursor: pointer;
}

.user-menu__logout--inline:hover {
  background: rgba(153, 27, 27, 0.92);
}

.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;
}

.footer-links {
  display: inline-flex;
  gap: 12px;
  margin-left: 16px;
  vertical-align: middle;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}

.footer-links a:hover {
  color: var(--text);
}

.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: 700;
  color: var(--text);
  cursor: pointer;
}

.bulk-actions__toggle > span:last-child {
  color: var(--text);
}

.bulk-actions__toggle input[type="checkbox"]:checked ~ span:last-child {
  color: #ffffff;
}

[data-theme="light"] .bulk-actions__toggle > span:last-child {
  color: #0f172a;
}

[data-theme="light"] .bulk-actions__toggle input[type="checkbox"]:checked ~ span:last-child {
  color: #0f172a;
}

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

.toggle-switch {
  position: relative;
}

.toggle-switch input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.toggle-switch__slider {
  position: relative;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(96, 165, 250, 0.32), rgba(59, 130, 246, 0.24));
  border: 1px solid rgba(96, 165, 250, 0.45);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04), 0 0 0 1px rgba(96, 165, 250, 0.08);
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  flex: 0 0 auto;
}

.toggle-switch__slider::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffffff, #dbeafe);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.32);
  transition: transform 0.2s ease;
}

.toggle-switch input[type="checkbox"]:checked + .toggle-switch__slider {
  background: linear-gradient(180deg, var(--primary), var(--primary-strong));
  border-color: rgba(167, 139, 250, 0.95);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), 0 0 0 3px rgba(109, 94, 252, 0.18);
}

.toggle-switch input[type="checkbox"]:checked + .toggle-switch__slider::after {
  transform: translateX(18px);
}

.toggle-switch input[type="checkbox"]:focus-visible + .toggle-switch__slider {
  outline: 2px solid rgba(96, 165, 250, 0.65);
  outline-offset: 2px;
}

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

.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;
  padding: 12px 14px;
  border: 1.5px solid rgba(148, 163, 184, 0.6);
  border-radius: 14px;
  background: rgba(30, 41, 59, 0.9);
  color: #f1f5f9;
  font: inherit;
}

.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;
}

.deck-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.deck-card__title-link {
  text-decoration: none;
  color: inherit;
  flex: 1;
  min-width: 0;
}

.deck-card__title-link:hover .deck-card__title {
  color: var(--primary);
}

.deck-favorite-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted, #64748b);
  flex-shrink: 0;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.deck-favorite-btn:hover {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
  transform: scale(1.1);
}

.deck-favorite-btn--active {
  color: #f59e0b;
}

.deck-favorite-btn--active:hover {
  background: rgba(245, 158, 11, 0.15);
}

.deck-favorite-btn--active svg {
  fill: currentColor;
  stroke: none;
}

.deck-star-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: inline-flex;
  color: var(--text-muted, #94a3b8);
  flex-shrink: 0;
  transition: filter 0.2s ease;
}
.deck-star-btn:hover {
  filter: drop-shadow(0 0 6px currentColor);
}
.deck-star-btn--favorited {
  color: #f59e0b;
}
.deck-star-btn--favorited:hover {
  filter: drop-shadow(0 0 8px #f59e0b);
}
.deck-star-btn--favorited svg {
  fill: currentColor;
  stroke: none;
}
 .deck-star-btn:not(.deck-star-btn--favorited) svg {
   fill: none;
 }

.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[type="checkbox"] {
  width: auto;
}

/* Toggle switch */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.toggle-row__label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.toggle-row__title {
  font-weight: 600;
  color: #d8e3f8;
  font-size: 0.94rem;
}

.toggle-row__desc {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.5;
}

.toggle-status {
  font-size: 0.88rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  color: var(--muted);
}

.toggle-switch {
  position: relative;
  flex: 0 0 auto;
  width: 48px;
  height: 26px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.28);
  transition: background 0.22s ease;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  border-radius: 50%;
  background: #e8eefc;
  transition: transform 0.22s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--primary);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

.toggle-switch input:focus-visible + .toggle-slider {
  outline: 2px solid rgba(96, 165, 250, 0.42);
  outline-offset: 2px;
}

.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;
  position: relative;
}

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

.review-area {
  transition: opacity 0.2s ease;
}



.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);
}

.review-body .button-rating[disabled],
.review-body .button-rating.disabled {
  opacity: 0.2 !important;
  cursor: not-allowed;
  filter: grayscale(1) !important;
  border: 3px dashed red !important;
}

.review-loading .review-card__body {
  opacity: 0.4;
}

.review-loading .review-loading-ring {
  display: flex !important;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
}

.review-card__body {
  position: relative;
}

.review-loading-ring {
  display: none;
  width: 40px;
  height: 40px;
  border: 3px solid rgba(120, 113, 108, 0.2);
  border-top-color: rgba(120, 113, 108, 0.8);
  border-radius: 50%;
  animation: review-spin 0.6s linear infinite;
}

@keyframes review-spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.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,
select {
  width: 100%;
  padding: 12px 14px;
  margin: 0;
  border: 1.5px solid rgba(148, 163, 184, 0.6);
  border-radius: 14px;
  background: rgba(30, 41, 59, 0.9);
  color: #f1f5f9;
  font: inherit;
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

textarea {
  resize: vertical;
}

textarea::placeholder,
input::placeholder {
  color: #94a3b8;
}

textarea:focus,
input:focus {
  outline: 2px solid rgba(96, 165, 250, 0.5);
  border-color: rgba(96, 165, 250, 0.7);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
}

@media (max-width: 640px) {
  textarea,
  input {
    margin-bottom: 0.75rem;
  }
}

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;
  }

  .topbar {
    padding: 10px 12px;
    gap: 10px;
  }

  .topbar-nav {
    gap: 4px 8px;
    font-size: 0.84rem;
  }

  .topbar-link {
    gap: 0;
    padding: 6px;
    min-width: 34px;
    min-height: 34px;
    justify-content: center;
  }

  .topbar-link__text {
    display: none;
  }

  .topbar-link__icon,
  .topbar-link__icon svg {
    width: 17px;
    height: 17px;
  }

  .topbar-nav a,
  .topbar-nav button,
  .user-menu__logout--inline {
    padding: 0;
    font-size: 0.82rem;
  }

  .brand-mark__copy {
    gap: 2px;
  }

  .brand-mark__title {
    font-size: 1rem;
  }

  .brand-mark__subtitle,
  .user-menu__meta--inline {
    font-size: 0.66rem;
  }

  .user-menu {
    gap: 4px;
    padding: 2px 4px;
  }

  .user-menu__meta--inline {
    max-width: 92px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .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;
  }

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

  .bulk-actions__controls {
    width: 100%;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
  }

  .bulk-actions__toggle,
  .study-card__select {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    white-space: nowrap;
  }

  .bulk-actions__toggle span,
  .study-card__select span {
    display: inline-block;
    white-space: nowrap;
  }

  .bulk-actions [data-bulk-submit] {
    width: 100%;
  }
  }

  .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));
  }

  .table-scroll {
    overflow: visible;
  }

  .data-table,
  .data-table thead,
  .data-table tbody,
  .data-table tr,
  .data-table th,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table thead {
    display: none;
  }

  .data-table tbody {
    display: grid;
    gap: 14px;
  }

  .data-table tr {
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.42);
    padding: 12px 14px;
  }

  .data-table td {
    border: 0;
    padding: 8px 0;
    text-align: left;
  }

  .data-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #8ea4c7;
  }
}

@media (max-width: 480px) {
  .section-title {
    font-size: 1.8rem;
  }

  .section-subtitle {
    font-size: 1.1rem;
  }

  .panel-label {
    font-size: 0.72rem;
  }

  .card {
    padding: 18px;
  }
}

/* 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 1 180px;
  min-width: 180px;
}

.ai-action-form {
  flex: 1 1 180px;
  min-width: 180px;
  margin: 0;
}

.ai-action-form .button,
.overview-actions .button-ai {
  width: 100%;
}

.button-ai {
  justify-content: center;
  border-color: rgba(96, 165, 250, 0.55);
  background: linear-gradient(180deg, rgba(30, 64, 175, 0.28), rgba(15, 23, 42, 0.92));
  color: #dbeafe;
  box-shadow:
    0 0 0 1px rgba(96, 165, 250, 0.18) inset,
    0 0 18px rgba(59, 130, 246, 0.24),
    0 0 34px rgba(30, 64, 175, 0.18);
}

.button-ai:hover {
  border-color: rgba(125, 211, 252, 0.75);
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.38), rgba(15, 23, 42, 0.96));
  box-shadow:
    0 0 0 1px rgba(125, 211, 252, 0.24) inset,
    0 0 20px rgba(59, 130, 246, 0.3),
    0 0 42px rgba(30, 64, 175, 0.28);
}

.button-ai__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1em;
  color: #93c5fd;
  text-shadow: 0 0 10px rgba(125, 211, 252, 0.65);
}

/* 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;
  }
}
.tag-badge-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.tag-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  background: rgba(72, 187, 120, 0.14);
  border: 1px solid rgba(72, 187, 120, 0.28);
  color: #d6ffe4;
  font-size: 0.92rem;
  line-height: 1;
}

.tag-badge__remove-form {
  margin: 0;
}

.tag-badge__remove {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
}

.tag-badge__remove:hover {
  opacity: 0.8;
}

/* Pagination */
.pagination {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem 0 0.5rem;
  font-size: 0.9rem;
}

.pagination__controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: center;
}

.page-num {
  min-width: 2.4rem;
  text-align: center;
  font-size: 0.85rem;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
}

.page-num--active {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  cursor: default;
}

.pagination__ellipsis {
  color: var(--text-muted);
  padding: 0 0.2rem;
}

.pagination__info {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.pagination__info--single {
  text-align: center;
  padding: 0.5rem 0;
}

/* ======================================================
   Light theme — applied via data-theme="light" on <html>
   ====================================================== */
[data-theme="light"] {
  --bg: #f1f5f9;
  --bg-soft: #e2e8f0;
  --bg-accent: rgba(109, 94, 252, 0.08);
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: rgba(255, 255, 255, 0.98);
  --surface-soft: rgba(241, 245, 249, 0.88);
  --border: rgba(148, 163, 184, 0.28);
  --border-strong: rgba(100, 116, 139, 0.4);
  --text: #1e293b;
  --muted: #64748b;
  --primary: #6d5efc;
  --primary-strong: #5647ef;
  --primary-soft: rgba(109, 94, 252, 0.12);
  --secondary: #16a34a;
  --secondary-soft: rgba(22, 163, 74, 0.12);
  --warning-soft: rgba(251, 191, 36, 0.16);
  --danger-soft: rgba(239, 68, 68, 0.12);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] body {
  background: linear-gradient(160deg, #eef2ff 0%, #f8fafc 50%, #f1f5f9 100%);
  color: var(--text);
}

[data-theme="light"] body::before,
[data-theme="light"] body::after {
  display: none;
}

[data-theme="light"] input,
[data-theme="light"] select,
[data-theme="light"] textarea {
  background: #fff;
  border-color: rgba(148, 163, 184, 0.5);
  color: #1e293b;
}

[data-theme="light"] input:focus,
[data-theme="light"] textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(109, 94, 252, 0.15);
  outline: none;
}

/* Theme toggle button */
.theme-toggle {
  background: none;
  border: 1.5px solid var(--border-strong);
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.3rem 0.5rem;
  line-height: 1;
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

/* Light theme toggle overrides */
[data-theme="light"] .toggle-row {
  background: rgba(241, 245, 249, 0.92);
  border-color: rgba(148, 163, 184, 0.32);
}

[data-theme="light"] .toggle-row__title {
  color: #1e293b;
}

[data-theme="light"] .toggle-slider {
  background: rgba(148, 163, 184, 0.38);
}

[data-theme="light"] .toggle-slider::before {
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .toggle-status {
  background: rgba(148, 163, 184, 0.18);
  color: #475569;
}

.theme-toggle:hover {
  background: var(--bg-accent);
  border-color: var(--primary);
}

@media (max-width: 640px) {
  .theme-toggle {
    padding: 0.4rem 0.6rem;
  }
}

/* ======================================================
   Light theme — comprehensive overrides
   ====================================================== */
[data-theme="light"] .deck-card,
[data-theme="light"] .study-card {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(148, 163, 184, 0.3);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .deck-card:hover,
[data-theme="light"] .study-card:hover {
  transform: translateY(-2px);
  border-color: rgba(109, 94, 252, 0.4);
  background: #fff;
  box-shadow: 0 8px 32px rgba(109, 94, 252, 0.12);
}

[data-theme="light"] .deck-card h3,
[data-theme="light"] .deck-card__title,
[data-theme="light"] .study-card h3 {
  color: #1e293b;
}

[data-theme="light"] .deck-card p,
[data-theme="light"] .study-card p,
[data-theme="light"] .muted {
  color: #64748b;
}

[data-theme="light"] .deck-favorite-btn {
  color: #94a3b8;
}

[data-theme="light"] .deck-favorite-btn:hover {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.08);
}

[data-theme="light"] .study-card__label {
  color: #6d5efc;
}

[data-theme="light"] .study-card__value {
  color: #1e293b;
}

[data-theme="light"] .deck-card__meta {
  color: #64748b;
}

[data-theme="light"] .study-card-grid {
  background: transparent;
}

[data-theme="light"] .study-card__date {
  color: #64748b;
}

[data-theme="light"] .study-card__test-title {
  color: #1e293b;
}

[data-theme="light"] .tag-badge {
  background: rgba(72, 187, 120, 0.1) !important;
  border-color: rgba(72, 187, 120, 0.3) !important;
  color: #16a34a !important;
}

[data-theme="light"] .tag-badge > span {
  color: #16a34a !important;
}

[data-theme="light"] .tag-badge__remove {
  color: #94a3b8;
}

[data-theme="light"] .hero-panel {
  background: linear-gradient(180deg, rgba(238, 242, 255, 0.96), rgba(241, 245, 249, 0.92));
  border-color: rgba(109, 94, 252, 0.2);
}

[data-theme="light"] .hero-panel__brand {
  background: radial-gradient(circle at top, rgba(109, 94, 252, 0.15), rgba(241, 245, 249, 0.9));
  border-color: rgba(109, 94, 252, 0.25);
}

[data-theme="light"] .hero h1 span {
  color: #4f46e5;
}

[data-theme="light"] .panel-strip span {
  background: rgba(99, 102, 241, 0.12);
  color: #4338ca;
}

[data-theme="light"] .panel-label {
  color: #64748b;
}

[data-theme="light"] .hero h2 {
  color: #1e293b;
}

[data-theme="light"] .feature-list {
  color: #475569;
}

[data-theme="light"] .hero-panel--accent {
  background: #fff;
  border-color: rgba(109, 94, 252, 0.25);
  box-shadow: 0 8px 32px rgba(99, 102, 241, 0.1);
}

[data-theme="light"] .hero-text {
  color: #475569;
}

[data-theme="light"] .hero-actions .button {
  background: #4f46e5;
  color: #fff;
}

[data-theme="light"] .hero-actions .button:hover {
  background: #4338ca;
}

[data-theme="light"] .info-card {
  background: #fff;
  border-color: rgba(148, 163, 184, 0.3);
}

[data-theme="light"] .info-card h3 {
  color: #1e293b;
}

[data-theme="light"] .page-content .page-content .review-card__text{
  background: rgba(241, 245, 249, 0.8);
  border-color: rgba(148, 163, 184, 0.25);
  color: #1e293b;
}

[data-theme="light"] .page-content .page-content .review-card__text--answer{
  background: rgba(22, 163, 74, 0.08);
  border-color: rgba(22, 163, 74, 0.2);
}

[data-theme="light"] .page-content .review-answer{
  background: rgba(241, 245, 249, 0.6);
  border-color: rgba(148, 163, 184, 0.2);
  color: #1e293b;
}

[data-theme="light"] .deck-search input {
  background: #fff;
  border-color: rgba(148, 163, 184, 0.5);
  color: #1e293b;
}

[data-theme="light"] .deck-star-btn--favorited {
  color: #f59e0b;
}

[data-theme="light"] .site-footer {
  color: #64748b;
}

[data-theme="light"] .topbar {
  background: rgba(255, 255, 255, 0.88);
  border-bottom-color: rgba(148, 163, 184, 0.2);
}

[data-theme="light"] .brand-mark__copy strong {
  color: #1e293b;
}

[data-theme="light"] .brand-mark__copy small {
  color: #64748b;
}

[data-theme="light"] .topbar-nav a {
  color: #64748b;
}

[data-theme="light"] .topbar-nav a:hover {
  color: var(--primary);
}

[data-theme="light"] .user-menu__text {
  color: #64748b;
}

[data-theme="light"] .hero-brand__media {
  background: radial-gradient(circle at top, rgba(109, 94, 252, 0.12), rgba(241, 245, 249, 0.92));
  border-color: rgba(109, 94, 252, 0.2);
  box-shadow: 0 18px 36px rgba(109, 94, 252, 0.12);
}

[data-theme="light"] .hero-brand__copy .eyebrow {
  color: #6d5efc;
}

[data-theme="light"] .hero-brand__copy .section-title {
  color: #1e293b;
}

[data-theme="light"] .hero-brand__copy .muted {
  color: #64748b;
}

[data-theme="light"] .hero-brand__caption {
  color: #64748b;
}

[data-theme="light"] .deck-highlight,
[data-theme="light"] .csv-highlight {
  color: #4f46e5;
}

[data-theme="light"] .light-strong-copy {
  color: #475569;
}

[data-theme="light"] .provider-card {
  background: #fff;
  border-color: rgba(148, 163, 184, 0.4);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  color: #1e293b;
}

[data-theme="light"] .provider-card:hover {
  background: #f8fafc;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .provider-card .muted {
  color: #64748b;
}

/* Provider cards - dark theme defaults */
.provider-card {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.provider-label--microsoft {
  color: #93c5fd;
}

.provider-label--google {
  color: #86efac;
}

.provider-title {
  color: #f8fafc;
}

.provider-desc {
  color: #cbd5e1;
}

.provider-btn {
  background: #1e3a8a;
  color: #fff;
  border: 1px solid rgba(96, 165, 250, 0.85);
}

.provider-card--google .provider-btn {
  background: #166534;
  border-color: rgba(74, 222, 128, 0.85);
}

/* Provider cards - light theme overrides */
[data-theme="light"] .provider-card {
  background: #fff;
  border-color: rgba(148, 163, 184, 0.4);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .provider-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .provider-card .panel-label {
  color: #6d5efc;
}

[data-theme="light"] .provider-card .section-subtitle {
  color: #1e293b;
}

[data-theme="light"] .provider-card .provider-desc {
  color: #64748b;
}

[data-theme="light"] .provider-card .provider-btn {
  background: #fff;
  color: #475569;
  border: 1px solid rgba(148, 163, 184, 0.4);
}

[data-theme="light"] .provider-card .provider-btn:hover {
  background: rgba(109, 94, 252, 0.08);
  color: #6d5efc;
  border-color: #6d5efc;
}

[data-theme="light"] .provider-card--microsoft {
  border-color: rgba(59, 130, 246, 0.35);
}

[data-theme="light"] .provider-card--google {
  border-color: rgba(34, 197, 94, 0.35);
}

[data-theme="light"] .brand-mark__copy small {
  color: #64748b;
}

[data-theme="light"] .topbar-nav a {
  color: #64748b;
}

[data-theme="light"] .topbar-nav a:hover {
  color: var(--primary);
}

[data-theme="light"] .user-menu__text {
  color: #64748b;
}

[data-theme="light"] .page-content {
  background: transparent;
}

[data-theme="light"] .section-title,
[data-theme="light"] .panel-label {
  color: #1e293b;
}

[data-theme="light"] .metric-pill {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(148, 163, 184, 0.25);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .metric-pill strong {
  color: var(--primary);
}

[data-theme="light"] .metric-pill span {
  color: #64748b;
}

[data-theme="light"] .dashboard-actions .button {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .info-card {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(148, 163, 184, 0.25);
  color: #1e293b;
}

[data-theme="light"] .form-card {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(148, 163, 184, 0.25);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .form-card h3 {
  color: #1e293b;
}

[data-theme="light"] .pagination__info {
  color: #64748b;
}

[data-theme="light"] .pagination__ellipsis {
  color: #94a3b8;
}

[data-theme="light"] .button-ghost {
  color: #64748b;
  border-color: rgba(148, 163, 184, 0.3);
  background: rgba(241, 245, 249, 0.6);
}

[data-theme="light"] .button-ghost:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: rgba(109, 94, 252, 0.08);
}

[data-theme="light"] .page-num--active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* Info cards in light mode */
[data-theme="light"] .info-card {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(148, 163, 184, 0.3);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .info-card .section-subtitle {
  color: #1e293b;
}

[data-theme="light"] .info-card .muted {
  color: #64748b;
}

[data-theme="light"] .info-card a {
  color: var(--primary);
}

/* Sign-in badge inline style in light mode */
[data-theme="light"] .dashboard-decks__heading [style*="background"] {
  background: linear-gradient(135deg, rgba(109, 94, 252, 0.12), rgba(34, 197, 94, 0.1)) !important;
  border-color: rgba(148, 163, 184, 0.3) !important;
}

[data-theme="light"] .dashboard-decks__heading [style*="background"] strong {
  color: #1e293b !important;
}

/* Study flow card */
[data-theme="light"] .feature-list li {
  color: #475569;
}

[data-theme="light"] .feature-list a {
  color: var(--primary);
}

/* Dashboard section headings */
[data-theme="light"] .section-title {
  color: #0f172a;
}

/* Deck name on overview page — extra dark */
[data-theme="light"] .page-content .section-title,
[data-theme="light"] .page-content .section-title span {
  color: #0f172a !important;
}

[data-theme="light"] .panel-label {
  color: #6d5efc;
}

[data-theme="light"] .section-subtitle {
  color: #1e293b;
}

/* Empty state */
[data-theme="light"] .empty-state {
  color: #475569;
}

[data-theme="light"] .empty-state h3 {
  color: #1e293b;
}

[data-theme="light"] .empty-state a {
  color: var(--primary);
}

/* Buttons in light mode */
[data-theme="light"] .button {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .button:hover {
  box-shadow: 0 4px 12px rgba(109, 94, 252, 0.2);
}

[data-theme="light"] .button-secondary {
  background: rgba(241, 245, 249, 0.9);
  color: #475569;
  border-color: rgba(148, 163, 184, 0.35);
}

[data-theme="light"] .button-secondary:hover {
  background: rgba(109, 94, 252, 0.08);
  color: var(--primary);
  border-color: var(--primary);
}

/* Labels / checkbox text */
[data-theme="light"] .checkbox-row span,
[data-theme="light"] label:not([class]) {
  color: #475569;
}

/* Review / Test buttons on deck overview — bright in light mode */
[data-theme="light"] .button-review {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.5) !important;
  color: #16a34a;
}
[data-theme="light"] .button-review:hover {
  background: rgba(34, 197, 94, 0.2);
  border-color: #16a34a !important;
  color: #15803d;
}
[data-theme="light"] .button-test {
  background: rgba(109, 94, 252, 0.12);
  border-color: rgba(109, 94, 252, 0.4) !important;
  color: #6d5efc;
}
[data-theme="light"] .button-test:hover {
  background: rgba(109, 94, 252, 0.2);
  border-color: #6d5efc !important;
  color: #5647ef;
}
[data-theme="light"] .button-ai {
  background: linear-gradient(180deg, rgba(219, 234, 254, 0.98), rgba(239, 246, 255, 0.94));
  border: 1px solid rgba(37, 99, 235, 0.75) !important;
  color: #1d4ed8;
  box-shadow:
    0 0 0 1px rgba(59, 130, 246, 0.18) inset,
    0 0 0 1px rgba(37, 99, 235, 0.08),
    0 0 12px rgba(59, 130, 246, 0.28),
    0 0 26px rgba(30, 64, 175, 0.2);
}

[data-theme="light"] .button-ai:hover {
  background: linear-gradient(180deg, rgba(191, 219, 254, 0.98), rgba(255, 255, 255, 0.98));
  border-color: rgba(37, 99, 235, 0.95) !important;
  color: #1e40af;
  box-shadow:
    0 0 0 1px rgba(37, 99, 235, 0.22) inset,
    0 0 16px rgba(59, 130, 246, 0.34),
    0 0 34px rgba(30, 64, 175, 0.26);
}

[data-theme="light"] .button-ai__icon {
  color: #2563eb;
  text-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

/* Modal */
[data-theme="light"] .modal {
  background: rgba(0, 0, 0, 0.4);
}

[data-theme="light"] .modal__surface {
  background: rgba(255, 255, 255, 0.97);
  border-color: rgba(148, 163, 184, 0.25);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .modal__surface .section-subtitle {
  color: #1e293b;
}

/* Footer */
[data-theme="light"] .site-footer {
  color: #94a3b8;
}

/* Status banners */
[data-theme="light"] .status-banner {
  border-color: rgba(148, 163, 184, 0.25);
}

[data-theme="light"] .status-banner strong {
  color: #1e293b;
}

[data-theme="light"] .status-banner span {
  color: #64748b;
}

/* Danger / delete button in light mode */
[data-theme="light"] .button-danger {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.08);
  color: #dc2626;
}

[data-theme="light"] .button-danger:hover {
  background: rgba(239, 68, 68, 0.14);
  border-color: #dc2626;
}

/* User menu in light mode — keep it clean */
[data-theme="light"] .user-menu {
  background: rgba(241, 245, 249, 0.9);
  border-color: rgba(148, 163, 184, 0.3);
}

[data-theme="light"] .user-menu__text {
  color: #1e293b;
  font-weight: 700;
}

[data-theme="light"] .user-menu__logout--inline {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.35);
  color: #dc2626;
}

[data-theme="light"] .user-menu__logout--inline:hover {
  background: rgba(239, 68, 68, 0.14);
}

/* Count badges (MCQ / flash card counts) in light mode */
[data-theme="light"] .overview-nav__count {
  background: rgba(109, 94, 252, 0.12);
  color: #6d5efc;
}

[data-theme="light"] .bulk-actions__count {
  color: #64748b;
}

/* Modal count buttons in light mode */
[data-theme="light"] .modal-count-btn {
  background: rgba(109, 94, 252, 0.1);
  border-color: rgba(109, 94, 252, 0.25);
  color: #6d5efc;
}

/* Review/test pages — always keep their warm cream paper theme
   regardless of global dark/light toggle. */
.review-body,
[data-theme="dark"] .review-body,
[data-theme="light"] .page-content .page-content .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%);
}

[data-theme="light"] .page-content .page-content .review-shell{
  /* already inherits fine */
}

[data-theme="light"] .page-content .page-content .review-topbar{
  border-bottom-color: rgba(148, 163, 184, 0.2);
}

[data-theme="light"] .page-content .page-content .review-brand{
  color: #1e293b;
}

[data-theme="light"] .page-content .review-brand small{
  color: #64748b;
}

[data-theme="light"] .page-content .page-content .review-focus-card{
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(148, 163, 184, 0.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .page-content .page-content .review-card__text{
  background: rgba(241, 245, 249, 0.7);
  border-color: rgba(148, 163, 184, 0.2);
  color: #1e293b;
}

[data-theme="light"] .page-content .page-content .review-card__text--answer{
  background: rgba(22, 163, 74, 0.08);
  border-color: rgba(22, 163, 74, 0.2);
}

[data-theme="light"] .page-content .page-content .review-answer{
  background: rgba(241, 245, 249, 0.6);
  border-color: rgba(148, 163, 184, 0.18);
  color: #1e293b;
}

[data-theme="light"] .page-content .review-body .button{
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(109, 94, 252, 0.3);
}

[data-theme="light"] .page-content .review-body .button:hover{
  background: var(--primary-strong);
  box-shadow: 0 4px 16px rgba(109, 94, 252, 0.4);
}

[data-theme="light"] .page-content .review-body .button-secondary{
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(148, 163, 184, 0.35);
  color: #475569;
}

[data-theme="light"] .page-content .review-body .button-secondary:hover{
  background: rgba(109, 94, 252, 0.08);
  color: var(--primary);
  border-color: var(--primary);
}

[data-theme="light"] .page-content .page-content .test-counter{
  background: rgba(109, 94, 252, 0.1);
  color: #6d5efc;
}

[data-theme="light"] .page-content .page-content .test-report-counter{
  background: rgba(109, 94, 252, 0.1);
  color: #6d5efc;
}

[data-theme="light"] .page-content .page-content .test-question-card{
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(148, 163, 184, 0.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .page-content .page-content .test-question-text{
  color: #1e293b;
}

[data-theme="light"] .page-content .page-content .test-option{
  background: rgba(241, 245, 249, 0.7);
  border-color: rgba(148, 163, 184, 0.25);
  color: #1e293b;
}

[data-theme="light"] .page-content .page-content .test-option:hover{
  border-color: rgba(109, 94, 252, 0.4);
  background: rgba(109, 94, 252, 0.06);
}

[data-theme="light"] .page-content .page-content .test-option-text{
  color: #1e293b;
}

[data-theme="light"] .page-content .page-content .test-report-card{
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(148, 163, 184, 0.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .page-content .page-content .test-report-question-text{
  color: #1e293b;
}

[data-theme="light"] .page-content .page-content .test-report-option{
  background: rgba(241, 245, 249, 0.6);
  border-color: rgba(148, 163, 184, 0.2);
}

[data-theme="light"] .page-content .page-content .test-report-option-text{
  color: #1e293b;
}

/* Review rating buttons — bright accents in light mode */
[data-theme="light"] .button-rating--muted {
  background: linear-gradient(135deg, #94a3b8, #64748b);
  color: #fff;
}

[data-theme="light"] .button-rating--warm {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
}

[data-theme="light"] .button-rating--cool {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
}

[data-theme="light"] .button-rating--bright {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
}

/* Test nav buttons — bright accent in light mode */
[data-theme="light"] .page-content .test-nav .button:not(:disabled){
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 12px rgba(109, 94, 252, 0.35);
}

[data-theme="light"] .page-content .test-nav .button:not(:disabled):hover{
  background: var(--primary-strong);
  box-shadow: 0 4px 16px rgba(109, 94, 252, 0.45);
}

[data-theme="light"] .site-footer--review {
  color: #94a3b8;
}

[data-theme="light"] .page-content .review-brand__copy strong{
  color: #1e293b;
}

[data-theme="light"] .page-content .review-brand__copy small{
  color: #64748b;
}
.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.9rem;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.16), rgba(16, 185, 129, 0.14));
  border: 1px solid rgba(148, 163, 184, 0.35);
  width: fit-content;
  font-size: 1.02rem;
}

.user-badge strong {
  color: var(--text);
}

.user-badge__dot {
  display: inline-flex;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15);
  flex-shrink: 0;
}

[data-theme="light"] .user-badge {
  background: linear-gradient(135deg, rgba(109, 94, 252, 0.12), rgba(22, 163, 74, 0.1));
  border-color: rgba(148, 163, 184, 0.3);
}

[data-theme="light"] .user-badge strong {
  color: #1e293b;
}

/* Tom Select overrides for theme consistency */
.ts-wrapper {
  min-height: 42px;
}

.ts-control {
  background: var(--input-bg, #1e293b);
  border: 1px solid var(--border-color, #475569);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  color: var(--text, #f1f5f9);
}

.ts-control:focus,
.ts-wrapper.focus .ts-control,
.ts-wrapper.ts-active .ts-control {
  border-color: var(--accent-color, #6366f1);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
  outline: none;
}

.ts-dropdown {
  background: var(--input-bg, #1e293b);
  border: 1px solid var(--border-color, #475569);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  color: var(--text, #f1f5f9);
}

.ts-dropdown .option {
  padding: 0.5rem 0.75rem;
  color: var(--text, #f1f5f9);
}

.ts-dropdown .option:hover,
.ts-dropdown .option.active {
  background: var(--accent-color, #6366f1);
  color: #fff;
}

.ts-dropdown .create {
  color: var(--accent-color, #6366f1);
}

.ts-placeholder {
  color: var(--muted-color, #94a3b8);
}

.ts-clear-button {
  color: var(--muted-color, #94a3b8);
}

.ts-clear-button:hover {
  color: var(--text, #f1f5f9);
}

/* Light theme overrides */
[data-theme="light"] .ts-control {
  background: #fff;
  border-color: #cbd5e1;
  color: #1e293b;
}

[data-theme="light"] .ts-dropdown {
  background: #fff;
  border-color: #cbd5e1;
  color: #1e293b;
}

[data-theme="light"] .ts-dropdown .option {
  color: #1e293b;
}

[data-theme="light"] .ts-placeholder {
  color: #64748b;
}

/* Light theme - data-table overrides */
[data-theme="light"] .data-table tr {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(148, 163, 184, 0.3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .data-table td::before {
  color: #64748b;
}

[data-theme="light"] .data-table td {
  color: #1e293b;
}

[data-theme="light"] .data-table th {
  color: #64748b;
}

/* Cloze card styles */
.cloze {
  display: inline;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cloze[data-answer] {
  background-color: var(--cloze-placeholder-bg, #3b4252);
  color: transparent;
  user-select: none;
  border-bottom: 2px dashed var(--cloze-placeholder-border, #6c7086);
}

.cloze[data-answer]:hover {
  background-color: var(--cloze-placeholder-hover-bg, #4c5264);
}

.cloze-revealed {
  background-color: var(--cloze-revealed-bg, rgba(136, 192, 208, 0.25));
  color: var(--cloze-revealed-text, #a3be8c);
  border-bottom: none;
}

/* Cloze numbers color coding */
.cloze-c1 { border-bottom-color: #bf616a; }
.cloze-c2 { border-bottom-color: #ebcb8b; }
.cloze-c3 { border-bottom-color: #a3be8c; }
.cloze-c4 { border-bottom-color: #88c0d0; }
.cloze-c5 { border-bottom-color: #b48ead; }

/* Cloze card media */
.cloze img {
  max-width: 100%;
  max-height: 400px;
  border-radius: 8px;
  margin: 8px 0;
}

/* Reveal animation */
@keyframes cloze-reveal {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.cloze-revealed {
  animation: cloze-reveal 0.3s ease-out;
}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}

/* MCQ Generation Progress Modal */
.mcq-progress-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.mcq-progress-modal-content {
  background: var(--surface-strong);
  color: inherit;
  border-radius: 12px;
  padding: 24px;
  max-width: 440px;
  width: min(100%, 440px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.mcq-progress-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.mcq-progress-modal-header h3 {
  margin: 0 0 16px 0;
  color: inherit;
}

.modal-body p {
  margin: 8px 0;
}

.mcq-progress-error {
  color: #f87171 !important;
  font-weight: 700;
}

[data-theme="light"] .mcq-progress-error {
  color: #b91c1c !important;
}

.progress-bar-container {
  background: var(--surface-soft);
  border-radius: 8px;
  height: 24px;
  overflow: hidden;
  margin: 12px 0;
}

.progress-bar {
  background: linear-gradient(90deg, #7c3aed 0%, #a855f7 100%);
  height: 100%;
  transition: width 0.3s ease;
  border-radius: 8px;
}

[data-theme="light"] .mcq-progress-modal {
  background: rgba(15, 23, 42, 0.22);
}

/* ============================================
   Folder Navigation
   ============================================ */

.folder-nav {
  margin-bottom: 1rem;
}

.folder-nav__list {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  padding: 0;
  margin: 0;
  flex-wrap: wrap;
}

.folder-nav__crumb {
  display: flex;
  align-items: center;
  gap: 4px;
}

.folder-nav__link {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.875rem;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

.folder-nav__link:hover {
  background: var(--bg-accent);
  color: var(--text);
}

.folder-nav__crumb--current span {
  font-size: 0.875rem;
  color: var(--text);
  font-weight: 600;
  padding: 4px 8px;
}

/* ============================================
   Folder Grid & Cards
   ============================================ */

.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.folder-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  transition: border-color 0.15s, background 0.15s;
  cursor: default;
}

.folder-card:hover {
  border-color: var(--border-strong);
  background: var(--surface);
}

.folder-card__main {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
  flex: 1;
}

.folder-card__icon-link {
  flex-shrink: 0;
  color: var(--primary);
  text-decoration: none;
  display: flex;
}

.folder-card__icon-link:hover {
  color: var(--primary-strong);
}

.folder-card__info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.folder-card__name {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.folder-card__name:hover {
  color: var(--primary);
}

.folder-card__meta {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.folder-card__actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s;
}

.folder-card:hover .folder-card__actions {
  opacity: 1;
}

/* ============================================
   Folder Picker Modal
   ============================================ */

.modal__surface--wide {
  max-width: 480px;
}

.folder-picker {
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem;
  margin-bottom: 1rem;
}

.folder-picker__node {
  margin: 0;
}

.folder-picker__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s;
}

.folder-picker__item:hover {
  background: var(--bg-accent);
}

.folder-picker__item--root {
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  margin-bottom: 6px;
}

.folder-picker__icon {
  flex-shrink: 0;
  color: var(--primary);
}

.folder-picker__item--root .folder-picker__icon {
  color: var(--muted);
}

.folder-picker__name {
  font-size: 0.875rem;
  color: var(--text);
}

.folder-picker__radio {
  display: none;
}

.folder-picker__item:has(input:checked) {
  background: var(--primary-soft);
}

.folder-picker__item:has(input:checked) .folder-picker__name {
  color: var(--primary);
  font-weight: 600;
}

.folder-picker__footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* ============================================
   Select Mode Bar (Browse page)
   ============================================ */

.select-mode-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface-soft);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 0.625rem 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.select-mode-bar__info {
  font-size: 0.875rem;
  color: var(--muted);
  flex: 1;
}

.select-mode-bar__info strong {
  color: var(--text);
}

.select-mode-bar__actions {
  display: flex;
  gap: 0.5rem;
}

.deck-card--selectable {
  cursor: pointer;
}

.deck-card--selectable:hover {
  border-color: var(--primary);
}

.deck-card--selected {
  border-color: var(--primary) !important;
  background: var(--primary-soft) !important;
}

.deck-card--selected .deck-card__checkbox {
  opacity: 1;
}

.deck-card__checkbox {
  position: absolute;
  top: 8px;
  right: 8px;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}

.deck-card--selectable:hover .deck-card__checkbox,
.deck-card--selected .deck-card__checkbox {
  opacity: 1;
}

/* ============================================
   Inline Folder Create / Rename
   ============================================ */

.folder-inline-form,
.inline-folder-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.folder-inline-form input,
.inline-folder-form input {
  flex: 1;
  max-width: 280px;
}

#inline-folder-create input[type="text"],
#inline-folder-rename input[type="text"] {
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.875rem;
}

.form-error {
  color: #f87171;
  font-size: 0.8rem;
  margin: 0.25rem 0;
}

/* ============================================
   Responsive
   ============================================ */

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

  .folder-card__actions {
    opacity: 1;
  }

  .select-mode-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .select-mode-bar__actions {
    width: 100%;
    flex-wrap: wrap;
  }
}
