/* Root theme variables */
:root {
  --bg: #181a1b;
  --fg: #f5f6fa;
  --accent: #4f8cff;
  --header-bg: #23272a;
  --card-bg: #222326;
  --button-bg: #4f8cff;
  --button-fg: #fff;
  --button-hover: #3561b7;
  --error-bg: #ff4f4f;
  --error-fg: #fff;
  --transition: 0.3s cubic-bezier(0.4,0,0.2,1);
}

body.light {
  --bg: #f5f6fa;
  --fg: #181a1b;
  --header-bg: #e3e6ea;
  --card-bg: #fff;
  --button-bg: #4f8cff;
  --button-fg: #fff;
  --button-hover: #3561b7;
  --error-bg: #ff4f4f;
  --error-fg: #fff;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
  transition: background var(--transition), color var(--transition);
}

.container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

header {
  position: relative;
  background: transparent;
  box-shadow: none;
}

header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 0.2em;
  color: var(--fg);
  text-shadow: 0 2px 12px rgba(79,140,255,0.12);
}

.subtitle {
  font-size: 1.15rem;
  color: #a0b3d6;
  margin: 0 0 1.2em 0;
  font-weight: 400;
  letter-spacing: 0.2px;
  text-shadow: 0 1px 8px rgba(79,140,255,0.08);
}

body.light .subtitle {
  color: #4f8cff;
}

#theme-toggle {
  position: absolute;
  right: 2rem;
  top: 1.5rem;
  background: rgba(255,255,255,0.18);
  border-radius: 50%;
  border: none;
  font-size: 1.7rem;
  cursor: pointer;
  color: var(--accent);
  box-shadow: 0 2px 8px rgba(79,140,255,0.08);
  transition: color var(--transition), background var(--transition), transform var(--transition);
}
#theme-toggle:hover {
  background: rgba(79,140,255,0.18);
  color: #fff;
  transform: scale(1.1);
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.video-wrapper {
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
  position: relative;
  width: 100%;
  max-width: 480px;
  aspect-ratio: 3/4;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 1s;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Loader Spinner */
.loader {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 56px;
  height: 56px;
  transform: translate(-50%, -50%);
  border: 6px solid #fff3;
  border-top: 6px solid var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  z-index: 3;
}
@keyframes spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

video, canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  border-radius: 1.2rem;
  object-fit: cover;
}

#overlay {
  pointer-events: none;
}

#error-message {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--error-bg);
  color: var(--error-fg);
  padding: 0.7rem 1rem;
  font-size: 1rem;
  text-align: center;
  border-radius: 0 0 1.2rem 1.2rem;
  opacity: 0.95;
  z-index: 2;
  transition: opacity var(--transition);
}

.hidden {
  display: none !important;
}

.controls {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  justify-content: center;
  margin-top: 1rem;
}

#detect-toggle {
  background: linear-gradient(90deg, #4f8cff 0%, #a770ef 100%);
  color: var(--button-fg);
  border: none;
  border-radius: 2rem;
  padding: 0.7rem 2.2rem;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(79,140,255,0.13);
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  outline: none;
  overflow: hidden;
  position: relative;
}
#detect-toggle span {
  position: relative;
  z-index: 2;
}
#detect-toggle::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  background: rgba(255,255,255,0.18);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.4s, height 0.4s;
  z-index: 1;
}
#detect-toggle:active::after {
  width: 200%;
  height: 200%;
}
#detect-toggle:hover, #detect-toggle:focus {
  background: linear-gradient(90deg, #a770ef 0%, #4f8cff 100%);
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 4px 24px rgba(167,112,239,0.18);
}

#face-count {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--accent);
  transition: color var(--transition);
}
.count-num {
  font-size: 1.3em;
  font-weight: 700;
  margin-left: 0.2em;
  transition: color 0.3s, transform 0.3s;
  display: inline-block;
}
.count-num.animated {
  color: #f6d365;
  transform: scale(1.3) rotate(-8deg);
  animation: popCount 0.4s;
}
@keyframes popCount {
  0% { transform: scale(1) rotate(0deg); }
  40% { transform: scale(1.3) rotate(-8deg); }
  100% { transform: scale(1) rotate(0deg); }
}

footer {
  text-align: center;
  padding: 1.2rem 0 0.7rem 0;
  font-size: 1rem;
  color: #888;
  text-shadow: 0 1px 8px rgba(79,140,255,0.08);
}
footer a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}
footer a:hover {
  color: var(--button-hover);
}

/* Enhanced bounding box glow */
canvas {
  filter: drop-shadow(0 0 8px #4f8cff88);
  transition: filter 0.3s;
}

/* Glassmorphism Card */
.glass {
  background: rgba(34, 35, 38, 0.45);
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.18);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 1.2rem;
  border: 1.5px solid rgba(255,255,255,0.18);
  transition: background var(--transition);
}
body.light .glass {
  background: rgba(255,255,255,0.55);
  border: 1.5px solid rgba(79,140,255,0.13);
}

@media (max-width: 600px) {
  .video-wrapper {
    max-width: 98vw;
    aspect-ratio: 3/4;
  }
  header h1 {
    font-size: 1.3rem;
  }
  .subtitle {
    font-size: 1rem;
  }
  #theme-toggle {
    right: 1rem;
    top: 1rem;
    font-size: 1.2rem;
  }
  .controls {
    flex-direction: column;
    gap: 0.7rem;
  }
}

/* Floating Shapes */
.floating-shapes {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  pointer-events: none;
  z-index: -1;
}
.shape {
  position: absolute;
  border-radius: 50%;
  opacity: 0.18;
  filter: blur(2px);
  animation: floatShape 12s infinite ease-in-out;
}
.shape1 {
  width: 180px; height: 180px;
  background: #4f8cff;
  left: 8vw; top: 10vh;
  animation-delay: 0s;
}
.shape2 {
  width: 120px; height: 120px;
  background: #a770ef;
  right: 10vw; top: 30vh;
  animation-delay: 2s;
}
.shape3 {
  width: 90px; height: 90px;
  background: #f6d365;
  left: 50vw; bottom: 8vh;
  animation-delay: 4s;
}
@keyframes floatShape {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-30px) scale(1.08); }
}

/* Hero Icon */
.hero-icon {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 0.5em;
  animation: popIn 1.2s cubic-bezier(0.4,0,0.2,1);
}
@keyframes popIn {
  0% { opacity: 0; transform: scale(0.7) translateY(-30px); }
  80% { opacity: 1; transform: scale(1.1) translateY(5px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* Typewriter subtitle */
.typewriter {
  overflow: hidden;
  border-right: .12em solid #4f8cff;
  white-space: nowrap;
  margin: 0 auto;
  letter-spacing: .04em;
  animation: typing 2.5s steps(40, end), blink-caret .7s step-end infinite;
  max-width: 100vw;
}
@keyframes typing {
  from { width: 0 }
  to { width: 100% }
}
@keyframes blink-caret {
  from, to { border-color: transparent }
  50% { border-color: #4f8cff; }
}

/* Features Section */
.features {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2.5rem 2rem;
  margin: 2.5rem 0 0 0;
  padding: 0 0.5rem;
  animation: fadeIn 1.2s 0.5s backwards;
}
.feature {
  background: rgba(255,255,255,0.08);
  border-radius: 1.1rem;
  box-shadow: 0 2px 12px rgba(79,140,255,0.07);
  padding: 1.2rem 1.5rem;
  min-width: 180px;
  max-width: 220px;
  text-align: center;
  transition: background 0.3s, box-shadow 0.3s, transform 0.3s;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.feature:hover {
  background: rgba(79,140,255,0.13);
  box-shadow: 0 4px 24px rgba(167,112,239,0.13);
  transform: translateY(-6px) scale(1.04);
}
.feature-icon {
  font-size: 2.1rem;
  margin-bottom: 0.5rem;
  display: block;
  color: #4f8cff;
  filter: drop-shadow(0 2px 8px #4f8cff33);
}
.feature h3 {
  margin: 0.2em 0 0.3em 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--fg);
}
.feature p {
  margin: 0;
  color: #a0b3d6;
  font-size: 0.98rem;
}
body.light .feature p {
  color: #4f8cff;
}

/* Video Card Hover Animation */
.video-wrapper.glass {
  transition: box-shadow 0.4s, transform 0.4s;
}
.video-wrapper.glass:hover {
  box-shadow: 0 8px 48px 0 #4f8cff55;
  transform: scale(1.025) translateY(-4px);
}

/* Loader Pulse */
.loader {
  animation: spin 1s linear infinite, loaderPulse 1.2s infinite alternate;
}
@keyframes loaderPulse {
  0% { box-shadow: 0 0 0 0 #4f8cff44; }
  100% { box-shadow: 0 0 24px 12px #4f8cff22; }
}

/* Custom Cursor for Buttons */
button, .feature {
  cursor: pointer;
}
button:active, .feature:active {
  filter: brightness(0.95);
}

@media (max-width: 900px) {
  .features {
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
  }
} 