:root {
  --bg: #0c0f1a;
  --surface: #111827;
  --border: #1e293b;
  --text: #e2e8f0;
  --text-muted: #64748b;
  --text-dim: #475569;
  --blue: #3b82f6;
  --blue-light: #60a5fa;
  --green: #10b981;
  --red: #ef4444;
  --yellow: #f59e0b;
  --orange: #f97316;
  --purple: #8b5cf6;
  --pink: #ec4899;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', emoji, sans-serif;
  --font-mono: 'SF Mono', 'Cascadia Code', 'JetBrains Mono', ui-monospace, monospace;
  --transition: 200ms ease;
  --glow-blue: rgba(59, 130, 246, 0.15);
  --glow-purple: rgba(139, 92, 246, 0.12);
}

[data-theme="light"] {
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --blue: #2563eb;
  --blue-light: #3b82f6;
  --green: #10b981;
  --red: #ef4444;
  --yellow: #f59e0b;
  --orange: #f97316;
  --glow-blue: rgba(37, 99, 235, 0.08);
  --glow-purple: rgba(139, 92, 246, 0.06);
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  padding: 88px 20px 20px;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

a {
  color: var(--blue-light);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ─── Ambient Background Glow ─── */

.bg-glow {
  position: fixed;
  top: -40vh;
  left: -20vw;
  width: 60vw;
  height: 60vh;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow-blue) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  animation: glowFloat 12s ease-in-out infinite alternate;
}

.bg-glow-2 {
  top: auto;
  bottom: -30vh;
  left: auto;
  right: -10vw;
  width: 50vw;
  height: 50vh;
  background: radial-gradient(circle, var(--glow-purple) 0%, transparent 70%);
  animation-delay: -6s;
}

@keyframes glowFloat {
  0% { transform: translate(0, 0) scale(1); opacity: 0.6; }
  100% { transform: translate(5%, 5%) scale(1.15); opacity: 1; }
}

/* ─── Nav Bar ─── */

.nav-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  background: rgba(12, 15, 26, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

[data-theme="light"] .nav-bar {
  background: rgba(248, 250, 252, 0.82);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.nav-logo {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.nav-brand:hover {
  text-decoration: none;
  color: var(--blue-light);
}

.nav-back {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius);
  transition: all var(--transition);
}

.nav-back:hover {
  color: var(--blue-light);
  background: rgba(59, 130, 246, 0.1);
  text-decoration: none;
}

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

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 0;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  color: var(--text-muted);
  transition: all var(--transition);
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  color: var(--blue-light);
  background: rgba(59, 130, 246, 0.1);
}

/* ─── Hero Section ─── */

.hero {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 48px 0 40px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 100px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(139, 92, 246, 0.12));
  border: 1px solid rgba(59, 130, 246, 0.15);
  color: var(--blue-light);
  margin-bottom: 20px;
  letter-spacing: 0.3px;
  animation: fadeInUp 0.6s ease both;
}

.hero-title {
  font-size: 44px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
  animation: fadeInUp 0.6s 0.1s ease both;
}

.hero-title-line {
  display: block;
}

.hero-title-gradient {
  background: linear-gradient(135deg, var(--blue-light), var(--purple), var(--pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 16px;
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 auto 36px;
  line-height: 1.7;
  animation: fadeInUp 0.6s 0.2s ease both;
}

.hero-subtitle strong {
  color: var(--text);
  font-weight: 600;
}

.hero-subtitle-accent {
  display: block;
  margin-top: 4px;
  font-size: 14px;
  color: var(--green);
  font-weight: 500;
}

/* ─── Hero Stats ─── */

.hero-stats {
  display: inline-flex;
  align-items: center;
  gap: 28px;
  padding: 20px 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  animation: fadeInUp 0.6s 0.3s ease both;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.hero-stats:hover {
  border-color: rgba(59, 130, 246, 0.2);
  box-shadow: 0 0 30px rgba(59, 130, 246, 0.06);
}

.hero-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.hero-stat-value {
  font-size: 28px;
  font-weight: 800;
  font-family: var(--font-mono);
  background: linear-gradient(135deg, var(--blue-light), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.hero-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 500;
}

.hero-stat-divider {
  width: 1px;
  height: 36px;
  background: var(--border);
}

/* ─── Search & Filter ─── */

.search-section {
  position: relative;
  z-index: 1;
  margin-bottom: 24px;
  animation: fadeInUp 0.6s 0.4s ease both;
}

.search-container {
  margin-bottom: 12px;
}

.search-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-input::placeholder {
  color: var(--text-dim);
}

.search-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

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

.sort-container {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.sort-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.sort-select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font);
  padding: 7px 28px 7px 12px;
  border-radius: 8px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3e%3cpath fill='none' stroke='%2394a3b8' stroke-width='1.5' d='M1 1l4 4 4-4'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.sort-select:hover {
  border-color: var(--text-dim);
}

.sort-select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.filter-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  font-size: 12px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font);
}

.chip:hover {
  border-color: var(--text-dim);
  color: var(--text);
}

.chip-active {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.3);
  color: var(--blue-light);
}

/* ─── Cards Grid (Catalog) ─── */

.cards-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.catalog-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px);
}

.catalog-card.visible {
  opacity: 1;
  transform: translateY(0);
}

.catalog-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.03), rgba(139, 92, 246, 0.03));
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.catalog-card:hover {
  border-color: rgba(59, 130, 246, 0.3);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2), 0 0 30px rgba(59, 130, 246, 0.05);
}

.catalog-card:hover::before {
  opacity: 1;
}

.catalog-card:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

[data-theme="light"] .catalog-card:hover {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.06), 0 0 30px rgba(59, 130, 246, 0.04);
}

.card-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 12px;
}

.card-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: rgba(255, 255, 255, 0.04);
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.catalog-card:hover .card-icon-wrap {
  transform: scale(1.05);
}

.card-icon-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius);
  display: block;
}

.header-icon-img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: var(--radius);
  display: block;
  margin: 0 auto;
}

@media (max-width: 600px) {
  .header-icon {
    margin-top: 8px;
  }
}

/* ─── Card Preview (description overlay on hover) ─── */

.card-preview {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px 20px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0) 0%, rgba(15, 23, 42, 0.95) 30%, rgba(15, 23, 42, 0.98) 100%);
  color: var(--text);
  font-size: 12px;
  line-height: 1.5;
  font-weight: 500;
  border-top: 1px solid rgba(59, 130, 246, 0.2);
  opacity: 0;
  transform: translateY(100%);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2;
}

.catalog-card:hover .card-preview {
  opacity: 1;
  transform: translateY(0);
}

[data-theme="light"] .card-preview {
  background: linear-gradient(180deg, rgba(248, 250, 252, 0) 0%, rgba(248, 250, 252, 0.97) 30%, rgba(248, 250, 252, 0.99) 100%);
  border-top-color: rgba(59, 130, 246, 0.25);
}

/* Mobile: tap to reveal preview (no hover on touch) */
@media (hover: none) {
  .card-preview {
    opacity: 1;
    transform: translateY(0);
    position: static;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-top: none;
    padding: 8px 0 0;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 400;
    font-style: italic;
  }
}

.card-title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 2px;
  letter-spacing: -0.01em;
}

.card-subtitle {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.4;
}

.card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.card-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  letter-spacing: 0.2px;
  text-transform: uppercase;
  min-height: 22px;
  display: inline-flex;
  align-items: center;
}

.card-tag-blue {
  background: rgba(59, 130, 246, 0.1);
  color: var(--blue-light);
}

.card-tag-green {
  background: rgba(16, 185, 129, 0.1);
  color: var(--green);
}

.card-tag-purple {
  background: rgba(139, 92, 246, 0.1);
  color: var(--purple);
}

.card-tag-orange {
  background: rgba(249, 115, 22, 0.1);
  color: var(--orange);
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.card-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-dim);
}

.card-meta-item .meta-icon {
  font-size: 12px;
  flex-shrink: 0;
}

.card-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 8px 20px;
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  min-height: 36px;
}

.card-btn:hover {
  background: rgba(59, 130, 246, 0.1);
  border-color: var(--blue);
  color: var(--blue-light);
}

.card-btn-arrow {
  transition: transform var(--transition);
}

.card-btn:hover .card-btn-arrow {
  transform: translateX(2px);
}

/* Recently Taken Badge */
.card-recent-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 100px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: var(--green);
  letter-spacing: 0.2px;
  animation: fadeIn 0.3s ease both;
}

/* Card Staggered Entrance */
@keyframes cardEnter {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.empty-search {
  text-align: center;
  padding: 64px 20px;
  color: var(--text-muted);
  font-size: 16px;
  grid-column: 1 / -1;
  animation: fadeInUp 0.4s ease both;
}

/* ─── Partial Results ─── */

.partial-results {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.partial-label {
  font-size: 14px;
  color: var(--text-muted);
}

.partial-score {
  font-size: 24px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.partial-grade {
  display: inline-block;
  font-size: 28px;
  font-weight: 900;
  margin-left: 8px;
}

/* ─── Share Button ─── */

.btn-share {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: var(--blue-light);
}

.btn-share:hover {
  background: rgba(59, 130, 246, 0.2);
}

/* ─── History ─── */

.history-section {
  margin-top: 16px;
  text-align: left;
}

.history-toggle {
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition);
  font-family: var(--font);
}

.history-toggle:hover {
  color: var(--blue-light);
  border-color: var(--blue);
}

.history-list {
  margin-top: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-muted);
}

.history-item:nth-child(odd) {
  background: rgba(255, 255, 255, 0.02);
}

[data-theme="light"] .history-item:nth-child(odd) {
  background: rgba(0, 0, 0, 0.02);
}

.history-item-grade {
  font-weight: 700;
  font-size: 15px;
  font-family: var(--font-mono);
}

.history-item-empty {
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  padding: 12px;
}

.container {
  max-width: 820px;
  margin: 0 auto;
  position: relative;
}

/* ─── Header (assessment page) ─── */

.header {
  text-align: center;
  padding: 40px 0 32px;
}

.header-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.header h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}

.header p {
  color: var(--text-muted);
  font-size: 15px;
}

/* ─── Back Link ─── */

.back-link {
  display: inline-block;
  padding: 16px 0;
  color: var(--text-muted);
  font-size: 14px;
}

.back-link:hover {
  color: var(--blue-light);
}

/* ─── Stats Bar ─── */

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

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 2px;
  line-height: 1.2;
}

.stat-sub {
  font-size: 11px;
  color: var(--text-dim);
}

/* ─── Progress Bar ─── */

.progress-container {
  margin-bottom: 24px;
}

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

.progress-label {
  font-size: 14px;
  font-weight: 500;
}

.progress-count {
  font-size: 13px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--blue-light));
  border-radius: var(--radius-sm);
  transition: width 0.4s ease;
}

/* ─── Category Sections ─── */

.category-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 16px;
}

.category-header {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
}

.category-header:hover {
  background: rgba(255, 255, 255, 0.02);
}

.cat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: rgba(255, 255, 255, 0.04);
  flex-shrink: 0;
  margin-right: 14px;
}

.cat-info {
  flex: 1;
  min-width: 0;
}

.cat-name {
  font-size: 16px;
  font-weight: 600;
}

.cat-weight {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}

.cat-score {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
  margin-right: 12px;
  font-family: var(--font-mono);
  white-space: nowrap;
}

.cat-chevron {
  font-size: 14px;
  color: var(--text-dim);
  transition: transform 0.3s ease;
  flex-shrink: 0;
}

.cat-chevron.open {
  transform: rotate(180deg);
}

.category-body {
  padding: 0 20px 20px;
}

/* ─── Questions ─── */

.question-item {
  padding: 16px 0;
  border-top: 1px solid var(--border);
}

.question-item:first-child {
  border-top: none;
}

.question-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}

.question-badge {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.question-text {
  font-size: 14px;
  line-height: 1.5;
  padding-top: 5px;
}

/* ─── Rating Buttons ─── */

.rating-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-left: 42px;
}

.rating-label {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
}

.rating-label-left {
  text-align: left;
}

.rating-label-right {
  text-align: right;
}

.rating-buttons {
  display: flex;
  gap: 8px;
}

.rating-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #0f1825;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16,1,0.3,1);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

[data-theme="light"] .rating-btn {
  background: #f1f5f9;
  color: #64748b;
}

.rating-btn:hover {
  border-color: var(--blue);
  color: var(--blue-light);
  transform: scale(1.08);
  z-index: 1;
}

.rating-btn.selected-1 {
  border-color: var(--red);
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

[data-theme="light"] .rating-btn.selected-1 {
  background: rgba(239, 68, 68, 0.08);
  color: #b91c1c;
}

.rating-btn.selected-2 {
  border-color: var(--orange);
  background: rgba(249, 115, 22, 0.15);
  color: #fdba74;
}

[data-theme="light"] .rating-btn.selected-2 {
  background: rgba(249, 115, 22, 0.08);
  color: #c2410c;
}

.rating-btn.selected-3 {
  border-color: var(--yellow);
  background: rgba(234, 179, 8, 0.15);
  color: #fde68a;
}

[data-theme="light"] .rating-btn.selected-3 {
  background: rgba(234, 179, 8, 0.08);
  color: #a16207;
}

.rating-btn.selected-4 {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
}

[data-theme="light"] .rating-btn.selected-4 {
  background: rgba(34, 197, 94, 0.08);
  color: #15803d;
}

.rating-btn.selected-5 {
  border-color: var(--green);
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
}

[data-theme="light"] .rating-btn.selected-5 {
  background: rgba(16, 185, 129, 0.08);
  color: #0f766e;
}

/* ─── Results Card ─── */

.results-section {
  margin-bottom: 32px;
}

.results-card {
  background: linear-gradient(135deg, #111827 0%, #1a2744 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px 28px;
  text-align: center;
}

[data-theme="light"] .results-card {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
}

.results-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
}

.results-grade {
  font-size: 72px;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 8px;
}

.results-label {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 12px;
}

.results-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 500px;
  margin: 0 auto 24px;
}

.results-breakdown {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 24px;
  text-align: left;
}

.breakdown-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  padding: 14px;
}

[data-theme="light"] .breakdown-item {
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

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

.breakdown-name {
  font-size: 13px;
  font-weight: 500;
}

.breakdown-score {
  font-size: 13px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.breakdown-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
}

[data-theme="light"] .breakdown-bar {
  background: rgba(0, 0, 0, 0.06);
}

.breakdown-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

.results-probability {
  margin-bottom: 20px;
}

.prob-badge {
  display: inline-block;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius);
  padding: 10px 20px;
  font-size: 14px;
  color: var(--blue-light);
}

/* ─── Buttons ─── */

.btn-group {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  padding: 10px 24px;
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid var(--border);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--red);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

.btn-secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}

.btn-secondary:hover {
  border-color: var(--text-dim);
  color: var(--text);
}

/* ─── Footer ─── */

.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 48px 0 24px;
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.footer-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.footer-logo {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.footer-links {
  font-size: 12px;
  color: var(--text-dim);
}

.footer-dot {
  margin: 0 6px;
  color: var(--border);
}

.footer-tech {
  font-size: 11px;
  color: var(--text-dim);
  opacity: 0.6;
  margin-top: 4px;
}

/* ─── Toast Notification ─── */

.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 13px;
  color: var(--text);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  pointer-events: auto;
  animation: toastIn 0.3s ease, toastOut 0.3s 2.5s ease forwards;
}

[data-theme="light"] .toast {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(16px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(16px) scale(0.95); }
}

/* ─── Error State ─── */

.error-section {
  text-align: center;
  padding: 60px 20px;
}

.error-icon {
  font-size: 64px;
  margin-bottom: 16px;
}

.error-title {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 8px;
}

.error-desc {
  color: var(--text-muted);
  margin-bottom: 20px;
}

.error-link {
  display: inline-block;
  padding: 10px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--blue-light);
  font-size: 14px;
  transition: border-color var(--transition);
}

.error-link:hover {
  border-color: var(--blue);
  text-decoration: none;
}

/* ─── 404 Page ─── */

.not-found {
  text-align: center;
  padding: 80px 20px;
}

.not-found h1 {
  font-size: 96px;
  font-weight: 900;
  color: var(--text-dim);
  line-height: 1;
  margin-bottom: 12px;
}

.not-found p {
  color: var(--text-muted);
  margin-bottom: 24px;
}

.not-found a {
  display: inline-block;
  padding: 10px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--blue-light);
  font-size: 14px;
}

/* ─── Assessment Header (dynamic) ─── */

.assessment-header .header-icon {
  font-size: 48px;
  margin-bottom: 8px;
}

.assessment-header h1 {
  font-size: 24px;
  font-weight: 700;
}

.assessment-header .header-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 4px;
}

.assessment-header .header-footer {
  color: var(--text-dim);
  font-size: 11px;
  margin-top: 4px;
}

/* ─── Scale Guide ─── */

.scale-guide{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);padding:16px 20px;margin-bottom:20px;display:flex;align-items:center;gap:16px;flex-wrap:wrap;animation:fadeInUp 0.5s 0.2s ease both}
.scale-guide-title{font-size:13px;font-weight:500;color:var(--text-muted);white-space:nowrap}
.scale-guide-items{display:flex;gap:12px;flex-wrap:wrap}
.scale-item{display:flex;align-items:center;gap:4px;font-size:12px;color:var(--text-dim);transition:color var(--transition)}
.scale-item:hover{color:var(--text)}
.scale-num{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:6px;border:1px solid var(--border);font-size:12px;font-weight:600;color:var(--text-muted);background:#0f1825;transition:all var(--transition);flex-shrink:0}
[data-theme="light"] .scale-num{background:var(--surface)}
.scale-item:hover .scale-num{border-color:var(--blue);color:var(--blue-light);background:rgba(59,130,246,0.1)}

/* ─── Assessment Page Entrance ─── */

.assessment-header{animation:fadeInUp 0.5s ease both}
.stats-bar{animation:fadeInUp 0.5s 0.1s ease both}
.progress-container{animation:fadeInUp 0.5s 0.15s ease both}
#categoriesContainer .category-section{animation:fadeInUp 0.4s ease both}

/* ─── Enhanced Stat Cards ─── */

.stat-card-answered .stat-value{color:var(--blue-light)}
.stat-card-score .stat-value{color:var(--text)}
.stat-card-grade .stat-value{color:var(--text)}
.stat-card-prob .stat-value{color:var(--text-muted)}
.stat-card{transition:all 0.3s cubic-bezier(0.16,1,0.3,1);position:relative;overflow:hidden}
.stat-card::before{content:'';position:absolute;inset:0;border-radius:inherit;opacity:0;transition:opacity 0.3s ease;pointer-events:none}
.stat-card:hover{border-color:rgba(59,130,246,0.2);transform:translateY(-2px);box-shadow:0 8px 24px rgba(0,0,0,0.15)}
[data-theme="light"] .stat-card:hover{box-shadow:0 8px 24px rgba(0,0,0,0.05)}

/* ─── Enhanced Progress Bar ─── */

.progress-bar{height:6px;background:var(--border);border-radius:var(--radius-sm);overflow:hidden;position:relative}
.progress-bar-fill{height:100%;background:linear-gradient(90deg,var(--blue),var(--blue-light),var(--purple));border-radius:var(--radius-sm);transition:width 0.5s cubic-bezier(0.16,1,0.3,1);background-size:200% 100%;animation:progressShimmer 3s ease infinite}
@keyframes progressShimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}

/* ─── Category Section Enhancements ─── */

.category-section{transition:all 0.3s cubic-bezier(0.16,1,0.3,1)}
.category-section:hover{border-color:rgba(59,130,246,0.15)}
.category-body{transition:max-height 0.3s cubic-bezier(0.16,1,0.3,1),padding 0.3s ease;overflow:hidden}
.category-body[style*="display: none"]{max-height:0;padding:0 20px 0}
.category-body:not([style*="display: none"]){max-height:5000px}

/* ─── Rating Button Micro-interactions ─── */

.rating-btn{position:relative;transition:all 0.2s cubic-bezier(0.16,1,0.3,1)}
.rating-btn:hover{transform:scale(1.08);border-color:var(--blue);color:var(--blue-light);z-index:1}
.rating-btn:active{transform:scale(0.95)}
.rating-btn.selected-1,.rating-btn.selected-2,.rating-btn.selected-3,.rating-btn.selected-4,.rating-btn.selected-5{transform:scale(1.05);z-index:1;box-shadow:0 0 12px rgba(59,130,246,0.1)}

/* ─── Results Card Glow ─── */

.results-card{position:relative;overflow:hidden;animation:fadeInUp 0.5s ease both}
.results-card::before{content:'';position:absolute;top:-50%;left:-50%;width:200%;height:200%;background:conic-gradient(from 0deg,transparent,rgba(59,130,246,0.03),transparent,rgba(139,92,246,0.03),transparent);animation:resultsGlow 6s linear infinite;pointer-events:none}
@keyframes resultsGlow{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}
.results-card>*{position:relative;z-index:1}

/* ─── Partial Results Enhancement ─── */

.partial-results{animation:fadeInUp 0.3s ease both;transition:all 0.3s ease}

/* ─── History Enhancement ─── */

.history-list{transition:all 0.3s ease}

/* ─── Assessment Footer ─── */

#assessmentFooter{animation:fadeInUp 0.5s 0.3s ease both}

/* ─── Responsive ─── */

@media (max-width: 640px) {
  body {
    padding: 88px 16px 20px;
  }

  .hero {
    padding: 16px 0 24px;
  }

  .hero-badge {
    margin-bottom: 16px;
  }

  .hero-title {
    font-size: 30px;
  }

  .hero-stats {
    gap: 16px;
    padding: 16px 20px;
  }

  .hero-stat-value {
    font-size: 22px;
  }

  .hero-stat-divider {
    height: 28px;
  }

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

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

  .results-breakdown {
    grid-template-columns: 1fr;
  }

  .rating-btn {
    width: 38px;
    height: 38px;
    font-size: 13px;
  }

  .rating-group {
    padding-left: 0;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
  }

  .rating-label {
    display: none;
  }

  .header h1 {
    font-size: 22px;
  }

  .results-card {
    padding: 28px 16px;
  }

  .results-grade {
    font-size: 56px;
  }

  .search-section {
    margin-bottom: 16px;
  }

  .filter-chips {
    gap: 6px;
  }

  .chip {
    font-size: 11px;
    padding: 5px 12px;
  }
}

@media (max-width: 480px) {
  .header {
    padding: 24px 0;
  }

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

  .hero-subtitle {
    font-size: 14px;
  }

  .hero-stats {
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    width: 100%;
  }

  .hero-stat-divider {
    width: 40px;
    height: 1px;
  }

  .category-header {
    padding: 12px 14px;
  }

  .category-body {
    padding: 0 14px 14px;
  }

  .question-text {
    font-size: 13px;
  }

  .rating-buttons {
    gap: 5px;
  }

  .catalog-card {
    padding: 18px;
  }

  .stat-card {
    padding: 12px 8px;
  }

  .stat-value {
    font-size: 20px;
  }

  .card-header {
    gap: 10px;
  }

  .card-icon-wrap {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0s !important;
    animation-duration: 0s !important;
  }

  .catalog-card {
    opacity: 1;
    transform: none;
  }

  .bg-glow {
    animation: none;
  }
}