/* 
   Boulangerie Blitz - Game Stylesheet
   Design Philosophy: Warm Bakery Palette, Glassmorphism, Micro-interactions, Full-responsive Layout.
*/

:root {
    --bg-dark: #0f0b09;
    --glass-bg: rgba(30, 22, 17, 0.65);
    --glass-bg-hover: rgba(45, 34, 26, 0.75);
    --glass-border: rgba(243, 223, 193, 0.12);
    --glass-border-focus: rgba(245, 166, 35, 0.4);
    --glass-inset: rgba(15, 11, 9, 0.4);
    
    /* Branding Colors */
    --color-wheat: #f3dfc1;
    --color-gold: #f5a623;
    --color-gold-glow: rgba(245, 166, 35, 0.5);
    --color-rust: #d06a4c;
    --color-flour: #fdfefe;
    
    /* Ingredients Theme */
    --color-chocolate: #5c3a21;
    --color-blueberry: #3b508f;
    --color-egg: #fbc02d;
    --color-sugar: #e0f7fa;
    --color-butter: #fff59d;

    /* Semantic Colors */
    --color-success: #66bb6a;
    --color-warning: #ffa726;
    --color-danger: #ef5350;
    
    /* Fonts */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-dark);
    font-family: var(--font-body);
    color: var(--color-wheat);
}

/* App Master Container */
#app-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle, #2d1d16 0%, #0f0b09 100%);
    overflow: hidden;
}

/* Dynamic Glassmorphism System */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.6);
}

.glass-inset {
    background: var(--glass-inset);
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* BUTTONS */
.btn {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    padding: 12px 28px;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-gold) 0%, #d87d15 100%);
    color: #130f0c;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--color-gold-glow);
}

.btn-primary:active {
    transform: translateY(1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--color-wheat);
}

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

.btn-glow {
    animation: pulseGlow 2s infinite alternate;
}

@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 10px rgba(245, 166, 35, 0.3);
    }
    100% {
        box-shadow: 0 0 25px rgba(245, 166, 35, 0.7);
    }
}

.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    font-size: 1.2rem;
    color: var(--color-wheat);
}

/* SCREEN LAYOUTS */
.menu-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
    background: rgba(15, 11, 9, 0.85);
    padding: 20px;
    overflow-y: auto;
}

.menu-screen.active {
    opacity: 1;
    pointer-events: auto;
}

.menu-content {
    width: 100%;
    max-width: 680px;
    padding: 40px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 30px;
    animation: slideUpIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUpIn {
    0% {
        transform: translateY(30px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

/* HEADER */
.game-header {
    margin-bottom: 5px;
}

.logo-emoji {
    font-size: 3rem;
    display: block;
    margin-bottom: 10px;
    filter: drop-shadow(0 0 10px rgba(245, 166, 35, 0.4));
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.game-title {
    font-family: var(--font-heading);
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fff 30%, var(--color-wheat) 70%, var(--color-gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.game-subtitle {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--color-gold);
    font-weight: 600;
}

/* CHARACTER SELECTION */
.character-selection-section h2 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: #fff;
}

.character-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.char-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 15px 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.char-card:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-4px);
}

.char-card.selected {
    background: rgba(245, 166, 35, 0.08);
    border-color: var(--color-gold);
    box-shadow: 0 0 15px rgba(245, 166, 35, 0.25);
}

.char-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    position: relative;
}

.char-card.selected .char-avatar {
    border-color: var(--color-gold);
}

.kevin-color { background: linear-gradient(135deg, #8e2de2 0%, #4a00e0 100%); }
.mauri-color { background: linear-gradient(135deg, #f12711 0%, #f5af19 100%); }
.ian-color { background: linear-gradient(135deg, #3a7bd5 0%, #3a6073 100%); }

.chef-hat-icon {
    font-size: 1.8rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}

.char-name {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 2px;
}

.char-role {
    font-size: 0.75rem;
    color: rgba(243, 223, 193, 0.7);
    margin-bottom: 8px;
}

.char-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: bold;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.08);
    padding: 3px 8px;
    border-radius: 20px;
    letter-spacing: 0.5px;
}

.char-card.selected .char-badge {
    background: rgba(245, 166, 35, 0.2);
    color: var(--color-gold);
}

/* TUTORIAL BOX */
.tutorial-box {
    padding: 15px 20px;
    text-align: left;
}

.tutorial-box h3 {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    margin-bottom: 10px;
    color: var(--color-gold);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.tutorial-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tut-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 0.85rem;
    line-height: 1.4;
    color: rgba(243, 223, 193, 0.85);
}

.tut-icon {
    font-size: 1.1rem;
}

.tut-item code {
    background: rgba(255,255,255,0.08);
    padding: 1px 5px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.1);
    font-family: monospace;
    color: #fff;
}

/* GAMEPLAY SCREEN */
.game-screen {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.game-screen.active {
    opacity: 1;
    pointer-events: auto;
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    outline: none;
}

/* HUD LAYOUT */
#game-hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Let clicks pass through to Canvas */
    z-index: 5;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 15px;
}

.hud-topbar {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    pointer-events: auto; /* Active clicking */
    flex-wrap: nowrap;
}

.hud-element {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 4px 14px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.hud-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: rgba(243, 223, 193, 0.6);
    text-transform: uppercase;
}

.hud-value {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 800;
    color: #fff;
}

.timer-box {
    border-left: 3px solid var(--color-gold);
    min-width: 90px;
}

.timer-warning {
    animation: flashRedBorder 0.8s infinite alternate;
}

@keyframes flashRedBorder {
    0% {
        border-left-color: var(--color-gold);
        box-shadow: 0 0 5px rgba(245, 166, 35, 0.2);
    }
    100% {
        border-left-color: var(--color-danger);
        box-shadow: 0 0 15px rgba(239, 83, 80, 0.6);
    }
}

.timer-warning .hud-value {
    color: var(--color-danger);
    animation: textShake 0.15s infinite alternate;
}

@keyframes textShake {
    0% { transform: scale(1) rotate(-1deg); }
    100% { transform: scale(1.1) rotate(1deg); }
}

.score-box {
    min-width: 90px;
}

.combo-box {
    min-width: 60px;
    text-align: center;
}

.active-chefs-box {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: none;
    padding: 0;
}

.chef-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 6px 12px;
    border-radius: 20px;
    opacity: 0.5;
    transition: all 0.2s ease;
}

.chef-status-pill.selected {
    opacity: 1;
    border-color: var(--color-gold);
    background: rgba(245, 166, 35, 0.1);
    box-shadow: 0 0 10px rgba(245, 166, 35, 0.2);
}

.mini-avatar {
    font-size: 1rem;
}

.mini-name {
    font-size: 0.75rem;
    font-weight: bold;
    color: #fff;
}

#btn-mute {
    margin-left: auto;
    pointer-events: auto;
    font-size: 1rem;
    transition: transform 0.2s ease;
}

#btn-mute:hover {
    transform: scale(1.1);
}

/* ORDERS SIDEBAR (Horizontal scroll of orders under HUD) */
.orders-sidebar {
    width: 100%;
    margin-top: 10px;
    height: 75px;
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    pointer-events: auto;
    scrollbar-width: none; /* Firefox */
}

.orders-sidebar::-webkit-scrollbar {
    display: none; /* Safari & Chrome */
}

#orders-list {
    display: flex;
    gap: 12px;
    padding: 2px 5px;
}

.order-card {
    min-width: 155px;
    height: 70px;
    padding: 6px 10px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    animation: orderSlideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    position: relative;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

@keyframes orderSlideIn {
    0% { transform: scale(0.7) translateY(-20px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.order-name {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 110px;
}

.order-emoji {
    font-size: 0.95rem;
}

.order-body {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 2px 0;
}

.order-ing {
    font-size: 0.75rem;
    background: rgba(255,255,255,0.08);
    padding: 1px 4px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.05);
}

.order-progress-container {
    width: 100%;
    height: 4px;
    background: rgba(255,255,255,0.15);
    border-radius: 2px;
    overflow: hidden;
}

.order-progress-bar {
    height: 100%;
    width: 100%;
    background-color: var(--color-success);
    transition: width 0.1s linear, background-color 0.3s ease;
}

.order-warning .order-progress-bar {
    background-color: var(--color-warning);
}

.order-critical .order-progress-bar {
    background-color: var(--color-danger);
}

.order-critical {
    animation: flashRedBg 0.5s infinite alternate;
}

@keyframes flashRedBg {
    0% { border-color: rgba(239, 83, 80, 0.2); }
    100% { border-color: rgba(239, 83, 80, 0.7); background: rgba(239, 83, 80, 0.15); }
}

/* CHEAT SHEET */
.cheat-sheet-trigger {
    position: absolute;
    bottom: 15px;
    right: 15px;
    padding: 8px 16px;
    font-size: 0.8rem;
    font-weight: bold;
    cursor: pointer;
    z-index: 6;
    pointer-events: auto;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.cheat-sheet-trigger:hover {
    transform: translateY(-2px);
    background-color: var(--glass-bg-hover);
}

.cheat-sheet {
    position: absolute;
    bottom: 50px;
    right: 15px;
    width: 280px;
    padding: 15px;
    display: none;
    z-index: 7;
    pointer-events: auto;
    box-shadow: 0 8px 25px rgba(0,0,0,0.5);
    animation: popUp 0.2s ease forwards;
}

@keyframes popUp {
    0% { transform: scale(0.9) translateY(10px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

.cheat-sheet.active {
    display: block;
}

.cheat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding-bottom: 6px;
}

.cheat-header h4 {
    font-family: var(--font-heading);
    color: var(--color-gold);
    font-size: 0.9rem;
    text-transform: uppercase;
}

.close-btn {
    font-size: 1.2rem;
    cursor: pointer;
    color: rgba(243, 223, 193, 0.5);
    transition: color 0.2s ease;
}

.close-btn:hover {
    color: #fff;
}

.cheat-sheet ul {
    list-style: none;
    font-size: 0.72rem;
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: rgba(243, 223, 193, 0.9);
}

.cheat-sheet ul li {
    line-height: 1.3;
}

/* MOBILE CONTROLS */
#mobile-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 6;
    display: none; /* Toggled in JS/CSS */
}

/* Joystick on Left */
#joystick-container {
    position: absolute;
    bottom: 30px;
    left: 45px;
    width: 110px;
    height: 110px;
    pointer-events: auto;
}

#joystick-ring {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.4);
    border: 3px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

#joystick-stick {
    position: absolute;
    top: 35px;
    left: 35px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: radial-gradient(circle, #f5a623 0%, #b86b10 100%);
    box-shadow: 0 4px 10px rgba(0,0,0,0.6);
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: transform 0.05s ease;
}

/* Action Buttons on Right */
#action-buttons-container {
    position: absolute;
    bottom: 25px;
    right: 45px;
    display: flex;
    gap: 15px;
    align-items: flex-end;
    pointer-events: auto;
}

.mobile-btn {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.25);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 6px 15px rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    transition: transform 0.1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.mobile-btn:active {
    transform: scale(0.85);
}

.btn-grab {
    width: 75px;
    height: 75px;
    background: rgba(102, 187, 106, 0.55);
    border-color: rgba(102, 187, 106, 0.7);
}
.btn-grab:active {
    background: rgba(102, 187, 106, 0.85);
}

.btn-work {
    width: 75px;
    height: 75px;
    background: rgba(245, 166, 35, 0.55);
    border-color: rgba(245, 166, 35, 0.7);
}
.btn-work:active {
    background: rgba(245, 166, 35, 0.85);
}

.btn-switch {
    background: rgba(59, 80, 143, 0.55);
    border-color: rgba(59, 80, 143, 0.7);
    margin-right: 10px;
}
.btn-switch:active {
    background: rgba(59, 80, 143, 0.85);
}

.btn-icon-sub {
    font-size: 1.4rem;
    margin-bottom: 2px;
}

.btn-label-sub {
    font-size: 0.52rem;
    font-weight: 800;
    letter-spacing: 0.5px;
}

/* RESULTS SCREEN STYLING */
.stars-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 10px 0;
}

.star-icon {
    font-size: 3rem;
    color: #4a3e35;
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), color 0.3s ease;
}

.star-icon.gold {
    color: var(--color-gold);
    text-shadow: 0 0 15px rgba(245, 166, 35, 0.8);
    transform: scale(1.15);
}

.star-icon.gold.delayed-1 { transition-delay: 0.2s; }
.star-icon.gold.delayed-2 { transition-delay: 0.4s; }

.results-stats {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.95rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 8px;
}

.stat-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.stat-row strong {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    color: #fff;
}

.text-success { color: var(--color-success) !important; }
.text-danger { color: var(--color-danger) !important; }

.results-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* ROTATE DEVICE MODAL FOR PORTRAIT */
#rotate-device-alert {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    background: #0f0b09;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 30px;
    text-align: center;
}

.rotate-content {
    padding: 30px;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.rotate-phone-icon {
    font-size: 4rem;
    animation: phoneTilt 1.5s infinite alternate ease-in-out;
}

@keyframes phoneTilt {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(-90deg); }
}

.rotate-content h2 {
    font-family: var(--font-heading);
    color: var(--color-gold);
}

.rotate-content p {
    font-size: 0.85rem;
    line-height: 1.4;
    color: rgba(243, 223, 193, 0.8);
}

/* RESPONSIVE MEDIA QUERIES */

/* Switch on Mobile Touch UI */
@media (max-width: 1024px) {
    #mobile-controls {
        display: block; /* Show virtual pads */
    }
    .cheat-sheet-trigger {
        bottom: auto;
        top: 85px;
        right: 15px;
    }
    .cheat-sheet {
        bottom: auto;
        top: 125px;
    }
}

/* Portrait orientation for tablets and mobiles */
@media (max-width: 900px) and (orientation: portrait) {
    #rotate-device-alert {
        display: flex;
    }
}

/* Scale adjustments for small screens (Landscape) */
@media (max-height: 480px) {
    .menu-content {
        padding: 15px 25px;
        gap: 12px;
    }
    .logo-emoji {
        font-size: 1.8rem;
        margin-bottom: 2px;
    }
    .game-title {
        font-size: 1.8rem;
    }
    .character-selection-section h2 {
        font-size: 0.95rem;
        margin-bottom: 5px;
    }
    .char-card {
        padding: 5px 8px;
    }
    .char-avatar {
        width: 35px;
        height: 35px;
        margin-bottom: 4px;
    }
    .chef-hat-icon {
        font-size: 1rem;
    }
    .char-name {
        font-size: 0.8rem;
    }
    .char-role, .char-badge {
        display: none;
    }
    .tutorial-box {
        display: none; /* Hide tutorial inside menu on super narrow viewports */
    }
    .btn {
        padding: 8px 20px;
        font-size: 0.85rem;
    }
    
    /* HUD layout scale */
    .hud-topbar {
        padding: 4px 10px;
        gap: 6px;
    }
    .hud-element {
        padding: 2px 8px;
    }
    .hud-value {
        font-size: 1rem;
    }
    .hud-label {
        font-size: 0.5rem;
    }
    .active-chefs-box {
        display: none; /* Hide active chef names on small landscape */
    }
    
    /* Orders sidebar scale */
    .orders-sidebar {
        height: 60px;
    }
    .order-card {
        min-width: 120px;
        height: 55px;
        padding: 4px 8px;
    }
    .order-name {
        font-size: 0.65rem;
        max-width: 80px;
    }
    .order-emoji {
        font-size: 0.75rem;
    }
    .order-body {
        margin: 1px 0;
    }
    .order-ing {
        font-size: 0.6rem;
    }
    
    /* Mobile joystick / buttons size reduction */
    #joystick-container {
        bottom: 15px;
        left: 20px;
        width: 75px;
        height: 75px;
    }
    #joystick-stick {
        top: 22px;
        left: 22px;
        width: 30px;
        height: 30px;
    }
    #action-buttons-container {
        bottom: 15px;
        right: 20px;
        gap: 8px;
    }
    .mobile-btn {
        width: 48px;
        height: 48px;
    }
    .btn-grab, .btn-work {
        width: 54px;
        height: 54px;
    }
    .btn-icon-sub {
        font-size: 1rem;
    }
    .btn-label-sub {
        font-size: 0.45rem;
    }
    
    /* Cheat sheet position on tiny landscape */
    .cheat-sheet-trigger {
        top: 55px;
        padding: 4px 8px;
        font-size: 0.65rem;
    }
    .cheat-sheet {
        top: 85px;
        width: 240px;
        padding: 8px;
    }
}

/* --- ADDED FOR USER FEEDBACK IMPROVEMENTS --- */

/* Floating labels for stations */
#tooltip-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 4;
    overflow: hidden;
}

.station-floating-label {
    position: absolute;
    transform: translate(-50%, -100%);
    background: rgba(26, 18, 14, 0.75);
    border: 1px solid rgba(243, 223, 193, 0.2);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 7px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    white-space: nowrap;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 10;
    transition: opacity 0.2s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    gap: 3px;
}

/* Action Tooltips (Interactive) */
.action-floating-tooltip {
    position: absolute;
    transform: translate(-50%, -100%) scale(0.9);
    background: rgba(245, 166, 35, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #130f0c;
    font-size: 0.8rem;
    font-weight: 800;
    padding: 5px 10px;
    border-radius: 12px;
    box-shadow: 0 6px 15px rgba(245, 166, 35, 0.4);
    pointer-events: none;
    white-space: nowrap;
    z-index: 12;
    transition: opacity 0.15s ease, transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    animation: tooltipFloat 1.2s infinite alternate ease-in-out;
}

.action-floating-tooltip .tooltip-btn {
    background: #130f0c;
    color: #f5a623;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 900;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.action-floating-tooltip .tooltip-progress {
    font-size: 0.7rem;
    font-weight: bold;
    color: #130f0c;
    opacity: 0.9;
}

@keyframes tooltipFloat {
    0% { transform: translate(-50%, -105%) scale(1); }
    100% { transform: translate(-50%, -95%) scale(1); }
}

/* Warning styling for items that are burning */
.action-floating-tooltip.burning {
    background: var(--color-danger);
    color: #fff;
    box-shadow: 0 0 15px rgba(239, 83, 80, 0.6);
    animation: tooltipPulse 0.5s infinite alternate ease-in-out;
}
.action-floating-tooltip.burning .tooltip-btn {
    background: #fff;
    color: var(--color-danger);
}

@keyframes tooltipPulse {
    0% { transform: translate(-50%, -100%) scale(0.95); }
    100% { transform: translate(-50%, -100%) scale(1.1); }
}

/* Sidebar Instructions Panel */
#controls-sidebar-panel {
    position: absolute;
    left: 15px;
    top: 52%;
    transform: translateY(-50%);
    width: 220px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: auto;
    z-index: 6;
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
    font-size: 0.72rem;
}

#controls-sidebar-panel h3 {
    font-family: var(--font-heading);
    color: var(--color-gold);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding-bottom: 4px;
    margin-bottom: 2px;
}

.panel-section {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.panel-section h4 {
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
}

.panel-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: rgba(243, 223, 193, 0.85);
}

.panel-list li {
    line-height: 1.3;
}

.key-badge {
    background: rgba(255,255,255,0.12);
    padding: 1px 4px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.15);
    font-family: monospace;
    font-weight: bold;
    color: #fff;
    font-size: 0.65rem;
}

/* Hide instructions panel on smaller screens / landscape mobile to prevent clutter */
@media (max-width: 1024px) {
    #controls-sidebar-panel {
        display: none;
    }
}
