/* ==========================================================================
   dev-console.css · 开发者门户 + 代码行
   与 index.html / index3.html 的深色基调一致，独立命名空间 .dc-*
   ========================================================================== */

.dc-root {
    position: fixed;
    inset: 0;
    /*
     * 取 32 位有符号整数上限。
     * style.css 里的弃用层用到 9999999（甚至一亿），用常规数值会被它盖住，
     * 导致拖动时真实鼠标事件被上层元素截走（终端看着在上面，实际点不到）。
     */
    z-index: 2147483647;
    font-family: ui-monospace, "SFMono-Regular", "JetBrains Mono", Consolas, monospace;
}

.dc-root[hidden] {
    display: none;
}

/* ---------------------------------------------------------------- 门户 */

.dc-portal {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(4, 4, 6, .72);
    backdrop-filter: blur(10px) saturate(120%);
    -webkit-backdrop-filter: blur(10px) saturate(120%);
    animation: dcFade .22s ease both;
}

.dc-portal[hidden] {
    display: none;
}

@keyframes dcFade {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.dc-portal__box {
    width: min(420px, 100%);
    padding: 24px;
    background: linear-gradient(160deg, #14141a, #0b0b0f);
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 14px;
    box-shadow: 0 40px 90px rgba(0, 0, 0, .65);
}

.dc-portal__head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.dc-portal__badge {
    padding: 3px 8px;
    color: #04060a;
    background: #d9ff38;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .12em;
    border-radius: 4px;
}

.dc-portal__title {
    flex: 1;
    color: #f2f2f5;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: .02em;
}

.dc-portal__close,
.dc-term__close {
    width: 26px;
    height: 26px;
    color: #9a9aa5;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 6px;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    transition: color .2s ease, border-color .2s ease, background .2s ease;
}

.dc-portal__close:hover,
.dc-term__close:hover {
    color: #fff;
    background: rgba(255, 255, 255, .08);
    border-color: rgba(255, 255, 255, .3);
}

.dc-portal__desc {
    margin-bottom: 18px;
    color: #8d8d99;
    font-size: 12px;
    line-height: 1.7;
}

.dc-portal__hint {
    display: inline-block;
    margin-top: 8px;
    color: #6c6c78;
}

.dc-portal__desc kbd {
    padding: 2px 6px;
    color: #d9ff38;
    background: rgba(217, 255, 56, .08);
    border: 1px solid rgba(217, 255, 56, .3);
    border-radius: 4px;
    font-family: inherit;
    font-size: 11px;
}

.dc-portal__alt {
    color: #6c6c78;
    font-size: 11px;
}

.dc-portal__alt[hidden] {
    display: none;
}

.dc-portal__field {
    display: block;
}

.dc-portal__field > span {
    display: block;
    margin-bottom: 8px;
    color: #8d8d99;
    font-size: 11px;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.dc-portal__field input {
    width: 100%;
    padding: 12px 14px;
    color: #f2f2f5;
    background: rgba(0, 0, 0, .45);
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 8px;
    font: inherit;
    font-size: 16px;
    letter-spacing: .3em;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.dc-portal__field input:focus {
    border-color: #d9ff38;
    box-shadow: 0 0 0 3px rgba(217, 255, 56, .14);
}

.dc-portal__err {
    min-height: 18px;
    margin-top: 10px;
    color: #ff5f56;
    font-size: 12px;
}

.dc-portal__actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.dc-btn {
    flex: 1;
    padding: 11px 16px;
    color: #d5d5dd;
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 8px;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .06em;
    cursor: pointer;
    transition: background .2s ease, color .2s ease, border-color .2s ease;
}

.dc-btn:hover {
    background: rgba(255, 255, 255, .1);
    color: #fff;
}

.dc-btn--primary {
    color: #04060a;
    background: #d9ff38;
    border-color: #d9ff38;
}

.dc-btn--primary:hover {
    color: #04060a;
    background: #e6ff6b;
}

.dc-shake {
    animation: dcShake .34s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes dcShake {

    10%,
    90% {
        transform: translateX(-2px);
    }

    20%,
    80% {
        transform: translateX(4px);
    }

    30%,
    50%,
    70% {
        transform: translateX(-7px);
    }

    40%,
    60% {
        transform: translateX(7px);
    }
}

/* -------------------------------------------------------------- 代码行 */

.dc-term {
    position: absolute;
    left: 50%;
    bottom: 0;
    width: min(920px, 100%);
    height: min(62vh, 560px);
    display: flex;
    flex-direction: column;
    /*
     * 位置由两个变量驱动：--dc-x / --dc-y 是拖动偏移（由 JS 写入）。
     * 不在这里用 animation 去动 transform —— animation ... both 会永久覆盖
     * transform，拖动就失效了。入场只做透明度过渡。
     */
    transform: translate3d(calc(-50% + var(--dc-x, 0px)), var(--dc-y, 0px), 0);
    background: rgba(8, 8, 11, .97);
    border: 1px solid rgba(255, 255, 255, .14);
    border-bottom: 0;
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -30px 80px rgba(0, 0, 0, .6);
    opacity: 0;
    transition: opacity .26s cubic-bezier(.22, 1, .36, 1);
    overflow: hidden;
}

.dc-term[hidden] {
    display: none;
}

.dc-term.is-in {
    opacity: 1;
}

/* 拖动中：关掉过渡，避免跟手感变差 */
.dc-term.is-dragging {
    transition: none;
    box-shadow: 0 30px 90px rgba(0, 0, 0, .75);
    border-color: rgba(217, 255, 56, .38);
}

.dc-term.is-dragging .dc-term__bar {
    cursor: grabbing;
}

.dc-term__bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, .045);
    border-bottom: 1px solid rgba(255, 255, 255, .1);
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

.dc-term__dots {
    display: inline-flex;
    gap: 6px;
}

.dc-term__dots i {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #3a3a44;
}

.dc-term__dots i:first-child {
    background: #ff5f56;
}

.dc-term__dots i:nth-child(2) {
    background: #ffbd2e;
}

.dc-term__dots i:last-child {
    background: #27c93f;
}

.dc-term__name {
    flex: 1;
    color: #8d8d99;
    font-size: 11.5px;
    letter-spacing: .04em;
}

.dc-term__cwd {
    padding: 3px 9px;
    color: #d9ff38;
    background: rgba(217, 255, 56, .08);
    border: 1px solid rgba(217, 255, 56, .26);
    border-radius: 5px;
    font-size: 11px;
}

.dc-term__body {
    flex: 1;
    padding: 14px 16px;
    overflow-y: auto;
    color: #cfcfd8;
    font-size: 12.5px;
    line-height: 1.65;
    outline: none;
    white-space: pre-wrap;
    word-break: break-word;
}

.dc-term__body::-webkit-scrollbar {
    width: 9px;
}

.dc-term__body::-webkit-scrollbar-track {
    background: transparent;
}

.dc-term__body::-webkit-scrollbar-thumb {
    background: #2c2c34;
    border-radius: 99px;
}

.dc-line {
    min-height: 1.2em;
}

.dc-dim {
    color: #6c6c78;
}

.dc-accent {
    color: #d9ff38;
    font-weight: 600;
}

.dc-key {
    color: #7ab9ff;
}

.dc-file {
    color: #e6e6ec;
}

.dc-ok {
    color: #27c93f;
}

.dc-err {
    color: #ff5f56;
}

.dc-ps1 {
    color: #d9ff38;
}

.dc-cmd {
    color: #f2f2f5;
}

.dc-term__input {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, .03);
    border-top: 1px solid rgba(255, 255, 255, .1);
}

.dc-term__ps1 {
    color: #d9ff38;
    font-size: 12.5px;
    white-space: nowrap;
}

.dc-term__input input {
    flex: 1;
    color: #f2f2f5;
    background: transparent;
    border: 0;
    font: inherit;
    font-size: 12.5px;
    outline: none;
}

.dc-term__input input::placeholder {
    color: #4f4f5a;
}

/* 拖动把手提示 */
.dc-term__dots::after {
    content: "";
    display: inline-block;
    width: 1px;
    height: 14px;
    margin-left: 10px;
    background: rgba(255, 255, 255, .16);
    vertical-align: middle;
}

@media (max-width: 640px) {
    .dc-term {
        height: 74vh;
        border-radius: 12px 12px 0 0;
    }

    .dc-term__name {
        display: none;
    }
}

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

    .dc-portal,
    .dc-term,
    .dc-shake {
        animation: none !important;
        transition: none !important;
    }
}
