* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: #1a1a1a;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    user-select: none;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    max-width: 960px;
    max-height: 700px;
    overflow: hidden;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

/* UI Overlay */
#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

#ui-overlay > * {
    pointer-events: auto;
}

/* Top Bar */
#top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: linear-gradient(180deg, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 100%);
    color: white;
    font-size: 14px;
    z-index: 10;
}

#money-display {
    display: flex;
    align-items: center;
    gap: 6px;
}

#money-display .label {
    opacity: 0.8;
    font-size: 12px;
}

#money-value {
    font-weight: bold;
    font-size: 18px;
    color: #ffd700;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

#stats-display {
    display: flex;
    gap: 12px;
    font-size: 13px;
}

#streak-count {
    color: #ff6b6b;
    font-weight: bold;
}

/* Speech Bubble */
#speech-bubble {
    position: absolute;
    top: 55px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 16px;
    padding: 10px 18px;
    max-width: 400px;
    min-width: 200px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    z-index: 20;
    transition: all 0.3s ease;
}

#speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 10px 10px 0;
    border-style: solid;
    border-color: white transparent transparent transparent;
}

#speech-bubble.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(-10px);
}

#customer-name {
    font-weight: bold;
    color: #e74c3c;
    font-size: 14px;
    margin-bottom: 4px;
}

#customer-order {
    font-size: 15px;
    color: #2c3e50;
    line-height: 1.4;
}

#patience-bar-container {
    margin-top: 8px;
    height: 6px;
    background: #ecf0f1;
    border-radius: 3px;
    overflow: hidden;
}

#patience-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #e74c3c, #f39c12, #2ecc71);
    border-radius: 3px;
    transition: width 0.3s linear;
}

/* Tray Display */
#tray-display {
    position: absolute;
    right: 8px;
    top: 55px;
    background: rgba(0, 0, 0, 0.75);
    border-radius: 12px;
    padding: 8px 12px;
    color: white;
    z-index: 15;
    min-width: 120px;
    backdrop-filter: blur(5px);
}

#tray-display.hidden {
    opacity: 0;
    pointer-events: none;
}

.tray-title {
    font-size: 11px;
    opacity: 0.7;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#tray-items {
    font-size: 13px;
    line-height: 1.6;
}

.tray-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Action Bar */
#action-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 10px 12px;
    background: linear-gradient(0deg, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.4) 70%, rgba(0,0,0,0) 100%);
    z-index: 10;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 12px;
    background: rgba(255,255,255,0.15);
    color: white;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    backdrop-filter: blur(5px);
}

.action-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-2px);
}

.action-btn:active {
    transform: translateY(1px);
    background: rgba(255,255,255,0.4);
}

.action-btn.active {
    border-color: #ffd700;
    background: rgba(255, 215, 0, 0.3);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
}

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

.btn-label {
    font-size: 11px;
    font-weight: 600;
}

.serve-btn {
    border-color: rgba(46, 204, 113, 0.6);
    background: rgba(46, 204, 113, 0.25);
}

.serve-btn:hover {
    background: rgba(46, 204, 113, 0.4);
    border-color: #2ecc71;
}

.reset-btn {
    border-color: rgba(231, 76, 60, 0.6);
    background: rgba(231, 76, 60, 0.2);
}

.reset-btn:hover {
    background: rgba(231, 76, 60, 0.35);
    border-color: #e74c3c;
}

/* Feedback Popup */
#feedback-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    background: rgba(0, 0, 0, 0.85);
    border-radius: 20px;
    padding: 20px 30px;
    color: white;
    text-align: center;
    z-index: 30;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(10px);
}

#feedback-popup.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0.5);
}

#feedback-popup.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

#feedback-text {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 8px;
}

#feedback-money {
    font-size: 20px;
    color: #ffd700;
    font-weight: bold;
}

/* Start Screen */
#start-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #1a0a00 0%, #2d1810 40%, #1a0a00 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    transition: opacity 0.5s ease;
}

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

.start-content {
    text-align: center;
    color: white;
    padding: 30px;
}

.start-content h1 {
    font-size: 42px;
    margin-bottom: 8px;
    text-shadow: 0 3px 10px rgba(255, 100, 0, 0.5);
    color: #ff8c00;
}

.start-content .subtitle {
    font-size: 18px;
    opacity: 0.8;
    margin-bottom: 30px;
    color: #ffa940;
}

.instructions {
    text-align: left;
    background: rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 30px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
    backdrop-filter: blur(5px);
}

.instructions h3 {
    margin-bottom: 10px;
    color: #ffd700;
    font-size: 16px;
}

.instructions ol {
    padding-left: 20px;
    font-size: 14px;
    line-height: 1.8;
    color: rgba(255,255,255,0.9);
}

.start-btn {
    padding: 15px 40px;
    font-size: 20px;
    font-weight: bold;
    border: none;
    border-radius: 30px;
    background: linear-gradient(135deg, #ff6b00, #ff8c00);
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 20px rgba(255, 100, 0, 0.4);
}

.start-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(255, 100, 0, 0.6);
}

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

/* Responsive */
@media (max-width: 600px) {
    #game-container {
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }

    .start-content h1 {
        font-size: 28px;
    }

    .action-btn {
        padding: 6px 10px;
    }

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

    #speech-bubble {
        max-width: 280px;
        padding: 8px 12px;
    }

    #customer-order {
        font-size: 13px;
    }
}
