/* ═══════════════════════════════════════════════════════
    Clan War — Битва за территорию (territories + battles)
    ═══════════════════════════════════════════════════════ */

/* ── Screen ────────────────────────────────────────── */
.cw-screen {
    display: none;
    flex-direction: column;
    padding: 0 0 80px 0;
    min-height: 100%;
    background: var(--bg-primary);
}

.cw-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}
.cw-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.cw-header-icon { font-size: 24px; }
.cw-header-title { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.cw-header-sub { font-size: 12px; color: var(--text-secondary); text-transform: uppercase; }
.cw-back-btn {
    background: none; border: none; color: var(--text-secondary);
    min-height: 44px; min-width: 44px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 14px; cursor: pointer; padding: 10px 14px;
}

/* ── Schedule / Countdown ──────────────────────────── */
.cw-schedule {
    text-align: center;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}
.cw-phase-waiting { color: var(--text-secondary); }
.cw-phase-lobby { color: #f0a500; }
.cw-phase-active { color: #ef4444; animation: cw-pulse 1s infinite; }

@keyframes cw-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Гекс-карта и панель гекса (.cw-canvas-wrap, .cw-zoom-*,
   .cw-hex-info-panel, .cw-info-*) удалены: clan-war.js перестал
   генерировать эту разметку после перехода на список территорий. */

/* ── Battle View ───────────────────────────────────── */
.cw-battle-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}
.cw-battle-title { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.cw-battle-status { font-size: 12px; font-weight: 600; }
.cw-status-active { color: #ef4444; }
.cw-status-lobby { color: #f0a500; }
.cw-status-finished { color: #22c55e; }

/* Teams */
.cw-teams {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
}
.cw-team {
    border: 1px solid var(--border-color);
    border-left: 3px solid;
    border-radius: 8px;
    padding: 8px 10px;
    background: var(--bg-secondary);
}
.cw-team-header {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 6px;
}
.cw-player {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 0;
    font-size: 12px;
}
.cw-player-dead { opacity: 0.4; text-decoration: line-through; }
.cw-player-name {
    flex: 0 1 70px;
    min-width: 0;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cw-player-hp-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-primary);
    border-radius: 4px;
    overflow: hidden;
}
.cw-player-hp-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s;
}
.cw-player-hp-text {
    font-size: 12px;
    color: var(--text-secondary);
    flex: 0 0 auto;
    min-width: 56px;
    text-align: right;
}

@media (max-width: 390px) {
    .cw-player {
        gap: 4px;
    }

    .cw-player-name {
        flex-basis: 56px;
    }

    .cw-player-hp-text {
        min-width: 48px;
        font-size: 12px;
    }
}

/* Power bar */
.cw-power-fill {
    height: 100%;
    width: 0%;
    background: var(--error-color);
    border-radius: 12px;
    transition: width 0.1s linear;
}
.cw-power-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Actions */
.cw-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 12px 8px;
}

.cw-dead-notice, .cw-lobby-notice {
    text-align: center;
    padding: 12px;
    color: var(--text-secondary);
    font-size: 14px;
}
.cw-dead-notice { color: #ef4444; }

.cw-result {
    text-align: center;
    padding: 16px;
    font-size: 18px;
    font-weight: 700;
    color: #f0a500;
}

/* Battle log */
.cw-battle-log {
    max-height: 200px;
    overflow-y: auto;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.cw-log-entry {
    font-size: 12px;
    padding: 4px 0;
    border-bottom: 1px solid var(--border-color);
}

/* Модалка клана (.cw-clan-*) удалена — разметки под неё нет. */

/* Баннер рефорка (.cw-rework-*) удалён — разметки под него нет. */

/* ──────────────────────────────────────────────────────
   Phase D — Territories list & schedule panel
   ────────────────────────────────────────────────────── */

.cw-schedule-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px;
    margin: 0 12px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
}
.cw-schedule-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.cw-schedule-label {
    color: var(--text-secondary);
    font-weight: 600;
}

.cw-territories {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 0 12px 16px 12px;
}
.cw-tier-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.cw-tier-header {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 0;
    border-bottom: 1px solid var(--border-color);
}

.cw-terr-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-left-width: 4px;
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.cw-tier-high { border-left-color: #f59e0b; }
.cw-tier-mid  { border-left-color: #a78bfa; }
.cw-tier-low  { border-left-color: #888; }

.cw-terr-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.cw-terr-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}
.cw-terr-meta {
    font-size: 12px;
    color: var(--text-secondary);
}
.cw-terr-row {
    font-size: 13px;
    color: var(--text-primary);
}
.cw-terr-owner {
    font-weight: 600;
}
.cw-terr-owner-free {
    color: var(--text-secondary);
    font-weight: 500;
    font-style: italic;
}
.cw-terr-reward {
    color: #22c55e;
    font-size: 12px;
}

.cw-terr-status {
    font-size: 13px;
    font-weight: 600;
    padding: 6px 8px;
    border-radius: 6px;
    background: rgba(255,255,255,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.cw-terr-participants {
    font-size: 12px;
    color: var(--text-secondary);
}

.cw-join-btn {
    width: 100%;
    min-height: 44px;
    margin-top: 4px;
}
.cw-join-hint {
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
    padding: 4px 0;
}
.cw-empty {
    text-align: center;
    color: var(--text-secondary);
    padding: 30px 12px;
}

/* ── Battle additions ────────────────────────────────── */

.cw-team-mine {
    box-shadow: 0 0 0 2px rgba(34,197,94,0.4);
}
.cw-player-me {
    background: rgba(34,197,94,0.08);
}
.cw-attack-btn {
    width: 100%;
    min-height: 50px;
    font-size: 16px;
    font-weight: 700;
    margin: 8px 12px 0 12px;
    width: calc(100% - 24px);
}
.cw-leave-btn {
    margin: 8px 12px 0 12px;
    width: calc(100% - 24px);
    min-height: 44px;
}
.cw-deadline {
    text-align: center;
    color: #ef4444;
    font-size: 13px;
    font-weight: 600;
    margin-top: 4px;
}
.cw-lobby-notice,
.cw-dead-notice,
.cw-result {
    text-align: center;
    padding: 12px;
    margin: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-weight: 600;
}
.cw-result {
    font-size: 15px;
    color: var(--text-primary);
}
