:root {
    --bg-color: #1a1a2e;
    --glass-color: rgba(255, 255, 255, 0.1);
    --accent-color: #0f3460;
    --highlight-color: #00d2ff;
    /* Vibrant Cyan-Blue */
    --text-color: #fff;
    --font-main: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    background: #000;
    /* Fallback */
}

.main-container {
    display: flex;
    width: 100vw;
    height: 100vh;
}

.game-view {
    flex: 1;
    position: relative;
    background: #000;
    overflow: hidden;
}

/* Background Layers */
#game-layers {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
}

#layer-interior-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
    /* Hide sliding parts */
    opacity: 0.5;
    /* Fainter interior */
}

.bg-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

#bg-interior-current {
    z-index: 1;
}

#bg-interior-next {
    z-index: 1;
    top: 100%;
    /* Start below */
}

#layer-reflection {
    z-index: 5;
    /* Above interior */
    opacity: 0.7;
    /* More prominent reflection */
    /* Subtly transparent reflection */
    pointer-events: none;
    /* Let clicks pass through to canvas */
    /* Mix blend mode for better reflection look */
    mix-blend-mode: screen;
}

#office-bg {
    display: none;
    /* Legacy */
}

canvas {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    background: transparent;
    z-index: 10;
    /* Top layer for dirt */
}

canvas {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    background: transparent;
}

/* Toolbar Groups */
.tool-group {
    display: flex;
    gap: 10px;
}

.toolbar-divider {
    width: 1px;
    height: 30px;
    background: rgba(255, 255, 255, 0.2);
    align-self: center;
}

.tool-group.secondary {
    gap: 15px;
}

.key-hint {
    position: absolute;
    top: 4px;
    left: 4px;
    font-size: 0.6rem;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.5);
    background: rgba(0, 0, 0, 0.3);
    padding: 1px 4px;
    border-radius: 3px;
    line-height: 1;
    pointer-events: none;
}

.tool.active .key-hint {
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
}

.tool {
    display: flex;
    flex-direction: column;
    /* Stack if we had text, but we don't */
    align-items: center;
    justify-content: center;
    padding: 0;
    width: 48px;
    height: 48px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.1s ease;
    border: 2px solid rgba(255, 255, 255, 0.05);
    position: relative;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.tool:active {
    transform: scale(0.95);
}

.tool.active {
    background: var(--highlight-color);
    border-color: var(--highlight-color);
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.6);
}

.tool .icon {
    font-size: 1.8rem;
    margin: 0;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.3));
}

.tool .label,
.tool .key {
    display: none;
    /* Hide labels/keys for clean look */
}

/* Custom Squeegee Icon */
.squeegee-icon-css {
    width: 32px;
    height: 32px;
    position: relative;
}

.squeegee-icon-css::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 4px;
    width: 24px;
    height: 4px;
    background: #fff;
    border-radius: 2px;
}

.squeegee-icon-css::after {
    content: '';
    position: absolute;
    top: 14px;
    left: 14px;
    width: 4px;
    height: 12px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 2px;
}

.tool.active .squeegee-icon-css::before {
    background: #fff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.tool-mini {
    position: relative;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.5rem;
    transition: all 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.tool-mini:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

/* Overlay UI */
#game-ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
}

#top-toolbar {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px 20px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

#stats-container {

    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    pointer-events: none;
    z-index: 60;
}

.score-display {
    position: relative;
    top: auto;
    right: auto;
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    padding: 10px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-width: 60px;
}

.score-display .value {
    font-size: 1.25rem;
    /* Halved from 2.5rem */
    font-weight: 800;
    color: #fff;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    letter-spacing: -1px;
    /* Reduced spacing */
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.score-display .label {
    font-size: 0.4rem;
    /* Halved from 0.8rem */
    color: var(--highlight-color);
    font-weight: bold;
    letter-spacing: 1px;
    margin-top: 2px;
    margin-left: 0;
}


/* Location Modal Styles */
#location-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: auto;
    height: auto;
    background: transparent;
    display: block;
    z-index: 200;
    pointer-events: none;
}

.location-modal-content {
    pointer-events: auto;
    width: 380px;
    /* Compact width for floating panel */
    max-height: 80vh;
    background: #16213e;
    padding: 1.5rem;
    border-radius: 20px;
    border: 1px solid rgba(100, 150, 255, 0.15);
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.location-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 25px;
    overflow-y: auto;
    padding-right: 10px;
    /* Space for scrollbar */
}

.location-card {
    height: 140px;
    border-radius: 15px;
    background-size: cover;
    background-position: center;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.location-card:hover {
    /* Hover transform removed to avoid double-tap phase */
}

.location-name {
    width: 100%;
    padding: 12px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    text-align: center;
    backdrop-filter: blur(4px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    align-self: flex-end;
}

.custom-card {
    background: rgba(255, 255, 255, 0.05);
}

.custom-card .location-name {
    align-self: center;
    background: transparent;
    border: none;
}

.hidden {
    display: none !important;
}


/* Level Complete Panel - Linked to Score */
.status-panel {
    position: relative;
    background: rgba(22, 33, 62, 0.95);
    padding: 0.75rem;
    border-radius: 0.5rem;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 100;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    min-width: 125px;
    pointer-events: auto;
    animation: slideInDown 0.3s ease-out;
}

@keyframes slideInDown {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.status-panel.hidden {
    display: none;
}

.status-message {
    color: #fff;
    font-weight: bold;
    font-size: 0.8rem;
    /* Almost halved from 1.5rem */
    /* Larger */
    margin-bottom: 0.75rem;
    /* Halved */
    letter-spacing: 0.05rem;
}

#restart-btn {
    background: var(--highlight-color);
    color: white;
    border: none;
    padding: 0.4rem 1rem;
    /* Halved from 0.8rem 2rem */
    font-size: 0.6rem;
    /* Halved from 1.1rem approx */
    border-radius: 1rem;
    /* Pill shape */
    cursor: pointer;
    font-family: var(--font-main);
    width: auto;
    /* Nature width */
    transition: all 0.2s;
    text-transform: uppercase;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 210, 255, 0.4);
}

#restart-btn:hover {
    background: #5ef8ff;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 210, 255, 0.6);
}

/* Modals */
#url-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

#dev-modal {
    position: fixed;
    /* Fixed to stay on screen, but positioned by JS */
    /* No background dimming for popover feel */
    background: transparent;
    display: block;
    /* Not flex center anymore */
    width: auto;
    height: auto;
    z-index: 110;
    pointer-events: none;
    /* Let clicks pass through outside content */
}

#dev-modal .modal-content {
    pointer-events: auto;
    /* Re-enable clicks on content */
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin: 0;
    /* Remove potential auto margins */
}

#url-modal.hidden,
#dev-modal.hidden {
    display: none;
}

.modal-content {
    background: #16213e;
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid rgba(100, 150, 255, 0.15);
    text-align: center;
    width: 320px;
}

.settings-modal {
    width: 350px;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    color: white;
}

.setting-row label {
    text-align: left;
    margin-right: 1rem;
    font-size: 0.9rem;
    min-width: 120px;
}

.setting-row input {
    cursor: pointer;
    flex-grow: 1;
}

/* ... keep modal content styles same ... */

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translate(50px, -50%);
    }

    to {
        opacity: 1;
        transform: translate(0, -50%);
    }
}