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

body {
    margin: 0;
    overflow: hidden;
    background-image: url('./assets/map.jpg');
    background-size: cover;
    background-position: center;
    cursor: crosshair;
    font-family: 'Inter', Arial, sans-serif;
}

canvas {
    display: block;
    width: 100vw;
    height: 100vh;
    object-fit: fill;
}

/* Start Menu */
#start-menu-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(5, 5, 10, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    backdrop-filter: blur(5px);
    overflow-y: auto;
}

#start-menu-content {
    background: rgba(10, 10, 15, 0.9);
    border: 2px solid #c8aa6e;
    padding: 30px 50px;
    border-radius: 15px;
    text-align: center;
    color: white;
    box-shadow: 0 0 50px rgba(200, 170, 110, 0.3), inset 0 0 20px rgba(0, 0, 0, 0.5);
    max-width: 800px;
    width: 95%;
    margin: 15px 0;
}

#game-title {
    font-size: 48px;
    font-weight: 900;
    color: #c8aa6e;
    margin-bottom: 5px;
    text-shadow: 0 0 15px rgba(200, 170, 110, 0.5);
    letter-spacing: 5px;
}

.game-subtitle {
    font-size: 14px;
    color: #a38d26;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

#control-guide {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 20px;
    text-align: left;
    background: rgba(255, 255, 255, 0.05);
    padding: 12px 20px;
    border-radius: 10px;
}

.control-item {
    display: flex;
    align-items: center;
    gap: 15px;
}

.control-key {
    background: #c8aa6e;
    color: #111;
    padding: 4px 12px;
    border-radius: 4px;
    font-weight: 900;
    min-width: 80px;
    text-align: center;
    font-size: 13px;
}

.control-desc {
    color: #ddd;
    font-size: 14px;
}

/* Leaderboard */
#leaderboard-section {
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.05);
    padding: 15px 20px;
    border-radius: 10px;
    border: 1px solid rgba(200, 170, 110, 0.2);
}

#leaderboard-title {
    font-size: 18px;
    color: #c8aa6e;
    margin-bottom: 8px;
    letter-spacing: 2px;
}

#leaderboard-list {
    min-height: 40px;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 5px;
}

/* Custom Scrollbar for Leaderboard */
#leaderboard-list::-webkit-scrollbar {
    width: 6px;
}
#leaderboard-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}
#leaderboard-list::-webkit-scrollbar-thumb {
    background: rgba(200, 170, 110, 0.4);
    border-radius: 4px;
}
#leaderboard-list::-webkit-scrollbar-thumb:hover {
    background: rgba(200, 170, 110, 0.7);
}

.leaderboard-loading {
    color: #888;
    font-size: 14px;
    padding: 10px 0;
}

.leaderboard-empty {
    color: #666;
    font-size: 14px;
    padding: 10px 0;
}

.lb-row {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 6px;
    margin-bottom: 4px;
    transition: background 0.2s;
}

.lb-row:hover {
    background: rgba(200, 170, 110, 0.1);
}

.lb-row.lb-gold { background: rgba(255, 215, 0, 0.1); }
.lb-row.lb-silver { background: rgba(192, 192, 192, 0.08); }
.lb-row.lb-bronze { background: rgba(205, 127, 50, 0.08); }

.lb-rank {
    width: 30px;
    font-weight: 900;
    font-size: 16px;
    text-align: center;
}

.lb-gold .lb-rank { color: #ffd700; }
.lb-silver .lb-rank { color: #c0c0c0; }
.lb-bronze .lb-rank { color: #cd7f32; }
.lb-row:not(.lb-gold):not(.lb-silver):not(.lb-bronze) .lb-rank { color: #888; }

.lb-name {
    flex: 1;
    text-align: left;
    padding-left: 10px;
    font-size: 14px;
    color: #ddd;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lb-score {
    font-weight: 700;
    font-size: 14px;
    color: #f1c40f;
    min-width: 60px;
    text-align: right;
}

.lb-level {
    font-size: 12px;
    color: #888;
    min-width: 45px;
    text-align: right;
}

#high-score-display {
    font-size: 18px;
    margin-bottom: 20px;
    color: #f1c40f;
    font-weight: 700;
}

#start-btn {
    background: linear-gradient(180deg, #c8aa6e 0%, #a38d26 100%);
    color: #111;
    border: none;
    padding: 16px 55px;
    font-size: 20px;
    font-weight: 900;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    letter-spacing: 2px;
    text-transform: uppercase;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

#start-btn:hover {
    background: linear-gradient(180deg, #f1d98a 0%, #c8aa6e 100%);
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(200, 170, 110, 0.5);
}

/* Skill Bar */
#ui-container {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    pointer-events: none;
}

.skill-box {
    width: 60px;
    height: 60px;
    background-color: rgba(20, 20, 20, 0.85);
    border: 2px solid #c8aa6e;
    border-radius: 8px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 22px;
    font-weight: bold;
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.6), inset 0 0 8px rgba(200, 170, 110, 0.15);
}

.skill-key {
    position: absolute;
    top: 3px;
    left: 5px;
    font-size: 12px;
    color: #ccc;
}

.skill-cd {
    z-index: 2;
}

.on-cooldown {
    border-color: #555;
    color: #fff;
}

.on-cooldown::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 6px;
}

/* Score Board */
#score-board {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 28px;
    font-weight: 900;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.9), 2px 2px 4px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    z-index: 10;
    letter-spacing: 1px;
}

/* Difficulty Display */
#difficulty-display {
    position: absolute;
    top: 58px;
    left: 50%;
    transform: translateX(-50%);
    color: #c8aa6e;
    font-size: 16px;
    font-weight: 700;
    text-shadow: 0 0 8px rgba(0, 0, 0, 0.9), 1px 1px 3px rgba(0, 0, 0, 0.7);
    pointer-events: none;
    z-index: 10;
    letter-spacing: 1px;
}

/* Game Over */
#game-over-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(10, 10, 15, 0.95);
    border: 2px solid #c8aa6e;
    padding: 40px 60px;
    border-radius: 12px;
    text-align: center;
    color: white;
    z-index: 100;
    box-shadow: 0 0 40px rgba(200, 50, 50, 0.4), inset 0 0 30px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    max-width: 500px;
    width: 90%;
}

#game-over-title {
    color: #e74c3c;
    font-size: 44px;
    font-weight: 900;
    margin-bottom: 15px;
    text-shadow: 0 0 20px rgba(231, 76, 60, 0.6);
    letter-spacing: 8px;
}

#game-over-container p {
    font-size: 20px;
    margin-bottom: 12px;
    color: #ddd;
}

#final-score {
    color: #f1c40f;
    font-weight: 900;
    font-size: 28px;
}

#final-difficulty {
    color: #c8aa6e;
    font-size: 14px !important;
}

/* Nickname Section */
#nickname-section {
    margin: 15px 0;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(200, 170, 110, 0.2);
}

.nickname-label {
    font-size: 15px !important;
    color: #c8aa6e !important;
    margin-bottom: 10px !important;
}

#nickname-input-row {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
}

#nickname-input {
    background: rgba(20, 20, 30, 0.9);
    border: 2px solid #555;
    color: white;
    padding: 10px 15px;
    font-size: 16px;
    font-family: 'Inter', sans-serif;
    border-radius: 6px;
    outline: none;
    width: 180px;
    transition: border-color 0.3s;
}

#nickname-input:focus {
    border-color: #c8aa6e;
    box-shadow: 0 0 10px rgba(200, 170, 110, 0.3);
}

#nickname-input::placeholder {
    color: #666;
}

#save-score-btn {
    background: linear-gradient(180deg, #27ae60 0%, #1e8449 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#save-score-btn:hover {
    background: linear-gradient(180deg, #2ecc71 0%, #27ae60 100%);
    transform: scale(1.05);
}

#save-score-btn:disabled {
    background: #555;
    cursor: not-allowed;
    transform: none;
}

#save-status {
    font-size: 13px !important;
    margin-top: 8px !important;
    margin-bottom: 0 !important;
    min-height: 18px;
}

#restart-btn {
    background: linear-gradient(180deg, #c8aa6e 0%, #a38d26 100%);
    color: #111;
    border: none;
    padding: 13px 45px;
    font-size: 17px;
    font-weight: 900;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
    letter-spacing: 2px;
    margin-top: 10px;
    text-transform: uppercase;
}

#restart-btn:hover {
    background: linear-gradient(180deg, #f1d98a 0%, #c8aa6e 100%);
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(200, 170, 110, 0.4);
}

.secondary-btn {
    background: transparent;
    color: #c8aa6e;
    border: 2px solid #c8aa6e;
    padding: 11px 45px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
    letter-spacing: 2px;
    margin-top: 8px;
    text-transform: uppercase;
    display: block;
    width: 100%;
}

.secondary-btn:hover {
    background: rgba(200, 170, 110, 0.15);
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(200, 170, 110, 0.3);
}

/* Pause Menu */
#pause-menu-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(5, 5, 10, 0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 150;
    backdrop-filter: blur(4px);
}

#pause-menu-content {
    background: rgba(10, 10, 15, 0.95);
    border: 2px solid #c8aa6e;
    padding: 50px 70px;
    border-radius: 12px;
    text-align: center;
    color: white;
    box-shadow: 0 0 40px rgba(200, 170, 110, 0.25), inset 0 0 20px rgba(0, 0, 0, 0.5);
}

#pause-title {
    color: #c8aa6e;
    font-size: 44px;
    font-weight: 900;
    margin-bottom: 15px;
    text-shadow: 0 0 15px rgba(200, 170, 110, 0.5);
    letter-spacing: 6px;
}

.pause-info {
    font-size: 20px;
    color: #ddd;
    margin-bottom: 35px;
}

#pause-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#resume-btn {
    background: linear-gradient(180deg, #c8aa6e 0%, #a38d26 100%);
    color: #111;
    border: none;
    padding: 15px 50px;
    font-size: 18px;
    font-weight: 900;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
    letter-spacing: 2px;
    text-transform: uppercase;
}

#resume-btn:hover {
    background: linear-gradient(180deg, #f1d98a 0%, #c8aa6e 100%);
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(200, 170, 110, 0.4);
}

#main-menu-btn {
    background: transparent;
    color: #c8aa6e;
    border: 2px solid #c8aa6e;
    padding: 13px 50px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
    letter-spacing: 2px;
    text-transform: uppercase;
}

#main-menu-btn:hover {
    background: rgba(200, 170, 110, 0.15);
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(200, 170, 110, 0.3);
}
