* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #08090d;
    --panel: #11131a;
    --panel2: #151821;
    --border: #292d38;

    --text: #ffffff;
    --muted: #8d94a5;

    --primary: #7c5cff;
    --primary-hover: #6948ee;

    --green: #35d49a;
    --green-hover: #2bb984;

    --danger: #ff5c6c;
}

html,
body {
    width: 100%;
    height: 100%;
}

body {
    overflow: hidden;

    background: var(--bg);
    color: var(--text);

    font-family:
        Inter,
        Arial,
        sans-serif;
}


/* =====================================================
   TOP BAR
   ===================================================== */

.topbar {
    height: 58px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 18px;

    background: #101218;

    border-bottom: 1px solid var(--border);

    position: relative;
    z-index: 20;
}


.brand {
    display: flex;
    align-items: center;

    gap: 10px;

    color: white;
    text-decoration: none;

    flex-shrink: 0;
}


.brand-icon {
    width: 34px;
    height: 34px;

    border-radius: 9px;

    overflow: hidden;

    flex-shrink: 0;
}


.brand-icon img {
    width: 100%;
    height: 100%;

    object-fit: cover;

    display: block;
}


.brand-text {
    font-size: 19px;
    font-weight: 800;

    white-space: nowrap;
}


.brand-text span {
    color: var(--primary);
}


.top-title {
    color: var(--muted);

    font-size: 14px;
    font-weight: 600;

    position: absolute;
    left: 50%;

    transform: translateX(-50%);

    white-space: nowrap;
}


.dashboard-btn {
    color: #fff;

    text-decoration: none;

    font-size: 13px;
    font-weight: 600;

    padding: 8px 10px;

    border-radius: 6px;

    transition:
        background 0.2s ease,
        color 0.2s ease;

    flex-shrink: 0;
}


.dashboard-btn:hover {
    background: #1d2029;
    color: #ffffff;
}


/* =====================================================
   TOOLBAR
   ===================================================== */

.toolbar {
    height: 52px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 12px;

    background: #0d0f14;

    border-bottom: 1px solid var(--border);

    position: relative;
    z-index: 20;
}


.toolbar-left {
    display: flex;
    align-items: center;

    gap: 8px;

    min-width: 0;
}


.toolbar-right {
    color: var(--muted);

    font-size: 12px;

    white-space: nowrap;
}


.language-select {
    height: 34px;

    min-width: 150px;

    padding: 0 10px;

    border-radius: 7px;

    border: 1px solid #343946;

    background: #171a22;

    color: white;

    outline: none;

    cursor: pointer;

    font-size: 13px;
}


.language-select:focus {
    border-color: var(--primary);
}


.toolbar button {
    height: 34px;

    padding: 0 14px;

    border: none;

    border-radius: 7px;

    cursor: pointer;

    font-weight: 700;

    font-size: 12px;

    transition:
        transform 0.15s ease,
        background 0.2s ease,
        opacity 0.2s ease;

    user-select: none;

    position: relative;
    z-index: 30;
}


.toolbar button:hover {
    transform: translateY(-1px);
}


.toolbar button:active {
    transform: translateY(0);
}


.run-btn {
    background: var(--primary);
    color: white;
}


.run-btn:hover {
    background: var(--primary-hover);
}


.preview-btn {
    background: #183328;
    color: var(--green);
}


.preview-btn:hover {
    background: #214535;
    color: #57e5ad;
}


.clear-btn {
    background: #252a34;
    color: white;
}


.clear-btn:hover {
    background: #303642;
}


/* =====================================================
   WORKSPACE
   ===================================================== */

.workspace {
    height: calc(100vh - 110px);

    display: grid;

    grid-template-columns:
        minmax(0, 1.7fr)
        minmax(360px, 0.8fr);

    gap: 1px;

    background: var(--border);
}


/* =====================================================
   EDITOR PANEL
   ===================================================== */

.editor-panel {
    min-width: 0;
    min-height: 0;

    background: #1e1e1e;

    display: flex;
    flex-direction: column;

    position: relative;
}


.editor-container {
    flex: 1;

    min-width: 0;
    min-height: 0;

    width: 100%;

    position: relative;
}


/* =====================================================
   TERMINAL PANEL
   ===================================================== */

.terminal-panel {
    min-width: 0;
    min-height: 0;

    background: #0b0d12;

    display: flex;
    flex-direction: column;

    position: relative;
}


/* =====================================================
   PANEL HEADER
   ===================================================== */

.panel-header {
    height: 38px;

    min-height: 38px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 12px;

    background: var(--panel2);

    border-bottom: 1px solid var(--border);

    font-size: 12px;
    font-weight: 700;

    user-select: none;
}


.shortcut {
    color: #707887;

    font-size: 10px;
}


/* =====================================================
   SMALL BUTTON
   ===================================================== */

.small-btn {
    border: 1px solid #343946;

    background: #20242d;

    color: white;

    border-radius: 5px;

    padding: 4px 8px;

    cursor: pointer;

    font-size: 11px;

    transition:
        background 0.2s ease,
        border-color 0.2s ease;
}


.small-btn:hover {
    background: #2a2f3a;

    border-color: #464c5b;
}


.small-btn:active {
    transform: translateY(1px);
}


/* =====================================================
   TERMINAL OUTPUT
   ===================================================== */

.terminal-output {
    flex: 1;

    min-width: 0;
    min-height: 0;

    overflow-y: auto;

    padding: 15px;

    font-family:
        Consolas,
        "Cascadia Code",
        "Courier New",
        monospace;

    font-size: 12px;

    line-height: 1.65;

    white-space: pre-wrap;

    word-break: break-word;

    color: #d8dce5;

    background: #0b0d12;
}


.terminal-output::-webkit-scrollbar {
    width: 8px;
}


.terminal-output::-webkit-scrollbar-track {
    background: #0b0d12;
}


.terminal-output::-webkit-scrollbar-thumb {
    background: #343946;

    border-radius: 10px;
}


.terminal-output::-webkit-scrollbar-thumb:hover {
    background: #454b59;
}


/* =====================================================
   TERMINAL WELCOME
   ===================================================== */

.terminal-welcome {
    color: #8f96a6;

    line-height: 1.8;
}


.terminal-title {
    color: #ffffff;

    font-weight: 700;

    margin-bottom: 4px;
}


/* =====================================================
   MONACO HELPERS
   ===================================================== */

#editorContainer {
    overflow: hidden;
}


/*
   Monaco should occupy the complete editor area.
*/

#editorContainer .monaco-editor {
    width: 100% !important;
    height: 100% !important;
}


#editorContainer .overflow-guard {
    width: 100% !important;
    height: 100% !important;
}


/* =====================================================
   SELECTION / ACCESSIBILITY
   ===================================================== */

button:focus-visible,
select:focus-visible,
a:focus-visible {
    outline: 2px solid var(--primary);

    outline-offset: 2px;
}


/* =====================================================
   DISABLED STATE
   ===================================================== */

button:disabled {
    cursor: not-allowed;

    opacity: 0.55;

    transform: none !important;
}


/* =====================================================
   TABLET
   ===================================================== */

@media (max-width: 900px) {

    html,
    body {
        overflow: hidden;
    }


    .top-title {
        display: none;
    }


    .workspace {
        grid-template-columns: 1fr 340px;
    }


    .language-select {
        min-width: 130px;
    }


    .toolbar button {
        padding: 0 11px;
    }

}


/* =====================================================
   SMALL TABLET
   ===================================================== */

@media (max-width: 720px) {

    .topbar {
        padding: 0 12px;
    }


    .brand-text {
        font-size: 17px;
    }


    .dashboard-btn {
        font-size: 12px;
    }


    .workspace {
        grid-template-columns: 1fr;
        grid-template-rows: 60% 40%;

        height: calc(100vh - 110px);
    }


    .editor-panel {
        min-height: 0;
    }


    .terminal-panel {
        min-height: 0;
    }


    .toolbar {
        overflow-x: auto;

        justify-content: flex-start;
    }


    .toolbar-left {
        min-width: max-content;
    }


    .toolbar-right {
        display: none;
    }

}


/* =====================================================
   MOBILE
   ===================================================== */

@media (max-width: 520px) {

    .topbar {
        height: 54px;
    }


    .brand-icon {
        width: 30px;
        height: 30px;
    }


    .brand-text {
        display: none;
    }


    .dashboard-btn {
        padding: 7px 8px;
    }


    .toolbar {
        height: 56px;

        padding: 0 8px;
    }


    .language-select {
        height: 32px;

        min-width: 125px;
    }


    .toolbar button {
        height: 32px;

        padding: 0 10px;

        font-size: 11px;
    }


    .workspace {
        height: calc(100vh - 110px);

        grid-template-rows: 58% 42%;
    }


    .panel-header {
        height: 36px;
        min-height: 36px;

        padding: 0 9px;
    }


    .shortcut {
        display: none;
    }


    .terminal-output {
        padding: 11px;

        font-size: 11px;
    }

}


/* =====================================================
   VERY SMALL SCREEN
   ===================================================== */

@media (max-width: 380px) {

    .dashboard-btn {
        font-size: 10px;
    }


    .language-select {
        min-width: 110px;
    }


    .toolbar button {
        padding: 0 8px;

        font-size: 10px;
    }

}