/* World-map battle explainer — the pulsing (!) and the modal it opens.
   Markup: views/tinybits/battleSituation.jsx. Behaviour: openBattleSituation()
   in public/main.js. */

.battle-situation {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}

.battle-situation-board {
  margin-top: 4px;
}

.battle-situation-lobby {
  margin-left: auto;
  padding-left: 8px;
}

.battle-situation-btn {
  --bs-ring: rgba(234, 170, 32, 0.75);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid #f2d27a;
  background: radial-gradient(circle at 35% 30%, #f5b93a, #b86f0a 70%);
  color: #2a1a05;
  font-size: 15px;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease;
}

.battle-situation-btn:hover,
.battle-situation-btn:focus-visible {
  transform: scale(1.12);
}

/* Pulses until the player has opened it for the situation they are in now
   (main.js adds .battle-situation-seen). A change of situation pulses again. */
.battle-situation-btn:not(.battle-situation-seen) {
  animation: battle-situation-pulse 1.4s ease-out infinite;
}

.battle-situation-btn.battle-situation-urgent {
  --bs-ring: rgba(217, 83, 79, 0.8);
  background: radial-gradient(circle at 35% 30%, #f06a5f, #a3231b 70%);
  border-color: #ffc2b8;
  color: #fff;
}

@keyframes battle-situation-pulse {
  0% { box-shadow: 0 0 0 0 var(--bs-ring), 0 2px 6px rgba(0, 0, 0, 0.35); }
  70% { box-shadow: 0 0 0 12px transparent, 0 2px 6px rgba(0, 0, 0, 0.35); }
  100% { box-shadow: 0 0 0 0 transparent, 0 2px 6px rgba(0, 0, 0, 0.35); }
}

@media (prefers-reduced-motion: reduce) {
  .battle-situation-btn:not(.battle-situation-seen) {
    animation: none;
    outline: 3px solid var(--bs-ring);
    outline-offset: 2px;
  }
}

/* ── Modal ─────────────────────────────────────────────────────────── */

.battle-situation-modal .info-modal-content {
  max-width: 540px;
  padding: 22px 22px 18px;
  color: var(--papyrus-text);
}

.battle-situation-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding-right: 34px; /* clear the close button */
}

.battle-situation-icon {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 20px;
  color: #fff;
  background: #7a5a2a;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.25);
}

.battle-situation-icon-long_your_turn,
.battle-situation-icon-lobby_raid,
.battle-situation-icon-lobby_conquer,
.battle-situation-icon-ai_playing_for_you {
  background: #b0352c;
}

.battle-situation-icon-long_their_turn,
.battle-situation-icon-long_take_seat,
.battle-situation-icon-long_spectator {
  background: #3b4f8a;
}

.battle-situation-head h2 {
  margin: 0 0 4px;
  font-family: "Cinzel", serif;
  font-size: 1.3rem;
}

.battle-situation-where {
  margin: 0;
  font-size: 0.85rem;
  opacity: 0.8;
}

.battle-situation-lead {
  margin: 16px 0 10px;
  font-weight: 600;
}

.battle-situation-rows {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.battle-situation-rows li {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  align-items: baseline;
  padding: 8px 10px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.06);
}

.battle-situation-rows li > i {
  text-align: center;
  opacity: 0.85;
}

.battle-countdown {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.battle-situation-foot {
  margin: 14px 0 0;
  font-size: 0.8rem;
  opacity: 0.75;
  line-height: 1.45;
}

.battle-situation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
}

.battle-situation-ok {
  min-width: 110px;
}

/* An <a>, so it would otherwise keep the browser's link blue. */
.battle-situation-actions a.game-over-btn {
  color: var(--papyrus-text);
  border: 1px solid currentColor;
  background: rgba(0, 0, 0, 0.04);
}

/* Dark theme: the three-state keying (explicit dark, OS dark, forced light). */
:root[data-theme="dark"] .battle-situation-rows li {
  background: rgba(255, 255, 255, 0.07);
}
@media (prefers-color-scheme: dark) {
  .battle-situation-rows li {
    background: rgba(255, 255, 255, 0.07);
  }
}
:root[data-theme="light"] .battle-situation-rows li {
  background: rgba(0, 0, 0, 0.06);
}

@media (max-width: 480px) {
  .battle-situation-modal .info-modal-content {
    padding: 18px 14px 14px;
  }
  .battle-situation-actions .game-over-btn {
    flex: 1 1 auto;
  }
}
