* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #000000;
    transition: background 0.5s ease;
}

/* Red background when counter is at zero (recent incident) */
body.alert-mode {
    background: linear-gradient(135deg, #FF4444 0%, #CC0000 100%);
    color: #FFFFFF;
}

body.alert-mode .container {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(255, 0, 0, 0.4);
}

body.alert-mode .counter {
    color: #FFCCCC;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

body.alert-mode .status-card {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

body.alert-mode .refresh-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #FFFFFF;
}

body.alert-mode .refresh-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

body.alert-mode .footer-content a {
    color: #FFCCCC;
}

body.alert-mode .footer-content a:hover {
    color: #FFFFFF;
}

body.alert-mode .scoreboard-card {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

body.alert-mode .scoreboard-item {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

body.alert-mode .scoreboard-card h3,
body.alert-mode .building-name {
    color: #FFFFFF;
}

body.alert-mode .rank,
body.alert-mode .incident-count {
    color: #FFCCCC;
}

.container {
    background: rgba(255, 248, 220, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 3rem 2rem;
    text-align: center;
    box-shadow: 0 8px 32px rgba(255, 215, 0, 0.4);
    border: 1px solid rgba(255, 223, 0, 0.3);
    max-width: 600px;
    width: 90%;
}

.title {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
    font-weight: 300;
    letter-spacing: -1px;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.8;
    margin-bottom: 3rem;
}

.counter {
    font-size: 5rem;
    font-weight: 700;
    margin: 2rem 0;
    text-shadow: 2px 2px 4px rgba(139, 69, 19, 0.4);
    line-height: 1;
    color: #B8860B;
}

.counter-label {
    font-size: 1.3rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.status-card {
    background: rgba(255, 248, 220, 0.2);
    border-radius: 15px;
    padding: 1.5rem;
    margin-top: 2rem;
    text-align: left;
    border: 1px solid rgba(255, 223, 0, 0.2);
}

.status-card h3 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
    text-align: center;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 223, 0, 0.2);
    min-height: 2rem;
}

.status-item:last-child {
    border-bottom: none;
}

.status-label {
    font-weight: 600;
    opacity: 0.8;
    flex-shrink: 0;
    min-width: 30%;
    padding-right: 1rem;
}

.status-value {
    font-weight: 400;
    flex: 1;
    text-align: right;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    line-height: 1.3;
}

/* Special handling for units to make them more readable */
#lastUnits {
    font-size: 0.9rem;
    line-height: 1.4;
    max-width: 65%;
}

#lastUnits br {
    line-height: 1.2;
}

.scoreboard-card {
    background: rgba(255, 248, 220, 0.2);
    border-radius: 15px;
    padding: 1.5rem;
    margin-top: 2rem;
    text-align: left;
    border: 1px solid rgba(255, 223, 0, 0.2);
}

.scoreboard-card h3 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
    text-align: center;
    color: #8B4513;
}

.scoreboard-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.scoreboard-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background: rgba(255, 248, 220, 0.3);
    border-radius: 10px;
    border: 1px solid rgba(255, 223, 0, 0.2);
    transition: all 0.3s ease;
}

.scoreboard-item:hover {
    background: rgba(255, 248, 220, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.2);
}

.rank {
    font-weight: bold;
    font-size: 1.2rem;
    color: #B8860B;
    min-width: 2rem;
    text-align: center;
}

.rank.gold { color: #FFD700; }
.rank.silver { color: #C0C0C0; }
.rank.bronze { color: #CD7F32; }

.building-name {
    flex: 1;
    margin: 0 1rem;
    font-weight: 600;
    color: #8B4513;
}

.incident-count {
    font-weight: bold;
    color: #B8860B;
    background: rgba(255, 223, 0, 0.2);
    padding: 0.25rem 0.5rem;
    border-radius: 15px;
    font-size: 0.9rem;
}

.update-time {
    margin-top: 2rem;
    font-size: 0.9rem;
    opacity: 0.6;
}

.refresh-btn {
    background: rgba(255, 248, 220, 0.3);
    border: 1px solid rgba(255, 223, 0, 0.5);
    color: #8B4513;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    margin-top: 1rem;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    font-weight: 600;
}

.refresh-btn:hover {
    background: rgba(255, 248, 220, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

.loading {
    opacity: 0.5;
}

.error {
    color: #CD853F;
    margin-top: 1rem;
    font-size: 0.9rem;
    background: rgba(255, 248, 220, 0.3);
    padding: 0.5rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 223, 0, 0.3);
}

.footer {
    margin-top: 3rem;
    padding: 2rem 0 1rem 0;
    border-top: 1px solid rgba(255, 223, 0, 0.3);
    text-align: center;
}

.footer-content {
    opacity: 0.7;
    font-size: 0.8rem;
    line-height: 1.4;
}

.footer-content p {
    margin: 0.3rem 0;
}

.footer-content a {
    color: #8B4513;
    text-decoration: none;
    font-weight: 600;
}

.footer-content a:hover {
    text-decoration: underline;
    color: #A0522D;
}

.credits {
    font-size: 0.7rem;
    opacity: 0.6;
}

.disclaimer {
    font-size: 0.7rem;
    opacity: 0.8;
    margin-top: 0.5rem;
    color: #B8860B;
    font-weight: 600;
}

@media (max-width: 768px) {
    .counter {
        font-size: 3.5rem;
    }
    
    .title {
        font-size: 1.8rem;
    }
    
    .container {
        padding: 2rem 1.5rem;
    }
    
    .footer {
        margin-top: 2rem;
        padding: 1.5rem 0 1rem 0;
    }
    
    .footer-content {
        font-size: 0.75rem;
    }
    
    .status-item {
        flex-direction: column;
        align-items: flex-start;
        padding: 0.75rem 0;
    }
    
    .status-label {
        margin-bottom: 0.25rem;
        min-width: auto;
        padding-right: 0;
    }
    
    .status-value {
        text-align: left;
        max-width: 100%;
        font-size: 0.9rem;
    }
    
    #lastUnits {
        font-size: 0.85rem;
        max-width: 100%;
    }
    
    .scoreboard-item {
        padding: 0.5rem;
    }
    
    .rank {
        min-width: 1.5rem;
        font-size: 1rem;
    }
    
    .building-name {
        font-size: 0.9rem;
        margin: 0 0.5rem;
    }
    
    .incident-count {
        font-size: 0.8rem;
        padding: 0.2rem 0.4rem;
    }
}
