/* ===== BOOT SCREEN ===== */
.boot-screen {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 78% 42%, rgba(0, 212, 170, 0.075), transparent 30%),
        radial-gradient(circle at 18% 18%, rgba(255, 176, 0, 0.055), transparent 28%),
        var(--bg);
    z-index: 300;
    padding: 20px;
    display: block;
    overflow: hidden;
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.24s var(--ui-ease), transform 0.24s var(--ui-ease);
}
.boot-screen.boot-fading {
    opacity: 0;
    transform: scale(1.008);
    pointer-events: none;
}
.boot-screen.boot-blackout {
    background: #000;
}
.boot-screen.boot-blackout .boot-left,
.boot-screen.boot-blackout .boot-right,
.boot-screen.boot-blackout .boot-skip {
    opacity: 0;
}
.boot-screen.hidden { display: none; }

.boot-left {
    height: 100%;
    max-width: min(88ch, 100%);
    margin: 0 auto;
    padding-inline: clamp(0px, 2vw, 20px);
    overflow-y: auto;
    overflow-x: hidden;
    contain: layout paint style;
    scrollbar-width: none;
    transition: opacity 0.32s var(--ui-ease), transform 0.32s var(--ui-ease);
}

.boot-screen.boot-log-mode .boot-left {
    display: flex;
    flex-direction: column;
}

.boot-left::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.boot-right {
    display: none;
}

.boot-output { 
    font-size: var(--font-size-small); 
    line-height: 1.35;
    font-family: var(--terminal-font);
    white-space: normal;
    overflow-wrap: anywhere;
    transition: opacity 0.32s var(--ui-ease), transform 0.32s var(--ui-ease);
    width: 100%;
}

.boot-screen.boot-log-mode .boot-output {
    margin-top: auto;
    flex: 0 0 auto;
}

.boot-output.fading {
    opacity: 0;
    transform: translateY(-8px);
}

.boot-line {
    display: block;
    min-height: 1.35em;
    width: 100%;
    max-width: 100%;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    animation: bootLineRise 0.16s var(--ui-ease) both;
}

@keyframes bootLineRise {
    from {
        opacity: 0;
        transform: translateY(0.45em);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.boot-line.boot-check {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
}

.boot-line.boot-check .boot-label {
    white-space: pre;
}

.boot-label {
    color: var(--phosphor);
    white-space: pre-wrap;
}

.boot-status {
    display: inline-block;
    margin-left: 0.8ch;
    letter-spacing: 1px;
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity 0.14s var(--ui-ease), transform 0.14s var(--ui-ease);
    white-space: nowrap;
}

.boot-status.visible {
    opacity: 1;
    transform: translateX(0);
}

.boot-section {
    margin-top: 0.45em;
    color: var(--amber);
    letter-spacing: 1px;
}

.boot-loader {
    color: var(--amber);
    margin-top: 0.45em;
}

.boot-logo {
    text-align: center;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.45s var(--ui-ease), transform 0.45s var(--ui-ease);
}

.boot-logo-inline {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    white-space: pre;
    font-family: var(--terminal-font);
    font-size: clamp(7px, 1.45vw, 14px);
    line-height: 1.14;
    text-align: center;
    padding-top: min(8vh, 64px);
}
.boot-logo.visible {
    opacity: 1;
    transform: translateY(0);
}

.boot-skip {
    position: fixed;
    right: 20px;
    bottom: 18px;
    right: max(20px, env(safe-area-inset-right));
    bottom: max(18px, env(safe-area-inset-bottom));
    z-index: 305;
    border: 1px solid rgba(255, 176, 0, 0.45);
    background: rgba(10, 18, 6, 0.82);
    color: var(--amber);
    font-family: var(--terminal-font);
    font-size: var(--font-size-small);
    letter-spacing: 1px;
    padding: 9px 14px;
    min-height: 44px;
    cursor: pointer;
    text-shadow: 0 0 6px var(--amber-dim);
    box-shadow: inset 0 0 18px rgba(255, 176, 0, 0.06);
    touch-action: manipulation;
}

.boot-skip:active {
    transform: translateY(1px);
    border-color: var(--amber);
}

html.has-gsap .boot-screen,
html.has-gsap .boot-logo {
    transition: none;
}

html.has-gsap .boot-left,
html.has-gsap .boot-output {
    transition: none;
}

@media (max-width: 900px) {
    .boot-left {
        height: 100%;
    }
}

/* ===== SHUTDOWN SCREEN ===== */
.shutdown-screen {
    position: fixed;
    inset: 0;
    z-index: 420;
    display: grid;
    place-items: center;
    padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
    background:
        radial-gradient(circle at 50% 35%, rgba(255, 48, 48, 0.13), transparent 34%),
        radial-gradient(circle at 18% 18%, rgba(255, 173, 0, 0.08), transparent 28%),
        linear-gradient(180deg, rgba(0, 0, 0, 0.92), rgba(12, 0, 0, 0.98));
    color: var(--amber);
    overflow: hidden;
}

.shutdown-screen.hidden {
    display: none;
}

.shutdown-screen::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        repeating-linear-gradient(0deg, rgba(255, 48, 48, 0.055) 0 1px, transparent 1px 5px),
        linear-gradient(90deg, transparent, rgba(255, 173, 0, 0.06), transparent);
    opacity: 0.45;
}

.shutdown-panel {
    position: relative;
    z-index: 1;
    width: min(760px, 100%);
    min-height: min(520px, calc(var(--viewport-height) - 76px));
    display: grid;
    grid-template-rows: auto minmax(150px, 1fr);
    align-content: center;
    justify-items: center;
    gap: 22px;
    border: 1px solid rgba(255, 48, 48, 0.34);
    background:
        linear-gradient(135deg, rgba(255, 48, 48, 0.08), transparent 34%),
        rgba(8, 0, 0, 0.82);
    box-shadow:
        inset 0 0 40px rgba(255, 48, 48, 0.075),
        0 0 40px rgba(0, 0, 0, 0.75);
    padding: clamp(18px, 4vw, 34px);
    transition: border-color 0.4s var(--ui-ease), box-shadow 0.4s var(--ui-ease);
}

.shutdown-ares-wordmark {
    width: min(430px, 82vw);
    height: auto;
    min-height: 0;
    color: var(--amber);
    transition: opacity 0.45s var(--ui-ease), transform 0.45s var(--ui-ease);
}

.shutdown-log {
    width: min(68ch, 100%);
    min-height: 12em;
    color: var(--phosphor);
    font-family: var(--terminal-font);
    font-size: clamp(12px, 1.35vw, 16px);
    line-height: 1.45;
    letter-spacing: 0.04em;
    transition: opacity 0.45s var(--ui-ease), transform 0.45s var(--ui-ease);
}

.shutdown-log-line {
    min-height: 1.45em;
}

.shutdown-log-line.warn {
    color: var(--amber);
}

.shutdown-log-line.alert {
    color: var(--red);
}

.shutdown-offline-ascii {
    position: absolute;
    inset: 50% auto auto 50%;
    margin: 0;
    width: min-content;
    max-width: calc(100vw - 34px);
    transform: translate(-50%, -50%);
    opacity: 0;
    pointer-events: none;
    color: var(--red);
    font-family: var(--terminal-font);
    font-size: clamp(4px, 1.35vw, 16px);
    line-height: 1.08;
    text-align: left;
    text-shadow:
        0 0 7px rgba(255, 48, 48, 0.78),
        0 0 22px rgba(255, 48, 48, 0.38);
    transition: opacity 0.45s var(--ui-ease), transform 0.45s var(--ui-ease);
}

.shutdown-screen.offline .shutdown-panel {
    border-color: rgba(255, 48, 48, 0.58);
    box-shadow:
        inset 0 0 52px rgba(255, 48, 48, 0.09),
        0 0 52px rgba(255, 48, 48, 0.08);
}

.shutdown-screen.offline .shutdown-ares-wordmark,
.shutdown-screen.offline .shutdown-log {
    opacity: 0;
    transform: translateY(-8px) scale(0.985);
}

.shutdown-screen.offline .shutdown-offline-ascii {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    animation: offlinePulse 2.8s ease-in-out infinite;
}

.shutdown-reboot-button {
    position: absolute;
    z-index: 2;
    right: max(20px, env(safe-area-inset-right));
    bottom: max(18px, env(safe-area-inset-bottom));
    min-height: 44px;
    border: 1px solid rgba(255, 48, 48, 0.58);
    background: rgba(18, 0, 0, 0.84);
    color: var(--red);
    font-family: var(--terminal-font);
    font-size: var(--font-size-small);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 10px 14px;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s var(--ui-ease), background-color 0.16s var(--ui-ease), border-color 0.16s var(--ui-ease);
}

.shutdown-screen.offline .shutdown-reboot-button {
    opacity: 1;
    pointer-events: auto;
}

.shutdown-reboot-button:hover,
.shutdown-reboot-button:focus-visible {
    outline: none;
    border-color: var(--amber);
    color: var(--amber);
    background: rgba(32, 12, 0, 0.9);
}

@keyframes offlinePulse {
    0%, 100% {
        opacity: 0.84;
        text-shadow: 0 0 7px rgba(255, 48, 48, 0.72), 0 0 22px rgba(255, 48, 48, 0.34);
    }
    50% {
        opacity: 1;
        text-shadow: 0 0 10px rgba(255, 48, 48, 0.95), 0 0 30px rgba(255, 48, 48, 0.5);
    }
}

@media (prefers-reduced-motion: reduce) {
    .ares-wordmark-scan,
    .ares-wordmark-svg .ares-emblem-core,
    .ares-wordmark-svg .ares-wordmark-main,
    .shutdown-screen.offline .shutdown-offline-ascii {
        animation: none;
    }
}

/* ===== HIDDEN RAYCAST MINI-GAME ===== */
.liebi-overlay {
    position: fixed;
    inset: 0;
    z-index: 540;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
    background:
        radial-gradient(circle at 50% 20%, rgba(0, 212, 170, 0.12), transparent 34%),
        linear-gradient(180deg, rgba(0, 0, 0, 0.94), rgba(1, 7, 5, 0.98));
    color: var(--phosphor);
    font-family: var(--terminal-font);
}

.liebi-shell {
    width: min(1080px, 100%);
    max-height: calc(var(--viewport-height) - 28px);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 10px;
    border: 1px solid rgba(0, 212, 170, 0.62);
    background:
        linear-gradient(90deg, rgba(0, 212, 170, 0.05), transparent 28%),
        rgba(1, 9, 7, 0.96);
    box-shadow:
        inset 0 0 46px rgba(0, 212, 170, 0.08),
        0 0 48px rgba(0, 0, 0, 0.7);
    padding: 10px;
    overflow: hidden;
}

.liebi-topbar,
.liebi-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
}

.liebi-title {
    color: var(--amber);
    letter-spacing: 2px;
    font-size: var(--font-size-title);
    white-space: nowrap;
}

.liebi-objective,
.liebi-controls {
    color: var(--cyan);
    font-size: var(--font-size-small);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.liebi-close {
    flex-shrink: 0;
    border: 1px solid rgba(255, 176, 0, 0.58);
    background: rgba(20, 12, 0, 0.82);
    color: var(--amber);
    font-family: var(--terminal-font);
    font-size: var(--font-size-small);
    padding: 8px 11px;
    min-height: 38px;
    cursor: pointer;
    touch-action: manipulation;
}

.liebi-close:focus-visible,
.liebi-action:focus-visible {
    outline: 2px solid var(--amber);
    outline-offset: 3px;
}

.liebi-stage {
    position: relative;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
}

.liebi-canvas-wrap {
    position: relative;
    min-width: 0;
    min-height: 0;
    display: grid;
    place-items: center;
    border: 1px solid rgba(32, 194, 14, 0.28);
    background:
        repeating-linear-gradient(0deg, rgba(32, 194, 14, 0.035), rgba(32, 194, 14, 0.035) 1px, transparent 1px, transparent 4px),
        #000;
    overflow: hidden;
}

#liebiCanvas {
    width: min(100%, calc((var(--viewport-height) - 180px) * 1.6));
    max-height: calc(var(--viewport-height) - 180px);
    aspect-ratio: 8 / 5;
    display: block;
    background: #000;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    cursor: crosshair;
}

.liebi-hud {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    align-content: start;
}

.liebi-panel {
    border: 1px solid rgba(32, 194, 14, 0.24);
    background: rgba(0, 12, 6, 0.72);
    padding: 8px;
    min-width: 0;
}

.liebi-panel.wide {
    grid-column: 1 / -1;
}

.liebi-label {
    color: var(--amber);
    font-size: var(--font-size-tiny);
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.liebi-value {
    color: var(--phosphor);
    font-size: var(--font-size-small);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.liebi-bar {
    height: 8px;
    border: 1px solid rgba(32, 194, 14, 0.35);
    background: rgba(0, 0, 0, 0.55);
    overflow: hidden;
}

.liebi-bar-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--red), var(--amber), var(--phosphor));
    transform-origin: left center;
}

.liebi-modal {
    position: absolute;
    inset: 0;
    display: none;
    place-items: center;
    background: rgba(0, 0, 0, 0.72);
    text-align: center;
    padding: 18px;
}

.liebi-modal.active {
    display: grid;
}

.liebi-modal-card {
    width: min(420px, 100%);
    border: 1px solid var(--amber);
    background: rgba(2, 9, 5, 0.96);
    padding: 20px;
    box-shadow: 0 0 30px rgba(255, 176, 0, 0.16);
}

.liebi-modal-title {
    color: var(--amber);
    font-size: var(--font-size-title);
    margin-bottom: 10px;
}

.liebi-modal-text {
    color: var(--phosphor);
    font-size: var(--font-size-small);
    margin-bottom: 16px;
}

.liebi-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.liebi-action {
    border: 1px solid rgba(32, 194, 14, 0.5);
    background: rgba(0, 28, 0, 0.86);
    color: var(--phosphor);
    font-family: var(--terminal-font);
    padding: 9px 14px;
    min-height: 38px;
    cursor: pointer;
}

.liebi-action.secondary {
    border-color: rgba(255, 176, 0, 0.48);
    color: var(--amber);
    background: rgba(20, 12, 0, 0.78);
}

@media (max-width: 760px) {
    .liebi-shell {
        max-height: calc(var(--viewport-height) - 20px);
    }

    .liebi-topbar,
    .liebi-footer {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    #liebiCanvas {
        width: 100%;
        max-height: 52vh;
    }
}

/* ===== NAV HINT ===== */
.nav-hint {
    position: fixed;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    font-size: var(--font-size-tiny);
    opacity: 0;
    z-index: 150;
    transition: opacity 0.3s;
}
.nav-hint.visible { opacity: 0.4; }

/* ===== HIDDEN ===== */
#fileInput,
#statusFileInput { display: none; }

.render-low .status-dot,
.render-reduced .status-dot,
.safe-mode .status-dot,
.render-low .ares-wordmark-svg,
.render-reduced .ares-wordmark-svg,
.safe-mode .ares-wordmark-svg {
    animation-duration: 3s;
}

.render-reduced *,
.safe-mode .crt-overlay::before,
.safe-mode .crt-overlay::after {
    animation-play-state: paused;
}

