/* ── WEX Theory – style.css ── */

:root {
  --bg: #0a0a0a;
  --bg-card: #111111;
  --border: #222222;
  --text: #ffffff;
  --text-muted: #666666;
  --accent: #ffffff;
  --btn-bg: #ffffff;
  --btn-text: #0a0a0a;
  --correct: #22c55e;
  --correct-bg: #052e16;
  --wrong: #ef4444;
  --wrong-bg: #1a0505;
}
[data-theme="light"] {
  --bg: #ffffff;
  --bg-card: #f5f5f5;
  --border: #e0e0e0;
  --text: #0a0a0a;
  --text-muted: #666666;
  --accent: #0a0a0a;
  --btn-bg: #0a0a0a;
  --btn-text: #ffffff;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  font-weight: 450;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

#questionText { font-weight: 700; }
.answer-option-label { font-weight: 500; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ── Nav ── */
nav {
  height: 60px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 100%;
  width: 100%;
}

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

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

.logo {
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.03em;
}

/* ── Buttons ── */
.btn-primary {
  background: var(--btn-bg);
  color: var(--btn-text);
  padding: 10px 24px;
  border-radius: 6px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: opacity 0.15s;
  white-space: nowrap;
}
.btn-primary:hover { opacity: 0.85; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 24px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: border-color 0.15s;
  white-space: nowrap;
}
.btn-ghost:hover { border-color: var(--text-muted); }

.btn-sm {
  padding: 6px 14px;
  font-size: 0.82rem;
}

/* ── Card ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}

/* ── Badges ── */
.badge-green {
  display: inline-block;
  background: var(--correct-bg);
  color: var(--correct);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--correct);
}
.badge-red {
  display: inline-block;
  background: var(--wrong-bg);
  color: var(--wrong);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--wrong);
}
.badge-gray {
  display: inline-block;
  background: #1a1a1a;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

/* ── Forms ── */
input, textarea, select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 6px;
  width: 100%;
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color 0.15s;
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--text-muted);
}
input::placeholder, textarea::placeholder {
  color: var(--text-muted);
}

.form-group {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}
.form-error {
  color: var(--wrong);
  font-size: 0.82rem;
  display: none;
}
.form-error.show { display: block; }

/* ── Page ── */
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px;
}

/* ── Tests Grid ── */
.tests-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.test-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}
.test-card:hover {
  border-color: var(--text-muted);
}
.test-card img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
  background: #000;
}
.test-card-body {
  padding: 16px;
}
.test-card-locked {
  position: relative;
  opacity: 0.65;
}
.test-card-locked img {
  filter: grayscale(40%);
}
.test-card-locked:hover {
  border-color: var(--border);
  transform: none;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open {
  display: flex;
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
}
.modal-close:hover { color: var(--text); }

/* ── Sidebar ── */
.sb-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 499;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.sb-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.sb {
  position: fixed;
  left: 0;
  top: 0;
  height: 100%;
  width: 260px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  box-shadow: 8px 0 32px rgba(0,0,0,0.4);
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  z-index: 500;
  display: flex;
  flex-direction: column;
}
.sb.open { transform: translateX(0); }

/* Brand bar */
.sb-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 52px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sb-logo {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  letter-spacing: -0.03em;
  text-decoration: none;
}
.sb-x {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 0.9rem;
  transition: color 0.15s, background 0.15s;
}
.sb-x:hover { color: var(--text); background: rgba(255,255,255,0.07); }
[data-theme="light"] .sb-x:hover { background: rgba(0,0,0,0.06); }

/* Profile block */
.sb-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sb-avi {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: 1px solid var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
  letter-spacing: 0;
}
[data-theme="light"] .sb-avi { background: rgba(0,0,0,0.06); }
.sb-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.sb-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-email {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 20px;
  letter-spacing: 0.01em;
  width: fit-content;
  margin-top: 3px;
}
.sb-badge--pro {
  background: rgba(234,179,8,0.12);
  color: #d4a007;
  border: 1px solid rgba(234,179,8,0.25);
}
[data-theme="light"] .sb-badge--pro {
  background: rgba(234,179,8,0.14);
  color: #92710a;
  border-color: rgba(234,179,8,0.38);
}
.sb-badge--free {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* Nav list */
.sb-list {
  flex: 1;
  min-height: 0;
  padding: 6px 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}
.sb-list::-webkit-scrollbar { width: 3px; }
.sb-list::-webkit-scrollbar-track { background: transparent; }
.sb-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* Section separator */
.sb-sep {
  padding: 14px 16px 4px;
  font-size: 0.64rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  opacity: 0.5;
  user-select: none;
}

/* Nav items */
.sb-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  height: 38px;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 400;
  text-decoration: none;
  border: none;
  background: none;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  border-radius: 6px;
  margin: 1px 8px;
  width: calc(100% - 16px);
  transition: color 0.15s ease, background 0.15s ease;
  position: relative;
  box-sizing: border-box;
}
.sb-item:hover {
  color: var(--text);
  background: rgba(255,255,255,0.06);
}
[data-theme="light"] .sb-item:hover {
  background: rgba(0,0,0,0.05);
}
.sb-ic {
  width: 16px;
  text-align: center;
  font-size: 0.85rem;
  opacity: 0.55;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
.sb-item:hover .sb-ic { opacity: 1; }

/* Danger item (sign out) */
.sb-item--danger { color: var(--wrong) !important; }
.sb-item--danger .sb-ic { opacity: 0.7; }
.sb-item--danger:hover {
  background: rgba(239,68,68,0.08) !important;
  color: var(--wrong) !important;
}

/* Footer */
.sb-foot {
  padding: 8px 8px 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sb-foot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px 6px;
}
.sb-foot-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding-left: 4px;
}

/* Theme toggle icons — CSS-driven, no JS text update needed */
.theme-icon { display: flex; align-items: center; }
.theme-icon-sun  { display: none; }
.theme-icon-moon { display: flex; }
[data-theme="dark"]  .theme-icon-sun  { display: flex; }
[data-theme="dark"]  .theme-icon-moon { display: none; }
[data-theme="light"] .theme-icon-sun  { display: none; }
[data-theme="light"] .theme-icon-moon { display: flex; }

.theme-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  flex-shrink: 0;
}
.theme-btn:hover { color: var(--text); border-color: var(--text-muted); background: rgba(255,255,255,0.05); }

/* ── Back button (test nav) ── */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.83rem;
  font-weight: 500;
  background: none;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  white-space: nowrap;
}
.back-btn:hover { color: var(--text); border-color: var(--text-muted); background: rgba(255,255,255,0.05); }
.back-arrow { font-size: 0.95rem; line-height: 1; }
.nav-test-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}
@media (max-width: 520px) {
  .back-label { display: none; }
  .nav-test-title { display: none; }
}

/* ── Burger btn ── */
.burger-btn {
  background: none;
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  font-family: inherit;
  transition: border-color 0.15s;
}
.burger-btn:hover { border-color: var(--text-muted); }
/* .theme-btn is defined with the sidebar block above */

/* ── Test answer options ── */
.answer-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  margin-bottom: 10px;
  user-select: none;
  background: var(--bg-card);
  position: relative;
}
.answer-option:hover {
  border-color: var(--text-muted);
  background: rgba(255,255,255,0.05);
}
.answer-option.selected {
  border-color: #111827;
  background: rgba(255,255,255,0.04);
}
[data-theme="light"] .answer-option.selected {
  border-color: #111827;
  background: #f8f8f8;
}
.answer-option.correct {
  border-color: #16a34a;
  background: #f0fdf4;
  color: #166534;
}
[data-theme="dark"] .answer-option.correct {
  background: #052e16;
  color: #4ade80;
}
.answer-option.wrong,
.answer-option.incorrect {
  border-color: #dc2626;
  background: #fef2f2;
  color: #991b1b;
}
[data-theme="dark"] .answer-option.wrong,
[data-theme="dark"] .answer-option.incorrect {
  background: #1a0505;
  color: #f87171;
}
.answer-option-label {
  flex: 1;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* ── Results ── */
.results-score {
  font-size: 4rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
}

/* ── Progress ── */
.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--text);
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* ── History Table ── */
.history-table {
  width: 100%;
  border-collapse: collapse;
}
.history-table th,
.history-table td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}
.history-table th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.history-table tr:last-child td { border-bottom: none; }
.history-table tbody tr:hover { background: rgba(255,255,255,0.02); }

/* ── Footer ── */
footer {
  border-top: 1px solid var(--border);
  padding: 40px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  margin-bottom: 16px;
}
.footer-links a {
  color: var(--text-muted);
  font-size: 0.85rem;
  transition: color 0.15s;
}
.footer-links a:hover { color: var(--text); }

/* ── Admin Table ── */
.admin-table {
  width: 100%;
  border-collapse: collapse;
}
.admin-table th,
.admin-table td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}
.admin-table th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg);
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: rgba(255,255,255,0.02); }

/* ── Toast ── */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Divider ── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

/* ── Section headers ── */
.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}
.section-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 32px;
}

/* ── Hero ── */
.hero {
  padding: 80px 24px 60px;
  max-width: 1200px;
  margin: 0 auto;
}
.hero-title {
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.04em;
  margin-bottom: 20px;
  max-width: 680px;
}
.hero-sub {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 36px;
  max-width: 520px;
  line-height: 1.7;
}
.hero-btns {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ── Steps ── */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px;
}
.step-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 24px;
}
.step-num {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-muted);
  line-height: 1;
  margin-bottom: 12px;
}
.step-title {
  font-weight: 600;
  margin-bottom: 8px;
}
.step-desc {
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.6;
}

/* ── Features list ── */
.feature-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.feature-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
}
.feature-list li::before {
  content: "✓";
  color: var(--correct);
  font-weight: 700;
  flex-shrink: 0;
}

/* ── Pricing ── */
.pricing-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  max-width: 400px;
  margin: 0 auto;
  text-align: center;
}
.pricing-price {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  margin: 16px 0 8px;
}
.pricing-period {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 28px;
}

/* ── Fixed nav buttons ── */
.nav-buttons {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px 32px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
}

/* ── Timer ── */
.timer {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-muted);
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.timer.warning { color: var(--wrong); border-color: var(--wrong); }

/* ── Question layout ── */
.test-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: start;
}
.test-image-wrap {
  position: sticky;
  top: 80px;
}
.test-image-wrap img {
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--border);
  aspect-ratio: 16/9;
  object-fit: cover;
  background: #000;
  display: block;
  box-shadow: 0 4px 20px rgba(0,0,0,0.18);
}
.test-image-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.88rem;
}

/* ── Stats strip ── */
.stats-strip {
  display: flex;
  gap: 32px;
  padding: 20px 0;
}
.stat-item { text-align: center; }
.stat-num {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}
.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 10px 16px;
  font-size: 0.9rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-family: inherit;
  transition: color 0.15s, border-color 0.15s;
}
.tab-btn.active {
  color: var(--text);
  border-bottom-color: var(--text);
}
.tab-btn:hover:not(.active) { color: var(--text); }

/* ── Accordion (FAQ) ── */
.accordion-item {
  border-bottom: 1px solid var(--border);
}
.accordion-btn {
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  padding: 18px 0;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.accordion-icon {
  font-size: 1rem;
  color: var(--text-muted);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.accordion-btn.open .accordion-icon { transform: rotate(45deg); }
.accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
}
.accordion-body-inner {
  padding-bottom: 18px;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.7;
}

/* ── Media queries ── */
@media (max-width: 768px) {
  .page { padding: 24px 16px; }
  .hero { padding: 48px 16px 36px; }
  .hero-title { font-size: 2rem; }
  .hero-btns { flex-direction: column; }
  .hero-btns .btn-primary,
  .hero-btns .btn-ghost { width: 100%; justify-content: center; }
  .test-layout { grid-template-columns: 1fr; }
  .test-image-wrap { position: static; }
  .steps-grid { grid-template-columns: 1fr; }
  .tests-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .stats-strip { gap: 16px; flex-wrap: wrap; }
  .pricing-card { padding: 28px 20px; }
  .admin-table th, .admin-table td,
  .history-table th, .history-table td { padding: 10px 12px; }
  .nav-inner { padding: 0 16px; }
  .modal { margin: 16px; padding: 24px 20px; }
}

@media (max-width: 480px) {
  .tests-grid { grid-template-columns: 1fr 1fr; }
  .results-score { font-size: 3rem; }
}

/* ── Animations ── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInFast {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.page { animation: fadeIn 0.3s ease both; }

/* Theme color transitions — applied first so specific rules below can override/extend */
body, nav, .sb, .modal, input, textarea, select {
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

/* Cards */
.card {
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.15s ease;
}

/* Buttons */
.btn-primary, .btn-ghost {
  transition: opacity 0.12s ease, background-color 0.15s ease,
              color 0.15s ease, border-color 0.15s ease;
}
.btn-primary:hover { opacity: 0.9; }

.answer-option {
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.result-card {
  transition: opacity 0.15s ease;
}


@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Custom div checkboxes ── */
.answer-checkbox {
  width: 22px;
  height: 22px;
  min-width: 22px;
  border: 2px solid #d1d5db;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s ease;
  background: var(--bg-card);
}
.answer-option.selected .answer-checkbox {
  background: #111827;
  border-color: #111827;
}
.answer-option.selected .answer-checkbox::after {
  content: '';
  width: 13px;
  height: 13px;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6.5 11.5L2.5 7.5L3.91 6.09L6.5 8.67L12.09 3.08L13.5 4.5L6.5 11.5Z'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}
.answer-option.correct .answer-checkbox {
  background: #16a34a;
  border-color: #16a34a;
}
.answer-option.correct .answer-checkbox::after {
  content: '';
  width: 13px;
  height: 13px;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6.5 11.5L2.5 7.5L3.91 6.09L6.5 8.67L12.09 3.08L13.5 4.5L6.5 11.5Z'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}
.answer-option.wrong .answer-checkbox,
.answer-option.incorrect .answer-checkbox {
  background: #dc2626;
  border-color: #dc2626;
}
.answer-option.wrong .answer-checkbox::after,
.answer-option.incorrect .answer-checkbox::after {
  content: '';
  width: 13px;
  height: 13px;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 4l8 8M12 4l-8 8' stroke='white' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

/* ── Wide modal ── */
.modal-wide { max-width: 860px !important; }
@media (max-width: 900px) { .modal-wide { max-width: calc(100vw - 32px) !important; } }

/* ── Bookmark button ── */
.bookmark-btn {
  position: absolute;
  top: 0;
  right: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: color 0.15s, opacity 0.15s;
  border-radius: 4px;
  opacity: 0.45;
}
.bookmark-btn:hover { color: var(--text); opacity: 0.75; }
.bookmark-btn.active { color: var(--text); opacity: 1; }
@keyframes bookmarkPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.35); }
  70%  { transform: scale(0.9); }
  100% { transform: scale(1); }
}
.bookmark-btn.pop { animation: bookmarkPop 0.3s ease both; }

/* ── Dashboard test card stagger ── */
@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.tests-grid .test-card { animation: cardIn 0.35s ease both; }
.tests-grid .test-card:nth-child(1)  { animation-delay: 0.03s; }
.tests-grid .test-card:nth-child(2)  { animation-delay: 0.06s; }
.tests-grid .test-card:nth-child(3)  { animation-delay: 0.09s; }
.tests-grid .test-card:nth-child(4)  { animation-delay: 0.12s; }
.tests-grid .test-card:nth-child(5)  { animation-delay: 0.15s; }
.tests-grid .test-card:nth-child(6)  { animation-delay: 0.18s; }
.tests-grid .test-card:nth-child(7)  { animation-delay: 0.21s; }
.tests-grid .test-card:nth-child(8)  { animation-delay: 0.24s; }
.tests-grid .test-card:nth-child(9)  { animation-delay: 0.27s; }
.tests-grid .test-card:nth-child(10) { animation-delay: 0.30s; }
.tests-grid .test-card:nth-child(11) { animation-delay: 0.33s; }
.tests-grid .test-card:nth-child(12) { animation-delay: 0.36s; }
.tests-grid .test-card:nth-child(13) { animation-delay: 0.39s; }
.tests-grid .test-card-locked { opacity: 0.65; }

/* ── Score counter animation ── */
.score-animated {
  display: inline-block;
  transition: color 0.3s;
}
