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

body {
    font-family: 'Nunito', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #1a1a2e;
    color: #eee;
    min-height: 100vh;
    padding: 10px;
}

/* Heading font for all titles */
h1, h2, h3, h4,
.panel-title, .map-title, .shop-name,
.phase-text, .location-name, .modal h2,
.customer-area-title > span:first-child,
.serving-header > span:first-child,
.wcat-title,
.event-modal h2,
.summary-section h4,
.btn, .stock-tab, .modal-btn,
.event-response-btn {
    font-family: 'Quicksand', 'Nunito', sans-serif;
}

/* ---- Logo / Wordmark ---- */
h1 {
    margin-bottom: 5px;
    text-align: center;
    font-size: 1.6em;
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.logo-leaf {
    display: inline-block;
    font-size: 1.1em;
    animation: leafSway 3s ease-in-out infinite;
    transform-origin: bottom center;
}

@keyframes leafSway {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(6deg); }
    75% { transform: rotate(-4deg); }
}

.logo-rye {
    color: #e8d5a3;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.logo-refill {
    color: #4ecca3;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.subtitle {
    color: #888;
    margin-bottom: 15px;
    text-align: center;
    font-size: 0.85em;
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    letter-spacing: 0.3px;
}

/* Screen management */
.screen {
    display: none;
}
.screen.active {
    display: block;
}

/* Mobile-optimized shop screen */
#shopScreen.screen.active {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for mobile */
}

#shopScreen .game-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    max-width: 500px;
    gap: 8px;
    padding-bottom: 20px;
}

/* Fixed header - always visible */
.shop-header {
    background: #252540;
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
    flex-shrink: 0;
}

.shop-info {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
}

.shop-name {
    font-weight: 700;
    font-size: 0.95em;
    letter-spacing: 0.3px;
}

.shop-name .sn-leaf { font-size: 1em; }
.shop-name .sn-rye { color: #e8d5a3; }
.shop-name .sn-refill { color: #4ecca3; }

.shop-location {
    color: #888;
    font-size: 0.7em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Compact day phase indicator */
.day-phase-indicator {
    background: #252540;
    border-radius: 8px;
    padding: 8px 12px;
    text-align: center;
    flex-shrink: 0;
}

.day-phase-indicator.serving-mode {
    display: none;
}

.phase-text {
    color: #4ecca3;
    font-weight: bold;
    font-size: 0.95em;
}

.phase-subtext {
    color: #888;
    font-size: 0.75em;
    margin-top: 2px;
}

/* Customer area - compact and scrollable */
.customer-area {
    background: #252540;
    border-radius: 8px;
    padding: 10px;
    flex-shrink: 0;
}

.customer-area.serving-mode {
    padding: 8px;
}

.customer-area-title {
    color: #4ecca3;
    font-size: 0.85em;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.customer-count {
    color: #888;
    font-size: 0.8em;
}

.customer-queue {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 5px;
    min-height: 70px;
    align-items: flex-start;
}

.customer-queue-empty {
    color: #555;
    font-style: italic;
    width: 100%;
    text-align: center;
    padding: 15px;
    font-size: 0.85em;
}

/* Compact customer cards */
.customer {
    background: #1a1a2e;
    border-radius: 8px;
    padding: 8px;
    min-width: 100px;
    max-width: 120px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    border: 2px solid transparent;
    flex-shrink: 0;
}

.customer.entering {
    animation: customerSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.customer:hover {
    border-color: #4ecca3;
}

.customer.selected {
    border-color: #4ecca3;
    background: #2a3a4a;
    box-shadow: 0 0 10px rgba(78, 204, 163, 0.5);
}

.customer.impatient {
    border-color: #f0c040;
    background: #2a2418;
    animation: impatientShake 0.4s ease-in-out infinite;
}

.customer.impatient .customer-avatar {
    animation: avatarImpatient 0.6s ease-in-out infinite;
}

.customer.impatient .customer-speech {
    background: #3a2a18;
    border-color: #f0c040;
}

.customer.left {
    animation: customerPoofOut 0.5s ease-in forwards;
    pointer-events: none;
}

.customer.served {
    animation: customerHappyExit 0.5s ease-out forwards;
    pointer-events: none;
}

.customer-avatar {
    font-size: 1.5em;
    text-align: center;
    margin-bottom: 2px;
    transition: transform 0.2s;
}

.customer-speech {
    background: #2a2a44;
    border: 1px solid #3a3a5a;
    border-radius: 8px;
    padding: 4px 6px;
    font-size: 0.7em;
    position: relative;
    margin-top: 6px;
}

.customer-speech::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 5px solid #3a3a5a;
}

.customer-speech::after {
    content: '';
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 4px solid #2a2a44;
}

.customer-wants {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    justify-content: center;
}

.customer-wants span {
    font-size: 1em;
}

.customer-budget {
    color: #4ecca3;
    font-size: 0.75em;
    text-align: center;
    margin-top: 3px;
}

.customer-preference {
    color: #f0c040;
    font-size: 0.65em;
    text-align: center;
    margin-top: 2px;
}

/* Serving controls - compact bar */
.serving-controls {
    background: #2a4a3a;
    border-radius: 8px;
    padding: 10px;
    border: 2px solid #4ecca3;
    flex-shrink: 0;
}

.serving-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}

.serving-header > span:first-child {
    color: #4ecca3;
    font-weight: bold;
    font-size: 0.9em;
}

.basket-info {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8em;
}

.basket-items {
    display: flex;
    gap: 1px;
    font-size: 1.1em;
}

.basket-items .empty-basket {
    color: #666;
    font-size: 0.75em;
    font-style: italic;
}

.basket-total {
    color: #4ecca3;
    font-weight: bold;
}

.serving-hint {
    display: none; /* Hide on mobile to save space */
}

.serving-buttons {
    display: flex;
    gap: 6px;
}

.serving-buttons .btn {
    flex: 1;
    padding: 8px 6px;
    font-size: 0.75em;
}

/* Category tabs - always visible, above shop floor */
.category-tabs-container {
    background: #252540;
    border-radius: 8px;
    padding: 8px;
    flex-shrink: 0;
}

.stock-tabs {
    display: flex;
    gap: 6px;
}

.stock-tab {
    flex: 1;
    padding: 12px 8px;
    background: #1a1a2e;
    border: none;
    color: #888;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.2s;
}

.stock-tab.active {
    background: #4ecca3;
    color: #1a1a2e;
    font-weight: bold;
}

/* Category tabs container - always visible above shop floor */
.category-tabs-container {
    background: #252540;
    border-radius: 8px;
    padding: 8px;
    flex-shrink: 0;
}

/* Stock panel - shows list when shop closed */
.stock-panel {
    background: #252540;
    border-radius: 8px;
    padding: 10px;
    flex-shrink: 0;
}

.stock-panel .panel-title {
    font-size: 0.9em;
    margin-bottom: 8px;
}

.stock-list {
    max-height: 150px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Hide stock list panel when serving - use shop floor instead */
.serving-mode .stock-panel {
    display: none;
}

/* Larger, more tappable stock items */
.stock-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 10px;
    background: #1a1a2e;
    border-radius: 6px;
    margin-bottom: 6px;
    font-size: 0.9em;
    min-height: 48px; /* Minimum tap target size */
}

.stock-item-name {
    flex: 1;
    font-size: 0.95em;
}

.stock-item-qty {
    color: #4ecca3;
    min-width: 45px;
    text-align: right;
    font-size: 0.85em;
}

.stock-item-qty.low { color: #f0c040; }
.stock-item-qty.out { color: #e05050; }

.stock-item .add-btn {
    background: #4ecca3;
    color: #1a1a2e;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.85em;
    font-weight: bold;
    cursor: pointer;
    margin-left: 8px;
    min-width: 60px;
}

.stock-item .add-btn:disabled {
    background: #555;
    cursor: not-allowed;
}

.stock-item.wanted {
    background: #2a4a3a;
    border: 2px solid #4ecca3;
}

.stock-item.fulfilled {
    opacity: 0.5;
}

.stock-item.clickable {
    cursor: pointer;
}

.stock-item.clickable:active {
    background: #2a3a4a;
    transform: scale(0.98);
}

/* Action bar - compact */
.action-bar {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.action-bar .btn {
    flex: 1;
    min-width: 80px;
    margin-top: 0;
    padding: 10px 8px;
    font-size: 0.8em;
}

/* Hide non-essential during serving - but keep shop floor! */
.serving-mode .deliveries-panel,
.serving-mode #viewMapBtn {
    display: none;
}

/* Shop floor - always visible, primary interaction */
.shop-floor-container {
    background: #252540;
    border-radius: 8px;
    padding: 10px;
    flex-shrink: 0;
}

.shop-floor {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(6, 48px);
    gap: 2px;
    background: #5c4a32;
    background-image:
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 12.3%,
            rgba(0,0,0,0.08) 12.3%,
            rgba(0,0,0,0.08) 12.7%
        ),
        repeating-linear-gradient(
            0deg,
            rgba(255,255,255,0.02) 0px,
            rgba(0,0,0,0.03) 2px,
            rgba(255,255,255,0.01) 4px
        );
    padding: 2px;
    border-radius: 8px;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.4);
}

.floor-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    border-radius: 3px;
    background: transparent;
    position: relative;
}

/* Deliveries panel - collapsible */
.deliveries-panel {
    background: #252540;
    border-radius: 8px;
    padding: 10px;
    flex-shrink: 0;
}

.deliveries-panel.hidden {
    display: none;
}

/* View map button */
#viewMapBtn {
    flex-shrink: 0;
}

#viewMapBtn.hidden {
    display: none;
}

.game-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 500px;
    margin: 0 auto;
}

/* ==================== LOCATION SELECTION STYLES ==================== */
.map-container {
    background: #252540;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.map-title {
    text-align: center;
    margin-bottom: 10px;
    color: #4ecca3;
    font-size: 1em;
}

.map-wrapper {
    display: flex;
    justify-content: center;
}

/* Leaflet map containers */
.leaflet-map {
    width: 100%;
    height: 350px;
    border-radius: 8px;
    border: 2px solid #3a3a5a;
    z-index: 1;
}

.leaflet-map-modal {
    height: 300px;
}

.map-hint {
    text-align: center;
    color: #4ecca3;
    font-size: 0.85em;
    margin-top: 10px;
    animation: fadeInOut 3s ease-in-out infinite;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Custom Leaflet marker styles */
.shop-marker {
    background: none !important;
    border: none !important;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.shop-marker-pin {
    cursor: pointer;
    line-height: 1;
    text-align: center;
}

.shop-marker-pulse {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    opacity: 0.6;
    margin-top: -4px;
    animation: markerPulse 2s ease-in-out infinite;
}

@keyframes markerPulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.8); opacity: 0; }
}

.landmark-marker {
    background: none !important;
    border: none !important;
}

/* Leaflet tooltip and popup overrides */
.shop-tooltip {
    background: #252540 !important;
    color: #4ecca3 !important;
    border: 1px solid #4ecca3 !important;
    border-radius: 6px !important;
    font-weight: bold !important;
    font-size: 0.85em !important;
    padding: 4px 10px !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.5) !important;
}

.shop-tooltip::before {
    border-top-color: #4ecca3 !important;
}

.shop-popup .leaflet-popup-content-wrapper {
    background: #252540 !important;
    color: #4ecca3 !important;
    border-radius: 8px !important;
    border: 1px solid #ffd700 !important;
}

.shop-popup .leaflet-popup-tip {
    background: #252540 !important;
}

/* Dark theme for Leaflet controls */
.leaflet-control-zoom a {
    background-color: #252540 !important;
    color: #4ecca3 !important;
    border-color: #3a3a5a !important;
}

.leaflet-control-zoom a:hover {
    background-color: #3a3a5a !important;
}

.leaflet-control-attribution {
    background: rgba(26, 26, 46, 0.8) !important;
    color: #888 !important;
    font-size: 0.65em !important;
}

.leaflet-control-attribution a {
    color: #4ecca3 !important;
}

.info-panel {
    background: #252540;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    border-bottom: 1px solid #4ecca3;
    padding-bottom: 10px;
}

.panel-title {
    color: #4ecca3;
    font-size: 1em;
}

.funds-display {
    text-align: right;
}

.funds-label {
    color: #888;
    font-size: 0.7em;
}

.funds-amount {
    font-size: 1.2em;
    color: #4ecca3;
    font-weight: bold;
}

.location-info { display: none; }
.location-info.active { display: block; }

.location-name {
    font-size: 1.2em;
    color: #ffd700;
    margin-bottom: 10px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid #333;
    font-size: 0.9em;
}

.stat-label { color: #888; }
.stat-value { font-weight: bold; }
.stat-value.good { color: #4ecca3; }
.stat-value.medium { color: #f0c040; }
.stat-value.bad { color: #e05050; }

.rates-breakdown {
    background: #1a1a2e;
    border-radius: 6px;
    padding: 8px;
    margin: 10px 0;
    font-size: 0.8em;
}

.rates-breakdown .title {
    color: #4ecca3;
    margin-bottom: 5px;
}

.rates-breakdown .line {
    display: flex;
    justify-content: space-between;
    color: #888;
    padding: 2px 0;
}

.rates-breakdown .line.discount { color: #4ecca3; }

.rates-breakdown .line.total {
    border-top: 1px solid #333;
    margin-top: 5px;
    padding-top: 5px;
    color: #fff;
    font-weight: bold;
}

.description {
    margin: 10px 0;
    color: #aaa;
    font-size: 0.85em;
    line-height: 1.4;
}

.btn {
    width: 100%;
    padding: 12px;
    background: #4ecca3;
    color: #1a1a2e;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.2s;
    letter-spacing: 0.3px;
}

.btn:hover { background: #3db892; }
.btn:active { transform: scale(0.98); }
.btn:disabled { background: #555; cursor: not-allowed; }

.btn-secondary {
    background: #4a4a6a;
    color: #eee;
}
.btn-secondary:hover { background: #5a5a7a; }

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #333;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75em;
    color: #888;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
}

.default-message {
    color: #888;
    text-align: center;
    padding: 20px 10px;
    font-size: 0.9em;
}

.tap-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #4ecca3;
    font-size: 1em;
}

.tooltip {
    position: fixed;
    background: rgba(0,0,0,0.9);
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    pointer-events: none;
    z-index: 100;
    display: none;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}
.modal-overlay.active { display: flex; }

.modal {
    background: #252540;
    padding: 25px;
    border-radius: 12px;
    max-width: 400px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal h2 {
    color: #4ecca3;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.modal p {
    color: #aaa;
    margin-bottom: 15px;
    font-size: 0.9em;
    line-height: 1.4;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.95em;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
}

.modal-btn.confirm { background: #4ecca3; color: #1a1a2e; }
.modal-btn.cancel { background: #555; color: #eee; }
.modal-btn:active { transform: scale(0.95); }

/* ==================== SHOP VIEW STYLES ==================== */
/* Wall - dark brick pattern */
.floor-cell.wall {
    background: #3a3a52;
    background-image:
        linear-gradient(to right, rgba(0,0,0,0.15) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(0,0,0,0.15) 1px, transparent 1px);
    background-size: 12px 8px;
    border-radius: 2px;
}

/* Door - welcome mat */
.floor-cell.door {
    background: linear-gradient(135deg, #4a6a4a 0%, #3d5a3d 50%, #4a6a4a 100%);
    border: 1px solid #5a7a5a;
    font-size: 16px;
    box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
}

/* Counter - wooden with polish */
.floor-cell.counter {
    background: linear-gradient(180deg, #7a6040 0%, #5a4a30 100%);
    border: 1px solid #8a7050;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.15), 0 1px 3px rgba(0,0,0,0.3);
    font-size: 16px;
}

/* Empty floor tile - subtle wood */
.floor-cell.floor {
    background: transparent;
}

/* Legacy shelf/drum classes (kept for chase game compatibility) */
.floor-cell.shelf { background: #4a3a2a; }
.floor-cell.drum { background: #2a3a4a; }

/* ---- Product cells ---- */
.floor-cell.product-cell {
    cursor: default;
    font-size: 22px;
    border-radius: 4px;
    transition: all 0.15s;
    flex-direction: column;
    gap: 0;
    padding: 2px 0;
}

/* Product cell label (name underneath emoji) */
.floor-cell.product-cell .cell-label {
    font-size: 6.5px;
    color: rgba(255,255,255,0.7);
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    padding: 0 1px;
}

/* Stock badge */
.floor-cell.product-cell .stock-badge {
    position: absolute;
    top: 1px;
    right: 2px;
    font-size: 8px;
    font-weight: bold;
    line-height: 1;
    padding: 1px 3px;
    border-radius: 6px;
    background: rgba(78, 204, 163, 0.85);
    color: #1a1a2e;
}

.floor-cell.product-cell .stock-badge.low {
    background: rgba(240, 192, 64, 0.9);
}

.floor-cell.product-cell .stock-badge.out {
    background: rgba(224, 80, 80, 0.9);
    color: #fff;
}

/* Category-specific shelf colours */
.floor-cell.product-cell.cat-dry {
    background: linear-gradient(180deg, #4a3d28 0%, #3a3020 100%);
    border: 1px solid #5a4d38;
    box-shadow: inset 0 -2px 0 rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.06);
}

.floor-cell.product-cell.cat-wet {
    background: linear-gradient(180deg, #283d4a 0%, #203040 100%);
    border: 1px solid #385a6a;
    box-shadow: inset 0 -2px 0 rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.06);
}

.floor-cell.product-cell.cat-eco {
    background: linear-gradient(180deg, #2a4a2a 0%, #1e3a1e 100%);
    border: 1px solid #3a5a3a;
    box-shadow: inset 0 -2px 0 rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.06);
}

/* Empty shelf - dashed outline, ghosted */
.floor-cell.product-cell.empty {
    opacity: 1;
    border-style: dashed;
    border-color: rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.03);
    box-shadow: none;
}

.floor-cell.product-cell.empty .stock-badge { display: none; }
.floor-cell.product-cell.empty .cell-label { color: rgba(255,255,255,0.3); }

.floor-cell.product-cell.clickable {
    cursor: pointer;
}

.floor-cell.product-cell.clickable:hover {
    transform: scale(1.1);
    z-index: 10;
    box-shadow: 0 0 10px rgba(78, 204, 163, 0.4);
}

.floor-cell.product-cell.clickable:active {
    transform: scale(0.95);
}

.floor-cell.product-cell.wanted {
    animation: wantedPulse 1s infinite;
    border: 2px solid #4ecca3;
}
.floor-cell.product-cell.wanted.cat-dry { background: linear-gradient(180deg, #3a4a28 0%, #2a3a1a 100%); }
.floor-cell.product-cell.wanted.cat-wet { background: linear-gradient(180deg, #284a4a 0%, #1a3a3a 100%); }
.floor-cell.product-cell.wanted.cat-eco { background: linear-gradient(180deg, #2a5a2a 0%, #1e4a1e 100%); }

.floor-cell.product-cell.fulfilled {
    opacity: 0.35;
    background: rgba(255,255,255,0.05);
    border-style: solid;
    box-shadow: none;
}

.header-funds {
    text-align: right;
}

/* Wholesaler modal */
/* ---- Wholesaler Modal ---- */
.wholesaler-modal {
    max-width: 500px;
    padding: 0;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    max-height: 90dvh;
    overflow: hidden;
}

.wholesaler-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 18px 12px;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
}

.wholesaler-header h2 {
    margin: 0;
    font-size: 1.15em;
}

.wholesaler-funds {
    color: #4ecca3;
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    font-size: 0.95em;
}

.wholesaler-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px 14px;
    overscroll-behavior: contain;
}

/* Accordion category headers */
.wholesaler-category {
    margin-bottom: 6px;
    border-radius: 8px;
    overflow: hidden;
    background: #1e1e36;
}

.wcat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: #2a2a48;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.wcat-header:hover {
    background: #33335a;
}

.wcat-header:active {
    background: #3a3a60;
}

.wcat-title {
    color: #4ecca3;
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    font-size: 0.95em;
}

.wcat-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wcat-count {
    color: #666;
    font-size: 0.8em;
}

.wcat-chevron {
    color: #888;
    font-size: 0.7em;
    transition: transform 0.2s;
}

.wcat-badge {
    background: #4ecca3;
    color: #1a1a2e;
    font-size: 0.7em;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

/* Accordion body — collapsed by default */
.wcat-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.wcat-body.expanded {
    max-height: 2000px;
}

/* Product items inside accordion */
.wholesaler-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: #1a1a2e;
    border-bottom: 1px solid #252540;
}

.wholesaler-item:last-child {
    border-bottom: none;
}

.wholesaler-item-info {
    flex: 1;
    min-width: 0;
}

.wholesaler-item-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

.wholesaler-item-name {
    font-weight: bold;
    font-size: 0.9em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wholesaler-stock {
    font-size: 0.7em;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

.wholesaler-stock.stock-ok { color: #4ecca3; background: rgba(78,204,163,0.12); }
.wholesaler-stock.stock-low { color: #f0c040; background: rgba(240,192,64,0.12); }
.wholesaler-stock.stock-out { color: #e05050; background: rgba(224,80,80,0.12); }

.wholesaler-item-prices {
    font-size: 0.75em;
    color: #888;
    display: flex;
    gap: 8px;
}

.wholesale-price { color: #4ecca3; }
.retail-price { color: #f0c040; }

.wholesaler-item-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    margin-left: 10px;
}

.qty-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 6px;
    background: #4a4a6a;
    color: #eee;
    font-size: 1.2em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.1s;
}

.qty-btn:hover { background: #5a5a7a; }
.qty-btn:active { background: #6a6a8a; transform: scale(0.95); }

.qty-input {
    width: 44px;
    height: 36px;
    text-align: center;
    background: #252540;
    border: 1px solid #4a4a6a;
    color: #eee;
    padding: 4px;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
}

.qty-input:focus {
    border-color: #4ecca3;
    outline: none;
}

/* Sticky footer */
.wholesaler-footer {
    flex-shrink: 0;
    border-top: 1px solid #333;
    background: #252540;
    padding: 10px 14px;
}

.order-summary-mini {
    cursor: pointer;
    padding: 8px 0 6px;
    -webkit-tap-highlight-color: transparent;
}

.order-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9em;
}

.order-summary-row span:first-child {
    color: #888;
}

.order-total-amount {
    color: #4ecca3;
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    font-size: 1.2em;
}

.wholesaler-footer.has-order .order-total-amount {
    color: #ffd700;
}

.delivery-note-mini {
    color: #666;
    font-size: 0.75em;
    margin-top: 2px;
}

/* Expandable order detail */
.order-summary-detail {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.order-summary-detail.expanded {
    max-height: 200px;
    overflow-y: auto;
    padding: 8px 0;
    border-top: 1px solid #333;
    margin-top: 6px;
}

.order-line {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    font-size: 0.8em;
    color: #aaa;
}

.wholesaler-footer-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.wholesaler-footer-buttons .modal-btn {
    flex: 1;
    padding: 12px;
    font-family: 'Quicksand', sans-serif;
    font-weight: 600;
    font-size: 0.95em;
    border-radius: 8px;
}

.wholesaler-footer-buttons .modal-btn.confirm.insufficient {
    background: #e05050;
}

/* Order shortcuts (inside body) */
.order-shortcuts {
    background: #1e1e36;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
}

.shortcut-section {
    margin-bottom: 10px;
}

.shortcut-section:last-child {
    margin-bottom: 0;
}

.shortcut-section label {
    display: block;
    color: #888;
    font-size: 0.85em;
    margin-bottom: 6px;
}

.shortcut-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.qty-select {
    flex: 1;
    padding: 10px;
    background: #252540;
    border: 1px solid #4a4a6a;
    color: #eee;
    border-radius: 6px;
    font-size: 0.9em;
}

/* Pending deliveries */
.deliveries-panel {
    background: #252540;
    border-radius: 12px;
    padding: 15px;
}

.delivery-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background: #1a1a2e;
    border-radius: 6px;
    margin-bottom: 5px;
    font-size: 0.85em;
}

.delivery-eta {
    color: #f0c040;
}

.btn-small {
    padding: 8px 12px;
    font-size: 0.85em;
    margin-top: 0;
    width: auto;
}

/* ==================== CUSTOMER & DAY SIMULATION STYLES ==================== */
.day-phase-indicator {
    background: #252540;
    border-radius: 12px;
    padding: 12px 15px;
    text-align: center;
}

.phase-text {
    color: #4ecca3;
    font-weight: bold;
    font-size: 1.1em;
}

.phase-subtext {
    color: #888;
    font-size: 0.85em;
    margin-top: 4px;
}

/* Reputation display */
.reputation-display {
    display: flex;
    align-items: center;
    gap: 5px;
}

.reputation-stars {
    color: #ffd700;
    font-size: 0.9em;
}

.reputation-value {
    color: #888;
    font-size: 0.75em;
}

/* Customer queue area */
.customer-area {
    background: #252540;
    border-radius: 12px;
    padding: 15px;
    min-height: 120px;
}

.customer-area-title {
    color: #4ecca3;
    font-size: 0.9em;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.customer-count {
    color: #888;
    font-size: 0.85em;
}

.customer-queue {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    min-height: 80px;
    align-items: flex-start;
}

.customer-queue-empty {
    color: #555;
    font-style: italic;
    width: 100%;
    text-align: center;
    padding: 20px;
}

/* Individual customer */
.customer {
    background: #1a1a2e;
    border-radius: 10px;
    padding: 10px;
    width: 140px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    border: 2px solid transparent;
    position: relative;
}

.customer.entering {
    animation: customerSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.customer:hover {
    border-color: #4ecca3;
    transform: translateY(-2px);
}

.customer.impatient {
    border-color: #f0c040;
    background: #2a2418;
    animation: impatientShake 0.4s ease-in-out infinite;
}

.customer.impatient .customer-avatar {
    animation: avatarImpatient 0.6s ease-in-out infinite;
}

.customer.impatient .customer-speech {
    background: #3a2a18;
    border-color: #f0c040;
}

.customer.left {
    animation: customerPoofOut 0.5s ease-in forwards;
    pointer-events: none;
}

.customer.served {
    animation: customerHappyExit 0.5s ease-out forwards;
    pointer-events: none;
}

/* Customer card animations */
@keyframes customerSlideIn {
    0% {
        opacity: 0;
        transform: translateX(60px) scale(0.8);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes customerPoofOut {
    0% {
        opacity: 1;
        transform: scale(1);
        filter: none;
    }
    40% {
        opacity: 0.8;
        transform: scale(1.1);
        filter: saturate(0.5);
    }
    100% {
        opacity: 0;
        transform: scale(0.3) translateY(-30px);
        filter: saturate(0) blur(4px);
    }
}

@keyframes customerHappyExit {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    30% {
        opacity: 1;
        transform: scale(1.1) translateY(-5px);
    }
    100% {
        opacity: 0;
        transform: scale(0.7) translateY(-40px);
    }
}

@keyframes impatientShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-3px) rotate(-1deg); }
    40% { transform: translateX(3px) rotate(1deg); }
    60% { transform: translateX(-2px) rotate(-0.5deg); }
    80% { transform: translateX(2px) rotate(0.5deg); }
}

@keyframes avatarImpatient {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes pulse-warning {
    0%, 100% { box-shadow: 0 0 0 0 rgba(240, 192, 64, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(240, 192, 64, 0); }
}

.customer-avatar {
    font-size: 2em;
    text-align: center;
    margin-bottom: 3px;
    transition: transform 0.2s;
}

.customer-speech {
    background: #2a2a44;
    border: 1px solid #3a3a5a;
    border-radius: 10px;
    padding: 6px 8px;
    font-size: 0.75em;
    color: #eee;
    position: relative;
    margin-top: 8px;
}

.customer-speech::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid #3a3a5a;
}

.customer-speech::after {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 5px solid #2a2a44;
}

.customer-wants {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    justify-content: center;
}

.customer-wants span {
    font-size: 1.1em;
}

.customer-budget {
    color: #4ecca3;
    font-size: 0.8em;
    text-align: center;
    margin-top: 4px;
}

.customer-preference {
    color: #f0c040;
    font-size: 0.7em;
    text-align: center;
    margin-top: 2px;
}

/* Day summary modal */
.day-summary {
    text-align: left;
}

.summary-section {
    margin-bottom: 15px;
}

.summary-section h4 {
    color: #4ecca3;
    margin-bottom: 8px;
    font-size: 0.95em;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 0.9em;
}

.summary-row.positive { color: #4ecca3; }
.summary-row.negative { color: #e05050; }
.summary-row.total {
    border-top: 1px solid #333;
    margin-top: 8px;
    padding-top: 8px;
    font-weight: bold;
}

.out-of-stock-list {
    color: #e05050;
    font-size: 0.85em;
    margin-top: 5px;
}

.missed-sales {
    color: #f0c040;
    font-size: 0.85em;
}

/* Plastic saved summary */
.plastic-summary {
    background: linear-gradient(135deg, rgba(78, 204, 163, 0.08), rgba(46, 160, 120, 0.04));
    border: 1px solid rgba(78, 204, 163, 0.2);
    border-radius: 8px;
    padding: 12px;
}

.plastic-summary h4 {
    color: #4ecca3;
}

.plastic-summary .summary-row span:last-child {
    color: #4ecca3;
    font-weight: 700;
}

.plastic-micro {
    margin-top: 8px;
    font-size: 0.8em;
    color: #8bc4b0;
    line-height: 1.5;
}

.plastic-micro strong {
    color: #4ecca3;
}

/* Start day button */
.btn-start-day {
    background: #4ecca3;
    font-size: 1.1em;
    padding: 15px;
}

.btn-end-day {
    background: #f0c040;
    color: #1a1a2e;
}

/* Event modal styles */
.event-modal {
    text-align: center;
    max-width: 350px;
}

.event-header {
    margin-bottom: 15px;
}

.event-emoji {
    font-size: 3em;
    display: block;
    margin-bottom: 10px;
}

.event-modal h2 {
    margin-bottom: 0;
}

.event-message {
    font-size: 0.95em;
    line-height: 1.5;
    margin-bottom: 20px;
}

.event-responses {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.event-response-btn {
    padding: 12px 16px;
    background: #1a1a2e;
    border: 2px solid #4a4a6a;
    color: #eee;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95em;
    transition: all 0.2s;
    text-align: left;
}

.event-response-btn:hover {
    border-color: #4ecca3;
    background: #252540;
}

.event-response-btn:active {
    transform: scale(0.98);
}

.event-response-btn .response-cost {
    color: #e05050;
    font-size: 0.85em;
    float: right;
}

/* Weather indicator in header */
.weather-indicator {
    font-size: 1.2em;
    margin-left: 5px;
}

/* Event notification banner */
.event-banner {
    background: #2a4a3a;
    border: 1px solid #4ecca3;
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85em;
}

.event-banner.negative {
    background: #4a2a2a;
    border-color: #e05050;
}

.event-banner-emoji {
    font-size: 1.3em;
}

.event-banner-text {
    flex: 1;
}

/* Chase mini-game (bee/dog) */
.floor-cell.has-creature {
    position: relative;
    animation: creatureShake 0.3s infinite;
    cursor: pointer !important;
    z-index: 100;
}

.floor-cell.has-creature::after {
    content: '';
    position: absolute;
    inset: -4px;
    border: 3px solid #e05050;
    border-radius: 8px;
    animation: creaturePulse 0.5s infinite;
}

.chase-creature {
    position: absolute;
    font-size: 24px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    filter: drop-shadow(0 0 4px rgba(255,255,255,0.8));
    animation: creatureBounce 0.4s infinite;
}

@keyframes creatureShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

@keyframes creaturePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes creatureBounce {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -60%) scale(1.1); }
}

.btn-warning {
    background: #e05050;
    color: #fff;
}

.btn-warning:hover {
    background: #c04040;
}

/* Serving controls */
.serving-controls {
    background: #2a4a3a;
    border-radius: 12px;
    padding: 12px 15px;
    border: 2px solid #4ecca3;
}

.serving-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.serving-header > span:first-child {
    color: #4ecca3;
    font-weight: bold;
}

.basket-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9em;
}

.basket-items {
    display: flex;
    gap: 2px;
    font-size: 1.2em;
}

.basket-items .empty-basket {
    color: #666;
    font-size: 0.8em;
    font-style: italic;
}

.basket-total {
    color: #4ecca3;
    font-weight: bold;
}

.serving-hint {
    color: #aaa;
    font-size: 0.8em;
    margin-bottom: 10px;
}

.serving-buttons {
    display: flex;
    gap: 10px;
}

.serving-buttons .btn {
    flex: 1;
}

/* Customer selected state */
.customer.selected {
    border-color: #4ecca3;
    background: #2a3a4a;
    box-shadow: 0 0 15px rgba(78, 204, 163, 0.5);
}

/* Customer wants - fulfilled and out of stock states */
.customer-wants span.fulfilled {
    opacity: 0.4;
    text-decoration: line-through;
}

.customer-wants span.out-of-stock {
    position: relative;
}

.customer-wants span.out-of-stock::after {
    content: '\2716';
    position: absolute;
    top: -2px;
    right: -2px;
    font-size: 0.6em;
    color: #e05050;
}

/* Clickable shop items when serving */
.floor-cell.clickable {
    cursor: pointer;
    transition: all 0.15s;
}

.floor-cell.clickable:hover {
    transform: scale(1.15);
    z-index: 10;
    box-shadow: 0 0 10px rgba(78, 204, 163, 0.5);
}

.floor-cell.clickable.wanted {
    animation: wantedPulse 1s infinite;
    border: 2px solid #4ecca3;
}

@keyframes wantedPulse {
    0%, 100% { box-shadow: 0 0 5px #4ecca3; }
    50% { box-shadow: 0 0 15px #4ecca3, 0 0 25px #4ecca3; }
}

.floor-cell.clickable.empty {
    cursor: not-allowed;
}

/* Interactive stock list when serving */
.stock-hint {
    font-size: 0.75em;
    color: #4ecca3;
    font-weight: normal;
}

.stock-item.clickable {
    cursor: pointer;
    transition: all 0.15s;
}

.stock-item.clickable:hover {
    background: #2a3a4a;
    transform: translateX(5px);
}

.stock-item.wanted {
    background: #2a4a3a;
    border: 1px solid #4ecca3;
    animation: wantedItemPulse 1.5s infinite;
}

@keyframes wantedItemPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(78, 204, 163, 0.4); }
    50% { box-shadow: 0 0 0 5px rgba(78, 204, 163, 0); }
}

.stock-item.fulfilled {
    opacity: 0.5;
    text-decoration: line-through;
}

.stock-item .add-btn {
    background: #4ecca3;
    color: #1a1a2e;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.8em;
    cursor: pointer;
    margin-left: 10px;
}

.stock-item .add-btn:disabled {
    background: #555;
    cursor: not-allowed;
}

/* Notifications */
/* ---- Stacking Toast Notifications ---- */
.toast-container {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 6px;
    pointer-events: none;
    width: 92%;
    max-width: 400px;
}

.toast {
    padding: 10px 18px;
    border-radius: 8px;
    font-family: 'Quicksand', 'Nunito', sans-serif;
    font-weight: 600;
    font-size: 0.85em;
    line-height: 1.3;
    text-align: center;
    pointer-events: auto;
    cursor: pointer;
    animation: toastIn 0.3s cubic-bezier(0.34, 1.4, 0.64, 1) both;
    box-shadow: 0 4px 12px rgba(0,0,0,0.35);
}

.toast-info {
    background: #4ecca3;
    color: #1a1a2e;
}

.toast-warning {
    background: #f0c040;
    color: #1a1a2e;
}

.toast-error {
    background: #e05050;
    color: #fff;
}

.toast-sale {
    background: linear-gradient(135deg, #4ecca3, #3db892);
    color: #1a1a2e;
    border: 1px solid #ffd700;
}

.toast-exit {
    animation: toastOut 0.3s ease-in forwards;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
        max-height: 60px;
        margin-bottom: 0;
    }
    to {
        opacity: 0;
        transform: translateY(-10px) scale(0.9);
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
        margin-bottom: -6px;
    }
}

/* Desktop adjustments */
@media (min-width: 600px) {
    h1 { font-size: 2em; }

    .game-container {
        max-width: 900px;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .map-container { flex: 0 0 auto; min-width: 420px; }
    
    .leaflet-map {
        height: 450px;
    }

    .info-panel {
        flex: 1;
        min-width: 300px;
        max-width: 400px;
    }

    /* Shop view desktop */
    #shopScreen .game-container {
        max-width: 600px;
        flex-direction: column;
    }

    .shop-floor {
        grid-template-rows: repeat(6, 54px);
    }

    .floor-cell { font-size: 24px; }
    .floor-cell.product-cell .cell-label { font-size: 7.5px; }
    .floor-cell.product-cell .stock-badge { font-size: 9px; }
}