:root {
    /* Soft Stark IDE Color Palette */
    --stark-bg: #1e222a;           
    --stark-panel: #282c34;        
    --stark-cyan: #5bc0be;         
    --stark-cyan-dim: rgba(91, 192, 190, 0.15); 
    --stark-red: #e06c75;          
    --stark-gold: #e5c07b;         
    --stark-green: #98c379;        
    --stark-purple: #c678dd;       
    --stark-orange: #d19a66;       
    --stark-text: #abb2bf;         
    --stark-grid: rgba(91, 192, 190, 0.03); 
}

body {
    font-family: 'Share Tech Mono', monospace;
    background-color: var(--stark-bg);
    background-image: 
        linear-gradient(var(--stark-grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--stark-grid) 1px, transparent 1px);
    background-size: 30px 30px;
    color: var(--stark-text);
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: 100vh;
    box-sizing: border-box;
    overflow: hidden;
}

/* Header & Typography */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--stark-cyan-dim);
    padding-bottom: 10px;
}

.title-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo {
    height: 42px;
    width: 42px;
    filter: drop-shadow(0 0 4px var(--stark-cyan-dim));
    animation: pulseCore 4s infinite ease-in-out;
}

@keyframes pulseCore {
    0%, 100% { filter: drop-shadow(0 0 2px var(--stark-cyan-dim)); }
    50% { filter: drop-shadow(0 0 8px var(--stark-cyan-dim)); }
}

h1 {
    margin: 0;
    font-size: 1.8rem;
    font-family: 'Orbitron', sans-serif;
    color: var(--stark-cyan);
    letter-spacing: 2px;
}

.subtitle {
    font-size: 1rem;
    color: var(--stark-text);
    opacity: 0.6;
}

/* HUD Buttons */
.controls {
    display: flex;
    gap: 12px;
}

button {
    font-family: 'Orbitron', sans-serif;
    background-color: transparent;
    color: var(--stark-cyan);
    border: 1px solid var(--stark-cyan-dim);
    padding: 10px 18px;
    font-weight: 500;
    font-size: 0.8rem;
    letter-spacing: 1px;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.2s ease;
    border-radius: 4px;
}

button:hover {
    background-color: rgba(91, 192, 190, 0.1);
    border-color: var(--stark-cyan);
    color: #ffffff;
}

button.secondary.gold { color: var(--stark-gold); border-color: rgba(229, 192, 123, 0.3); }
button.secondary.gold:hover { background-color: rgba(229, 192, 123, 0.1); border-color: var(--stark-gold); }

button.secondary.green { color: var(--stark-green); border-color: rgba(152, 195, 121, 0.3); }
button.secondary.green:hover { background-color: rgba(152, 195, 121, 0.1); border-color: var(--stark-green); }

button.secondary.red { color: var(--stark-red); border-color: rgba(224, 108, 117, 0.3); }
button.secondary.red:hover { background-color: rgba(224, 108, 117, 0.1); border-color: var(--stark-red); }

/* Editor Container */
.editor-container {
    flex-grow: 1;
    position: relative;
    border: 1px solid var(--stark-cyan-dim);
    background-color: var(--stark-panel);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* CodeMirror Core Overrides */
.CodeMirror {
    height: calc(100% - 37px);
    font-family: 'Share Tech Mono', monospace;
    font-size: 16px;
    letter-spacing: 0.5px;
    line-height: 1.5;
}

.cm-s-stark.CodeMirror {
    background: transparent;
    color: var(--stark-text);
}

.cm-s-stark .CodeMirror-gutters {
    background: var(--stark-panel);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.cm-s-stark .CodeMirror-linenumber {
    color: #5c6370;
}

.cm-s-stark .CodeMirror-cursor {
    border-left: 2px solid var(--stark-cyan);
}

.cm-s-stark .CodeMirror-selected {
    background: rgba(91, 192, 190, 0.2) !important;
}

.cm-s-stark .CodeMirror-line::selection, 
.cm-s-stark .CodeMirror-line > span::selection, 
.cm-s-stark .CodeMirror-line > span > span::selection {
    background: rgba(91, 192, 190, 0.2);
}

/* Syntax Highlighting */
.cm-s-stark .cm-keyword { color: var(--stark-purple); }
.cm-s-stark .cm-operator { color: var(--stark-cyan); }
.cm-s-stark .cm-def { color: var(--stark-gold); }
.cm-s-stark .cm-string, .cm-s-stark .cm-string-2 { color: var(--stark-green); }
.cm-s-stark .cm-number { color: var(--stark-orange); } 
.cm-s-stark .cm-comment { color: #5c6370; font-style: italic; }
.cm-s-stark .cm-builtin { color: var(--stark-gold); }
.cm-s-stark .cm-variable { color: var(--stark-text); }
.cm-s-stark .cm-variable-2 { color: var(--stark-red); }
.cm-s-stark .cm-variable-3, .cm-s-stark .cm-type { color: var(--stark-cyan); }
.cm-s-stark .cm-property { color: var(--stark-text); }
.cm-s-stark .cm-meta { color: var(--stark-gold); }
.cm-s-stark .cm-atom { color: var(--stark-orange); }
.cm-s-stark .cm-attribute { color: var(--stark-gold); }
.cm-s-stark .cm-tag { color: var(--stark-red); }
.cm-s-stark .cm-bracket { color: var(--stark-text); }
.cm-s-stark .cm-qualifier { color: var(--stark-green); }
.cm-s-stark .cm-error { color: #ffffff; background-color: var(--stark-red); }

/* HUD Search Dialog */
.CodeMirror-dialog {
    background-color: var(--stark-panel);
    color: var(--stark-text);
    border: 1px solid var(--stark-cyan-dim);
    padding: 10px 15px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.85em;
    border-radius: 4px;
}

.CodeMirror-dialog input {
    background-color: var(--stark-bg);
    color: var(--stark-text);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 6px 10px;
    outline: none;
    font-family: 'Share Tech Mono', monospace;
    border-radius: 3px;
}

.CodeMirror-dialog input:focus {
    border-color: var(--stark-cyan);
}

.CodeMirror-dialog button {
    padding: 4px 10px;
    font-size: 0.9em;
    margin-left: 10px;
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: var(--stark-panel);
    color: var(--stark-cyan);
    border: 1px solid var(--stark-cyan-dim);
    padding: 12px 20px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.85rem;
    letter-spacing: 1px;
    border-radius: 4px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    z-index: 100;
}

/* HUD Tab Bar */
.tabs-bar {
    display: flex;
    background-color: var(--stark-bg);
    border-bottom: 1px solid var(--stark-cyan-dim);
    padding: 5px 10px 0 10px;
    align-items: flex-end;
    z-index: 20;
    position: relative;
}

.tabs-list {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
}
.tabs-list::-webkit-scrollbar {
    display: none;
}

.tab {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
    background-color: transparent;
    padding: 8px 16px;
    margin-right: 2px;
    cursor: grab;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background-color 0.2s, color 0.2s;
    border-radius: 6px 6px 0 0;
    border: 1px solid transparent;
    border-bottom: none;
    user-select: none;
    box-sizing: border-box;
}

.tab:active { cursor: grabbing; }
.tab:hover { background-color: rgba(255, 255, 255, 0.02); color: var(--stark-text); }

.tab.active {
    background-color: var(--stark-panel);
    color: var(--stark-cyan);
    border: 1px solid var(--stark-cyan-dim);
    border-bottom: none;
}

.tab.dragging { opacity: 0.4; background-color: var(--stark-bg); }
.tab.drag-over-left { border-left: 2px solid var(--stark-cyan); }
.tab.drag-over-right { border-right: 2px solid var(--stark-cyan); }
.tab-name { pointer-events: none; }

.tab-close {
    color: var(--stark-text);
    font-weight: bold;
    font-size: 1.1rem;
    line-height: 1;
    opacity: 0.3;
    transition: color 0.2s, opacity 0.2s;
    cursor: pointer;
}
.tab-close:hover { opacity: 1; color: var(--stark-red); }

.add-tab-btn {
    background: transparent;
    border: none;
    color: var(--stark-text);
    font-size: 1.2rem;
    padding: 5px 15px;
    cursor: pointer;
    opacity: 0.5;
}
.add-tab-btn:hover { opacity: 1; color: var(--stark-cyan); }

.lang-indicator {
    margin-left: auto;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.7rem;
    color: var(--stark-gold);
    letter-spacing: 1px;
    padding: 5px 10px;
    margin-bottom: 5px;
    border-radius: 3px;
    background: rgba(229, 192, 123, 0.1);
}

/* CUSTOM MODAL */
.stark-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.stark-modal-overlay.hidden { opacity: 0; pointer-events: none; }

.stark-modal {
    background-color: var(--stark-panel);
    border: 1px solid var(--stark-cyan-dim);
    padding: 25px 35px;
    border-radius: 6px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    min-width: 400px;
    text-align: center;
    transform: scale(1);
    transition: transform 0.3s ease;
}

.stark-modal-overlay.hidden .stark-modal { transform: scale(0.95); }

.stark-modal-header {
    font-family: 'Orbitron', sans-serif;
    color: var(--stark-cyan);
    font-size: 1.2rem;
    margin-bottom: 15px;
    letter-spacing: 1px;
}

.stark-modal-body p {
    color: var(--stark-text);
    margin-bottom: 20px;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
}

.stark-modal-input {
    width: 100%;
    background-color: var(--stark-bg);
    color: var(--stark-text);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 15px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 1rem;
    outline: none;
    margin-bottom: 25px;
    box-sizing: border-box;
    transition: border 0.3s ease;
    text-align: center;
    border-radius: 4px;
}

.stark-modal-input:focus { border-color: var(--stark-cyan); }
.stark-modal-footer { display: flex; justify-content: center; gap: 15px; }
.hidden { display: none !important; }

/* ==================================================
   ADVANCED IDE FEATURES (Stark Integrations)
   ================================================== */

/* Active Line Highlight */
.CodeMirror-activeline-background {
    background: rgba(91, 192, 190, 0.05);
}

/* Match Highlighter (Same variable highlighting) */
.cm-matchhighlight {
    background-color: rgba(229, 192, 123, 0.2);
    border-bottom: 1px solid var(--stark-gold);
    border-radius: 2px;
}
.CodeMirror-selection-highlight-scrollbar {
    background-color: var(--stark-gold);
}

/* Matching Brackets & Tags */
.CodeMirror-matchingbracket, .CodeMirror-matchingtag {
    color: var(--stark-cyan) !important;
    font-weight: bold;
    border-bottom: 1px solid var(--stark-cyan);
    background-color: rgba(91, 192, 190, 0.1);
}

/* Code Folding Icons (Gutters) */
.CodeMirror-foldmarker {
    color: var(--stark-gold);
    text-shadow: none;
    font-family: 'Share Tech Mono', monospace;
    font-size: 14px;
    padding: 0 4px;
    cursor: pointer;
}
.CodeMirror-foldgutter {
    width: 15px;
}
.CodeMirror-foldgutter-open,
.CodeMirror-foldgutter-folded {
    color: var(--stark-cyan-dim);
    cursor: pointer;
    text-align: center;
}
.CodeMirror-foldgutter-open:after {
    content: "▼";
    font-size: 0.7rem;
    color: rgba(255,255,255,0.3);
}
.CodeMirror-foldgutter-folded:after {
    content: "▶";
    font-size: 0.7rem;
    color: var(--stark-cyan);
}
.CodeMirror-foldgutter-open:hover:after,
.CodeMirror-foldgutter-folded:hover:after {
    color: var(--stark-gold);
}

/* Auto-Complete (Hints) Dropdown UI */
.CodeMirror-hints {
    position: absolute;
    z-index: 9999;
    overflow: hidden;
    list-style: none;
    margin: 0;
    padding: 2px;
    background-color: var(--stark-panel);
    border: 1px solid var(--stark-cyan);
    border-radius: 4px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.8);
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.9rem;
    max-height: 20em;
    overflow-y: auto;
}
.CodeMirror-hint {
    margin: 0;
    padding: 4px 10px;
    border-radius: 2px;
    white-space: pre;
    color: var(--stark-text);
    cursor: pointer;
}
.CodeMirror-hint-active {
    background-color: rgba(91, 192, 190, 0.2);
    color: var(--stark-cyan);
    font-weight: bold;
}
.CodeMirror-hints::-webkit-scrollbar {
    width: 6px;
}
.CodeMirror-hints::-webkit-scrollbar-track {
    background: var(--stark-bg);
}
.CodeMirror-hints::-webkit-scrollbar-thumb {
    background: var(--stark-cyan-dim);
    border-radius: 3px;
}