/* Fast Five Daily Quiz — Sharp & Bright */
:root {
  --primary: #F5B800;
  --primary-glow: rgba(245, 184, 0, 0.18);
  --primary-dim: rgba(245, 184, 0, 0.10);
  --secondary: #7C6BFF;
  --correct: #2DD4A0;
  --incorrect: #FF6B6B;
  --surface: #0A0A0F;
  --surface-raised: #18181F;
  --surface-option: #1E1E28;
  --surface-border: rgba(255, 255, 255, 0.08);
  --text-primary: #F5F5F5;
  --text-secondary: #8A8F9C;
  --relaxed: #5BA8FF;
}

/* Utility classes */
.bg-primary { background-color: var(--primary); }
.text-primary { color: var(--primary); }
.border-primary { border-color: var(--primary); }
.bg-secondary { background-color: var(--secondary); }
.text-secondary { color: var(--secondary); }
.border-secondary { border-color: var(--secondary); }
.bg-correct { background-color: var(--correct); }
.text-correct { color: var(--correct); }
.border-correct { border-color: var(--correct) !important; }
.bg-incorrect { background-color: var(--incorrect); }
.text-incorrect { color: var(--incorrect); }
.border-incorrect { border-color: var(--incorrect) !important; }

.font-luckiest { font-family: 'Luckiest Guy', cursive; }
.bg-dark { background-color: var(--surface-raised); }

/* ---- Play buttons ---- */
.play-btn {
  background: var(--primary);
  color: #000;
  border: none;
  border-bottom: 4px solid rgba(0, 0, 0, 0.25);
  border-radius: 0;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease, border-color 0.15s ease;
  letter-spacing: 0.5px;
  font-weight: 800;
}

.play-btn:hover {
  background: #FFD000;
  transform: translateY(-1px);
}

.play-btn:active {
  transform: translateY(1px);
  border-bottom-width: 2px;
}

.play-btn.relaxed-btn {
  background: var(--relaxed);
  color: #fff;
}

.play-btn.relaxed-btn:hover {
  background: #79BBFF;
}

/* ---- Progress squares ---- */
.progress-square {
  transition: background-color 0.2s ease, border-color 0.2s ease;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 0;
}

.progress-square.current {
  background-color: var(--primary);
  border-color: var(--primary);
  color: #000;
}

.progress-square.correct {
  background-color: var(--correct);
  border-color: var(--correct);
  color: #000;
}

.progress-square.incorrect {
  background-color: var(--incorrect);
  border-color: var(--incorrect);
}

/* ---- Option styling ---- */
.option-letter {
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: 0.9rem;
  border-radius: 0;
  flex-shrink: 0;
}

.option {
  background: var(--surface-option);
  border: 2px solid rgba(255, 255, 255, 0.10);
  border-radius: 0;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  text-align: left;
  width: 100%;
  font: inherit;
  color: inherit;
  min-height: 60px;
}

.option:hover {
  border-color: var(--primary);
  background: #252530;
}

.option:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.option.selected {
  border-color: var(--primary) !important;
  background-color: rgba(245, 184, 0, 0.08);
}

/* Answer reveal states — keyed to classes the JS actually applies */
.option.correct {
  border-color: var(--correct) !important;
  background-color: rgba(45, 212, 160, 0.12) !important;
}

.option.incorrect {
  border-color: var(--incorrect) !important;
  background-color: rgba(255, 107, 107, 0.12) !important;
}

/* Legacy CSS-class selectors (kept for safety) */
.option.correct-answer {
  border-color: var(--correct) !important;
  background-color: rgba(45, 212, 160, 0.12) !important;
}

.option.wrong-answer {
  border-color: var(--incorrect) !important;
  background-color: rgba(255, 107, 107, 0.12) !important;
}

/* Dim the non-relevant options on reveal */
.option.border-transparent {
  opacity: 0.35;
  border-color: transparent !important;
}

/* Fixed-height question area to prevent layout shift */
.question-container {
  display: flex;
  flex-direction: column;
}

.question-text {
  min-height: 80px;
}

/* ---- Timer bar ---- */
.timer-bar {
  transition: width 0.3s linear, background-color 0.3s ease;
  border-radius: 0;
  background: var(--primary);
}

.timer-bar.warning {
  background: var(--incorrect);
}

.timer-bar.smooth-countdown {
  transition: width 15s linear, background-color 0.3s ease;
}

.timer-bar-container {
  border-radius: 0;
}

/* ---- Result squares ---- */
.result-square {
  width: 40px;
  height: 40px;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: bold;
  color: white;
}

.result-square.correct {
  background-color: var(--correct);
}

.result-square.incorrect {
  background-color: var(--incorrect);
}

/* ---- History Grid ---- */
#historyGrid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  max-width: 220px;
  margin: 0 auto;
}

.history-row {
  display: flex;
  align-items: center;
  padding: 4px 0;
  gap: 8px;
}

.history-date {
  font-size: 0.9rem;
  color: var(--text-secondary);
  width: 60px;
  flex-shrink: 0;
}

.history-squares {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.history-rank {
  font-size: 0.75rem;
  color: var(--text-secondary, #999);
  width: 40px;
  flex-shrink: 0;
  text-align: right;
}

.history-spacer {
  width: 40px;
  flex-shrink: 0;
}

.history-square {
  width: 20px;
  height: 20px;
  border-radius: 0;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.history-square:hover { opacity: 0.8; }
.history-square.active {
  transform: scale(1.3);
  box-shadow: 0 0 0 2px rgba(255,255,255,0.5);
}

.history-square.correct { background-color: var(--correct); }
.history-square.incorrect { background-color: var(--incorrect); }

/* ---- History detail slide-out panel ---- */
.history-entry {
  margin-bottom: 2px;
}

.history-detail-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease, padding 0.25s ease;
  background: rgba(255,255,255,0.04);
  border-left: 2px solid transparent;
  padding: 0 12px;
}

.history-detail-panel.open {
  max-height: 200px;
  padding: 10px 12px;
  border-left-color: var(--primary);
}

.history-detail-q {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: #eee;
}

.history-detail-answers {
  font-size: 0.8rem;
}

.history-detail-wrong {
  color: var(--incorrect);
  margin-bottom: 2px;
}

.history-detail-correct {
  color: var(--correct);
}

/* ---- Sticker CTA on welcome card ---- */
.sticker-cta {
  position: absolute;
  top: -14px;
  right: -10px;
  z-index: 10;
  transform: rotate(8deg);
  transform-origin: center;
  background: var(--correct);
  color: #000;
  border: 2px solid var(--correct);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  padding: 10px 16px 10px 14px;
  border-radius: 0;
  font-weight: 800;
  letter-spacing: 0.2px;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.15s ease;
}

.sticker-cta:hover {
  transform: rotate(5deg) translateY(-1px);
  background: #3DEBB5;
}

.sticker-cta:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(45, 212, 160, 0.45);
}

.sticker-cta::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 18px;
  width: 60%;
  height: 8px;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.35), transparent 60%);
  transform: rotate(-8deg);
  filter: blur(2px);
  pointer-events: none;
}

@media (max-width: 380px) {
  .sticker-cta {
    top: -12px;
    right: -8px;
    padding: 8px 12px 8px 10px;
    font-size: 0.85rem;
  }
}

/* NEW badge */
.badge-new {
  display: inline-block;
  background: var(--primary);
  color: #000;
  font-size: 0.7rem;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 0;
  margin-right: 2px;
}

/* ---- Quick View icon button ---- */
.history-view-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  background: transparent;
  color: var(--correct);
  border: none;
  border-radius: 0;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.history-view-icon:hover {
  background: rgba(45, 212, 160, 0.15);
  color: #fff;
}

.history-view-icon svg { display: block; }

/* ---- Quick View Modal ---- */
.quickview-modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--surface);
  display: flex;
  align-items: stretch;
  justify-content: center;
  z-index: 60;
}

.hidden.quickview-modal-backdrop { display: none !important; }

.quickview-modal {
  background: var(--surface);
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.quickview-content {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
}

.quickview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--surface-border);
}

.quickview-title {
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--text-primary);
  flex: 1;
}

.quickview-meta {
  color: var(--primary);
  font-weight: 700;
  font-size: 1.25rem;
}

.quickview-close {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border: none;
  border-radius: 0;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  margin-left: auto;
}

.quickview-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.quickview-close svg { display: block; }

.quickview-list { display: grid; gap: 16px; }

.quickview-item {
  background: var(--surface-raised);
  border: 1px solid var(--surface-border);
  border-radius: 0;
  padding: 16px;
}

.quickview-question {
  color: #e5e7eb;
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 10px;
}

.quickview-your { font-size: 1rem; margin-bottom: 6px; }
.quickview-your.correct { color: var(--correct); }
.quickview-your.incorrect { color: var(--incorrect); }

.quickview-correct { font-size: 1rem; color: var(--primary); }

.quickview-empty {
  color: var(--text-secondary);
  text-align: center;
  padding: 40px;
  font-size: 1.1rem;
}

/* ---- Visually hidden (screen readers only) ---- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .timer-bar { transition: none; }
  .sticker-cta { transition: none; }
  .sticker-cta:hover { transform: rotate(8deg); }
  .play-btn:hover { transform: none; }
}
