* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #101a2e;
  font-family: "Avenir Next", "Trebuchet MS", system-ui, sans-serif;
  color: #fff;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

/* iPad: no page to scroll, nothing to zoom — the whole screen is the court */
body { position: fixed; inset: 0; }

canvas { display: block; cursor: crosshair; touch-action: none; }

/* ---------- HUD ---------- */

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

#scoreBox {
  position: absolute;
  top: max(18px, env(safe-area-inset-top));
  left: max(20px, env(safe-area-inset-left));
  text-shadow: 0 2px 10px rgba(0, 10, 30, 0.8);
}

#scoreBox .label {
  font-size: 12px;
  letter-spacing: 2.5px;
  opacity: 0.8;
}

#wins {
  font-size: 34px;
  font-weight: 700;
  line-height: 1.05;
}

/* who is still standing — three dots a side, they go dark as people go out */
.teams { margin-top: 10px; }

.team {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.team .tag {
  font-size: 11px;
  letter-spacing: 2px;
  width: 42px;
  opacity: 0.85;
}

.dots { display: flex; gap: 5px; }

.dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.5);
}

.you .dot.on { background: #56b7ff; border-color: #b7e2ff; }
.them .dot.on { background: #ff6a5a; border-color: #ffc0b8; }
.dot.off { background: rgba(255, 255, 255, 0.07); border-color: rgba(255, 255, 255, 0.22); }

#soundBtn {
  position: absolute;
  top: max(18px, env(safe-area-inset-top));
  right: max(20px, env(safe-area-inset-right));
  pointer-events: auto;
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.55);
  background: rgba(10, 25, 50, 0.35);
  color: #fff;
  font: inherit;
  font-size: 12px;
  letter-spacing: 2px;
  padding: 8px 12px;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}

#soundBtn:hover { border-color: #fff; }
#soundBtn[aria-pressed="true"] { background: rgba(255, 255, 255, 0.9); color: #10203a; }

/* how hard the throw will be — fills up while you drag the mouse back */
#powerBox {
  position: absolute;
  bottom: calc(34px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: 260px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(10, 25, 50, 0.4);
}

#powerBox.hidden { display: none; }

#powerFill {
  height: 100%;
  width: 0%;
  background: #dfe9f5;
  transition: background 0.1s;
}

#powerBox.hot #powerFill { background: #ff5236; }

#powerWord {
  position: absolute;
  inset: 0;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 3px;
  line-height: 12px;
  color: #10203a;
  mix-blend-mode: normal;
}

#message {
  position: absolute;
  top: 16%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 62px;
  font-weight: 700;
  letter-spacing: -1px;
  white-space: nowrap;
  text-shadow: 0 4px 26px rgba(0, 10, 30, 0.85);
  opacity: 0;
  transition: opacity 0.25s;
}

#message.on { opacity: 1; }
#message.small { font-size: 34px; }

#ballHint {
  position: absolute;
  bottom: calc(66px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  letter-spacing: 2.5px;
  opacity: 0;
  transition: opacity 0.3s;
  text-shadow: 0 2px 10px rgba(0, 10, 30, 0.9);
}

#ballHint.on { opacity: 0.85; }

/* ---------- start / end card ---------- */

#start {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px;
  overflow-y: auto;
  background: radial-gradient(circle at 50% 35%, rgba(30, 70, 130, 0.72), rgba(8, 14, 30, 0.94));
  backdrop-filter: blur(3px);
}

#start.hidden { display: none; }

#start h1 {
  margin: 0;
  font-size: 68px;
  letter-spacing: 4px;
}

#start .tag {
  margin: 6px 0 22px;
  font-size: 17px;
  opacity: 0.9;
  letter-spacing: 1px;
}

#start .keys {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  font-size: 14px;
  line-height: 1.9;
  opacity: 0.92;
}

#start .keys b {
  display: inline-block;
  min-width: 22px;
  padding: 1px 7px;
  margin-right: 6px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 5px;
  font-size: 12px;
  letter-spacing: 1px;
}

#start .note {
  max-width: 560px;
  font-size: 13px;
  line-height: 1.65;
  opacity: 0.85;
  margin: 0 0 26px;
}

#start .note .hot { color: #ff8a76; }
#start .note .cold { color: #cfe6ff; }

#startBtn {
  cursor: pointer;
  border: none;
  background: #ff5236;
  color: #fff;
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 3px;
  padding: 15px 34px;
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(255, 82, 54, 0.35);
}

#startBtn:hover { background: #ff6d54; }

/* ---------- iPad / touch ---------- */
/* Everything below only shows once the page knows it is being played with a
   finger (body.touch, set in game.js). Desktop never sees any of it. */

#start .keys.touch { display: none; }
body.touch #start .keys.desk { display: none; }
body.touch #start .keys.touch { display: block; }

body.touch #soundBtn { min-height: 44px; padding: 10px 16px; }
body.touch #startBtn { min-height: 54px; }

#pad { display: none; }
body.touch #pad { display: block; }
#pad.hidden { display: none !important; }

#pad, #pad * { touch-action: none; }

/* the stick sits up off the bottom edge — the corner under it belongs to the
   "Rigotti Games" back link */
#stick {
  position: fixed;
  z-index: 15;
  left: calc(26px + env(safe-area-inset-left));
  bottom: calc(78px + env(safe-area-inset-bottom));
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.45);
  background: rgba(10, 25, 50, 0.35);
  backdrop-filter: blur(4px);
}

#stickKnob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 62px;
  height: 62px;
  margin: -31px 0 0 -31px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 4px 14px rgba(0, 10, 30, 0.5);
}

.padBtn {
  position: fixed;
  z-index: 15;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.55);
  background: rgba(10, 25, 50, 0.35);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  backdrop-filter: blur(4px);
}

.padBtn.down { background: rgba(255, 255, 255, 0.9); color: #10203a; }

#duckBtn {
  right: calc(26px + env(safe-area-inset-right));
  bottom: calc(40px + env(safe-area-inset-bottom));
}

#jumpBtn {
  right: calc(26px + env(safe-area-inset-right));
  bottom: calc(146px + env(safe-area-inset-bottom));
}

/* portrait on a touch screen — the square needs the width, so ask for it */
#turn {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px;
  background: radial-gradient(circle at 50% 35%, rgba(30, 70, 130, 0.96), rgba(8, 14, 30, 0.99));
}

#turn h1 { margin: 0; font-size: 44px; letter-spacing: 3px; }
#turn .tag { margin: 10px 0 0; font-size: 17px; opacity: 0.9; letter-spacing: 1px; }

@media (orientation: portrait) {
  body.touch #turn { display: flex; }
}
