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

body {
  font-family: "Segoe UI", system-ui, sans-serif;
  background: linear-gradient(160deg, #0f2027, #203a43, #2c5364);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

#app {
  position: relative;
  width: 480px;
  height: 640px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

#game-canvas { display: block; width: 100%; height: 100%; }

.hidden { display: none !important; }
.muted { color: rgba(255, 255, 255, 0.65); font-size: 0.85rem; }

/* ---------- Overlays ---------- */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: rgba(10, 20, 30, 0.82);
  backdrop-filter: blur(4px);
  text-align: center;
  padding: 24px;
  z-index: 10;
}

.title { font-size: 3rem; letter-spacing: 2px; text-shadow: 0 4px 12px rgba(0,0,0,.5); }
.title span { color: #ffd23f; }
.subtitle { color: rgba(255,255,255,.8); margin-top: -10px; }

.menu-buttons { display: flex; flex-direction: column; gap: 12px; width: 260px; }

.btn {
  border: none;
  border-radius: 10px;
  padding: 13px 22px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.35); }
.btn:active { transform: translateY(0); }

.btn-primary { background: #ffd23f; color: #1b2733; }
.btn-secondary { background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.3); }
.btn-link { background: none; color: rgba(255,255,255,.6); font-weight: 400; text-decoration: underline; }
.btn-small { padding: 6px 12px; font-size: .78rem; background: rgba(0,0,0,.45); color: #fff; }

/* ---------- Theme ---------- */
.theme-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.theme-row .settings-label { flex: 1; font-size: .9rem; font-weight: 600; }
.theme-btn { background: rgba(255,255,255,.14); color: #fff; }
.theme-btn.active { background: #ffd23f; color: #1b2733; }

#menu-logo {
  display: block;
  width: 240px;
  margin: 0 auto;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,.5));
}

/* ---------- Settings ---------- */
.settings {
  width: 280px;
  background: rgba(255,255,255,.07);
  border-radius: 12px;
  padding: 12px 18px;
  text-align: left;
}
.settings label {
  display: flex;
  justify-content: space-between;
  font-size: .9rem;
  font-weight: 600;
  margin-bottom: 6px;
}
.settings label strong { color: #ffd23f; }
.settings input[type="range"] {
  width: 100%;
  accent-color: #ffd23f;
  cursor: pointer;
}
.settings p { margin-top: 4px; font-size: .75rem; }

/* ---------- Leaderboard ---------- */
.leaderboard { width: 280px; background: rgba(255,255,255,.07); border-radius: 12px; padding: 14px 18px; }
.leaderboard h2 { font-size: 1rem; margin-bottom: 8px; }
.leaderboard ol { list-style-position: inside; text-align: left; font-size: .88rem; max-height: 150px; overflow-y: auto; }
.leaderboard li { padding: 3px 0; border-bottom: 1px solid rgba(255,255,255,.08); }
.leaderboard li strong { color: #ffd23f; float: right; }

/* ---------- Camera setup ---------- */
.setup-tips { text-align: left; line-height: 1.9; color: rgba(255,255,255,.85); font-size: .95rem; }

#camera-preview {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 120px;
  height: 90px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid rgba(255,255,255,.6);
  transform: scaleX(-1); /* mirror for natural feel */
  z-index: 15;
}

/* ---------- Countdown ---------- */
#countdown-number { font-size: 6rem; font-weight: 800; color: #ffd23f; text-shadow: 0 6px 20px rgba(0,0,0,.6); }

/* ---------- Game over ---------- */
.score-box { display: flex; gap: 30px; font-size: 1.1rem; }
.score-box strong { display: block; font-size: 2.2rem; color: #ffd23f; }
.submit-row { display: flex; gap: 8px; }
.submit-row input {
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.35);
  background: rgba(255,255,255,.1);
  color: #fff;
  padding: 10px 14px;
  font-size: 1rem;
  width: 170px;
}
.submit-row input::placeholder { color: rgba(255,255,255,.45); }

/* ---------- HUD ---------- */
#hud {
  position: absolute;
  top: 10px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 14px;
  z-index: 5;
  pointer-events: none;
}
#hud button { pointer-events: auto; }
#hud-score {
  font-size: 2.4rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 3px 8px rgba(0,0,0,.55);
}

