/* ==========================================================================
   ide3.css · ArcX Dev Studio（可编程 Web IDE）
   编辑器在浏览器，编译/运行交给本机工具链（MSVC / dotnet / Python）
   ========================================================================== */

:root {
    --bg: #0b0d11;
    --bg-2: #0f1216;
    --panel: #12151a;
    --panel-2: #171b21;
    --panel-3: #1e232a;
    --line: #242a32;
    --line-2: #313842;
    --text: #e6e9ef;
    --dim: #8b93a1;
    --dim-2: #5d6572;
    --acc: #d9ff38;
    --acc-2: #4fc3f7;
    --warn: #ffb020;
    --err: #ff6b6b;
    --ok: #6ee7a0;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
        "Cascadia Mono", "Liberation Mono", monospace;
    --c-cm: #5d6572;
    --c-str: #8bd39b;
    --c-tag: #ff8f6b;
    --c-attr: #d9ff38;
    --c-num: #f0b37e;
    --c-kw: #c9a0ff;
    --c-fn: #7fd3ff;
    --c-pun: #8b93a1;
    --c-type: #4fc3f7;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    overflow: hidden;
    color: var(--text);
    background: var(--bg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Microsoft YaHei", sans-serif;
    font-size: 13px;
    -webkit-font-smoothing: antialiased;
}

::selection {
    color: #0b0d11;
    background: var(--acc);
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--line-2);
    border: 2px solid transparent;
    background-clip: content-box;
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background: #414a57;
    background-clip: content-box;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    background: none;
    border: 0;
}

/* ---------- 应用骨架 ---------- */

.app {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 46px minmax(0, 1fr);
    height: 100vh;
    overflow: hidden;
}

/* ---------- 顶栏 ---------- */

.topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    padding: 0 12px;
    overflow-x: auto;
    overflow-y: hidden;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    scrollbar-width: none;
}

.topbar::-webkit-scrollbar {
    display: none;
}

.brand {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-shrink: 0;
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.brand i {
    width: 9px;
    height: 9px;
    background: var(--acc);
    border-radius: 2px;
    box-shadow: 0 0 12px rgba(217, 255, 56, .6);
}

.brand b {
    color: var(--acc);
}

.brand span {
    color: var(--dim-2);
}

.topbar-sep {
    width: 1px;
    height: 22px;
    background: var(--line);
}

.project-name {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    color: var(--dim);
    font-size: 12.5px;
}

.project-name b {
    color: var(--text);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 260px;
}

.project-badge {
    padding: 2px 8px;
    border-radius: 999px;
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: .08em;
}

.project-badge.is-local {
    color: #0b0d11;
    background: var(--ok);
}

.project-badge.is-cloud {
    color: var(--dim);
    background: var(--panel-3);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    flex-shrink: 0;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 13px;
    color: var(--dim);
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 12px;
    white-space: nowrap;
    transition: color .16s ease, border-color .16s ease, background .16s ease;
}

.btn:hover {
    color: var(--text);
    border-color: var(--line-2);
    background: var(--panel-3);
}

.btn--primary {
    color: #0b0d11;
    background: var(--acc);
    border-color: var(--acc);
    font-weight: 600;
}

.btn--primary:hover {
    color: #0b0d11;
    background: #e4ff62;
    border-color: #e4ff62;
}

.btn--ghost {
    background: transparent;
}

.btn.is-active {
    color: #0b0d11;
    background: var(--acc);
    border-color: var(--acc);
    font-weight: 600;
}

.btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.btn-small {
    padding: 5px 9px;
    font-size: 11.5px;
    border-radius: 7px;
}

.select {
    padding: 7px 10px;
    color: var(--dim);
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 12px;
    outline: none;
    cursor: pointer;
    transition: color .16s ease, border-color .16s ease;
}

.select:hover,
.select:focus {
    color: var(--text);
    border-color: var(--line-2);
}

.stdin-bar {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
    padding: 10px 14px;
    background: var(--bg-2);
    border-bottom: 1px solid var(--line);
}

.stdin-bar[hidden] {
    display: none;
}

.stdin-bar span {
    color: var(--dim);
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.stdin-bar textarea {
    height: 52px;
    padding: 8px 10px;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--line-2);
    border-radius: 8px;
    font-family: var(--mono);
    font-size: 12px;
    outline: none;
    resize: vertical;
}

/* ---------- 主体 ---------- */

.body {
    display: grid;
    grid-template-columns: 262px minmax(0, 1fr);
    min-width: 0;
    min-height: 0;
}

.body.is-side-hidden {
    grid-template-columns: 0 minmax(0, 1fr);
}

.body.is-side-hidden .sidebar {
    display: none;
}

/* 侧栏 */

.sidebar {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--panel);
    border-right: 1px solid var(--line);
}

.sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 11px 10px 9px 13px;
    color: var(--dim);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.sidebar-tools {
    display: flex;
    gap: 2px;
}

.icon-btn {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    color: var(--dim);
    border-radius: 6px;
    font-size: 13px;
    transition: color .16s ease, background .16s ease;
}

.icon-btn:hover {
    color: var(--text);
    background: var(--panel-2);
}

.file-tree {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 0 6px 12px;
}

.file-row {
    display: flex;
    align-items: center;
    gap: 7px;
    width: 100%;
    padding: 6px 8px;
    color: var(--dim);
    border: 0;
    border-radius: 6px;
    font-family: var(--mono);
    font-size: 12px;
    text-align: left;
    transition: color .14s ease, background .14s ease;
}

.file-row:hover {
    color: var(--text);
    background: var(--panel-2);
}

.file-row.is-active {
    color: #0b0d11;
    background: var(--acc);
    font-weight: 600;
}

.file-row.is-dirty::after {
    content: "";
    width: 6px;
    height: 6px;
    margin-left: auto;
    background: var(--warn);
    border-radius: 50%;
}

.file-row .name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-row .size {
    margin-left: auto;
    color: var(--dim-2);
    font-size: 10px;
}

.file-row.is-active .size {
    color: rgba(11, 13, 17, .55);
}

.sidebar-foot {
    padding: 10px 12px 12px;
    border-top: 1px solid var(--line);
}

.sidebar-tip {
    color: var(--dim-2);
    font-size: 11px;
    line-height: 1.6;
}

/* 主区 */

.main {
    display: grid;
    grid-template-rows: 37px minmax(0, 1fr) auto 25px;
    min-width: 0;
    min-height: 0;
    background: var(--bg);
}

.tabs {
    display: flex;
    align-items: stretch;
    min-width: 0;
    overflow-x: auto;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    flex-shrink: 0;
    color: var(--dim);
    background: transparent;
    border: 0;
    border-right: 1px solid var(--line);
    border-top: 2px solid transparent;
    font-family: var(--mono);
    font-size: 12px;
    transition: color .16s ease, background .16s ease;
}

.tab:hover {
    color: var(--text);
    background: var(--panel-2);
}

.tab.is-active {
    color: var(--text);
    background: var(--bg);
    border-top-color: var(--acc);
}

.tab .dot {
    width: 6px;
    height: 6px;
    background: var(--warn);
    border-radius: 50%;
}

.tab .close {
    display: grid;
    place-items: center;
    width: 16px;
    height: 16px;
    color: var(--dim-2);
    border-radius: 4px;
    font-size: 12px;
}

.tab .close:hover {
    color: #fff;
    background: var(--err);
}

/* 编辑器 */

.editor {
    display: flex;
    min-height: 0;
    position: relative;
}

.code {
    position: relative;
    flex: 1;
    min-width: 0;
}

.monaco-host {
    position: absolute;
    inset: 0;
}

/* Monaco 不可用时的原生回退编辑器 */
.native-fallback {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 14px 18px;
    color: var(--text);
    background: var(--bg);
    border: 0;
    outline: none;
    resize: none;
    font-family: var(--mono);
    font-size: 13px;
    line-height: 20px;
    tab-size: 4;
}

.native-fallback[hidden] {
    display: none;
}

.hl .c {
    color: var(--c-cm);
    font-style: italic;
}

.hl .s {
    color: var(--c-str);
}

.hl .t {
    color: var(--c-tag);
}

.hl .a {
    color: var(--c-attr);
}

.hl .n {
    color: var(--c-num);
}

.hl .k {
    color: var(--c-kw);
}

.hl .f {
    color: var(--c-fn);
}

.hl .p {
    color: var(--c-pun);
}

.hl .m {
    color: var(--c-meta, #ff6748);
}

.hl .y {
    color: var(--c-type);
}

/* 面板 */

.panels {
    display: flex;
    flex-direction: column;
    height: 264px;
    background: var(--panel);
    border-top: 1px solid var(--line);
}

.panels.is-hidden {
    display: none;
}

.panel-head {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 35px;
    flex-shrink: 0;
    padding: 0 10px;
    border-bottom: 1px solid var(--line);
}

.panel-tab {
    padding: 5px 11px;
    color: var(--dim);
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    transition: color .16s ease, background .16s ease;
}

.panel-tab:hover {
    color: var(--text);
}

.panel-tab.is-active {
    color: var(--text);
    background: var(--panel-3);
}

.panel-head .spacer {
    flex: 1;
}

.panel-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 12px 14px;
    font-size: 12.5px;
    line-height: 1.7;
}

.panel-body.is-mono {
    font-family: var(--mono);
    white-space: pre-wrap;
    word-break: break-word;
}

.line {
    white-space: pre-wrap;
    word-break: break-word;
}

.line.is-dim {
    color: var(--dim-2);
}

.line.is-ok {
    color: var(--ok);
}

.line.is-err {
    color: var(--err);
}

.line.is-warn {
    color: var(--warn);
}

.line.is-acc {
    color: var(--acc);
}

/* 状态栏 */

.status {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    overflow: hidden;
    padding: 0 12px;
    color: #0b0d11;
    background: var(--acc);
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 600;
    user-select: none;
}

.status .spacer {
    flex: 1;
}

.status-badge {
    padding: 1px 7px;
    background: rgba(11, 13, 17, .16);
    border-radius: 999px;
}

.status-badge.is-dirty {
    color: #fff;
    background: #d97706;
}

/* ---------- 环境报告卡片 ---------- */

.env-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 12px;
}

.env-card {
    padding: 15px 16px;
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: 12px;
}

.env-card.is-ok {
    border-color: rgba(110, 231, 160, .4);
}

.env-card.is-miss {
    border-color: rgba(255, 107, 107, .35);
}

.env-card.is-idle {
    border-color: var(--line);
}

.env-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--dim);
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.env-value {
    margin-top: 10px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -.01em;
}

.env-card.is-ok .env-value {
    color: var(--ok);
}

.env-card.is-miss .env-value {
    color: var(--err);
}

.env-note {
    margin-top: 7px;
    color: var(--dim-2);
    font-size: 11.5px;
    line-height: 1.6;
}

.env-list {
    margin-top: 8px;
    color: var(--dim);
    font-family: var(--mono);
    font-size: 11.5px;
    line-height: 1.7;
    word-break: break-all;
}

/* ---------- 代码块 / 命令 ---------- */

.code-block {
    position: relative;
    margin-top: 10px;
    padding: 13px 15px;
    padding-right: 74px;
    overflow-x: auto;
    color: #cfe3ff;
    background: #0a0f16;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-family: var(--mono);
    font-size: 12px;
    line-height: 1.7;
    white-space: pre;
}

.code-block .copy {
    position: absolute;
    top: 9px;
    right: 9px;
}

.hint {
    margin-top: 10px;
    padding: 10px 13px;
    color: var(--dim);
    background: rgba(79, 195, 247, .07);
    border-left: 2px solid var(--acc-2);
    border-radius: 0 8px 8px 0;
    font-size: 12px;
    line-height: 1.7;
}

.hint.is-warn {
    background: rgba(255, 176, 32, .08);
    border-left-color: var(--warn);
}

.hint b {
    color: var(--text);
}

/* ---------- 拖放 ---------- */

.drop-veil {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    color: var(--text);
    background: rgba(11, 13, 17, .86);
    border: 2px dashed var(--acc);
    font-size: 15px;
    backdrop-filter: blur(6px);
}

.drop-veil[hidden] {
    display: none;
}

/* ---------- 弹窗 ---------- */

.modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 22px;
    background: rgba(5, 6, 9, .72);
    backdrop-filter: blur(8px);
}

.modal[hidden] {
    display: none;
}

.modal-card {
    width: min(560px, 94vw);
    max-height: 88vh;
    overflow: auto;
    padding: 24px 24px 20px;
    background: var(--panel-2);
    border: 1px solid var(--line-2);
    border-radius: 16px;
    box-shadow: 0 40px 90px rgba(0, 0, 0, .6);
}

.modal-card h3 {
    font-size: 17px;
    font-weight: 700;
}

.modal-card p {
    margin-top: 8px;
    color: var(--dim);
    font-size: 12.5px;
    line-height: 1.7;
}

.modal-card textarea {
    width: 100%;
    height: 150px;
    margin-top: 12px;
    padding: 11px 13px;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--line-2);
    border-radius: 10px;
    font-family: var(--mono);
    font-size: 12px;
    outline: none;
    resize: vertical;
}

.modal-card input[type="text"] {
    width: 100%;
    margin-top: 12px;
    padding: 11px 13px;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--line-2);
    border-radius: 10px;
    font-family: var(--mono);
    font-size: 13px;
    outline: none;
}

.modal-actions {
    display: flex;
    gap: 9px;
    justify-content: flex-end;
    margin-top: 18px;
}

/* ---------- 提示条 ---------- */

.panel-restore {
    position: fixed;
    right: 18px;
    bottom: 40px;
    z-index: 30;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    color: #0b0d11;
    background: var(--acc);
    border: 0;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: .02em;
    box-shadow: 0 12px 28px rgba(217, 255, 56, .3);
    animation: restoreIn .28s ease both;
}

.panel-restore:hover {
    background: #e4ff62;
}

.panel-restore[hidden] {
    display: none;
}

@keyframes restoreIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.toast {
    position: fixed;
    right: 18px;
    bottom: 40px;
    z-index: 60;
    max-width: 380px;
    padding: 12px 16px;
    color: var(--text);
    background: var(--panel-3);
    border: 1px solid var(--line-2);
    border-radius: 11px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .5);
    font-size: 12.5px;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity .22s ease, transform .22s ease;
}

.toast.is-show {
    opacity: 1;
    transform: translateY(0);
}

/* ---------- 运行中遮罩 ---------- */

.busy {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: grid;
    place-items: center;
    color: var(--dim);
    background: rgba(11, 13, 17, .7);
    font-family: var(--mono);
    font-size: 12px;
}

.busy[hidden] {
    display: none;
}

/* ---------- 响应式 ---------- */

@media (max-width: 940px) {
    .body {
        grid-template-columns: 190px minmax(0, 1fr);
    }

    .project-name {
        display: none;
    }

    .panels {
        height: 220px;
    }
}

@media (max-width: 680px) {
    .body {
        grid-template-columns: minmax(0, 1fr);
    }

    .sidebar {
        display: none;
    }

    .topbar {
        gap: 8px;
    }

    .brand span {
        display: none;
    }

    .btn span.label {
        display: none;
    }

    .project-badge {
        display: none;
    }

    .status {
        gap: 9px;
    }

    #stPos,
    #stFile {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        transition-duration: .001ms !important;
        animation-duration: .001ms !important;
    }
}
