* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    touch-action: none; /* Prevent default touch behaviors */
}
#game-container {
    position: relative;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    overflow: hidden;
    max-width: 100vw;
    max-height: 100vh;
}
#game-canvas {
    display: block;
    touch-action: none;
}

/* Responsive canvas for mobile */
@media (max-width: 1024px) {
    body {
        align-items: flex-start;
        padding: 0;
    }
    #game-container {
        border-radius: 0;
    }
    #game-canvas {
        display: block;
    }
}
#hud {
    position: absolute;
    top: 0; left: 0; right: 0;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(180deg, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 100%);
    pointer-events: none;
}
.hud-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    font-weight: bold;
    font-size: 18px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}
.hud-icon {
    width: 28px; height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}
.cash-icon { background: linear-gradient(135deg, #f1c40f, #f39c12); }
.timer-icon { background: linear-gradient(135deg, #3498db, #2980b9); }
.avatar-icon { background: linear-gradient(135deg, #9b59b6, #8e44ad); }
.avatar-btn { cursor: pointer; transition: transform 0.1s; pointer-events: auto; }
.avatar-btn:hover { transform: scale(1.1); }
.avatar-btn:active { transform: scale(0.95); }
.star-icon { background: linear-gradient(135deg, #e74c3c, #c0392b); }

/* Avatar Selection Panel */
#avatar-panel {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
#avatar-panel.hidden { display: none; }
#avatar-panel-content {
    background: linear-gradient(135deg, #2c3e50, #1a252f);
    border-radius: 15px;
    padding: 20px;
    border: 3px solid #3498db;
    box-shadow: 0 0 30px rgba(52, 152, 219, 0.5);
}
#avatar-panel-header {
    color: white;
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}
#avatar-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    max-width: 400px;
}
.avatar-option {
    width: 80px;
    height: 80px;
    border-radius: 10px;
    background: rgba(255,255,255,0.1);
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.avatar-option:hover {
    background: rgba(255,255,255,0.2);
    border-color: #3498db;
    transform: scale(1.05);
}
.avatar-option.selected {
    border-color: #2ecc71;
    background: rgba(46, 204, 113, 0.3);
}
.avatar-option img {
    width: 60px;
    height: 60px;
    object-fit: contain;
}
.avatar-option-label {
    color: white;
    font-size: 11px;
    margin-top: 2px;
}
#avatar-panel-close {
    color: #7f8c8d;
    font-size: 12px;
    text-align: center;
    margin-top: 15px;
}
#upgrade-toggle {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 20px;
    background: linear-gradient(135deg, #8e44ad, #6c3483);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    color: white;
    font-weight: bold;
    font-size: 11px;
    cursor: pointer;
    z-index: 60;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease-in-out;
}
#upgrade-toggle:active {
    transform: translateX(-50%) scale(0.95);
}
#upgrade-toggle.hidden {
    display: none;
}
#upgrade-toggle.panel-open {
    bottom: 120px;
}

#upgrade-panel {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 8px;
    background: linear-gradient(0deg, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding-bottom: 10px;
    padding-top: 30px;
    transition: transform 0.3s ease-in-out;
    z-index: 55;
}
#upgrade-panel.collapsed {
    transform: translateY(100%);
}
.upgrade-row {
    display: flex;
    gap: 8px;
    justify-content: center;
}
.upgrade-btn {
    padding: 6px 10px;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}
.upgrade-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.upgrade-btn:disabled { opacity: 0.9; cursor: not-allowed; }
.upgrade-btn.locked { opacity: 0.8; background: #555 !important; }
.upgrade-btn.table { background: linear-gradient(135deg, #9b59b6, #8e44ad); }
.upgrade-btn.grill { background: linear-gradient(135deg, #e74c3c, #c0392b); }
.upgrade-btn.host { background: linear-gradient(135deg, #3498db, #2980b9); }
.upgrade-btn.cook { background: linear-gradient(135deg, #e67e22, #d35400); }
.upgrade-btn.speed { background: linear-gradient(135deg, #2ecc71, #27ae60); }
.upgrade-btn.runner { background: linear-gradient(135deg, #1abc9c, #16a085); }
.upgrade-btn.expansion { background: linear-gradient(135deg, #8e44ad, #6c3483); }
.upgrade-btn.kitchen { background: linear-gradient(135deg, #c0392b, #922b21); }
.upgrade-btn.quality { background: linear-gradient(135deg, #f39c12, #d68910); }
.upgrade-btn.oven { background: linear-gradient(135deg, #e74c3c, #b03a2e); }
.upgrade-btn.fryer { background: linear-gradient(135deg, #f1c40f, #d4ac0d); }
#milestone-notification {
    position: absolute;
    top: 100px; left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
    padding: 15px 30px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    pointer-events: none;
    display: none;
    animation: pulse 0.5s ease-in-out;
    z-index: 100;
}
@keyframes pulse {
    0%, 100% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.1); }
}
#style-indicator {
    background: rgba(0,0,0,0.5);
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 12px;
}
#style-display.quick-serve { color: #f1c40f; }
#style-display.high-volume { color: #3498db; }
#style-display.fine-dining { color: #e74c3c; }
#instructions {
    position: absolute;
    top: 55px; left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.9);
    color: #f1c40f;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: bold;
    pointer-events: none;
    border: 2px solid #f1c40f;
    text-align: center;
    max-width: 90%;
}
#controls-hint {
    position: absolute;
    bottom: 110px; left: 20px;
    background: rgba(0,0,0,0.8);
    color: #ecf0f1;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 11px;
    pointer-events: none;
    line-height: 1.6;
}
.key {
    display: inline-block;
    background: #34495e;
    padding: 2px 6px;
    border-radius: 4px;
    margin: 0 2px;
    font-family: monospace;
}

/* Mobile Touch Controls */
#mobile-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    top: 0;
    pointer-events: none;
    z-index: 50;
}
#mobile-controls.hidden {
    display: none;
}

/* Virtual Joystick */
#joystick-container {
    position: absolute;
    bottom: 120px;
    left: 30px;
    width: 120px;
    height: 120px;
    pointer-events: auto;
}
#joystick-base {
    position: absolute;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 3px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
}
#joystick-stick {
    position: absolute;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3498db, #2980b9);
    border: 3px solid rgba(255, 255, 255, 0.5);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: background 0.1s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
#joystick-stick.active {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
}

/* Action Button */
#action-button {
    position: absolute;
    bottom: 140px;
    right: 30px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    border: 4px solid rgba(255, 255, 255, 0.5);
    color: white;
    font-weight: bold;
    font-size: 12px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    transition: all 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
}
#action-button:active {
    transform: scale(0.9);
    background: linear-gradient(135deg, #27ae60, #229954);
}
#action-button span {
    pointer-events: none;
}

/* Donation Button */
#donation-btn {
    position: absolute;
    bottom: 10px;
    left: 10px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    color: white;
    font-weight: bold;
    font-size: 11px;
    cursor: pointer;
    z-index: 60;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transition: all 0.2s;
}
#donation-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(231, 76, 60, 0.4);
}
#donation-btn:active {
    transform: scale(0.95);
}

/* Multiplier Container */
#multiplier-container {
    position: absolute;
    bottom: 10px;
    left: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 60;
}

#multiplier-label {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    color: white;
    font-weight: bold;
    font-size: 8px;
    padding: 2px 8px;
    border-radius: 8px;
    margin-bottom: 3px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Multiplier Button */
#multiplier-btn {
    padding: 8px 16px;
    background: linear-gradient(135deg, #f39c12, #e67e22);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    color: white;
    font-weight: bold;
    font-size: 11px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transition: all 0.2s;
    min-width: 60px;
}
#multiplier-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(243, 156, 18, 0.4);
}
#multiplier-btn:active {
    transform: scale(0.95);
}

/* Donation Modal */
#donation-modal {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
#donation-modal.hidden {
    display: none;
}
#donation-content {
    background: linear-gradient(135deg, #2c3e50, #1a252f);
    border-radius: 15px;
    padding: 30px;
    border: 3px solid #e74c3c;
    box-shadow: 0 0 30px rgba(231, 76, 60, 0.5);
    max-width: 400px;
    text-align: center;
}
#donation-header {
    color: white;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}
#donation-message {
    color: #ecf0f1;
    font-size: 18px;
    margin-bottom: 20px;
}
#donation-amounts {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
}
.donation-amount-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    color: white;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}
.donation-amount-btn:hover {
    background: linear-gradient(135deg, #c0392b, #a93226);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-2px);
}
.donation-amount-btn.selected {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    border-color: #fff;
}
#custom-amount {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 2px solid #34495e;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 16px;
    text-align: center;
}
#custom-amount::placeholder {
    color: rgba(255, 255, 255, 0.5);
}
#apple-pay-btn {
    width: 100%;
    padding: 12px;
    margin-bottom: 10px;
    background: black;
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}
#apple-pay-btn.hidden {
    display: none;
}
#apple-pay-btn:hover {
    background: #1a1a1a;
    transform: translateY(-2px);
}
.apple-pay-logo {
    display: inline-block;
    width: 40px;
    height: 20px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 20"><path fill="white" d="M8.5 3c.4 0 .9.2 1.2.6.3.4.5 1 .4 1.6-.5 0-1-.3-1.3-.6C8.5 4.2 8.3 3.6 8.5 3zm1.2 1.9c.7 0 1.3.4 1.6.4.3 0 .8-.4 1.4-.4 1.2 0 2.2.7 2.2 2 0 1.2-.9 2.4-2 2.4-.5 0-.9-.3-1.3-.3s-.8.3-1.3.3c-1 0-2.2-1.3-2.2-2.4 0-1.3 1-2 2.2-2h-.6z"/><text x="16" y="14" font-family="sans-serif" font-size="10" fill="white" font-weight="500">Pay</text></svg>');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}
#donation-submit {
    width: 100%;
    padding: 12px;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}
#donation-submit:hover {
    background: linear-gradient(135deg, #27ae60, #229954);
    transform: translateY(-2px);
}
#donation-close {
    width: 100%;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}
#donation-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Buy Multiplier Modal */
#buy-multiplier-modal {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
#buy-multiplier-modal.hidden {
    display: none;
}
#buy-multiplier-content {
    background: linear-gradient(135deg, #2c3e50, #1a252f);
    border-radius: 15px;
    padding: 30px;
    border: 3px solid #f39c12;
    box-shadow: 0 0 30px rgba(243, 156, 18, 0.5);
    max-width: 500px;
    text-align: center;
}
#buy-multiplier-header {
    color: white;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}
#buy-multiplier-message {
    color: #ecf0f1;
    font-size: 16px;
    margin-bottom: 20px;
}
#multiplier-packages {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}
.multiplier-package-btn {
    padding: 20px 15px;
    background: linear-gradient(135deg, #f39c12, #e67e22);
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}
.multiplier-package-btn:hover {
    background: linear-gradient(135deg, #e67e22, #d35400);
    border-color: rgba(255, 255, 255, 0.8);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(243, 156, 18, 0.4);
}
.package-title {
    font-size: 18px;
    margin-bottom: 8px;
}
.package-price {
    font-size: 22px;
    color: #2ecc71;
}
.package-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #e74c3c;
    color: white;
    padding: 3px 8px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: bold;
}
#buy-multiplier-close {
    width: 100%;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}
#buy-multiplier-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Hide keyboard controls on mobile */
@media (max-width: 1024px) {
    #controls-hint {
        display: none;
    }
    #instructions {
        font-size: 11px;
        padding: 6px 12px;
        max-width: 70%;
        top: 10px;
    }
    /* Make HUD more compact on mobile */
    #hud {
        padding: 8px 10px;
    }
    .hud-item {
        font-size: 14px;
        gap: 5px;
    }
    .hud-icon {
        width: 24px;
        height: 24px;
        font-size: 14px;
    }
    /* Show toggle button and make upgrade panel collapsible on mobile */
    #upgrade-toggle {
        display: block;
    }
    #upgrade-panel {
        padding: 5px;
        padding-bottom: 5px;
        padding-top: 20px;
    }
    #upgrade-panel.collapsed {
        transform: translateY(100%);
    }
    .upgrade-row {
        gap: 5px;
    }
    .upgrade-btn {
        padding: 8px 8px;
        font-size: 9px;
        min-height: 32px;
    }
    /* Adjust donation and multiplier buttons on mobile */
    #donation-btn {
        font-size: 10px;
        padding: 6px 12px;
        bottom: 8px;
        left: 8px;
    }
    #multiplier-container {
        left: 100px;
        bottom: 8px;
    }
    #multiplier-label {
        font-size: 7px;
        padding: 2px 6px;
    }
    #multiplier-btn {
        font-size: 9px;
        padding: 6px 10px;
        min-width: 50px;
    }
    #donation-content {
        padding: 20px;
        margin: 10px;
    }
    #donation-header {
        font-size: 20px;
    }
    #donation-message {
        font-size: 16px;
    }
    #buy-multiplier-content {
        padding: 20px;
        margin: 10px;
        max-width: 90%;
    }
    #buy-multiplier-header {
        font-size: 20px;
    }
    #buy-multiplier-message {
        font-size: 14px;
    }
    #multiplier-packages {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .multiplier-package-btn {
        padding: 15px 10px;
    }
    .package-title {
        font-size: 16px;
    }
    .package-price {
        font-size: 18px;
    }
}