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

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Baloo 2', system-ui, sans-serif;
  background: #1a1d16;
}

/* ---- Игра на весь экран ---- */
#game-panel {
  position: fixed;
  inset: 0;
  z-index: 1;
}

/* ---- Камера: PIP в левом нижнем углу ---- */
#cam-panel {
  position: fixed;
  left: 16px;
  bottom: 16px;
  width: 300px;
  height: 220px;
  z-index: 5;
  background: #0d0f0b;
  overflow: hidden;
  border-radius: 18px;
  border: 2px solid rgba(255, 255, 255, .55);
  box-shadow: 0 10px 32px rgba(0, 0, 0, .45);
}

@media (max-width: 640px) {
  #cam-panel {
    width: 44vw;
    height: 32vw;
    left: 10px;
    bottom: 10px;
  }
}

#cam-video, #cam-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* зеркало */
}

#gesture-pill {
  position: absolute;
  left: 50%;
  top: 8px;
  transform: translateX(-50%);
  padding: 4px 14px;
  border-radius: 999px;
  background: rgba(0,0,0,.6);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .5px;
  white-space: nowrap;
  backdrop-filter: blur(4px);
  text-transform: uppercase;
}

#gesture-pill.glide { background: rgba(60, 165, 90, .85); }
#gesture-pill.dive  { background: rgba(200, 70, 55, .85); }
#gesture-pill.flap  { background: rgba(240, 175, 45, .95); color: #2a1e05; }

/* Живые индикаторы жестов */
#gesture-bars {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  display: flex;
  gap: 6px;
  pointer-events: none;
}
.gbar {
  flex: 1;
  height: 8px;
  border-radius: 6px;
  background: rgba(255,255,255,.18);
  overflow: hidden;
  position: relative;
}
.gbar::after {
  content: attr(data-label);
  position: absolute;
  left: 6px; top: -14px;
  font-size: 10px;
  font-weight: 800;
  color: rgba(255,255,255,.75);
  letter-spacing: .5px;
}
.gbar > i {
  display: block;
  height: 100%;
  width: 0%;
  background: #ffd83d;
  transition: width .05s linear, background .1s linear;
}
.gbar.active > i { background: #5fd6e8; }

#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#hud {
  position: fixed;
  top: 14px;
  left: 16px;
  right: 16px;
  z-index: 6;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}

#apple-counter {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #4a4a3d;
  font-size: 20px;
  font-weight: 800;
  text-shadow: 0 1px 0 rgba(255,255,255,.5);
}

#alt-meter {
  color: #4a4a3d;
  font-size: 16px;
  font-weight: 700;
  opacity: .8;
  text-shadow: 0 1px 0 rgba(255,255,255,.5);
}

/* ---- Оверлеи ---- */
#start-overlay, #win-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 24, 16, .72);
  backdrop-filter: blur(6px);
}

.hidden { display: none !important; }

.overlay-card {
  max-width: 340px;
  width: calc(100% - 40px);
  background: #fdfaf1;
  border-radius: 22px;
  padding: 26px 24px;
  text-align: center;
  box-shadow: 0 18px 50px rgba(0,0,0,.4);
}

.overlay-card h1 {
  font-size: 32px;
  font-weight: 800;
  color: #3d4a2e;
}

.overlay-card .sub {
  color: #8a8a76;
  font-weight: 600;
  margin-bottom: 14px;
}

.rules {
  list-style: none;
  text-align: left;
  margin: 0 0 14px;
  color: #4a4a3d;
  font-size: 15px;
  line-height: 1.9;
}

.rules b { color: #3d4a2e; }

.hint {
  font-size: 13px;
  color: #9a9a86;
  margin-bottom: 18px;
}

.overlay-card button {
  display: block;
  width: 100%;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 800;
  font-size: 19px;
  padding: 13px;
  border-radius: 14px;
  background: #7fb14f;
  color: #fff;
  box-shadow: 0 4px 0 #5d8a3a;
  transition: transform .08s;
}

.overlay-card button:active { transform: translateY(3px); box-shadow: none; }

#btn-kb {
  margin-top: 10px;
  background: transparent;
  color: #8a8a76;
  font-size: 14px;
  font-weight: 600;
  box-shadow: none;
  padding: 6px;
}

#turn-debug {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(74,74,61,.5);
  font-size: 12px;
  font-weight: 600;
  pointer-events: none;
}
