        /* === TOP RESOURCE BAR === */
        #top-bar {
            position: fixed;
            top: calc(10px + env(safe-area-inset-top, 0px));
            left: 50%;
            transform: translateX(-50%);
            display: flex;
            align-items: stretch;
            background: rgba(15, 12, 8, 0.85);
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
            border-radius: 12px;
            border: 1px solid rgba(255, 255, 255, 0.08);
            box-shadow:
                0 4px 20px rgba(0, 0, 0, 0.5),
                inset 0 1px 0 rgba(255, 255, 255, 0.05);
            overflow: hidden;
            pointer-events: auto;
            cursor: pointer;
            z-index: 100;
            transition: transform 0.1s ease;
        }

        #top-bar:hover {
            transform: translateX(-50%) scale(1.02);
        }

        #top-bar:active {
            transform: translateX(-50%) scale(0.98);
        }

        .resource-box {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 10px 16px;
            position: relative;
        }

        .resource-box:not(:last-child)::after {
            content: '';
            position: absolute;
            right: 0;
            top: 20%;
            height: 60%;
            width: 1px;
            background: linear-gradient(180deg,
                transparent 0%,
                rgba(255, 255, 255, 0.15) 50%,
                transparent 100%);
        }

        .resource-icon {
            width: 28px;
            height: 28px;
            image-rendering: auto;
            filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
        }

        .resource-info {
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            gap: 1px;
        }

        .resource-value {
            font-size: 13px;
            color: #fff;
            text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
            letter-spacing: 0.5px;
        }

        .resource-box:nth-child(1) .resource-value {
            color: #FFD700;
            text-shadow: 0 0 8px rgba(255, 215, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.8);
        }

        .resource-box:nth-child(2) .resource-value {
            color: #50C878;
            text-shadow: 0 0 8px rgba(80, 200, 120, 0.3), 0 1px 2px rgba(0, 0, 0, 0.8);
        }

        .resource-box:nth-child(3) .resource-value {
            color: #FF8080;
            text-shadow: 0 0 8px rgba(255, 128, 128, 0.3), 0 1px 2px rgba(0, 0, 0, 0.8);
        }

        .resource-rate {
            font-size: 8px;
            color: rgba(140, 255, 140, 0.9);
            letter-spacing: 0.3px;
        }

        .resource-rate.negative {
            color: rgba(255, 140, 140, 0.9);
        }

        /* === SIDE BUTTONS === */
        #side-buttons {
            position: fixed;
            left: calc(10px + env(safe-area-inset-left, 0px));
            bottom: calc(20px + env(safe-area-inset-bottom, 0px));
            display: flex;
            flex-direction: column;
            gap: 10px;
            z-index: 100;
        }

        .side-btn {
            width: 48px;
            height: 48px;
            background: none;
            border: none;
            padding: 0;
            cursor: pointer;
            transition: transform 0.1s ease, filter 0.1s ease;
        }

        .side-btn:hover {
            transform: scale(1.08);
        }

        .side-btn:active {
            transform: scale(0.9);
        }

        .side-btn-icon {
            width: 48px;
            height: 48px;
            filter: drop-shadow(2px 3px 3px rgba(0, 0, 0, 0.4));
            transition: filter 0.1s ease;
        }

        .side-btn:hover .side-btn-icon {
            filter: drop-shadow(3px 4px 5px rgba(0, 0, 0, 0.5));
        }

        .side-btn:active .side-btn-icon {
            filter: drop-shadow(1px 2px 2px rgba(0, 0, 0, 0.3));
        }

        /* Corner button (logout - right side) */
        .corner-btn {
            position: fixed;
            right: calc(10px + env(safe-area-inset-right, 0px));
            bottom: calc(20px + env(safe-area-inset-bottom, 0px));
            z-index: 100;
            width: 48px;
            height: 48px;
            background: none;
            border: none;
            padding: 0;
            cursor: pointer;
            transition: transform 0.1s ease;
        }

        .corner-btn:hover {
            transform: scale(1.08);
        }

        .corner-btn:active {
            transform: scale(0.9);
        }

        .corner-btn-icon {
            width: 48px;
            height: 48px;
            filter: drop-shadow(2px 3px 3px rgba(0, 0, 0, 0.4));
            transition: filter 0.1s ease;
        }

        .corner-btn:hover .corner-btn-icon {
            filter: drop-shadow(3px 4px 5px rgba(0, 0, 0, 0.5));
        }

        .corner-btn:active .corner-btn-icon {
            filter: drop-shadow(1px 2px 2px rgba(0, 0, 0, 0.3));
        }

        /* Corner button left side (boost) */
        .corner-btn.left {
            left: calc(16px + env(safe-area-inset-left, 0px));
            right: auto;
        }

        /* === STATS MODAL === */
        #stats-modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.6);
            z-index: 200;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.2s ease;
        }

        #stats-modal-overlay.show {
            opacity: 1;
            pointer-events: auto;
        }

        .stats-modal {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%) scale(0.9);
            width: 320px;
            max-width: 90vw;
            max-height: 80vh;
            overflow-y: auto;
            background: linear-gradient(180deg, #1a1612 0%, #0f0d0a 100%);
            border-radius: 16px;
            border: 1px solid rgba(255, 215, 0, 0.2);
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
            z-index: 201;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.2s ease, transform 0.2s ease;
        }

        .stats-modal.show {
            opacity: 1;
            pointer-events: auto;
            transform: translate(-50%, -50%) scale(1);
        }

        .stats-modal-title {
            text-align: center;
            font-size: 14px;
            color: #FFD700;
            padding: 16px 20px 12px;
            margin: 0;
            border-bottom: 1px solid rgba(255, 255, 255, 0.08);
            text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
        }

        .stats-modal-section {
            padding: 12px 16px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        }

        .stats-modal-section:last-child {
            border-bottom: none;
        }

        .stats-modal-header {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 10px;
            padding-bottom: 8px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        }

        .stats-modal-header.gold .stats-modal-resource-name {
            color: #FFD700;
        }

        .stats-modal-header.wood .stats-modal-resource-name {
            color: #CD853F;
        }

        .stats-modal-header.meat .stats-modal-resource-name {
            color: #FF8080;
        }

        .stats-modal-header.emerald .stats-modal-resource-name {
            color: #50C878;
        }

        .stats-modal-icon {
            width: 28px;
            height: 28px;
            object-fit: contain;
        }

        .stats-modal-resource-name {
            font-size: 13px;
            font-weight: bold;
            flex: 1;
        }

        .stats-modal-net {
            font-size: 12px;
            color: rgba(140, 255, 140, 0.9);
            font-weight: bold;
        }

        .stats-modal-net.negative {
            color: rgba(255, 140, 140, 0.9);
        }

        .stats-modal-rows {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .stats-modal-row {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 8px 10px;
            background: rgba(255, 255, 255, 0.03);
            border-radius: 8px;
        }

        .stats-modal-row-label {
            font-size: 12px;
            color: rgba(255, 255, 255, 0.8);
            flex: 1;
        }

        .stats-modal-row-label.idle {
            opacity: 0.5;
        }

        .stats-modal-row-count {
            font-size: 12px;
            color: #fff;
            min-width: 24px;
            text-align: right;
        }

        .stats-modal-row-rate {
            font-size: 11px;
            color: rgba(255, 255, 255, 0.5);
            min-width: 55px;
            text-align: right;
        }

        .stats-modal-row-rate.positive {
            color: rgba(140, 255, 140, 0.9);
        }

        .stats-modal-row-rate.negative {
            color: rgba(255, 140, 140, 0.9);
        }

        /* Hide idle miners row when no idle miners */
        #stats-miners-idle-row.hidden {
            display: none;
        }

        /* === BOTTOM BAR === */
        #bottom-bar {
            position: fixed;
            bottom: calc(35px + env(safe-area-inset-bottom, 0px));
            left: 50%;
            transform: translateX(-50%);
            display: flex;
            align-items: stretch;
            gap: 1px;
            background: rgba(15, 12, 8, 0.85);
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
            border-radius: 10px;
            border: 1px solid rgba(255, 255, 255, 0.08);
            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
            overflow: hidden;
            z-index: 100;
        }

        .bottom-bar-item {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 8px 14px;
            position: relative;
        }

        .bottom-bar-item:not(:last-child)::after {
            content: '';
            position: absolute;
            right: 0;
            top: 20%;
            height: 60%;
            width: 1px;
            background: linear-gradient(180deg,
                transparent 0%,
                rgba(255, 255, 255, 0.12) 50%,
                transparent 100%);
        }

        .bottom-bar-icon {
            width: 24px;
            height: 24px;
            image-rendering: auto;
            filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.4));
        }

        .bottom-bar-info {
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            gap: 1px;
        }

        .bottom-bar-value {
            font-size: 12px;
            color: #fff;
            text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
        }

        .bottom-bar-value.full {
            color: #FF8080;
        }

        /* Wood value color */
        .bottom-bar-item:nth-child(2) .bottom-bar-value {
            color: #CD853F;
        }

        .bottom-bar-label {
            font-size: 8px;
            color: rgba(255, 255, 255, 0.5);
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        .bottom-bar-rate {
            font-size: 8px;
            color: rgba(140, 255, 140, 0.9);
        }

        .bottom-bar-rate.negative {
            color: rgba(255, 140, 140, 0.9);
        }

