/* ============================================
   CWL Live Table - War-Themed Styling
   ============================================ */

:root {
    --war-dark-bg: #0f1419;
    --war-darker-bg: #0a0e13;
    --war-gold: #d4af37;
    --war-gold-bright: #ffd700;
    --war-bronze: #cd7f32;
    --war-silver: #c0c0c0;
    --war-red: #dc2626;
    --war-green: #16a34a;
    --war-blue: #1e3a8a;
    --war-primary: #3b82f6;
    --war-border: #2d3748;
    --war-glow: rgba(212, 175, 55, 0.5);
    --war-text-primary: #e2e8f0;
    --war-text-secondary: #94a3b8;
}

/* Global Dark Mode */
body {
    background: var(--war-darker-bg) !important;
    color: var(--war-text-primary) !important;
    min-height: 100vh;
}

/* Input Section Styling */
.cwl-input-section {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.6), rgba(15, 20, 25, 0.8));
    border: 2px solid var(--war-gold);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.2);
}

.cwl-input-section h1 {
    color: var(--war-gold);
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    text-align: center;
}

.cwl-input-section .subtitle {
    color: var(--war-text-secondary);
    text-align: center;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.cwl-input-controls {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.cwl-input-controls input {
    background: rgba(0, 0, 0, 0.5) !important;
    color: var(--war-text-primary) !important;
    border: 1px solid var(--war-border) !important;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    min-width: 200px;
}

.cwl-input-controls input::placeholder {
    color: var(--war-text-secondary);
}

.cwl-input-controls button {
    padding: 0.5rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cwl-input-controls .btn-load {
    background: linear-gradient(135deg, var(--war-gold), var(--war-gold-bright));
    color: var(--war-dark-bg);
}

.cwl-input-controls .btn-refresh {
    background: linear-gradient(135deg, var(--war-bronze), var(--war-gold));
    color: var(--war-dark-bg);
}

.cwl-input-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cwl-input-controls button:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--war-glow);
}

/* Container */
.cwl-container {
    color: var(--war-text-primary);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Header */
.cwl-header {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin-bottom: 2rem;
    padding: 2rem;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.6), rgba(15, 20, 25, 0.8));
    border: 2px solid var(--war-border);
    border-radius: 12px;
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.2), inset 0 0 30px rgba(0, 0, 0, 0.5);
}

.cwl-header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.cwl-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    background: linear-gradient(135deg, var(--war-gold-bright), var(--war-bronze));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 20px var(--war-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.title-icon {
    font-size: 2rem;
    text-shadow: 0 0 10px var(--war-gold), 0 0 20px var(--war-gold);
}

.cwl-season-info {
    display: flex;
    justify-content: center;
}

.last-sync {
    color: var(--war-text-secondary);
    font-size: 0.9rem;
}

/* Actions */
.cwl-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 1.5rem;
}

.btn-refresh {
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--war-gold);
    border-radius: 0.325em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    color: red;
}

.btn-purge {
    display: none;
    min-width: 150px;
}

.btn-purge.show {
    display: block;
}

.btn-text {
    font-size: 0.9rem;
}

.btn-refresh {
    background: linear-gradient(135deg, var(--war-gold), var(--war-gold-bright));
    color: var(--war-dark-bg);
    box-shadow: 0 4px 15px var(--war-glow);
}

.btn-refresh:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--war-glow);
}

.btn-refresh:active {
    transform: translateY(0);
}

.btn-purge.btn-outline-primary {
    color: var(--war-red);
    border-color: var(--war-red);
    background: transparent;
}

.btn-purge.btn-outline-primary:hover {
    background-color: var(--war-red);
    border-color: var(--war-red);
    color: white;
}

.btn-purge.btn-outline-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 0, 0, 0.5);
}

/* Section Titles */
.section-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--war-gold);
    text-align: center;
    margin: 2rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.title-divider {
    flex: 1;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--war-gold), transparent);
    max-width: 200px;
}

/* Standings Table */
/* CWL Info Section - now inside header */
.cwl-info-content {
    width: 100%;
    margin-top: 1.5rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--war-border);
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease, margin-top 0.3s ease;
    overflow: hidden;
    max-height: 2000px;
    opacity: 1;
}

.cwl-info-content.collapsed {
    max-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    opacity: 0;
    border: none;
    box-shadow: none;
    background: transparent !important;
}

.distribution-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.distribution-card {
    background: var(--war-bg);
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid var(--war-border);
}

.distribution-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--war-text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.distribution-title i {
    color: var(--war-gold);
}

.distribution-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.distribution-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 0;
}

.distribution-label {
    min-width: 150px;
    font-weight: 500;
    color: var(--war-text);
    text-align: left;
}

.distribution-bar-container {
    flex: 1;
    height: 20px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.distribution-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--war-primary), var(--war-gold));
    border-radius: 10px;
    transition: width 0.3s ease;
    min-width: 2px;
}

.distribution-value {
    min-width: 80px;
    text-align: right;
    font-weight: 600;
    color: var(--war-text-secondary);
    font-size: 0.9rem;
}

.distribution-empty {
    text-align: center;
    color: var(--war-text-secondary);
    padding: 1rem;
    font-style: italic;
}

/* Expandable Distribution Rows */
.clan-row-expand {
    background: none;
    border: none;
    color: var(--war-text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    margin: 0 auto;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
}

.clan-row-expand:hover {
    background: var(--war-border);
    color: var(--war-primary);
    opacity: 1;
}

.clan-row-expand i {
    font-size: 1rem;
}

.distribution-row {
    background: var(--war-card-bg);
}

.distribution-row td {
    padding: 1rem 1.5rem !important;
    border-top: 2px solid var(--war-border);
}

.clan-distribution-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

.clan-distribution-section {
    color: var(--war-text);
    font-size: 0.95rem;
}

.clan-distribution-section strong {
    color: var(--war-text-secondary);
    margin-right: 0.5rem;
}

.clan-distribution-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 0.25rem;
}

.clan-distribution-item {
    display: block;
    margin-left: 0.5rem;
}

.clan-distribution-mobile {
    padding: 1rem;
    background: var(--war-bg);
    border-top: 2px solid var(--war-border);
    margin-top: 0.5rem;
}

.distribution-empty-small {
    text-align: center;
    color: var(--war-text-secondary);
    padding: 0.5rem;
    font-style: italic;
    font-size: 0.9rem;
}

.standings-section {
    margin-bottom: 3rem;
}

/* Show/hide desktop vs mobile views */
.standings-mobile {
    display: none;
}

@media (max-width: 1000px) {
    .clan-badge {
        display: none;
    }
}

@media (max-width: 768px) {
    .standings-desktop {
        display: none;
    }

    .standings-mobile {
        display: block;
    }
}

.standings-table-container {
    overflow-x: auto;
    background: rgba(15, 20, 25, 0.6);
    border: 2px solid var(--war-border);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(0, 0, 0, 0.3);
}

.standings-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.standings-table thead {
    background: linear-gradient(135deg, var(--war-bronze), var(--war-gold));
    color: var(--war-dark-bg);
}

.standings-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 700;
    border-bottom: 3px solid var(--war-gold-bright);
}

.standings-table tbody tr {
    border-bottom: 1px solid var(--war-border);
    transition: all 0.3s ease;
}

.standings-table tbody tr:hover {
    background: rgba(212, 175, 55, 0.1);
}

.standings-table tbody tr.our-clan {
    background: linear-gradient(90deg, rgba(30, 58, 138, 0.15), rgba(30, 58, 138, 0.05));
}

.standings-table td {
    padding: 1rem;
    color: var(--war-text-primary);
}

/* First column (Rank) - centered */
.standings-table th:nth-child(1),
.standings-table td:nth-child(1) {
    width: 60px;
    text-align: center;
}

/* Second column (Clan) - left aligned, flexible */
.standings-table th:nth-child(2),
.standings-table td:nth-child(2) {
    width: 180px;
    text-align: left;
}

/* Third column (Points) - centered */
.standings-table th:nth-child(3),
.standings-table td:nth-child(3) {
    width: 80px;
    text-align: center;
}

/* Fourth column (Stars) - centered */
.standings-table th:nth-child(4),
.standings-table td:nth-child(4) {
    width: 80px;
    text-align: center;
}

/* Fifth column (Destruction) - centered */
.standings-table th:nth-child(5),
.standings-table td:nth-child(5) {
    width: 100px;
    text-align: center;
}

/* Sixth column (Hit Rate) - centered */
.standings-table th:nth-child(6),
.standings-table td:nth-child(6) {
    width: 90px;
    text-align: center;
}

/* Seventh column (Record) - centered */
.standings-table th:nth-child(7),
.standings-table td:nth-child(7) {
    width: 90px;
    text-align: center;
}


/* Fix header alignment to match content - center numeric columns */
.standings-table th:nth-child(1),
.standings-table th:nth-child(3),
.standings-table th:nth-child(4),
.standings-table th:nth-child(5),
.standings-table th:nth-child(6),
.standings-table th:nth-child(7),
.standings-table th:nth-child(8) {
    text-align: center;
}

.rank-badge {
    display: inline-block;
    width: 35px;
    height: 35px;
    line-height: 35px;
    text-align: center;
    border-radius: 50%;
    font-weight: 700;
    font-size: 1.1rem;
}

.rank-1 {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: var(--war-dark-bg);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
}

.rank-2 {
    background: linear-gradient(135deg, #c0c0c0, #e8e8e8);
    color: var(--war-dark-bg);
    box-shadow: 0 0 15px rgba(192, 192, 192, 0.6);
}

.rank-3 {
    background: linear-gradient(135deg, #cd7f32, #e89656);
    color: var(--war-dark-bg);
    box-shadow: 0 0 15px rgba(205, 127, 50, 0.6);
}

.rank-other {
    background: rgba(30, 41, 59, 0.6);
    color: var(--war-text-primary);
    border: 1px solid var(--war-border);
}

.clan-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.clan-badge {
    width: 40px;
    height: 40px;
    border-radius: 8px;
}

.clan-name {
    font-weight: 600;
    color: var(--war-gold-bright);
}

.attacks-remaining {
    font-size: 0.85rem;
    color: var(--war-text-secondary);
    font-weight: 500;
    margin-left: 0.5rem;
}

.bonus-indicator {
    display: inline-block;
    background: var(--war-green);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

/* Mobile Standing Cards */
.standing-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.4), rgba(15, 20, 25, 0.6));
    border: 2px solid var(--war-border);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.standing-card.our-clan {
    background: linear-gradient(135deg, rgba(30, 58, 138, 0.3), rgba(15, 20, 25, 0.6));
}

.standing-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--war-border);
}

.clan-info-mobile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.clan-badge-mobile {
    width: 40px;
    height: 40px;
    border-radius: 8px;
}

.clan-name-mobile {
    font-weight: 600;
    color: var(--war-gold-bright);
    font-size: 1.1rem;
}

.standing-card-body {
    display: grid;
    gap: 0.75rem;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-label {
    color: var(--war-text-secondary);
    font-size: 0.9rem;
}

.stat-value {
    color: var(--war-text-primary);
    font-size: 1rem;
}

.bonus-indicator-small {
    display: inline-block;
    background: var(--war-green);
    color: white;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.25rem;
}

/* Round Wheel */
.rounds-section {
    margin-bottom: 3rem;
}

.round-wheel-container {
    background: rgba(15, 20, 25, 0.6);
    border: 2px solid var(--war-border);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(0, 0, 0, 0.3);
}

.round-selector {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.round-nav-btn {
    background: linear-gradient(135deg, var(--war-bronze), var(--war-gold));
    color: var(--war-dark-bg);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px var(--war-glow);
}

.round-nav-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px var(--war-glow);
}

.round-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: scale(1);
}

.round-indicator {
    text-align: center;
}

.round-label {
    display: block;
    color: var(--war-text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.round-number {
    display: block;
    font-size: 3rem;
    font-weight: 700;
    color: var(--war-gold-bright);
    text-shadow: 0 0 20px var(--war-glow);
}

.round-total {
    display: block;
    color: var(--war-text-secondary);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.round-status-badge {
    display: inline-block;
    margin-top: 0.75rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 140px;
    text-align: center;
}

.round-status-badge.status-ended {
    background: var(--war-green);
    color: white;
}

.round-status-badge.status-inwar {
    background: var(--war-red);
    color: white;
    animation: statusPulse 2s infinite;
}

.round-status-badge.status-preparation {
    background: #555;
    color: white;
}

@keyframes statusPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(139, 0, 0, 0.5); }
    50% { box-shadow: 0 0 20px rgba(139, 0, 0, 0.8); }
}

/* War Timer */
.war-timer {
    margin-top: 0.75rem;
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    border: 1px solid var(--war-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.war-timer .timer-label {
    font-size: 0.75rem;
    color: var(--war-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.war-timer .timer-value {
    font-size: 1.25rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
}

.war-timer.countdown .timer-value {
    color: var(--war-gold-bright);
    text-shadow: 0 0 10px var(--war-glow);
}

.war-timer.time-remaining .timer-value {
    color: var(--war-red);
    text-shadow: 0 0 10px rgba(220, 38, 38, 0.5);
}

.round-wheel {
    position: relative;
    min-height: 400px;
}

.round-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    transition: all 0.5s ease;
}

@media (min-width: 1000px) {
    .round-content {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* War Card */
.war-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.4), rgba(15, 20, 25, 0.6));
    border: 2px solid var(--war-border);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.war-card:hover {
    box-shadow: 0 10px 30px rgba(212, 175, 55, 0.3);
    border-color: var(--war-gold);
}

.war-card.war-ended {
    border-color: var(--war-green);
}

.war-card.war-inwar {
    border-color: var(--war-red);
    animation: warPulse 2s infinite;
}

@keyframes warPulse {
    0%, 100% { box-shadow: 0 0 20px rgba(139, 0, 0, 0.3); }
    50% { box-shadow: 0 0 30px rgba(139, 0, 0, 0.6); }
}

.war-matchup {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    grid-template-rows: auto auto;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
    padding-top: 2rem;
    position: relative;
}

.war-clan-names {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-align: center;
    min-height: 60px;
    position: relative;
}

.war-clan-name {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--war-gold);
    max-width: 100px;
    word-break: break-word;
    line-height: 1.4;
}

.war-clan-badge {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    flex-shrink: 0;
}

.war-clan-stars {
    font-size: 2rem;
    font-weight: 700;
    color: var(--war-gold-bright);
    text-shadow: 0 0 10px var(--war-glow);
    text-align: center;
    grid-row: 2;
}

.war-clan-stars:nth-of-type(4) {
    grid-column: 1;
}

.war-clan-stars:nth-of-type(6) {
    grid-column: 3;
}

.war-empty {
    grid-row: 2;
    grid-column: 2;
}

.war-vs-div {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    grid-row: 1;
    grid-column: 2;
}

.war-vs {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--war-text-secondary);
}

.war-clan-badge-left,
.war-clan-badge-right {
    flex-shrink: 0;
}

/* Hide mobile badges on desktop */
.war-clan-badge-mobile {
    display: none;
}

.war-clan-section {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.war-clan-section.winner::before {
    content: "👑";
    display: block;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 2px 4px rgba(255, 215, 0, 0.6));
}

.war-clan-names.winner::before {
    content: "👑";
    position: absolute;
    top: -1.5rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.5rem;
    z-index: 5;
    filter: drop-shadow(0 2px 4px rgba(255, 215, 0, 0.6));
}

.war-vs-section {
    display: flex;
    align-items: center;
    justify-content: center;
}

.war-vs {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--war-text-secondary);
}

.war-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--war-border);
    font-size: 0.9rem;
    color: var(--war-text-secondary);
}

.war-clan-details {
    text-align: center;
}

.war-detail-clan-name {
    font-weight: 600;
    color: var(--war-gold);
    margin-bottom: 0.5rem;
}

.war-detail-stats {
    color: var(--war-text-secondary);
}

.stat-label {
    display: block;
    font-size: 0.85rem;
    color: var(--war-text-secondary);
    margin-top: 0.3rem;
    font-weight: 500;
}

.attack-icon {
    color: var(--war-red);
}

/* Hide mobile destruction icon on desktop */
.destruction-icon-mobile {
    display: none;
}

/* Hide mobile labels on desktop */
.stat-label-mobile {
    display: none;
}

/* Show desktop labels on desktop */
.stat-label-desktop {
    display: inline;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: linear-gradient(135deg, var(--war-dark-bg), var(--war-darker-bg));
    margin: 10% auto;
    padding: 2rem;
    border: 2px solid var(--war-gold);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 0 50px var(--war-glow);
}

.modal-content h3 {
    color: var(--war-gold);
    margin-bottom: 1rem;
}

.modal-content p {
    color: var(--war-text-primary);
    margin-bottom: 1rem;
}

.warning-text {
    color: var(--war-red);
    font-weight: 600;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.btn-confirm-purge {
    flex: 1;
    background: var(--war-red);
    color: white;
    padding: 0.75rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-confirm-purge:hover {
    background: #a00000;
    transform: translateY(-2px);
}

.btn-cancel {
    flex: 1;
    background: #555;
    color: white;
    padding: 0.75rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-cancel:hover {
    background: #666;
    transform: translateY(-2px);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.loading-spinner {
    text-align: center;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(212, 175, 55, 0.3);
    border-top-color: var(--war-gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-spinner p {
    color: var(--war-gold);
    font-size: 1.2rem;
}

/* Responsive Design */
@media (max-width: 900px) {
    .cwl-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .cwl-header-content {
        width: 100%;
        margin-bottom: 1rem;
    }
}

@media (max-width: 768px) {
    .cwl-header {
        padding: 1.5rem 1rem;
    }

    .cwl-title {
        font-size: 1.8rem;
    }

    .cwl-info-content {
        border: none;
    }

    .btn-refresh,
    .btn-purge {
        max-width: 200px;
    }

    /* Keep button text visible on mobile */
    .btn-text {
        display: inline;
    }

    .standings-table {
        font-size: 0.9rem;
    }

    .standings-table th,
    .standings-table td {
        padding: 0.75rem 0.5rem;
    }
}

/* Mobile responsiveness for war cards */
/* Close War Info Icon & Tooltip */
.close-war-info-wrapper {
    position: relative;
    display: inline-block;
}

.close-war-info {
    color: var(--war-text-secondary);
    font-size: 0.85rem;
    margin-left: 0.5rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.close-war-info:hover {
    opacity: 1;
    color: var(--war-primary);
}

.close-war-tooltip {
    display: none;
    position: fixed;
    background: var(--war-card-bg, #1a1a2e);
    color: var(--war-text-primary, #e0e0e0);
    border: 1px solid var(--war-primary, #4a9eff);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.75rem;
    white-space: pre-line;
    max-width: 320px;
    width: max-content;
    line-height: 1.4;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

@media (max-width: 480px) {
    .close-war-tooltip {
        max-width: calc(100vw - 24px);
        font-size: 0.7rem;
    }
}

.close-war-tooltip.visible {
    display: block;
}

@media (max-width: 768px) {
    .war-clan-name {
        font-size: 0.85rem;
        max-width: 100px;
        word-break: break-word;
        line-height: 1.3;
    }

    .war-matchup {
        gap: 0.75rem;
        padding-top: 1.5rem;
    }

    .war-clan-names {
        min-height: auto;
        gap: 0.5rem;
        flex-direction: column;
        align-items: center;
    }

    /* On mobile, stack VS vertically in center (no badges) */
    .war-vs-div {
        flex-direction: column;
        gap: 0.5rem;
    }

    /* Hide center badges on mobile */
    .war-vs-div .war-clan-badge {
        display: none;
    }

    /* Show mobile badges above names on mobile */
    .war-clan-badge-mobile {
        display: block;
    }

    /* Hide star icon on mobile (keep the number visible) */
    .war-clan-stars .star-icon {
        display: none;
    }

    /* Hide bullet separator on mobile */
    .bullet-separator {
        display: none;
    }

    /* Stack attack stats vertically on mobile */
    .attack-stats-line {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
    }

    .attack-stats-attacks,
    .attack-stats-destruction {
        display: block;
    }

    /* Hide line break on mobile */
    .stats-line-break {
        display: none;
    }

    /* Show destruction icon on mobile (icon on left) */
    .destruction-icon-mobile {
        display: inline-block;
        margin-right: 0.25rem;
        color: var(--war-red);
    }

    /* Hide desktop labels, show mobile labels on mobile */
    .stat-label-desktop {
        display: none;
    }

    .stat-label-mobile {
        display: inline;
    }

    /* Mobile distribution styles */
    .distribution-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .distribution-card {
        padding: 1rem;
    }

    .distribution-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .distribution-label {
        min-width: auto;
        width: 100%;
        text-align: left;
    }

    .distribution-bar-container {
        width: 100%;
    }

    .distribution-value {
        min-width: auto;
        width: 100%;
        text-align: left;
    }

    .clan-info-mobile .clan-row-expand {
        margin-left: auto;
    }
}


/* ============================================
   Attack / Defense Alerts
   ============================================ */

.btn-outline-primary.alerts-on {
    border-color: var(--war-gold);
    color: var(--war-gold-bright);
    box-shadow: 0 0 12px var(--war-glow);
}

.notify-label {
    display: block;
    color: var(--war-text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
}

.notify-input {
    width: 100%;
    padding: 0.65rem 0.85rem;
    background: var(--war-darker-bg);
    color: var(--war-text-primary);
    border: 1px solid var(--war-border);
    border-radius: 8px;
    font-size: 1rem;
    text-transform: uppercase;
}

.notify-input:focus {
    outline: none;
    border-color: var(--war-gold);
    box-shadow: 0 0 10px var(--war-glow);
}

.notify-options {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 1.25rem;
}

.notify-check {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--war-text-primary);
    cursor: pointer;
    user-select: none;
}

.notify-check input {
    width: 1.05rem;
    height: 1.05rem;
    accent-color: var(--war-gold);
    cursor: pointer;
}

.notify-status {
    min-height: 1.2rem;
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--war-text-secondary);
}

.notify-status.is-error {
    color: var(--war-red);
}

.notify-status.is-ok {
    color: var(--war-green);
}

.btn-confirm-notify {
    flex: 1;
    background: linear-gradient(135deg, var(--war-bronze), var(--war-gold));
    color: var(--war-dark-bg);
    padding: 0.75rem;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-confirm-notify:hover {
    box-shadow: 0 4px 15px var(--war-glow);
}

/* Toasts */

.notify-toasts {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-width: min(360px, calc(100vw - 2rem));
    pointer-events: none;
}

.notify-toast {
    pointer-events: auto;
    background: linear-gradient(135deg, var(--war-dark-bg), var(--war-darker-bg));
    border: 1px solid var(--war-border);
    border-left: 4px solid var(--war-gold);
    border-radius: 10px;
    padding: 0.75rem 0.9rem;
    color: var(--war-text-primary);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    animation: notify-toast-in 0.25s ease-out;
    cursor: pointer;
}

.notify-toast.is-defense {
    border-left-color: var(--war-red);
}

.notify-toast.is-attack {
    border-left-color: var(--war-green);
}

.notify-toast-title {
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 0.2rem;
}

.notify-toast-body {
    /* The body is built with a \n between the matchup and the result line;
       pre-line honours it while still wrapping long player names. */
    white-space: pre-line;
    font-size: 0.85rem;
    color: var(--war-text-secondary);
    line-height: 1.35;
}

.notify-toast.is-leaving {
    animation: notify-toast-out 0.25s ease-in forwards;
}

@keyframes notify-toast-in {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes notify-toast-out {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(20px); }
}

@media (max-width: 768px) {
    .notify-toasts {
        left: 1rem;
        right: 1rem;
        max-width: none;
    }
}

/* ============================================
   War History (current war only)
   ============================================ */

.war-history-section {
    margin-top: 2.5rem;
}

.war-history-subtitle {
    text-align: center;
    color: var(--war-text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.war-history-content {
    max-width: 900px;
    margin: 0 auto;
    max-height: 420px;
    overflow-y: auto;
    border: 1px solid var(--war-border);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.25);
}

/* One line per attack, always: names ellipsize rather than wrap, so the feed reads as a
   dense headerless table and a full war stays a short scroll. */
.history-row {
    display: grid;
    grid-template-columns: 2.6rem minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-bottom: 1px solid var(--war-border);
    border-left: 4px solid transparent;
}

.history-row:last-child {
    border-bottom: none;
}

.history-row.is-attack {
    border-left-color: var(--war-green);
}

.history-row.is-defense {
    border-left-color: var(--war-red);
}

.history-order {
    color: var(--war-text-secondary);
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
}

.history-matchup {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.4rem;
    color: var(--war-text-primary);
    font-size: 0.85rem;
    min-width: 0;
    overflow: hidden;
}

.history-arrow {
    color: var(--war-text-secondary);
    flex: none;
}

.history-player {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.history-result {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    white-space: nowrap;
}

.history-stars {
    letter-spacing: 0.05em;
    color: var(--war-gold-bright);
    font-size: 0.85rem;
}

.history-destruction {
    color: var(--war-text-secondary);
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
    min-width: 3rem;
    text-align: right;
}

.history-empty {
    text-align: center;
    color: var(--war-text-secondary);
    padding: 1.5rem;
    margin: 0;
}

@media (max-width: 768px) {
    /* Still one line per attack — just tighter. Long names give way to the ellipsis. */
    .history-row {
        grid-template-columns: 2.1rem minmax(0, 1fr) auto;
        gap: 0.35rem;
        padding: 0.2rem 0.5rem;
    }

    .history-order {
        font-size: 0.7rem;
    }

    .history-matchup {
        font-size: 0.8rem;
    }

    .history-result {
        gap: 0.35rem;
    }

    .history-stars {
        font-size: 0.8rem;
    }

    .history-destruction {
        font-size: 0.75rem;
        min-width: 2.4rem;
    }
}

/* ============================================
   Season Over Panel
   ============================================ */

.season-over {
    max-width: 700px;
    margin: 3rem auto;
    padding: 3rem 2rem;
    text-align: center;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.6), rgba(15, 20, 25, 0.8));
    border: 2px solid var(--war-gold);
    border-radius: 12px;
    box-shadow: 0 0 40px rgba(212, 175, 55, 0.2), inset 0 0 30px rgba(0, 0, 0, 0.5);
}

.season-over-icon {
    font-size: 4rem;
    line-height: 1;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 20px var(--war-glow));
}

.season-over-title {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    background: linear-gradient(135deg, var(--war-gold-bright), var(--war-bronze));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.season-over-subtitle {
    color: var(--war-text-secondary);
    font-size: 1rem;
    margin-bottom: 2rem;
}

.season-over-result {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--war-border);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.season-over-medal {
    font-size: 2.5rem;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.season-over-rank {
    color: var(--war-gold);
    font-size: 1.3rem;
    font-weight: 700;
}

.season-over-clan {
    color: var(--war-text-primary);
    font-size: 1.05rem;
    margin-top: 0.25rem;
}

.season-over-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.25rem;
    margin-top: 1rem;
    color: var(--war-text-secondary);
    font-size: 0.9rem;
}

.season-over-jab {
    margin-top: 0.9rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--war-border);
    color: var(--war-text-secondary);
    font-size: 0.85rem;
    font-style: italic;
}

.season-over-countdown {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--war-border);
    border-radius: 10px;
    padding: 1.25rem;
}

.season-over-countdown-label {
    color: var(--war-text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.season-over-countdown-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--war-gold);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.03em;
    text-shadow: 0 0 20px var(--war-glow);
}

.season-over-countdown-waiting {
    font-size: 1.15rem;
    letter-spacing: 0;
}

.season-over-countdown-date {
    color: var(--war-text-secondary);
    font-size: 0.9rem;
    margin-top: 0.4rem;
}

@media (max-width: 600px) {
    .season-over {
        padding: 2rem 1.25rem;
        margin: 1.5rem auto;
    }

    .season-over-title {
        font-size: 1.5rem;
    }
}
