/* 01 · 布局与颜色参数 */

:root {
	--Window-bg: rgb(48 48 48);
    --menu-height: 240px;
    --menu-padding: 10px;
    --menu-radius: 10px;
    --row-height: 34px;
    --row-gap: 5px;
    --row-radius: 10px;
    --menu-bg: rgb(43 43 43);
    --row-bg: rgb(32 32 32);
    --active-bg: rgb(16 38 77 / 100%);
    --accent: rgb(71 160 255);
    --muted: #9aa2ae;
    --outline: rgb(255 255 255 / 8%);
    --preset-size: 34px;
    --preset-gap: 7px;
    --light-connected: rgb(0 221 112);
    --light-running: rgb(47 107 253);
    --light-idle: #5b6170;
    --state-success: rgb(0 221 112);
    --state-warning: rgb(255 87 34);
    --flow-line: rgb(22 22 22);
    --flow-idle: rgb(0 0 0);
    --flow-active: rgb(0 221 112);
}

/* 02 · 基础样式与统一滚动条 */

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

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

/* A 6px hit area with transparent borders leaves a 2px visible thumb. */
::-webkit-scrollbar-thumb {
    transition: all 0.25s ease 0s;
    min-height: 24px;
    min-width: 24px;
    background: #606060;
    border: 2px solid transparent;
    background-clip: padding-box;
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    border-width: 0;
    background: #969696;
}

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

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

/* Firefox uses standard scrollbar properties instead of WebKit pseudo-elements. */
@supports not selector(::-webkit-scrollbar) {
    * {
        scrollbar-width: thin;
        scrollbar-color: #606060 transparent;
    }

    :is(.menu-scroll, .statistics-popup, .log-window-body):hover {
        scrollbar-color: #969696 transparent;
    }

    .statistics-popup,
    .log-window-body {
        scrollbar-gutter: stable;
    }
}

:focus,
:focus-visible {
    outline: none !important;
    outline-offset: 0;
}

button,
input {
    font: inherit;
    border: 0;
    outline: 0;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    font-family: "Segoe UI", "Microsoft YaHei UI", "PingFang SC", sans-serif;
    background: #000;
    color: #f2f3f5;
    width: 100vw;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column-reverse;
    min-height: 100svh;
    height: auto;
    padding: 24px 0;
    overflow-x: hidden;
}

/* 03 · 主窗口与标题栏 */

#window {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.notice-ico {
    width: 662px;
    line-height: 2;
    text-align: center;
    font-family: "cmdpe2", -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}

.notice-ico::before {
    font-family: "iconfont";
    display: inline-block;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-shadow: none;
    font-style: normal;
    content: "\e719";
    font-size: 1.1em;
    margin-right: 5px;
    vertical-align: 0px;
}

.download {
    text-decoration: none;
    color: inherit;
    font-weight: 600;
    background: #0021d9;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 14px;
    position: relative;
    top: 13px;
    font-family: "cmdpe2", -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}

.download:hover {
    color: #ffffff;
    background: #bc2d00;
}

html.launcher-3d #window {
    position: relative;
    transform-origin: center;
}

.window {
    width: 380px;
    min-height: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    border-radius: 0px;
    isolation: isolate;
}

.titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 15px 10px;
    position: relative;
    user-select: none;
    background: var(--Window-bg);
    margin: 5px 0 2px;
}

.titlebar::before {
    content: '';
    position: absolute;
    top: -5px;
    bottom: -5px;
    left: 5px;
    right: 5px;
    z-index: -1;
    background: var(--Window-bg);
}

.titlebar::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 18px;
    right: 18px;
    height: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.42);
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    flex: 0 0 auto;
    overflow: hidden;
    margin-top: 0px;
    position: relative;
    top: 0px;
}

.brand-mark img,
.status-icon img {
    width: 100%;
    height: 100%;
}

.brand-copy h1 {
    margin: 0;
    font-size: 15px;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: -4px;
}

.brand-copy p {
    margin: 1px 0 0;
    color: #a0a6b0;
    font-size: 11px;
}

.brand-copy p a {
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
    color: rgb(25 93 255);
}

.brand-copy p a:hover {
    color: rgb(155 255 0);
}

.brand-copy p img {
    height: 12px;
    position: relative;
    top: 2.4px;
}

.window-controls {
    display: flex;
    gap: 6px;
}

.window-dot {
    position: relative;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    overflow: hidden;
}

.window-dot.red {
    background: rgba(255, 95, 87, 0.92);
}

.window-dot.yellow {
    background: rgba(254, 188, 46, 0.92);
}

.window-dot.green {
    background: rgba(40, 200, 64, 0.92);
}

.window-dot::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 11px;
    height: 11px;
    transform: translate(-50%, -50%);
    background-image: url("../imgs/svg/window-control-glyphs.svg");
    background-repeat: no-repeat;
    background-size: 33px 11px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s ease;
    zoom: 1.5;
}

.window-dot:hover::after {
    opacity: 1;
}

.window-dot.yellow::after {
    background-position: -11px 0;
}

.window-dot.green::after {
    background-position: -22px 0;
}

.window-dot.red::after {
    background-position: 0 0;
}

.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0px;
    padding: 12px 15px 12px;
    background: var(--Window-bg);
    position: relative;
}

#window {
    margin: 0 0 20px 0;
    zoom: 105%;
    flex-shrink: 0;
}

.content > .section {
    position: relative;
    z-index: 1;
}

/* 04 · 接口输入框与操作按钮 */

.fields {
    display: grid;
    gap: 10px;
}

.field {
    display: block;
    min-width: 0;
}

.control {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
}

.control input {
    font-size: 14px;
    width: 100%;
    height: 34px;
    border-radius: 10px;
    background: rgb(0 0 0 / 33%);
    color: #f2f3f5;
    padding: 0 12px;
    outline: none;
    transition: background 0.16s ease, box-shadow 0.16s ease;
}

.control.has-toggle input {
    padding-left: 25px;
    padding-right: 34px;
}

.field-leading img {
    width: 16px;
    height: 16px;
    object-fit: contain;
    display: block;
    opacity: 1;
}

.control input::placeholder {
    color: #6d7380;
}

.control input:hover {
    background: rgba(0, 0, 0, 0.42);
}

.toggle-visibility:focus-visible {
    outline: 2px solid rgba(79, 140, 255, 0.7);
    outline-offset: 1px;
}

.field-control {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.field-control .control {
    flex: 1 1 auto;
    min-width: 0;
}

.action-btn {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 10px;
    cursor: pointer;
    display: grid;
    place-items: center;
    position: relative;
    color: #ffffff;
    background: rgba(0, 0, 0, 0.33);
    transition: all 0s ease;
    -webkit-backdrop-filter: blur(6px) saturate(140%);
    backdrop-filter: blur(6px) saturate(140%);
}

#install {
    border-radius: 12px;
    background: rgb(16 52 255 / 60%);
}

#launchBtn {
    border-radius: 12px;
    background: rgb(0 221 112 / 60%);
}

.action-btn img {
    width: 16px;
    height: 16px;
    object-fit: contain;
    pointer-events: none;
    display: block;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
}

.action-btn:hover {
    background: rgb(204 49 0) !important;
}

.action-btn:active {
    filter: brightness(0.96);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16),
        0 3px 8px rgba(8, 64, 248, 0.26);
}

.action-btn:focus-visible {
    outline: 2px solid rgba(120, 170, 255, 0.9);
    outline-offset: 2px;
}

.field-leading {
    position: absolute;
    left: 5px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    display: grid;
    place-items: center;
    z-index: 1;
    pointer-events: auto;
    cursor: help;
}

.toggle-visibility {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    background: transparent;
    color: #9aa2ae;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background 0.15s ease, color 0.15s ease;
    border-radius: 9px;
}

.toggle-visibility:hover {
    color: #f2f3f5;
    background: rgb(45 45 45);
}

.toggle-visibility img {
    object-fit: contain;
    display: block;
    opacity: 0.92;
    width: 16px;
    height: 16px;
}

#historyBtn img {
    width: 18px;
    height: 18px;
    transition: transform .18s;
}

#historyBtn[aria-expanded="true"] img {
    transform: rotate(180deg);
}

.action-btn:disabled {
    opacity: .95;
    cursor: default;
}

.action-btn:disabled:hover {
    background: rgba(0, 0, 0, .33) !important;
}

.endpoint-light {
    position: absolute;
    z-index: 1;
    right: 37px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 22px;
    display: grid;
    place-items: center;
    cursor: help;
}

.endpoint-light::after,
.history-light.is-connected::after {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--light-connected);
    animation: small-live-pulse 1.4s infinite;
}

.control:has(.endpoint-light:not([hidden])) input {
    padding-right: 55px;
}

#install:disabled,
#launchBtn:disabled {
    background: rgb(59 59 59) !important;
}

.action-btn:disabled img {
    opacity: .95;
}

/* 05 · 客户端卡片与状态灯 */

.cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    background: rgb(59 59 59);
    border-radius: 30px;
    padding: 15px;
    margin: 0;
}

.card {
    position: relative;
    appearance: none;
    border-radius: 14px;
    color: inherit;
    width: 100%;
    min-width: 0;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    background: none;
    box-shadow: none;
    transition: none;
}

.card:focus-visible {
    outline: 2px solid rgba(79, 140, 255, 0.75);
    outline-offset: 2px;
}

.card.is-selected {
    background: none;
    box-shadow: none;
}

.card.is-active {
    background: none;
    box-shadow: none;
}

.card.is-selected.is-active {
    background: none;
    box-shadow: none;
}

.icon-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    height: auto;
    border-radius: 22px;
    display: grid;
    place-items: center;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0.08) 42%, rgba(255, 255, 255, 0.04) 100%),
        rgba(40, 44, 54, 0.28);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.34),
        inset 0 0 0 1px rgba(255, 255, 255, 0.08);
    transition: background 0.18s ease, box-shadow 0.18s ease;
}

.icon-wrap::before {
    content: "";
    position: absolute;
    left: 8px;
    right: 8px;
    top: 3px;
    height: 18px;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0));
    pointer-events: none;
    opacity: 0;
}

.card.is-selected .icon-wrap::after {
    content: "";
    position: absolute;
    bottom: -15px;
    height: 4px;
    width: 16px;
    background: rgb(0 221 112);
}

.icon-wrap .client-icon {
    position: relative;
    z-index: 1;
    width: 60%;
    height: 60%;
    object-fit: contain;
    filter: none;
    transition: none;
}

.icon-wrap .type-badge {
    position: absolute;
    left: 7px;
    bottom: 4px;
    z-index: 2;
    width: 24px;
    height: 24px;
    object-fit: contain;
    pointer-events: none;
    filter: none;
    transition: none;
}

.card:hover .icon-wrap,
.card.is-selected .icon-wrap {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0.12) 44%, rgba(255, 255, 255, 0.06) 100%),
        rgba(50, 56, 70, 0.34);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42),
        inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.status-dot {
    position: absolute;
    right: -3px;
    bottom: 0px;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #5b6170;
    border: 2px solid rgb(43 43 43);
    transition: background 0.18s ease, box-shadow 0.18s ease;
}

@keyframes hv-live-pulse {
    0% {
        box-shadow: 0 0 #62c55599;
    }

    70% {
        box-shadow: 0 0 0 8px #62c55500;
    }

    100% {
        box-shadow: 0 0 #62c55500;
    }
}

.card .status-dot {
    z-index: 3;
    background: var(--light-idle);
    animation: none;
    box-shadow: none;
    display: grid;
    place-items: center;
}

.card.is-running .status-dot {
    background: var(--light-running);
}

.card.is-active .status-dot {
    background: var(--light-connected);
    animation: hv-live-pulse 1.2s infinite;
}

.card.is-uninstalled .status-dot::before,
.card.is-uninstalled .status-dot::after,
.log-window-close::before,
.log-window-close::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    height: 1.5px;
    border-radius: 1px;
    background: currentColor;
    transform: translate(-50%, -50%) rotate(45deg);
}

.card.is-uninstalled .status-dot::before,
.card.is-uninstalled .status-dot::after {
    width: 6px;
    height: 1.2px;
    background: rgb(43 43 43);
}

.card.is-uninstalled .status-dot::after,
.log-window-close::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.card.is-running .icon-wrap,
.card.is-selected.is-running .icon-wrap,
.card.is-running:hover .icon-wrap {
    background: linear-gradient(180deg, rgba(210,230,255,.34), rgb(0 88 255 / 18%) 48%, rgba(70,120,220,.12)), rgba(40,70,140,.22);
    box-shadow: inset 0 1px rgba(235,245,255,.46), inset 0 0 0 1px rgba(160,200,255,.22);
}

.card.is-active .icon-wrap,
.card.is-active:hover .icon-wrap,
.card.is-selected.is-active .icon-wrap {
    background: linear-gradient(180deg, rgba(210,255,235,.26), rgb(0 255 128 / 12%) 48%, rgba(30,120,80,.1)), rgba(20,70,50,.18);
    box-shadow: inset 0 1px rgba(230,255,240,.36), inset 0 0 0 1px rgba(120,230,180,.16);
}

@keyframes small-live-pulse {
    0% {
        box-shadow: 0 0 0 0 rgb(0 221 112 / 45%);
    }

    80%,
    100% {
        box-shadow: 0 0 0 10px rgb(0 221 112 / 0%);
    }
}

/* 06 · 模型来源选框 */

.actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.model-source {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1 1 auto;
}

.model-check {
    height: 34px;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    cursor: pointer;
    user-select: none;
    color: #c8ced8;
    font-size: 11px;
    line-height: 1.2;
    text-align: left;
    background: rgb(255 255 255 / 5%);
    padding: 8px;
    border-radius: 12px;
}

.model-check input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.model-check .box {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: none;
    position: relative;
    display: grid;
    place-items: center;
}

.model-check .box img {
    width: 12px;
    height: 12px;
    object-fit: contain;
    display: block;
    opacity: 0;
    filter: brightness(0) invert(1);
    pointer-events: none;
}

.model-check input:checked+.box {
    background: #0027ff;
    box-shadow: none;
}

.model-check input:checked+.box img {
    opacity: 1;
}

.model-check:hover .box {
    box-shadow: none;
}

.model-check input:focus-visible+.box {
    outline: 2px solid rgba(79, 140, 255, 0.75);
    outline-offset: 1px;
}

.model-check .text {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.action-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}

.model-check.is-disabled {
    opacity: .65;
    cursor: default;
}

/* 07 · 底部状态栏 */

.status-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px 3px;
    position: relative;
    background: var(--Window-bg);
    margin: 0 0 5px;
}

.status-bar::before {
    content: '';
    position: absolute;
    top: -5px;
    bottom: -5px;
    left: 5px;
    right: 5px;
    z-index: -1;
    background: rgb(48 48 48);
}

.status-bar::after {
    content: "";
    position: absolute;
    top: 0px;
    left: 18px;
    right: 18px;
    height: 0;
    border-top: 1px solid rgba(0, 0, 0, 0.42);
}

.status-bar.normal {
    color: #c8ced8;
}

.status-bar.warn {
    color: #ff3d00;
    background: rgb(58 37 30);
}

.status-bar.warn::before {
    background: rgb(58 37 30);
}

.status-icon {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    display: grid;
    place-items: center;
}

.status-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.status-text {
    min-width: 0;
    flex: 1 1 auto;
    font-size: 11px;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-text .st-installed,
.status-text .st-running {
    color: #00dd70;
    font-weight: 600;
}

.status-text .st-missing {
    color: #ff3d00;
    font-weight: 600;
}

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

.status-log-btn {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 12px;
    cursor: pointer;
    display: grid;
    place-items: center;
    position: relative;
    color: #ffffff;
    background: rgb(255 255 255 / 5%);
}

.status-log-btn img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    pointer-events: none;
    display: block;
}

.status-log-btn:hover {
    background: rgb(204 49 0);
}

.status-log-btn:focus-visible {
    outline: 2px solid rgba(120, 170, 255, 0.9);
    outline-offset: 2px;
}

.status-text .st-installed,
.status-text .st-running,
.status-text .st-missing {
    font-weight: 400;
}

.status-endpoint {
    display: inline;
    color: #c8ced8;
}

.status-endpoint img {
    width: 14px;
    height: 14px;
    vertical-align: -3px;
    margin-right: 3px;
}

.state-positive {
    color: var(--state-success);
}

.state-negative {
    color: var(--state-warning);
}

/* 08 · 供应商与模型下拉列表 */

.dropdown {
    position: absolute;
    z-index: 50;
    height: var(--menu-height);
    padding: var(--menu-padding);
    border-radius: var(--menu-radius);
    background: var(--menu-bg);
    box-shadow: 0 0 0 1px var(--outline);
    animation: menu-open .15s ease-out;
    transform-origin: top;
}

@keyframes menu-open {
    from {
        opacity: 0;
        transform: translateY(-4px) scaleY(.98);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.menu-scroll {
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 1px 2px 1px 10px;
    margin: 0 -8px 0 -10px;
    scrollbar-gutter: stable;
}

@supports not selector(::-webkit-scrollbar) {
    .menu-scroll {
        /* Leave room even when Firefox uses an overlay scrollbar. */
        padding-right: 8px;
    }
}

.menu-section-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--muted);
    font-size: 10px;
    height: 16px;
    margin: 0 0 6px;
    white-space: nowrap;
}

.menu-section-title::before,
.menu-section-title::after {
    content: '';
    width: 52px;
    height: 1px;
    background: rgb(28 29 29);
}

.presets-title {
    margin-top: 10px;
}

.history-row,
.model-row {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 100%;
    min-width: 0;
    height: var(--row-height);
    margin-bottom: var(--row-gap);
    padding: 0 6px;
    border-radius: var(--row-radius);
    background: var(--row-bg);
    color: var(--muted);
    cursor: pointer;
    font-size: 12px;
    text-align: left;
    position: relative;
}

.history-row:last-child,
.model-row:last-child {
    margin-bottom: 0;
}

.history-row:hover,
.history-row.is-selected,
.model-row:hover {
    background: var(--active-bg);
    color: var(--accent);
}

.history-row:focus-visible,
.model-row:focus-visible,
.preset-button:focus-visible,
.icon-button:focus-visible,
.log-menu button:focus-visible {
    outline: 1px solid var(--accent) !important;
    outline-offset: -1px;
}

.row-icon {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
}

.row-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.row-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.icon-button {
    background: none;
    width: 20px;
    height: 22px;
    border-radius: 6px;
    display: grid;
    place-items: center;
    cursor: pointer;
    flex-shrink: 0;
}

.icon-button img {
    width: 13px;
    height: 13px;
    opacity: .55;
    pointer-events: none;
}

.icon-button:hover img {
    opacity: 1;
    filter: brightness(0) invert(1);
}

.row-actions .icon-button {
    visibility: hidden;
}

.history-row:hover .icon-button,
.history-row:focus-within .icon-button,
.model-row:hover .icon-button,
.model-row:focus-within .icon-button {
    visibility: visible;
}

.delete-record:hover img {
    filter: brightness(0) saturate(100%) invert(51%) sepia(83%) saturate(1732%) hue-rotate(326deg) brightness(105%);
}

.history-light {
    width: 12px;
    height: 22px;
    margin-left: 0px;
    margin-right: 3px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.history-light::after {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #5b6170;
}

.history-row.is-editing {
    background: rgb(12 12 12);
    box-shadow: 0 0 0 1px var(--outline);
}

.history-row.is-editing .icon-button {
    visibility: visible;
}

.rename-input {
    flex: 1;
    width: 0;
    min-width: 0;
    height: 24px;
    color: #f2f3f5;
    background: transparent;
    font-size: 12px;
}

.history-row.is-dragging {
    opacity: .4;
}

.history-row.drop-before {
    box-shadow: 0 -2px var(--accent);
}

.provider-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, var(--preset-size)));
    gap: 8px var(--preset-gap);
    justify-content: center;
}

.preset-button {
    width: var(--preset-size);
    height: var(--preset-size);
    background: transparent;
    box-shadow: inset 0 0 0 1px var(--outline);
    border-radius: 12px;
    cursor: pointer;
    display: grid;
    place-items: center;
    position: relative;
}

.preset-button:hover,
.preset-button:focus-visible {
    box-shadow: inset 0 0 0 1px rgb(20 126 255 / 33%);
    background: rgb(71 160 255 / 8%);
}

.preset-button img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    pointer-events: none;
}

.model-row.is-hidden {
    color: var(--muted);
}

.model-selection {
    width: 12px;
    height: 12px;
    flex: 0 0 12px;
    margin: 0 2px 0 4px;
}

.model-row.is-hidden .model-selection {
    visibility: hidden;
}

.empty-history {
    color: var(--muted);
    font-size: 11px;
    text-align: center;
    padding: 12px 0;
}

/* 09 · 用量统计 */

.statistics-popup {
    position: absolute;
    z-index: 90;
    padding: 5px 10px 10px;
    border-radius: 10px;
    background: rgb(0 5 33 / 94%);
    box-shadow: 0 0 0 0px var(--outline);
    color: var(--muted);
    overflow: auto;
    max-height: min(230px, 65vh);
}

.stat-identity {
    display: flex;
    align-items: center;
    gap: 5px;
    height: 23px;
    font-size: 13px;
}

.stat-identity img {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.stat-identity span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.stat-lines {
    display: grid;
    gap: 4px;
    margin-top: 6px;
    width: max-content;
    min-width: 100%;
}

.stat-line {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    white-space: nowrap;
}

.stat-line img {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

.stat-line > span:first-of-type {
    width: 42px;
    text-align: left;
}

.stat-badge {
    padding: 2px 4px;
    border-radius: 6px;
    color: var(--accent);
    background: rgb(71 160 255 / 20%);
}

.stat-badge.success {
    color: rgb(0 210 106);
    background: rgb(0 210 106 / 15%);
}

.stat-badge.failure {
    color: rgb(255 87 34);
    background: rgb(255 87 34 / 20%);
}

.statistics-arrow {
    z-index: 90;
    background: rgb(0 5 33 / 94%);
}

/* 10 · 日志菜单与日志窗口 */

.log-window.is-open {
    display: flex;
}

.log-window-title img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    flex: 0 0 18px;
    display: none;
}

.log-window-close {
    width: 24px;
    height: 24px;
    border-radius: 9px;
    background: rgb(255 255 255 / 8%);
    color: #d7dde8;
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 19px;
    line-height: 1;
    font-family: revert;
    position: absolute;
    right: 8px;
}

.log-window-close:hover {
    background: rgb(204 49 0);
    color: #ffffff;
}

.log-menu {
    position: absolute;
    z-index: 85;
    width: 90px;
    padding: 6px;
    border-radius: 12px;
    background: var(--menu-bg);
    box-shadow: 0 0 0 1px var(--outline);
    display: grid;
    gap: 5px;
    animation: menu-open .15s ease-out;
}

.log-menu button {
    background: var(--row-bg);
	background: rgb(59 59 59);
    color: #c8ced8;
    height: 26px;
    border-radius: 9px;
    cursor: pointer;
    font-size: 11px;
}

.log-menu button:hover,
.log-menu button:focus-visible {
    background: rgb(204 49 0);
    color: white;
}

.log-window {
    position: absolute;
    height: 316px;
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 80;
    width: calc(100% - 20px);
    left: 10px;
    bottom: 10px;
    transform: none;
    border-radius: 12px;
    box-shadow: 0 0 0 1px var(--outline);
}

.log-window-titlebar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-bottom: 0px solid rgb(255 255 255 / 10%);
    user-select: none;
    background: #2b2b2b;
    padding: 10px 12px;
    min-height: 44px;
}

.log-window-title {
    display: flex;
    gap: 3px;
    min-width: 0;
    color: #f2f3f5;
    font-weight: 400;
    align-items: center;
    font-size: 15px;
}

.log-window-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    font-family: Consolas, "Cascadia Mono", "Microsoft YaHei UI", monospace;
    color: #c8ced8;
    padding: 10px;
    background: rgb(0 2 16);
    font-size: 11px;
    line-height: 1.85;
}

.runtime-section {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    margin-bottom: 12px;
}

.runtime-section:last-child {
    margin-bottom: 0;
}

.request-line,
.request-heading {
    white-space: nowrap;
    width: max-content;
    min-width: 100%;
    margin-bottom: 0px;
}

.request-heading {
    color: #9aa2ae;
    margin-bottom: 4px;
}

.request-line:nth-of-type(even) {
    color: rgb(112 211 255);
}

.request-success {
    color: #00dd70;
}

.request-failure {
    color: #ff5722;
}

.log-demo-label {
    color: #7f8796;
    font-size: 10px;
    margin-bottom: 4px;
}

.log-window-close::before,
.log-window-close::after {
    width: 10px;
}

/* 11 · 悬停提示与箭头 */

.client-tooltip-line {
    text-align: center;
}

.demo-tooltip {
    position: absolute;
    z-index: 110;
    pointer-events: none;
    border-radius: 8px;
    background: rgb(54 0 148 / 94%);
    color: white;
    padding: 5px 8px;
    font-size: 11px;
    line-height: 1.5;
    white-space: pre;
    max-width: calc(100% - 16px);
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

.popup-arrow {
    position: absolute;
    width: 10px;
    height: 5px;
    pointer-events: none;
    clip-path: polygon(0 0, 100% 0, 50% 100%);
}

.popup-arrow.points-up {
    clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.tooltip-arrow {
    z-index: 110;
    background: rgb(54 0 148 / 94%);
}

/* 12 · 连接线与流动光点 */

.cascade-fx object,
.cascade-fx img,
.cascade-fx svg {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 920 / 127.384615;
}

.cascade-fx {
    height: 37px;
    width: 100%;
}

.flow-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.flow-track {
    stroke: var(--flow-line);
    stroke-width: .9px;
    fill: none;
    stroke-linecap: round;
}

.flow-branch {
    fill: var(--flow-idle);
}

.flow-branch.is-connected {
    fill: var(--flow-active);
}

/* 13 · 嵌入模式与响应式设置 */

html.launcher-embed,
html.launcher-embed body {
    margin: 0;
    padding: 0;
    background: transparent;
}

html.launcher-embed body {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100vh;
    height: auto;
}

html.launcher-embed body > :not(#window) {
    display: none !important;
}

html.launcher-embed #window {
    flex-shrink: 0;
    margin: 0;
}

@media (prefers-reduced-motion: reduce) {
    .card.is-active .status-dot,
    .endpoint-light::after,
    .history-light.is-connected::after,
    .dropdown,
    .log-menu {
        animation: none;
    }

    #historyBtn img {
        transition: none;
    }
}

@media (max-width: 399px) {
    .window {
        width: calc(100vw - 16px);
    }

    .provider-grid {
        grid-template-columns: repeat(7, minmax(0, 1fr));
        gap: 5px;
    }

    .preset-button {
        width: 100%;
        height: auto;
        aspect-ratio: 1;
    }

    .cards {
        gap: 8px;
        padding: 12px;
    }

    .actions,
    .model-source,
    .action-buttons {
        gap: 6px;
    }

    .model-check {
        padding: 7px 5px;
        font-size: 10px;
        gap: 4px;
    }
}

