/* Entropy Garden — matrix, panopticon, artifacts, docking bay */

/* --- GOD MODE --- */
/* Letter spans can't inherit h1 background-clip:text — syncGodTitleGradient() in
   god-title.js tiles each glyph on the .hud-title-card::after gradient field. */
h1.god-title-live {
    background: none;
    -webkit-background-clip: unset;
    background-clip: unset;
    -webkit-text-fill-color: unset;
    color: unset;
}

h1.god-title-live .god-title-chrome {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
}

h1.god-title-live .god-title-letter {
    display: inline-block;
    will-change: transform;
    background-repeat: repeat;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    text-shadow: none;
}

@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
    h1.god-title-live .god-title-letter {
        background: none;
        -webkit-text-fill-color: var(--neon-green);
        color: var(--neon-green);
        text-shadow: 0 0 8px rgba(0, 255, 0, 0.4);
    }
}

h1.god-title-live .god-title-letter.is-space {
    min-width: 0.38em;
}

body.corrupted.god-mode h1.god-title-live .god-title-letter {
    background: none;
    -webkit-background-clip: border-box;
    background-clip: border-box;
    -webkit-text-fill-color: var(--alert-red);
    color: var(--alert-red);
    text-shadow: none;
    will-change: auto;
}

body.corrupted.god-mode .hud-title-card::after {
    background: var(--alert-red);
    background-size: 100% 100%;
    box-shadow: 0 0 12px rgba(255, 0, 85, 0.45);
}

body.corrupted:not(.god-mode) h1 {
    background: none;
    -webkit-background-clip: unset;
    background-clip: unset;
    -webkit-text-fill-color: var(--alert-red);
    color: var(--alert-red);
    text-shadow: 0 0 8px rgba(255, 0, 85, 0.35);
}

body.corrupted:not(.god-mode) h1.god-title-live {
    background: none;
    -webkit-background-clip: unset;
    background-clip: unset;
}

body.corrupted:not(.god-mode) h1.god-title-live .god-title-letter {
    background: none;
    -webkit-background-clip: border-box;
    background-clip: border-box;
    -webkit-text-fill-color: var(--alert-red);
    color: var(--alert-red);
    text-shadow: none;
}

body.corrupted:not(.god-mode) .hud-title-card::after {
    background: var(--alert-red);
    background-size: 100% 100%;
    box-shadow: 0 0 12px rgba(255, 0, 85, 0.45);
}

#panopticon-eye.god-rainbow .panopticon-lid,
#panopticon-eye.god-rainbow .panopticon-iris-outer,
#panopticon-eye.god-rainbow .panopticon-iris-mid {
    stroke: url(#panopticon-rainbow);
}

#panopticon-eye.god-rainbow .panopticon-god-pupil {
    fill: url(#panopticon-rainbow);
}

.god-mode-triangle-layer {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    /* Stack: cipher canvas (10) < triangle (11) < panopticon eye (12) */
    z-index: 11;
    pointer-events: none;
    overflow: visible;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.85s ease, visibility 0.85s ease;
}

.god-mode-triangle-layer.god-triangle-visible {
    opacity: 1;
    visibility: visible;
    filter: drop-shadow(0 0 8px rgba(0, 255, 0, 0.4));
}

body.god-mode:has(#panopticon-eye.god-active):not(:has(#panopticon-eye.pong-active)) .god-mode-triangle-layer.god-triangle-visible {
    opacity: 1;
    visibility: visible;
}

.panopticon-god-triangle {
    fill: none;
    stroke-width: 2.5;
    stroke-linejoin: round;
    stroke-linecap: round;
    pointer-events: none;
}

.god-mode-triangle-layer.god-triangle-visible .panopticon-god-triangle,
body.god-mode:has(#panopticon-eye.god-active) .god-mode-triangle-layer .panopticon-god-triangle {
    stroke: #00ff00;
    stroke: url(#god-mode-rainbow);
}

body.corrupted.god-mode .god-mode-triangle-layer.god-triangle-visible .panopticon-god-triangle,
body.corrupted.god-mode:has(#panopticon-eye.god-active) .god-mode-triangle-layer .panopticon-god-triangle {
    stroke: var(--alert-red);
}

.panopticon-god-pupil {
    display: none;
    font-family: "Apple Symbols", Menlo, "PingFang SC", sans-serif;
    font-size: 22px;
    text-anchor: middle;
    dominant-baseline: middle;
    fill: var(--neon-green);
    pointer-events: none;
}

#panopticon-eye.god-active .panopticon-pupil {
    display: none;
}

#panopticon-eye.god-active .panopticon-god-pupil {
    display: block;
}

/* --- UI CONTROLS --- */
.control-panel { 
    position: absolute; 
    top: 20px; 
    left: 30px; /* Anchored Left */
    right: auto !important; 
    z-index: 100; 
    display: flex; 
    z-index: 10001;

    opacity: 0;
    transform: translateX(calc(-100% - 48px));
    transition: transform 1.5s cubic-bezier(0.25, 1, 0.5, 1), opacity 1.5s ease;
    pointer-events: none;
}

.control-panel.active {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.ui-btn { 
    background: rgba(0,0,0,0.7); 
    border: 1px solid var(--neon-green); 
    color: var(--neon-green); 
    padding: 5px 10px; cursor: pointer; 
    font-family: var(--main-font); 
    font-size: 0.8rem; text-transform: uppercase; 
    border-radius: var(--radius-sm);
    transition: all 0.3s; 
}

.ui-btn:hover { 
    background: var(--neon-green); 
    color: #000; 
}

.ui-btn:focus,
#hamburger-icon:focus {
    outline: none;
}

.ui-btn:focus-visible,
#hamburger-icon:focus-visible {
    outline: 2px solid var(--neon-green);
    outline-offset: 3px;
}

body.corrupted .ui-btn { 
    border-color: var(--alert-red); 
    color: var(--alert-red); 
}

body.corrupted .ui-btn:hover { 
    background: var(--alert-red); 
    color: #000; 
}

/* --- ARTIFACTS --- */
.artifact { 
    position: absolute; width: 60px; height: 60px; 
    z-index: 50; cursor: grab; 
    filter: drop-shadow(0 0 5px var(--neon-green)); 
    transition: transform 0.1s; 
}

/* Pizza & scatter stickers sit above the terminal FAB (10060) */
.artifact.artifact-pizza,
.artifact[id^="art-pizza-clone-"] {
    z-index: 10070;
}

.artifact:active { cursor: grabbing; transform: scale(1.1); }

.artifact .artifact-pizza-icon {
    display: block;
    width: 100%;
    height: 100%;
    mask-image: url('../assets/icons/pizza.svg');
    -webkit-mask-image: url('../assets/icons/pizza.svg');
    mask-size: contain;
    -webkit-mask-size: contain;
    mask-repeat: no-repeat;
    -webkit-mask-repeat: no-repeat;
    mask-position: center;
    -webkit-mask-position: center;
}

.artifact svg {
    width: 100%; height: 100%; 
    fill: rgba(0, 20, 0, 0.5); 
    stroke: var(--neon-green); 
    stroke-width: 2; 
    stroke-linecap: round; 
    stroke-linejoin: round; 
}

.artifact.wrong-slot { animation: errorShake 0.4s ease; }

.artifact.wrong-slot .artifact-pizza-icon {
    background-color: var(--alert-red);
    filter: drop-shadow(0 0 5px var(--alert-red));
}

.artifact.wrong-slot svg {
    stroke: var(--alert-red); 
    filter: drop-shadow(0 0 5px var(--alert-red)); 
}

/* --- SCATTER FILES --- */
.scatter-file { 
    position: absolute; background: #c0c0c0; color: #000; 
    border: 1px solid #fff; border-right-color: #000; 
    border-bottom-color: #000; padding: 4px 8px; 
    font-family: var(--main-font); font-size: 11px; 
    cursor: grab; z-index: 10070; box-shadow: 2px 2px 0px rgba(0,0,0,0.5); 
    user-select: none; display: flex; align-items: center; gap: 5px; 
    border-radius: var(--radius-sm);
    transition: top 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); 
}

.scatter-file:active { 
    cursor: grabbing; border: 1px solid #000; 
    border-right-color: #fff; border-bottom-color: #fff; 
}

.file-icon { 
    width: 12px; height: 16px; background: #fff; 
    border: 1px solid #666; position: relative; 
}

.file-icon::after { 
    content: ''; position: absolute; top: 0; right: 0; 
    border-width: 0 4px 4px 0; border-style: solid; 
    border-color: #c0c0c0 #c0c0c0 #666 #666; 
}

/* --- DOCKING BAY --- */
#docking-bay { 
    position: absolute; 
    bottom: 0; 
    left: 50%; 
    transform: translate(-50%, 0);
    display: flex; 
    gap: 20px; 
    z-index: 40; 
    padding-bottom: 40px;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

body.garden-ready #docking-bay {
    /* `backwards` (not `both`) so the finished animation releases `transform` back
       to the cascade — otherwise the :hover slide-up is permanently overridden. */
    animation: uiDockEnterTouch 1.5s cubic-bezier(0.25, 1, 0.5, 1) 0.85s backwards;
}

/* Only hide and slide on devices with a real mouse cursor */
@media (hover: hover) and (pointer: fine) {
    #docking-bay {
        transform: translate(-50%, 120px); 
        padding-top: 150px; 
    }

    body.garden-ready #docking-bay {
        animation-name: uiDockEnterDesktop;
    }
    
    #docking-bay:hover {
        transform: translate(-50%, 0); 
    }
}

/* Make slots look clickable */
.slot {
    cursor: pointer;
}

/* Style the icons injected into the slots */
.slot .slot-icon {
    display: block;
    flex-shrink: 0;
    width: 54%;
    height: 54%;
    mask-size: contain;
    -webkit-mask-size: contain;
    mask-position: center;
    -webkit-mask-position: center;
    filter: drop-shadow(0 0 4px var(--neon-green));
    transition: transform 0.1s;
}

.slot:active .slot-icon {
    transform: scale(0.9);
}

.slot .slot-icon.mask-icon--dock-pizza {
    width: 62%;
    height: 62%;
    transform: scaleY(-1);
    mask-image: url('../assets/icons/pizza.svg');
    -webkit-mask-image: url('../assets/icons/pizza.svg');
    mask-size: 110%;
    -webkit-mask-size: 110%;
}

.slot:active .slot-icon.mask-icon--dock-pizza {
    transform: scaleY(-1) scale(0.9);
}

.slot .slot-icon.mask-icon--dock-flask {
    width: 52%;
    height: 52%;
    mask-image: url('../assets/icons/flask.svg');
    -webkit-mask-image: url('../assets/icons/flask.svg');
}

.slot .slot-icon.mask-icon--dock-save {
    width: 48%;
    height: 48%;
    mask-image: url('../assets/icons/save.svg');
    -webkit-mask-image: url('../assets/icons/save.svg');
}

/* Legacy inline SVG slots (if any remain) */
.slot svg { 
    width: 80%; 
    height: 80%; 
    fill: rgba(0, 20, 0, 0.5); 
    stroke: var(--neon-green); 
    stroke-width: 2; 
    stroke-linecap: round; 
    stroke-linejoin: round; 
    filter: drop-shadow(0 0 5px var(--neon-green));
    transition: transform 0.1s;
}

.slot:active svg {
    transform: scale(0.9); /* Adds a nice click down effect */
}

.slot { 
    width: 70px; 
    height: 70px; 
    border: 2px solid #333; 
    border-radius: 50%; /* Changed from 5px to 50% */
    display: flex; 
    justify-content: center; 
    align-items: center; 
    color: #333; 
    font-size: 0.7rem; 
    background: rgba(0,0,0,0.5); 
    transition: border-color 0.3s, box-shadow 0.3s;
    overflow: hidden;
    box-sizing: border-box;
}

.slot.occupied { border-color: var(--neon-green); border-style: solid; }

/* --- file:// guard (modules require http) --- */
html.file-protocol #init-screen {
    opacity: 0.35;
    pointer-events: none;
}

#file-protocol-notice {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100030;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.88);
    font-family: var(--main-font);
    color: rgba(0, 255, 0, 0.88);
    text-align: center;
    line-height: 1.55;
}

html.file-protocol #file-protocol-notice {
    display: flex;
    flex-direction: column;
}

#file-protocol-notice .file-protocol-title {
    margin: 0 0 12px;
    letter-spacing: 0.12em;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.35);
}

#file-protocol-notice .file-protocol-cmd {
    margin: 12px 0;
    padding: 10px 14px;
    border: 1px solid rgba(0, 255, 0, 0.35);
    border-radius: var(--radius-sm, 4px);
    background: rgba(0, 12, 0, 0.6);
    font-size: 0.85rem;
}

#file-protocol-notice code {
    color: rgba(0, 255, 0, 0.95);
}
