/* -------------------------------------
   Mobile bottom nav items
-------------------------------------- */
.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 14px;
  border-radius: 14px;
  font-size: 0.7rem;
  font-weight: 600;
  color: #9ca3af;
  position: relative;
  text-decoration: none;
  transition: color 0.22s ease, background 0.22s ease, box-shadow 0.22s ease, transform 0.22s ease;
}
.mobile-nav-item:hover {
  color: #6b7280;
  background: rgba(255,255,255,0.35);
}
.mobile-nav-active {
  color: #4338ca;
  background: rgba(238, 242, 255, 0.88);
  box-shadow:
    0 3px 14px rgba(99, 102, 241, 0.22),
    0 1px 3px rgba(67, 56, 202, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 1);
  transform: translateY(-1px);
}
/* Thin accent bar at top of active pill — classic iOS tab indicator */
.mobile-nav-active::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2.5px;
  background: linear-gradient(90deg, #818cf8, #4f46e5);
  border-radius: 99px;
  opacity: 0.85;
}

/* All styling is handled by Tailwind CSS (loaded via CDN in head.ejs).
   This file is kept for any custom overrides that cannot be expressed
   with Tailwind utility classes alone. */

/* Smooth radio option selection highlight */
input[type="radio"]:checked ~ span {
  font-weight: 600;
}

/* Ensure images in prize cards don't overflow */
img {
  max-width: 100%;
  height: auto;
}

/* Responsive Table classes */
@media (max-width: 768px) {
  table.responsive-table, 
  table.responsive-table thead, 
  table.responsive-table tbody, 
  table.responsive-table th, 
  table.responsive-table td, 
  table.responsive-table tr { 
    display: block; 
  }
  
  table.responsive-table thead tr { 
    position: absolute;
    top: -9999px;
    left: -9999px;
  }
  
  table.responsive-table tr { 
    border: 1px solid #e5e7eb; 
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: white;
  }
  
  table.responsive-table td { 
    border: none;
    border-bottom: 1px solid #f3f4f6; 
    position: relative;
    padding-left: 50% !important; 
    text-align: right !important;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
  }

  table.responsive-table td:last-child {
    border-bottom: 0;
  }
  
  table.responsive-table td::before { 
    position: absolute;
    top: 50%;
    left: 1rem;
    transform: translateY(-50%);
    width: 45%; 
    padding-right: 10px; 
    white-space: nowrap;
    text-align: left;
    font-weight: 600;
    color: #4b5563;
    content: attr(data-label);
  }

  table.responsive-table td.hidden {
    display: flex !important;
  }
}

/* -------------------------------------
   Swipe Card UI Components 
-------------------------------------- */
.swipe-container {
  position: relative;
  width: 100%;
  height: 380px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: visible; /* Allows card to be dragged out of bounds */
}

/* Compact swipe card on mobile so it fits without scrolling */
@media (max-width: 1023px) {
  .swipe-container { height: 230px; }
  /* Hide the in-card desktop button on mobile — needs !important to override btn-primary's inline-flex */
  .quiz-desktop-btn { display: none !important; }
}

.swipe-emoji {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 0.6rem;
}
@media (min-width: 1024px) {
  .swipe-emoji { font-size: 3.75rem; margin-bottom: 1.5rem; }
}

/* Invisible background hints */
.swipe-hint {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.5rem;
  font-weight: 800;
  opacity: 0.2;
  transition: opacity 0.3s ease;
  z-index: 10;
}
.swipe-hint-left { left: -10px; color: #ef4444; } /* Red False/No */
.swipe-hint-right { right: -10px; color: #10b981; } /* Green True/Yes */

.swipe-card {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: white;
  border-radius: 1.25rem;
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  border: 4px solid #f9fafb;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  cursor: grab;
  /* Ensure physics engine can run smoothly on mobile devices without layout thrashing */
  touch-action: none;   
  transform-origin: 50% 100%; /* Rotates smoothly from the bottom center */
  z-index: 20;
  user-select: none;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.swipe-card:active {
  cursor: grabbing;
}

/* Interactive Feedback Overlays */
.stamp {
  position: absolute;
  top: 2rem;
  padding: 0.5rem 1rem;
  border: 4px solid;
  border-radius: 8px;
  font-size: 2.5rem;
  font-weight: 900;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none; /* Don't block dragging */
  z-index: 30;
}
.stamp-true { 
  color: #10b981; 
  border-color: #10b981;
  left: 2rem;
  transform: rotate(-15deg);
}
.stamp-false { 
  color: #ef4444; 
  border-color: #ef4444;
  right: 2rem;
  transform: rotate(15deg);
}

/* Sub-state logic when drug far enough to lock in an answer */
.swipe-card.ready-right { border-color: #d1fae5; box-shadow: 0 0 30px #10b98140;}
.swipe-card.ready-left { border-color: #fee2e2; box-shadow: 0 0 30px #ef444440;}

/* Animate standard choices so they feel punchy like games */
.game-choice {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.game-choice:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}
.game-choice:active {
  transform: scale(0.98);
}

/* -------------------------------------
   Build-the-Answer UI Components 
-------------------------------------- */
.build-answer-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.puzzle-board {
  min-height: 80px;
  border: 2px dashed #cbd5e1;
  border-radius: 1rem;
  padding: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 0.75rem;
  background-color: #f8fafc;
  transition: all 0.3s ease;
}

.puzzle-board.has-pieces {
  border-color: #818cf8;
  background-color: #eef2ff;
}

.word-bank {
  min-height: 120px;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-content: flex-start;
}

.puzzle-block {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: white;
  border: 2px solid #e2e8f0;
  border-bottom-width: 4px; /* 3D effect */
  border-radius: 0.75rem;
  padding: 0.5rem 1rem;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  transition: transform 0.1s ease, filter 0.1s ease;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05);
}

.puzzle-block:hover {
  filter: brightness(0.95);
}

.puzzle-block:active, .block-pop {
  transform: translateY(2px);
  border-bottom-width: 2px;
  margin-top: 2px; /* Compensate layout shift so neighbors don't jiggle */
}

/* -------------------------------------
   Lottery Scratch UI Components 
-------------------------------------- */
.scratch-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  background-color: white;
  border-radius: 1rem;
  padding: 1.5rem;
  overflow: hidden;
  box-shadow: inset 0 2px 4px 0 rgb(0 0 0 / 0.05); /* Slight inset makes it look like it was under the foil */
}

.scratch-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  cursor: crosshair;
  border-radius: 1rem;
  transition: opacity 0.5s ease;
}

/* Animation when the user has scratched enough */
.scratch-peel {
  opacity: 0;
  transform: scale(1.05);
  pointer-events: none;
}

/* Make multiple choice answers pop into focus once unlocked */
.options-unlocked {
  animation: unlockPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes unlockPop {
  0% { transform: scale(0.95); opacity: 0.5; filter: grayscale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); opacity: 1; filter: grayscale(0); }
}

/* -------------------------------------
   Quiz Action Bar
-------------------------------------- */
.quiz-docs-btn {
  color: #4f46e5;
  background: rgba(99, 102, 241, 0.08);
  border: 1.5px solid rgba(99, 102, 241, 0.18);
}
.quiz-docs-btn:hover {
  background: rgba(99, 102, 241, 0.13);
  border-color: rgba(99, 102, 241, 0.28);
}

/* -------------------------------------
   Documentation Panel
-------------------------------------- */
.doc-panel-scroll {
  max-height: calc(100vh - 160px);
  overflow-y: auto;
  position: sticky;
  top: 1rem;
}

/* Rich content inside documentation */
.doc-content { font-size: 1rem; line-height: 1.7; color: #1f2937; }
.doc-content h1 { font-size: 1.25rem; font-weight: 700; color: #111827; margin: 1.1rem 0 0.5rem; }
.doc-content h2 { font-size: 1.1rem; font-weight: 700; color: #1e293b; margin: 1rem 0 0.4rem; }
.doc-content h3 { font-size: 1rem; font-weight: 600; color: #374151; margin: 0.85rem 0 0.35rem; }
.doc-content p  { margin-bottom: 0.65rem; }
.doc-content ul, .doc-content ol { padding-left: 1.25rem; margin-bottom: 0.65rem; }
.doc-content ul { list-style-type: disc; }
.doc-content ol { list-style-type: decimal; }
.doc-content li { margin-bottom: 0.25rem; }
.doc-content strong, .doc-content b { font-weight: 600; color: #1f2937; }
.doc-content em { font-style: italic; }
.doc-content img { border-radius: 0.75rem; margin: 0.75rem 0; width: 100%; height: auto; object-fit: cover; }
.doc-content a { color: #4f46e5; text-decoration: underline; }
.doc-content hr { border: none; border-top: 1px solid #e5e7eb; margin: 1rem 0; }
.doc-content table { width: 100%; border-collapse: collapse; margin-bottom: 0.75rem; font-size: 0.8rem; }
.doc-content th { background: #f3f4f6; font-weight: 600; padding: 0.4rem 0.6rem; text-align: left; border: 1px solid #e5e7eb; }
.doc-content td { padding: 0.4rem 0.6rem; border: 1px solid #e5e7eb; }

/* -------------------------------------
   Toast notifications (container markup: views/partials/toast.ejs;
   JS appends .toast.toast-{ok|err|info} nodes to #toast-stack)
-------------------------------------- */
.toast {
  pointer-events: auto;
  padding: 12px 16px;
  border-radius: 12px;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  min-width: 260px;
  max-width: 360px;
  animation: toast-in 0.2s ease-out;
}
.toast-ok   { background: var(--color-success); }
.toast-err  { background: var(--color-danger); }
.toast-info { background: var(--color-brand); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
