/* ==========================================
   FULL-WIDTH PIXEL-PERFECT DRIVEL HABITAT (404)
========================================== */

html, body {
    overflow-x: hidden;
}

/* Habitat wrapper */
#drivel-zone-404 {
    width: 100%;
    margin: 0;
    padding: 0;
}

/* ==========================================
   CONTROLS
========================================== */
#drivel-controls-404 {
    width: 100%;
    padding: 10px 0;
    background: #294257;
    border-top: 2px solid #579C9A;
    border-bottom: 2px solid #579C9A;
    display: flex;
    justify-content: center;
    gap: 12px;
}

#drivel-controls-404 button {
    padding: 8px 14px;
    background: #191B1A;
    color: #EDF6D6;
    border: 2px solid #579C9A;
    font-family: monospace;
    text-transform: uppercase;
}

/* ==========================================
   BACKGROUND (404 ENVIRONMENT)
========================================== */
#drivel-habitat-404 {
    width: 100%;
    position: relative;
    overflow: hidden;
    transition: filter 0.6s linear;

    /* NEW: allow CSS background fallback */
    background-image: url("../habitats/error-dimension.png");
    background-size: cover;
    background-position: center;
}

#habitat-bg-404 {
    width: 100%;
    display: block;
    image-rendering: optimizeSpeed;
    image-rendering: pixelated;
    opacity: 0; /* Hidden because CSS provides the BG now */
}

/* Day / Night */
#drivel-habitat-404[data-time="day"]   { filter: brightness(1); }
#drivel-habitat-404[data-time="night"] { filter: brightness(0.65); }

/* ==========================================
   HUD PANELS
========================================== */
#habitat-clock-404,
#habitat-moon-404 {
    position: absolute;
    top: 10px;
    right: 10px;

    background: rgba(25,27,26,0.85);
    border: 2px solid #579C9A;
    box-shadow: 0 0 8px rgba(87,156,154,0.3);
}

#habitat-clock-404 {
    padding: 6px 10px;
    color: #EDF6D6;
    font-family: monospace;
    font-size: 14px;
    text-align: center;
    letter-spacing: 1px;
}

#habitat-moon-404 {
    margin-top: 42px;
    padding: 10px 10px 8px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

/* ==========================================
   CSS 3D WIREFRAME SPHERE
========================================== */
.moon-sphere-404 {
    width: 48px;
    height: 48px;
    position: relative;
    border-radius: 50%;
    overflow: hidden;
    background: #000;
    border: 2px solid #EDF6D6;
    box-shadow: 0 0 6px rgba(237,246,214,0.35);
    perspective: 300px;
}

.sphere-layer-404 {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1px solid rgba(237,246,214,0.22);
    transform-style: preserve-3d;
    animation: rotateLayer404 12s linear infinite;
}

.layer1-404 { transform: rotateX(30deg); animation-duration: 10s; }
.layer2-404 { transform: rotateX(-30deg); animation-duration: 14s; }
.layer3-404 { transform: rotateX(60deg); animation-duration: 18s; }

@keyframes rotateLayer404 {
    0%   { transform: rotateX(var(--x-angle)) rotateZ(0deg); }
    100% { transform: rotateX(var(--x-angle)) rotateZ(360deg); }
}

.sphere-longitudes-404 {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background:
        repeating-linear-gradient(
            to right,
            rgba(237,246,214,0.2) 0px,
            rgba(237,246,214,0.2) 1px,
            transparent 1px,
            transparent 6px
        );
    transform-origin: center;
    animation: longSpin404 18s linear infinite;
}

@keyframes longSpin404 {
    0%   { transform: rotateY(0deg); }
    100% { transform: rotateY(360deg); }
}

/* ==========================================
   MOON PHASE SHADOW
========================================== */
.moon-shadow-mask-404 {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background:
        radial-gradient(
            circle at calc(50% + var(--shadow-offset, 0%)) 50%,
            rgba(0,0,0,0.85) 40%,
            rgba(0,0,0,0.45) 60%,
            rgba(0,0,0,0) 75%
        );
    pointer-events: none;
    transition: all 0.6s ease-out;
}

.moon-phase-label-404 {
    font-family: monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #EDF6D6;
    text-align: center;
}

/* ==========================================
   DRIVEL SPRITE
========================================== */
.drivel-sprite-404 {
    position: absolute;
    pointer-events: none;
    transition: transform 0.1s;
}

/* ==========================================
   TERMINAL LOG PANEL
========================================== */

#drivel-log-panel-404 {
    width: 100%;
    height: 240px;
    background: rgba(5, 9, 12, 0.92);
    border: 1px solid rgba(153,201,179,0.35);
    border-top: 2px solid #294257;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    box-shadow:
        inset 0 0 0 1px rgba(0,0,0,0.9),
        inset 0 0 18px rgba(0,255,190,0.08),
        0 0 22px rgba(0,255,190,0.12);
    font-family: "IBM Plex Mono", "Courier New", monospace;
    color: #99C9B3;
    overflow: hidden;
    position: relative;
}

#drivel-log-title-404 {
    font-size: 11px;
    padding: 6px 10px;
    color: #579C9A;
    border-bottom: 1px solid rgba(153,201,179,0.25);
    z-index: 5;
}

#drivel-log-output-404 {
    flex: 1;
    padding: 10px;
    overflow-y: auto;
    white-space: pre-wrap;
    line-height: 1.4em;
    z-index: 5;
}

#drivel-log-panel-404::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        rgba(255,255,255,0.02) 0,
        rgba(255,255,255,0.02) 2px,
        rgba(0,0,0,0.08) 2px,
        rgba(0,0,0,0.08) 4px
    );
    mix-blend-mode: overlay;
    z-index: 3;
}

#drivel-log-output-404::-webkit-scrollbar {
    width: 6px;
}
#drivel-log-output-404::-webkit-scrollbar-thumb {
    background: #294257;
}
#drivel-log-output-404::-webkit-scrollbar-track {
    background: #0D0F12;
}

/* ==========================================
   COMMAND INPUT BAR
========================================== */
#drivel-log-input-bar-404 {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: rgba(12,17,20,0.95);
    border-top: 1px solid rgba(153,201,179,0.25);
    z-index: 10;
}

#drivel-log-prompt-404 {
    color: #579C9A;
    font-size: 13px;
    text-shadow: 0 0 4px rgba(87,156,154,0.4);
}

#drivel-log-input-404 {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #EDF6D6;
    font-size: 13px;
    font-family: inherit;
    caret-color: #99C9B3;
}

#drivel-log-input-404::placeholder {
    color: rgba(153,201,179,0.35);
}

.terminal-line-404 {
    text-shadow:
        0 0 4px rgba(153,201,179,0.6),
        0 0 6px rgba(153,201,179,0.4);
}

.log-info-404  { color: #99C9B3; }
.log-warn-404  { color: #C9C493; }
.log-error-404 { color: #FF8A8A; }
.log-command-404 { color: #8CF0FF; }

.log-cursor-404::after {
    content: "█";
    animation: blink404 0.7s infinite;
}

@keyframes blink404 {
    0%, 50% { opacity: 1; }
    50.01%, 100% { opacity: 0; }
}
