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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    background: #0a1a1f;
}

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

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #1a2a3a;
}

::-webkit-scrollbar-thumb {
    background: #ffd700;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #ffb347;
}

/* Loading indicator */
.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 1.2rem;
    z-index: 1000;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .brick-counter {
        top: 10px;
        right: 10px;
        font-size: 0.7rem;
        padding: 6px 12px;
    }
    
    .instruction-badge,
    .click-hint {
        font-size: 0.6rem;
        padding: 4px 10px;
    }
    
    .modal-content {
        margin: 20px;
        padding: 25px;
    }
}
/* ── CHARACTER SIDEBAR ── */
#charSidebar {
    transition: transform 0.45s cubic-bezier(0.34,1.2,0.64,1);
}

/* On mobile: sidebar shows as a top strip instead of side panel */
@media (max-width: 700px) {
    #charSidebar {
        width: 100% !important;
        height: 140px !important;
        bottom: auto !important;
        top: 0 !important;
        flex-direction: row !important;
        align-items: center !important;
        padding: 12px 16px !important;
        border-right: none !important;
        border-bottom: 1px solid rgba(255,215,0,0.18) !important;
    }
    #charFigure {
        width: 70px !important;
        height: 110px !important;
        margin-bottom: 0 !important;
        margin-right: 12px !important;
        flex-shrink: 0;
    }
    #purchaseModal .modal-content {
        margin-left: 0 !important;
        margin-top: 150px !important;
    }
}

/* figCanvas in sidebar */
#figCanvas {
    background: transparent;
    flex-shrink: 0;
}

@media (max-width: 700px) {
    #figCanvas {
        width: 100px !important;
        height: 160px !important;
    }
    #charBubble {
        font-size: 0.72rem !important;
    }
}
/* Bigger Hades-style character beside the claim dialog */
#charSidebar {
    width: 520px !important;
    height: 620px !important;
    top: auto !important;
    bottom: 0 !important;
    background: transparent !important;
    border-right: none !important;
    pointer-events: none !important;
}
#figCanvas {
    width: 520px !important;
    height: 620px !important;
    background: transparent !important;
}
#charBubble { display: none !important; }

@media (max-width: 900px) {
    #charSidebar { width: 210px !important; height: 310px !important; }
    #figCanvas { width: 210px !important; height: 310px !important; }
    #purchaseModal { padding-left: 0 !important; justify-content: center !important; }
}


/* Final no-jump modal fix */
#purchaseModal.active { display:flex !important; align-items:center !important; justify-content:flex-start !important; }
#purchaseModal .modal-content { animation:none !important; transform:none !important; }
#charSidebar { overflow:visible !important; }

/* ── MOBILE ONLY: bottom dock so the 3D bricks stay tappable ── */
@media (max-width: 700px) {
    /* The bottom row contains: mute button + claimed counter + go-to-block. */
    #muteBtn {
        left: 10px !important;
        bottom: 12px !important;
        width: 46px !important;
        height: 46px !important;
        z-index: 650 !important;
    }

    .stats-counter {
        top: auto !important;
        right: auto !important;
        left: 62px !important;
        bottom: 12px !important;
        width: 118px !important;
        max-width: 118px !important;
        z-index: 650 !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        pointer-events: none !important;
    }

    .stats-counter .stat-pill,
    .stat-pill {
        width: 118px !important;
        max-width: 118px !important;
        padding: 8px 8px !important;
        font-size: 0.68rem !important;
        line-height: 1.1 !important;
        border-radius: 22px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        background: rgba(0,0,0,0.88) !important;
        backdrop-filter: blur(8px) !important;
        pointer-events: auto !important;
    }

    .stats-counter .stat-pill span,
    .stat-pill span {
        font-size: 0.78rem !important;
    }

    #goToBlockPanel {
        top: auto !important;
        left: 186px !important;
        right: 8px !important;
        bottom: 12px !important;
        width: auto !important;
        max-width: none !important;
        padding: 6px 7px !important;
        border-radius: 24px !important;
        z-index: 650 !important;
        background: rgba(0,0,0,0.88) !important;
        box-shadow: 0 6px 22px rgba(0,0,0,0.35) !important;
    }

    #goToBlockPanel > div:first-child {
        display: none !important;
    }

    #goToBlockPanel input {
        height: 34px !important;
        font-size: 0.78rem !important;
        padding: 6px 8px !important;
    }

    #goToBlockPanel button {
        height: 34px !important;
        min-width: 44px !important;
        padding: 6px 8px !important;
        border-radius: 18px !important;
        font-size: 0.72rem !important;
    }

    /* Recent purchases stays low on mobile, not at the top. */
    #recentPanel {
        top: auto !important;
        right: 8px !important;
        left: 8px !important;
        bottom: 70px !important;
        width: auto !important;
        max-width: calc(100vw - 16px) !important;
        max-height: 22vh !important;
        overflow-y: auto !important;
        z-index: 640 !important;
        padding: 9px 10px 7px !important;
        border-radius: 18px !important;
        background: rgba(0,0,0,0.88) !important;
        -webkit-overflow-scrolling: touch !important;
    }

    #recentPanel .rp-header {
        font-size: 0.82rem !important;
        margin-bottom: 5px !important;
    }

    #recentPanel .rp-list {
        max-height: 12vh !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    #recentPanel .rp-item {
        padding: 5px 2px !important;
    }

    #recentPanel .rp-avatar,
    #recentPanel .rp-avatar img {
        width: 28px !important;
        height: 28px !important;
    }
}

@media (max-width: 380px) {
    .stats-counter { width: 104px !important; max-width: 104px !important; }
    .stats-counter .stat-pill, .stat-pill { width: 104px !important; max-width: 104px !important; font-size:0.62rem !important; }
    #goToBlockPanel { left: 172px !important; }
}

@media (max-width: 700px) and (max-height: 680px) {
    #recentPanel {
        max-height: 17vh !important;
        bottom: 66px !important;
    }
    #recentPanel .rp-list {
        max-height: 8vh !important;
    }
}


/* ── MOBILE FINAL LAYOUT FIX: bottom strip + recent purchases below viewport ── */
@media (max-width: 700px) {
    html, body {
        overflow-x: hidden !important;
        overflow-y: auto !important;
        height: auto !important;
        min-height: 100vh !important;
        background: #87CEEB !important;
    }

    #houseCanvas {
        display: block !important;
        width: 100vw !important;
        height: calc(100vh - 72px) !important;
        min-height: 620px !important;
        touch-action: none !important;
    }

    /* Hide the big character on mobile purchase dialog; it was covering fields/buttons. */
    #charSidebar,
    #figCanvas,
    #charBubble {
        display: none !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    #purchaseModal {
        padding-left: 0 !important;
        justify-content: center !important;
        align-items: center !important;
        padding: 10px !important;
        z-index: 1000 !important;
    }

    #purchaseModal .modal-content {
        width: min(94vw, 430px) !important;
        max-width: 94vw !important;
        max-height: 78vh !important;
        overflow-y: auto !important;
        margin: 0 auto !important;
        padding: 22px 18px !important;
        border-radius: 18px !important;
    }

    /* Bottom strip: mute + claimed + go-to-block in the same row. */
    #muteBtn,
    .stats-counter,
    #goToBlockPanel {
        position: fixed !important;
        bottom: max(8px, env(safe-area-inset-bottom)) !important;
        z-index: 1400 !important;
    }

    #muteBtn {
        left: 8px !important;
        width: 44px !important;
        height: 44px !important;
        border-radius: 50% !important;
    }

    .stats-counter {
        top: auto !important;
        left: 58px !important;
        right: auto !important;
        width: 132px !important;
        max-width: 132px !important;
        display: flex !important;
        flex-direction: row !important;
        gap: 0 !important;
        pointer-events: none !important;
    }

    .stats-counter .stat-pill {
        width: 132px !important;
        max-width: 132px !important;
        padding: 9px 9px !important;
        border-radius: 22px !important;
        font-size: 0.68rem !important;
        line-height: 1 !important;
        overflow: hidden !important;
        white-space: nowrap !important;
        text-overflow: ellipsis !important;
        background: rgba(0,0,0,0.88) !important;
        pointer-events: auto !important;
    }

    #goToBlockPanel {
        top: auto !important;
        left: 196px !important;
        right: 8px !important;
        width: auto !important;
        max-width: none !important;
        padding: 5px !important;
        border-radius: 24px !important;
        background: rgba(0,0,0,0.9) !important;
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
        box-shadow: 0 5px 18px rgba(0,0,0,0.4) !important;
    }

    #goToBlockPanel > div:first-child {
        display: none !important;
    }

    #goToBlockPanel input {
        min-width: 0 !important;
        height: 36px !important;
        font-size: 0.78rem !important;
        padding: 7px 9px !important;
        border-radius: 18px !important;
    }

    #goToBlockPanel button {
        height: 38px !important;
        min-width: 46px !important;
        padding: 7px 9px !important;
        border-radius: 20px !important;
        font-size: 0.72rem !important;
    }

    /* Recent purchases is NOT fixed over the house on mobile.
       It sits below the 3D area, so user scrolls down to see it. */
    #recentPanel {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        width: calc(100vw - 16px) !important;
        max-width: calc(100vw - 16px) !important;
        max-height: none !important;
        min-height: 170px !important;
        margin: 8px 8px 86px !important;
        overflow-y: visible !important;
        z-index: 20 !important;
        padding: 12px !important;
        border-radius: 18px !important;
        background: rgba(0,0,0,0.9) !important;
        -webkit-overflow-scrolling: touch !important;
    }

    #recentPanel .rp-list {
        max-height: none !important;
        overflow-y: visible !important;
    }

    /* During rectangle selection, keep the bottom clean and readable. */
    body.mobile-selecting #recentPanel {
        display: none !important;
    }

    body.mobile-selecting #multiHint {
        top: 58px !important;
        left: 0 !important;
        right: 0 !important;
        transform: none !important;
        width: 100vw !important;
        border-radius: 0 !important;
        padding: 9px 10px !important;
        text-align: center !important;
        font-size: 0.78rem !important;
        white-space: normal !important;
        z-index: 1300 !important;
    }

    body.mobile-selecting #multiBar {
        left: 8px !important;
        right: 8px !important;
        bottom: calc(62px + env(safe-area-inset-bottom)) !important;
        transform: none !important;
        width: auto !important;
        padding: 8px 10px !important;
        border-radius: 22px !important;
        gap: 8px !important;
        justify-content: center !important;
        z-index: 1350 !important;
        white-space: normal !important;
        flex-wrap: wrap !important;
    }

    body.mobile-selecting #multiBarCount {
        font-size: 0.82rem !important;
        width: 100% !important;
        text-align: center !important;
    }
}

@media (max-width: 380px) {
    .stats-counter { width: 112px !important; max-width: 112px !important; }
    .stats-counter .stat-pill { width: 112px !important; max-width: 112px !important; font-size: 0.62rem !important; }
    #goToBlockPanel { left: 176px !important; }
}

/* ── MOBILE TOP STRIP FINAL ADJUSTMENT ──
   Mobile only: keep the normal desktop layout untouched.
   Moves mute + claimed counter + go-to-block into a compact top control line,
   directly under the main nav strip, so the bottom area stays cleaner. */
@media (max-width: 700px) {
    nav.top-nav {
        height: 54px !important;
        padding: 8px 10px !important;
        gap: 8px !important;
        z-index: 1500 !important;
    }

    nav.top-nav .nav-logo {
        font-size: 0.95rem !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 46vw !important;
    }

    nav.top-nav .nav-links {
        gap: 10px !important;
        flex-shrink: 0 !important;
    }

    nav.top-nav .nav-links a {
        font-size: 0.72rem !important;
    }

    /* Top mini toolbar: mute + claimed + go-to-block */
    #muteBtn,
    .stats-counter,
    #goToBlockPanel {
        position: fixed !important;
        top: 60px !important;
        bottom: auto !important;
        z-index: 1450 !important;
    }

    #muteBtn {
        left: 8px !important;
        width: 38px !important;
        height: 38px !important;
        font-size: 1.05rem !important;
        border-radius: 50% !important;
        padding: 0 !important;
    }

    .stats-counter {
        left: 52px !important;
        right: auto !important;
        width: 172px !important;
        max-width: 172px !important;
        display: flex !important;
        flex-direction: row !important;
        pointer-events: none !important;
    }

    .stats-counter .stat-pill {
        width: 172px !important;
        max-width: 172px !important;
        height: 38px !important;
        padding: 7px 10px !important;
        border-radius: 20px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 0.72rem !important;
        line-height: 1 !important;
        overflow: hidden !important;
        white-space: nowrap !important;
        text-overflow: ellipsis !important;
        background: rgba(0,0,0,0.88) !important;
        pointer-events: auto !important;
    }

    .stats-counter .stat-pill span {
        font-size: 0.82rem !important;
    }

    #goToBlockPanel {
        left: 230px !important;
        right: 8px !important;
        width: auto !important;
        max-width: none !important;
        height: 38px !important;
        padding: 3px 4px !important;
        border-radius: 20px !important;
        display: flex !important;
        align-items: center !important;
        gap: 4px !important;
        background: rgba(0,0,0,0.88) !important;
        box-shadow: 0 4px 16px rgba(0,0,0,0.35) !important;
    }

    #goToBlockPanel > div:first-child {
        display: none !important;
    }

    #goToBlockPanel input {
        height: 30px !important;
        min-width: 0 !important;
        font-size: 0.7rem !important;
        padding: 4px 7px !important;
        border-radius: 16px !important;
    }

    #goToBlockPanel button {
        height: 30px !important;
        min-width: 38px !important;
        padding: 4px 7px !important;
        border-radius: 16px !important;
        font-size: 0.68rem !important;
    }

    /* Give the 3D area a little more breathing room now that controls are at top. */
    #houseCanvas {
        height: calc(100vh - 56px) !important;
        min-height: 560px !important;
    }

    /* Recent purchases stays below the 3D area, not in the top strip. */
    #recentPanel {
        margin-top: 6px !important;
        margin-bottom: 18px !important;
    }

    body.mobile-selecting #multiHint {
        top: 104px !important;
    }

    body.mobile-selecting #multiBar {
        bottom: max(12px, env(safe-area-inset-bottom)) !important;
    }
}

@media (max-width: 390px) {
    .stats-counter {
        width: 150px !important;
        max-width: 150px !important;
    }

    .stats-counter .stat-pill {
        width: 150px !important;
        max-width: 150px !important;
        font-size: 0.66rem !important;
        padding-left: 7px !important;
        padding-right: 7px !important;
    }

    #goToBlockPanel {
        left: 208px !important;
    }
}

@media (max-width: 350px) {
    nav.top-nav .nav-links a {
        font-size: 0.65rem !important;
    }

    .stats-counter {
        width: 132px !important;
        max-width: 132px !important;
    }

    .stats-counter .stat-pill {
        width: 132px !important;
        max-width: 132px !important;
        font-size: 0.6rem !important;
    }

    #goToBlockPanel {
        left: 190px !important;
    }
}

/* ── MOBILE CONTROL STRIP REFINEMENT ──
   Keeps mute + claimed counter + go-to-block on ONE compact line.
   Makes Recent Purchases sit below the 3D house and visible after a small scroll. */
@media (max-width: 700px) {
    nav.top-nav {
        height: 54px !important;
        padding: 8px 10px !important;
        z-index: 1600 !important;
    }

    #muteBtn,
    .stats-counter,
    #goToBlockPanel {
        position: fixed !important;
        top: 61px !important;
        bottom: auto !important;
        z-index: 1550 !important;
    }

    #muteBtn {
        left: 8px !important;
        width: 38px !important;
        height: 38px !important;
        min-width: 38px !important;
        padding: 0 !important;
        font-size: 1.05rem !important;
    }

    .stats-counter {
        left: 52px !important;
        right: auto !important;
        width: 178px !important;
        max-width: 178px !important;
        height: 38px !important;
        display: flex !important;
        pointer-events: none !important;
    }

    .stats-counter .stat-pill {
        width: 178px !important;
        max-width: 178px !important;
        height: 38px !important;
        padding: 0 9px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 2px !important;
        border-radius: 20px !important;
        font-size: 0.70rem !important;
        line-height: 1 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: clip !important;
        pointer-events: auto !important;
    }

    .stats-counter .stat-pill span {
        font-size: 0.83rem !important;
        flex-shrink: 0 !important;
    }

    #goToBlockPanel {
        left: 236px !important;
        right: 8px !important;
        width: auto !important;
        max-width: none !important;
        height: 38px !important;
        min-width: 0 !important;
        padding: 3px 4px !important;
        border-radius: 20px !important;
        display: flex !important;
        align-items: center !important;
        background: rgba(0,0,0,0.88) !important;
        box-sizing: border-box !important;
    }

    #goToBlockPanel > div:first-child {
        display: none !important;
    }

    #goToBlockPanel > div:last-child {
        display: flex !important;
        align-items: center !important;
        gap: 4px !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    #goToBlockInput {
        flex: 1 1 auto !important;
        width: auto !important;
        min-width: 0 !important;
        height: 30px !important;
        padding: 4px 7px !important;
        font-size: 0.7rem !important;
        border-radius: 16px !important;
    }

    #goToBlockBtn {
        flex: 0 0 38px !important;
        width: 38px !important;
        min-width: 38px !important;
        height: 30px !important;
        padding: 0 !important;
        font-size: 0.66rem !important;
        border-radius: 16px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* Make the 3D area shorter on mobile so the Recent Purchases section is below and reachable/visible. */
    #houseCanvas {
        height: calc(100svh - 170px) !important;
        min-height: 480px !important;
        max-height: 640px !important;
        touch-action: none !important;
    }

    #recentPanel {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        width: calc(100vw - 16px) !important;
        max-width: calc(100vw - 16px) !important;
        margin: 8px 8px 24px !important;
        min-height: 170px !important;
        max-height: none !important;
        overflow: visible !important;
        z-index: 20 !important;
    }

    #recentPanel .rp-header {
        font-size: 1.05rem !important;
        margin-bottom: 8px !important;
    }
}

@media (max-width: 390px) {
    .stats-counter {
        width: 166px !important;
        max-width: 166px !important;
    }
    .stats-counter .stat-pill {
        width: 166px !important;
        max-width: 166px !important;
        font-size: 0.66rem !important;
        padding-left: 7px !important;
        padding-right: 7px !important;
    }
    #goToBlockPanel {
        left: 224px !important;
    }
}

@media (max-width: 360px) {
    .stats-counter {
        width: 146px !important;
        max-width: 146px !important;
    }
    .stats-counter .stat-pill {
        width: 146px !important;
        max-width: 146px !important;
        font-size: 0.60rem !important;
    }
    #goToBlockPanel {
        left: 204px !important;
    }
    #goToBlockBtn {
        flex-basis: 34px !important;
        width: 34px !important;
        min-width: 34px !important;
        font-size: 0.62rem !important;
    }
}


/* ── FINAL MOBILE VIEWPORT / LOADING / CAMERA UI FIX ── */
@media (max-width: 700px) {
    body:not(.ui-ready) .stats-counter,
    body:not(.ui-ready) #goToBlockPanel,
    body:not(.ui-ready) #muteBtn,
    body:not(.ui-ready) #recentPanel {
        visibility: hidden !important;
        opacity: 0 !important;
    }

    html, body {
        overflow-x: hidden !important;
        overflow-y: auto !important;
        background: #87CEEB !important;
    }

    #houseCanvas {
        width: 100vw !important;
        height: min(60svh, 620px) !important;
        min-height: 430px !important;
        max-height: 620px !important;
        display: block !important;
        touch-action: none !important;
    }

    /* Keep the top mobile controls as one compact row under the nav. */
    #muteBtn,
    .stats-counter,
    #goToBlockPanel {
        top: 82px !important;
        bottom: auto !important;
        z-index: 1450 !important;
    }

    #muteBtn {
        left: 10px !important;
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
    }

    .stats-counter {
        left: 62px !important;
        right: auto !important;
        width: 310px !important;
        max-width: calc(100vw - 335px) !important;
        min-width: 190px !important;
        display: flex !important;
        flex-direction: row !important;
        pointer-events: none !important;
    }

    .stats-counter .stat-pill {
        width: 100% !important;
        max-width: none !important;
        height: 44px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0 12px !important;
        font-size: 0.86rem !important;
        line-height: 1 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: clip !important;
        border-radius: 24px !important;
        pointer-events: auto !important;
    }

    #goToBlockPanel {
        left: auto !important;
        right: 10px !important;
        width: 300px !important;
        max-width: 40vw !important;
        height: 44px !important;
        padding: 4px !important;
        border-radius: 24px !important;
        display: flex !important;
        align-items: center !important;
        gap: 5px !important;
        background: rgba(0,0,0,0.9) !important;
        box-shadow: 0 5px 18px rgba(0,0,0,0.4) !important;
    }

    #goToBlockPanel > div:first-child {
        display: none !important;
    }

    #goToBlockInput {
        flex: 1 1 auto !important;
        width: auto !important;
        min-width: 0 !important;
        height: 34px !important;
        padding: 5px 8px !important;
        font-size: 0.75rem !important;
        border-radius: 18px !important;
    }

    #goToBlockBtn {
        flex: 0 0 42px !important;
        width: 42px !important;
        min-width: 42px !important;
        height: 34px !important;
        padding: 0 !important;
        font-size: 0.68rem !important;
        border-radius: 18px !important;
    }

    #recentPanel {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        width: calc(100vw - 18px) !important;
        max-width: calc(100vw - 18px) !important;
        margin: 8px 9px 28px !important;
        min-height: 170px !important;
        max-height: none !important;
        overflow: visible !important;
        z-index: 20 !important;
    }

    body.mobile-selecting #recentPanel {
        display: none !important;
    }
}

@media (max-width: 430px) {
    .stats-counter {
        width: 260px !important;
        max-width: calc(100vw - 310px) !important;
        min-width: 180px !important;
    }
    .stats-counter .stat-pill {
        font-size: 0.78rem !important;
        padding: 0 8px !important;
    }
    #goToBlockPanel {
        width: 265px !important;
        max-width: 39vw !important;
    }
}

@media (max-width: 390px) {
    .stats-counter {
        left: 58px !important;
        min-width: 168px !important;
        max-width: calc(100vw - 286px) !important;
    }
    .stats-counter .stat-pill {
        font-size: 0.70rem !important;
    }
    #goToBlockPanel {
        right: 8px !important;
        max-width: 38vw !important;
    }
}

/* ─────────────────────────────────────────────────────────────
   FINAL MOBILE COMPACT HEADER + 2-ROW RECENT PURCHASES
   Keeps PC unchanged. Mobile only.
───────────────────────────────────────────────────────────── */
@media (max-width: 700px) {
    nav.top-nav {
        padding: 7px 14px !important;
        min-height: 46px !important;
        height: 46px !important;
    }

    nav.top-nav .nav-logo {
        font-size: 0.95rem !important;
        line-height: 1 !important;
        white-space: nowrap !important;
    }

    nav.top-nav .nav-links {
        gap: 14px !important;
    }

    nav.top-nav .nav-links a {
        font-size: 0.78rem !important;
        line-height: 1 !important;
    }

    #muteBtn,
    .stats-counter,
    #goToBlockPanel {
        top: 54px !important;
    }

    #muteBtn {
        left: 8px !important;
        width: 38px !important;
        height: 38px !important;
        min-width: 38px !important;
        font-size: 1.08rem !important;
    }

    .stats-counter {
        left: 54px !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        right: 160px !important;
    }

    .stats-counter .stat-pill {
        height: 38px !important;
        min-height: 38px !important;
        padding: 0 9px !important;
        font-size: 0.74rem !important;
        border-radius: 22px !important;
        justify-content: center !important;
    }

    .stats-counter .stat-pill span {
        font-size: 0.9rem !important;
    }

    #goToBlockPanel {
        right: 8px !important;
        width: 146px !important;
        max-width: 146px !important;
        height: 38px !important;
        min-height: 38px !important;
        padding: 3px !important;
        border-radius: 22px !important;
        gap: 4px !important;
    }

    #goToBlockInput {
        height: 30px !important;
        padding: 4px 7px !important;
        font-size: 0.72rem !important;
        border-radius: 16px !important;
    }

    #goToBlockBtn {
        flex: 0 0 38px !important;
        width: 38px !important;
        min-width: 38px !important;
        height: 30px !important;
        font-size: 0.66rem !important;
        border-radius: 16px !important;
    }

    #houseCanvas {
        height: min(62svh, 640px) !important;
        min-height: 410px !important;
    }

    #recentPanel {
        width: calc(100vw - 16px) !important;
        max-width: calc(100vw - 16px) !important;
        margin: 6px 8px 18px !important;
        min-height: 0 !important;
        max-height: 255px !important;
        overflow: hidden !important;
        padding: 12px 14px 10px !important;
    }

    #recentPanel .rp-header {
        font-size: 1.1rem !important;
        margin-bottom: 8px !important;
    }

    #recentPanel .rp-list {
        max-height: 116px !important;
        overflow-y: auto !important;
        padding-right: 4px !important;
    }

    #recentPanel .rp-item {
        min-height: 54px !important;
        padding: 6px 2px !important;
    }

    #recentPanel .rp-avatar,
    #recentPanel .rp-avatar img {
        width: 42px !important;
        height: 42px !important;
    }
}

@media (max-width: 390px) {
    .stats-counter {
        right: 146px !important;
    }

    .stats-counter .stat-pill {
        font-size: 0.66rem !important;
        padding: 0 6px !important;
    }

    #goToBlockPanel {
        width: 134px !important;
        max-width: 134px !important;
    }

    #goToBlockBtn {
        flex-basis: 34px !important;
        width: 34px !important;
        min-width: 34px !important;
    }
}



/* ─────────────────────────────────────────────
   EXTRA MOBILE SPACE FOR THE HOUSE
   Makes top strips + recent purchases thinner
   PC stays untouched
───────────────────────────────────────────── */
@media (max-width: 700px) {

    /* TOP NAVIGATION */
    nav.top-nav {
        height: 42px !important;
        min-height: 42px !important;
        padding: 4px 10px !important;
    }

    nav.top-nav .nav-logo {
        font-size: 0.88rem !important;
    }

    nav.top-nav .nav-links {
        gap: 10px !important;
    }

    nav.top-nav .nav-links a {
        font-size: 0.72rem !important;
    }

    /* TOP CONTROL ROW */
    #muteBtn,
    .stats-counter,
    #goToBlockPanel {
        top: 48px !important;
    }

    #muteBtn {
        width: 34px !important;
        height: 34px !important;
        min-width: 34px !important;
    }

    .stats-counter {
        left: 48px !important;
    }

    .stats-counter .stat-pill {
        height: 34px !important;
        min-height: 34px !important;
        font-size: 0.68rem !important;
        padding: 0 8px !important;
        border-radius: 18px !important;
    }

    .stats-counter .stat-pill span {
        font-size: 0.82rem !important;
    }

    #goToBlockPanel {
        height: 34px !important;
        min-height: 34px !important;
        border-radius: 18px !important;
        padding: 2px !important;
    }

    #goToBlockInput {
        height: 28px !important;
        font-size: 0.68rem !important;
    }

    #goToBlockBtn {
        height: 28px !important;
        width: 38px !important;
        min-width: 38px !important;
        font-size: 0.62rem !important;
    }

    /* GIVE HOUSE MORE ROOM */
    #houseCanvas {
        height: min(68svh, 720px) !important;
        min-height: 500px !important;
    }

    /* RECENT PURCHASES PANEL */
    #recentPanel {
        margin-top: 2px !important;
        margin-bottom: 10px !important;
        min-height: 135px !important;
        padding: 8px !important;
        border-radius: 16px !important;
    }

    /* RECENT PURCHASES TITLE */
    #recentPanel h3,
    #recentPanel .rp-title {
        font-size: 1rem !important;
        margin-bottom: 6px !important;
    }

    /* SEARCH */
    #recentPanel input {
        height: 30px !important;
        font-size: 0.7rem !important;
    }

    /* PURCHASE ITEMS */
    .rp-item,
    .purchase-item,
    .recent-item {
        min-height: 52px !important;
        padding: 5px !important;
    }

    .rp-item img,
    .purchase-item img,
    .recent-item img {
        width: 42px !important;
        height: 42px !important;
    }

    /* PURCHASE TEXT */
    .rp-item .name,
    .purchase-item .name,
    .recent-item .name {
        font-size: 0.78rem !important;
    }

    .rp-item .block,
    .purchase-item .block,
    .recent-item .block {
        font-size: 0.65rem !important;
    }

    /* RECENT PURCHASES SCROLL AREA */
    #recentPanel .rp-list {
        max-height: 130px !important;
    }
}
