/* ==========================================================================
   RESET & BASIS
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --font-display: 'Bungee', cursive, sans-serif;
  --font-body: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;

  --bg-dark: #090a15;
  --bg-card: #ffffff;
  --accent-orange: #ff5e00;
  --accent-yellow: #ffe600;
  --accent-cyan: #00f0ff;
  --accent-pink: #ff0077;
  --accent-green: #00ff66;
  --text-dark: #12131a;
  --text-muted: #64748b;
  --border-radius-card: 24px;
  --border-radius-btn: 18px;
  --shadow-comic: 0 10px 0 #000000, 0 16px 28px rgba(0, 0, 0, 0.45);
  --shadow-comic-pressed: 0 2px 0 #000000, 0 4px 10px rgba(0, 0, 0, 0.35);
}

html, body {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  background-color: var(--bg-dark);
  font-family: var(--font-body);
  color: #ffffff;
  user-select: none;
  -webkit-user-select: none;
}

body {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 100vh;
  min-height: 100dvh;
  background-image: 
    radial-gradient(circle at 50% 10%, rgba(255, 94, 0, 0.22), transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(0, 240, 255, 0.15), transparent 40%),
    radial-gradient(circle at 15% 75%, rgba(255, 0, 119, 0.15), transparent 40%),
    radial-gradient(#1e2238 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 100% 100%, 24px 24px;
  padding: env(safe-area-inset-top, 16px) 16px env(safe-area-inset-bottom, 20px) 16px;
}

/* ==========================================================================
   CANVAS OVERLAY & FX
   ========================================================================== */
#fxCanvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 999;
}

.flash-overlay {
  position: fixed;
  inset: 0;
  background: white;
  opacity: 0;
  pointer-events: none;
  z-index: 900;
  transition: opacity 0.1s ease-out;
}

.flash-overlay.flash {
  opacity: 0.85;
}

.flash-overlay.emergency {
  animation: emergencyStrobe 0.25s infinite alternate;
}

@keyframes emergencyStrobe {
  0% { opacity: 0.6; background: #ff0033; }
  100% { opacity: 0.1; background: #0000ff; }
}

/* ==========================================================================
   HOOFDCONTAINER (MOBIELE FOCUS)
   ========================================================================== */
.app-container {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin: 0 auto;
  z-index: 10;
}

/* ==========================================================================
   HEADER & CAPTION
   ========================================================================== */
.main-header {
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-top: 4px;
}

.pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--accent-yellow);
  text-transform: uppercase;
  backdrop-filter: blur(8px);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 10px var(--accent-green);
  animation: pulseDot 1.4s infinite;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.5; }
}

.main-title {
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 6.2vw, 1.95rem);
  line-height: 1.15;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.title-word {
  display: block;
}

.title-word.highlight {
  color: var(--accent-yellow);
  text-shadow: 0 0 18px rgba(255, 230, 0, 0.45), 2px 2px 0px #000;
  transform: rotate(-1.5deg);
  display: inline-block;
}

.title-word.highlight-alt {
  color: var(--accent-cyan);
  text-shadow: 0 0 20px rgba(0, 240, 255, 0.5), 2px 2px 0px #000;
  transform: rotate(1deg);
  display: inline-block;
}

.subtitle {
  font-size: 0.75rem;
  font-weight: 600;
  color: #cbd5e1;
  opacity: 0.85;
}

/* ==========================================================================
   STAGE & POLAROID FOTOKAART
   ========================================================================== */
.stage-section {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  perspective: 1200px;
}

/* Anime speedlines achtergrond */
.speed-lines {
  position: absolute;
  inset: -20px;
  border-radius: 30px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  background: repeating-conic-gradient(
    from 0deg,
    rgba(255, 255, 255, 0.14) 0deg 4deg,
    transparent 4deg 12deg
  );
  z-index: 1;
}

.speed-lines.active {
  opacity: 1;
  animation: speedSpin 0.35s infinite linear;
}

@keyframes speedSpin {
  100% { transform: rotate(360deg); }
}

.card-wrapper {
  position: relative;
  width: 100%;
  z-index: 2;
  cursor: pointer;
  touch-action: pan-y;
}

.photo-card {
  position: relative;
  width: 100%;
  background: var(--bg-card);
  border: 4px solid #000000;
  border-radius: var(--border-radius-card);
  padding: 14px 14px 16px 14px;
  box-shadow: var(--shadow-comic);
  color: var(--text-dark);
  transform-origin: center center;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
  will-change: transform;
}

.photo-card:active {
  transform: scale(0.985) translateY(4px);
  box-shadow: var(--shadow-comic-pressed);
}

/* Washi tape sticker bovenaan */
.tape-sticker {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  background: var(--accent-yellow);
  color: #000;
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  padding: 4px 18px;
  border: 2px solid #000;
  box-shadow: 0 4px 0 #000;
  z-index: 5;
}

/* Afbeelding box */
.image-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 4.7;
  border-radius: 16px;
  overflow: hidden;
  background: #0f172a;
  border: 3px solid #000;
}

.image-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  transition: transform 0.2s ease;
}

/* Badges op de afbeelding */
.level-badge {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.85);
  color: var(--accent-yellow);
  font-family: var(--font-display);
  font-size: 0.68rem;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1.5px solid var(--accent-yellow);
  letter-spacing: 0.04em;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.sound-indicator {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.9);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  border: 2px solid #000;
  opacity: 0;
  transform: scale(0.6);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sound-indicator.pop {
  opacity: 1;
  transform: scale(1.15);
}

/* Kaarttekst */
.card-body {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.meta-tag {
  font-size: 0.65rem;
  font-weight: 800;
  background: #f1f5f9;
  border: 1.5px solid #000;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.meta-rating {
  font-family: var(--font-display);
  font-size: 0.68rem;
  color: var(--accent-orange);
  letter-spacing: 0.02em;
}

.card-quote {
  font-family: var(--font-display);
  font-size: 0.98rem;
  line-height: 1.28;
  color: var(--text-dark);
  letter-spacing: -0.01em;
  min-height: 2.6em;
}

.card-lore {
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.35;
  font-weight: 600;
}

.swipe-hint {
  margin-top: 8px;
  text-align: center;
  font-size: 0.66rem;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.03em;
}

/* ==========================================================================
   ANIMATIE KLASSEN VOOR DE KAART
   ========================================================================== */
/* Snelle comedy shuffle bounce */
.photo-card.shuffling {
  animation: comedicShuffle 0.12s infinite alternate ease-in-out;
}

@keyframes comedicShuffle {
  0% {
    transform: rotate(-3deg) scale(0.97) translateY(4px);
  }
  100% {
    transform: rotate(3deg) scale(1.02) translateY(-4px);
  }
}

/* Landingsklap / Rubberband */
.photo-card.landed {
  animation: cartoonLand 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes cartoonLand {
  0% {
    transform: scale(0.85) rotate(-6deg) translateY(12px);
  }
  45% {
    transform: scale(1.07) rotate(3deg) translateY(-8px);
  }
  75% {
    transform: scale(0.96) rotate(-1deg) translateY(2px);
  }
  100% {
    transform: scale(1) rotate(0deg) translateY(0);
  }
}

/* Swipe swipe animations */
.photo-card.swipe-left {
  animation: flingLeft 0.32s forwards cubic-bezier(0.1, 0.8, 0.3, 1);
}

.photo-card.swipe-right {
  animation: flingRight 0.32s forwards cubic-bezier(0.1, 0.8, 0.3, 1);
}

@keyframes flingLeft {
  0% { transform: translateX(0) rotate(0); opacity: 1; }
  100% { transform: translateX(-120%) rotate(-25deg); opacity: 0; }
}

@keyframes flingRight {
  0% { transform: translateX(0) rotate(0); opacity: 1; }
  100% { transform: translateX(120%) rotate(25deg); opacity: 0; }
}

/* Algemene Screen Shake */
.shake-screen {
  animation: screenQuake 0.38s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes screenQuake {
  10%, 90% { transform: translate3d(-3px, 0, 0); }
  20%, 80% { transform: translate3d(5px, 2px, 0); }
  30%, 50%, 70% { transform: translate3d(-6px, -2px, 0); }
  40%, 60% { transform: translate3d(6px, 1px, 0); }
}

/* ==========================================================================
   TICKER & LIVE STATUS
   ========================================================================== */
.ticker-box {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(15, 23, 42, 0.7);
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 8px 16px;
  backdrop-filter: blur(10px);
  font-size: 0.78rem;
  font-weight: 700;
}

.ticker-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ticker-label {
  color: #94a3b8;
}

.ticker-value {
  color: #ffffff;
  font-family: var(--font-display);
}

.ticker-value.highlight-text {
  color: var(--accent-green);
  transition: color 0.2s ease;
}

.ticker-divider {
  color: rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   CONTROLS & KNOPPEN
   ========================================================================== */
.controls-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 2px;
}

/* Grote primaire knop */
.btn-main {
  width: 100%;
  padding: 16px 20px;
  background: var(--accent-orange);
  background: linear-gradient(180deg, #ff7a1a 0%, #ff4d00 100%);
  color: #ffffff;
  border: 3.5px solid #000000;
  border-radius: var(--border-radius-btn);
  box-shadow: var(--shadow-comic);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  transform: translateY(0);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.15s ease;
}

.btn-main:hover {
  filter: brightness(1.06);
}

.btn-main:active {
  transform: translateY(6px);
  box-shadow: var(--shadow-comic-pressed);
}

.btn-icon {
  font-size: 1.3rem;
  display: inline-block;
  animation: diceRoll 2s infinite ease-in-out;
}

@keyframes diceRoll {
  0%, 80% { transform: rotate(0deg); }
  90% { transform: rotate(20deg) scale(1.2); }
  100% { transform: rotate(0deg); }
}

/* Sub-knoppen rij */
.sub-controls {
  display: flex;
  gap: 8px;
  width: 100%;
}

.btn-secondary {
  flex: 1.6;
  padding: 11px 12px;
  background: #1e293b;
  color: #ffffff;
  border: 2.5px solid #000000;
  border-radius: 14px;
  box-shadow: 0 4px 0 #000000;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 0.72rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.12s ease;
}

.btn-secondary:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #000000;
}

.btn-secondary.active {
  background: var(--accent-pink);
  border-color: #000;
  color: #fff;
  box-shadow: 0 0 16px rgba(255, 0, 119, 0.6), 0 4px 0 #000;
  animation: turboJitter 0.15s infinite alternate;
}

@keyframes turboJitter {
  0% { transform: rotate(-1deg); }
  100% { transform: rotate(1deg); }
}

.btn-danger {
  flex: 1.2;
  padding: 11px 8px;
  background: #dc2626;
  color: #ffffff;
  border: 2.5px solid #000000;
  border-radius: 14px;
  box-shadow: 0 4px 0 #000000;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 0.72rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.12s ease;
}

.btn-danger:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #000000;
}

.btn-icon-only {
  flex: 0.6;
  padding: 11px 0;
  background: #334155;
  color: #ffffff;
  border: 2.5px solid #000000;
  border-radius: 14px;
  box-shadow: 0 4px 0 #000000;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s ease;
}

.btn-icon-only:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #000000;
}

.btn-icon-only.muted {
  background: #1e2238;
  opacity: 0.6;
}

/* ==========================================================================
   RESPONSIVE OVERRIDES
   ========================================================================== */
@media (max-height: 720px) {
  .app-container {
    gap: 8px;
  }
  .image-frame {
    aspect-ratio: 4 / 4.2;
  }
  .card-quote {
    font-size: 0.88rem;
    min-height: 2.2em;
  }
  .card-lore {
    font-size: 0.7rem;
  }
  .btn-main {
    padding: 13px 16px;
    font-size: 0.95rem;
  }
}
