: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);
    z-index: 100;
}

#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-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);
}


/* --- Version 0.9 Full-Screen Overlays --- */

#menu-screen,
#settings-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 10, 20, 0.9);
    backdrop-filter: blur(25px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5000;
    transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
}

#menu-screen.hidden,
#settings-screen.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(1.1);
    visibility: hidden;
}

/* Glassmorphic Container Blobs */
.menu-blob,
.settings-blob {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 40px;
    padding: 4rem;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.8),
        inset 0 0 20px rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    width: 90%;
    max-width: 600px;
    animation: blobAppear 0.8s cubic-bezier(0.19, 1, 0.22, 1);
}

@keyframes blobAppear {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.game-title {
    font-size: 4rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: -3px;
    background: linear-gradient(to bottom, #fff, #00d2ff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 3rem;
    text-align: center;
    filter: drop-shadow(0 0 10px rgba(0, 210, 255, 0.3));
}

.menu-buttons-v2 {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
}

.big-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 1.5rem;
    border-radius: 20px;
    font-size: 1.5rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.big-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
    border-color: var(--highlight-color);
    box-shadow: 0 0 40px rgba(0, 210, 255, 0.3);
}

.big-btn.primary {
    background: var(--highlight-color);
    color: #000;
    border: none;
}

.big-btn.primary:hover {
    background: #fff;
    box-shadow: 0 0 50px rgba(255, 255, 255, 0.5);
}

/* Zen & Arcade Buttons */
.career-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
}

.career-wrapper .big-btn {
    width: 100%;
}

/* Timer HUD (50% Shrunk Scale) */
#timer-hud {
    padding: 0.6rem 1rem !important;
    gap: 0.4rem !important;
    margin-bottom: 5px;
    background: rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

#timer-hud .stat-item {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1;
    position: relative;
}

/* Clear Record Hover State */
.stat-item.interactive {
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 4px;
    padding: 2px 4px;
    margin-right: -4px;
    pointer-events: auto;
    /* Ensure events are captured */
}

.stat-item.interactive:hover {
    background: rgba(255, 0, 0, 0.2);
}

.clear-prompt {
    display: none;
    color: #ff3333;
    font-weight: 900;
    font-size: 0.9rem;
    letter-spacing: -0.5px;
    text-transform: uppercase;
    white-space: nowrap;
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}

.stat-item.interactive:hover .stat-value,
.stat-item.interactive:hover .stat-label {
    opacity: 0 !important;
}

.stat-item.interactive:hover .clear-prompt {
    display: block;
    animation: pulseRed 0.5s infinite alternate;
}

@keyframes pulseRed {
    from {
        transform: translateY(-50%) scale(1);
        filter: drop-shadow(0 0 5px rgba(255, 0, 0, 0.5));
    }

    to {
        transform: translateY(-50%) scale(1.1);
        filter: drop-shadow(0 0 15px rgba(255, 0, 0, 0.8));
    }
}

/* Burst Celebration */
#record-celebration {
    position: absolute;
    top: 50%;
    left: -10px;
    transform: translate(-100%, -50%);
    pointer-events: none;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    background: transparent !important;
    backdrop-filter: none !important;
    width: auto !important;
    height: auto !important;
}

#record-celebration.hidden {
    display: none !important;
}

.celebration-burst {
    font-size: 1.5rem;
    font-weight: 900;
    color: #ffd700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.8), 0 0 40px rgba(255, 215, 0, 0.4);
    white-space: nowrap;
    background: linear-gradient(to bottom, #fff, #ffd700);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: burstPop 2.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes burstPop {
    0% {
        transform: scale(0) rotate(-10deg);
        opacity: 0;
    }

    10% {
        transform: scale(1.2) rotate(5deg);
        opacity: 1;
    }

    20% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }

    80% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }

    100% {
        transform: scale(1.5) translateY(-50px);
        opacity: 0;
    }
}

/* Settings Blobs */
.settings-blob {
    max-height: 90vh;
    overflow-y: auto;
    padding: 1.5rem;
    gap: 0.75rem;
    display: block !important;
    max-width: 450px;
}

.settings-group-v2 {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    padding: 1rem;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 1rem;
}

.settings-group-v2 h3 {
    font-size: 0.7rem;
    color: var(--highlight-color);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.settings-row-v2 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    gap: 0.75rem;
}

.settings-row-v2 label {
    flex: 1;
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
}

.settings-row-v2 input[type="range"] {
    flex: 1.2;
    height: 4px;
    accent-color: var(--highlight-color);
}

.settings-actions {
    display: flex;
    gap: 0.75rem;
    width: 100%;
    margin-top: 0.5rem;
    position: sticky;
    bottom: 0;
    background: transparent;
    padding-top: 0.5rem;
}

.settings-actions .big-btn {
    flex: 1;
    font-size: 0.7rem;
    padding: 0.6rem;
    border-radius: 10px;
}

.btn-danger {
    background: rgba(255, 0, 0, 0.12);
    border-color: rgba(255, 0, 0, 0.3);
    color: #ff6b6b;
}

.btn-danger:hover {
    background: #ff0000;
    color: #fff;
    border-color: #ff0000;
    box-shadow: 0 0 30px rgba(255, 0, 0, 0.4);
}

#url-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 6000;
}