/* games-tennis.css — chibi top-down tennis battle.
   The chibi PNGs are top-down "doll" art (long hair behind the head), so the
   court is drawn from above. We use absolute-positioned divs/imgs animated
   via inline style updates from games-tennis.js. */

/* -------- Avatar picker -------- */
.tn-picker { padding: 28px 22px; }
.tn-picker-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  max-width: 600px;
  margin: 0 auto;
}
.tn-avatar-card {
  background: var(--gm-bg);
  border: 2px solid var(--gm-border);
  border-radius: 16px;
  padding: 14px 12px 18px;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  color: var(--gm-text);
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.tn-avatar-card img {
  width: 100%;
  max-width: 180px;
  height: auto;
  display: block;
  filter: drop-shadow(0 6px 18px rgba(255, 121, 242, 0.25));
}
.tn-avatar-card:hover {
  transform: translateY(-3px);
  border-color: var(--gm-accent-1);
  box-shadow: 0 14px 30px -10px rgba(107, 247, 255, 0.4);
}
.tn-avatar-name {
  font-family: 'Bangers', cursive;
  font-size: 1.5em;
  letter-spacing: 0.05em;
  background: linear-gradient(135deg, var(--gm-accent-1), var(--gm-accent-2));
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.tn-avatar-tag { color: var(--gm-muted); font-size: 0.92em; }

/* -------- Court -------- */
.tn-court-wrap { padding: 18px; }
.tn-score {
  display: flex;
  gap: 10px;
  align-items: center;
  font-family: 'Bangers', cursive;
  font-size: 1.4em;
  letter-spacing: 0.05em;
}
.tn-score-you { color: var(--gm-accent-1); }
.tn-score-ai  { color: var(--gm-accent-2); }
.tn-score-vs  { color: var(--gm-muted); }
.tn-score strong { font-size: 1.2em; padding: 0 4px; }

.tn-court {
  position: relative;
  width: 100%;
  max-width: 520px;
  aspect-ratio: 5 / 7;
  margin: 14px auto 0;
  border-radius: 18px;
  /* clay-court vibes — diagonal repeating stripes in deep ochre + the WebStories cyan accent */
  background:
    linear-gradient(180deg, rgba(255, 121, 242, 0.05), rgba(107, 247, 255, 0.05)),
    repeating-linear-gradient(45deg, #c25b4a 0 20px, #b14e3f 20px 40px);
  border: 5px solid #f3d4a0;
  box-shadow: inset 0 0 0 12px rgba(0,0,0,0.18), 0 18px 36px -16px rgba(0,0,0,0.6);
  overflow: hidden;
  user-select: none;
  touch-action: manipulation;
}
/* Center service line (horizontal — top half is AI, bottom is player) */
.tn-line-h {
  position: absolute;
  left: 8%; right: 8%;
  top: 50%;
  height: 0;
  border-top: 2px dashed #f3d4a0;
  opacity: 0.65;
}
/* Net — sits at the midline */
.tn-net {
  position: absolute;
  left: 0; right: 0;
  top: calc(50% - 14px);
  height: 28px;
  background:
    repeating-linear-gradient(90deg,
      rgba(245, 245, 245, 0.92) 0 4px,
      rgba(245, 245, 245, 0.4) 4px 8px);
  border-top: 3px solid #fff;
  border-bottom: 3px solid #fff;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.3);
  z-index: 4;
  pointer-events: none;
}

/* Players. PNGs are now single-pose per file (5 separate files under
 * /images/avatars/) so we use the whole image (`background-size: contain`).
 * The bot's image is rotated 180° so we still see their face from the
 * camera at the bottom of the court. */
.tn-player {
  position: absolute;
  width: 24%;
  aspect-ratio: 1 / 1.05;
  z-index: 3;
  pointer-events: none;
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.45));
  transition: left 0.18s cubic-bezier(0.4, 0, 0.2, 1), transform 0.18s ease;
  will-change: left, transform;
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center center;
}
.tn-player-ai  { top: 2%; left: 38%; /* iter 39u (2026-02-18): no rotate per user feedback — keep Ivy/Luke as drawn */ }
.tn-player-you { bottom: 2%; left: 38%; }
/* Shadow ellipses under each player */
.tn-shadow {
  position: absolute;
  width: 18%; height: 4%;
  background: rgba(0, 0, 0, 0.32);
  border-radius: 50%;
  filter: blur(3px);
  z-index: 2;
  transition: left 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}
.tn-shadow-ai  { top: 18%; left: 41%; }
.tn-shadow-you { bottom: 7%; left: 41%; }

/* Swing animation: the player tilts toward where they hit */
.tn-player.is-swing-l { transform: rotate(-12deg); }
.tn-player.is-swing-r { transform: rotate(12deg); }
/* Bot tilts the SAME way (no 180° base rotate anymore — see comment above). */
.tn-player-ai.is-swing-l { transform: rotate(-12deg); }
.tn-player-ai.is-swing-r { transform: rotate(12deg); }

/* The ball — a yellow disc with WebStories cyan highlight */
.tn-ball {
  position: absolute;
  width: 4.2%;
  aspect-ratio: 1;
  background: radial-gradient(circle at 35% 30%, #fffba1 0%, #e4d04a 70%, #b08f1b 100%);
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45), inset 0 0 0 1.5px rgba(255, 255, 255, 0.4);
  left: 48%;
  top: 48%;
  z-index: 5;
  transition: left 0.5s linear, top 0.5s cubic-bezier(0.3, 0, 0.6, 1);
  will-change: left, top, transform;
}
.tn-ball.is-hidden { opacity: 0; }
.tn-ball.is-bounce { animation: tn-ball-pop 0.35s ease-out; }
@keyframes tn-ball-pop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.45); }
  100% { transform: scale(1); }
}

/* Click-zones — invisible buttons that cover the bottom-left and bottom-right
 * quadrants of the court (the player's side only). */
.tn-swing {
  position: absolute;
  bottom: 0;
  height: 40%;
  width: 50%;
  background: transparent;
  border: 0;
  cursor: pointer;
  z-index: 6;
  outline: none;
}
.tn-swing-l { left: 0; }
.tn-swing-r { right: 0; }
.tn-swing:active { background: rgba(107, 247, 255, 0.08); }

/* Toast — center banner that announces "POINT!", "MISS!", "GAME!" etc. */
.tn-toast {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bangers', cursive;
  font-size: clamp(34px, 8vw, 56px);
  letter-spacing: 0.06em;
  color: #fff;
  text-shadow: 0 6px 0 #000, 0 0 28px rgba(255, 121, 242, 0.85);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
  transform: scale(0.7);
  z-index: 9;
}
.tn-toast.is-show { opacity: 1; transform: scale(1); }
.tn-toast.is-good { text-shadow: 0 6px 0 #000, 0 0 28px var(--gm-success); }
.tn-toast.is-bad  { text-shadow: 0 6px 0 #000, 0 0 28px var(--gm-error); }

.tn-help { color: var(--gm-muted); text-align: center; margin-top: 12px; font-size: 0.92em; }

@media (max-width: 520px) {
  .tn-court { max-width: 100%; }
}
