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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Map */
#map {
    width: 100%;
    height: 100vh;
}

/* Game UI */
#game-ui {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: white;
    padding: 12px 25px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    text-align: center;
}

#neighborhood-name {
    font-size: 24px;
    font-weight: bold;
    color: #2196F3;
}

/* Loading */
#loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    text-align: center;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2196F3;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error Animation */
@keyframes error-blink {
    0%, 100% { background: white; }
    50% { background: #ffcccc; }
}

.error-blink {
    animation: error-blink 0.15s ease-in-out 2;
}

/* Rules Panel */
#rules {
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    background: rgba(255,255,255,0.95);
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    font-size: 14px;
    line-height: 1.6;
}

#rules h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
}

#rules .score-info {
    margin-bottom: 6px;
    font-size: 13px;
    color: #333;
}

#rules .score-info .num {
    font-weight: bold;
}

#rules .score-info .num-guessed {
    font-weight: bold;
    color: #4CAF50;
}

#rules .score-info .num-failed {
    font-weight: bold;
    color: #f44336;
}

#rules .show-rules {
    margin-top: 12px;
    color: #2196F3;
    cursor: pointer;
    font-size: 13px;
}

#rules .show-rules:hover {
    text-decoration: underline;
}

#rules .rule {
    display: flex;
    align-items: center;
    gap: 8px;
}

#rules .dot {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
}

/* Language Switcher */
#welcome-lang-switcher {
    position: absolute;
    bottom: 15px;
    right: 18px;
}

.lang-flag {
    cursor: pointer;
    opacity: 0.8;
    display: inline-block;
    width: 24px;
    height: 18px;
    background-size: cover;
    border-radius: 2px;
    vertical-align: middle;
    border: 1px solid #ccc;
}

.lang-flag:hover {
    opacity: 1;
}

/* Modal Base Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 35px 45px;
    border-radius: 15px;
    max-width: 520px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    text-align: center;
    position: relative;
}

.modal-close-x {
    position: absolute;
    top: 15px;
    right: 18px;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close-x:hover {
    color: #333;
}

/* Welcome Modal */
#welcome-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
}

#welcome-content {
    background: white;
    padding: 35px 45px;
    border-radius: 15px;
    max-width: 520px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    text-align: center;
    position: relative;
}

#welcome-content h1 {
    color: #2196F3;
    font-size: 26px;
    margin-bottom: 15px;
}

#welcome-content .intro {
    color: #555;
    font-size: 15px;
    margin-bottom: 20px;
    line-height: 1.5;
}

#welcome-content h2 {
    color: #333;
    font-size: 18px;
    margin: 20px 0 12px;
    text-align: left;
}

#welcome-content .welcome-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #555;
    margin-bottom: 6px;
    text-align: left;
}

#welcome-content .welcome-dot {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
}

#welcome-content .scoring-intro {
    font-size: 14px;
    color: #555;
    margin-bottom: 10px;
    text-align: left;
}

#welcome-content .good-luck {
    margin-top: 20px;
    font-size: 14px;
    color: #666;
    font-style: italic;
}

#start-game-btn {
    margin-top: 25px;
    padding: 14px 50px;
    font-size: 18px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
}

#start-game-btn:hover {
    background: #45a049;
    transform: scale(1.02);
}

#close-modal-btn {
    margin-top: 25px;
    padding: 14px 50px;
    font-size: 18px;
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
    display: none;
}

#close-modal-btn:hover {
    background: #1976D2;
    transform: scale(1.02);
}

#modal-close-x {
    position: absolute;
    top: 15px;
    right: 18px;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
    display: none;
}

#modal-close-x:hover {
    color: #333;
}

/* Final Modal */
#final-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
}

#final-content {
    background: white;
    padding: 35px 45px;
    border-radius: 15px;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    text-align: center;
    position: relative;
}

#final-close-x {
    position: absolute;
    top: 15px;
    right: 18px;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

#final-close-x:hover {
    color: #333;
}

#final-content h1 {
    font-size: 28px;
    margin-bottom: 10px;
}

#final-content .level-title {
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 20px;
}

#final-content .stats {
    text-align: left;
    margin: 20px 0;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 8px;
}

#final-content .stat-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 15px;
}

#final-content .stat-row:last-child {
    margin-bottom: 0;
}

#final-content .stat-value {
    font-weight: bold;
}

#final-content .level-bar {
    width: 100%;
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    margin: 15px 0;
    overflow: hidden;
}

#final-content .level-progress {
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s ease;
}

#play-again-btn {
    margin-top: 20px;
    padding: 14px 50px;
    font-size: 18px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
}

#play-again-btn:hover {
    background: #45a049;
    transform: scale(1.02);
}
