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

:root {
    --gold: #f5a623;
    /* warm amber instead of yellow-gold */
    --bronze: #c8623a;
    /* terracotta */
    --dark: #1e1a14;
    /* warm dark instead of cold navy */
    --panel: rgba(20, 16, 10, 0.92);
    --border: #5a3e28;
    /* warm brown */
    --accent: #e05c20;
}

body {
    background: var(--dark);
    color: #f0e6d0;
    /* warmer cream */
    font-family: 'Nunito', sans-serif;
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

#title-screen {
    position: fixed;
    inset: 0;
    z-index: 100;
    /* Kitchen tile wall instead of space gradient */
    background-color: #2e261e;
    background-image:
        repeating-linear-gradient(180deg, transparent 0px, transparent 61px, rgba(0, 0, 0, 0.32) 61px, rgba(0, 0, 0, 0.32) 63px),
        repeating-linear-gradient(90deg, transparent 0px, transparent 61px, rgba(0, 0, 0, 0.32) 61px, rgba(0, 0, 0, 0.32) 63px),
        radial-gradient(ellipse at 55% 30%, #4a3a28 0%, #2a2018 70%);
    background-size: 63px 63px, 63px 63px, 100% 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    transition: opacity 0.8s ease;
}

#title-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.title-logo {
    font-family: 'Fredoka One', cursive;
    font-size: clamp(28px, 5vw, 56px);
    color: var(--gold);
    text-shadow:
        0 0 20px rgba(245, 166, 35, 0.5),
        0 3px 0 #8b3e10,
        0 6px 0 rgba(0, 0, 0, 0.4);
    letter-spacing: 2px;
    text-align: center;
}

.subtitle {
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    color: #b8a080;
    letter-spacing: 4px;
    text-transform: uppercase;
}

.pan-icon {
    font-size: 80px;
    filter: drop-shadow(0 0 20px rgba(245, 166, 35, 0.5));
    animation: float 2.5s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0) rotate(-5deg);
    }

    50% {
        transform: translateY(-12px) rotate(5deg);
    }
}

.name-input {
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid var(--gold);
    border-radius: 8px;
    color: #f0e6d0;
    font-family: 'Nunito', sans-serif;
    font-size: 18px;
    padding: 12px 24px;
    text-align: center;
    outline: none;
    width: 280px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.name-input:focus {
    border-color: #fff;
    box-shadow: 0 0 16px rgba(245, 166, 35, 0.3);
}

.name-input::placeholder {
    color: #806050;
}

.play-btn {
    background: linear-gradient(160deg, #d06030, #e8803a, #c04820);
    border: none;
    border-radius: 10px;
    color: #fff5e8;
    cursor: pointer;
    font-family: 'Fredoka One', cursive;
    font-size: 18px;
    font-weight: 400;
    padding: 14px 48px;
    letter-spacing: 1px;
    box-shadow: 0 4px 0 #7a2808, 0 6px 20px rgba(200, 80, 30, 0.45);
    transition: transform 0.1s, box-shadow 0.1s;
}

.play-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #7a2808, 0 10px 28px rgba(200, 80, 30, 0.55);
}

.play-btn:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #7a2808, 0 3px 10px rgba(200, 80, 30, 0.3);
}

.controls-hint {
    font-size: 12px;
    color: #806858;
    text-align: center;
    line-height: 1.8;
}

/* HUD */
#hud {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(to bottom, rgba(20, 14, 8, 0.75), transparent);
    pointer-events: none;
}

.hud-title {
    font-family: 'Fredoka One', cursive;
    font-size: 18px;
    color: var(--gold);
    text-shadow: 0 0 10px rgba(245, 166, 35, 0.4);
}

#player-count {
    font-size: 13px;
    color: #c8a878;
    background: rgba(0, 0, 0, 0.5);
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid #5a3e28;
}

.log-entry {
    margin: 2px 0;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(8px);
    }

    to {
        opacity: 1;
    }
}

#canvas-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

canvas {
    display: block;
    image-rendering: pixelated;
}

/* Mobile controls */
#mobile-controls {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 20px;
    background: linear-gradient(to top, rgba(15, 10, 5, 0.85), transparent);
    justify-content: space-between;
    align-items: center;
    z-index: 60;
}

@media (max-width: 768px) {
    #mobile-controls {
        display: flex;
    }
}

.dpad {
    display: flex;
    gap: 8px;
}

.ctrl-btn {
    width: 56px;
    height: 56px;
    background: rgba(200, 100, 40, 0.15);
    border: 2px solid rgba(200, 100, 40, 0.45);
    border-radius: 10px;
    color: var(--gold);
    font-size: 22px;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.1s;
}

.ctrl-btn:active {
    background: rgba(200, 100, 40, 0.40);
}

.audio-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 20px;
    pointer-events: auto;
}

.mute-btn {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #c8a878;
    color: white;
    border-radius: 5px;
    padding: 5px 10px;
    font-size: 16px;
    cursor: pointer;
    transition: 0.2s;
}

.mute-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

#volume-slider {
    width: 80px;
    cursor: pointer;
    accent-color: #f0e6d0;
}

#volume-slider::-webkit-slider-thumb,
#sfx-slider::-webkit-slider-thumb {
    background: #f0e6d0;
    border-radius: 50%;
}

#volume-slider,
#sfx-slider {
    width: 80px;
    cursor: pointer;
    accent-color: #f5a623;
}