/* ==========================================================================
   WebSocket 在线测试 —— 「信号控制台」皮肤
   页面跟随站点深浅色，控制台面板恒定深色（终端语义）
   ========================================================================== */

.ws-page {
    --ws-bg-console: #0b1220;
    --ws-bg-panel: #101a2c;
    --ws-line: #1e2b42;
    --ws-text: #dbe7f5;
    --ws-dim: #7e8fa8;
    --ws-mint: #34e0a1;
    --ws-cyan: #38bdf8;
    --ws-amber: #fbbf24;
    --ws-red: #f87171;
    background: var(--c-bg, #f6f8fb);
    padding: 26px 0 64px;
}

.ws-wrap {
    width: 100%;
    max-width: 1160px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ---------- 首屏 ---------- */
.ws-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    margin: 14px 0 22px;
}

.ws-eyebrow {
    display: inline-block;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11.5px;
    letter-spacing: 0.16em;
    color: #0e9f76;
    background: rgba(52, 224, 161, 0.14);
    border: 1px solid rgba(52, 224, 161, 0.32);
    border-radius: 999px;
    padding: 4px 12px;
    margin-bottom: 12px;
}

.ws-hero h1 {
    margin: 0 0 10px;
    font-size: 38px;
    line-height: 1.18;
    letter-spacing: -0.02em;
    color: var(--c-text, #101828);
}

.ws-hero h1 em {
    font-style: normal;
    background: linear-gradient(120deg, #12b981, #0ea5e9);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.ws-hero p {
    margin: 0 0 14px;
    max-width: 640px;
    font-size: 15px;
    line-height: 1.85;
    color: var(--c-text-sub, #4b5563);
}

.ws-hero p code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    padding: 1px 6px;
    border-radius: 5px;
    background: rgba(14, 165, 233, 0.12);
    color: #0284c7;
}

.ws-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ws-chips span {
    font-size: 12.5px;
    padding: 5px 12px;
    border-radius: 999px;
    background: var(--c-bg-card, #fff);
    border: 1px solid var(--c-border, #e5e9f0);
    color: var(--c-text-sub, #4b5563);
}

/* 首屏右上：脉冲信号盘 */
.ws-hero-gauge {
    position: relative;
    width: 132px;
    height: 132px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
}

.ws-gauge-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background:
        radial-gradient(circle at center, rgba(52, 224, 161, 0.16) 0 40%, transparent 62%),
        conic-gradient(from 200deg, #34e0a1, #38bdf8, transparent 62%);
    -webkit-mask: radial-gradient(circle, transparent 62%, #000 63%);
    mask: radial-gradient(circle, transparent 62%, #000 63%);
    animation: ws-spin 9s linear infinite;
}

.ws-gauge-dot {
    position: absolute;
    inset: 26px;
    border-radius: 50%;
    border: 1px dashed rgba(56, 189, 248, 0.35);
    animation: ws-spin 14s linear infinite reverse;
}

.ws-gauge-label {
    position: relative;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    letter-spacing: 0.3em;
    color: #0e9f76;
}

@keyframes ws-spin { to { transform: rotate(360deg); } }

/* ---------- 控制台 ---------- */
.ws-console {
    background: var(--ws-bg-console);
    border: 1px solid var(--ws-line);
    border-radius: 16px;
    padding: 0 0 14px;
    box-shadow: 0 22px 50px rgba(8, 16, 30, 0.28);
    overflow: hidden;
}

.ws-console-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    background: linear-gradient(180deg, #111d31, #0d1727);
    border-bottom: 1px solid var(--ws-line);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    color: var(--ws-dim);
}

.ws-led {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #445066;
    box-shadow: 0 0 0 3px rgba(68, 80, 102, 0.2);
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.ws-led[data-state="connecting"] {
    background: var(--ws-amber);
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.18);
    animation: ws-blink 0.9s ease-in-out infinite;
}

.ws-led[data-state="open"] {
    background: var(--ws-mint);
    box-shadow: 0 0 10px rgba(52, 224, 161, 0.9), 0 0 0 3px rgba(52, 224, 161, 0.2);
}

.ws-led[data-state="closed"],
.ws-led[data-state="error"] {
    background: var(--ws-red);
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.18);
}

@keyframes ws-blink { 50% { opacity: 0.35; } }

.ws-status { color: var(--ws-text); letter-spacing: 0.04em; }

.ws-timer {
    color: var(--ws-dim);
    padding-left: 10px;
    border-left: 1px solid var(--ws-line);
}

.ws-spacer { flex: 1; }

.ws-switch {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
    color: var(--ws-dim);
}

.ws-switch input {
    accent-color: var(--ws-mint);
    width: 13px;
    height: 13px;
}

.ws-switch:hover { color: var(--ws-text); }

/* 地址行 */
.ws-addr-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 16px 8px;
}

.ws-prompt {
    font-family: ui-monospace, monospace;
    color: var(--ws-mint);
    font-size: 18px;
    line-height: 1;
}

.ws-url {
    flex: 1;
    min-width: 0;
    height: 42px;
    padding: 0 14px;
    border-radius: 10px;
    border: 1px solid var(--ws-line);
    background: #0a1524;
    color: var(--ws-text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13.5px;
    outline: none;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.ws-url:focus {
    border-color: rgba(52, 224, 161, 0.7);
    box-shadow: 0 0 0 3px rgba(52, 224, 161, 0.14);
}

.ws-url::placeholder { color: #5b6b82; }

.ws-btn {
    height: 42px;
    padding: 0 22px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
    white-space: nowrap;
}

.ws-btn:active { transform: translateY(1px); }

.ws-btn--connect {
    background: linear-gradient(135deg, #34e0a1, #10b981);
    color: #06251b;
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.28);
}

.ws-btn--disconnect {
    background: rgba(248, 113, 113, 0.14);
    border-color: rgba(248, 113, 113, 0.45);
    color: #fca5a5;
}

.ws-btn--send {
    background: rgba(56, 189, 248, 0.16);
    border-color: rgba(56, 189, 248, 0.45);
    color: #7dd3fc;
}

.ws-btn--send:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.ws-addr-hint {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 0 16px 4px 30px;
    font-size: 12px;
    color: #6b7c94;
}

.ws-hint {
    border: 1px dashed var(--ws-line);
    background: transparent;
    color: #93a5bd;
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 11.5px;
    font-family: ui-monospace, monospace;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.ws-hint:hover { color: var(--ws-mint); border-color: rgba(52, 224, 161, 0.5); }

/* ---------- 双栏面板 ---------- */
.ws-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.86fr) minmax(0, 1.14fr);
    gap: 18px;
    margin-top: 18px;
}

.ws-panel {
    display: flex;
    flex-direction: column;
    min-height: 380px;
    background: var(--ws-bg-panel);
    border: 1px solid var(--ws-line);
    border-radius: 16px;
    overflow: hidden;
}

.ws-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--ws-line);
    background: rgba(255, 255, 255, 0.02);
}

.ws-panel-head h2 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--ws-text);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.ws-count {
    font-family: ui-monospace, monospace;
    font-size: 11px;
    padding: 1px 7px;
    border-radius: 999px;
    background: rgba(52, 224, 161, 0.14);
    color: var(--ws-mint);
}

/* 分段控件 */
.ws-seg {
    display: inline-flex;
    padding: 3px;
    gap: 2px;
    border-radius: 9px;
    background: #0a1524;
    border: 1px solid var(--ws-line);
}

.ws-seg button {
    border: 0;
    background: transparent;
    color: var(--ws-dim);
    font-size: 12px;
    padding: 4px 11px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.ws-seg button.is-on {
    background: rgba(52, 224, 161, 0.16);
    color: var(--ws-mint);
    font-weight: 600;
}

.ws-input {
    flex: 1;
    min-height: 190px;
    margin: 14px 16px 0;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--ws-line);
    background: #0a1524;
    color: var(--ws-text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px;
    line-height: 1.7;
    resize: vertical;
    outline: none;
}

.ws-input:focus { border-color: rgba(56, 189, 248, 0.6); }

.ws-input::placeholder { color: #4e5f77; }

.ws-send-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
}

.ws-tip {
    font-size: 11.5px;
    color: #6b7c94;
    font-family: ui-monospace, monospace;
}

.ws-presets {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 0 16px 14px;
    border-top: 1px dashed var(--ws-line);
    padding-top: 12px;
}

.ws-presets-label {
    font-size: 11.5px;
    color: #6b7c94;
}

.ws-preset {
    border: 1px solid var(--ws-line);
    background: transparent;
    color: #93a5bd;
    font-size: 11.5px;
    padding: 3px 10px;
    border-radius: 999px;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.ws-preset:hover { color: var(--ws-cyan); border-color: rgba(56, 189, 248, 0.45); }

/* 日志 */
.ws-log-actions { display: inline-flex; gap: 6px; }

.ws-mini {
    border: 1px solid var(--ws-line);
    background: transparent;
    color: var(--ws-dim);
    font-size: 11.5px;
    padding: 3px 10px;
    border-radius: 7px;
    cursor: pointer;
}

.ws-mini:hover { color: var(--ws-text); border-color: #33455f; }

.ws-log {
    flex: 1;
    min-height: 260px;
    max-height: 460px;
    overflow-y: auto;
    padding: 10px 12px 16px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.65;
    scrollbar-width: thin;
}

.ws-empty {
    display: grid;
    place-items: center;
    gap: 4px;
    padding: 56px 20px;
    text-align: center;
    color: #5b6b82;
}

.ws-empty-icon { font-size: 26px; color: #33455f; }

.ws-empty p { margin: 0; color: #7e8fa8; font-size: 13px; }

.ws-empty small { max-width: 260px; font-size: 11.5px; color: #55647a; line-height: 1.6; }

.ws-msg {
    display: grid;
    grid-template-columns: 62px 1fr;
    gap: 10px;
    padding: 7px 8px;
    border-radius: 8px;
    margin-bottom: 4px;
    border-left: 2px solid transparent;
}

.ws-msg time {
    color: #5b6b82;
    font-size: 11px;
    padding-top: 2px;
}

.ws-msg .ws-body {
    color: var(--ws-text);
    word-break: break-word;
    white-space: pre-wrap;
}

.ws-msg pre {
    margin: 0;
    font-family: inherit;
    font-size: 11.5px;
    color: #a5d6ff;
    white-space: pre-wrap;
}

.ws-msg.is-sent { border-left-color: rgba(56, 189, 248, 0.7); background: rgba(56, 189, 248, 0.05); }
.ws-msg.is-recv { border-left-color: rgba(52, 224, 161, 0.7); background: rgba(52, 224, 161, 0.05); }
.ws-msg.is-sys  { border-left-color: rgba(148, 163, 184, 0.5); background: rgba(148, 163, 184, 0.05); }
.ws-msg.is-err  { border-left-color: rgba(248, 113, 113, 0.75); background: rgba(248, 113, 113, 0.07); }

.ws-msg .ws-tag {
    display: inline-block;
    font-size: 10px;
    letter-spacing: 0.08em;
    padding: 0 5px;
    border-radius: 4px;
    margin-right: 6px;
    vertical-align: 1px;
}

.is-sent .ws-tag { background: rgba(56, 189, 248, 0.16); color: #7dd3fc; }
.is-recv .ws-tag { background: rgba(52, 224, 161, 0.16); color: var(--ws-mint); }
.is-sys  .ws-tag { background: rgba(148, 163, 184, 0.16); color: #cbd5e1; }
.is-err  .ws-tag { background: rgba(248, 113, 113, 0.18); color: #fca5a5; }

.is-sys .ws-body { color: #9fb0c6; }
.is-err .ws-body { color: #fca5a5; }

/* ---------- 说明区 ---------- */
.ws-info {
    margin-top: 34px;
}

.ws-info > h2 {
    font-size: 21px;
    margin: 0 0 16px;
    color: var(--c-text, #101828);
}

.ws-info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.ws-info-card {
    position: relative;
    padding: 18px 18px 16px;
    border-radius: 14px;
    background: var(--c-bg-card, #fff);
    border: 1px solid var(--c-border, #e5e9f0);
}

.ws-info-no {
    font-family: ui-monospace, monospace;
    font-size: 11px;
    color: #0e9f76;
    letter-spacing: 0.1em;
}

.ws-info-card h3 {
    margin: 6px 0 6px;
    font-size: 15px;
    color: var(--c-text, #101828);
}

.ws-info-card p {
    margin: 0;
    font-size: 13px;
    line-height: 1.8;
    color: var(--c-text-sub, #4b5563);
}

.ws-faq { margin-top: 18px; display: grid; gap: 8px; }

.ws-faq details {
    border: 1px solid var(--c-border, #e5e9f0);
    border-radius: 12px;
    background: var(--c-bg-card, #fff);
    padding: 12px 16px;
}

.ws-faq summary {
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--c-text, #101828);
    list-style: none;
}

.ws-faq summary::-webkit-details-marker { display: none; }

.ws-faq summary::before {
    content: "＋";
    color: #0e9f76;
    margin-right: 8px;
    font-weight: 700;
}

.ws-faq details[open] summary::before { content: "－"; }

.ws-faq p {
    margin: 10px 0 2px;
    font-size: 13px;
    line-height: 1.85;
    color: var(--c-text-sub, #4b5563);
}

.ws-faq code {
    font-family: ui-monospace, monospace;
    font-size: 12px;
    padding: 1px 5px;
    border-radius: 4px;
    background: rgba(14, 165, 233, 0.1);
    color: #0284c7;
}

/* ---------- 深色主题微调 ---------- */
:root[data-theme="dark"] .ws-page { background: #0a1018; }

:root[data-theme="dark"] .ws-hero h1,
:root[data-theme="dark"] .ws-info > h2 { color: #e6edf9; }

:root[data-theme="dark"] .ws-hero p,
:root[data-theme="dark"] .ws-info-card p,
:root[data-theme="dark"] .ws-faq p { color: #9fb0c6; }

:root[data-theme="dark"] .ws-chips span,
:root[data-theme="dark"] .ws-info-card,
:root[data-theme="dark"] .ws-faq details {
    background: #131c2b;
    border-color: #223047;
}

:root[data-theme="dark"] .ws-info-card h3,
:root[data-theme="dark"] .ws-faq summary { color: #e6edf9; }

/* ---------- 响应式 ---------- */
@media (max-width: 980px) {
    .ws-grid { grid-template-columns: 1fr; }
    .ws-info-grid { grid-template-columns: 1fr; }
    .ws-hero { align-items: flex-start; }
    .ws-hero-gauge { width: 96px; height: 96px; }
}

@media (max-width: 640px) {
    .ws-hero h1 { font-size: 27px; }
    .ws-hero-gauge { display: none; }
    .ws-addr-row { flex-wrap: wrap; }
    .ws-url { flex: 1 1 100%; order: -1; }
    .ws-prompt { display: none; }
    .ws-btn { flex: 1; }
    .ws-addr-hint { padding-left: 16px; }
    .ws-console-bar { flex-wrap: wrap; row-gap: 6px; }
    .ws-timer { border-left: 0; padding-left: 0; }
}
