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

body {
    margin: 0;
    background: radial-gradient(circle at top, #1f2933, #05070a 60%, #020308 100%);
    color: white;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    gap: 1rem;
}

main {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

#playSpace {
    position: relative;
    width: 500px;
    height: 500px;
    border: 6px solid #1ff2ff;
    box-shadow: 0 0 0 2px #021017 inset;
    background-color: #05070a;
    background-image:
        linear-gradient(135deg, rgba(0, 255, 204, 0.08), rgba(255, 0, 153, 0.08)),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(180deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size:
        100% 100%,
        50px 50px,
        50px 50px;
    background-position: center center;
}

#hero {
    position: absolute;
    background-image: url("assets/images/snake-head.svg");
    background-size: 110% 110%;
    background-position: center;
    background-repeat: no-repeat;
}

.bomb {
    position: absolute;
    width: 50px;
    height: 50px;
    background-image: url("assets/svg/bomb.svg");
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    display: none;
}

#fruit {
    position: absolute;
    width: 50px;
    height: 50px;
    background-image: url("assets/images/apple.svg");
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}

.snake-body {
    position: absolute;
    background-image: url("assets/images/tile.svg");
    background-size: 110% 110%;
    background-position: center;
    background-repeat: no-repeat;
}

.snake-tail {
    position: absolute;
    background-image: url("assets/images/tail.svg");
    background-size: 110% 110%;
    background-position: center;
    background-repeat: no-repeat;
}

p {
    font-size: 0.95rem;
    color: #ddd;
}

#audioStart {
    display: none;
}

#hintText {
    opacity: 0.8;
}

#controlBar {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.control-btn {
    border: none;
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    background: #111827;
    color: #e5e7eb;
    font-size: 0.8rem;
    cursor: pointer;
    border: 1px solid #4b5563;
    transition: background 0.15s ease, transform 0.1s ease, opacity 0.1s ease;
}

.control-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.control-btn:not(:disabled):hover {
    background: #1f2937;
    transform: translateY(-1px);
}

.control-btn.selected {
    box-shadow: 0 0 0 2px #f97316, 0 10px 25px rgba(249, 115, 22, 0.4);
}

.overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top, rgba(15, 23, 42, 0.96), rgba(3, 7, 18, 0.98));
    z-index: 10;
}

.overlay-visible {
    display: flex;
}

.overlay-card {
    max-width: 420px;
    padding: 1.75rem 2rem;
    border-radius: 18px;
    background: radial-gradient(circle at top left, #111827, #020617 70%);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(148, 163, 184, 0.25);
    text-align: center;
}

.overlay-card h2 {
    font-size: 1.6rem;
    margin-bottom: 0.75rem;
}

.overlay-card p {
    margin-bottom: 0.5rem;
}

.overlay-hint {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: #9ca3af;
}

.overlay-hint span {
    font-weight: 600;
    color: #f97316;
}

.hidden {
    display: none;
}

.level-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0.75rem 0 0.5rem;
}

.level-btn {
    border: none;
    padding: 0.55rem 0.9rem;
    border-radius: 999px;
    background: linear-gradient(90deg, #0ea5e9, #6366f1);
    color: white;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.1s ease;
}

.level-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.35);
}

.level-btn:active {
    transform: translateY(0);
    filter: brightness(0.95);
}

.level-btn.selected {
    filter: brightness(1.05);
}

.level-btn.level-1.selected {
    box-shadow: 0 0 0 2px #22c55e, 0 12px 30px rgba(34, 197, 94, 0.45);
}

.level-btn.level-2.selected {
    box-shadow: 0 0 0 2px #eab308, 0 12px 30px rgba(234, 179, 8, 0.45);
}

.level-btn.level-3.selected {
    box-shadow: 0 0 0 2px #ef4444, 0 12px 30px rgba(239, 68, 68, 0.45);
}

#countdownOverlay {
    background: radial-gradient(circle at center, rgba(15, 23, 42, 0.9), rgba(3, 7, 18, 0.98));
}

#countdownNumber {
    font-size: 4rem;
    font-weight: 800;
    letter-spacing: 0.1em;
}