/* Brain Freezers Trivia — Redesign 2.0 */
/* Single-screen app: nothing requires scrolling */

:root {
  --bg:        #080c18;
  --bg-card:   #0f1623;
  --bg-panel:  #0d1420;
  --accent:    #00d4ff;
  --accent2:   #0098d4;
  --accent3:   #006fa8;
  --glow:      rgba(0, 212, 255, 0.18);
  --glow-sm:   rgba(0, 212, 255, 0.08);
  --text:      #eef2ff;
  --text-2:    #7a90b8;
  --text-3:    #3f5070;
  --border:    #162032;
  --border-2:  #1e2f45;
  --green:     #22c55e;
  --green-bg:  rgba(34,197,94,0.12);
  --yellow:    #fbbf24;
  --yellow-bg: rgba(251,191,36,0.12);
  --red:       #ef4444;
  --red-bg:    rgba(239,68,68,0.12);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --r:   10px;
  --r-sm: 7px;
}

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

html { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ─── HEADER ─────────────────────────────────────────────── */
.app-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 16px 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(0,212,255,0.08) 0%, transparent 100%);
  flex-shrink: 0;
  text-align: center;
  gap: 12px;
}

.logo-img {
  width: 180px;
  height: 180px;
  border-radius: 36px;
  object-fit: contain;
  box-shadow: 0 12px 48px rgba(0,212,255,0.3), 0 4px 16px rgba(0,0,0,0.5);
}

.brand-name {
  font-size: 36px;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1;
}

.brand-name em {
  color: var(--accent);
  font-style: normal;
}

.brand-tag {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  line-height: 1;
}

/* ─── CONTROLS PANEL ─────────────────────────────────────── */
.controls-wrapper {
  width: 100%;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.controls-panel {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
}

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

.ctrl-tag {
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  flex-shrink: 0;
  width: 28px;
}

/* Horizontally scrolling pill row */
.pill-scroll {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}

.pill {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1.5px solid var(--border-2);
  background: transparent;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.12s;
  flex-shrink: 0;
  min-height: 32px;
  display: flex;
  align-items: center;
}

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

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

/* Count row */
.count-group {
  display: flex;
  gap: 5px;
  flex: 1;
  align-items: center;
}

.count-btn {
  height: 36px;
  min-width: 34px;
  padding: 0 6px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border-2);
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.12s;
  flex-shrink: 0;
}

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

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

/* Custom count input */
.count-input {
  height: 36px;
  width: 72px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border-2);
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font);
  text-align: center;
  padding: 0 6px;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  -moz-appearance: textfield;
}
.count-input::-webkit-inner-spin-button,
.count-input::-webkit-outer-spin-button { -webkit-appearance: none; }
.count-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--glow-sm);
}
.count-input.has-value {
  border-color: var(--accent);
  background: var(--glow-sm);
  color: var(--accent);
}
.count-input::placeholder { color: var(--text-3); }

/* Generate button — same width as pill-scroll (flex:1 after ctrl-tag) */
.btn-generate {
  flex: 1;
  height: 44px;
  border: none;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, #00d4ff 0%, #0098d4 55%, #006fa8 100%);
  color: #000;
  font-size: 15px;
  font-weight: 900;
  font-family: var(--font);
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: all 0.18s;
  box-shadow: 0 4px 18px rgba(0,212,255,0.32);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

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

/* ─── QUESTION ARENA ─────────────────────────────────────── */
.question-arena {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 16px;
  min-height: 0;
  width: 100%;
}

.q-card,
.empty-state {
  width: 100%;
  max-width: 520px;
}

/* Empty state */
.empty-state {
  text-align: center;
  color: var(--text-3);
  padding: 20px 0;
}

.empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 15px; }

/* Question card */
.q-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: fadeUp 0.25s ease;
}

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

.q-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.q-progress {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  margin-right: auto;
}

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

.badge-easy   { background: var(--green-bg);  color: var(--green);  }
.badge-medium { background: var(--yellow-bg); color: var(--yellow); }
.badge-hard   { background: var(--red-bg);    color: var(--red);    }
.badge-cat    { background: var(--glow-sm);   color: var(--accent); }

/* The question text — hero element */
.q-text {
  font-size: clamp(17px, 4.5vw, 22px);
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
  min-height: 56px;
}

/* Reveal button */
.btn-reveal {
  width: 100%;
  height: 48px;
  border: 2px solid var(--border-2);
  border-radius: var(--r);
  background: transparent;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

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

.btn-reveal.revealed {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-bg);
}

/* Answer box */
.answer-box {
  background: var(--glow-sm);
  border: 1.5px solid rgba(0,212,255,0.22);
  border-radius: var(--r);
  padding: 12px 16px;
  text-align: center;
  animation: fadeUp 0.2s ease;
}

.answer-label {
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 6px;
}

.answer-text {
  font-size: clamp(18px, 5vw, 26px);
  font-weight: 900;
  color: var(--text);
  line-height: 1.2;
}

/* Navigation row */
.q-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-btn {
  padding: 0 16px;
  height: 44px;
  border: 1.5px solid var(--border-2);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.nav-btn:disabled { opacity: 0.25; cursor: default; }

.nav-btn.btn-next {
  background: var(--glow-sm);
  border-color: var(--accent);
  color: var(--accent);
}

/* Inline score */
.score-inline {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.score-num {
  font-size: 16px;
  font-weight: 900;
  color: var(--accent);
  min-width: 44px;
  text-align: center;
}

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

.score-btn.plus:hover  { border-color: var(--green); color: var(--green); background: var(--green-bg); }
.score-btn.minus:hover { border-color: var(--red);   color: var(--red);   background: var(--red-bg);   }
.score-btn:disabled { opacity: 0.25; cursor: default; }

/* ─── STICKY ACTION BAR ──────────────────────────────────── */
.action-bar {
  position: -webkit-sticky;
  position: sticky;
  bottom: 0;
  z-index: 100;
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(8,12,24,0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1.5px solid var(--border-2);
  box-shadow: 0 -6px 28px rgba(0,0,0,0.6);
  flex-shrink: 0;
}

.btn-action {
  flex: 1;
  min-width: 0;
  height: 44px;
  border: 1.5px solid var(--border-2);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.12s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
}

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

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

/* ─── TOAST ──────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(60px);
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: var(--r-sm);
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  transition: transform 0.25s ease;
  z-index: 200;
  white-space: nowrap;
  pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ─── BELOW-FOLD SEO CONTENT ─────────────────────────────── */
.below-fold {
  padding: 32px 16px 80px;
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
}

.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}

/* Category grid */
.section-title {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 16px;
  color: var(--text);
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.cat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  text-decoration: none;
  color: var(--text);
  transition: all 0.18s;
  text-align: center;
}
.cat-card:hover { border-color: var(--accent); background: #111e30; transform: translateY(-2px); }
.cat-icon { font-size: 26px; }
.cat-name { font-size: 12px; font-weight: 700; }

/* FAQ */
.faq-section { margin-top: 32px; }
.faq-item { border: 1px solid var(--border); border-radius: var(--r-sm); margin-bottom: 8px; overflow: hidden; }

.faq-question {
  width: 100%; padding: 13px 16px;
  background: var(--bg-card); border: none;
  color: var(--text); font-size: 14px; 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.12s;
}
.faq-question:hover { background: #111e30; }
.faq-arrow { color: var(--accent); font-size: 11px; transition: transform 0.22s; flex-shrink: 0; }
.faq-item.open .faq-arrow { transform: rotate(180deg); }
.faq-answer { max-height: 0; overflow: hidden; transition: max-height 0.28s ease; }
.faq-item.open .faq-answer { max-height: 300px; }
.faq-answer-inner { padding: 13px 16px; color: var(--text-2); font-size: 13px; line-height: 1.7; border-top: 1px solid var(--border); }

/* CTA */
.cta-section {
  margin-top: 32px;
  background: linear-gradient(135deg, var(--glow-sm) 0%, transparent 100%);
  border: 1px solid rgba(0,212,255,0.15);
  border-radius: var(--r);
  padding: 24px;
  text-align: center;
}
.cta-section h2 { font-size: 18px; font-weight: 800; margin-bottom: 8px; }
.cta-section p  { color: var(--text-2); font-size: 13px; margin-bottom: 16px; }
.btn-cta {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 22px; background: var(--accent); color: #000;
  font-size: 14px; font-weight: 800; font-family: var(--font);
  border: none; border-radius: var(--r-sm); cursor: pointer;
  text-decoration: none; transition: all 0.18s;
}
.btn-cta:hover { background: #33ddff; transform: translateY(-1px); }

/* Footer */
.site-footer {
  padding: 20px 16px;
  text-align: center;
  border-top: 1px solid var(--border);
  color: var(--text-3);
  font-size: 12px;
}
.site-footer a { color: var(--accent); text-decoration: none; }

/* Breadcrumb (category pages) */
.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-3);
  padding: 8px 16px 0;
}
.breadcrumb a { color: var(--accent); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* ─── AD SLOTS ───────────────────────────────────────────── */
.ad-slot {
  width: 100%;
  text-align: center;
  min-height: 0; /* collapse when empty */
  overflow: hidden;
}

/* ─── PRINT ──────────────────────────────────────────────── */
@media print {
  body { background: #fff; color: #000; }
  .app-header, .controls-panel, .action-bar, .btn-reveal,
  .q-nav, .cta-section, .site-footer, .btn-generate { display: none !important; }
  .q-text { font-size: 16px; }
  .answer-box { border: 1px solid #ccc; background: #f9f9f9; }
  .answer-text { color: #000; }
}

/* ─── DESKTOP POLISH ─────────────────────────────────────── */
@media (min-width: 600px) {
  .app-header { padding: 12px 24px; }
  .controls-panel { padding: 12px 24px; }
  .question-arena { padding: 24px 24px 12px; }
  .action-bar { padding: 12px 24px; padding-bottom: calc(12px + env(safe-area-inset-bottom,0px)); }
  .q-text { font-size: 22px; }
  .brand-name { font-size: 18px; }
}

@media (min-width: 680px) {
  body { max-width: 680px; margin: 0 auto; }
  body::before { display: none; }
}
