/* Pup Pong R1 v=r1-9 — full-bleed fixed stage (r1-7 safe layout) */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  height: 100%;
  width: 100%;
  margin: 0;
  overflow: hidden;
  background: #120a06;
  color: #ffe8c8;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Rounded", system-ui, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
  overscroll-behavior: none;
}

#wrap {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #120a06;
  touch-action: none;
}

#game {
  display: block;
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  touch-action: none;
  outline: none;
  z-index: 1;
}

#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 15;
  display: flex;
  gap: 6px;
  align-items: flex-start;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 10px 0;
  pointer-events: none;
}
.score {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 200, 120, 0.22);
  border-radius: 10px;
  padding: 5px 8px;
  min-width: 44px;
}
.score span {
  display: block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: rgba(255, 220, 180, 0.65);
}
.score strong {
  font-size: 18px;
  font-weight: 800;
  color: #ffe7c2;
  font-variant-numeric: tabular-nums;
}
#muteBtn {
  pointer-events: auto;
  margin-left: auto;
  border: 1px solid rgba(255, 200, 120, 0.22);
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 12px;
  font-size: 16px;
  cursor: pointer;
  touch-action: manipulation;
}

/* Edge pads — primary controls when dial is dead */
.edgeBtn {
  position: absolute;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  z-index: 35;
  width: 56px;
  height: 56px;
  min-width: 48px;
  min-height: 48px;
  border-radius: 16px;
  border: 1px solid rgba(255, 220, 180, 0.35);
  background: rgba(0, 0, 0, 0.55);
  color: rgba(255, 231, 194, 0.95);
  font-size: 20px;
  font-weight: 800;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.edgeBtn.left {
  left: calc(10px + env(safe-area-inset-left, 0px));
}
.edgeBtn.right {
  right: calc(10px + env(safe-area-inset-right, 0px));
}
.edgeBtn:active {
  transform: scale(0.94);
  background: rgba(0, 0, 0, 0.75);
  border-color: rgba(255, 220, 180, 0.55);
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(12, 6, 3, 0.88);
  padding: 16px 14px;
  text-align: center;
  color: #ffe8c8;
}
.overlay.hidden { display: none; }
.logo {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  object-fit: cover;
  margin-bottom: 10px;
  box-shadow: 0 8px 28px rgba(255, 160, 60, 0.35);
}
.overlay h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
  color: #fff5e6;
}
.overlay p {
  color: rgba(255, 230, 200, 0.85);
  font-size: 12px;
  line-height: 1.4;
  margin-bottom: 14px;
  max-width: 210px;
}
.cta {
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
  background: linear-gradient(180deg, #ffb347, #e8890c);
  color: #2a1400;
  font-weight: 800;
  font-size: 16px;
  min-height: 48px;
  padding: 12px 32px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(232, 137, 12, 0.4);
}
.cta:active { transform: scale(0.97); }

/* Low-contrast debug chip — above left pad so it never steals hits */
#r1Chip {
  position: absolute;
  left: calc(8px + env(safe-area-inset-left, 0px));
  bottom: calc(78px + env(safe-area-inset-bottom, 0px));
  z-index: 20;
  font: 700 9px ui-monospace, SFMono-Regular, Menlo, monospace;
  color: rgba(255, 255, 255, 0.4);
  background: rgba(0, 0, 0, 0.35);
  padding: 2px 6px;
  border-radius: 6px;
  pointer-events: none;
  max-width: 55vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-height: 360px) {
  .overlay h1 { font-size: 22px; }
  .logo { width: 56px; height: 56px; }
  .edgeBtn { width: 48px; height: 48px; font-size: 16px; }
  .score strong { font-size: 15px; }
  #r1Chip { bottom: calc(70px + env(safe-area-inset-bottom, 0px)); }
}
