/* static/css/click-clash.css — Click Clash arena.
   Bar is horizontal (left vs right) on desktop, vertical (top vs bottom) on mobile.
   Colors route through site tokens only: no brand/background custom properties are
   declared here (see the theming rules in CLAUDE.md). Text on the brand-gradient
   fill uses a literal #fff, never a theme-flipping token. */

.cc-page { position: relative; }

/* ── Track ─────────────────────────────────────────────────────────────────── */

.cc-track {
  position: relative;
  height: 3rem;
  border-radius: 999px;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border-color, rgba(148, 163, 184, 0.35));
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.35);
}

/* The fill grows from the left edge; JS sets --cc-fill as a percentage. */
.cc-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--cc-fill, 50%);
  background: var(--grad-primary);
  transition: width 90ms linear;
}

/* Moving hatch stripes: the bar reads as under pressure even when it holds still. */
.cc-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(115deg,
    rgba(255, 255, 255, 0.16) 0 10px, rgba(255, 255, 255, 0) 10px 20px);
  animation: cc-stripes 700ms linear infinite;
}

@keyframes cc-stripes {
  to { background-position: 40px 0; }
}

.cc-centre {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: var(--text-muted);
  opacity: 0.55;
}

/* Danger zones at both ends — they light up when the bar gets close. */
.cc-edge {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 12%;
  opacity: 0;
  transition: opacity 140ms linear;
  pointer-events: none;
}
.cc-edge-a { left: 0;  background: linear-gradient(90deg, rgba(248, 113, 113, 0.55), transparent); }
.cc-edge-b { right: 0; background: linear-gradient(270deg, rgba(248, 113, 113, 0.55), transparent); }
.cc-track.cc-danger-a .cc-edge-a,
.cc-track.cc-danger-b .cc-edge-b { opacity: 1; animation: cc-flash 420ms ease-in-out infinite alternate; }

@keyframes cc-flash {
  from { opacity: 0.35; }
  to   { opacity: 1; }
}

.cc-shake { animation: cc-shake 110ms linear; }

@keyframes cc-shake {
  0%, 100% { transform: translateX(0); }
  25%  { transform: translateX(-3px); }
  75%  { transform: translateX(3px); }
}

/* ── Clock, seats, status ──────────────────────────────────────────────────── */

.cc-clock { line-height: 1; letter-spacing: -0.02em; }
.cc-clock.cc-urgent { color: #f87171; animation: cc-tick 1s steps(1) infinite; }

@keyframes cc-tick {
  0%, 60% { transform: scale(1); }
  70%     { transform: scale(1.09); }
  100%    { transform: scale(1); }
}

.cc-dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 999px;
  flex-shrink: 0;
  display: inline-block;
}
.cc-dot-a { background: var(--brand-primary); }
.cc-dot-b { background: var(--brand-secondary); }

/* ── The hit button ───────────────────────────────────────────────────────── */

.cc-hit {
  position: relative;      /* anchors the click ripples */
  overflow: hidden;
  border-radius: 1rem;
  border: 1px solid var(--border-color, rgba(148, 163, 184, 0.35));
  background: var(--bg-card);
  color: var(--text-primary);
  letter-spacing: 0.15em;
  cursor: pointer;
  transition: transform 60ms ease-out, box-shadow 120ms ease-out, background 120ms ease-out;
}
.cc-hit:hover { transform: translateY(-1px); }
.cc-hit:active,
.cc-hit.cc-punch {
  transform: scale(0.985);
  background: var(--grad-primary);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}
.cc-hit:disabled { opacity: 0.5; cursor: default; }

/* Click ripple — one short-lived span per click, removed on animation end. */
.cc-ripple {
  position: absolute;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 999px;
  background: #fff;
  opacity: 0.55;
  pointer-events: none;
  animation: cc-ripple 380ms ease-out forwards;
}

@keyframes cc-ripple {
  to { transform: scale(7); opacity: 0; }
}

/* ── Countdown overlay ────────────────────────────────────────────────────── */

.cc-countdown.hidden { display: none; }  /* beats this file's own display: flex */

.cc-countdown {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;    /* never swallow a hit-button click, visible or not */
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(2px);
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: clamp(3rem, 14vw, 7rem);
  color: #fff;
}
.cc-countdown span { display: inline-block; animation: cc-pop 420ms cubic-bezier(0.2, 1.3, 0.4, 1); }

/* ── Small flourishes ─────────────────────────────────────────────────────── */

.cc-pop { animation: cc-pop 420ms cubic-bezier(0.2, 1.3, 0.4, 1); }

@keyframes cc-pop {
  from { transform: scale(0.6); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.cc-float { animation: cc-float 2.6s ease-in-out infinite; }

@keyframes cc-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

/* Searching-for-opponent radar, only while the lobby says so. */
.cc-pulse-ring {
  position: absolute;
  left: 50%;
  top: 3.2rem;
  width: 7rem;
  height: 7rem;
  margin: -3.5rem 0 0 -3.5rem;
  border-radius: 999px;
  border: 2px solid var(--brand-secondary);
  opacity: 0;
  pointer-events: none;
}
#cc-lobby.cc-searching .cc-pulse-ring { animation: cc-pulse 1.6s ease-out infinite; }

@keyframes cc-pulse {
  from { transform: scale(0.5); opacity: 0.5; }
  to   { transform: scale(1.8); opacity: 0; }
}

/* ── Mobile: same bar, rotated — top player pushes down, bottom pushes up ─── */

@media (max-width: 767px) {
  .cc-track {
    /* dvh, not vh: with vh the bar is sized for a viewport the browser chrome is
       covering, and the CLICK button lands under the fold on a phone. */
    height: 38dvh;
    width: 3rem;
    margin: 0 auto;
  }
  .cc-fill {
    inset: 0 0 auto 0;
    width: 100%;
    height: var(--cc-fill, 50%);
    transition: height 90ms linear;
  }
  .cc-centre {
    left: 0;
    right: 0;
    top: 50%;
    width: auto;
    height: 2px;
  }
  .cc-edge { top: auto; bottom: auto; left: 0; right: 0; width: auto; height: 12%; }
  .cc-edge-a { top: 0;    background: linear-gradient(180deg, rgba(248, 113, 113, 0.55), transparent); }
  .cc-edge-b { bottom: 0; background: linear-gradient(0deg,   rgba(248, 113, 113, 0.55), transparent); }
  .cc-hit { padding-top: 2rem; padding-bottom: 2rem; }
  #cc-arena > .card-border { padding: 0.65rem; }
}

/* ── Static containers keep no hover animation ────────────────────────────── */
/* The lobby/arena/result panels are not clickable cards, so the sitewide
   .card-border:hover lift is neutralized here. The CLICK button is the one
   genuinely interactive element and keeps its own press feedback. */
#cc-app > .card-border:hover,
#cc-app .card-border:hover {
  transform: none;
  box-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
  .cc-fill::after,
  .cc-clock.cc-urgent,
  .cc-float,
  .cc-pulse-ring,
  .cc-track.cc-danger-a .cc-edge-a,
  .cc-track.cc-danger-b .cc-edge-b { animation: none; }
  .cc-shake { animation: none; }
}
