* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    font-family: 'Press Start 2P', monospace;
    background: linear-gradient(135deg, #0d0d1a 0%, #1a1a2e 50%, #16213e 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #fff;
    overflow-x: hidden;
}

#console-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
    max-width: 100%;
}

#console-body {
    background: linear-gradient(180deg, #3d3d3d 0%, #2a2a2a 50%, #1a1a1a 100%);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), inset 0 2px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 800px;
    height: calc(100vh - 100px);
    max-height: 900px;
}

#console-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 0 10px;
    gap: 10px;
    flex-shrink: 0;
}

#logo {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

#logo .star {
    color: #ffd700;
    font-size: 16px;
    text-shadow: 0 0 10px #ffd700;
    animation: pulse 2s ease-in-out infinite;
}

#logo .title {
    font-size: 18px;
    background: linear-gradient(180deg, #fff 0%, #ccc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 2px;
}

#unreal-badge {
    font-family: 'Orbitron', sans-serif;
    font-size: 8px;
    color: #0070E0;
    background: linear-gradient(90deg, rgba(0,112,224,0.2) 0%, rgba(138,43,226,0.2) 100%);
    padding: 3px 6px;
    border-radius: 4px;
    border: 1px solid #0070E0;
    animation: unrealPulse 2s ease-in-out infinite;
}

#level-up-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 7px;
    color: #ffd700;
    background: linear-gradient(90deg, rgba(255,215,0,0.2) 0%, rgba(0,112,224,0.2) 100%);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #ffd700;
    animation: levelUpPulse 1.5s ease-in-out infinite;
}

.pulse-dot {
    width: 6px;
    height: 6px;
    background: #ffd700;
    border-radius: 50%;
    animation: pulseDot 1s ease-in-out infinite;
}

@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.7; transform: scale(1.1); } }
@keyframes unrealPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }
@keyframes levelUpPulse { 0%, 100% { box-shadow: 0 0 5px rgba(255,215,0,0.5); } 50% { box-shadow: 0 0 15px rgba(255,215,0,0.8); } }
@keyframes pulseDot { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.3); } }

#game-title {
    font-size: 8px;
    color: #888;
    letter-spacing: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

#screen-bezel {
    background: #111;
    border-radius: 10px;
    padding: 15px;
    box-shadow: inset 0 4px 10px rgba(0, 0, 0, 0.8);
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    overflow: hidden;
}

#screen-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 0 30px rgba(100, 200, 255, 0.2);
    background: #000;
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

#scanlines {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.15) 0px, rgba(0, 0, 0, 0.15) 1px, transparent 1px, transparent 2px);
}

#crt-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: radial-gradient(ellipse at center, transparent 0%, rgba(0, 0, 0, 0.3) 100%);
    pointer-events: none;
}

#fullscreen-btn {
    position: absolute;
    top: 10px; right: 10px;
    width: 32px; height: 32px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid #444;
    border-radius: 5px;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    z-index: 50;
}

#status-bar {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 15px 20px;
    margin-top: 10px;
    flex-shrink: 0;
}

.score-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.score-display .label { font-size: 8px; color: #888; }
.score-display .value { font-size: 16px; color: #0f0; text-shadow: 0 0 10px #0f0; font-family: monospace; }

#export-ready {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 7px;
    color: #0f0;
    background: rgba(0, 255, 0, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #0f0;
}

.export-check { font-size: 10px; }

/* Touch controls */
#controls, #start-select { display: none; }

#controls {
    justify-content: space-between;
    padding: 20px;
    margin-top: 10px;
}

#dpad {
    display: grid;
    grid-template-columns: repeat(3, 40px);
    grid-template-rows: repeat(3, 40px);
    gap: 2px;
}

.dpad-btn {
    background: #1a1a1a;
    border: none;
    border-radius: 5px;
    color: #666;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 3px 0 #000;
}

.dpad-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #000; }

#btn-up { grid-column: 2; grid-row: 1; }
#btn-left { grid-column: 1; grid-row: 2; }
#btn-right { grid-column: 3; grid-row: 2; }
#btn-down { grid-column: 2; grid-row: 3; }

#action-buttons {
    display: flex;
    gap: 15px;
    align-items: center;
    transform: rotate(-20deg);
}

.action-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(180deg, #e63946 0%, #a62633 100%);
    border: none;
    color: #fff;
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
    cursor: pointer;
    box-shadow: 0 5px 0 #7a1d25;
}

.action-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #7a1d25; }

#btn-b { margin-top: 20px; }

#start-select {
    justify-content: center;
    gap: 15px;
    padding: 15px;
}

.sys-btn {
    padding: 8px 15px;
    background: #444;
    border: none;
    border-radius: 15px;
    color: #888;
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    cursor: pointer;
    box-shadow: 0 2px 0 #222;
}

.sys-btn.export-btn {
    background: linear-gradient(180deg, #0070E0 0%, #004a99 100%);
    color: #fff;
    box-shadow: 0 2px 0 #003366;
}

/* Select Menu */
#select-menu {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 250;
}

#select-menu.hidden { display: none; }

#select-menu-content {
    background: linear-gradient(180deg, #2a2a3e 0%, #1a1a2e 100%);
    border-radius: 15px;
    width: 90%;
    max-width: 300px;
    overflow: hidden;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.6);
}

#select-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    background: #1d3557;
}

#select-menu-header span { font-size: 12px; letter-spacing: 2px; }
#close-select-menu { background: none; border: none; color: #f88; font-size: 16px; cursor: pointer; }

#select-menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 15px;
}

.select-menu-btn {
    padding: 15px 20px;
    background: linear-gradient(180deg, #3a3a4a 0%, #2a2a3a 100%);
    border: 1px solid #4a4a5a;
    border-radius: 8px;
    color: #fff;
    font-family: 'Press Start 2P', monospace;
    font-size: 9px;
    cursor: pointer;
    text-align: left;
}

.select-menu-btn:hover { background: linear-gradient(180deg, #4a4a5a 0%, #3a3a4a 100%); }

.select-menu-btn.unreal-menu-btn {
    background: linear-gradient(90deg, #0070E0 0%, #8A2BE2 100%);
    border-color: #8A2BE2;
}

/* Generator Panel */
#generator-panel {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(180deg, #2a2a3e 0%, #1a1a2e 100%);
    border-radius: 15px;
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.6);
    z-index: 200;
}

#generator-panel.hidden { display: none; }

#generator-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    background: #1d3557;
}

#generator-header span { font-size: 10px; }
.gen-icon { font-size: 14px; }
#close-generator { background: none; border: none; color: #f88; font-size: 14px; cursor: pointer; }

#generator-content {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    max-height: calc(80vh - 60px);
}

#api-selector {
    display: flex;
    gap: 15px;
    font-size: 8px;
    flex-wrap: wrap;
}

#api-selector label { display: flex; align-items: center; gap: 5px; cursor: pointer; }

#grok-options.hidden, #openrouter-options.hidden, #pollinations-options.hidden { display: none; }

#api-key-container, #openrouter-key-container { display: flex; gap: 8px; }

#api-key, #openrouter-key, #openrouter-model {
    flex: 1;
    padding: 10px;
    background: #111;
    border: 2px solid #333;
    border-radius: 5px;
    color: #fff;
    font-family: monospace;
    font-size: 12px;
}

#toggle-key-visibility, #toggle-openrouter-key-visibility {
    padding: 10px;
    background: #333;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

#grok-model, #pollinations-model {
    padding: 10px;
    background: #111;
    border: 2px solid #333;
    border-radius: 5px;
    color: #fff;
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
}

#game-prompt {
    width: 100%;
    height: 80px;
    padding: 10px;
    background: #111;
    border: 2px solid #333;
    border-radius: 5px;
    color: #fff;
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    line-height: 1.5;
    resize: none;
}

#game-prompt:focus { border-color: #e63946; outline: none; }

#char-count { font-size: 8px; color: #666; text-align: right; }

#image-upload-section {
    background: #111;
    border: 2px solid #333;
    border-radius: 5px;
    padding: 10px;
}

#image-upload-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#image-upload-header span { font-size: 8px; color: #888; }

#image-upload-btn {
    padding: 6px 12px;
    background: linear-gradient(180deg, #4a5a6a 0%, #3a4a5a 100%);
    border: 1px solid #5a6a7a;
    border-radius: 4px;
    color: #adf;
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    cursor: pointer;
}

#generate-btn {
    padding: 15px;
    background: linear-gradient(180deg, #e63946 0%, #a62633 100%);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    cursor: pointer;
    box-shadow: 0 4px 0 #7a1d25;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

#generate-btn:hover { background: linear-gradient(180deg, #ff4d5a 0%, #c62d3b 100%); }
#generate-btn:disabled { opacity: 0.7; cursor: not-allowed; }

.loading-spinner { animation: spin 0.5s linear infinite; }
.loading-spinner.hidden { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

#generation-status { padding: 10px; background: #111; border-radius: 5px; }
#generation-status.hidden { display: none; }
.status-text { font-size: 8px; color: #0f0; margin-bottom: 8px; }
.progress-bar { height: 8px; background: #333; border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #0f0, #0ff); width: 0%; transition: width 0.3s; }

#pollinations-ad { padding: 10px; background: #1a2a3a; border: 1px solid #3a4a5a; border-radius: 8px; display: flex; align-items: center; gap: 8px; }
#pollinations-ad.hidden { display: none; }
#pollinations-ad .ad-icon { font-size: 14px; }
#pollinations-ad .ad-text { font-size: 7px; color: #8af; }

/* Library Panel */
#library-panel {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(180deg, #2a3a2a 0%, #1a2a1a 100%);
    border-radius: 15px;
    width: 90%;
    max-width: 450px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.6);
    z-index: 200;
    display: flex;
    flex-direction: column;
}

#library-panel.hidden { display: none; }

#library-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    background: #2d4a2d;
}

#library-header span { font-size: 10px; color: #8f8; }
.lib-icon { font-size: 14px; }
#close-library { background: none; border: none; color: #f88; font-size: 14px; cursor: pointer; }

#library-content { flex: 1; overflow-y: auto; padding: 15px; }
#library-games { display: flex; flex-direction: column; gap: 10px; }

.library-empty { text-align: center; padding: 30px 20px; color: #6a8; font-size: 8px; line-height: 1.8; }

.library-game {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: linear-gradient(180deg, #2a3a2a 0%, #1a2a1a 100%);
    border: 1px solid #3d5a3d;
    border-radius: 8px;
    cursor: pointer;
}

.library-game:hover { background: linear-gradient(180deg, #3a4a3a 0%, #2a3a2a 100%); }
.library-game.active { border-color: #8f8; box-shadow: 0 0 10px rgba(136, 255, 136, 0.2); }

.library-game-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.library-game-title { font-size: 9px; color: #8f8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.exported-badge { font-size: 10px; }
.library-game-prompt { font-size: 7px; color: #6a8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.library-game-meta { display: flex; gap: 10px; }
.library-game-date { font-size: 6px; color: #4a6; }
.library-game-actions { display: flex; gap: 8px; }

.library-btn {
    width: 32px; height: 32px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.library-btn.play { background: linear-gradient(180deg, #4a8 0%, #286 100%); color: #fff; }
.library-btn.export { background: linear-gradient(180deg, #0070E0 0%, #004a99 100%); color: #fff; }
.library-btn.delete { background: linear-gradient(180deg, #844 0%, #622 100%); color: #faa; }

/* Level Up Panel - CreateLex Integration */
#levelup-panel {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #1a1a2e 0%, #0d0d1a 50%, #1a0a2e 100%);
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 0 50px rgba(0, 112, 224, 0.3), 0 0 100px rgba(138, 43, 226, 0.2);
    z-index: 200;
    display: flex;
    flex-direction: column;
    border: 2px solid transparent;
    background-clip: padding-box;
}

#levelup-panel::before {
    content: '';
    position: absolute;
    top: -2px; left: -2px; right: -2px; bottom: -2px;
    background: linear-gradient(90deg, #0070E0, #8A2BE2, #0070E0);
    border-radius: 17px;
    z-index: -1;
    animation: borderGlow 3s linear infinite;
}

@keyframes borderGlow {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

#levelup-panel.hidden { display: none; }

#levelup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: linear-gradient(90deg, rgba(0,112,224,0.3) 0%, rgba(138,43,226,0.3) 100%);
    border-bottom: 1px solid rgba(138,43,226,0.3);
}

.levelup-title-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pixel-icon { font-size: 20px; image-rendering: pixelated; }
.modern-icon { font-size: 20px; }

.levelup-title {
    font-family: 'Orbitron', 'Press Start 2P', sans-serif;
    font-size: 14px;
    background: linear-gradient(90deg, #ffd700 0%, #0070E0 50%, #8A2BE2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: titleShimmer 3s ease-in-out infinite;
}

@keyframes titleShimmer {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.3); }
}

#close-levelup { background: none; border: none; color: #f88; font-size: 16px; cursor: pointer; }

#levelup-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Portal Animation */
#portal-animation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 20px;
    background: linear-gradient(90deg, rgba(26,26,46,0.8) 0%, rgba(13,13,26,0.8) 50%, rgba(26,10,46,0.8) 100%);
    border-radius: 10px;
    position: relative;
}

.pixel-side {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pixel-character {
    width: 32px;
    height: 32px;
    background: linear-gradient(180deg, #F8D830 0%, #E45C10 100%);
    image-rendering: pixelated;
    animation: pixelBounce 0.5s ease-in-out infinite;
}

@keyframes pixelBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.portal-ring {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, #0070E0, #8A2BE2, #0070E0);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: portalSpin 2s linear infinite;
    box-shadow: 0 0 30px rgba(0,112,224,0.5), 0 0 60px rgba(138,43,226,0.3);
}

@keyframes portalSpin {
    to { transform: rotate(360deg); }
}

.portal-inner {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: radial-gradient(circle, #1a1a2e 0%, #0d0d1a 100%);
    box-shadow: inset 0 0 20px rgba(0,112,224,0.5);
}

.modern-side {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.unreal-logo {
    font-family: 'Orbitron', sans-serif;
    font-size: 18px;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 10px #0070E0, 0 0 20px #8A2BE2;
}

/* Game Analysis */
#game-analysis {
    background: rgba(0, 50, 100, 0.2);
    border: 1px solid rgba(0,112,224,0.3);
    border-radius: 10px;
    padding: 15px;
}

#game-analysis h3 {
    font-size: 10px;
    color: #0070E0;
    margin-bottom: 12px;
    letter-spacing: 1px;
}

#analysis-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.analysis-section {
    display: flex;
    gap: 10px;
    font-size: 8px;
}

.analysis-label {
    color: #8A2BE2;
    min-width: 100px;
    flex-shrink: 0;
}

.analysis-section span:last-child {
    color: #adf;
}

/* Translation Table */
#translation-table {
    background: rgba(50, 0, 100, 0.2);
    border: 1px solid rgba(138,43,226,0.3);
    border-radius: 10px;
    padding: 15px;
}

#translation-table h3 {
    font-size: 10px;
    color: #8A2BE2;
    margin-bottom: 12px;
    letter-spacing: 1px;
}

.translation-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(138,43,226,0.1);
    font-size: 7px;
}

.translation-row:last-child { border-bottom: none; }

.x9000-concept {
    color: #ffd700;
    min-width: 100px;
    font-family: 'Press Start 2P', monospace;
}

.arrow {
    color: #666;
}

.unreal-concept {
    color: #0070E0;
    font-family: 'Orbitron', sans-serif;
}

/* Export Actions */
#export-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.export-action-btn {
    padding: 12px 15px;
    background: linear-gradient(180deg, #2a3a4a 0%, #1a2a3a 100%);
    border: 1px solid #3a4a5a;
    border-radius: 8px;
    color: #adf;
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
}

.export-action-btn:hover {
    background: linear-gradient(180deg, #3a4a5a 0%, #2a3a4a 100%);
    border-color: #4a5a6a;
}

.createlex-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 18px 25px;
    background: linear-gradient(90deg, #0070E0 0%, #8A2BE2 100%);
    border: 2px solid transparent;
    border-radius: 10px;
    color: #fff;
    font-family: 'Orbitron', 'Press Start 2P', sans-serif;
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.createlex-btn::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.createlex-btn:hover::before {
    left: 100%;
}

.createlex-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 0 30px rgba(0,112,224,0.5), 0 0 60px rgba(138,43,226,0.3);
}

.cta-arrow {
    font-size: 14px;
    transition: transform 0.3s;
}

.createlex-btn:hover .cta-arrow {
    transform: translateX(5px);
}

/* Pipeline Info */
#pipeline-info {
    background: rgba(26, 46, 26, 0.3);
    border: 1px solid rgba(100, 200, 100, 0.2);
    border-radius: 10px;
    padding: 15px;
}

#pipeline-info h3 {
    font-size: 10px;
    color: #8f8;
    margin-bottom: 12px;
    letter-spacing: 1px;
}

.pipeline-steps {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pipeline-step {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 8px;
}

.step-num {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0070E0 0%, #8A2BE2 100%);
    border-radius: 50%;
    color: #fff;
    font-weight: bold;
}

.step-text {
    color: #adf;
}

/* Settings Panel */
#settings-panel {
    position: fixed;
    top: 70px; right: 20px;
    width: 400px;
    max-height: calc(100vh - 100px);
    background: linear-gradient(180deg, #2a1a3a 0%, #1a0d2a 100%);
    border: 2px solid #5a3a6a;
    border-radius: 10px;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.5);
    z-index: 160;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#settings-panel.hidden { display: none; }

#settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #4a2a5a;
}

#settings-header span { font-size: 10px; color: #d8f; }
#close-settings { background: none; border: none; color: #f88; font-size: 14px; cursor: pointer; }

#settings-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.settings-section { display: flex; flex-direction: column; gap: 8px; }
.settings-section label { font-size: 9px; color: #a8f; }
.settings-section textarea {
    width: 100%;
    padding: 10px;
    background: #111;
    border: 2px solid #444;
    border-radius: 5px;
    color: #fff;
    font-family: monospace;
    font-size: 9px;
    line-height: 1.4;
    resize: vertical;
    min-height: 200px;
}

.settings-section input[type="number"] {
    width: 100%;
    padding: 10px;
    background: #111;
    border: 2px solid #444;
    border-radius: 5px;
    color: #fff;
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
}

.settings-actions { display: flex; gap: 10px; margin-top: 10px; }

.settings-btn {
    flex: 1;
    padding: 12px 15px;
    border: none;
    border-radius: 5px;
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    cursor: pointer;
}

.settings-btn.restore { background: linear-gradient(180deg, #5a4a4a 0%, #4a3a3a 100%); color: #faa; }
.settings-btn.save { background: linear-gradient(180deg, #5a3a6a 0%, #4a2a5a 100%); color: #d8f; }

/* Debug Panel */
#debug-panel {
    position: fixed;
    top: 70px; right: 20px;
    width: 350px;
    max-height: calc(100vh - 100px);
    background: linear-gradient(180deg, #1a2a1a 0%, #0d1a0d 100%);
    border: 2px solid #3d5a3d;
    border-radius: 10px;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.5);
    z-index: 150;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#debug-panel.hidden { display: none; }

#debug-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #2d4a2d;
}

#debug-header span { font-size: 10px; color: #8f8; }
#close-debug { background: none; border: none; color: #f88; font-size: 14px; cursor: pointer; }

#debug-tabs { display: flex; background: #1a2a1a; border-bottom: 1px solid #3d5a3d; }

.debug-tab {
    flex: 1;
    padding: 10px 8px;
    background: transparent;
    border: none;
    color: #6a8;
    font-family: 'Press Start 2P', monospace;
    font-size: 6px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.debug-tab:hover { background: rgba(100, 200, 100, 0.1); }
.debug-tab.active { color: #8f8; border-bottom-color: #8f8; }

#debug-content { flex: 1; overflow-y: auto; padding: 15px; }

.debug-tab-content { display: flex; flex-direction: column; gap: 15px; }
.debug-tab-content.hidden { display: none; }
.debug-tab-content h3 { font-size: 8px; color: #6a8; margin-bottom: 8px; }

#palette-display { display: grid; grid-template-columns: repeat(16, 1fr); gap: 2px; background: #111; padding: 8px; border-radius: 5px; }
.palette-color { aspect-ratio: 1; border-radius: 2px; }

#tileset-sprites { display: flex; flex-wrap: wrap; gap: 10px; background: #111; padding: 10px; border-radius: 5px; }

.sprite-preview { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 8px; background: #1a1a1a; border-radius: 5px; }
.sprite-preview canvas { image-rendering: pixelated; }
.sprite-label { font-size: 6px; color: #888; }

.layer-item { background: #111; padding: 12px; border-radius: 5px; border-left: 3px solid #4a4; }
.layer-header { display: flex; justify-content: space-between; align-items: center; }
.layer-name { font-size: 9px; color: #8f8; }

#sound-log-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
#sound-log-header span { font-size: 8px; color: #6a8; }
#clear-sound-log { padding: 5px 10px; background: #3a2a2a; border: none; border-radius: 3px; color: #f88; font-family: 'Press Start 2P', monospace; font-size: 6px; cursor: pointer; }

#sound-log-entries { background: #111; border-radius: 5px; max-height: 300px; overflow-y: auto; }
.sound-entry { display: flex; gap: 10px; padding: 8px 10px; border-bottom: 1px solid #222; font-size: 7px; }
.sound-time { color: #666; }
.sound-name { color: #fa0; }

#source-toolbar { display: flex; gap: 8px; margin-bottom: 10px; }
#copy-source-btn { padding: 8px 12px; background: linear-gradient(180deg, #3a4a5a 0%, #2a3a4a 100%); border: 1px solid #4a5a6a; border-radius: 5px; color: #adf; font-family: 'Press Start 2P', monospace; font-size: 7px; cursor: pointer; }

#source-code-inline {
    background: #0a0a0a;
    border: 1px solid #333;
    border-radius: 5px;
    padding: 15px;
    margin: 0;
    color: #8f8;
    font-family: monospace;
    font-size: 10px;
    line-height: 1.5;
    white-space: pre-wrap;
    max-height: 400px;
    overflow-y: auto;
}

.debug-empty { font-size: 8px; color: #666; text-align: center; padding: 20px; }

/* Help Modal */
#help-modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

#help-modal.hidden { display: none; }

.modal-content {
    background: #1a1a2e;
    padding: 30px;
    border-radius: 15px;
    max-width: 320px;
    text-align: center;
}

.modal-content h2 { font-size: 14px; margin-bottom: 20px; color: #e63946; }
.control-section { margin-bottom: 20px; text-align: left; }
.control-section h3 { font-size: 10px; color: #0ff; margin-bottom: 10px; }
.control-section p { font-size: 8px; color: #ccc; margin: 5px 0; }

.control-section.createlex-help h3 { color: #0070E0; }
.control-section.createlex-help { background: rgba(0,112,224,0.1); padding: 10px; border-radius: 8px; border: 1px solid rgba(0,112,224,0.3); }

#close-help { padding: 10px 20px; background: #e63946; border: none; border-radius: 5px; color: #fff; font-family: 'Press Start 2P', monospace; font-size: 8px; cursor: pointer; }

/* Unreal Mode Overlay (Konami Code) */
#unreal-mode-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: linear-gradient(135deg, rgba(0,112,224,0.9) 0%, rgba(138,43,226,0.9) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    animation: unrealModeIn 0.5s ease-out;
}

#unreal-mode-overlay.hidden { display: none; }

@keyframes unrealModeIn {
    from { opacity: 0; transform: scale(1.2); }
    to { opacity: 1; transform: scale(1); }
}

.unreal-mode-content {
    text-align: center;
    color: #fff;
}

.unreal-mode-content h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 24px;
    margin-bottom: 20px;
    text-shadow: 0 0 20px rgba(255,255,255,0.5);
}

.unreal-mode-content p {
    font-size: 12px;
    margin-bottom: 30px;
    opacity: 0.9;
}

.konami-cta {
    display: inline-block;
    padding: 15px 30px;
    background: #fff;
    color: #0070E0;
    text-decoration: none;
    font-family: 'Orbitron', sans-serif;
    font-size: 14px;
    font-weight: 700;
    border-radius: 30px;
    margin-bottom: 20px;
    transition: all 0.3s;
}

.konami-cta:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(255,255,255,0.5);
}

#close-unreal-mode {
    display: block;
    margin: 0 auto;
    padding: 10px 20px;
    background: transparent;
    border: 2px solid rgba(255,255,255,0.5);
    border-radius: 20px;
    color: #fff;
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    cursor: pointer;
    opacity: 0.7;
}

#close-unreal-mode:hover { opacity: 1; }

/* Floating Buttons */
.floating-btn {
    position: fixed;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
    z-index: 100;
    transition: transform 0.2s;
}

.floating-btn:hover { transform: scale(1.1); }

#generator-btn { top: 20px; right: 20px; background: linear-gradient(180deg, #e63946 0%, #a62633 100%); }
#library-btn { top: 20px; right: 74px; background: linear-gradient(180deg, #2d4a2d 0%, #1a3a1a 100%); }
#levelup-btn { top: 20px; right: 128px; background: linear-gradient(90deg, #0070E0 0%, #8A2BE2 100%); animation: unrealPulse 2s ease-in-out infinite; }
#help-btn { top: 20px; right: 182px; background: #1d3557; font-family: 'Press Start 2P', monospace; font-size: 16px; }
#settings-btn { top: 20px; right: 236px; background: #3d3557; }
#debug-btn { top: 20px; right: 290px; background: #2d4a3e; }

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 12px 20px;
    background: linear-gradient(180deg, #2a2a3e 0%, #1a1a2e 100%);
    border: 1px solid #4a4a5a;
    border-radius: 8px;
    color: #fff;
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    z-index: 500;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.toast-error { background: linear-gradient(180deg, #4a2a2a 0%, #3a1a1a 100%); border-color: #6a3a3a; color: #faa; }

/* Footer */
footer {
    margin-top: 30px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

footer a { color: #666; text-decoration: none; font-size: 8px; transition: color 0.3s; }
footer a:hover { color: #e63946; }
.footer-divider { color: #444; }

.createlex-footer {
    background: linear-gradient(90deg, #0070E0, #8A2BE2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.createlex-footer:hover {
    filter: brightness(1.3);
}

/* Fullscreen */
.fullscreen-screen-wrapper { display: none; }
.fullscreen-touch-controls { display: none; }

body.fullscreen-mode { padding: 0; background: #000; }
body.fullscreen-mode #console-body { display: none; }
body.fullscreen-mode footer { display: none; }
body.fullscreen-mode .floating-btn { display: none; }

body.fullscreen-mode .fullscreen-screen-wrapper {
    display: flex !important;
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: #000;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

body.fullscreen-mode .fullscreen-screen-wrapper #screen-container {
    width: min(100vw, 100vh);
    height: min(100vw, 100vh);
}

/* Mobile */
@media (max-width: 768px) {
    body { padding: 0; justify-content: flex-start; min-height: 100dvh; }
    #console-container { width: 100%; height: 100dvh; gap: 0; }
    #console-body { width: 100%; height: 100%; padding: 8px; border-radius: 0; box-shadow: none; }
    #console-header { padding: 5px 8px; margin-bottom: 8px; }
    #logo .title { font-size: 14px; }
    #game-title { max-width: 80px; font-size: 6px; }
    #level-up-indicator { font-size: 6px; padding: 2px 5px; }
    #unreal-badge { font-size: 6px; padding: 2px 4px; }
    #screen-bezel { padding: 8px; }
    #status-bar { padding: 8px; }
    .score-display .value { font-size: 12px; }
    #export-ready { font-size: 6px; padding: 2px 5px; }
    
    #controls.touch-only, #start-select.touch-only { display: flex; }
    
    .floating-btn.desktop-only { display: none !important; }
    
    #generator-panel, #library-panel, #levelup-panel, #settings-panel, #debug-panel {
        position: fixed;
        top: 0; left: 0;
        width: 100%; height: 100%;
        max-width: 100%; max-height: 100%;
        border-radius: 0;
        transform: none;
    }
    
    footer { display: none; }
}