/* ============================================================
   CONTEXTO BATTLE - additions only.
   Loaded after unlimited.css + navbar.css, so it reuses their design
   tokens (colors, radii, shadows, fonts) and light/dark theme. Every
   selector here is battle-specific; nothing from daily/unlimited is
   overridden.
   ============================================================ */

.battle-container {
  padding-bottom: 3rem;
}

.battle-section-title {
  font-size: 1rem;
  font-weight: 900;
  margin: 0 0 0.6rem;
  color: inherit;
}

.battle-hint-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0.4rem 0;
  line-height: 1.4;
}

.battle-hint-text a {
  color: var(--link-blue);
}

/* ---------- rejoin banner ---------- */
.battle-rejoin {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1rem;
  margin: 0.8rem 0;
  border-radius: var(--radius-md);
  background: var(--tint-yellow);
  border: 1.5px solid var(--border-strong);
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.battle-rejoin i {
  font-size: 1.2rem;
}

/* ---------- setup card ---------- */
.battle-setup .battle-section-title:not(:first-child) {
  margin-top: 1.1rem;
}

.battle-segment {
  display: flex;
  gap: 0.6rem;
}

.battle-segment-btn {
  flex: 1;
  padding: 0.55rem 0.4rem;
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--card-alt);
  color: var(--text-primary);
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition-base);
}

.battle-segment-btn:hover {
  border-color: rgba(250, 203, 28, 0.6);
}

.battle-segment-btn.active {
  background: linear-gradient(135deg, #f7d154, #e6b706);
  border-color: #e6b706;
  color: #17140a;
  box-shadow: 0 0 18px rgba(230, 183, 6, 0.3);
}

.battle-segment-big {
  font-size: 1.35rem;
  font-weight: 900;
}

.battle-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 0.55rem 0.5rem 0.55rem 1rem;
  font-size: 1rem;
  font-weight: 800;
  font-family: var(--font);
  outline: none;
  color: var(--text-primary);
}

.battle-input::placeholder {
  font-weight: 500;
  color: var(--text-muted);
}

.battle-playing-as {
  margin: 0;
  font-size: 0.95rem;
}

.battle-playing-as i {
  margin-right: 0.3rem;
  color: var(--text-secondary);
}

.battle-modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
  margin-top: 1.3rem;
}

.battle-mode-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 1rem 0.6rem;
  background: var(--card-alt);
  border: 2px solid var(--border-subtle);
  border-radius: 16px;
  color: var(--text-primary);
  font-family: var(--font);
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
}

.battle-mode-btn i {
  font-size: 1.7rem;
}

.battle-mode-btn:hover:not(:disabled) {
  border-color: #e6b706;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.battle-mode-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.battle-mode-title {
  font-weight: 900;
  font-size: 1.05rem;
}

.battle-mode-sub {
  font-weight: 500;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.battle-duration-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.7rem;
  margin-top: 0.8rem;
}

.battle-duration-btn {
  padding: 0.9rem 0.4rem;
}

.battle-duration-btn .battle-segment-big {
  font-size: 1.9rem;
}

/* ---------- buttons ---------- */
.battle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 1.1rem;
  border: none;
  border-radius: var(--radius-sm);
  background: #000;
  color: #fff;
  font-family: var(--font);
  font-weight: 800;
  font-size: 0.98rem;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

body.dark-mode .battle-btn {
  background: var(--border-strong);
  color: #1f2937;
}

.battle-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.battle-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.battle-btn.secondary {
  background: var(--card-alt);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.battle-btn.danger {
  background: var(--danger);
  color: #fff;
}

.battle-btn.whatsapp {
  background: #25d366;
  color: #fff;
}

.battle-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 1rem;
}

/* ---------- message cards (waiting / join / cancelled) ---------- */
.battle-message-card {
  text-align: center;
}

.battle-message-card p {
  margin: 0.4rem 0 0.9rem;
}

.battle-versus-icon {
  width: 3.4rem;
  height: 3.4rem;
  margin: 0 auto 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #f7d154, #e6b706);
  color: #17140a;
  font-size: 1.5rem;
  box-shadow: 0 0 24px rgba(230, 183, 6, 0.35);
}

.battle-spinner {
  display: block;
  width: 2.4rem;
  height: 2.4rem;
  margin: 0 auto 0.7rem;
}

.battle-dots::after {
  content: '';
  display: inline-block;
  width: 1.2em;
  text-align: left;
  animation: battleDots 1.4s steps(4, end) infinite;
}

@keyframes battleDots {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
}

.battle-link-wrapper {
  margin-top: 0.3rem;
}

.battle-banner {
  margin: 0.6rem 0;
  padding: 0.5rem 0.8rem;
  border-radius: var(--radius-sm);
  background: var(--orange-soft);
  border: 1px solid var(--orange);
  text-align: center;
  font-weight: 700;
  font-size: 0.9rem;
}

/* ---------- searching ---------- */
.battle-searching {
  text-align: center;
}

.battle-radar {
  position: relative;
  width: 5rem;
  height: 5rem;
  margin: 0.4rem auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
}

.battle-radar span {
  position: absolute;
  inset: 0;
  border: 2px solid #e6b706;
  border-radius: 50%;
  opacity: 0;
  animation: battleRadar 2.4s ease-out infinite;
}

.battle-radar span:nth-child(2) { animation-delay: 0.8s; }
.battle-radar span:nth-child(3) { animation-delay: 1.6s; }

@keyframes battleRadar {
  0% { transform: scale(0.35); opacity: 0.9; }
  100% { transform: scale(1.15); opacity: 0; }
}

/* ---------- countdown ---------- */
.battle-matchup {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  font-weight: 900;
  font-size: 1.05rem;
  flex-wrap: wrap;
}

.battle-matchup-vs {
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--navbar-bg);
  color: #17140a;
  font-size: 0.8rem;
}

.battle-countdown-number {
  font-size: 5.5rem;
  line-height: 1.1;
  font-weight: 900;
  margin: 0.6rem 0;
}

.battle-countdown-number.pop {
  animation: battlePop 0.5s ease;
}

@keyframes battlePop {
  0% { transform: scale(1.5); opacity: 0.3; }
  100% { transform: scale(1); opacity: 1; }
}

/* ---------- scoreboard (compact: one row per player) ---------- */
.battle-scoreboard {
  display: block;
  padding: 1rem;
  margin: 0.6rem 0 0.2rem;
}

.battle-scoreboard:hover {
  transform: none;
}

.battle-timer-row {
  text-align: center;
  margin-bottom: 0.4rem;
}

.battle-timer {
  font-size: 1.6rem;
  line-height: 1.1;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.battle-timer.urgent {
  color: var(--danger);
  animation: battlePulse 1s ease-in-out infinite;
}

@keyframes battlePulse {
  50% { opacity: 0.55; }
}

.battle-racer {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.battle-racer + .battle-racer {
  margin-top: 0.4rem;
}

/* name and guess count, stacked, to the left of the bar */
.battle-racer-info {
  flex: 0 0 6.6rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.battle-racer-name {
  display: flex;
  align-items: center;
  min-width: 0;
  font-size: 0.88rem;
  font-weight: 800;
}

#me-name,
#opp-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.battle-racer-stats {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.battle-racer-bar {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 2.1rem;
  border-radius: var(--radius-sm);
  background: var(--pill-bg);
  overflow: hidden;
}

.battle-racer-bar .result-fill {
  transition: width 0.5s ease;
}

.battle-racer-rank {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  padding: 0 0.7rem;
  font-weight: 800;
  font-size: 0.95rem;
}

.battle-dot {
  flex: 0 0 auto;
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  margin-right: 0.4rem;
  border-radius: 50%;
  background: var(--text-muted);
}

.battle-dot.online {
  background: var(--success);
  box-shadow: 0 0 0 3px var(--green-soft);
}

#screen-game #input-section {
  margin-top: 0.8rem;
}

/* ---------- result ---------- */
.battle-result-card {
  margin: 1rem auto;
}

.battle-compare {
  width: 100%;
  margin: 1rem 0 0.4rem;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.battle-compare th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  font-weight: 700;
  padding: 0.3rem 0.4rem;
}

.battle-compare td {
  padding: 0.45rem 0.4rem;
  border-top: 1px solid var(--border-subtle);
  font-weight: 700;
}

.battle-compare td.who {
  text-align: left;
}

.battle-result-card .share-btn {
  margin-top: 0;
}

/* ---------- both players' guesses after the match ---------- */
.battle-guesses {
  margin-top: 1.2rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  align-items: start;
}

.battle-guess-col h4 {
  margin: 0 0 0.4rem;
  font-size: 0.85rem;
  font-weight: 800;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.battle-guess-col .card {
  padding: 0.4rem 0.6rem;
}

.battle-guess-col .word {
  font-size: 0.88rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.battle-guess-col .rank {
  font-size: 0.8rem;
  margin-left: 0.4rem;
}

.battle-guess-col .battle-hint-text {
  text-align: center;
}

@media (max-width: 600px) {
  .battle-countdown-number { font-size: 4.5rem; }
  .battle-modes { gap: 0.6rem; }
}

/* ---------- join page spacing ---------- */
#screen-join .battle-name-wrapper {
  margin-top: 0.5rem;
}

#screen-join .battle-btn {
  margin-top: 1.1rem;
}

/* ---------- FAQ below the lobby: same centred column as on the other pages ---------- */
#battle-bottom .faq-section {
  max-width: 500px;
  margin: 0 auto;
  padding: 1rem 1rem 2.5rem;
}

/* ---------- steady height while the boxes swap (setup -> searching -> waiting -> countdown -> game),
   so the FAQ and the content below do not jump up and down ---------- */
:root {
  --battle-stage-height: 15rem;
}

#battle-setup,
#battle-searching,
#view-room .battle-message-card,
#screen-game {
  min-height: var(--battle-stage-height);
}

#battle-searching,
#view-room .battle-message-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#battle-searching > *,
#view-room .battle-message-card > * {
  max-width: 100%;
}

#battle-searching p,
#view-room .battle-message-card p {
  text-align: center;
}

#view-room .battle-message-card .battle-invite,
#view-room .battle-message-card .battle-name-wrapper,
#view-room .battle-message-card .battle-actions {
  width: 100%;
}

/* keep child margins inside the game box so it lines up exactly with the other boxes */
#screen-game {
  display: flow-root;
}

/* ---------- rematch request (friend battles) ---------- */
.battle-rematch {
  margin-top: 1rem;
  padding: 0.7rem 0.8rem;
  border-radius: var(--radius-md);
  background: var(--tint-yellow);
  border: 1px solid var(--border-subtle);
  text-align: center;
}

.battle-rematch p {
  margin: 0;
  font-weight: 700;
  font-size: 0.95rem;
}

.battle-rematch .battle-actions {
  margin-top: 0.6rem;
}

/* ---------- players online (lobby) ---------- */
.battle-online {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0.2rem 0 1rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.battle-online strong {
  color: var(--text-primary);
}

.battle-online-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px var(--green-soft);
  animation: battlePulse 2s ease-in-out infinite;
}

/* ---------- result card: Share on its own centred row under Play again / Rematch ---------- */
.battle-share-row {
  margin-top: 0.6rem;
}


/* ---------- battle header (the daily / unlimited pages no longer have one) ---------- */
.header-with-menu {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  position: relative;
}

.header-title {
  font-size: 1.3rem;
  font-weight: 900;
  margin: 0;
  color: inherit;
}

.header-controls {
  position: absolute;
  right: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* menu button: a true circle with the icon centred (matches the daily / unlimited pages) */
.header-controls .menu-button {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
