/* ===== RESET & BASE ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: auto;
}

body {
    background-color: #0a0a0f;
    color: #e0e0ff;
    font-family: 'VT323', monospace;
    font-size: 18px;
    line-height: 1.6;
    overflow-x: hidden;
    image-rendering: pixelated;
    -webkit-font-smoothing: none;
    -moz-osx-font-smoothing: unset;
    cursor: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMklEQVQ4T2P8z8Dwn4EIwMjAwMBETAuYBowGAhE+gLYGRkIBMBoIhHwAPQ2MBgIROQAArEEJEXnFfRcAAAAASUVORK5CYII=') 0 0, auto;
}

/* ===== CRT SCANLINE OVERLAY ===== */
body.crt-overlay::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 1px,
        rgba(0, 0, 0, 0.08) 1px,
        rgba(0, 0, 0, 0.08) 2px
    );
    pointer-events: none;
    z-index: 9999;
}

/* ===== TYPOGRAPHY ===== */
h2 {
    font-family: 'Press Start 2P', cursive;
    color: #00ff9f;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    line-height: 1.8;
    font-size: 16px;
}

.tile--featured h2,
.tile--bio h2 {
    font-size: 24px;
}

.tile-meta {
    font-family: 'Share Tech Mono', monospace;
    font-size: 14px;
    color: #ff006e;
}

p {
    color: #e0e0ff;
}

a {
    color: #4a9eff;
    text-decoration: none;
}

/* ===== BOOT SEQUENCE ===== */
.boot-sequence {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: #0a0a0f;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 40px;
}

.boot-screen {
    max-width: 600px;
}

.terminal-line {
    font-family: 'VT323', monospace;
    font-size: 20px;
    color: #00ff9f;
    opacity: 0;
    white-space: nowrap;
    overflow: hidden;
}

.terminal-line.visible {
    opacity: 1;
}

.terminal-line .char {
    opacity: 0;
}

.terminal-line .char.typed {
    opacity: 1;
}

.cursor-blink {
    font-family: 'VT323', monospace;
    font-size: 20px;
    color: #00ff9f;
    animation: blink-cursor 500ms steps(1) infinite;
}

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

.skip-boot {
    position: absolute;
    bottom: 40px;
    left: 40px;
    font-family: 'VT323', monospace;
    font-size: 16px;
    color: #7a7aad;
    background: none;
    border: 1px solid #1a1a3e;
    padding: 8px 16px;
    cursor: inherit;
    transition: color 0ms;
}

.skip-boot:hover {
    color: #00ff9f;
    border-color: #00ff9f;
}

/* ===== CRT POWER-ON ===== */
.crt-power-on {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: #0a0a0f;
    z-index: 999;
    display: none;
}

.crt-power-on.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.crt-power-on .crt-line {
    width: 100%;
    height: 1px;
    background: #e0e0ff;
    animation: crt-expand 300ms steps(8) forwards;
}

@keyframes crt-expand {
    0% { height: 1px; }
    100% { height: 100vh; }
}

/* ===== DUNGEON GRID ===== */
.dungeon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 64px);
    grid-auto-rows: 64px;
    gap: 1px;
    max-width: 900px;
    margin: 0 auto;
    padding: 32px 16px;
    background-image:
        linear-gradient(to right, #1a1a3e 1px, transparent 1px),
        linear-gradient(to bottom, #1a1a3e 1px, transparent 1px);
    background-size: 65px 65px;
    opacity: 0;
}

.dungeon-grid.visible {
    opacity: 1;
}

/* ===== TILES ===== */
.tile {
    background: #12121f;
    border: 1px solid #1a1a3e;
    padding: 12px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 8px;
    filter: brightness(0.3);
    transition: filter 0ms;
}

.tile--revealed {
    filter: brightness(1);
}

.tile--revealed::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    box-shadow: inset 0 0 8px rgba(0, 255, 159, 0.15);
    pointer-events: none;
    animation: neon-edge 1000ms steps(2) infinite;
}

@keyframes neon-edge {
    0%, 49% { box-shadow: inset 0 0 8px rgba(0, 255, 159, 0.15); }
    50%, 100% { box-shadow: inset 0 0 12px rgba(0, 255, 159, 0.25); }
}

/* Fog overlay */
.fog-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #15152a;
    background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAAEklEQVQImWNgYGD4z4AGGBgYABYIAgUxAlYOAAAAAElFTkSuQmCC');
    background-repeat: repeat;
    opacity: 0.8;
    pointer-events: none;
    transition: opacity 0ms;
}

.tile--revealed .fog-overlay {
    opacity: 0;
}

/* Tile icon canvas */
.tile-icon {
    image-rendering: pixelated;
}

/* Tile content */
.tile-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 1;
}

.tile-content p {
    font-size: 16px;
}

/* Single cell tiles */
.tile[style*="span"] {
    /* multi-span tiles handled inline */
}

.tile--skill {
    align-items: center;
    justify-content: center;
    text-align: center;
}

.tile--skill h2 {
    font-size: 12px;
}

.tile--locked {
    opacity: 0.5;
}

.tile--locked h2 {
    color: #7a7aad;
}

.tile--wip h2 {
    color: #ffb700;
}

.tile--featured {
    border-color: #ff006e;
}

.tile--featured h2 {
    color: #ff006e;
}

/* ===== MINIMAP ===== */
.minimap {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 120px;
    height: 80px;
    border: 2px solid #1a1a3e;
    background: #0a0a0f;
    z-index: 100;
    opacity: 0;
}

.minimap.visible {
    opacity: 1;
}

.minimap canvas {
    display: block;
    image-rendering: pixelated;
}

/* ===== DIALOGUE BOX FOOTER ===== */
.dialogue-box {
    max-width: 900px;
    margin: 64px auto 32px;
    padding: 0 16px;
    opacity: 0;
}

.dialogue-box.visible {
    opacity: 1;
}

.dialogue-border {
    border: 3px solid #1a1a3e;
    padding: 24px;
    position: relative;
    background: #0a0a0f;
}

.dialogue-text {
    font-family: 'VT323', monospace;
    font-size: 20px;
    color: #00ff9f;
    margin-bottom: 16px;
}

.dialogue-options {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dialogue-options li {
    font-family: 'VT323', monospace;
    font-size: 18px;
}

.dialogue-options a {
    color: #e0e0ff;
    display: inline-block;
}

.dialogue-options a:hover {
    color: #00ff9f;
}

.pixel-cursor {
    color: #00ff9f;
    opacity: 0;
    margin-right: 4px;
}

.dialogue-options a:hover .pixel-cursor {
    opacity: 1;
}

.blink-triangle {
    position: absolute;
    bottom: 8px;
    right: 12px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid #00ff9f;
    animation: blink-cursor 800ms steps(1) infinite;
}

/* ===== CURSOR TRAIL ===== */
#cursor-trail {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
}

.trail-dot {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #00ff9f;
    pointer-events: none;
    image-rendering: pixelated;
}

/* ===== LENS FLARE ===== */
#lens-flare-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9997;
}

#lens-flare-container canvas {
    position: absolute;
    pointer-events: none;
    image-rendering: pixelated;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
    .dungeon-grid {
        grid-template-columns: repeat(auto-fill, 48px);
        grid-auto-rows: 48px;
        background-size: 49px 49px;
    }

    .tile--bio h2,
    .tile--featured h2 {
        font-size: 16px;
    }

    h2 {
        font-size: 12px;
    }

    .minimap {
        display: none;
    }
}
