:root {
    --bg: #0b1020;
    --panel: #11182a;
    --panel-2: #151e34;
    --panel-3: #1b2740;
    --line: #293653;
    --line-soft: rgba(146, 166, 211, .14);
    --text: #e7ecf8;
    --muted: #8c9bb9;
    --faint: #627292;
    --cyan: #70d8e8;
    --green: #8be0ae;
    --yellow: #f2d38a;
    --red: #ff919d;
    --purple: #c2aeff;
    --orange: #f4b47b;
    --shadow: 0 24px 70px rgba(0, 0, 0, .3);
    --radius: 16px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 12% 0%, rgba(80, 106, 184, .2), transparent 35rem),
        radial-gradient(circle at 95% 15%, rgba(47, 150, 163, .12), transparent 30rem),
        var(--bg);
}
button, input { font: inherit; }
button { cursor: pointer; }
code, .terminal-output, .terminal-input-row, .status-list dd, .file-tree { font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace; }

.lab-app { width: min(1600px, calc(100% - 28px)); margin: 0 auto; padding: 22px 0 18px; }
.lab-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.brand-lockup { display: flex; align-items: center; gap: 13px; }
/* Logo jest odnośnikiem na pulpit — wygląd zostaje ten sam, co div.
   Bez tego <a> dziedziczyłby niebieski kolor linku przeglądarki. */
a.brand-lockup { color: inherit; text-decoration: none; }
a.brand-lockup:hover .brand-mark { filter: brightness(1.1); }
.brand-mark {
    display: grid; width: 44px; height: 44px; place-items: center;
    color: #08101c; border-radius: 13px; background: linear-gradient(135deg, var(--cyan), #9d8aff);
    font: 900 25px Georgia, serif; box-shadow: 0 8px 25px rgba(112, 216, 232, .2);
}
.eyebrow { margin: 0 0 3px; color: var(--cyan); font-size: 10px; font-weight: 850; letter-spacing: .14em; }
h1 { margin: 0; font: 500 clamp(22px, 3vw, 32px)/1.1 Georgia, "Times New Roman", serif; letter-spacing: -.025em; }
.header-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.simulation-badge, .ghost-button, .tiny-button {
    display: inline-flex; align-items: center; justify-content: center; min-height: 33px; padding: 6px 10px;
    color: var(--muted); border: 1px solid var(--line); border-radius: 8px; background: rgba(20, 29, 50, .8);
    font-size: 11px; text-decoration: none;
}
.simulation-badge { gap: 7px; color: var(--green); border-color: rgba(139, 224, 174, .25); background: rgba(139, 224, 174, .08); }
.simulation-badge i, .online-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(139, 224, 174, .1); }
.ghost-button:hover, .tiny-button:hover { color: var(--text); border-color: #536a98; background: var(--panel-3); }
.file-button { cursor: pointer; }

.lab-notice {
    margin-bottom: 16px; padding: 11px 14px; color: #c3cee6; border: 1px solid rgba(112, 216, 232, .18); border-radius: 11px;
    background: rgba(61, 116, 145, .1); font-size: 12px; line-height: 1.5;
}
.lab-notice strong { color: var(--cyan); }

.lab-layout { display: grid; grid-template-columns: 285px minmax(0, 1fr); gap: 16px; align-items: stretch; }
.lab-sidebar { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.side-card { padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(17, 24, 42, .88); box-shadow: var(--shadow); }
.side-card--muted { color: var(--muted); background: rgba(17, 24, 42, .6); font-size: 11px; line-height: 1.55; }
.side-card--muted p { margin: 0; }
.side-card--muted strong { color: var(--yellow); }
.side-card code { color: var(--green); }
.side-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.side-card-heading .online-dot { display: inline-block; width: 6px; height: 6px; box-shadow: none; }
.key-hint { color: var(--faint); font-size: 12px; }
.tiny-button { min-height: 24px; padding: 2px 7px; font-size: 13px; }
.status-list { display: grid; gap: 9px; margin: 0; }
.status-list div { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.status-list dt { color: var(--faint); font-size: 11px; }
.status-list dd { max-width: 68%; margin: 0; overflow: hidden; color: var(--text); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.quick-actions { display: grid; gap: 6px; }
.quick-actions button {
    width: 100%; padding: 8px 9px; color: var(--muted); border: 1px solid transparent; border-radius: 8px; background: rgba(255,255,255,.035); text-align: left; font-size: 11px;
}
.quick-actions button:hover { color: var(--cyan); border-color: rgba(112, 216, 232, .25); background: rgba(112, 216, 232, .07); }
.file-tree { max-height: 340px; overflow: auto; padding-right: 3px; color: var(--muted); font-size: 11px; line-height: 1.7; }
.tree-row { display: flex; align-items: center; gap: 5px; min-height: 22px; padding: 1px 4px; border-radius: 5px; cursor: pointer; white-space: nowrap; }
.tree-row:hover { color: var(--text); background: rgba(255,255,255,.06); }
.tree-row.is-current { color: var(--yellow); background: rgba(242, 211, 138, .08); }
.tree-icon { width: 13px; color: var(--cyan); text-align: center; }
.tree-name { overflow: hidden; text-overflow: ellipsis; }

.terminal-panel { display: flex; min-width: 0; min-height: 680px; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: #0a0f1d; box-shadow: var(--shadow); }
.terminal-toolbar { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 14px; border-bottom: 1px solid var(--line); background: #121a2d; }
.window-controls { display: flex; gap: 6px; }
.window-controls i { width: 9px; height: 9px; border-radius: 50%; background: #ff7d88; }
.window-controls i:nth-child(2) { background: #f0c66d; }
.window-controls i:nth-child(3) { background: #78d5a0; }
.terminal-tab { display: flex; align-items: center; gap: 7px; min-width: 0; color: var(--muted); font-size: 11px; }
.terminal-prompt-dot { display: grid; width: 19px; height: 19px; place-items: center; color: #07121c; border-radius: 5px; background: var(--green); font: 800 11px Consolas, monospace; }
.toolbar-actions { display: flex; gap: 5px; margin-left: auto; }
.toolbar-actions button { padding: 5px 8px; color: var(--faint); border: 1px solid transparent; border-radius: 6px; background: transparent; font-size: 10px; }
.toolbar-actions button:hover { color: var(--text); border-color: var(--line); background: rgba(255,255,255,.05); }
.terminal-output { flex: 1; min-height: 0; overflow: auto; padding: 17px 18px 12px; color: #cbd5eb; font-size: 12px; line-height: 1.58; scrollbar-color: #334565 transparent; }
.output-line { min-height: 1.58em; white-space: pre-wrap; overflow-wrap: anywhere; }
.output-line.command { color: var(--text); }
.output-line.command .prompt-inline { color: var(--green); }
.output-line.stderr { color: var(--red); }
.output-line.system { color: var(--yellow); }
.output-line.success { color: var(--green); }
.output-line.info { color: var(--cyan); }
.output-line.muted { color: var(--faint); }
.output-line a { color: var(--cyan); }
.terminal-input-row { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 7px 14px; border-top: 1px solid var(--line); background: #10182a; }
.prompt-label { flex: 0 0 auto; color: var(--green); font-size: 12px; white-space: nowrap; }
.terminal-input-row input { min-width: 0; flex: 1; padding: 7px 4px; color: var(--text); border: 0; outline: 0; background: transparent; caret-color: var(--cyan); font-size: 12px; }
.send-button { width: 29px; height: 29px; color: var(--bg); border: 0; border-radius: 7px; background: var(--cyan); font-weight: 900; }
.send-button:hover { background: #a2eff4; }
.terminal-statusbar { display: flex; justify-content: space-between; gap: 10px; padding: 7px 14px; color: var(--faint); border-top: 1px solid var(--line-soft); background: #0d1425; font-size: 10px; }
.terminal-statusbar b { color: var(--muted); font-weight: 700; }
.lab-footer { display: flex; justify-content: space-between; gap: 12px; padding: 12px 2px 0; color: var(--faint); font-size: 10px; }
.lab-footer strong { color: var(--muted); }

@media (max-width: 900px) {
    .lab-layout { grid-template-columns: 1fr; }
    .lab-sidebar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
    .side-card:last-child { grid-column: 1 / -1; }
    .file-tree { max-height: 190px; }
    .terminal-panel { min-height: 650px; }
}
@media (max-width: 620px) {
    .lab-app { width: min(100% - 14px, 1600px); padding-top: 10px; }
    .lab-header { align-items: flex-start; flex-direction: column; }
    .header-actions { justify-content: flex-start; }
    .lab-sidebar { display: flex; }
    .terminal-panel { min-height: 600px; }
    .terminal-statusbar { flex-wrap: wrap; }
    .terminal-statusbar span:nth-child(2) { display: none; }
    .lab-footer { flex-direction: column; }
    .prompt-label { max-width: 47vw; overflow: hidden; text-overflow: ellipsis; }
}

body.is-embedded {
    height: 100vh;
    overflow: hidden;
}

body.is-embedded .lab-app {
    display: flex;
    width: 100%;
    height: 100vh;
    flex-direction: column;
    padding: 8px;
}

body.is-embedded .lab-header {
    flex: 0 0 auto;
    min-height: 44px;
    margin-bottom: 8px;
}

body.is-embedded .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
}

body.is-embedded h1 {
    font-size: 24px;
}

body.is-embedded .lab-notice,
body.is-embedded .lab-footer {
    display: none;
}

body.is-embedded .lab-layout {
    flex: 1 1 auto;
    min-height: 0;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 8px;
}

body.is-embedded .lab-sidebar {
    min-height: 0;
    overflow: auto;
}

body.is-embedded .file-tree {
    max-height: none;
}

body.is-embedded .terminal-panel {
    min-height: 0;
    height: 100%;
}

@media (max-width: 760px) {
    body.is-embedded {
        overflow: auto;
    }

    body.is-embedded .lab-app {
        height: auto;
        min-height: 100vh;
    }

    body.is-embedded .lab-layout {
        display: flex;
        flex-direction: column;
    }

    body.is-embedded .terminal-panel {
        min-height: 600px;
    }
}

