body {
    font-family: 'Arial', sans-serif;
    margin: 0;
    background-color: #e67e22;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    box-sizing: border-box;
}

#bartender-game {
    width: 100%;
    max-width: 800px;
    background-color: #e67e22;
    border: 3px solid #000000;
    padding: 15px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    color: #000000;
}
.top-panel, .info-panel, .section {
    border-bottom: 2px solid #000000;
    padding-bottom: 10px;
    margin-bottom: 10px;
}
.sections-container .section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.top-panel {
    display: flex;
    justify-content: space-between;
    align-items: flex-start; /* Align items to the top of the flex container */
    min-height: 150px; /* Approximate height based on image */
}

.left-actions, .right-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 10px;
    align-items: flex-start;
}
.right-actions {
    align-items: flex-end;
}
.ice-button {
    background-image: url('https://play.rosebud.ai/assets/Ice.png?OdwA');
    background-color: transparent;
    border: none;
    width: 60px; /* Match icon-placeholder size */
    height: 60px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    cursor: pointer;
    font-size: 0; /* Hide any lingering text/space */
    padding: 0;
}
.shaker-button {
    background-image: url('https://play.rosebud.ai/assets/Shaker.png?NNFh');
    background-color: transparent;
    border: none;
    width: 100px;
    height: 100px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    cursor: pointer;
    font-size: 0;
    padding: 0;
}
.mixing-glass-button {
    background-image: url('https://play.rosebud.ai/assets/Mixew.png?xH4b');
    background-color: transparent;
    border: none;
    width: 100px;
    height: 100px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    cursor: pointer;
    font-size: 0;
    padding: 0;
}

.center-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px; /* Space between circles and text */
}
/* New styles for horizontal ingredient display */
.ingredient-display {
    width: 100%;
    max-width: 90%;
    min-height: 30px; /* Minimum height for one row */
    height: auto; /* Allow container to grow */
    background-color: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap; /* Allow items to wrap to the next line */
    gap: 5px 8px; /* Vertical and horizontal gap between items */
    padding: 5px 10px; /* Add padding for spacing */
    box-sizing: border-box;
    transition: all 0.3s ease-in-out;
}
.ingredient-display .item {
    display: inline-flex;
    align-items: center;
    justify-content: center; /* Center text horizontally */
    text-align: center; /* Ensure text inside is centered */
    gap: 8px;
    padding: 8px 15px; /* Increased padding for better spacing */
    margin: 0 5px;
    border-radius: 15px;
    background-color: #c49100;
    border: 1px solid #000;
    color: #000;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
    min-height: 30px;
    box-sizing: border-box;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out; /* Add transition for hover effect */
}
.ingredient-display .item:hover {
    transform: scale(1.08); /* Subtle scale-up effect */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2); /* Add a soft glow */
}

.info-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 10px 0 10px; /* Added horizontal padding */
}

.sections-container {
    margin-top: 10px;
}
.section {
    display: grid;
    display: flex; /* Changed to flex for S1 custom layout */
    flex-direction: column; /* Stack header and items vertically */
    align-items: stretch; /* Stretch children to fill width */
    gap: 10px;
    padding: 15px 0;
}

.items { /* Common styling for item containers */
    display: flex;
    gap: 8px;
    align-items: center; /* Vertically align items if they have different heights */
}
.bottom-right-tools {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Section Focus View Layout */
.section-items-content { /* Common class for all item containers */
    display: none; /* Hidden by default */
}
.section.is-focused .section-items-content {
    display: flex; /* Or block, depending on original display type of item container. S1-S3 use flex. */
}
.section-header {
    cursor: pointer;
    transition: background-color 0.2s ease;
    padding: 10px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    gap: 15px; /* Space between S1 ID and Title */
    margin-bottom: 10px; /* Space before items */
}
.section-header:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

/* S1 Speedrail specific styles */
.speedrail-section .section-id, .glassware-section .section-id, .fridge-section .section-id, .backbar-section .section-id, .garnish-section .section-id, .recipe-book-section .section-id, .method-section .section-id {
    font-size: 24px; /* Larger S1 ID */
    font-weight: bold;
}
.speedrail-section .section-title, .glassware-section .section-title, .fridge-section .section-title, .backbar-section .section-title, .garnish-section .section-title, .recipe-book-section .section-title, .method-section .section-title {
    font-size: 28px; /* Larger SPEEDRAIL title */
    font-weight: bold;
    text-align: center; /* Center if flex allows */
    flex-grow: 1;
}

.speedrail-items-container, .glassware-items-container, .fridge-items-container, .backbar-items-container, .garnish-items-container, .method-items-container {
    display: flex;
    flex-direction: column;
    gap: 15px; /* Space between rows */
}

.speedrail-row, .glassware-row, .fridge-row, .backbar-row, .garnish-row, .method-row {
    display: flex;
    justify-content: space-around; /* Distribute items in a row */
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    gap: 10px; /* Space between items in a row */
}
.speedrail-item, .glassware-item, .fridge-item, .backbar-item, .garnish-item, .method-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-width: 50px; /* Ensure items have some base width */
}
.next-drink-desktop {
    display: block; /* Visible by default */
}
.next-drink-mobile {
    display: none; /* Hidden by default on desktop */
}
/* Responsive Styles */
@media (max-width: 768px) {
    body {
        padding: 0;
        overflow-x: hidden; /* Prevent horizontal scrolling */
        align-items: flex-start; /* Align game to the top on mobile */
    }
    .item-number {
        display: none !important; /* Ensure item numbers are hidden on mobile */
    }
    #bartender-game {
        padding: 10px;
        border-left: none;
        border-right: none;
        border-top: none;
        border-bottom: none;
        min-height: 100vh; /* Make container fill the screen height */
        box-sizing: border-box; /* Ensure padding is included in height */
        width: 100vw; /* Ensure it takes full viewport width */
        overflow-x: hidden; /* Prevent internal elements from causing scroll */
    }
    .top-panel {
        position: relative;
        flex-direction: column;
        align-items: center;
        gap: 15px;
        min-height: auto;
        margin-bottom: 15px;
        padding-bottom: 30px; /* Make space for the absolute positioned button */
        border-bottom: none; /* Remove border from top panel on mobile */
    }
    .left-actions {
        flex-wrap: nowrap;
        gap: 10px; /* Increased gap for better spacing */
        align-items: flex-start; /* Align buttons to the left */
        flex-direction: column; /* Stack buttons vertically */
    }
    .left-actions button {
        font-size: 20px; /* Increased font size by ~60% */
        padding: 8px 12px; /* Adjusted padding for better fit */
        font-weight: 800; /* Made font bold */
        width: 100%; /* Make buttons take full width of container */
        text-align: left; /* Align text to the left */
        margin-bottom: 0px; /* Add vertical space between buttons */
    }
    .left-actions, .right-actions {
        flex-direction: row;
        justify-content: center;
        padding-top: 0;
        width: 100%;
}
    .center-display {
        padding-top: 40%;
    }
    .info-panel {
        flex-direction: column; /* Stack children vertically */
        align-items: center; /* Center items */
        gap: 15px;
    }
    .info-panel {
        border-top: 2px solid #000000; /* Add border to the top of info-panel */
        padding-top: 30px; /* Add padding to create space from the line */
    }
    .section-header {
        padding: 8px;
        gap: 10px;
        margin-bottom: 5px;
    }
    .section {
        padding: 5px 0;
        margin-bottom: 0px; /* Remove margin between sections on mobile */
    }
    .info-panel {
        padding-bottom: 0px; /* Remove padding from info panel */
        margin-bottom: 0px; /* Remove margin from info panel */
    }
    
    .speedrail-section .section-title, .glassware-section .section-title, .fridge-section .section-title, .backbar-section .section-title, .garnish-section .section-title, .recipe-book-section .section-title, .method-section .section-title {
        font-size: 22px;
    }
    
    .speedrail-section .section-id, 
    .glassware-section .section-id, 
    .fridge-section .section-id, 
    .backbar-section .section-id, 
    .garnish-section .section-id, 
    .recipe-book-section .section-id, 
    .method-section .section-id {
        display: none;
    }
    .bottom-panel {
        flex-direction: column;
        align-items: center;
    }
    #bartender-game.mobile-fullscreen .right-actions {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    width: 100%;
    gap: 5px;
    margin-top: -30px;
    padding-bottom: 0;
    position: absolute;
    bottom: -130px; /* ← adjust this to control how low it sits */
    left: 47%;
    transform: translateX(-50%);
}


    .right-actions .mixing-glass-button,
    .right-actions .shaker-button {
        transform: scale(1.2); /* Slightly increase icon size for better touch targets */
        transform-origin: center;
        height: 90px; /* Reduce height to make container more compact */
    }
    .next-drink-desktop {
        display: none; /* Hide desktop next button on mobile */
    }
    .next-drink-mobile {
        display: block; /* Show mobile-specific Next button */
        position: static; /* Remove absolute positioning to allow flex alignment */
        background: transparent;
        border: none;
        color: #000;
        font-weight: bold;
        font-size: 0.9 rem;
        padding: 8px 12px;
        text-transform: capitalize;
    }
    .ice-button {
        position: static; /* Remove absolute positioning */
        transform: scale(0.9); /* Match other icons' size */
        transform-origin: center;
    }
    .ingredient-display[data-display-area="top_circle"] {
        margin-top: -50px;px;
        flex-wrap: nowrap; /* Ensure items stay on a single line */
        overflow-x: auto;  /* Allow horizontal scrolling if needed */
        justify-content: flex-start; /* Align items to the start */
        pointer-events: none; /* Make the display non-interactive */
    }
    .ingredient-display[data-display-area="top_circle"] .item {
        padding: 4px 8px;
        font-size: 7px;
        border-radius: 10px;
        min-height: 20px;
    }
    .ingredient-display[data-display-area="top_circle"] .item::before {
        transform: scale(0.5);
        transform-origin: top;
        margin: -10px -5px;
    }
    .ingredient-display[data-display-area="bottom_circle"] .item {
        padding: 4px 8px;
        font-size: 12px;
        border-radius: 10px;
        min-height: 20px;
    }
    .ingredient-display[data-display-area="bottom_circle"] .item::before {
        transform: scale(0.5);
        transform-origin: top;
        margin: -10px -5px;
    }
    .challenge-tracker {
        /* Move tracker higher up on the screen in mobile fullscreen to avoid overlap with controls */
        top: 15px;
        bottom: auto;
        left: 50%;
        transform: translateX(-50%);
    }
}
.backbar-item {
    min-width: calc(25% - 15px); /* Four items per row with gap */
    flex-grow: 1;
}
/* Responsive Styles for larger mobile devices, up to 800px */
@media (min-width: 769px) and (max-width: 800px) {
}
.ingredient-display[data-display-area="top_circle"] .item {
    padding: 4px 8px; /* Reduced padding */
    font-size: 10px;  /* Reduced font size */
    border-radius: 10px; /* Smaller border radius */
    min-height: 20px; /* Reduced min height */
}
.ingredient-display[data-display-area="top_circle"] .item::before {
    transform: scale(0.5); /* Scale down the icon pseudo-element */
    transform-origin: center;
    margin: -10px -5px; /* Adjust margin to compensate for scaling */
}
/* Responsive Styles for larger mobile devices, up to 800px */
@media (min-width: 769px) and (max-width: 800px) {
    .ice-button {
        position: static; /* Revert to default position */
        background: initial;
        border: initial;
        color: initial;
        font-weight: initial;
        font-size: initial;
        padding: initial;
        text-transform: initial;
    }
}
.feedback-popup {
    position: fixed;
    background-color: rgba(24, 26, 27, 0.85);
    padding: 8px 24px;
    border-radius: 50px;
    font-size: 1.5rem;
    font-weight: bold;
    z-index: 1001;
    pointer-events: none;
    font-family: 'Helvetica Neue', sans-serif;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: popup-fade-in-out 2.5s ease-in-out forwards;
}
.feedback-speed {
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
}
.feedback-book {
    top: 70px;
    right: 20px;
    transform: translateX(0);
}
@keyframes popup-fade-in-out {
    0% {
        opacity: 0;
        transform: translateY(-20px) translateX(var(--tx, -50%));
    }
    15%, 85% {
        opacity: 1;
        transform: translateY(0) translateX(var(--tx, -50%));
    }
    100% {
        opacity: 0;
        transform: translateY(-20px) translateX(var(--tx, -50%));
    }
}
/* Set transform variables for animations */
.feedback-speed { --tx: -50%; }
.feedback-book { --tx: 0; }
/* Custom properties for recipe modal styling */
:root {
    --recipe-modal-bg: #E77A2F; /* Orange background to match theme */
    --recipe-modal-text: #000000; /* Black text */
    --recipe-modal-header-text: #000000; /* Black header text */
    --recipe-modal-border: #000000; /* Black border */
    --recipe-modal-item-bg: rgba(255, 255, 255, 0.15); /* Lighter item background */
}
.challenge-tracker {
    position: fixed;
    top: 20px;
    left: 25%;
    transform: translateX(-50%);
    color: #e53935; /* Clean red color */
    font-size: 1.5rem;
    font-weight: bold;
    display: none; /* Hidden by default */
    z-index: 1000;
    font-family: 'Helvetica Neue', sans-serif;
}
#challenge-buttons-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: row-reverse; /* Places Final Exam button on the left */
    gap: 15px;
    z-index: 1000;
    transition: bottom 0.3s ease-in-out;
}
#bartender-game.mobile-fullscreen .mobile-actions-left {
    position: absolute;
    bottom: 40px;
    left: 10px;
    display: flex;
    flex-direction: column;
    gap: 25px;
    font-size: 2.2rem;
}
#bartender-game.mobile-fullscreen .mobile-actions-right {
    position: fixed;
    top: 60px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 30px;
    font-size: 2.8rem;
}
#bartender-game.mobile-fullscreen #floating-recipe-container {
    bottom: 140px;
    left: 20px;
    max-width: calc(100vw - 40px);
    width: auto;
    background-color: transparent;
    padding: 0;
    border-radius: 0;
}
#bartender-game.mobile-fullscreen .progress-bar-info {
    color: #FDFBF5 !important; /* Ensure off-white color in mobile fullscreen mode */
}
.random-mode-button, .full-exam-button {
    padding: 12px 24px;
    border: none;
    border-radius: 30px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: background-color 0.3s, transform 0.3s;
}
.random-mode-button {
    background-color: #ffd700;
    color: #000;
}
.random-mode-button:hover {
    background-color: #ffc107;
    transform: scale(1.05);
}
.full-exam-button {
    background-color: #dc3545;
    color: #fff;
    display: none; /* Hidden by default */
}
.full-exam-button:hover {
    background-color: #c82333;
    transform: scale(1.05);
}
.recipe-book-modal-content {
    background-color: var(--recipe-modal-bg);
    color: var(--recipe-modal-text);
    border: 8px solid #1a1a1a; /* Dark frame */
    border-radius: 10px;
    padding: 1.5rem;
    width: 90%;
    max-width: 700px; /* Adjusted for better content fit */
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7);
    position: relative;
}
.recipe-book-content h2,
.recipe-book-content h3 {
    color: var(--recipe-modal-header-text);
    margin-top: 0;
    font-family: 'Helvetica Neue', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.recipe-book-content h2 {
    font-size: 1.8rem;
    text-align: center;
    margin-bottom: 1rem;
    font-weight: bold;
}
.recipe-book-content h3 {
    font-size: 0.9rem;
    font-weight: bold;
    border-bottom: 2px solid var(--recipe-modal-border);
    padding-bottom: 0.4rem;
    margin-bottom: 0.8rem;
}
.recipe-details-grid {
    display: grid;
    grid-template-columns: 1fr 2fr; /* Adjusted column ratio */
    gap: 1.5rem;
    margin-bottom: 1rem;
}
.recipe-info-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.recipe-info-item p {
    margin: 0;
    font-size: 1rem;
    font-weight: normal;
}
.recipe-ingredients-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 1rem;
}
.recipe-ingredients-list li {
    padding: 0.2rem 0;
}
.recipe-serving-notes p {
    margin: 0;
    font-size: 0.9rem;
    font-style: italic;
    opacity: 0.9;
}
/* iPhone-specific layout adjustments for fullscreen */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    @media (max-width: 768px) {
        #bartender-game {
            /* Use dvh to account for dynamic browser UI on iOS */
            min-height: 100dvh;
            /* Add padding to account for the home indicator */
            padding-bottom: env(safe-area-inset-bottom);
        }
    }
}