* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}


body {

    min-height: 100vh;

    background:
        radial-gradient(
            circle at top,
            #172554 0%,
            #0f172a 45%,
            #020617 100%
        );

    color: #e2e8f0;

    font-family:
        Inter,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}


/* =========================================
   APP
========================================= */

.app {

    width: 100%;

    max-width: 1500px;

    margin: auto;

    padding: 25px;
}


/* =========================================
   HEADER
========================================= */

.header {

    display: flex;

    align-items: center;

    justify-content: center;

    text-align: center;

    margin-bottom: 25px;
}


.header h1 {

    font-size: 32px;

    color: #f8fafc;

    margin-bottom: 8px;
}


.header p {

    color: #94a3b8;

    font-size: 15px;
}


/* =========================================
   TOOLBAR
========================================= */

.toolbar {

    display: flex;

    flex-wrap: wrap;

    gap: 10px;

    padding: 12px;

    margin-bottom: 14px;

    background: rgba(30, 41, 59, 0.85);

    border: 1px solid #334155;

    border-radius: 12px;
}


.btn {

    border: 1px solid #475569;

    background: #334155;

    color: #f8fafc;

    padding: 10px 16px;

    border-radius: 8px;

    font-size: 14px;

    font-weight: 600;

    cursor: pointer;

    transition:
        background 0.2s,
        transform 0.1s,
        opacity 0.2s;
}


.btn:hover {

    background: #475569;
}


.btn:active {

    transform: scale(0.97);
}


.btn:disabled {

    opacity: 0.45;

    cursor: not-allowed;
}


.run-btn {

    background: #16a34a;

    border-color: #22c55e;
}


.run-btn:hover {

    background: #15803d;
}


.stop-btn {

    background: #991b1b;

    border-color: #ef4444;
}


.stop-btn:hover {

    background: #b91c1c;
}


/* =========================================
   STATUS
========================================= */

.status {

    display: flex;

    align-items: center;

    gap: 9px;

    padding: 10px 14px;

    margin-bottom: 14px;

    background: rgba(30, 41, 59, 0.85);

    border: 1px solid #334155;

    border-radius: 8px;

    font-size: 14px;
}


.status-dot {

    width: 9px;

    height: 9px;

    border-radius: 50%;

    background: #f59e0b;

    box-shadow:
        0 0 8px rgba(245, 158, 11, 0.7);
}


.status.ready .status-dot {

    background: #22c55e;

    box-shadow:
        0 0 8px rgba(34, 197, 94, 0.7);
}


.status.running .status-dot {

    background: #3b82f6;

    box-shadow:
        0 0 8px rgba(59, 130, 246, 0.7);

    animation: pulse 1s infinite;
}


.status.waiting .status-dot {

    background: #f59e0b;

    box-shadow:
        0 0 8px rgba(245, 158, 11, 0.7);

    animation: pulse 1s infinite;
}


.status.error .status-dot {

    background: #ef4444;

    box-shadow:
        0 0 8px rgba(239, 68, 68, 0.7);
}


@keyframes pulse {

    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.35;
    }

    100% {
        opacity: 1;
    }
}


/* =========================================
   EDITOR LAYOUT
========================================= */

.editor-section {

    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        minmax(0, 1fr);

    gap: 15px;

    min-height: 650px;
}


.panel {

    display: flex;

    flex-direction: column;

    min-width: 0;

    overflow: hidden;

    background: #0f172a;

    border: 1px solid #334155;

    border-radius: 12px;

    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.2);
}


/* =========================================
   PANEL HEADER
========================================= */

.panel-header {

    display: flex;

    align-items: center;

    justify-content: space-between;

    min-height: 48px;

    padding: 0 15px;

    background: #172033;

    border-bottom: 1px solid #334155;

    font-size: 14px;

    font-weight: 700;

    color: #f8fafc;
}


.badge {

    padding: 4px 8px;

    border-radius: 5px;

    background: #14532d;

    color: #86efac;

    font-size: 11px;
}


/* =========================================
   CODE EDITOR
========================================= */

#code {

    flex: 1;

    width: 100%;

    min-height: 600px;

    resize: none;

    border: none;

    outline: none;

    padding: 20px;

    background: #020617;

    color: #e2e8f0;

    font-family:
        "Fira Code",
        "Cascadia Code",
        Consolas,
        monospace;

    font-size: 15px;

    line-height: 1.6;

    tab-size: 4;
}


#code::selection {

    background: #1d4ed8;

    color: white;
}


/* =========================================
   TERMINAL
========================================= */

.terminal {

    flex: 1;

    min-height: 550px;

    overflow-y: auto;

    overflow-x: auto;

    padding: 18px;

    background: #020617;

    color: #d1fae5;

    font-family:
        "Fira Code",
        "Cascadia Code",
        Consolas,
        monospace;

    font-size: 14px;

    line-height: 1.65;

    white-space: pre-wrap;

    word-break: break-word;
}


/* =========================================
   TERMINAL LINES
========================================= */

.terminal-line {

    min-height: 22px;

    white-space: pre-wrap;
}


.terminal-output {

    color: #d1fae5;
}


.terminal-error {

    color: #fca5a5;
}


.terminal-command {

    color: #93c5fd;
}


.terminal-system {

    color: #94a3b8;
}


.terminal-prompt {

    color: #fbbf24;
}


/* =========================================
   INPUT AREA
========================================= */

.input-area {

    display: flex;

    align-items: center;

    gap: 8px;

    padding: 10px 12px;

    background: #0f172a;

    border-top: 1px solid #334155;
}


.input-area.hidden {

    display: none;
}


.input-prompt {

    flex-shrink: 0;

    max-width: 55%;

    color: #fbbf24;

    font-family:
        "Fira Code",
        Consolas,
        monospace;

    font-size: 14px;

    white-space: pre-wrap;

    word-break: break-word;
}


#terminalInput {

    flex: 1;

    min-width: 0;

    border: 1px solid #475569;

    outline: none;

    border-radius: 7px;

    padding: 9px 11px;

    background: #020617;

    color: #f8fafc;

    font-family:
        "Fira Code",
        Consolas,
        monospace;

    font-size: 14px;
}


#terminalInput:focus {

    border-color: #3b82f6;

    box-shadow:
        0 0 0 2px rgba(59, 130, 246, 0.15);
}


#terminalInput:disabled {

    opacity: 0.5;
}


.submit-input {

    flex-shrink: 0;

    border: none;

    border-radius: 7px;

    padding: 9px 14px;

    background: #2563eb;

    color: white;

    font-weight: 600;

    cursor: pointer;
}


.submit-input:hover {

    background: #1d4ed8;
}


.submit-input:disabled {

    opacity: 0.45;

    cursor: not-allowed;
}


/* =========================================
   COPY BUTTON
========================================= */

.copy-btn {

    border: 1px solid #475569;

    border-radius: 6px;

    padding: 5px 9px;

    background: #334155;

    color: #e2e8f0;

    font-size: 12px;

    cursor: pointer;
}


.copy-btn:hover {

    background: #475569;
}


/* =========================================
   SCROLLBARS
========================================= */

textarea::-webkit-scrollbar,
.terminal::-webkit-scrollbar {

    width: 9px;

    height: 9px;
}


textarea::-webkit-scrollbar-track,
.terminal::-webkit-scrollbar-track {

    background: #020617;
}


textarea::-webkit-scrollbar-thumb,
.terminal::-webkit-scrollbar-thumb {

    background: #334155;

    border-radius: 10px;
}


textarea::-webkit-scrollbar-thumb:hover,
.terminal::-webkit-scrollbar-thumb:hover {

    background: #475569;
}


/* =========================================
   FOOTER
========================================= */

footer {

    display: flex;

    justify-content: center;

    align-items: center;

    gap: 10px;

    padding: 18px;

    color: #64748b;

    font-size: 13px;

    text-align: center;
}


/* =========================================
   MOBILE
========================================= */

@media (max-width: 900px) {

    .app {

        padding: 15px;
    }


    .editor-section {

        grid-template-columns: 1fr;

        min-height: auto;
    }


    .panel {

        min-height: 450px;
    }


    #code {

        min-height: 450px;
    }


    .terminal {

        min-height: 400px;
    }
}


@media (max-width: 600px) {

    .toolbar {

        display: grid;

        grid-template-columns: 1fr 1fr;
    }


    .toolbar .run-btn,
    .toolbar .stop-btn {

        grid-column: span 1;
    }


    .btn {

        width: 100%;
    }


    .header h1 {

        font-size: 26px;
    }


    .input-area {

        flex-wrap: wrap;
    }


    .input-prompt {

        width: 100%;

        max-width: 100%;
    }


    #terminalInput {

        min-width: 0;

        width: 100%;
    }


    .submit-input {

        width: 80px;
    }


    footer {

        flex-direction: column;
    }
}