* { margin: 0; padding: 0; box-sizing: border-box; }
body { background: #000; overflow: hidden; width: 100vw; height: 100vh; }

/* Canvas */
#canvas {
    position: absolute; top: 0; left: 0;
    z-index: 1;
}

/* Editor overlay */
#editor-container {
    position: absolute; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 10;
    pointer-events: none; /* Allow mouse events to pass through to canvas */
}
#editor-container .CodeMirror {
    pointer-events: auto; /* But keep CodeMirror interactive */
}

/* CodeMirror styling */
.CodeMirror {
    background: transparent !important; height: 100%; width: 100%;
    font-family: 'Fira Code', 'Courier New', monospace; font-size: 14px;
}
.CodeMirror-wrap pre.CodeMirror-line, .CodeMirror-wrap pre.CodeMirror-line-like {
    word-wrap: break-word; white-space: pre-wrap; word-break: normal;
}
.CodeMirror-gutters { background: transparent !important; border: none !important; }
.CodeMirror-linenumber { color: #0f03 !important; }
.CodeMirror-cursor { border-left: 2px solid #0f0 !important; }
.CodeMirror-selected { background: transparent !important; }
.CodeMirror-focused .CodeMirror-selected { background: transparent !important; }
.CodeMirror-line { }
.CodeMirror-line > span { background: rgba(0, 0, 0, 0.85) !important; }
.CodeMirror-line > span span { background: transparent !important; }
.CodeMirror .cm-selection-mark { background: #234 !important; border-radius: 2px; }
.CodeMirror-scroll { padding: 20px; }

/* Error highlighting */
.cm-error-line { background: rgba(180, 0, 0, 0.3) !important; }
.cm-error-line pre.CodeMirror-line > span { background: rgba(55, 0, 0, 0.7) !important; }

/* Help line */
#help-line {
    position: fixed; bottom: 20px; left: 20px; z-index: 500;
    color: #666; font-family: 'Fira Code', monospace; font-size: 12px;
    background: rgba(0, 0, 0, 0.85); padding: 4px 8px;
}
#version-link {
    color: #0f0; cursor: pointer; text-decoration: underline;
    text-decoration-color: #0f04;
}
#version-link:hover { text-decoration-color: #0f0; }

/* Help screen */
#help-screen {
    display: none;
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: 1000; background: #000;
}
#help-screen.visible { display: flex; }
#help-nav {
    width: 220px; height: 100vh; overflow-y: auto;
    border-right: 1px solid #333; padding: 20px 0;
    font-family: 'Fira Code', monospace; font-size: 13px;
    background: rgba(0, 0, 0, 0.9); z-index: 100;
}
#help-nav-title {
    color: #0f0; padding: 0 20px 15px; font-size: 16px;
    border-bottom: 1px solid #333; margin-bottom: 10px;
}
.help-nav-section {
    color: #0f0; padding: 15px 20px 8px; font-size: 11px;
    text-transform: uppercase; letter-spacing: 1px;
    border-top: 1px solid #333; margin-top: 10px;
    font-weight: bold;
}
.help-nav-section:first-child {
    border-top: none; margin-top: 0;
}
.help-nav-item {
    padding: 8px 20px; cursor: pointer; color: #888;
    transition: background 0.1s, color 0.1s;
}
.help-nav-item:hover { background: #111; color: #fff; }
.help-nav-item.selected { background: #0f02; color: #0f0; }
#help-content {
    flex: 1; position: relative; overflow: hidden;
}
#help-canvas {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 1;
}
#help-editor-container {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 10;
}
#help-close {
    position: absolute; top: 15px; right: 20px; z-index: 1001;
    color: #666; font-family: 'Fira Code', monospace; font-size: 12px;
    cursor: pointer;
}
#help-close:hover { color: #fff; }
#help-hint {
    position: absolute; bottom: 20px; left: 20px; z-index: 1001;
    color: #666; font-family: 'Fira Code', monospace; font-size: 12px;
}

/* Error message display */
#error-message {
    position: fixed; bottom: 50px; left: 20px; right: 20px; z-index: 500;
    color: #f00; font-family: 'Fira Code', monospace; font-size: 12px;
    text-shadow: 0 0 8px #f00; display: none;
}
#error-message.hint-mode {
    color: #0ff; text-shadow: none;
    background: rgba(0, 0, 0, 0.85); padding: 4px 8px;
    right: auto; /* Don't stretch across screen */
}

/* FPS counter */
#fps-counter {
    position: fixed; top: 20px; right: 20px; z-index: 500;
    color: #0f0; font-family: 'Fira Code', monospace; font-size: 12px;
    background: rgba(0, 0, 0, 0.85); padding: 4px 8px;
}

/* Share button */
#share-btn {
    position: fixed; bottom: 20px; right: 20px; z-index: 500;
    color: #0f0; font-family: 'Fira Code', monospace; font-size: 12px;
    background: rgba(0, 0, 0, 0.85); padding: 8px 16px;
    cursor: pointer; border: 1px solid #0f04;
    transition: border-color 0.2s, background 0.2s;
}
#share-btn:hover { border-color: #0f0; background: rgba(0, 50, 0, 0.85); }

/* Export button */
#export-btn {
    position: fixed; bottom: 20px; right: 100px; z-index: 500;
    color: #0f0; font-family: 'Fira Code', monospace; font-size: 12px;
    background: rgba(0, 0, 0, 0.85); padding: 8px 16px;
    cursor: pointer; border: 1px solid #0f04;
    transition: border-color 0.2s, background 0.2s;
}
#export-btn:hover { border-color: #0f0; background: rgba(0, 50, 0, 0.85); }

/* Export modal */
#export-modal {
    display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: 2000; background: rgba(0, 0, 0, 0.9);
    justify-content: center; align-items: center;
}
#export-modal.visible { display: flex; }
#export-content {
    background: #111; border: 1px solid #0f0; padding: 24px;
    max-width: 700px; width: 90%; max-height: 80vh;
    font-family: 'Fira Code', monospace;
}
#export-title {
    color: #0f0; font-size: 16px; margin-bottom: 8px;
}
#export-desc {
    color: #888; font-size: 12px; margin-bottom: 16px;
}
#export-code {
    background: #000; color: #0f0; padding: 16px;
    font-size: 11px; overflow: auto; max-height: 400px;
    border: 1px solid #333; white-space: pre-wrap; word-break: break-all;
}
#export-actions {
    display: flex; gap: 12px; margin-top: 16px;
}
#export-copy, #export-close {
    color: #0f0; font-size: 12px; padding: 8px 16px;
    cursor: pointer; border: 1px solid #0f04;
    transition: border-color 0.2s, background 0.2s;
}
#export-copy:hover, #export-close:hover {
    border-color: #0f0; background: rgba(0, 50, 0, 0.85);
}

/* Toast notification */
#toast {
    position: fixed; bottom: 70px; right: 20px; z-index: 600;
    color: #0f0; font-family: 'Fira Code', monospace; font-size: 12px;
    background: rgba(0, 50, 0, 0.95); padding: 8px 16px;
    border: 1px solid #0f0; opacity: 0; transform: translateY(10px);
    transition: opacity 0.3s, transform 0.3s; pointer-events: none;
}
#toast.visible { opacity: 1; transform: translateY(0); }

/* Syntax highlighting */
.cm-s-monokai .cm-keyword { color: #0f0 !important; }
.cm-s-monokai .cm-number { color: #ff0 !important; }
.cm-s-monokai .cm-variable { color: #fff !important; }
.cm-s-monokai .cm-property { color: #0a0 !important; }
.cm-s-monokai .cm-operator { color: #f0f !important; }
.cm-s-monokai .cm-comment { color: #0ff !important; }
.cm-s-monokai .cm-string { color: #ff0 !important; }

/* Changelog modal */
#changelog-modal {
    display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: 2000; background: rgba(0, 0, 0, 0.5);
    justify-content: center; align-items: center;
}
#changelog-modal.visible { display: flex; }
#changelog-content {
    background: #111; border: 1px solid #0f0; padding: 24px;
    max-width: 600px; width: 90%; max-height: 80vh; overflow-y: auto;
    font-family: 'Fira Code', monospace;
}
#changelog-title {
    color: #0f0; font-size: 18px; margin-bottom: 20px;
}
.changelog-version {
    color: #0f0; font-size: 14px; margin-top: 16px;
}
.changelog-date {
    color: #666; font-size: 11px; margin-left: 10px;
}
.changelog-changes {
    color: #888; font-size: 12px; margin: 8px 0 0 0; padding-left: 20px;
}
.changelog-changes li {
    margin: 4px 0;
}
#changelog-close {
    color: #0f0; font-size: 12px; padding: 8px 16px; margin-top: 20px;
    cursor: pointer; border: 1px solid #0f04; display: inline-block;
    transition: border-color 0.2s, background 0.2s;
}
#changelog-close:hover { border-color: #0f0; background: rgba(0, 50, 0, 0.85); }
