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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 30px;
    max-width: 900px;
    width: 100%;
}

header {
    text-align: center;
    margin-bottom: 20px;
}

h1 {
    color: #667eea;
    font-size: 2.5em;
    margin-bottom: 15px;
}

.header-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    background: #f5f5f5;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.stage-info, .death-counter, .coin-counter, .timer {
    font-size: 1.1em;
    font-weight: bold;
    text-align: center;
}

.stage-info span:last-child {
    color: #667eea;
}

.stage-name {
    margin-top: 5px;
    font-size: 0.9em;
    color: #666;
    font-weight: normal;
}

.death-counter span:last-child {
    color: #e74c3c;
}

.coin-counter span:last-child {
    color: #f1c40f;
}

.timer span:last-child {
    color: #3498db;
}

.game-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

#gameCanvas {
    border: 3px solid #667eea;
    border-radius: 8px;
    background: #f9f9f9;
    cursor: crosshair;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
}

.overlay.hidden {
    display: none;
}

.message-box {
    background: white;
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    max-width: 400px;
}

.stage-select-box {
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.message-box h2 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 2em;
}

.message-box p {
    margin-bottom: 25px;
    font-size: 1.1em;
    color: #555;
    white-space: pre-line;
}

.btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 1.1em;
    border-radius: 6px;
    cursor: pointer;
    margin: 5px;
    transition: background 0.3s, transform 0.1s;
}

.btn:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

.btn-secondary {
    background: #95a5a6;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.controls {
    background: #f5f5f5;
    padding: 20px;
    border-radius: 8px;
}

.controls h3 {
    color: #667eea;
    margin-bottom: 10px;
}

.controls p {
    margin-bottom: 10px;
    color: #555;
}

.controls ul {
    margin-left: 20px;
    margin-bottom: 15px;
    color: #555;
}

.controls li {
    margin-bottom: 5px;
}

.button-group {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
}

.stage-list {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.stage-btn {
    padding: 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2em;
    font-weight: bold;
    transition: all 0.3s;
    position: relative;
}

.stage-btn:hover {
    background: #5568d3;
    transform: scale(1.1);
}

.stage-btn.locked {
    background: #bdc3c7;
    cursor: not-allowed;
    opacity: 0.6;
}

.stage-btn.locked:hover {
    background: #bdc3c7;
    transform: none;
}

.stage-btn.locked::after {
    content: '🔒';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5em;
}

.stage-btn.completed {
    background: #27ae60;
}

.stage-btn.completed:hover {
    background: #229954;
}

.stage-btn.completed::after {
    content: '✓';
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 1em;
}

@media (max-width: 900px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 2em;
    }

    #gameCanvas {
        max-width: 100%;
        height: auto;
    }

    .stage-list {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 600px) {
    .header-info {
        grid-template-columns: repeat(2, 1fr);
    }

    .stage-list {
        grid-template-columns: repeat(3, 1fr);
    }
}
