/* ==========================================================================
   SMILE DETECTOR - ZONA DILARANG SEDIH
   Modern Cyber-Glassmorphism Design System + Alarm & Upload Mode
   ========================================================================== */

:root {
  /* Color Palette */
  --bg-primary: #0b0f19;
  --bg-secondary: #131b2e;
  --bg-card: rgba(23, 32, 54, 0.7);
  --bg-card-hover: rgba(30, 41, 69, 0.85);
  
  --accent-gold: #f6b73c;
  --accent-gold-glow: rgba(246, 183, 60, 0.4);
  --accent-cyan: #00f2fe;
  --accent-cyan-glow: rgba(0, 242, 254, 0.35);
  --accent-pink: #ff2a6d;
  --accent-pink-glow: rgba(255, 42, 109, 0.4);
  --accent-green: #05ffa1;
  --accent-green-glow: rgba(5, 255, 161, 0.4);
  --accent-purple: #9d4edd;
  --accent-purple-glow: rgba(157, 78, 221, 0.4);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-active: rgba(246, 183, 60, 0.6);
  --border-sad: rgba(255, 42, 109, 0.7);
  
  --shadow-main: 0 10px 30px -5px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px var(--accent-gold-glow);
  --shadow-glow-sad: 0 0 25px var(--accent-pink-glow);

  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
  
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;
  
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Base & Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  line-height: 1.6;
}

/* Background Animated Gradient Mesh */
.bg-mesh {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}

.bg-mesh::before, .bg-mesh::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.18;
  animation: floatMesh 15s infinite alternate ease-in-out;
}

.bg-mesh::before {
  width: 500px;
  height: 500px;
  background: linear-gradient(45deg, #f6b73c, #ff2a6d);
  top: -10%;
  left: -10%;
}

.bg-mesh::after {
  width: 600px;
  height: 600px;
  background: linear-gradient(45deg, #00f2fe, #7928ca);
  bottom: -15%;
  right: -10%;
  animation-duration: 20s;
}

@keyframes floatMesh {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(100px, 80px) scale(1.15); }
  100% { transform: translate(-50px, 120px) scale(0.95); }
}

/* Fullscreen Alarm Strobe Effects */
.alarm-overlay-sad {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 99;
  border: 8px solid transparent;
  display: none;
}

.alarm-overlay-sad.active {
  display: block;
  animation: strobeSad 0.4s infinite alternate;
}

@keyframes strobeSad {
  0% {
    box-shadow: inset 0 0 50px rgba(255, 42, 109, 0.4);
    border-color: rgba(255, 42, 109, 0.8);
    background: rgba(255, 42, 109, 0.05);
  }
  100% {
    box-shadow: inset 0 0 100px rgba(255, 42, 109, 0.8);
    border-color: rgba(255, 0, 85, 1);
    background: rgba(255, 42, 109, 0.15);
  }
}

.alarm-overlay-joy {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 99;
  border: 8px solid transparent;
  display: none;
}

.alarm-overlay-joy.active {
  display: block;
  animation: strobeJoy 0.5s infinite alternate;
}

@keyframes strobeJoy {
  0% {
    box-shadow: inset 0 0 50px rgba(246, 183, 60, 0.4);
    border-color: rgba(246, 183, 60, 0.8);
    background: rgba(246, 183, 60, 0.04);
  }
  100% {
    box-shadow: inset 0 0 100px rgba(5, 255, 161, 0.7);
    border-color: rgba(5, 255, 161, 1);
    background: rgba(5, 255, 161, 0.1);
  }
}

/* App Container */
.app-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-height: 100vh;
}

/* Header & Navbar */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-main);
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-badge {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent-gold), #ff8c00);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  box-shadow: 0 4px 15px var(--accent-gold-glow);
  animation: bounceLogo 3s infinite ease-in-out;
}

@keyframes bounceLogo {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.logo-text h1 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(90deg, #fff, var(--accent-gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-text p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: var(--transition-fast);
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
  border-color: var(--accent-cyan);
}

.icon-btn.active {
  background: var(--accent-gold);
  color: #0b0f19;
  box-shadow: 0 0 15px var(--accent-gold-glow);
}

/* Mode Navigation Tabs */
.mode-tabs {
  display: flex;
  gap: 0.75rem;
  background: rgba(19, 27, 46, 0.6);
  padding: 0.4rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  width: fit-content;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 1.25rem;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.tab-btn.active {
  background: linear-gradient(135deg, rgba(246, 183, 60, 0.2), rgba(0, 242, 254, 0.2));
  color: #fff;
  border: 1px solid var(--accent-gold);
  box-shadow: 0 0 15px var(--accent-gold-glow);
}

/* Alert Banner (Zona Dilarang Sedih) */
.alert-banner {
  display: none;
  background: linear-gradient(90deg, #ff2a6d, #ff5e36);
  color: #fff;
  padding: 0.8rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  text-align: center;
  box-shadow: var(--shadow-glow-sad);
  animation: shakeBanner 0.5s ease-in-out, pulseSad 1.5s infinite;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  font-size: 1rem;
  letter-spacing: 0.5px;
}

.alert-banner.show {
  display: flex;
}

@keyframes shakeBanner {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

@keyframes pulseSad {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}

/* Main Dashboard Grid */
.main-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 960px) {
  .main-grid {
    grid-template-columns: 1fr;
  }
}

/* Cards General */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-main);
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition-smooth);
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
}

/* Scanner Card */
.camera-card {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.camera-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.camera-header h2 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
}

.live-indicator.live {
  background: rgba(5, 255, 161, 0.15);
  border-color: var(--accent-green);
  color: var(--accent-green);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.live-indicator.live .live-dot {
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  animation: pulseDot 1.5s infinite;
}

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

/* Viewport Frame (Shared for Webcam & Upload) */
.webcam-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #060911;
  border: 2px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8);
  transition: all var(--transition-smooth);
}

.webcam-viewport.state-smiling {
  border-color: var(--accent-gold);
  box-shadow: 0 0 30px var(--accent-gold-glow), inset 0 0 20px rgba(246, 183, 60, 0.2);
}

.webcam-viewport.state-sad {
  border-color: var(--accent-pink);
  box-shadow: 0 0 30px var(--accent-pink-glow), inset 0 0 20px rgba(255, 42, 109, 0.2);
  animation: sadShake 0.4s ease-in-out;
}

@keyframes sadShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* Teachable Machine Webcam Canvas Target */
#webcam-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#webcam-container canvas, #webcam-container video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  transform: scaleX(-1);
  border-radius: var(--radius-md);
}

/* Upload Container Viewport */
#upload-container {
  width: 100%;
  height: 100%;
  display: none;
  align-items: center;
  justify-content: center;
  position: relative;
}

#uploadedImagePreview {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius-md);
}

/* Upload Dropzone Box */
.upload-dropzone {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  border: 2px dashed rgba(0, 242, 254, 0.4);
  border-radius: var(--radius-md);
  background: rgba(19, 27, 46, 0.85);
  cursor: pointer;
  padding: 1.5rem;
  text-align: center;
  transition: all var(--transition-fast);
  z-index: 5;
}

.upload-dropzone:hover, .upload-dropzone.dragover {
  border-color: var(--accent-cyan);
  background: rgba(0, 242, 254, 0.1);
  box-shadow: 0 0 20px var(--accent-cyan-glow);
}

.upload-dropzone i {
  font-size: 3rem;
  color: var(--accent-cyan);
}

/* Placeholder when camera is off */
.camera-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: linear-gradient(180deg, rgba(19, 27, 46, 0.9), rgba(11, 15, 25, 0.95));
  z-index: 10;
  text-align: center;
  padding: 2rem;
}

.camera-placeholder i {
  font-size: 3.5rem;
  color: var(--accent-gold);
  opacity: 0.8;
  animation: pulseIcon 2s infinite ease-in-out;
}

@keyframes pulseIcon {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.1); opacity: 1; filter: drop-shadow(0 0 15px var(--accent-gold-glow)); }
}

.camera-placeholder p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  max-width: 320px;
}

/* Face Target Scanner HUD */
.hud-scanner {
  position: absolute;
  inset: 15%;
  border: 2px dashed rgba(255, 255, 255, 0.3);
  border-radius: 24px;
  pointer-events: none;
  display: none;
  transition: all var(--transition-fast);
  z-index: 4;
}

.hud-scanner.active {
  display: block;
}

.hud-scanner.smile {
  border-color: var(--accent-gold);
  box-shadow: 0 0 15px var(--accent-gold-glow);
}

.hud-scanner.sad {
  border-color: var(--accent-pink);
  box-shadow: 0 0 15px var(--accent-pink-glow);
}

.hud-corner {
  position: absolute;
  width: 16px;
  height: 16px;
  border-color: var(--accent-cyan);
  border-style: solid;
}

.hud-corner.tl { top: -2px; left: -2px; border-width: 3px 0 0 3px; border-radius: 6px 0 0 0; }
.hud-corner.tr { top: -2px; right: -2px; border-width: 3px 3px 0 0; border-radius: 0 6px 0 0; }
.hud-corner.bl { bottom: -2px; left: -2px; border-width: 0 0 3px 3px; border-radius: 0 0 0 6px; }
.hud-corner.br { bottom: -2px; right: -2px; border-width: 0 3px 3px 0; border-radius: 0 0 6px 0; }

/* Emotion Overlay Floating Badge */
.emotion-badge {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-glass);
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 0.95rem;
  z-index: 8;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
  transition: all var(--transition-fast);
}

.emotion-badge.badge-smile {
  border-color: var(--accent-gold);
  color: #ffde59;
}

.emotion-badge.badge-sad {
  border-color: var(--accent-pink);
  color: #ff5e87;
}

/* Primary Action Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.8rem 1.5rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-gold), #ff9800);
  color: #0b0f19;
  box-shadow: 0 4px 15px var(--accent-gold-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(246, 183, 60, 0.6);
}

.btn-danger {
  background: linear-gradient(135deg, #ff2a6d, #ff5e36);
  color: #fff;
  box-shadow: 0 4px 15px var(--accent-pink-glow);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 42, 109, 0.6);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--accent-cyan);
}

.btn-cyan {
  background: linear-gradient(135deg, var(--accent-cyan), #00b4d8);
  color: #0b0f19;
  box-shadow: 0 4px 15px var(--accent-cyan-glow);
}

.btn-cyan:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 242, 254, 0.6);
}

.camera-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* AI Detection Metrics Bars */
.metrics-group {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  background: rgba(0, 0, 0, 0.25);
  padding: 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
}

.metric-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.metric-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 600;
}

.metric-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.metric-bar-bg {
  width: 100%;
  height: 12px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.metric-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: var(--radius-full);
  transition: width 0.15s ease-out;
}

.fill-smile {
  background: linear-gradient(90deg, #f6b73c, #05ffa1);
  box-shadow: 0 0 10px var(--accent-gold-glow);
}

.fill-sad {
  background: linear-gradient(90deg, #7928ca, #ff2a6d);
  box-shadow: 0 0 10px var(--accent-pink-glow);
}

/* Right Column Panels */
.side-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Alarm Station Card */
.alarm-station-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: linear-gradient(135deg, rgba(23, 32, 54, 0.9), rgba(15, 23, 42, 0.95));
  border: 1px solid var(--border-glass);
}

.alarm-station-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.alarm-station-header h3 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent-cyan);
}

.alarm-controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.alarm-box {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
  text-align: center;
  position: relative;
  transition: all var(--transition-fast);
}

.alarm-box.alarm-box-sad {
  border-color: rgba(255, 42, 109, 0.3);
}

.alarm-box.alarm-box-sad.active {
  border-color: var(--accent-pink);
  box-shadow: 0 0 15px var(--accent-pink-glow);
  background: rgba(255, 42, 109, 0.15);
}

.alarm-box.alarm-box-joy {
  border-color: rgba(246, 183, 60, 0.3);
}

.alarm-box.alarm-box-joy.active {
  border-color: var(--accent-gold);
  box-shadow: 0 0 15px var(--accent-gold-glow);
  background: rgba(246, 183, 60, 0.15);
}

.alarm-icon {
  font-size: 1.6rem;
  transition: transform var(--transition-fast);
}

.alarm-box.active .alarm-icon {
  animation: ringAlarm 0.4s infinite alternate ease-in-out;
}

@keyframes ringAlarm {
  0% { transform: rotate(-15deg) scale(1.1); }
  100% { transform: rotate(15deg) scale(1.1); }
}

.alarm-title {
  font-weight: 700;
  font-size: 0.85rem;
}

.btn-test-alarm {
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-glass);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition-fast);
}

.btn-test-alarm:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Mood Meter & Streak Card */
.stats-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.stat-box {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.35rem;
}

.stat-icon {
  font-size: 1.5rem;
  color: var(--accent-gold);
}

.stat-val {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 800;
  color: #fff;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

/* Challenge Mode Section */
.challenge-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.challenge-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.challenge-header h3 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.challenge-progress-box {
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-md);
  padding: 1rem;
  border: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  text-align: center;
}

.timer-display {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--accent-cyan);
}

.badge-reward {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(246, 183, 60, 0.15);
  border: 1px solid var(--accent-gold);
  color: var(--accent-gold);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  margin: 0 auto;
}

/* Joke & Anti-Sadness Machine Card */
.joke-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: linear-gradient(135deg, rgba(30, 41, 69, 0.75), rgba(19, 27, 46, 0.85));
}

.joke-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.joke-header h3 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent-gold);
}

.joke-bubble {
  background: rgba(0, 0, 0, 0.35);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  border-left: 4px solid var(--accent-gold);
  font-size: 0.95rem;
  color: #e2e8f0;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: all var(--transition-fast);
}

.joke-punchline {
  margin-top: 0.5rem;
  font-weight: 700;
  color: var(--accent-green);
}

/* Photobooth & Snapshot Gallery */
.photobooth-section {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.photobooth-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
}

.polaroid-card {
  background: #ffffff;
  padding: 0.75rem 0.75rem 1.25rem 0.75rem;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  transform: rotate(-1.5deg);
  transition: transform var(--transition-fast);
  color: #1e293b;
  position: relative;
}

.polaroid-card:nth-child(even) {
  transform: rotate(2deg);
}

.polaroid-card:hover {
  transform: rotate(0deg) scale(1.03);
  z-index: 10;
}

.polaroid-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 4px;
  margin-bottom: 0.6rem;
}

.polaroid-caption {
  font-family: 'Outfit', cursive, sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
  color: #0f172a;
}

.polaroid-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: #64748b;
}

.btn-download-snap {
  background: #0f172a;
  color: #fff;
  border: none;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  transition: var(--transition-fast);
}

.btn-download-snap:hover {
  background: var(--accent-gold);
  color: #000;
}

/* Modal Popup (Reward / Help) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-overlay.show {
  display: flex;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-main);
  animation: modalPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
  0% { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.modal-trophy {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: bounceTrophy 1.5s infinite ease-in-out;
}

@keyframes bounceTrophy {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* Footer */
.app-footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border-glass);
  margin-top: auto;
}

.app-footer a {
  color: var(--accent-cyan);
  text-decoration: none;
}

.app-footer a:hover {
  text-decoration: underline;
}

/* Floating Reactions */
.floating-emoji {
  position: fixed;
  pointer-events: none;
  font-size: 2rem;
  z-index: 999;
  animation: floatUpFade 2s forwards ease-out;
}

@keyframes floatUpFade {
  0% { transform: translateY(0) scale(0.5); opacity: 1; }
  50% { transform: translateY(-80px) scale(1.2); opacity: 0.9; }
  100% { transform: translateY(-160px) scale(0.8); opacity: 0; }
}

/* Responsive Rules */
@media (max-width: 640px) {
  .app-container {
    padding: 1rem;
    gap: 1.25rem;
  }
  
  .app-header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }
  
  .header-controls {
    width: 100%;
    justify-content: space-between;
  }
  
  .mode-tabs {
    width: 100%;
    justify-content: space-between;
  }
  
  .tab-btn {
    flex: 1;
    justify-content: center;
  }
  
  .stats-card {
    grid-template-columns: 1fr;
  }

  .alarm-controls-grid {
    grid-template-columns: 1fr;
  }
}
