/* ==========================================================================
   AR Gesture FX — Modern Immersive Glassmorphic Stylesheet
   ========================================================================== */

:root {
  --bg-dark: #06070d;
  --surface-glass: rgba(12, 15, 28, 0.58);
  --surface-glass-strong: rgba(10, 12, 24, 0.78);
  --border-glass: rgba(255, 255, 255, 0.14);
  --border-glass-bright: rgba(255, 255, 255, 0.28);

  --text-primary: #f7f9ff;
  --text-secondary: rgba(235, 240, 255, 0.72);
  --text-muted: rgba(220, 228, 255, 0.5);

  --accent-cyan: #22d3ee;
  --accent-emerald: #34d399;
  --accent-amber: #fbbf24;
  --accent-pink: #ff4fa3;
  --accent-rose: #ff2e63;
  --accent-purple: #a855f7;
  --accent-danger: #f43f5e;

  --radius-pill: 999px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --shadow-glass: 0 12px 40px rgba(0, 0, 0, 0.42);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  color: var(--text-primary);
  font-family: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   Fullscreen AR Stage & Layered Canvases
   ========================================================================== */

.ar-stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: radial-gradient(circle at 20% 20%, #161830 0%, #090b16 48%, #04050a 100%);
  isolation: isolate;
}

.camera-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  background: #05060b;
  opacity: 0;
  transition: opacity 0.45s ease, filter 0.45s ease;
}

.camera-video.active {
  opacity: 1;
}

.camera-video.mirrored {
  transform: scaleX(-1);
}

/* Subtle reactive tinting during Metal party mode */
.ar-stage[data-mode="metal"] .camera-video.active {
  filter: contrast(1.12) saturate(1.25) brightness(0.84);
}

.ar-stage[data-mode="finger_heart"] .camera-video.active {
  filter: saturate(1.12) brightness(1.04);
}

.ar-stage[data-mode="thumbs_up"] .camera-video.active {
  filter: saturate(1.15) contrast(1.04);
}

.ar-stage[data-mode="thumbs_down"] .camera-video.active {
  filter: saturate(0.55) contrast(1.18) brightness(0.72) hue-rotate(8deg);
}

/* ==========================================================================
   Atmospheric Overlays
   ========================================================================== */

.atmosphere-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.love-atmosphere {
  z-index: 2;
  opacity: 0;
  background:
    radial-gradient(circle at 50% 88%, rgba(255, 79, 163, 0.34), transparent 58%),
    radial-gradient(circle at 18% 22%, rgba(255, 117, 181, 0.22), transparent 45%),
    radial-gradient(circle at 85% 30%, rgba(255, 46, 99, 0.22), transparent 48%),
    inset 0 0 90px rgba(255, 64, 150, 0.38);
  mix-blend-mode: screen;
  transition: opacity 0.5s ease;
}

.ar-stage[data-mode="finger_heart"] .love-atmosphere {
  opacity: 1;
}

.storm-atmosphere {
  z-index: 2;
  opacity: 0;
  transition: opacity 0.45s ease;
}

.ar-stage[data-mode="thumbs_down"] .storm-atmosphere {
  opacity: 1;
}

.storm-vignette {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(6, 12, 28, 0.84) 0%, rgba(10, 20, 44, 0.34) 36%, rgba(8, 16, 36, 0.56) 100%),
    radial-gradient(circle at 50% 45%, transparent 32%, rgba(4, 10, 24, 0.72) 100%);
}

.storm-mist {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 8%, rgba(56, 189, 248, 0.22), transparent 55%);
  mix-blend-mode: screen;
}

.disco-atmosphere {
  z-index: 2;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.ar-stage[data-mode="metal"] .disco-atmosphere {
  opacity: 1;
}

.disco-vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 45%, rgba(168, 85, 247, 0.08) 18%, rgba(9, 4, 24, 0.62) 82%, rgba(4, 2, 12, 0.85) 100%);
}

.disco-strobe {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    125deg,
    rgba(255, 0, 128, 0.22),
    rgba(0, 240, 255, 0.18),
    rgba(139, 92, 246, 0.22),
    rgba(0, 255, 136, 0.16)
  );
  background-size: 300% 300%;
  mix-blend-mode: color-dodge;
  opacity: 0.72;
  animation: discoGradientShift 2.8s ease-in-out infinite;
}

@keyframes discoGradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.flash-overlay {
  z-index: 7;
  opacity: 0;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.9), rgba(255, 215, 70, 0.25) 55%, transparent 80%);
  mix-blend-mode: screen;
}

/* ==========================================================================
   AR Canvas Layers
   ========================================================================== */

.ar-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.three-layer {
  z-index: 3;
}

.effects-layer {
  z-index: 4;
}

.landmark-layer {
  z-index: 5;
  transition: opacity 0.25s ease;
}

.landmark-layer.hidden-layer {
  opacity: 0;
}

/* ==========================================================================
   GSAP Hero Emoji / Emblem Layer
   ========================================================================== */

.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.hero-emoji-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.2);
  will-change: transform, opacity;
}

.hero-ring {
  position: absolute;
  width: clamp(190px, 32vw, 310px);
  height: clamp(190px, 32vw, 310px);
  border-radius: 50%;
  border: 4px solid rgba(255, 220, 75, 0.85);
  box-shadow:
    0 0 40px rgba(255, 200, 45, 0.7),
    inset 0 0 36px rgba(255, 200, 45, 0.45);
  opacity: 0;
  pointer-events: none;
}

.hero-emoji {
  font-size: clamp(110px, 21vw, 210px);
  line-height: 1;
  filter: drop-shadow(0 16px 38px rgba(0, 0, 0, 0.48))
          drop-shadow(0 0 32px rgba(255, 204, 51, 0.72));
  will-change: transform, filter;
}

.hero-tag {
  margin-top: 10px;
  padding: 7px 22px;
  border-radius: var(--radius-pill);
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(15px, 2.2vw, 22px);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(135deg, rgba(255, 196, 0, 0.92), rgba(255, 94, 0, 0.92));
  box-shadow: 0 10px 30px rgba(255, 136, 0, 0.5), 0 0 0 2px rgba(255, 255, 255, 0.35);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

/* Theme variants for hero emblem */
.hero-emoji-wrap[data-theme="finger_heart"] .hero-emoji {
  filter: drop-shadow(0 14px 36px rgba(255, 46, 130, 0.68))
          drop-shadow(0 0 42px rgba(255, 125, 190, 0.85));
}

.hero-emoji-wrap[data-theme="finger_heart"] .hero-ring {
  border-color: rgba(255, 102, 178, 0.9);
  box-shadow: 0 0 44px rgba(255, 64, 150, 0.75), inset 0 0 36px rgba(255, 125, 190, 0.45);
}

.hero-emoji-wrap[data-theme="finger_heart"] .hero-tag {
  background: linear-gradient(135deg, #ff4fa3, #ff2e63);
  box-shadow: 0 10px 30px rgba(255, 46, 99, 0.55), 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.hero-emoji-wrap[data-theme="metal"] .hero-emoji {
  filter: drop-shadow(0 14px 34px rgba(168, 85, 247, 0.8))
          drop-shadow(0 0 42px rgba(0, 240, 255, 0.78));
}

.hero-emoji-wrap[data-theme="metal"] .hero-ring {
  border-color: rgba(0, 240, 255, 0.9);
  box-shadow: 0 0 46px rgba(168, 85, 247, 0.85), inset 0 0 36px rgba(0, 240, 255, 0.5);
}

.hero-emoji-wrap[data-theme="metal"] .hero-tag {
  background: linear-gradient(135deg, #00f0ff, #a855f7, #ff0099);
  box-shadow: 0 10px 34px rgba(168, 85, 247, 0.65), 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.hero-emoji-wrap[data-theme="thumbs_down"] .hero-emoji {
  filter: drop-shadow(0 14px 36px rgba(14, 165, 233, 0.8))
          drop-shadow(0 0 42px rgba(186, 230, 253, 0.85));
}

.hero-emoji-wrap[data-theme="thumbs_down"] .hero-ring {
  border-color: rgba(125, 211, 252, 0.92);
  box-shadow: 0 0 48px rgba(56, 189, 248, 0.85), inset 0 0 38px rgba(186, 230, 253, 0.5);
}

.hero-emoji-wrap[data-theme="thumbs_down"] .hero-tag {
  background: linear-gradient(135deg, #0284c7, #1d4ed8, #38bdf8);
  box-shadow: 0 10px 34px rgba(14, 165, 233, 0.65), 0 0 0 2px rgba(224, 242, 254, 0.45);
}

/* ==========================================================================
   TOP HUD
   ========================================================================== */

.hud-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(14px + var(--safe-top)) 18px 12px;
  pointer-events: none;
}

.hud-left,
.hud-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  pointer-events: auto;
}

.brand-pill,
.status-pill,
.fps-badge,
.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  background: var(--surface-glass);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-glass);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
}

.brand-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #64748b;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.brand-dot.live {
  background: var(--accent-danger);
  box-shadow: 0 0 12px var(--accent-danger);
  animation: pulseDot 1.6s ease-in-out infinite;
}

.brand-name {
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: 0.02em;
}

/* Hand detection indicator */
.status-pill {
  transition: border-color 0.25s ease, background-color 0.25s ease, box-shadow 0.25s ease;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #64748b;
  flex-shrink: 0;
  transition: background-color 0.25s ease, box-shadow 0.25s ease;
}

.status-pill[data-state="searching"] .status-dot {
  background: var(--accent-amber);
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.75);
}

.status-pill[data-state="detected"] {
  border-color: rgba(52, 211, 153, 0.55);
  background: rgba(16, 42, 34, 0.68);
  box-shadow: 0 8px 26px rgba(16, 185, 129, 0.25);
}

.status-pill[data-state="detected"] .status-dot {
  background: var(--accent-emerald);
  box-shadow: 0 0 12px var(--accent-emerald);
  animation: pulseDot 1.2s ease-in-out infinite;
}

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

.fps-badge {
  font-family: "Space Grotesk", monospace;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 0 12px;
}

.icon-btn {
  cursor: pointer;
  transition: transform 0.16s ease, background-color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.icon-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.16);
  border-color: var(--border-glass-bright);
  transform: translateY(-1px);
}

.icon-btn:active:not(:disabled) {
  transform: scale(0.96);
}

.icon-btn.active {
  border-color: rgba(34, 211, 238, 0.55);
  color: var(--accent-cyan);
  background: rgba(14, 42, 56, 0.65);
}

.icon-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

/* ==========================================================================
   START / WELCOME OVERLAY
   ========================================================================== */

.start-overlay {
  position: absolute;
  inset: 0;
  z-index: 15;
  display: grid;
  place-items: center;
  padding: 74px 18px 140px;
  background: radial-gradient(circle at 50% 35%, rgba(18, 22, 46, 0.72), rgba(5, 7, 14, 0.92));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.start-overlay.hidden-overlay {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.start-backdrop-glow {
  position: absolute;
  width: min(620px, 90vw);
  height: min(620px, 90vw);
  border-radius: 50%;
  background: conic-gradient(
    from 120deg,
    rgba(34, 211, 238, 0.2),
    rgba(168, 85, 247, 0.22),
    rgba(255, 79, 163, 0.22),
    rgba(251, 191, 36, 0.16),
    rgba(34, 211, 238, 0.2)
  );
  filter: blur(72px);
  animation: slowSpin 16s linear infinite;
  pointer-events: none;
}

@keyframes slowSpin {
  to { transform: rotate(360deg); }
}

.start-card {
  position: relative;
  width: min(560px, 100%);
  padding: clamp(22px, 4vw, 34px);
  border-radius: 28px;
  background: rgba(12, 15, 28, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  text-align: center;
}

.start-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-cyan);
  background: rgba(34, 211, 238, 0.12);
  border: 1px solid rgba(34, 211, 238, 0.28);
  margin-bottom: 14px;
}

.pulse-ring {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 10px var(--accent-cyan);
}

.start-title {
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(24px, 4.8vw, 38px);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}

.start-title span {
  background: linear-gradient(110deg, #22d3ee, #a855f7 52%, #ff4fa3);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.start-desc {
  font-size: clamp(13.5px, 2.2vw, 15px);
  line-height: 1.55;
  color: var(--text-secondary);
  max-width: 440px;
  margin: 0 auto 20px;
}

.gesture-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}

.preview-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 10px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.preview-emoji {
  font-size: 30px;
  line-height: 1;
}

.preview-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.preview-info strong {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.preview-info span {
  font-size: 11px;
  line-height: 1.3;
  color: var(--text-muted);
}

.loading-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 14px;
  border-radius: 14px;
  background: rgba(34, 211, 238, 0.12);
  border: 1px solid rgba(34, 211, 238, 0.3);
  color: #bff6ff;
  font-size: 13px;
  font-weight: 500;
}

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2.5px solid rgba(34, 211, 238, 0.25);
  border-top-color: var(--accent-cyan);
  animation: slowSpin 0.8s linear infinite;
}

.error-banner {
  padding: 11px 14px;
  margin-bottom: 14px;
  border-radius: 14px;
  background: rgba(244, 63, 94, 0.16);
  border: 1px solid rgba(244, 63, 94, 0.42);
  color: #fecdd3;
  font-size: 13px;
  line-height: 1.45;
  text-align: left;
}

.btn-primary-hero {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 280px;
  height: 52px;
  padding: 0 28px;
  border: none;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, #22d3ee 0%, #7c3aed 55%, #ec4899 100%);
  color: #fff;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 12px 34px rgba(124, 58, 237, 0.45);
  transition: transform 0.18s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.btn-primary-hero:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 16px 42px rgba(236, 72, 153, 0.48);
  filter: brightness(1.06);
}

.btn-primary-hero:active:not(:disabled) {
  transform: scale(0.97);
}

.btn-primary-hero:disabled {
  opacity: 0.65;
  cursor: wait;
}

.privacy-note {
  margin-top: 14px;
  font-size: 11.5px;
  color: var(--text-muted);
}

/* ==========================================================================
   BOTTOM HUD: Active Gesture Indicator, Legend & Camera Controls
   ========================================================================== */

.hud-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 12px 18px calc(16px + var(--safe-bottom));
  pointer-events: none;
}

.gesture-indicator {
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(440px, 100%);
  padding: 10px 16px;
  border-radius: 20px;
  background: var(--surface-glass-strong);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--shadow-glass);
  pointer-events: auto;
  transition: border-color 0.28s ease, box-shadow 0.28s ease, transform 0.22s ease;
}

.gesture-indicator[data-gesture="thumbs_up"] {
  border-color: rgba(255, 255, 255, 0.78);
  box-shadow: 0 12px 34px rgba(255, 255, 255, 0.24);
}

.gesture-indicator[data-gesture="finger_heart"] {
  border-color: rgba(255, 79, 163, 0.75);
  box-shadow: 0 12px 34px rgba(255, 79, 163, 0.3);
}

.gesture-indicator[data-gesture="metal"] {
  border-color: rgba(0, 240, 255, 0.75);
  box-shadow: 0 12px 36px rgba(168, 85, 247, 0.36);
}

.gesture-indicator[data-gesture="thumbs_down"] {
  border-color: rgba(56, 189, 248, 0.8);
  box-shadow: 0 12px 36px rgba(14, 165, 233, 0.38);
}

.gesture-icon-box {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 26px;
  flex-shrink: 0;
}

.gesture-meta {
  flex: 1;
  min-width: 0;
}

.gesture-meta-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}

.gesture-label {
  font-weight: 700;
  font-size: 14.5px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gesture-confidence {
  font-family: "Space Grotesk", monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-cyan);
}

.confidence-track {
  width: 100%;
  height: 5px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  margin-bottom: 5px;
}

.confidence-fill {
  width: 0%;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #22d3ee, #a855f7, #ff4fa3);
  transition: width 0.14s linear;
}

.gesture-indicator[data-gesture="thumbs_up"] .confidence-fill {
  background: linear-gradient(90deg, #ffffff, #cbd5e1);
}

.gesture-indicator[data-gesture="finger_heart"] .confidence-fill {
  background: linear-gradient(90deg, #ff7eb3, #ff2e63);
}

.gesture-indicator[data-gesture="metal"] .confidence-fill {
  background: linear-gradient(90deg, #00f0ff, #a855f7, #ff0099);
}

.gesture-indicator[data-gesture="thumbs_down"] .confidence-fill {
  background: linear-gradient(90deg, #38bdf8, #3b82f6, #e0f2fe);
}

.gesture-subtext {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Bottom Control & Legend Row */
.bottom-bar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  width: min(820px, 100%);
  pointer-events: auto;
}

.gesture-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 13px;
  border-radius: var(--radius-pill);
  background: var(--surface-glass);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: transform 0.2s ease, border-color 0.22s ease, background-color 0.22s ease, color 0.22s ease, box-shadow 0.22s ease;
}

.legend-emoji {
  font-size: 16px;
  line-height: 1;
}

.legend-chip.active[data-gesture="thumbs_up"] {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.88);
  background: rgba(255, 255, 255, 0.22);
  box-shadow: 0 0 22px rgba(255, 255, 255, 0.34);
  transform: translateY(-2px) scale(1.04);
}

.legend-chip.active[data-gesture="finger_heart"] {
  color: #fbcfe8;
  border-color: rgba(255, 79, 163, 0.88);
  background: rgba(255, 79, 163, 0.24);
  box-shadow: 0 0 22px rgba(255, 79, 163, 0.4);
  transform: translateY(-2px) scale(1.04);
}

.legend-chip.active[data-gesture="metal"] {
  color: #e9d5ff;
  border-color: rgba(0, 240, 255, 0.88);
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.22), rgba(168, 85, 247, 0.28));
  box-shadow: 0 0 24px rgba(168, 85, 247, 0.45);
  transform: translateY(-2px) scale(1.04);
}

.legend-chip.active[data-gesture="thumbs_down"] {
  color: #e0f2fe;
  border-color: rgba(56, 189, 248, 0.9);
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.28), rgba(37, 99, 235, 0.34));
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.45);
  transform: translateY(-2px) scale(1.04);
}

/* Camera Start / Stop Buttons */
.camera-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.cam-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: transform 0.16s ease, opacity 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.cam-btn:active:not(:disabled) {
  transform: scale(0.96);
}

.cam-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.cam-btn-start {
  background: linear-gradient(135deg, #10b981, #06b6d4);
  color: #fff;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.36);
}

.cam-btn-start:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(6, 182, 212, 0.46);
}

.cam-btn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
}

.cam-btn-stop {
  background: rgba(244, 63, 94, 0.22);
  border-color: rgba(244, 63, 94, 0.52);
  color: #ffe4e6;
}

.cam-btn-stop:hover:not(:disabled) {
  background: rgba(244, 63, 94, 0.36);
  transform: translateY(-1px);
}

/* TikTok-style Record Button & Live Timer Pill */
.rec-timer-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  background: rgba(225, 29, 72, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 8px 26px rgba(225, 29, 72, 0.55);
  font-family: "Space Grotesk", monospace;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.rec-live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
  animation: pulseDot 0.9s ease-in-out infinite;
}

.cam-btn-record {
  background: linear-gradient(135deg, #ff2e63, #e11d48);
  border-color: rgba(255, 255, 255, 0.28);
  color: #fff;
  box-shadow: 0 8px 24px rgba(225, 29, 72, 0.45);
}

.cam-btn-record:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 30px rgba(255, 46, 99, 0.6);
}

.rec-btn-shape {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  transition: border-radius 0.2s ease, transform 0.2s ease;
}

.cam-btn-record.recording {
  background: linear-gradient(135deg, #be123c, #9f1239);
  box-shadow: 0 0 0 3px rgba(255, 46, 99, 0.38), 0 8px 28px rgba(225, 29, 72, 0.65);
  animation: recPulseGlow 1.3s ease-in-out infinite;
}

.cam-btn-record.recording .rec-btn-shape {
  border-radius: 3px;
  transform: scale(0.92);
}

@keyframes recPulseGlow {
  0%, 100% { box-shadow: 0 0 0 2px rgba(255, 46, 99, 0.35), 0 8px 26px rgba(225, 29, 72, 0.55); }
  50% { box-shadow: 0 0 0 6px rgba(255, 46, 99, 0.55), 0 10px 34px rgba(255, 46, 99, 0.78); }
}

/* ==========================================================================
   Recorded Video Preview & Save to Gallery Modal
   ========================================================================== */

.record-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(4, 6, 14, 0.84);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.record-modal-card {
  width: min(440px, 100%);
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border-radius: 24px;
  background: rgba(14, 18, 34, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.72);
  overflow-y: auto;
}

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

.record-modal-header h2 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 18px;
  font-weight: 700;
}

.modal-close-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}

.record-preview-frame {
  width: 100%;
  max-height: 52dvh;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
  display: grid;
  place-items: center;
}

.record-preview-frame video {
  width: 100%;
  max-height: 52dvh;
  object-fit: contain;
  display: block;
}

.record-save-hint {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-secondary);
  text-align: center;
}

.record-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-save-gallery {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  border-radius: var(--radius-pill);
  border: none;
  background: linear-gradient(135deg, #22d3ee 0%, #7c3aed 55%, #ec4899 100%);
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(124, 58, 237, 0.45);
}

.btn-download-secondary {
  height: 42px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

/* ==========================================================================
   Responsive Design (Tablets & Smartphones)
   ========================================================================== */

@media (max-width: 720px) {
  .hud-top {
    padding: calc(10px + var(--safe-top)) 12px 8px;
  }

  .brand-pill {
    display: none;
  }

  .fps-badge {
    display: none;
  }

  .btn-label-sm {
    display: none;
  }

  .icon-btn {
    padding: 0 11px;
  }

  .start-overlay {
    padding: 60px 14px 120px;
    overflow-y: auto;
  }

  .gesture-preview-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .preview-item {
    flex-direction: row;
    text-align: left;
    padding: 10px 14px;
  }

  .hud-bottom {
    padding: 8px 12px calc(12px + var(--safe-bottom));
    gap: 8px;
  }

  .bottom-bar-row {
    justify-content: center;
  }

  .gesture-legend {
    justify-content: center;
    width: 100%;
  }

  .legend-chip {
    height: 32px;
    padding: 0 10px;
    font-size: 11.5px;
  }

  .camera-controls {
    width: 100%;
    justify-content: center;
    margin-left: 0;
  }

  .cam-btn {
    flex: 1;
    max-width: 180px;
    height: 40px;
    font-size: 13px;
  }
}
