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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  min-height: 100vh;
  color: #fff;
  overflow-x: hidden;
  overflow-y: auto;
}

body.no-scroll {
  overflow: hidden;
}

.container {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 40px 20px;
  position: relative;
}

/* Language Switcher */
.lang-switcher {
  position: fixed;
  top: 15px;
  right: 15px;
  display: flex;
  gap: 5px;
  z-index: 1000;
}

.lang-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #8b8b9e;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.lang-btn.active {
  background: #e94560;
  border-color: #e94560;
  color: #fff;
}

.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: fadeIn 0.3s ease;
}

.screen.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Title */
.title {
  font-size: 4rem;
  font-weight: 900;
  letter-spacing: -2px;
  line-height: 1;
  margin-bottom: 10px;
}

.blink-text {
  color: #e94560;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.subtitle {
  color: #8b8b9e;
  margin-bottom: 10px;
  font-size: 1.1rem;
}

.seo-tagline {
  color: #6b6b7e;
  font-size: 0.9rem;
  margin-bottom: 30px;
  font-style: italic;
}

/* SEO Footer */
.seo-footer {
  margin-top: 40px;
  padding: 20px;
  max-width: 500px;
  text-align: left;
  color: #6b6b7e;
  font-size: 0.85rem;
  line-height: 1.6;
}

.seo-footer h2 {
  font-size: 1rem;
  color: #8b8b9e;
  margin-bottom: 10px;
}

.seo-footer p {
  margin-bottom: 10px;
}

.features-list {
  list-style: none;
  padding: 0;
  margin-top: 15px;
}

.features-list li {
  padding: 5px 0;
  padding-left: 20px;
  position: relative;
}

.features-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: #00ff64;
}

/* Share Buttons */
.share-buttons {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.btn-share {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-twitter {
  background: #1da1f2;
  color: #fff;
}

.btn-twitter:hover {
  background: #0d8ddb;
}

.btn-copy {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

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

.btn-copy.copied {
  background: #00ff64;
  color: #000;
}

/* Input */
.input-group {
  margin-bottom: 20px;
}

.input-group input {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 15px 25px;
  color: #fff;
  font-size: 1.1rem;
  text-align: center;
  width: 250px;
  transition: all 0.3s ease;
}

.input-group input:focus {
  outline: none;
  border-color: #e94560;
  background: rgba(233, 69, 96, 0.1);
}

.input-group input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

/* Buttons */
.btn {
  border: none;
  border-radius: 12px;
  padding: 15px 40px;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.btn-primary {
  background: #e94560;
  color: #fff;
}

.btn-primary:hover {
  background: #ff6b6b;
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(233, 69, 96, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

/* Top Score */
.top-score {
  margin-top: 40px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.top-score .label {
  color: #8b8b9e;
  font-size: 0.8rem;
  letter-spacing: 2px;
}

.top-score .value {
  color: #ffd700;
  font-size: 1.5rem;
  font-weight: 700;
}

/* Game Screen */
.timer-display {
  margin-bottom: 20px;
}

#timer {
  font-size: 5rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, #fff, #e94560);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.timer-label {
  display: block;
  color: #8b8b9e;
  font-size: 1rem;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.video-container {
  position: relative;
  width: 400px;
  height: 300px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

#video, #canvas, #video-game, #canvas-game {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

#canvas, #canvas-game {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}

/* Calibration Screen */
.calibration-title {
  font-size: 2.5rem;
  font-weight: 900;
  margin-bottom: 10px;
  color: #00ff64;
}

.calibration-subtitle {
  color: #8b8b9e;
  margin-bottom: 30px;
  font-size: 1.1rem;
}

.calibration-status {
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  text-align: center;
}

.calibration-progress {
  background: rgba(0, 0, 0, 0.5);
  border-radius: 10px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 10px;
}

.calibration-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #00ff64, #00cc50);
  border-radius: 10px;
  transition: width 0.1s ease;
}

#calibration-text {
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.ear-display {
  margin-top: 25px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ear-label {
  color: #8b8b9e;
  font-size: 0.8rem;
  letter-spacing: 2px;
}

.ear-value {
  color: #00ff64;
  font-size: 2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ear-value.low {
  color: #e94560;
}

.countdown {
  font-size: 8rem;
  font-weight: 900;
  color: #e94560;
  animation: countPulse 1s ease-in-out;
}

@keyframes countPulse {
  0% { transform: scale(1.5); opacity: 0; }
  50% { transform: scale(1); opacity: 1; }
  100% { transform: scale(0.8); opacity: 0; }
}

.eye-status {
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 255, 100, 0.9);
  color: #000;
  padding: 8px 20px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 1px;
}

.eye-status.closed {
  background: rgba(233, 69, 96, 0.9);
  color: #fff;
}

.hint {
  margin-top: 20px;
  color: #8b8b9e;
  font-size: 1rem;
}

/* Game Over Screen */
.gameover-title {
  font-size: 3rem;
  color: #e94560;
  margin-bottom: 20px;
  animation: shake 0.5s ease;
}

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

.final-score {
  margin-bottom: 10px;
}

.score-value {
  font-size: 4rem;
  font-weight: 900;
  color: #ffd700;
}

.score-label {
  display: block;
  color: #8b8b9e;
  font-size: 1rem;
  letter-spacing: 2px;
}

.rank-display {
  background: rgba(255, 215, 0, 0.1);
  border: 2px solid #ffd700;
  border-radius: 10px;
  padding: 10px 30px;
  margin-bottom: 30px;
  color: #ffd700;
  font-weight: 700;
  font-size: 1.2rem;
}

/* Leaderboard */
.leaderboard {
  width: 300px;
  margin-bottom: 30px;
}

.leaderboard h3 {
  color: #8b8b9e;
  font-size: 0.9rem;
  letter-spacing: 2px;
  margin-bottom: 15px;
}

.leaderboard ol {
  list-style: none;
  text-align: left;
}

.leaderboard li {
  display: flex;
  justify-content: space-between;
  padding: 10px 15px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.leaderboard li:nth-child(1) {
  background: rgba(255, 215, 0, 0.15);
  border: 1px solid rgba(255, 215, 0, 0.3);
}

.leaderboard li:nth-child(2) {
  background: rgba(192, 192, 192, 0.1);
}

.leaderboard li:nth-child(3) {
  background: rgba(205, 127, 50, 0.1);
}

.leaderboard .name {
  color: #fff;
}

.leaderboard .time {
  color: #e94560;
  font-weight: 700;
}

/* Face guide overlay */
.face-guide {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 180px;
  height: 240px;
  border: 3px dashed rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  pointer-events: none;
  transition: all 0.3s ease;
}

.face-guide.detected {
  border-color: #00ff64;
  border-style: solid;
}

.face-guide-text {
  position: absolute;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  white-space: nowrap;
}

/* Buy Me a Coffee */
.bmc-container {
  margin-top: 20px;
}

/* Ad container */
.ad-container {
  width: 100%;
  max-width: 728px;
  min-height: 90px;
  background: linear-gradient(135deg, #1a1a2e 0%, #2d2d44 100%);
  border: 2px solid #ffd700;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 20px;
  color: #ffd700;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s ease;
}

.ad-link:hover {
  background: linear-gradient(135deg, #2d2d44 0%, #3d3d5c 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(255, 215, 0, 0.3);
}

.ad-container-mobile {
  display: none;
}

/* Responsive - Mobile fullscreen game */
@media (max-width: 768px) {
  .container {
    padding: 10px;
  }

  .title {
    font-size: 3rem;
  }

  /* Fullscreen video on mobile during game */
  #calibration-screen.active,
  #game-screen.active {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0;
    z-index: 100;
    background: #000;
  }

  #calibration-screen .video-container,
  #game-screen .video-container {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    box-shadow: none;
  }

  /* Overlay UI on fullscreen video */
  #calibration-screen .calibration-title,
  #calibration-screen .calibration-subtitle,
  #calibration-screen .ear-display {
    position: absolute;
    z-index: 10;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
  }

  #calibration-screen .calibration-title {
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.8rem;
  }

  #calibration-screen .calibration-subtitle {
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.9rem;
    margin-bottom: 0;
  }

  #calibration-screen .ear-display {
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
  }

  /* Game screen mobile */
  #game-screen .timer-display {
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    margin-bottom: 0;
  }

  #game-screen #timer {
    font-size: 4rem;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
  }

  #game-screen .hint {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
  }

  .face-guide {
    width: 140px;
    height: 190px;
  }

  /* Ads on mobile */
  .ad-container {
    display: none;
  }

  .ad-container-mobile {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: linear-gradient(135deg, #1a1a2e 0%, #2d2d44 100%);
    border-top: 2px solid #ffd700;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    color: #ffd700;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
  }

  /* Hide mobile ad during active game */
  #game-screen.active ~ .ad-container-mobile,
  #calibration-screen.active ~ .ad-container-mobile {
    display: none;
  }

  .score-value {
    font-size: 3rem;
  }

  .gameover-title {
    font-size: 2.5rem;
  }

  .leaderboard {
    width: 90%;
    max-width: 300px;
  }
}
