* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: #0f1115;
  color: #f3f4f6;
}
.app {
  max-width: 860px;
  margin: 0 auto;
  padding: 20px;
}
h1, h2, h3 { margin-top: 0; }
.screen { display: none; }
.screen.active { display: block; }

.card {
  background: #171a21;
  border: 1px solid #272b35;
  border-radius: 14px;
  padding: 16px;
  margin: 16px 0;
}
.btn {
  border: 1px solid #3a4050;
  background: #212635;
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  margin: 4px 6px 4px 0;
}
.btn:hover { opacity: 0.95; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: #2563eb; border-color: #2563eb; }
.btn-danger { background: #b91c1c; border-color: #b91c1c; }
.big {
  font-size: 22px;
  padding: 14px 22px;
}
.muted { color: #a9b0bd; }
.hint { margin-top: 10px; color: #8e96a8; font-size: 13px; }
.status {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #171a21;
  border: 1px solid #272b35;
}
.top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}
label {
  display: block;
  font-size: 14px;
  color: #cfd5df;
}
input[type="number"], input[type="password"], input[type="file"] {
  width: 100%;
  margin-top: 6px;
  background: #0f1115;
  border: 1px solid #2f3543;
  color: #fff;
  border-radius: 10px;
  padding: 10px;
}
.actions { margin-top: 10px; }

.track-item {
  border: 1px solid #2a3040;
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 10px;
  background: #12151c;
}
.track-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.badge {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid #3a4050;
  color: #dbe2ee;
}
.badge.active { border-color: #22c55e; color: #22c55e; }
.badge.off { border-color: #ef4444; color: #ef4444; }
.upload-box {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #2a3040;
}
.upload-label {
  display: block;
  margin-bottom: 6px;
}
.small {
  font-size: 12px;
  color: #a9b0bd;
}

.status.tap-flash {
  transform: scale(0.995);
  opacity: 0.92;
  transition: 0.08s ease;
}

select {
  width: 100%;
  margin-top: 6px;
  background: #0f1115;
  border: 1px solid #2f3543;
  color: #fff;
  border-radius: 10px;
  padding: 10px;
}

.viz-wrap {
  margin-top: 12px;
  background: #11141b;
  border: 1px solid #272b35;
  border-radius: 12px;
  padding: 8px;
  overflow: hidden;
}

#visualizer {
  width: 100%;
  height: 140px;
  display: block;
  border-radius: 8px;
  background: #0b0d12;
}

.cookie-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 9999;
  background: #171a21;
  border: 1px solid #2f3543;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}
.cookie-text {
  color: #d9dfeb;
  font-size: 14px;
}

/* --- Mosquito mini-game --- */
.game-wrap {
  margin-top: 14px;
  background: #12151c;
  border: 1px solid #272b35;
  border-radius: 12px;
  padding: 10px;
}
.game-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.game-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
  color: #d9dfeb;
}
.game-badge {
  border: 1px solid #3a4050;
  border-radius: 999px;
  padding: 4px 8px;
  background: #1a1f2a;
}
.game-medals {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.medal {
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  border: 1px solid #3a4050;
  color: #cfd5df;
  background: #171a21;
}
.medal.on {
  border-color: #f59e0b;
  color: #f59e0b;
}
.medal.boss {
  border-color: #22c55e;
  color: #22c55e;
}
.game-area {
  position: relative;
  height: 180px;
  border-radius: 10px;
  background:
    radial-gradient(circle at 20% 20%, rgba(34,197,94,.06), transparent 40%),
    radial-gradient(circle at 80% 40%, rgba(37,99,235,.06), transparent 35%),
    #0b0d12;
  border: 1px solid #222834;
  overflow: hidden;
  touch-action: manipulation;
}
.fly {
  position: absolute;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  cursor: pointer;
  user-select: none;
  transform: translate(-50%, -50%);
  transition: transform .08s ease, opacity .15s ease;
  font-size: 24px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.35));
}
.fly.mosq { }
.fly.wasp { font-size: 26px; }
.fly.gold { font-size: 26px; animation: goldPulse 0.7s infinite alternate; }

@keyframes goldPulse {
  from { transform: translate(-50%, -50%) scale(1); }
  to   { transform: translate(-50%, -50%) scale(1.08); }
}

.fly.splat {
  animation: splat .28s ease forwards;
}
@keyframes splat {
  0%   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  60%  { opacity: 1; transform: translate(-50%, -50%) scale(1.35) rotate(8deg); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.4) rotate(-12deg); }
}

.splat-mark {
  position: absolute;
  transform: translate(-50%, -50%);
  color: #ef4444;
  font-size: 18px;
  pointer-events: none;
  opacity: .8;
  animation: fadeMark .55s ease forwards;
}
@keyframes fadeMark {
  from { opacity: .95; transform: translate(-50%, -50%) scale(1); }
  to   { opacity: 0; transform: translate(-50%, -50%) scale(1.4); }
}

.game-toast {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  background: rgba(23,26,33,.94);
  border: 1px solid #384055;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  color: #fff;
  opacity: 0;
  transition: opacity .15s ease;
  pointer-events: none;
}
.game-toast.show { opacity: 1; }

.game-reward {
  color: #facc15;
  font-weight: 600;
}
