/* Brain Freezers Trivia — Shared Styles */
/* Mobile-first, dark theme */

:root {
  --bg-primary: #0a0e1a;
  --bg-card: #111827;
  --bg-card-hover: #1a2236;
  --accent: #00d4ff;
  --accent-dark: #0098bb;
  --accent-glow: rgba(0, 212, 255, 0.15);
  --text-primary: #f0f4ff;
  --text-secondary: #8899bb;
  --text-muted: #556077;
  --border: #1e2d45;
  --border-light: #243550;
  --badge-easy-bg: rgba(34, 197, 94, 0.15);
  --badge-easy-color: #22c55e;
  --badge-medium-bg: rgba(251, 191, 36, 0.15);
  --badge-medium-color: #fbbf24;
  --badge-hard-bg: rgba(239, 68, 68, 0.15);
  --badge-hard-color: #ef4444;
  --font: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  padding: 0 0 80px;
}

/* ── Layout ── */
.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ── Header ── */
.site-header {
  text-align: center;
  padding: 32px 16px 24px;
  border-bottom: 1px solid var(--border);
}

.brand {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.site-header h1 {
  font-size: clamp(22px, 5vw, 32px);
  font-weight: 800;
  line-height: 1.2;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.site-header .subtitle {
  color: var(--text-secondary);
  font-size: 15px;
}

/* ── Nav breadcrumb ── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  padding: 16px 16px 0;
  max-width: 680px;
  margin: 0 auto;
}

.breadcrumb a {
  color: var(--accent);
  text-decoration: none;
}

.breadcrumb a:hover { text-decoration: underline; }

/* ── Controls ── */
.controls {
  padding: 24px 0 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ── Pill buttons (category/difficulty) ── */
.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--border-light);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  line-height: 1;
}

.pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
  font-weight: 700;
}

/* ── Count selector ── */
.count-group {
  display: flex;
  gap: 8px;
}

.count-btn {
  width: 52px;
  height: 44px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-light);
  background: transparent;
  color: var(--text-secondary);
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s ease;
}

.count-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.count-btn.active {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Generate button ── */
.btn-generate {
  width: 100%;
  padding: 16px 24px;
  border: none;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #00d4ff 0%, #0098d4 50%, #006fa8 100%);
  color: #000;
  font-size: 17px;
  font-weight: 800;
  font-family: var(--font);
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 20px rgba(0, 212, 255, 0.3);
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-generate:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 28px rgba(0, 212, 255, 0.45);
}

.btn-generate:active {
  transform: translateY(0);
}

/* ── Score tracker ── */
.score-tracker {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(17, 24, 39, 0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 0;
  border-left: none;
  border-right: none;
  padding: 10px 16px;
  margin: 16px -16px 0;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.score-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.score-display {
  font-size: 22px;
  font-weight: 800;
  color: var(--accent);
}

.score-controls {
  display: flex;
  gap: 8px;
}

.score-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--border-light);
  background: transparent;
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  line-height: 1;
}

.score-btn.plus:hover {
  border-color: #22c55e;
  color: #22c55e;
  background: rgba(34, 197, 94, 0.1);
}

.score-btn.minus:hover {
  border-color: #ef4444;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.score-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ── Question cards ── */
#questions-output {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.question-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.2s ease;
  animation: cardIn 0.3s ease forwards;
}

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

.question-card:hover {
  border-color: var(--border-light);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.q-number {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.badge {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.badge-easy {
  background: var(--badge-easy-bg);
  color: var(--badge-easy-color);
}

.badge-medium {
  background: var(--badge-medium-bg);
  color: var(--badge-medium-color);
}

.badge-hard {
  background: var(--badge-hard-bg);
  color: var(--badge-hard-color);
}

.badge-category {
  background: rgba(0, 212, 255, 0.1);
  color: var(--accent);
}

.question-text {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.btn-reveal {
  width: 100%;
  padding: 10px 16px;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-reveal:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}

.btn-reveal.revealed {
  border-color: #22c55e;
  color: #22c55e;
  background: rgba(34, 197, 94, 0.05);
}

.answer-area {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, opacity 0.3s ease, margin 0.3s ease;
  opacity: 0;
  margin-top: 0;
}

.answer-area.open {
  max-height: 200px;
  opacity: 1;
  margin-top: 12px;
}

.answer-inner {
  background: rgba(0, 212, 255, 0.06);
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.answer-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 4px;
}

.answer-text {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

/* ── Action bar ── */
/* ── Sticky action bar ── */
.action-bar {
  position: sticky;
  bottom: 0;
  z-index: 100;
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  margin: 0 -16px;
  background: rgba(10, 14, 26, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1.5px solid var(--border);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.5);
  flex-wrap: nowrap;
}

.action-bar .btn-action {
  flex: 1;
  min-width: 0;
  padding: 11px 10px;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
  white-space: nowrap;
}

.action-bar .btn-action:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}

.btn-new {
  flex: 2 !important;
  background: var(--accent-glow) !important;
  border-color: var(--accent) !important;
  color: var(--accent) !important;
}

/* ── Empty/loading states ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.6;
}

.empty-state p {
  font-size: 15px;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  box-shadow: var(--shadow);
  transition: transform 0.3s ease;
  z-index: 1000;
  white-space: nowrap;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* ── CTA ── */
.cta-section {
  margin-top: 48px;
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.08) 0%, rgba(0, 150, 200, 0.05) 100%);
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
}

.cta-section h2 {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 8px;
}

.cta-section p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 18px;
}

.btn-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--accent);
  color: #000;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-cta:hover {
  background: #33ddff;
  transform: translateY(-1px);
}

/* ── FAQ ── */
.faq-section {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.faq-section h2 {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  overflow: hidden;
}

.faq-question {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-card);
  border: none;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font);
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  transition: background 0.15s;
}

.faq-question:hover {
  background: var(--bg-card-hover);
}

.faq-arrow {
  color: var(--accent);
  font-size: 12px;
  transition: transform 0.25s ease;
  flex-shrink: 0;
}

.faq-item.open .faq-arrow {
  transform: rotate(180deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.faq-item.open .faq-answer {
  max-height: 300px;
}

.faq-answer-inner {
  padding: 14px 16px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.7;
  border-top: 1px solid var(--border);
}

/* ── Category grid (index page) ── */
.category-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 32px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.cat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.2s ease;
  text-align: center;
}

.cat-card:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.cat-icon {
  font-size: 32px;
}

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

.cat-count {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Footer ── */
.site-footer {
  margin-top: 64px;
  padding: 24px 16px;
  text-align: center;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
}

.site-footer a {
  color: var(--accent);
  text-decoration: none;
}

/* ── Print styles ── */
@media print {
  body {
    background: #fff;
    color: #000;
  }

  .controls, .action-bar, .score-tracker,
  .btn-reveal, .cta-section, .site-footer,
  .btn-generate { display: none !important; }

  .question-card {
    background: #fff;
    border: 1px solid #ccc;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .answer-area { max-height: 200px !important; opacity: 1 !important; }
}

/* ── Responsive tweaks ── */
@media (min-width: 480px) {
  .category-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .action-bar {
    flex-wrap: nowrap;
  }
}

@media (min-width: 640px) {
  body { padding-bottom: 40px; }
  .site-header { padding: 40px 16px 28px; }
}
