/* EXCEPTION — game + developer debugger styling */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    height: 100%;
    background: #06080c;
    overflow: hidden;
    font-family: Consolas, "Cascadia Mono", monospace;
}

#wrap {
    position: relative;
    width: 768px;
    height: 432px;
    margin: 40px auto;
    box-shadow: 0 0 0 2px #1a2230, 0 0 40px rgba(0,0,0,0.8);
}

#game {
    display: block;
    width: 768px;
    height: 432px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    background: #6ecbff;
}

.hidden { display: none !important; }

/* ---------- overlays ---------- */
.overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
}

/* ---------- error dialog ---------- */
#errorDialog {
    background: rgba(4, 6, 10, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
}

.error-box {
    background: #0d1117;
    border: 2px solid #ff3b3b;
    box-shadow: 0 0 0 2px #0d1117, 0 0 30px rgba(255, 59, 59, 0.35);
    padding: 26px 34px;
    text-align: center;
    min-width: 420px;
}

.error-title {
    color: #ff5252;
    font-size: 20px;
    font-weight: bold;
    letter-spacing: 4px;
    margin-bottom: 16px;
    animation: errBlink 1.1s steps(2) infinite;
}

@keyframes errBlink { 50% { opacity: 0.55; } }

.error-msg {
    color: #e6edf3;
    font-size: 14px;
    white-space: pre-wrap;
    margin-bottom: 8px;
    text-align: left;
}

.error-where {
    color: #8b949e;
    font-size: 12px;
    text-align: left;
    margin-bottom: 18px;
}

/* ---------- buttons ---------- */
.dbg-btn {
    background: #161b22;
    color: #e6edf3;
    border: 1px solid #30363d;
    font-family: inherit;
    font-size: 13px;
    padding: 6px 14px;
    cursor: pointer;
}
.dbg-btn:hover { background: #21262d; border-color: #8b949e; }
.dbg-btn.danger { color: #ff7b72; border-color: #f85149; }
.dbg-btn.danger:hover { background: #2d1214; }
.dbg-btn.run { color: #3fb950; border-color: #2ea043; }

/* ---------- debugger window ---------- */
#debugger { background: rgba(2, 4, 8, 0.9); }

.dbg-window {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    background: #0d1117;
    border-top: 2px solid #30363d;
}

.dbg-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #161b22;
    border-bottom: 1px solid #30363d;
    padding: 6px 10px;
}

.dbg-title { color: #8b949e; font-size: 12px; }

.dbg-tabs .tab {
    background: transparent;
    border: 1px solid #30363d;
    color: #8b949e;
    font-family: inherit;
    font-size: 11px;
    padding: 3px 10px;
    cursor: pointer;
    margin-left: 4px;
}
.dbg-tabs .tab.active { color: #e6edf3; background: #0d1117; border-color: #58a6ff; }

.tab-page {
    flex: 1;
    overflow: auto;
    padding: 10px 12px;
    font-size: 13px;
    color: #e6edf3;
}

/* console tab */
.console-error {
    border: 1px solid #f85149;
    background: #170c0e;
    padding: 8px 10px;
    margin-bottom: 10px;
}
.console-error #consoleErrHead { color: #ff7b72; white-space: pre-wrap; }
.console-error pre { color: #c9a227; font-size: 12px; margin-top: 6px; }

.console-clean { color: #3fb950; margin-bottom: 10px; }

#consoleLog { color: #8b949e; font-size: 12px; white-space: pre-wrap; margin-bottom: 10px; }
#consoleLog .log-warn { color: #d29922; }
#consoleLog .log-ok { color: #3fb950; }
#consoleLog .log-err { color: #ff7b72; }

.file-list-label { color: #58a6ff; font-size: 11px; margin: 6px 0; text-transform: uppercase; }
.file-list { display: flex; flex-wrap: wrap; gap: 6px; }
.file-list .file-btn {
    background: #161b22;
    border: 1px solid #30363d;
    color: #79c0ff;
    font-family: inherit;
    font-size: 12px;
    padding: 4px 10px;
    cursor: pointer;
}
.file-list .file-btn:hover { border-color: #58a6ff; }
.file-list .file-btn.dirty::after { content: " *"; color: #d29922; }

/* editor tab */
#tabEditor { display: flex; flex-direction: column; padding: 0; }

.editor-head {
    display: flex;
    justify-content: space-between;
    background: #161b22;
    border-bottom: 1px solid #30363d;
    padding: 5px 12px;
    font-size: 12px;
    color: #8b949e;
}
#editorFile { color: #79c0ff; }
#editorFlags { color: #d29922; }

.editor-body { flex: 1; display: flex; overflow: hidden; }

#editorGutter {
    min-width: 44px;
    padding: 8px 8px 8px 0;
    text-align: right;
    color: #484f58;
    background: #0d1117;
    border-right: 1px solid #21262d;
    font-size: 13px;
    line-height: 19.5px;
    overflow: hidden;
    user-select: none;
}

.editor-stack { position: relative; flex: 1; overflow: hidden; }

#editorHighlight, #editorInput {
    position: absolute;
    inset: 0;
    font-family: inherit;
    font-size: 13px;
    line-height: 19.5px;
    padding: 8px 12px;
    white-space: pre;
    overflow: auto;
    tab-size: 4;
}

#editorHighlight {
    pointer-events: none;
    color: #e6edf3;
    margin: 0;
}

#editorInput {
    background: transparent;
    color: transparent;
    caret-color: #58a6ff;
    border: none;
    outline: none;
    resize: none;
}

/* syntax tokens */
.tk-k { color: #ff7b72; }
.tk-s { color: #a5d6ff; }
.tk-n { color: #79c0ff; }
.tk-c { color: #8b949e; font-style: italic; }

/* vcs tab */
.vcs-head { color: #d29922; font-size: 12px; margin-bottom: 12px; }
.vcs-list .vcs-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid #21262d;
    padding: 6px 10px;
    margin-bottom: 6px;
}
.vcs-row .vcs-file { color: #79c0ff; font-size: 13px; }
.vcs-row .vcs-state { color: #8b949e; font-size: 11px; margin-left: auto; margin-right: 12px; }
.vcs-note { color: #484f58; font-size: 11px; margin-top: 8px; }

/* footer */
.dbg-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid #30363d;
    background: #161b22;
    padding: 6px 10px;
}
#dbgHint { color: #484f58; font-size: 11px; }

/* ---------- pause ---------- */
#pauseMenu {
    background: rgba(4, 6, 10, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}
.pause-box {
    background: #0d1117;
    border: 1px solid #30363d;
    padding: 24px 36px;
    text-align: center;
}
.pause-title { color: #e6edf3; letter-spacing: 6px; margin-bottom: 16px; font-size: 18px; }
.pause-box .dbg-btn { display: block; width: 220px; margin: 8px auto; }

/* ---------- meta toast ---------- */
#metaToast {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    background: #170c0e;
    border: 1px solid #d29922;
    color: #d29922;
    font-size: 12px;
    padding: 6px 14px;
    white-space: pre-wrap;
}
