/* ============================================================
   chloe.cx — Game Engine Editor UI
   ============================================================ */

/* --- CSS Variables (Palette from DESIGN.md) --- */
:root {
    --engine-dark: #1e1e2e;
    --panel-slate: #2a2a3c;
    --gutter-gray: #363649;
    --electric-lime: #BFFF00;
    --viewport-cyan: #00E5FF;
    --gizmo-red: #FF4060;
    --screen-white: #E8E8F0;
    --comment-gray: #8888A0;
    --shader-orange: #FF9F43;
    --wire-blue: #3A3A5C;

    --font-mono: 'Share Tech Mono', monospace;
    --font-body: 'Exo 2', sans-serif;
    --font-display: 'Press Start 2P', cursive;
}

/* --- Reset --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--engine-dark);
    color: var(--screen-white);
    font-family: var(--font-body);
    font-weight: 300;
    line-height: 1.65;
    overflow-x: hidden;
    min-height: 100vh;
}

a {
    color: var(--viewport-cyan);
    text-decoration: none;
    position: relative;
}

a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--viewport-cyan);
    transition: width 0.3s ease;
}

a:hover::after {
    width: 100%;
}

/* --- Scanline Overlay --- */
#scanline-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
    background: repeating-linear-gradient(
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.1) 2px,
        rgba(0, 0, 0, 0.1) 4px
    );
}

/* ============================================================
   BOOT SEQUENCE
   ============================================================ */
#boot-sequence {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--engine-dark);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 12px;
    animation: boot-fadeout 0.5s ease forwards;
    animation-delay: 2.4s;
}

.boot-line {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--viewport-cyan);
    letter-spacing: 0.02em;
    opacity: 0;
    animation: boot-line-in 0.3s ease forwards;
}

.boot-line:last-child {
    color: var(--electric-lime);
}

@keyframes boot-line-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes boot-fadeout {
    from { opacity: 1; pointer-events: all; }
    to { opacity: 0; pointer-events: none; }
}

/* ============================================================
   ENGINE UI CONTAINER
   ============================================================ */
#engine-ui {
    opacity: 0;
    animation: engine-fadein 0.5s ease forwards;
    animation-delay: 2.6s;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

@keyframes engine-fadein {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ============================================================
   MENU BAR
   ============================================================ */
#menu-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--panel-slate);
    border-bottom: 1px solid var(--wire-blue);
    padding: 0 16px;
    height: 32px;
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.02em;
    flex-shrink: 0;
    z-index: 100;
}

.menu-items {
    display: flex;
    align-items: center;
    gap: 4px;
}

.menu-item {
    color: var(--comment-gray);
    padding: 4px 8px;
    transition: color 0.2s ease;
    cursor: pointer;
}

.menu-item::after {
    display: none;
}

.menu-item:hover,
.menu-item.active {
    color: var(--screen-white);
}

.menu-item.active {
    border-bottom: 2px solid var(--electric-lime);
    box-shadow: 0 2px 8px rgba(191, 255, 0, 0.3);
}

.menu-sep {
    color: var(--wire-blue);
    user-select: none;
}

.fps-counter {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--electric-lime);
    font-size: 11px;
}

.fps-label {
    color: var(--comment-gray);
}

/* ============================================================
   MAIN GRID LAYOUT
   ============================================================ */
#main-grid {
    display: grid;
    grid-template-columns: 200px 1fr 280px;
    grid-template-rows: 1fr auto auto;
    grid-template-areas:
        "hierarchy viewport inspector"
        "hierarchy assets assets"
        "hierarchy console console";
    flex: 1;
    min-height: 0;
}

/* ============================================================
   HIERARCHY PANEL (Left Sidebar)
   ============================================================ */
#hierarchy-panel {
    grid-area: hierarchy;
    background: var(--panel-slate);
    border-right: 1px solid var(--wire-blue);
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 12px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--gutter-gray);
    border-bottom: 1px solid var(--wire-blue);
    position: sticky;
    top: 0;
    z-index: 5;
}

.panel-title {
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--comment-gray);
}

.panel-path {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--comment-gray);
    opacity: 0.6;
}

.hierarchy-tree {
    padding: 8px 0;
}

.tree-node {
    display: flex;
    align-items: center;
    padding: 4px 12px;
    cursor: pointer;
    transition: background 0.15s ease;
    white-space: nowrap;
}

.tree-node:hover {
    background: var(--gutter-gray);
}

.tree-node.selected {
    background: var(--gutter-gray);
    border-left: 2px solid var(--electric-lime);
}

.tree-toggle {
    font-size: 8px;
    margin-right: 4px;
    color: var(--comment-gray);
    transition: transform 0.2s ease;
    width: 12px;
    display: inline-block;
    text-align: center;
}

.tree-indent {
    display: inline-block;
    width: 16px;
    border-left: 1px solid var(--wire-blue);
    height: 100%;
    min-height: 20px;
    margin-right: 4px;
}

.tree-icon {
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 6px;
    flex-shrink: 0;
}

.cube-icon {
    border: 1.5px solid var(--viewport-cyan);
    transform: rotate(45deg) scale(0.7);
}

.sphere-icon {
    border: 1.5px solid var(--electric-lime);
    border-radius: 50%;
}

.camera-icon {
    border: 1.5px solid var(--shader-orange);
    border-radius: 2px;
    position: relative;
}

.camera-icon::after {
    content: '';
    position: absolute;
    right: -4px;
    top: 2px;
    width: 0;
    height: 0;
    border-top: 3px solid transparent;
    border-bottom: 3px solid transparent;
    border-left: 4px solid var(--shader-orange);
}

.light-icon {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--shader-orange);
    box-shadow: 0 0 6px var(--shader-orange);
}

.scene-icon {
    border: 1.5px solid var(--viewport-cyan);
    border-radius: 2px;
    background: rgba(0, 229, 255, 0.1);
}

.prefab-icon {
    border: 1.5px solid var(--electric-lime);
    border-radius: 2px;
    background: rgba(191, 255, 0, 0.1);
}

.shader-icon {
    border: 1.5px solid var(--gizmo-red);
    border-radius: 2px;
    background: rgba(255, 64, 96, 0.1);
}

.tree-label {
    color: var(--screen-white);
    font-size: 12px;
}

.tree-children {
    display: block;
}

/* ============================================================
   VIEWPORT (Hero)
   ============================================================ */
#viewport {
    grid-area: viewport;
    position: relative;
    min-height: 500px;
    overflow: hidden;
    background: var(--engine-dark);
}

.viewport-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        repeating-linear-gradient(
            30deg,
            var(--wire-blue) 0px,
            var(--wire-blue) 1px,
            transparent 1px,
            transparent 40px
        ),
        repeating-linear-gradient(
            150deg,
            var(--wire-blue) 0px,
            var(--wire-blue) 1px,
            transparent 1px,
            transparent 40px
        );
    opacity: 0.5;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,0) 100%);
    -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,0) 100%);
}

.viewport-scene {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 500px;
}

/* --- Game Objects in Viewport --- */
.game-object {
    position: absolute;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.game-object:hover {
    transform: scale(1.05);
}

.game-object:hover .object-label {
    opacity: 1;
}

.object-label {
    position: absolute;
    bottom: -24px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--electric-lime);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0;
    transition: opacity 0.3s ease;
    white-space: nowrap;
    background: rgba(30, 30, 46, 0.8);
    padding: 2px 6px;
}

/* Wireframe Cube */
.obj-cube {
    top: 25%;
    left: 20%;
}

.wireframe-cube {
    width: 80px;
    height: 80px;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateX(-25deg) rotateY(45deg);
    animation: cube-rotate 20s linear infinite;
}

.cube-face {
    position: absolute;
    width: 80px;
    height: 80px;
    border: 1.5px solid var(--wire-blue);
    background: transparent;
    transition: border-color 0.3s ease;
}

.obj-cube:hover .cube-face {
    border-color: var(--electric-lime);
}

.obj-cube:hover .wireframe-cube {
    filter: drop-shadow(0 0 8px rgba(191, 255, 0, 0.4));
}

.cube-face.front  { transform: translateZ(40px); }
.cube-face.back   { transform: translateZ(-40px); }
.cube-face.left   { transform: rotateY(-90deg) translateZ(40px); }
.cube-face.right  { transform: rotateY(90deg) translateZ(40px); }
.cube-face.top    { transform: rotateX(90deg) translateZ(40px); }
.cube-face.bottom { transform: rotateX(-90deg) translateZ(40px); }

@keyframes cube-rotate {
    from { transform: rotateX(-25deg) rotateY(0deg); }
    to   { transform: rotateX(-25deg) rotateY(360deg); }
}

/* Selection Bounding Box */
.obj-cube:hover::after,
.obj-sphere:hover::after,
.obj-plane:hover::after {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    border: 2px dashed var(--electric-lime);
    pointer-events: none;
}

/* Wireframe Sphere */
.obj-sphere {
    top: 30%;
    right: 20%;
}

.wireframe-sphere {
    width: 70px;
    height: 70px;
    border: 1.5px solid var(--wire-blue);
    border-radius: 50%;
    position: relative;
    transition: border-color 0.3s ease;
    animation: sphere-pulse 4s ease-in-out infinite;
}

.wireframe-sphere::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 0;
    border-top: 1px solid var(--wire-blue);
    transform: translateY(-50%);
    transition: border-color 0.3s ease;
}

.wireframe-sphere::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 0;
    height: 100%;
    border-left: 1px solid var(--wire-blue);
    transform: translateX(-50%);
    transition: border-color 0.3s ease;
}

.obj-sphere:hover .wireframe-sphere,
.obj-sphere:hover .wireframe-sphere::before,
.obj-sphere:hover .wireframe-sphere::after {
    border-color: var(--electric-lime);
    filter: drop-shadow(0 0 8px rgba(191, 255, 0, 0.4));
}

@keyframes sphere-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

/* Wireframe Plane */
.obj-plane {
    bottom: 25%;
    left: 50%;
    transform: translateX(-50%);
}

.wireframe-plane {
    width: 100px;
    height: 60px;
    border: 1.5px solid var(--wire-blue);
    transform: perspective(300px) rotateX(50deg);
    position: relative;
    transition: border-color 0.3s ease;
    background:
        repeating-linear-gradient(
            90deg,
            var(--wire-blue) 0px,
            var(--wire-blue) 1px,
            transparent 1px,
            transparent 20px
        ),
        repeating-linear-gradient(
            0deg,
            var(--wire-blue) 0px,
            var(--wire-blue) 1px,
            transparent 1px,
            transparent 20px
        );
}

.obj-plane:hover .wireframe-plane {
    border-color: var(--electric-lime);
    background:
        repeating-linear-gradient(
            90deg,
            var(--electric-lime) 0px,
            var(--electric-lime) 1px,
            transparent 1px,
            transparent 20px
        ),
        repeating-linear-gradient(
            0deg,
            var(--electric-lime) 0px,
            var(--electric-lime) 1px,
            transparent 1px,
            transparent 20px
        );
    filter: drop-shadow(0 0 8px rgba(191, 255, 0, 0.4));
}

/* Viewport Title */
.viewport-title {
    text-align: center;
    z-index: 2;
}

.viewport-title h1 {
    font-family: var(--font-display);
    font-size: 42px;
    color: var(--screen-white);
    text-shadow: 0 0 20px rgba(0, 229, 255, 0.5), 0 0 40px rgba(0, 229, 255, 0.2);
    margin-bottom: 12px;
    letter-spacing: 2px;
}

.viewport-subtitle {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--comment-gray);
    letter-spacing: 0.05em;
}

/* ============================================================
   INSPECTOR PANEL (Right Sidebar)
   ============================================================ */
#inspector-panel {
    grid-area: inspector;
    background: var(--panel-slate);
    border-left: 1px solid var(--wire-blue);
    font-family: var(--font-mono);
    font-size: 12px;
    overflow-y: auto;
}

#inspector-content {
    padding: 12px;
}

.inspector-section {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--wire-blue);
}

.inspector-label {
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--comment-gray);
    opacity: 0.7;
    display: block;
    margin-bottom: 8px;
}

.inspector-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 0;
}

.inspector-field-label {
    color: var(--comment-gray);
    font-size: 11px;
}

.inspector-field-value {
    color: var(--screen-white);
    font-size: 11px;
    background: var(--engine-dark);
    padding: 2px 6px;
    border-radius: 2px;
    border: 1px solid var(--wire-blue);
}

.inspector-hint {
    color: var(--comment-gray);
    font-size: 11px;
    font-style: italic;
    padding: 16px 0;
    text-align: center;
}

/* ============================================================
   ASSET BROWSER (Projects Bento Grid)
   ============================================================ */
#assets-section {
    grid-area: assets;
    background: var(--engine-dark);
    border-top: 1px solid var(--wire-blue);
    padding: 0 0 24px 0;
}

#assets-section .panel-header {
    margin-bottom: 16px;
}

.bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 0 16px;
}

.bento-card {
    background: var(--gutter-gray);
    border: 1px solid var(--wire-blue);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.bento-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* Card Gizmo (transform gizmo on hover) */
.card-gizmo {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    z-index: 3;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.bento-card:hover .card-gizmo {
    opacity: 1;
}

.card-gizmo::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 0;
    width: 2px;
    height: 20px;
    background: var(--gizmo-red);
    transform-origin: bottom center;
}

.card-gizmo::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 20px;
    height: 2px;
    background: var(--electric-lime);
    transform-origin: left center;
}

/* Card Thumbnails */
.card-thumbnail {
    height: 120px;
    background: var(--engine-dark);
    position: relative;
    overflow: hidden;
    filter: grayscale(0.6);
    transition: filter 0.3s ease;
}

.bento-card:hover .card-thumbnail {
    filter: grayscale(0);
}

/* Generative thumbnails with CSS patterns */
.thumb-webengine {
    background:
        linear-gradient(135deg, var(--viewport-cyan) 0%, transparent 50%),
        repeating-linear-gradient(45deg, var(--wire-blue) 0px, var(--wire-blue) 1px, transparent 1px, transparent 8px),
        var(--engine-dark);
}

.thumb-pixelart {
    background:
        repeating-conic-gradient(var(--gutter-gray) 0% 25%, var(--engine-dark) 0% 50%) 0 0 / 16px 16px,
        linear-gradient(180deg, var(--electric-lime) 0%, transparent 60%);
    background-blend-mode: overlay;
}

.thumb-shader {
    background:
        radial-gradient(circle at 30% 40%, var(--gizmo-red) 0%, transparent 50%),
        radial-gradient(circle at 70% 60%, var(--viewport-cyan) 0%, transparent 50%),
        var(--engine-dark);
}

.thumb-gamejam {
    background:
        linear-gradient(180deg, transparent 0%, var(--gizmo-red) 100%),
        repeating-linear-gradient(90deg, transparent 0px, transparent 10px, var(--wire-blue) 10px, var(--wire-blue) 11px),
        var(--engine-dark);
}

.thumb-devtools {
    background:
        repeating-linear-gradient(0deg, var(--wire-blue) 0px, var(--wire-blue) 1px, transparent 1px, transparent 18px),
        repeating-linear-gradient(90deg, var(--wire-blue) 0px, var(--wire-blue) 1px, transparent 1px, transparent 18px),
        var(--engine-dark);
}

.thumb-synth {
    background:
        radial-gradient(ellipse at 50% 50%, var(--shader-orange) 0%, transparent 60%),
        repeating-linear-gradient(90deg, transparent 0px, transparent 4px, var(--wire-blue) 4px, var(--wire-blue) 5px),
        var(--engine-dark);
}

.card-info {
    padding: 10px 12px;
}

.card-type {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--viewport-cyan);
    letter-spacing: 0.05em;
    background: rgba(0, 229, 255, 0.1);
    padding: 2px 6px;
    border-radius: 2px;
}

.card-name {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 16px;
    margin: 6px 0 4px 0;
    color: var(--screen-white);
}

.card-meta {
    font-size: 12px;
    color: var(--comment-gray);
    margin-bottom: 4px;
}

.card-size {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--comment-gray);
    opacity: 0.6;
}

/* Card Inspector Overlay */
.card-inspector-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(42, 42, 60, 0.95);
    padding: 12px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    border-top: 1px solid var(--wire-blue);
}

.bento-card:hover .card-inspector-overlay {
    transform: translateY(0);
}

.card-inspector-overlay p {
    font-size: 12px;
    color: var(--screen-white);
    margin: 6px 0 8px 0;
    line-height: 1.5;
}

.card-tag {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--electric-lime);
    border: 1px solid var(--electric-lime);
    padding: 2px 6px;
    border-radius: 2px;
    margin-right: 4px;
    margin-bottom: 4px;
}

/* Bento card sizes */
.span-2x1 {
    grid-column: span 2;
}

.span-1x2 {
    grid-row: span 2;
}

.span-1x1 {
    /* default */
}

/* ============================================================
   CONSOLE PANEL (About/Contact)
   ============================================================ */
#console-section {
    grid-area: console;
    background: var(--engine-dark);
    border-top: 1px solid var(--wire-blue);
    font-family: var(--font-mono);
    font-size: 13px;
    max-height: 400px;
    display: flex;
    flex-direction: column;
}

#console-section .panel-header {
    flex-shrink: 0;
}

.console-controls {
    display: flex;
    gap: 8px;
}

.console-filter {
    font-size: 10px;
    color: var(--comment-gray);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 2px;
    transition: color 0.2s ease, background 0.2s ease;
}

.console-filter:hover,
.console-filter.active {
    color: var(--screen-white);
    background: var(--gutter-gray);
}

.console-output {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
}

.console-line {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 3px 0;
    opacity: 0;
    animation: console-line-in 0.4s ease forwards;
    animation-delay: calc(var(--line-index, 0) * 0.15s + 2.8s);
}

.console-output .console-line:nth-child(1) { --line-index: 0; }
.console-output .console-line:nth-child(2) { --line-index: 1; }
.console-output .console-line:nth-child(3) { --line-index: 2; }
.console-output .console-line:nth-child(4) { --line-index: 3; }
.console-output .console-line:nth-child(5) { --line-index: 4; }
.console-output .console-line:nth-child(6) { --line-index: 5; }
.console-output .console-line:nth-child(7) { --line-index: 6; }

@keyframes console-line-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.console-timestamp {
    color: var(--comment-gray);
    font-size: 11px;
    flex-shrink: 0;
    min-width: 65px;
}

.console-tag {
    font-size: 11px;
    flex-shrink: 0;
    font-weight: bold;
}

.tag-info {
    color: var(--viewport-cyan);
}

.tag-warn {
    color: var(--shader-orange);
}

.tag-error {
    color: var(--gizmo-red);
}

.console-msg {
    color: var(--screen-white);
    font-size: 12px;
}

.console-input-area {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-top: 1px solid var(--wire-blue);
    background: var(--panel-slate);
    flex-shrink: 0;
}

.console-prompt {
    color: var(--electric-lime);
    margin-right: 8px;
    font-size: 14px;
}

.console-input {
    background: transparent;
    border: none;
    color: var(--screen-white);
    font-family: var(--font-mono);
    font-size: 13px;
    outline: none;
    flex: 1;
    caret-color: var(--electric-lime);
}

.console-cursor {
    display: inline-block;
    width: 8px;
    height: 14px;
    background: var(--electric-lime);
    animation: cursor-blink 1s step-end infinite;
    margin-left: 2px;
    flex-shrink: 0;
}

@keyframes cursor-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.console-help {
    padding: 8px 12px;
    border-top: 1px solid var(--wire-blue);
    flex-shrink: 0;
}

.console-help .console-line {
    opacity: 1;
    animation: none;
}

.command-link {
    cursor: pointer;
    transition: background 0.2s ease;
    padding: 4px 0;
}

.command-link:hover {
    background: var(--gutter-gray);
}

.link-arrow {
    color: var(--electric-lime);
}

.console-help a {
    color: var(--viewport-cyan);
}

.console-help a::after {
    display: none;
}

/* ============================================================
   DEBUG FOOTER
   ============================================================ */
#debug-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: rgba(42, 42, 60, 0.8);
    border-top: 1px solid var(--wire-blue);
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--comment-gray);
    flex-shrink: 0;
}

.debug-stat {
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-value {
    color: var(--screen-white);
}

.debug-sep {
    color: var(--wire-blue);
}

/* ============================================================
   MOBILE HAMBURGER
   ============================================================ */
#mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 4px;
    left: 8px;
    z-index: 200;
    background: var(--panel-slate);
    border: 1px solid var(--wire-blue);
    border-radius: 4px;
    padding: 8px;
    cursor: pointer;
    flex-direction: column;
    gap: 4px;
}

.hamburger-line {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--screen-white);
    border-radius: 1px;
}

/* ============================================================
   STAGGER ANIMATIONS for bento cards
   ============================================================ */
.bento-card {
    opacity: 0;
    transform: translateY(20px);
    animation: card-stagger-in 0.5s ease forwards;
}

.bento-card:nth-child(1) { animation-delay: 3.0s; }
.bento-card:nth-child(2) { animation-delay: 3.08s; }
.bento-card:nth-child(3) { animation-delay: 3.16s; }
.bento-card:nth-child(4) { animation-delay: 3.24s; }
.bento-card:nth-child(5) { animation-delay: 3.32s; }
.bento-card:nth-child(6) { animation-delay: 3.40s; }

@keyframes card-stagger-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    #boot-sequence {
        animation-delay: 0s;
        animation-duration: 0s;
    }

    .boot-line {
        animation-delay: 0s !important;
        animation-duration: 0s;
        opacity: 1;
    }

    #engine-ui {
        animation-delay: 0s;
        animation-duration: 0s;
        opacity: 1;
    }

    .wireframe-cube {
        animation: none;
    }

    .wireframe-sphere {
        animation: none;
    }

    .bento-card {
        animation-delay: 0s !important;
        animation-duration: 0s;
        opacity: 1;
        transform: none;
    }

    .console-line {
        animation-delay: 0s !important;
        animation-duration: 0s;
        opacity: 1;
    }

    .console-cursor {
        animation: none;
        opacity: 1;
    }
}

/* ============================================================
   RESPONSIVE (< 768px)
   ============================================================ */
@media (max-width: 768px) {
    #mobile-menu-toggle {
        display: flex;
    }

    #menu-bar {
        padding-left: 48px;
    }

    #main-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto auto;
        grid-template-areas:
            "viewport"
            "assets"
            "console"
            "console";
    }

    #hierarchy-panel {
        display: none;
        position: fixed;
        top: 32px;
        left: 0;
        width: 240px;
        height: calc(100vh - 32px);
        z-index: 150;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
    }

    #hierarchy-panel.mobile-open {
        display: block;
    }

    #inspector-panel {
        display: none;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        max-height: 50vh;
        z-index: 150;
        border-top: 1px solid var(--wire-blue);
        border-left: none;
    }

    #inspector-panel.mobile-open {
        display: block;
    }

    .bento-grid {
        grid-template-columns: 1fr;
    }

    .span-2x1 {
        grid-column: span 1;
    }

    .span-1x2 {
        grid-row: span 1;
    }

    .viewport-title h1 {
        font-size: 24px;
    }

    .obj-cube { top: 15%; left: 10%; }
    .obj-sphere { top: 20%; right: 10%; }
    .obj-plane { bottom: 20%; }

    .wireframe-cube {
        width: 50px;
        height: 50px;
    }

    .cube-face {
        width: 50px;
        height: 50px;
    }

    .cube-face.front  { transform: translateZ(25px); }
    .cube-face.back   { transform: translateZ(-25px); }
    .cube-face.left   { transform: rotateY(-90deg) translateZ(25px); }
    .cube-face.right  { transform: rotateY(90deg) translateZ(25px); }
    .cube-face.top    { transform: rotateX(90deg) translateZ(25px); }
    .cube-face.bottom { transform: rotateX(-90deg) translateZ(25px); }

    .wireframe-sphere {
        width: 45px;
        height: 45px;
    }

    .wireframe-plane {
        width: 60px;
        height: 36px;
    }

    #debug-footer {
        flex-wrap: wrap;
        font-size: 10px;
        gap: 6px;
    }
}

/* ============================================================
   SELECTION HIGHLIGHT (for hierarchy + viewport interaction)
   ============================================================ */
.highlight-flash {
    animation: flash-highlight 1s ease;
}

@keyframes flash-highlight {
    0% { box-shadow: 0 0 0 2px var(--electric-lime); }
    100% { box-shadow: none; }
}
