/* static/game.css
   Game-specific styles - focus controller, world view, ads, etc.
   Extracted from style.css for better maintainability
*/

/* control panel */

.control-panel {
    position: fixed;
    left: 0;
    right: 0;
    width: 100%;
    bottom: 0;
    pointer-events: none;
    box-sizing: border-box;
    border: 0px solid transparent; /* Debug border removed for production */
    z-index: calc(var(--z-content) + 1000);
    /* Remove flex layout since all controllers now use absolute positioning */
}


.map-power-controller{
  /* Use absolute positioning for consistent baseline with other controllers */
  position: absolute;
  left: 50%;
  transform: translateX(-50%); /* center horizontally */
  margin: 0;
  bottom: calc(var(--header-height) + var(--space-lg)); /* vertical baseline */

  --ring-size: 70px;
  --btn-size: 30px;
  --gap: 30px;
  --col-gap: 12px;
  --v-step: 36px;

  height: var(--ring-size);
  width: -moz-fit-content;
  width: fit-content;        /* keep intrinsic width so centering is exact */
  pointer-events: auto;
  z-index: var(--z-content);
  box-sizing: border-box;
}
.power-spot {
    /* Consolidated power spot: non-interfering decorative center spot
       Keep it slightly smaller than the ring, visually prominent but
       not intercepting clicks intended for the semicircle halves. */
    position: absolute;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    z-index: 2;
    pointer-events: none; /* allow power-half buttons to receive clicks */
    background: radial-gradient(circle at 30% 30%, var(--roller-color), #222);
    transition: transform 180ms cubic-bezier(.22,.9,.25,1), filter 180ms linear, box-shadow 180ms cubic-bezier(.22,.9,.25,1);
    will-change: transform, filter, box-shadow;
}
.power-ring {
    width: 70px;
    height: 70px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    /* remove the old border; halves will render it */
    /* border: 6px solid var(--text-color); */
    border-radius: 50%;
    box-sizing: border-box;
}

/* shared half styles */
.power-half {
    position: absolute;
    inset: 0;                       /* fill the ring */
    border-radius: 50%;
    border: 6px solid var(--text-color);
    
    box-sizing: border-box;
    pointer-events: auto;
    -webkit-appearance: none;
    appearance: none;
    transition: background-color .12s ease, filter .12s ease;
    z-index: 1;
}

/* show only top semicircle border */
.power-top {
    clip-path: inset(0 0 50% 0);    /* keep top half visible */
    background: rgba(223, 192, 16, 0.823);
    border-bottom-color: transparent; /* hide bottom edge so halves meet cleanly */
}

/* show only bottom semicircle border */
.power-bottom {
    clip-path: inset(50% 0 0 0);    /* keep bottom half visible */
    background: rgba(255,215,0,0.5);
    border-top-color: transparent;  /* hide top edge */
}

/* unified hover / active visual (same effect for both halves) */
.power-half:hover,
.power-half:active,
.power-half.active {
    background-color: rgba(255,255,255,0.06); /* subtle brighten */
    filter: brightness(1.06);
    cursor: pointer;
}

/* keep the central spot on top and non-interfering (no duplicate rule) */

/* gentle bump + brighten when ring hovered or when its buttons receive keyboard focus */
.power-ring:hover .power-spot,
.power-ring:focus-within .power-spot,
.power-half:focus ~ .power-spot {
    transform: translateY(-2px) scale(1.06);
    filter: brightness(1.06);
    box-shadow: 0 8px 18px rgba(206, 149, 5, 0.775);
}

/* pressed state (smaller depression) */
.power-half:active ~ .power-spot,
.power-ring .power-half:active ~ .power-spot {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 3px 6px rgba(0,0,0,0.18);
}

/* respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .power-spot {
        transition: none;
    }
    .power-ring:hover .power-spot,
    .power-ring:focus-within .power-spot {
        transform: none;
        filter: none;
        box-shadow: none;
    }
}
/* ===== ROLLER CONTROLLER ===== */

/* Position roller controller to the right side of the control panel */
.map-roller-controller {
    /* Use absolute positioning to place on right side, matching power controller's vertical baseline */
    position: absolute;
    right: var(--toolbar-width);              /* position from right edge of parent */
    bottom: calc(var(--header-height) + var(--space-lg)); /* same vertical baseline as power controller */
    margin: 0;

    /* sizing/layout variables (unchanged) */
    --ring-size: 70px;
    --btn-size: 30px;
    --gap: 10px;
    --col-gap: 12px;
    --v-step: 36px;

    height: var(--ring-size);
    width: -moz-fit-content;
    width: fit-content;        /* intrinsic width so positioning of mode buttons stays relative */
    pointer-events: auto;
    z-index: var(--z-content);
    box-sizing: border-box;
}

/* ensure the ring itself is positioned correctly within the roller controller */
.map-roller-controller > .roller-ring {
    position: relative;
    top: 0;
    left: 0;
    transform: none;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 8;
}

.roller-ring {
    width: 70px;
    height: 70px;
    border: 6px solid var(--text-color);
    border-radius: 50%;
    position: relative;
    /* Remove flex properties that interfere with absolute positioning */
    box-sizing: border-box;
    pointer-events: auto; /* ALLOW pointer events to reach children - SAME AS FOCUS-RING */
    z-index: 5;
}

.roller-spot {
    width: 40px; /* Make it larger for easier clicking */
    height: 40px;
    background: radial-gradient(circle at 30% 30%, var(--roller-color), #222);
    border-radius: var(--border-radius-full);
    cursor: grab;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%); /* center it perfectly */
    z-index: 90000;
    pointer-events: auto; /* enable mouse/touch interaction for dragging */
}

.roller-spot:active {
    padding-right: var(--space-md);
    cursor: grabbing;
}

.roller-ring:has(.roller-spot:active) {
    animation: rollerGlow 1.5s ease-in-out infinite;
}
/* mode buttons are positioned absolutely relative to .map-roller-controller */
/* first column (three) - immediate left of ring */
.map-roller-controller > .roller-boost-mode {
    right: calc(var(--ring-size) + var(--gap));
    top: calc(50% - var(--v-step) - (var(--btn-size) / 2));
}
.map-roller-controller > .roller-run-mode {
    right: calc(var(--ring-size) + var(--gap));
    top: calc(50% - (var(--btn-size) / 2));
}
.map-roller-controller > .roller-stealth-mode {
    right: calc(var(--ring-size) + var(--gap));
    top: calc(50% + var(--v-step) - (var(--btn-size) / 2));
}

/* second column (two) - left of the first column and staggered */
.map-roller-controller > .roller-robot-mode {
    right: calc(var(--ring-size) + var(--gap) + var(--btn-size) + var(--col-gap));
    top: calc(50% - (var(--v-step) / 2) - (var(--btn-size) / 2));
}
.map-roller-controller > .roller-joy_mode {
    right: calc(var(--ring-size) + var(--gap) + var(--btn-size) + var(--col-gap));
    top: calc(50% + (var(--v-step) / 2) - (var(--btn-size) / 2));
}

/* third column single button, left of the second column and centered between them */
.map-roller-controller > .roller-extra-mode {
    right: calc(var(--ring-size) + var(--gap) + 2 * (var(--btn-size) + var(--col-gap)));
    top: calc(50% - (var(--btn-size) / 2));
}

/* ===== MODE BUTTONS - Independent Toggle System ===== */
/* Base styling for all mode buttons */
.roller-boost-mode,
.roller-run-mode, 
.roller-stealth-mode,
.roller-robot-mode,
.roller-joy_mode {
    position: absolute;
    width: var(--btn-size);
    height: var(--btn-size);
    border-radius: 6px;
    background: var(--surface-elevated, rgba(255,255,255,0.02));
    border: 1px solid rgba(255,255,255,0.03);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--icon-color);
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    transition: transform var(--transition-base), background var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base);
    z-index: var(--z-content);
    cursor: pointer;
}

/* Material Icons inside mode buttons */
.roller-boost-mode .material-symbols-outlined,
.roller-run-mode .material-symbols-outlined,
.roller-stealth-mode .material-symbols-outlined,
.roller-robot-mode .material-symbols-outlined,
.roller-joy_mode .material-symbols-outlined {
    font-size: 18px !important;
    transition: color var(--transition-base);
    color: inherit; /* Inherit from parent */
}

/* Hover state */
.roller-boost-mode:hover,
.roller-run-mode:hover,
.roller-stealth-mode:hover,
.roller-robot-mode:hover,
.roller-joy_mode:hover {
    transform: translateY(-2px);
    background: rgba(255,255,255,0.06);
    border-color: transparent;
}

/* Active state - only changes color */
.roller-boost-mode.active,
.roller-run-mode.active,
.roller-stealth-mode.active,
.roller-robot-mode.active,
.roller-joy_mode.active {
    color: var(--accent-color);
    transform: translateY(-2px);
    background: rgba(255,255,255,0.06);
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(126, 173, 247, 0.3);
}







/* ===== FOCUS CONTROLLER ===== */

.map-focus-controller {
    position: absolute; /* changed from relative to absolute for precise positioning */
    left: var(--toolbar-width);  /* position to the right of the left perimeter arm */
    bottom: calc(var(--header-height) + var(--space-lg)); /* same vertical baseline as power controller */
    
    --ring-size: 70px;    /* match .roller-ring size */
    --btn-size: 30px;     /* desired button size */
    --gap: 30px;          /* horizontal gap from the ring for first column */
    --col-gap: 12px;      /* horizontal gap between columns */
    --v-step: 36px;       /* vertical step between top/mid/bottom first-column centers */
    width: calc(var(--ring-size) + (var(--gap) + var(--btn-size) + var(--col-gap) * 2) + 20px);
    height: var(--ring-size);
    z-index: var(--z-content);
    pointer-events: auto;
}






.focus-ring {
    width: 70px;
    height: 70px;
    border: 6px solid var(--text-color);
    border-radius: var(--border-radius-full);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}


.focus-ring:has(.focus-up-arrow:active),
.focus-ring:has(.focus-down-arrow:active),
.focus-ring:has(.focus-spot-slider:active) {
    animation: rollerGlow 1.5s ease-in-out infinite;
}

/* Up arrow triangle */
.focus-up-arrow {
    position: absolute;
    top: 2px;
    left: 50%;
    width: 32px;
    height: 20px;
    cursor: pointer;
    transition: all var(--transition-fast);
    z-index: 6; /* above track and spot */
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto !important;
    user-select: none;
    transform: translateX(-50%);
}

.focus-up-arrow::before {
    content: '';
    width: 0;
    height: 0;
    border-left: 16px solid transparent;
    border-right: 16px solid transparent;
    border-bottom: 14px solid var(--text-color);
    border-radius: 6px;
}

.focus-up-arrow:hover {
    opacity: 0.8;
}

.focus-up-arrow:active,
.focus-up-arrow.keyboard-active,
.focus-up-arrow.active {
    opacity: 0.6;
    filter: drop-shadow(0 0 8px var(--text-color));
    color: #FF4444; /* Red color for active state */
}

.focus-up-arrow:hover::before {
    border-bottom-color: var(--text-color);
}

/* Down arrow triangle */
.focus-down-arrow {
    position: absolute;
    bottom: 2px;
    left: 50%;
    width: 32px;
    height: 20px;
    cursor: pointer;
    transition: all var(--transition-fast);
    z-index: 6; /* above track and spot */
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto !important;
    user-select: none;
    transform: translateX(-50%);
}

.focus-down-arrow::before {
    content: '';
    width: 0;
    height: 0;
    border-left: 16px solid transparent;
    border-right: 16px solid transparent;
    border-top: 14px solid var(--text-color);
    border-radius: 6px;
}

.focus-down-arrow:hover {
    opacity: 0.8;
}

.focus-down-arrow:active,
.focus-down-arrow.keyboard-active,
.focus-down-arrow.active {
    opacity: 0.6;
    filter: drop-shadow(0 0 8px var(--text-color));
    color: #FF4444; /* Red color for active state */
}

.focus-down-arrow:hover::before {
    border-top-color: var(--text-color);
}

/* Horizontal slider track */
.focus-slider-track {
    position: absolute;
    top: 50%;
    left: 15px;
    right: 15px;
    height: 12px;
    background: rgba(224, 224, 224, 0.3);
    border-radius: 6px;
    transform: translateY(-50%);
    cursor: pointer;
    padding: 4px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3; /* below arrows and spot */
}

.focus-slider-track::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 4px; /* Visual track height */
    background: rgba(224, 224, 224, 0.3);
    border-radius: 2px;
    transform: translateY(-50%);
}

/* Slider spot that moves left/right */
.focus-spot-slider {
    position: absolute;
    width: 26px;
    height: 26px;
    background: radial-gradient(circle at 30% 30%, var(--roller-color), #222);
    border-radius: var(--border-radius-full);
    cursor: grab;
    transition: transform var(--transition-fast);
    z-index: 7; /* above arrows (which have z-index: 6) */
    user-select: none;
    pointer-events: auto !important;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.focus-spot-slider:active {
    cursor: grabbing;
    transform: translate(-50%, -50%) scale(1.1);
}

.focus-spot-slider.dragging {
    cursor: grabbing;
    transition: none;
}

/* ===== WORLD VIEW CANVAS ===== */
.view-content.world-view #world-canvas {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    /* Mobile Safari incognito mode compatibility */
    min-width: 100vw !important;
    min-height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    pointer-events: auto !important; /* FIXED: Allow mouse events for camera controls */
    z-index: var(--z-behind) !important;
    display: block !important;
    visibility: visible !important;
}

/* Mobile Safari incognito mode specific fixes */
@supports (-webkit-touch-callout: none) {
    .view-content.world-view #world-canvas {
        width: 100% !important;
        height: 100% !important;
        position: absolute !important;
    }
    
    .view-content.world-view {
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
    }
}

#preserved-world-anchor #world-canvas.preserve-hidden {
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Fixed inline styles from HTML */
#preserved-world-anchor {
    position: fixed;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: var(--z-behind);
    pointer-events: none;
}

#world-canvas {
    position: fixed;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    visibility: visible;
    pointer-events: none;
    z-index: var(--z-behind);
    background-color: #000000;
}

/* ===== AD COMPONENTS (merged from ads.css) ===== */
.display-ad-credits-overlay {
    position: absolute;
    top: var(--space-lg);
    right: var(--space-lg);
    z-index: var(--z-modal);
}

.display-ad-credits {
    background-color: rgba(0, 0, 0, 0.7);
    color: var(--success-color);
    font-size: var(--font-size-xl);
    padding: 5px var(--space-lg);
    border-radius: var(--border-radius-sm);
    font-weight: bold;
}

.show-more-container,
.request-next-ad-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 250px;
    width: 100%;
    background-color: #f5f5f5;
    padding: var(--space-xxxl);
    box-sizing: border-box;
}

.request-next-ad-container {
    height: 150px;
    border: 2px dashed #ccc;
    border-radius: var(--border-radius-lg);
}

.show-more-ads-btn {
    background-color: var(--success-color);
    color: white;
    border: none;
    padding: calc(var(--space-xxl) + 2px) calc(var(--space-xxxl) + 2px);
    font-size: calc(var(--font-size-lg) + 4px);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: background-color var(--transition-slow);
}

.show-more-ads-btn:hover {
    background-color: var(--success-hover);
}

.request-next-ad-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: calc(var(--space-xxl) + 2px) calc(var(--space-xxxl) + 2px);
    font-size: calc(var(--font-size-lg) + 4px);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: background-color var(--transition-slow);
    margin: var(--space-lg);
}

.request-next-ad-btn:hover {
    background-color: var(--primary-hover);
}

/* Ad wrapper and watching components */
#ad-wrapper {
    position: absolute;
    top: var(--header-height);
    left: var(--toolbar-width);
    right: var(--toolbar-width);
    bottom: var(--header-height);
    z-index: var(--z-modal);
    overflow: auto;
    display: none;
}

.game-container.work-view-active #ad-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.game-container.work-view-active #game-content-wrapper {
    display: none;
}

.ad-watching-page {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.ad-watching-toolbar {
    background-color: var(--panel-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 11px var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-xl);
    height: var(--header-height);
    box-sizing: border-box;
    flex-wrap: nowrap;
}

.ad-watching-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: var(--space-lg);
    gap: 0;
}

.advert-slot {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius-lg);
    background-color: rgba(42, 42, 42, 0.3);
    min-height: 300px;
    max-width: 100%;
    padding: var(--space-lg);
    box-sizing: border-box;
    min-width: 0;
}

.advert-slot #div-gpt-ad-slot-1,
.advert-slot #div-gpt-ad-1755837729011-0 {
    max-width: 100%;
    width: auto !important;
    height: auto !important;
}

/* ===== COMPONENT-SPECIFIC STYLES (CONDENSED) ===== */

/* Auth panels */
.auth-panel {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.auth-panel input,
.auth-panel button {
    padding: calc(var(--space-lg) + 2px) calc(var(--space-lg) + 2px);
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    border-radius: var(--border-radius-sm);
    font-size: calc(var(--font-size-base) + 4px);
}

.auth-panel button {
    background-color: var(--accent-color);
    color: #111;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.auth-panel button:hover {
    color: var(--accent-color);
}

/* Fixed inline styles from HTML */
#profile-modal-health {
    color: #b71c1c;
    font-weight: bold;
}

#ai-chat-loading {
    text-align: center;
    padding: 5px;
    color: var(--dim-text);
}

#div-gpt-ad-1755414206069-0,
#div-gpt-ad-slot-1,
#div-gpt-ad-1755837729011-0 {
    min-width: 320px;
    min-height: 50px;
}

/* ===== HALO MENU SYSTEM ===== */
#halo-menu {
    position: fixed;
    z-index: var(--z-tooltip);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

#halo-menu.visible {
    opacity: 1;
    visibility: visible;
}

#halo-menu.fading-out {
    opacity: 0;
    visibility: hidden;
}

#halo-actions {
    position: relative;
    display: flex;
    gap: var(--space-sm);
    align-items: center;
    justify-content: center;
    min-width: 200px;
    height: 40px;
}

.halo-action {
    background: var(--dark-panel-bg);
    color: var(--icon-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-full);
    width: 39px;
    height: 39px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    pointer-events: auto;
    font-size: 20px;
    font-family: 'Material Symbols Outlined', monospace;
    position: absolute;
    transform-origin: center;
}

.halo-action:hover {
    background: var(--light-panel-bg);
    color: var(--icon-hover);
    border-color: var(--accent-color);
    box-shadow: 0 2px 8px rgba(126, 173, 247, 0.3);
    transform: scale(1.1);
}

/* Curved positioning for halo buttons */
.halo-action:nth-child(1) { transform: rotate(-60deg) translateY(-80px) rotate(60deg); }
.halo-action:nth-child(2) { transform: rotate(-30deg) translateY(-80px) rotate(30deg); }
.halo-action:nth-child(3) { transform: rotate(0deg) translateY(-80px) rotate(0deg); }
.halo-action:nth-child(4) { transform: rotate(30deg) translateY(-80px) rotate(-30deg); }
.halo-action:nth-child(5) { transform: rotate(60deg) translateY(-80px) rotate(-60deg); }

.halo-action:hover:nth-child(1) { transform: rotate(-60deg) translateY(-80px) rotate(60deg) scale(1.1); }
.halo-action:hover:nth-child(2) { transform: rotate(-30deg) translateY(-80px) rotate(30deg) scale(1.1); }
.halo-action:hover:nth-child(3) { transform: rotate(0deg) translateY(-80px) rotate(0deg) scale(1.1); }
.halo-action:hover:nth-child(4) { transform: rotate(30deg) translateY(-80px) rotate(-30deg) scale(1.1); }
.halo-action:hover:nth-child(5) { transform: rotate(60deg) translateY(-80px) rotate(-60deg) scale(1.1); }

#halo-tooltip {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--panel-bg);
    color: var(--text-color);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--border-radius-sm);
    font-size: var(--font-size-xs);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
    border: 1px solid var(--border-color);
}

#halo-tooltip.visible {
    opacity: 1;
    visibility: visible;
}

/* ===== MOBILE & RESPONSIVE GAME STYLES ===== */

/* TOOLBAR OVERFLOW FUNCTIONALITY */
/* Right toolbar overflow for mobile portrait mode */
@media (max-width: 768px) and (orientation: portrait) {
    .perimeter-right {
        overflow: hidden;
        max-height: calc(100vh - var(--header-height) - var(--header-height) - 40px);
        position: relative;
    }
    
    .perimeter-right.overflow-expanded {
        overflow: visible;
        max-height: none;
    }
    
    .perimeter-right .header-icon:nth-child(n+6) {
        display: none;
    }
    
    .perimeter-right.overflow-expanded .header-icon:nth-child(n+6) {
        display: flex;
    }
    
    /* Overflow indicator/toggle button styling */
    .toolbar-overflow-toggle {
        position: absolute;
        bottom: -2px;
        left: 50%;
        transform: translateX(-50%);
        width: 36px;
        height: 20px;
        background: var(--dark-panel-bg);
        border: 1px solid var(--border-color);
        border-radius: 8px 8px 0 0;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        z-index: calc(var(--z-perimeter) + 1);
        transition: all var(--transition-fast);
    }
    
    .toolbar-overflow-toggle:hover {
        background: var(--light-panel-bg);
        border-color: var(--accent-color);
    }
    
    .toolbar-overflow-toggle .material-symbols-outlined {
        font-size: 16px;
        color: var(--icon-color);
        transition: transform var(--transition-fast);
    }
    
    .perimeter-right.overflow-expanded .toolbar-overflow-toggle .material-symbols-outlined {
        transform: rotate(180deg);
    }
}

/* Mobile scrolling */
@media (max-width: 768px) {
    body.work-view-active, html {
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    .game-container {
        grid-template-columns: 1fr var(--toolbar-width);
        grid-template-rows: var(--header-height) 1fr;
        grid-template-areas:
            "header       header"
            "main-scene   main-toolbar";
    }
    
    .game-container.work-view-active .view-content {
        overflow-y: auto;
        height: auto;
        min-height: calc(100vh - var(--header-height));
    }
    
    /* Mobile positioning for roller controller */
    .map-focus-controller {
        position: fixed !important;
        bottom: calc(var(--header-height) + var(--space-lg)) !important;
        left: var(--space-lg) !important;
        z-index: calc(var(--z-perimeter) + 10) !important;
    }
    
    /* Mobile positioning for focus controller */
    .Xfocus-controller,
    .contained-by-perimeter .Xfocus-controller {
        position: fixed !important;
        bottom: calc(var(--header-height) + var(--space-lg)) !important;
        right: calc(var(--toolbar-width) + var(--space-lg)) !important;
        left: auto !important;
        transform: none !important;
        z-index: calc(var(--z-content) + 10) !important;
    }
}

/* Tablet positioning */
@media (min-width: 769px) and (max-width: 1024px) {
    /* Tablet positioning for roller controller */
    .map-focus-controller {
        position: fixed !important;
        bottom: calc(var(--header-height) + var(--space-lg)) !important;
        left: var(--space-xxxl) !important;
        z-index: calc(var(--z-perimeter) + 10) !important;
    }
    
    /* Tablet positioning for focus controller */
    .Xfocus-controller,
    .contained-by-perimeter .Xfocus-controller {
        position: fixed !important;
        bottom: calc(var(--header-height) + var(--space-lg)) !important;
        right: calc(var(--toolbar-width) + var(--space-xxxl)) !important;
        left: auto !important;
        transform: none !important;
        z-index: calc(var(--z-content) + 10) !important;
    }
}

/* --- Agent override: ensure focus controller aligns with power controller baseline --- */
/* This ensures the focus controller sits at the correct position and
   that touch/pointer interactions are not accidentally intercepted. */
.map-focus-controller {
    position: absolute !important;
    left: 50px !important; /* Position to the right of the left perimeter arm */
    bottom: calc(var(--header-height) + var(--space-lg)) !important; /* Match power controller vertical baseline */
    transform: none !important;
    touch-action: none; /* prefer explicit pointer handling */
    z-index: 9900 !important; /* Keep high z-index to avoid splash screen issues */
    pointer-events: auto !important;
}

/* ===== HALO MENU ===== */
/* Halo menu */
.halo-menu {
    position: absolute;
    pointer-events: none;
    z-index: var(--z-modal);
    transform: translate(-50%, -100%);
    opacity: 0;
    transition: opacity 0.3s ease-in-out, transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    /* Initial state for entrance animation */
    transform: translate(-50%, -100%) scale(0.8) translateY(-10px);
}

.halo-menu.visible {
    opacity: 1;
    pointer-events: all;
    /* Final state after entrance animation */
    transform: translate(-50%, -100%) scale(1) translateY(0px);
}

.halo-menu.fading-out {
    opacity: 0;
    transition: opacity 0.3s ease-out;
    pointer-events: none;
}

.halo-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    /* Create curved arrangement */
    margin-bottom: 15px;
}

.halo-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: var(--text-color);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    margin-bottom: 8px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-in-out;
}

.halo-tooltip.visible {
    opacity: 1;
}

.halo-button-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* Create curved effect by positioning buttons in an arc */
.halo-button-wrapper:nth-child(1) {
    transform: rotate(-35deg) translateY(-15px) rotate(35deg);
}

.halo-button-wrapper:nth-child(2) {
    transform: rotate(-18deg) translateY(-8px) rotate(18deg);
}

.halo-button-wrapper:nth-child(3) {
    transform: rotate(0deg) translateY(0px) rotate(0deg);
}

.halo-button-wrapper:nth-child(4) {
    transform: rotate(18deg) translateY(-8px) rotate(-18deg);
}

.halo-button-wrapper:nth-child(5) {
    transform: rotate(35deg) translateY(-15px) rotate(-35deg);
}

/* Add hover animation to curve effect */
.halo-button-wrapper:hover {
    transform-origin: center;
}

.halo-button-wrapper:nth-child(1):hover {
    transform: rotate(-35deg) translateY(-18px) rotate(35deg) scale(1.1);
}

.halo-button-wrapper:nth-child(2):hover {
    transform: rotate(-18deg) translateY(-11px) rotate(18deg) scale(1.1);
}

.halo-button-wrapper:nth-child(3):hover {
    transform: rotate(0deg) translateY(-3px) rotate(0deg) scale(1.1);
}

.halo-button-wrapper:nth-child(4):hover {
    transform: rotate(18deg) translateY(-11px) rotate(-18deg) scale(1.1);
}

.halo-button-wrapper:nth-child(5):hover {
    transform: rotate(35deg) translateY(-18px) rotate(-35deg) scale(1.1);
}

.halo-mobile-label {
    background: rgba(0, 0, 0, 0.8);
    color: var(--text-color);
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 10px;
    margin-bottom: 4px;
    white-space: nowrap;
    display: none; /* Hidden by default, shown on mobile */
}

.halo-action-btn {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius-full);
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid var(--border-color);
    color: var(--icon-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-base);
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    font-size: calc(16px + 4px);
}

.halo-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--icon-hover);
    border-color: var(--icon-hover);
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.halo-action-btn.flashing {
    animation: halo-flash 0.3s ease-in-out;
}

@keyframes halo-flash {
    0% { background: rgba(255, 255, 255, 0.1); }
    50% { background: rgba(126, 173, 247, 0.8); }
    100% { background: rgba(255, 255, 255, 0.1); }
}

/* ===== DETAIL AREA - SLIDING PANEL ===== */
.detail-area {
    position: fixed;
    /* Fill from left edge to left edge of right toolbar */
    left: 0;
    right: var(--toolbar-width);
    width: calc(100% - var(--toolbar-width));
    /* Fill from bottom of top arm to bottom of viewport */
    top: var(--header-height);
    bottom: var(--header-height); /* Leave space for bottom toolbar */
    z-index: 1200;
    background-color: rgba(42, 42, 42, 0.85);
    backdrop-filter: blur(8px);
    border-left: 1px solid var(--border-color);
    display: none; /* Hidden by default */
    flex-direction: column;
    pointer-events: auto;
    /* Start off-screen to the left */
    transform: translateX(-100%);
    /* Smooth slide animation */
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    overflow: hidden;
}

/* Show state - slide into position */
.detail-area.show {
    transform: translateX(0); /* Slide into view */
}

/* Content area inside detail panel */
.tab-content-area {
    overflow-y: auto;
    flex-grow: 1;
    padding: 0; /* Remove default padding - pages will handle their own */
    min-height: 0;
}

/* ===== DETAIL PAGE COMMON STRUCTURE ===== */
.detail-page {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 100%;
}

.detail-page-header {
    flex-shrink: 0;
    background-color: rgba(60, 60, 60, 0.9);
    border-bottom: 1px solid var(--border-color);
    padding: var(--space-md) var(--space-lg);
    backdrop-filter: blur(4px);
}

.detail-page-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
}

.detail-page-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: var(--space-lg);
    min-height: 0;
}

/* ===== GAME ANIMATIONS ===== */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

@keyframes dormancyPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 20px 40px rgba(255, 107, 107, 0.3);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 25px 50px rgba(255, 107, 107, 0.5);
    }
}

@keyframes rollerGlow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.6);
    }
}
