/* =============== War: phone =============== */
#war.screen { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; padding: 10px 12px 8px; gap: 8px; }
#war .bj-status { flex-shrink: 0; }
.war-body {
  flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; justify-content: space-between; gap: 6px; padding: 10px;
  border-radius: 22px; border: 5px solid var(--rail); background: radial-gradient(ellipse at 50% 40%, var(--felt-1), var(--felt-2) 90%);
  box-shadow: inset 0 0 22px rgba(0, 0, 0, 0.5); container-type: size; overflow: hidden;
}
.war-opps { display: flex; justify-content: center; gap: 10px; flex-shrink: 0; }
.war-opp { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; flex: 0 1 90px; border-radius: 12px; padding: 4px; border: 2px solid transparent; }
.war-opp .card { --w: min(13vw, 50px, 14cqh); }
.war-opp-name { font-weight: 900; font-size: 13px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.war-opp-count { font-size: 11px; color: rgba(255, 255, 255, 0.75); font-weight: 700; }
.war-opp.won { border-color: var(--accent); background: rgba(245, 197, 66, 0.15); }
.war-opp.out { opacity: 0.4; }
.war-opp.waiting .card.back { animation: war-wait 1.2s ease-in-out infinite; }
@keyframes war-wait { 50% { transform: translateY(-4px); } }
.war-center { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.war-mycard .card { --w: min(42vw, 170px, 52cqh); }
.war-mycard.won .card { box-shadow: 0 0 0 4px var(--accent), 0 0 26px rgba(245, 197, 66, 0.7); }
.war-mycard.lost .card { opacity: 0.75; }
.war-downs { font-size: 13px; font-weight: 800; color: #ffd27a; min-height: 18px; }
.war-downs-cards { display: flex; gap: 5px; justify-content: center; align-items: center; min-height: 18px; }
.war-downs-cards .card { --w: min(14vw, 56px, 22cqh); }
/* a war: your card gets smaller so the war cards fit under it */
.war-center.at-war .war-mycard .card { --w: min(28vw, 110px, 25cqh); }
.war-center.at-war .war-downs-cards .card { --w: min(13vw, 52px, 17cqh); }
.war-center.at-war .war-downs-cards .card { margin-left: -4vw; }
.war-center.at-war .war-downs-cards .card:first-child { margin-left: 0; }
.war-ph-down.new { animation: war-slide 0.45s ease-out both; }
.war-ph-top { --w: min(16vw, 62px); }
.reduce-motion .war-ph-down.new { animation: none !important; }
/* a war: your last face-down card glows until you tap it */
.war-ph-down.war-tapme { cursor: pointer; --w: min(15vw, 60px, 19cqh); margin-left: 6px !important; box-shadow: 0 0 0 3px var(--accent), 0 0 18px rgba(245, 197, 66, 0.8);
  animation: war-slide 0.45s ease-out both, war-tap 1.1s ease-in-out var(--glow-delay, 0s) infinite; }
.war-ph-down.war-tapme:not(.new) { animation: war-tap 1.1s ease-in-out infinite; }
@keyframes war-tap { 50% { transform: translateY(-5px) scale(1.06); box-shadow: 0 0 0 3px var(--accent), 0 0 30px rgba(245, 197, 66, 1); } }
.reduce-motion .war-ph-down.war-tapme { animation: none !important; }
/* the sweep: the battle's cards go to the winner (down into your pile, or up toward the winner) */
.war-center.sweep-mine .card { animation: war-sweep-mine 0.8s ease-in 0.9s forwards; }
.war-center.sweep-away .card { animation: war-sweep-away 0.8s ease-in 0.9s forwards; }
@keyframes war-sweep-mine { to { transform: translateY(18vh) scale(0.5); opacity: 0; } }
@keyframes war-sweep-away { to { transform: translateY(-22vh) scale(0.4); opacity: 0; } }
.reduce-motion .war-center.sweep-mine .card, .reduce-motion .war-center.sweep-away .card { animation: none; }
.war-line { text-align: center; font-weight: 800; font-size: 15px; min-height: 22px; flex-shrink: 0; }
.war-dock { flex-shrink: 0; display: flex; flex-direction: column; gap: 6px; }
#warFlip { height: 84px; font-size: 30px; font-weight: 900; border-radius: 20px; letter-spacing: 1px; }
.war-clock { text-align: center; font-size: 12px; color: var(--muted); font-weight: 700; min-height: 16px; }
#war .header .chips { white-space: nowrap; }

/* =============== War: TV =============== */
.war-tv { display: flex; flex-direction: column; overflow: hidden; }
.war-table {
  flex: 1; margin: 0 1.5vw 1.5vh; border-radius: 3vw; border: 1vw solid var(--rail); min-height: 0;
  background: radial-gradient(ellipse at 50% 40%, var(--felt-1), var(--felt-2) 85%); box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.5);
  display: flex; flex-direction: column; padding: 2vh 2vw; gap: 2vh;
}
.war-msg { text-align: center; font-size: 2.6vw; font-weight: 900; min-height: 3.4vw; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); }
.war-msg .sub { display: block; font-size: 1.3vw; color: rgba(255, 255, 255, 0.75); font-weight: 700; }
.war-seats { flex: 1; display: grid; gap: 2vw; min-height: 0; }
.war-seat { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 1vh; border-radius: 1.5vw; padding: 1vh 0.5vw; border: 0.25vw solid transparent; transition: border-color 0.3s, box-shadow 0.3s; min-width: 0; }
.war-seat.won { border-color: var(--accent); box-shadow: 0 0 2.5vw rgba(245, 197, 66, 0.55); }
.war-seat.at-war { border-color: #ff8a80; }
.war-seat.out { opacity: 0.35; }
.war-battle { display: flex; align-items: center; justify-content: center; min-height: calc(8vw * 1.4); }
.war-battle .card { --w: 8vw; }
.war-battle .card.war-down { --w: 5vw; margin-left: -2.6vw; transform: rotate(-6deg); }
.war-battle .card.war-down:first-child { margin-left: 0; }
.war-battle .card.war-up { margin-left: -1.5vw; box-shadow: 0 0 0 0.25vw #ff8a80, 0 0.6vw 1.4vw rgba(0, 0, 0, 0.5); }
.war-battle .card.war-down.new { animation: war-slide 0.5s ease-out both; }
.war-battle .card.war-up.new { animation: war-turn 0.55s ease-out 0.45s both; }
@keyframes war-slide { from { transform: translateY(-6vh) rotate(-20deg); opacity: 0; } }
@keyframes war-turn { from { transform: rotateY(90deg) scale(1.15); } to { transform: none; } }
/* the winner sweeps the pile: every seat's battle cards slide to the winner's pile (--sx/--sy set by war-tv.js) */
.war-battle.sweep .card { animation: war-sweep 1s ease-in 0.8s forwards; }
.war-battle.sweep.swept .card { animation: none; opacity: 0; }
@keyframes war-sweep { 70% { opacity: 1; } to { transform: translate(var(--sx, 0), var(--sy, -3vh)) scale(0.55) rotate(8deg); opacity: 0; } }
.reduce-motion .war-battle.sweep .card { animation: war-sweep-still 0.4s ease-in 1.2s forwards; }
@keyframes war-sweep-still { to { opacity: 0; } }
.war-pile { position: relative; width: 5vw; height: calc(5vw * 1.4 + 1.5vw); }
.war-pile .card { --w: 5vw; position: absolute; left: 0; bottom: calc(var(--i, 0) * 0.25vw); }
.war-name { font-size: 1.6vw; font-weight: 900; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.war-count { font-size: 1.3vw; font-weight: 800; color: var(--accent); }
.war-count b { color: #fff; }
.war-info { font-size: 1.2vw; color: var(--muted); font-weight: 700; }

/* ---------- TV: the house frame (tv-frame.js). The felt: the game's name printed at the top, the seats along the bottom
   (a name pill over the card they flipped, then their pile and count; no box). ---------- */
.war-tv .war-table { margin: 0; position: relative; padding-top: 0; }
.war-tv .war-seats { margin-top: auto; flex: 0 0 auto; }
.war-tv .war-seat { border: 0; box-shadow: none; padding: 0; }
.war-tv .war-seat.won > .hf-name { box-shadow: 0 0 0 0.2vw var(--accent), 0 0 1.2vw rgba(245, 197, 66, 0.8); }
.war-tv .war-seat.at-war > .hf-name { box-shadow: 0 0 0 0.2vw #ff8a80, 0 0 1.2vw rgba(255, 138, 128, 0.7); }
.war-tv .war-seat .hf-name { font-size: 1.5vw; }
.war-tv .hf-felt-name { top: 9%; --hf-name: 4.4vw; }
.war-tv .war-battle .card { --w: 7vw; }
/* a war: the face-down cards stay small and tucked under each other, so a seat never spills into the next one */
.war-tv .war-battle .card.war-down { --w: 4.2vw; margin-left: -3vw; }
.war-tv .war-battle .card.war-down:first-child { margin-left: 0; }
.war-tv .war-battle .card.war-up { margin-left: -1.6vw; }
/* Scan to join in the side panel: anyone who scans in mid-game watches */
#joinCornerWar .jc-title::after { content: ' · WATCH'; color: var(--accent); }
