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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
    overflow: hidden;
    height: 100vh;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
}

#game-canvas {
    display: block;
    background: #fafafa;
}

#ui {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
}

#instructions {
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    color: #333;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#instructions kbd {
    background: #e0e0e0;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 12px;
}

#controls {
    display: flex;
    gap: 10px;
    pointer-events: auto;
}

#controls button {
    background: #fff;
    border: 1px solid #ddd;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

#controls button:hover {
    background: #f0f0f0;
    border-color: #ccc;
}

#controls button:active {
    background: #e0e0e0;
}

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

.modal.hidden {
    display: none;
}

.modal-content {
    background: #fff;
    padding: 30px 40px;
    border-radius: 12px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-content h2 {
    color: #4CAF50;
    margin-bottom: 20px;
    font-size: 28px;
}

.modal-content h3 {
    color: #333;
    margin: 20px 0 15px;
    font-size: 20px;
}

#finish-stats {
    font-size: 18px;
    color: #333;
    margin-bottom: 25px;
    line-height: 1.8;
}

#finish-stats .score {
    font-size: 32px;
    font-weight: bold;
    color: #FFD700;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

#finish-stats .item-counts {
    font-size: 14px;
    color: #666;
}

.name-input-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.name-input-section label {
    font-size: 14px;
    color: #666;
}

.name-input-section input {
    padding: 12px 16px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    text-align: center;
    outline: none;
    transition: border-color 0.2s;
}

.name-input-section input:focus {
    border-color: #4CAF50;
}

.modal-content button {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 10px;
}

.modal-content button:hover {
    background: #45a049;
}

#scoreboard-section {
    margin-top: 20px;
}

#scoreboard-list {
    text-align: left;
    padding-left: 30px;
    margin: 15px 0;
    max-height: 250px;
    overflow-y: auto;
}

#scoreboard-list li {
    padding: 8px 0;
    font-size: 14px;
    border-bottom: 1px solid #eee;
}

#scoreboard-list li.current-player {
    background: #fff3cd;
    margin: 0 -10px;
    padding: 8px 10px;
    border-radius: 4px;
    font-weight: bold;
}

#scoreboard-list li .rank {
    display: inline-block;
    width: 30px;
    color: #999;
}

#scoreboard-list li .name {
    display: inline-block;
    width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

#scoreboard-list li .score {
    float: right;
    color: #FFD700;
    font-weight: bold;
}

/* ============================================
   MAIN MENU STYLES
   ============================================ */

.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #87CEEB 0%, #e3f2fd 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease;
}

.menu-overlay.hidden {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.menu-container {
    text-align: center;
    padding: 40px 60px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    max-width: 400px;
    width: 90%;
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(30px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

.menu-title h1 {
    font-size: 42px;
    color: #333;
    margin-bottom: 8px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.menu-subtitle {
    font-size: 14px;
    color: #888;
    margin-bottom: 30px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 30px;
}

.menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    border: 2px solid #ddd;
    border-radius: 12px;
    background: #fff;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
}

.menu-btn:hover {
    border-color: #4CAF50;
    background: #f8fff8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.2);
}

.menu-btn.primary {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border: none;
    font-size: 18px;
    padding: 16px 32px;
}

.menu-btn.primary:hover {
    background: linear-gradient(135deg, #45a049 0%, #3d8b40 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.btn-icon {
    font-size: 18px;
}

.menu-footer {
    color: #888;
    font-size: 13px;
}

/* How to Play Modal */
.instructions-content {
    text-align: left;
    margin: 20px 0;
}

.instruction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

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

.instruction-item kbd {
    background: #e0e0e0;
    padding: 4px 10px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 13px;
    margin-right: 5px;
}

.instruction-item span {
    color: #666;
    font-size: 14px;
}

.collectibles-info {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin: 15px 0 25px;
}

.collectible-item {
    background: #f5f5f5;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    color: #555;
}

/* Settings Modal */
.settings-list {
    margin: 25px 0;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
}

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

.setting-item label {
    font-size: 15px;
    color: #333;
}

.setting-item input[type="checkbox"] {
    width: 22px;
    height: 22px;
    cursor: pointer;
    accent-color: #4CAF50;
}

/* Pause button */
#pause-btn {
    position: fixed;
    top: 15px;
    right: 15px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    font-size: 20px;
    cursor: pointer;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s;
}

#pause-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
