/* ═══════════════════════════════════════════════════════════
   Королевская битва — стили
   ═══════════════════════════════════════════════════════════ */

/* ─── Лобби ─── */
.battle-header {
    background: linear-gradient(135deg, rgba(236,72,153,0.08), rgba(124,58,237,0.08)) !important;
    border: 1px solid rgba(236,72,153,0.2) !important;
}

.battle-lobby-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

@media (max-width: 900px) {
    .battle-lobby-grid { grid-template-columns: 1fr; }
}

.battle-info-card {
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.battle-info-card .battle-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    font-size: 0.95rem;
}

.battle-info-card .battle-info-row:last-child {
    border-bottom: none;
}

.battle-info-label {
    color: var(--text-muted);
}

.battle-info-value {
    font-weight: 700;
    font-family: 'Space Grotesk', sans-serif;
}

.battle-join-btn-wrap {
    margin-top: 1.5rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.battle-join-btn-wrap .btn {
    flex: 1;
    min-width: 160px;
}

.battle-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.9rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.battle-status-waiting   { background: rgba(245,158,11,0.15);  color: #f59e0b;  border: 1px solid rgba(245,158,11,0.35); }
.battle-status-playing   { background: rgba(239,68,68,0.15);   color: #ef4444;  border: 1px solid rgba(239,68,68,0.35); animation: pulse-live 1.5s ease-in-out infinite; }
.battle-status-finished  { background: rgba(16,185,129,0.15);  color: #10b981;  border: 1px solid rgba(16,185,129,0.35); }
.battle-status-cancelled { background: rgba(107,114,128,0.15); color: #9ca3af;  border: 1px solid rgba(107,114,128,0.35); }

@keyframes pulse-live {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.55; }
}

/* ─── Список участников ─── */
.battle-participants-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.battle-participant-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.9rem;
    background: rgba(255,255,255,0.03);
    border-radius: 10px;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}

.battle-participant-row.is-me {
    background: rgba(124,58,237,0.1);
    border-left-color: var(--accent-purple);
}

.battle-participant-row.eliminated {
    opacity: 0.5;
    border-left-color: #ef4444;
}

.battle-participant-name {
    flex: 1;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.battle-participant-lives {
    font-size: 0.9rem;
    letter-spacing: 2px;
}

/* ─── Live-таблица ─── */
.battle-live-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 0.4rem;
    font-size: 0.92rem;
}

.battle-live-table thead th {
    text-align: left;
    padding: 0.65rem 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.battle-live-table tbody tr {
    background: rgba(255,255,255,0.03);
    transition: all 0.2s ease;
}

.battle-live-table tbody tr.is-me {
    background: rgba(124,58,237,0.12);
    box-shadow: inset 3px 0 0 var(--accent-purple);
}

.battle-live-table tbody tr.eliminated {
    opacity: 0.45;
}

.battle-live-table tbody tr.just-lost-life {
    animation: shake-life 0.5s ease;
    background: rgba(239,68,68,0.18);
}

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

.battle-live-table td {
    padding: 0.65rem 0.75rem;
    vertical-align: middle;
}

.battle-live-table td:first-child {
    border-top-left-radius: 10px;
    border-bottom-left-radius: 10px;
}

.battle-live-table td:last-child {
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
}

.battle-lives-inline {
    letter-spacing: 2px;
    font-size: 0.95rem;
}

.battle-lives-inline .dead { opacity: 0.25; }

.battle-pulse-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    margin-right: 0.35rem;
    animation: pulse-live 1.2s ease-in-out infinite;
}

/* ─── Игровой экран ─── */
.battle-game-container {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    background: #000;
    z-index: 9999;
}

.battle-hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: linear-gradient(180deg, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0.75) 100%);
    backdrop-filter: blur(10px);
    z-index: 100;
    gap: 1rem;
    flex-shrink: 0;
}

.battle-hud-left, .battle-hud-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}

.battle-hud-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    min-width: 0;
    flex: 1;
    text-align: center;
}

.battle-hud-round {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.battle-hud-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.battle-hud-value {
    font-size: 1.5rem;
    font-weight: 800;
    font-family: 'Space Grotesk', sans-serif;
    color: white;
}

.battle-hud-timer {
    font-size: 1.75rem;
    font-weight: 800;
    font-family: 'Space Grotesk', sans-serif;
    color: var(--accent-cyan);
    padding: 0.25rem 0.75rem;
    border-radius: 8px;
    background: rgba(6,182,212,0.1);
    border: 1px solid rgba(6,182,212,0.3);
    min-width: 92px;
    text-align: center;
    transition: color 0.3s, border-color 0.3s;
}

.battle-hud-timer.warning { color: #f59e0b; border-color: rgba(245,158,11,0.5); background: rgba(245,158,11,0.1); }
.battle-hud-timer.danger  { color: #ef4444; border-color: rgba(239,68,68,0.5); background: rgba(239,68,68,0.12); animation: pulse-live 0.8s ease-in-out infinite; }

.battle-hud-city {
    font-size: 1rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.battle-hud-alive {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.battle-lives {
    font-size: 1.5rem;
    letter-spacing: 3px;
    line-height: 1;
}

.battle-lives .dead { opacity: 0.2; }

.battle-panorama-container {
    flex: 1;
    position: relative;
    background: #0a0e27;
}

.battle-minimap-wrapper {
    height: 260px;
    position: relative;
    background: rgba(0,0,0,0.9);
    backdrop-filter: blur(10px);
    flex-shrink: 0;
}

.battle-minimap {
    width: 100%;
    height: 100%;
}

.battle-confirm-btn {
    position: absolute;
    bottom: 16px;
    right: 16px;
    padding: 0.9rem 1.75rem;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 20px rgba(124,58,237,0.4);
    font-family: inherit;
}

.battle-confirm-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

.battle-confirm-btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(124,58,237,0.6);
}

.battle-confirm-btn.sent {
    background: linear-gradient(135deg, #10b981, #06b6d4);
    cursor: default;
}

.battle-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.battle-overlay-content {
    text-align: center;
    padding: 2rem;
    max-width: 420px;
}

/* ─── Модалка результата раунда ─── */
.battle-result-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.9rem;
    background: rgba(255,255,255,0.03);
    border-radius: 10px;
    border-left: 3px solid transparent;
    font-size: 0.92rem;
}

.battle-result-row.is-me {
    background: rgba(124,58,237,0.12);
    border-left-color: var(--accent-purple);
}

.battle-result-row.lost-life {
    background: rgba(239,68,68,0.15);
    border-left-color: #ef4444;
}

.battle-result-row.eliminated {
    opacity: 0.55;
}

.battle-result-rank {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-muted);
    min-width: 28px;
    text-align: center;
}

.battle-result-name {
    flex: 1;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}

.battle-result-distance {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    color: var(--accent-cyan);
    white-space: nowrap;
}

.battle-result-lives {
    letter-spacing: 2px;
    font-size: 0.9rem;
    white-space: nowrap;
}

/* ─── История ─── */
.battle-history-card {
    padding: 1.5rem;
    margin-bottom: 1rem;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1.25rem;
    align-items: center;
    transition: all 0.2s ease;
    cursor: pointer;
}

.battle-history-card:hover {
    transform: translateY(-2px);
    border-color: rgba(124,58,237,0.4);
}

@media (max-width: 700px) {
    .battle-history-card {
        grid-template-columns: 1fr;
    }
}

.battle-history-id {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent-purple);
    text-align: center;
    min-width: 64px;
}

.battle-history-info {
    min-width: 0;
}

.battle-history-city {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.battle-history-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.battle-history-top3 {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.battle-history-top3-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
}

.battle-history-top3-item .medal {
    font-size: 1.1rem;
}

/* ─── Детали КБ ─── */
.battle-detail-round {
    padding: 1.25rem;
    margin-bottom: 1rem;
    background: rgba(255,255,255,0.03);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.06);
}

.battle-detail-round-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.battle-detail-guess-row {
    display: grid;
    grid-template-columns: 28px 1fr auto auto;
    gap: 0.75rem;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 0.9rem;
}

.battle-detail-guess-row:last-child {
    border-bottom: none;
}

.battle-detail-guess-row.lost-life {
    background: rgba(239,68,68,0.08);
    border-radius: 6px;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.battle-detail-guess-row .place {
    font-weight: 700;
    color: var(--text-muted);
    text-align: center;
}

.battle-detail-guess-row .name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

.battle-detail-guess-row .distance {
    font-family: 'Space Grotesk', sans-serif;
    color: var(--accent-cyan);
    font-weight: 700;
    white-space: nowrap;
}

.battle-detail-guess-row .lives {
    letter-spacing: 1px;
    white-space: nowrap;
}