/* Button Battle — two pins face off. Follows theme.css variables like wall.css. */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  min-height: 100vh;
}

.battle {
  max-width: 760px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg);
  text-align: center;
}

.battle__title {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  margin: 0;
}

.battle__subtitle {
  color: var(--color-text-secondary);
  margin: var(--space-sm) 0 0;
}

.battle__status {
  margin: var(--space-xl) 0;
  color: var(--color-text-secondary);
}

.battle__status[hidden] { display: none; }

/* ── Arena ───────────────────────────────────────────────────────────────── */

.battle__arena {
  margin-top: var(--space-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
}

.battle__arena[hidden] { display: none; }

.battle__vs {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.5rem;
  color: var(--color-text-secondary);
  user-select: none;
}

.battle-pin {
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  transition: transform 0.15s ease, opacity 0.3s ease;
}

.battle-pin img {
  width: clamp(120px, 32vw, 220px);
  height: clamp(120px, 32vw, 220px);
  border-radius: 50%;
  background: var(--color-surface);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.12),
    0 4px 12px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.battle-pin:hover:not(:disabled) img,
.battle-pin:focus-visible img {
  transform: scale(1.06);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.12),
    0 8px 20px rgba(0, 0, 0, 0.3);
}

.battle-pin.is-winner {
  animation: battle-win 0.5s ease;
}

.battle-pin.is-winner img {
  box-shadow:
    inset 0 0 0 2px var(--color-status-ok),
    0 8px 24px rgba(0, 0, 0, 0.3);
}

.battle-pin.is-loser {
  opacity: 0.25;
  transform: scale(0.92);
}

@keyframes battle-win {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.12); }
  100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .battle-pin.is-winner { animation: none; }
}

/* ── Standings ───────────────────────────────────────────────────────────── */

.battle__standings {
  margin-top: var(--space-xl);
}

.battle__standings-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  margin: 0 0 var(--space-md);
}

.battle__leaderboard {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  max-width: 380px;
  counter-reset: rank;
}

.battle__row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 1px solid var(--color-border);
  counter-increment: rank;
}

.battle__row::before {
  content: counter(rank);
  width: 1.4em;
  text-align: right;
  color: var(--color-text-secondary);
  font-variant-numeric: tabular-nums;
}

/* With no names shown, the thumb is the whole identity — render it a bit larger. */
.battle__mini {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.battle__record {
  margin-left: auto;
  color: var(--color-text-secondary);
  font-variant-numeric: tabular-nums;
}

.battle__empty {
  color: var(--color-text-secondary);
  font-style: italic;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */

.battle__footer {
  margin-top: var(--space-xl);
  padding-bottom: var(--space-xl);
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  align-items: center;
  /* Wider pills (label + QR) wrap on a narrow phone rather than overflow. */
  flex-wrap: wrap;
}

.battle__link {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  font-family: var(--font-display);
  color: var(--color-text-primary);
  /* Filled background so the label side reads as one solid button. */
  background: var(--color-surface);
  border: 1px solid var(--color-text-primary);
  border-radius: 999px;              /* full capsule; QR panel fills its right */
  padding-left: 1em;
  overflow: hidden;                  /* clip the QR panel to the capsule end */
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.battle__link:hover {
  background: var(--color-text-primary);
  color: var(--color-bg);
}
