/**
 * Flash Mini Demo - Swipe Card Styles
 * ====================================
 *
 * Styles for the binary swipe-based vocabulary demo.
 * Mobile-first, system fonts, no external dependencies.
 */

/* ==========================================
   PHONE FRAME
   ========================================== */
.phone-preview {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
}

.phone-frame {
  position: relative;
  /* SIZE MATCH: phone-frame outer 300px → inner screen 280px (300 - 2×10px padding).
     Inner screen 280px matches hero screenshot rendered width exactly.
     At 280px wide (1080:2400 = 9:20 ratio), height = ~622px. */
  width: 300px;
  max-width: 300px;
  background: linear-gradient(145deg, #2d2d2d 0%, #1a1a1a 100%);
  border-radius: 44px;
  padding: 10px;
  box-shadow:
    0 20px 40px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}

.phone-notch {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: 85px;
  height: 24px;
  background: #000;
  border-radius: 12px;
  z-index: 20;
}

/* Camera dot */
.phone-notch::before {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  background: linear-gradient(135deg, #1a1a2e 0%, #0f0f1a 100%);
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1) inset;
}

.phone-screen {
  background: #ffffff;
  border-radius: 34px;
  padding: 2rem 0.75rem 1.25rem;
  /* SIZE MATCH: 602px = 622px (1080:2400 ratio at 280px width) minus phone frame padding (2×10px). */
  min-height: 602px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  /* HARD FIX: ensure screen is fully bright, no dimming */
  opacity: 1 !important;
  filter: none !important;
}

/* Ensure no pseudo-elements dim the screen */
.phone-screen::before,
.phone-screen::after {
  content: none !important;
}

/* Ensure demo content inside is not dimmed */
.phone-screen > * {
  opacity: 1;
  filter: none;
}

/* Phone screen color wash feedback */
.phone-screen {
  position: relative;
  transition: background-color 0.15s ease-out;
}

.phone-screen.flash-correct {
  background-color: rgba(0, 200, 83, 0.18);
}

.phone-screen.flash-wrong {
  background-color: rgba(255, 82, 82, 0.18);
}

/* Responsive phone frame — reset explicit width on small screens */
@media (max-width: 440px) {
  .phone-frame {
    width: 100%;
    max-width: 100%;
    border-radius: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
    max-width: 100%;
  }

  .phone-notch {
    display: none;
  }

  .phone-screen {
    border-radius: 0;
    padding: 1.25rem 0.5rem;
    min-height: auto;
    box-shadow: none;
  }
}

/* ==========================================
   CONTAINER & HEADER
   ========================================== */
.flash-demo {
  --demo-primary: #6200EE;
  --demo-primary-dark: #3700B3;
  --demo-secondary: #03DAC6;
  --demo-success: #00C853;
  --demo-error: #FF5252;
  --demo-bg: #ffffff;
  --demo-card-bg: #ffffff;
  --demo-text: #212121;
  --demo-text-muted: #757575;
  --demo-border: #e0e0e0;
  --demo-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  --demo-radius: 16px;

  background: var(--demo-bg);
  padding: 3rem 1rem;
}

/* Dark mode overrides for demo */
@media (prefers-color-scheme: dark) {
  .flash-demo {
    --demo-primary: #BB86FC;
    --demo-primary-dark: #9965DF;
    --demo-bg: #121212;
    --demo-card-bg: #1E1E1E;
    --demo-text: #FFFFFF;
    --demo-text-muted: #B3B3B3;
    --demo-border: #3D3D3D;
    --demo-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  }

  .phone-screen {
    background: #1E1E1E;
  }

  .phone-screen.flash-correct {
    background-color: rgba(0, 200, 83, 0.25);
  }

  .phone-screen.flash-wrong {
    background-color: rgba(255, 82, 82, 0.25);
  }

  /* Card feedback overlay in dark mode */
  .flash-demo__card-feedback {
    background: rgba(30, 30, 30, 0.95);
  }

  /* Type badge in dark mode */
  .flash-demo__type {
    background: rgba(187, 134, 252, 0.15);
  }
}

.flash-demo .container {
  max-width: 480px;
  margin: 0 auto;
}

.flash-demo__header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.flash-demo__title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--demo-primary);
  margin: 0 0 0.5rem;
}

.flash-demo__subtitle {
  color: var(--demo-text-muted);
  font-size: clamp(15px, 0.4vw + 13px, 17px);
  margin: 0;
  line-height: 1.45;
}

.flash-demo__beta-notice {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 0.5rem 1rem;
  font-size: clamp(14px, 0.3vw + 13px, 15px);
  color: var(--demo-primary-dark);
  background: rgba(98, 0, 238, 0.08);
  border-radius: 999px;
  border: 1px solid rgba(98, 0, 238, 0.2);
}

.flash-demo__beta-notice a {
  color: var(--demo-primary);
  font-weight: 600;
  text-decoration: underline;
}

.flash-demo__beta-notice a:hover {
  color: var(--demo-primary-dark);
}

/* ==========================================
   HEARTS BAR (demo-only, replaces score/streak)
   ========================================== */
.flash-demo__hearts-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: var(--demo-card-bg);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.flash-demo__hearts {
  display: flex;
  gap: 4px;
}

.flash-demo__heart {
  font-size: 20px;
  line-height: 1;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.flash-demo__heart--lost {
  opacity: 0.35;
  transform: scale(0.85);
}

/* ==========================================
   STATS BAR (kept for .flash-demo__stat shared usage)
   ========================================== */
.flash-demo__stats {
  display: flex;
  justify-content: space-around;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: var(--demo-card-bg);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.flash-demo__stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.flash-demo__stat-label {
  font-size: clamp(13px, 0.4vw + 11px, 14px);
  font-weight: 600;
  color: var(--demo-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.flash-demo__stat-value {
  font-size: clamp(18px, 0.5vw + 16px, 22px);
  font-weight: 700;
  color: var(--demo-text);
}

.flash-demo__stat--streak .flash-demo__stat-value {
  color: var(--demo-primary);
}

/* Hot streak animation */
.flash-demo__stat--hot {
  animation: pulse-streak 0.6s ease-in-out infinite alternate;
}

.flash-demo__stat--hot .flash-demo__stat-value {
  color: #FF6B00;
}

@keyframes pulse-streak {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.1);
  }
}

/* ==========================================
   PROGRESS BAR
   ========================================== */
.flash-demo__progress-bar {
  height: 6px;
  background: var(--demo-border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.flash-demo__progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--demo-primary), var(--demo-secondary));
  border-radius: 3px;
  transition: width 0.3s ease;
  width: 0%;
}

/* ==========================================
   CARD AREA
   ========================================== */
.flash-demo__card-area {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 1;
  min-height: 340px;
  perspective: 1000px;
}

/* ==========================================
   SWIPE CARD
   ========================================== */
.flash-demo__card {
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 360px;
  /* Choices are now inside the card — content-driven height */
  min-height: 320px;
  background: var(--demo-card-bg);
  border-radius: var(--demo-radius);
  box-shadow: var(--demo-shadow);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  gap: 0.75rem;
  text-align: center;
  cursor: grab;
  user-select: none;
  touch-action: pan-y;
  will-change: transform;
  transition: box-shadow 0.2s ease;
}

/* Ensure card children are above flash overlay */
.flash-demo__card > * {
  position: relative;
  z-index: 2;
}

.flash-demo__card:active,
.flash-demo__card--dragging {
  cursor: grabbing;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.flash-demo__type {
  display: inline-block;
  font-size: clamp(13px, 0.3vw + 12px, 14px);
  font-weight: 600;
  color: var(--demo-primary);
  background: rgba(98, 0, 238, 0.1);
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  /* margin-bottom removed — card gap handles spacing */
  margin-bottom: 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.flash-demo__prompt {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--demo-text);
  margin: 0;
  line-height: 1.4;
  /* flex: 1 makes the prompt take remaining space, pushing choices to bottom */
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Card enter animation */
.flash-demo__card--enter {
  animation: card-enter 0.3s ease-out;
}

@keyframes card-enter {
  from {
    transform: scale(0.9) translateY(20px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

/* Flash feedback animation (momentary pulse) */
@keyframes flashPulse {
  0%   { opacity: 0; }
  35%  { opacity: 1; }
  100% { opacity: 0; }
}

/* Card flash overlay - sits ABOVE background, BELOW text */
.flash-demo__card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--demo-radius);
  opacity: 0;
  pointer-events: none;
  z-index: 1;
}

.flash-demo__card.flash-correct::after {
  background: rgba(46, 204, 113, 0.22);
  animation: flashPulse 160ms ease-out;
}

.flash-demo__card.flash-wrong::after {
  background: rgba(255, 77, 77, 0.22);
  animation: flashPulse 160ms ease-out;
}

/* Button flash overlay */
.flash-demo__choice::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 12px;
  opacity: 0;
  pointer-events: none;
  z-index: 10;
}

.flash-demo__choice.flash-correct::after {
  background: rgba(0, 200, 83, 0.25);
  animation: flashPulse 180ms ease-out;
}

.flash-demo__choice.flash-wrong::after {
  background: rgba(255, 82, 82, 0.25);
  animation: flashPulse 180ms ease-out;
}

/* ==========================================
   CARD FEEDBACK OVERLAY
   ========================================== */
.flash-demo__card-feedback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--demo-radius);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.flash-demo__card-feedback--visible {
  opacity: 1;
  visibility: visible;
}

.flash-demo__card-feedback-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.flash-demo__card-feedback-text {
  font-size: 1rem;
  color: var(--demo-text);
  padding: 0 1rem;
  text-align: center;
  line-height: 1.4;
}

.flash-demo__card-feedback--correct {
  border: 3px solid var(--demo-success);
}

.flash-demo__card-feedback--wrong {
  border: 3px solid var(--demo-error);
}

/* ==========================================
   SWIPE HINTS
   ========================================== */
.flash-demo__swipe-hint {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  background: var(--demo-border);
  color: var(--demo-text-muted);
  font-size: 1.25rem;
  font-weight: 700;
  opacity: 0.4;
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
  pointer-events: none;
}

.flash-demo__swipe-hint--left {
  left: -60px;
}

.flash-demo__swipe-hint--right {
  right: -60px;
}

.flash-demo__swipe-hint--active {
  opacity: 1;
  transform: translateY(-50%) scale(1.2);
  background: var(--demo-primary);
  color: #fff;
}

/* Hide hints on smaller screens where they overlap */
@media (max-width: 480px) {
  .flash-demo__swipe-hint {
    display: none;
  }
}

/* ==========================================
   CHOICE BUTTONS
   ========================================== */
/* Choices are now inside the card — stretch to full card width */
.flash-demo__choices {
  display: flex;
  gap: 1rem;
  align-self: stretch;
  margin-bottom: 0;
}

.flash-demo__choice {
  position: relative;
  overflow: hidden;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  border: 2px solid var(--demo-border);
  border-radius: 12px;
  background: var(--demo-card-bg);
  color: var(--demo-text);
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 60px;
}

.flash-demo__choice:hover:not(:disabled) {
  border-color: var(--demo-primary);
  background: rgba(98, 0, 238, 0.05);
}

.flash-demo__choice:active:not(:disabled) {
  transform: scale(0.98);
}

.flash-demo__choice:disabled {
  cursor: not-allowed;
  opacity: 0.8;
}

.flash-demo__choice-arrow {
  font-size: 1.25rem;
  opacity: 0.6;
}

.flash-demo__choice-text {
  flex: 1;
  text-align: center;
  word-wrap: break-word;
}

/* Correct/Wrong states */
.flash-demo__choice--correct {
  border-color: var(--demo-success) !important;
  background: rgba(0, 200, 83, 0.1) !important;
  color: var(--demo-success) !important;
}

.flash-demo__choice--wrong {
  border-color: var(--demo-error) !important;
  background: rgba(255, 82, 82, 0.1) !important;
  color: var(--demo-error) !important;
}

/* ==========================================
   TIP TEXT
   ========================================== */
.flash-demo__tip {
  text-align: center;
  font-size: clamp(14px, 0.3vw + 13px, 15px);
  color: var(--demo-text-muted);
  margin: 0 0 1.5rem;
}

.flash-demo__tip kbd {
  display: inline-block;
  padding: 0.2em 0.4em;
  font-size: 0.8em;
  font-family: inherit;
  background: var(--demo-card-bg);
  border: 1px solid var(--demo-border);
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* ==========================================
   CONTROLS
   ========================================== */
.flash-demo__controls {
  display: flex;
  justify-content: center;
}

/* Restart button outside phone frame */
.flash-demo__controls-outside {
  display: flex;
  justify-content: center;
  margin-top: 1.25rem;
}

/* Restart button on light background (outside phone) */
.flash-demo__controls-outside .flash-demo__btn {
  color: #141414;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.14);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.flash-demo__controls-outside .flash-demo__btn:hover {
  border-color: rgba(0, 0, 0, 0.22);
  background: rgba(98, 0, 238, 0.04);
}

.flash-demo__controls-outside .flash-demo__btn:focus-visible {
  outline: 3px solid rgba(98, 0, 238, 0.28);
  outline-offset: 2px;
}

.flash-demo__btn {
  padding: 0.75rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: 999px;
  background: var(--demo-primary);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.flash-demo__btn:hover {
  background: var(--demo-primary-dark);
}

.flash-demo__btn:active {
  transform: scale(0.98);
}

/* ==========================================
   BETA CTA
   ========================================== */
.flash-demo__beta-cta {
  text-align: center;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--demo-border);
}

.flash-demo__beta-cta p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--demo-text-muted);
}

.flash-demo__beta-cta a {
  color: var(--demo-primary);
  font-weight: 600;
  text-decoration: underline;
}

.flash-demo__beta-cta a:hover {
  color: var(--demo-primary-dark);
}

/* ==========================================
   COMPLETE SCREEN
   ========================================== */
.flash-demo__card--complete {
  cursor: default;
}

.flash-demo__complete {
  text-align: center;
  padding: 1rem 0;
}

.flash-demo__complete-emoji {
  font-size: 3.5rem;
  margin-bottom: 0.5rem;
}

.flash-demo__complete-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--demo-text);
  margin: 0 0 1rem;
}

.flash-demo__complete-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 1rem;
}

.flash-demo__complete-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.flash-demo__complete-stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--demo-primary);
}

.flash-demo__complete-stat-label {
  font-size: 0.875rem;
  color: var(--demo-text-muted);
}

.flash-demo__complete-cta {
  color: var(--demo-text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0 0 0.75rem;
}

.flash-demo__complete-beta {
  font-size: 0.9rem;
  color: var(--demo-text);
  line-height: 1.5;
  margin: 0;
  padding: 0.75rem 1rem;
  background: rgba(98, 0, 238, 0.08);
  border-radius: 12px;
  border: 1px solid rgba(98, 0, 238, 0.15);
}

.flash-demo__complete-beta a {
  color: var(--demo-primary);
  font-weight: 600;
  text-decoration: underline;
}

.flash-demo__complete-beta a:hover {
  color: var(--demo-primary-dark);
}

/* ==========================================
   ACCESSIBILITY
   ========================================== */
.flash-demo__sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 400px) {
  .flash-demo {
    padding: 2rem 0.75rem;
  }

  .flash-demo__title {
    font-size: 1.5rem;
  }

  .flash-demo__prompt {
    font-size: 1.25rem;
  }

  .flash-demo__choice {
    padding: 0.75rem 0.5rem;
    font-size: 0.9rem;
    min-height: 50px;
  }

  .flash-demo__choice-arrow {
    font-size: 1rem;
  }
}

/* Focus styles for keyboard users */
.flash-demo__choice:focus-visible,
.flash-demo__btn:focus-visible {
  outline: 3px solid var(--demo-secondary);
  outline-offset: 2px;
}
