/* ============================================================
   鲸鱼娘控制台 · 海洋蓝 × 樱花粉（二次元主题）
   01 Tokens / 02 Base / 03 背景与泡泡 / 04 头部 / 05 按钮
   06 平台 Tab / 07 统计卡 / 08 面板 / 09 消息流 / 10 表单
   11 列表与杂项 / 12 语音点歌 / 13 Toast 与提示 / 14 数据页
   15 工具类 / 16 响应式 / 17 降级与无障碍
   ============================================================ */

/* ---------- 01 Tokens ---------- */
:root {
    color-scheme: light;
    --blue-1: #6ec6ff;
    --blue-2: #3f9fff;
    --blue-3: #2b6fd6;
    --pink-1: #ffc4dd;
    --pink-2: #ff8fc0;
    --pink-3: #f0629e;
    --green: #3ddc84;
    --red: #ff6b88;
    --orange: #ff9f43;
    --ink: #2b3a55;
    --ink-soft: #5b6b8c;
    --ink-mute: #8b98b5;
    --card-bg: rgba(255, 255, 255, 0.82);
    --card-bg-strong: rgba(255, 255, 255, 0.92);
    --card-border: rgba(255, 255, 255, 0.9);
    --line-soft: rgba(63, 159, 255, 0.22);
    --radius-lg: 26px;
    --radius-md: 18px;
    --radius-sm: 12px;
    --radius-pill: 999px;
    --shadow-pop: 0 8px 24px rgba(63, 159, 255, 0.16), 0 2px 6px rgba(240, 98, 158, 0.08);
    --font-round: "YouYuan", "幼圆", "Yuanti SC", "Yuanti", "Microsoft YaHei", "微软雅黑", sans-serif;
    --font-mono: "Consolas", "Monaco", monospace;
}

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

html { min-height: 100%; background: #dce9fb; }

body {
    position: relative;
    min-height: 100vh;
    font-family: var(--font-round);
    color: var(--ink);
    background: transparent;
    isolation: isolate;
    padding-bottom: 60px;
}

/* ---------- 03 背景与泡泡 ---------- */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    background: url("/static/deepsleep-whale-girl.jpg") center / cover no-repeat fixed;
    opacity: 0.85;
    filter: saturate(1.05);
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: linear-gradient(160deg, rgba(190, 226, 255, 0.55), rgba(255, 214, 235, 0.45));
}

.bubble {
    position: fixed;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.12));
    border: 1.5px solid rgba(255, 255, 255, 0.55);
    pointer-events: none;
    animation: float-up linear infinite;
    z-index: 0;
}

@keyframes float-up {
    from { transform: translateY(105vh) scale(1); }
    to   { transform: translateY(-15vh) scale(1.12); }
}

/* ---------- 04 头部 ---------- */
header {
    position: sticky;
    top: 12px;
    z-index: 20;
    width: min(1200px, calc(100% - 32px));
    margin: 14px auto 0;
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    background: var(--card-bg);
    border: 2px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-pop);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
}

.logo-row { display: flex; align-items: center; gap: 14px; min-width: 0; }

.logo-badge {
    width: 50px;
    height: 50px;
    flex: none;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--blue-1), var(--pink-1));
    display: grid;
    place-items: center;
    font-size: 26px;
    border: 2.5px solid #fff;
    box-shadow: 0 4px 10px rgba(63, 159, 255, 0.35);
}

header h1 {
    font-size: 22px;
    letter-spacing: 1px;
    background: linear-gradient(90deg, var(--blue-3), var(--pink-3));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.logo-sub {
    font-size: 12px;
    color: var(--ink-soft);
    letter-spacing: 2px;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* 连接状态：纯 CSS 变成小贴纸（JS 只切 connected/disconnected/connecting 类） */
.status-dot {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    font-size: 12.5px;
    font-weight: bold;
    letter-spacing: 1px;
    border: 2px solid transparent;
}

.status-dot::before {
    content: "";
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex: none;
}

.status-dot.connected { background: #eafff1; border-color: #8be8ae; color: #1d9e57; }
.status-dot.connected::before { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot.connected::after { content: "实时连接正常"; }

.status-dot.disconnected { background: #fff0f3; border-color: #ffb3c2; color: #d6345c; }
.status-dot.disconnected::before { background: var(--red); box-shadow: 0 0 6px var(--red); }
.status-dot.disconnected::after { content: "连接已断开"; }

.status-dot.connecting { background: #fff8ec; border-color: #ffd28a; color: #c47d0e; }
.status-dot.connecting::before { background: var(--orange); animation: pulse 1s infinite; }
.status-dot.connecting::after { content: "连接中…"; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

/* ---------- 05 按钮（软糖风） ---------- */
.btn {
    font-family: var(--font-round);
    font-size: 13.5px;
    font-weight: bold;
    letter-spacing: 1px;
    color: var(--ink);
    padding: 9px 20px;
    border: none;
    border-radius: var(--radius-pill);
    background: #fff;
    box-shadow: 0 3px 0 rgba(43, 58, 85, 0.14), 0 6px 14px rgba(63, 159, 255, 0.14);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.btn:hover:not(:disabled) { transform: translateY(-2px) scale(1.03); }
.btn:active:not(:disabled) {
    transform: translateY(1px) scale(0.98);
    box-shadow: 0 1px 0 rgba(43, 58, 85, 0.14);
}

.btn:focus-visible,
select:focus-visible,
input:focus-visible,
.platform-tab:focus-visible {
    outline: 3px solid rgba(255, 143, 192, 0.65);
    outline-offset: 2px;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-green {
    background: linear-gradient(135deg, #8ef0b4, #4fd98b);
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 120, 60, 0.3);
    box-shadow: 0 3px 0 #2fae68, 0 8px 16px rgba(79, 217, 139, 0.35);
}
.btn-red {
    background: linear-gradient(135deg, #ffb3c6, var(--pink-2));
    color: #fff;
    text-shadow: 0 1px 2px rgba(180, 40, 90, 0.3);
    box-shadow: 0 3px 0 var(--pink-3), 0 8px 16px rgba(255, 143, 192, 0.35);
}
.btn-blue {
    background: linear-gradient(135deg, var(--blue-1), var(--blue-2));
    color: #fff;
    text-shadow: 0 1px 2px rgba(30, 90, 180, 0.35);
    box-shadow: 0 3px 0 var(--blue-3), 0 8px 16px rgba(63, 159, 255, 0.35);
}
.btn-orange {
    background: linear-gradient(135deg, #ffd28a, var(--orange));
    color: #fff;
    text-shadow: 0 1px 2px rgba(170, 100, 10, 0.35);
    box-shadow: 0 3px 0 #d67f1e, 0 8px 16px rgba(255, 159, 67, 0.35);
}
.btn-gray {
    background: linear-gradient(135deg, #c9d6ea, #93a7c4);
    color: #fff;
    text-shadow: 0 1px 2px rgba(60, 80, 110, 0.35);
    box-shadow: 0 3px 0 #7488a8, 0 8px 16px rgba(147, 167, 196, 0.35);
}

/* ---------- 06 平台 Tab ---------- */
.platform-tabs {
    width: min(1200px, calc(100% - 32px));
    margin: 18px auto 0;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.platform-tab {
    flex: 1 1 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 14px;
    border-radius: var(--radius-md) var(--radius-md) var(--radius-md) 6px;
    background: rgba(255, 255, 255, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.85);
    font-family: var(--font-round);
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(43, 58, 85, 0.07);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.platform-tab:hover { transform: translateY(-3px) rotate(-1deg); }

.platform-tab.active {
    background: linear-gradient(135deg, var(--blue-2), var(--pink-2));
    border-color: #fff;
    color: #fff;
    box-shadow: 0 6px 18px rgba(240, 98, 158, 0.4);
    transform: translateY(-3px);
}

.tab-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--red);
    border: 1.5px solid rgba(255, 255, 255, 0.8);
    flex: none;
}

.tab-dot.on { background: var(--green); box-shadow: 0 0 8px rgba(61, 220, 132, 0.9); }

.tab-title { font-size: 15px; font-weight: bold; letter-spacing: 1px; color: var(--ink); }
.platform-tab.active .tab-title { color: #fff; }

.tab-state {
    font-size: 11px;
    font-weight: bold;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.75);
    color: var(--ink-soft);
}

.platform-tab.active .tab-state { background: rgba(255, 255, 255, 0.28); color: #fff; }

.platform-page { display: none; }

.platform-page.active {
    display: block;
    animation: fade-in 0.25s ease;
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- 07 主体与统计卡 ---------- */
main {
    width: min(1200px, calc(100% - 32px));
    margin: 20px auto 0;
    position: relative;
    z-index: 2;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    position: relative;
    overflow: hidden;
    background: var(--card-bg);
    border: 2px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 18px 20px 16px;
    box-shadow: var(--shadow-pop);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    min-width: 0;
}

.stat-card::after {
    content: "✦";
    position: absolute;
    top: 10px;
    right: 16px;
    color: var(--pink-2);
    font-size: 14px;
    opacity: 0.8;
}

.stat-label {
    font-size: 12.5px;
    color: var(--ink-soft);
    letter-spacing: 2px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    background: linear-gradient(90deg, var(--blue-2), var(--pink-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    overflow-wrap: anywhere;
}

/* 执行器状态位（2026-10-28）：静默失效过一次，给它个显眼的成败色 */
.stat-value.stat-good {
    background: linear-gradient(90deg, #6fd08c, #2fa86a);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.stat-value.stat-bad {
    background: linear-gradient(90deg, #ff8a8a, #e05252);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.stat-sub {
    margin-top: 6px;
    font-size: 11.5px;
    color: var(--ink-soft);
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.two-col {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

/* ---------- 08 面板 ---------- */
.panel {
    background: var(--card-bg);
    border: 2px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    box-shadow: var(--shadow-pop);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    min-width: 0;
}

.panel h2 {
    font-size: 16.5px;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    color: var(--ink);
}

.panel h2::before {
    content: "";
    width: 10px;
    height: 22px;
    border-radius: 6px;
    background: linear-gradient(180deg, var(--blue-2), var(--pink-2));
    flex: none;
}

.panel h3 { font-size: 14px; color: var(--ink-soft); margin: 18px 0 10px; letter-spacing: 1px; }

.control-group { margin-bottom: 4px; }
.control-group + .control-group {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 2px dashed var(--line-soft);
}
.control-group h3 { font-size: 13.5px; color: var(--ink-soft); margin: 0 0 10px; letter-spacing: 1px; }

.mini-stats { display: flex; gap: 12px; flex-wrap: wrap; }

.mini-stat {
    flex: 1 1 110px;
    text-align: center;
    padding: 12px 8px;
    border-radius: var(--radius-md);
    background: linear-gradient(160deg, rgba(110, 198, 255, 0.16), rgba(255, 196, 221, 0.18));
    border: 1.5px dashed rgba(63, 159, 255, 0.35);
}

.mini-stat b { display: block; font-size: 21px; color: var(--blue-3); }
.mini-stat span { font-size: 12px; color: var(--ink-soft); letter-spacing: 1px; }

.panel-note { margin-top: 10px; font-size: 12.5px; color: var(--ink-soft); }

/* ---------- 09 消息流（聊天气泡） ---------- */
.feed {
    height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 6px 4px;
}

.feed::-webkit-scrollbar { width: 8px; }
.feed::-webkit-scrollbar-track { background: rgba(110, 198, 255, 0.10); border-radius: 8px; }
.feed::-webkit-scrollbar-thumb { background: rgba(63, 159, 255, 0.35); border-radius: 8px; }

.feed-item {
    max-width: 92%;
    padding: 7px 12px;
    border-radius: var(--radius-md);
    background: #fff;
    border: 1.5px solid rgba(110, 198, 255, 0.35);
    box-shadow: 0 2px 6px rgba(63, 159, 255, 0.08);
    font-size: 13px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.feed-time {
    color: var(--ink-mute);
    font-size: 11px;
    margin-right: 8px;
    font-family: var(--font-mono);
}

.feed-in { color: var(--ink); }

.feed-out {
    color: var(--blue-3);
    font-weight: bold;
}

.feed-event { color: #c47d0e; font-size: 12px; }

/* ---------- 10 表单控件 ---------- */
select,
.text-input {
    width: 100%;
    min-height: 40px;
    font-family: var(--font-round);
    font-size: 13.5px;
    color: var(--ink);
    padding: 9px 16px;
    border-radius: var(--radius-pill);
    border: 2px solid rgba(110, 198, 255, 0.45);
    background: rgba(255, 255, 255, 0.92);
    outline: none;
    margin-bottom: 8px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

select { border-radius: var(--radius-md); }

select:focus,
.text-input:focus {
    border-color: var(--pink-2);
    box-shadow: 0 0 0 4px rgba(255, 143, 192, 0.16);
}

.text-input::placeholder { color: var(--ink-mute); }

select option { background: #fff; color: var(--ink); }

.field-label {
    display: block;
    margin: 0 0 5px 6px;
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 1px;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 9px 0;
    font-size: 13px;
    color: var(--ink-soft);
    cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
    width: 17px;
    height: 17px;
    flex: none;
    accent-color: var(--pink-2);
    cursor: pointer;
}

.group-add-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 10px;
}

.group-add-row .text-input { margin-bottom: 0; }

/* ---------- 11 列表与杂项 ---------- */
.group-list { display: grid; gap: 8px; margin-bottom: 8px; }

.group-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: var(--radius-md);
    background: linear-gradient(90deg, rgba(110, 198, 255, 0.12), rgba(255, 196, 221, 0.12));
    border: 1.5px solid rgba(255, 255, 255, 0.9);
}

.group-name { min-width: 0; overflow-wrap: anywhere; font-size: 13px; color: var(--ink); }

.group-remove {
    padding: 4px 12px;
    font-size: 11.5px;
    box-shadow: none;
}

.group-empty {
    padding: 10px;
    border: 1.5px dashed rgba(63, 159, 255, 0.35);
    border-radius: var(--radius-md);
    color: var(--ink-mute);
    font-size: 12px;
    text-align: center;
}

.hint { color: var(--ink-mute); font-size: 12px; line-height: 1.6; margin-bottom: 10px; }

.muted { color: var(--ink-mute); font-size: 12.5px; }

.lock-note { color: #c47d0e; font-size: 12px; font-weight: bold; margin-top: 4px; }

.test-result {
    margin-top: 10px;
    background: rgba(110, 198, 255, 0.10);
    border: 1.5px dashed rgba(63, 159, 255, 0.3);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 12.5px;
    min-height: 40px;
    overflow-wrap: anywhere;
    color: var(--ink-soft);
}

#security-status div { padding: 4px 0; font-size: 13px; color: var(--ink-soft); }

.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.btn-row .btn { flex: 1 1 auto; }
.btn-row.tight { margin: 4px 0; }

/* ---------- 12 语音 / 点歌 ---------- */
.sub-title {
    margin: 16px 0 8px;
    font-size: 13px;
    font-weight: bold;
    color: var(--ink-soft);
    letter-spacing: 1px;
}

.voice-status {
    margin-bottom: 10px;
    padding: 9px 14px;
    border-radius: var(--radius-md);
    background: rgba(110, 198, 255, 0.10);
    border: 1.5px dashed rgba(63, 159, 255, 0.3);
    color: var(--ink-soft);
    font-size: 12.5px;
    line-height: 1.6;
    word-break: break-all;
}

.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-pair > div { min-width: 0; }

.song-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 190px;
    overflow-y: auto;
    padding: 4px 2px;
}

.song-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    line-height: 1.5;
    color: var(--ink-soft);
    background: rgba(255, 255, 255, 0.75);
    border: 1.5px solid rgba(110, 198, 255, 0.4);
    cursor: default;
    white-space: nowrap;
}

.song-chip.cached {
    color: #1d9e57;
    border-color: #8be8ae;
    background: #eafff1;
}

.voice-player { width: 100%; margin-top: 10px; }

/* ---------- 13 Toast 与全局提示 ---------- */
#toast-box {
    position: fixed;
    top: 84px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    max-width: min(92vw, 520px);
}

.toast-item {
    background: var(--card-bg-strong);
    color: var(--ink);
    border: 2px solid var(--card-border);
    border-radius: var(--radius-pill);
    padding: 10px 22px;
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 0.5px;
    line-height: 1.5;
    box-shadow: var(--shadow-pop);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    animation: toast-in 0.22s ease;
    overflow-wrap: anywhere;
}

.toast-item.leaving { opacity: 0; transition: opacity 0.2s ease; }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(-8px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-notice {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #ffb3c6, var(--pink-2));
    color: #fff;
    font-weight: bold;
    padding: 10px 22px;
    border-radius: var(--radius-pill);
    font-size: 13.5px;
    z-index: 9999;
    box-shadow: 0 6px 18px rgba(240, 98, 158, 0.4);
}

/* 双跑对比列表：空时不占位 */
.compare-list { max-height: 220px; overflow-y: auto; }
.compare-list:empty { display: none; }
.compare-list .feed-item {
    padding: 8px 10px;
    border: none;
    border-bottom: 1.5px dashed var(--line-soft);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    font-size: 13px;
    max-width: 100%;
}
.compare-list .feed-meta { font-size: 12px; color: var(--ink-soft); margin-bottom: 4px; }

/* ---------- 14 数据页 / 全局记忆页：左导航 + 紧凑视图 ---------- */
.page-body {
    display: grid;
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.side-nav {
    position: sticky;
    top: 96px;
    background: var(--card-bg);
    border: 2px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 12px 10px;
    box-shadow: var(--shadow-pop);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    max-height: calc(100vh - 130px);
    overflow-y: auto;
}

.side-group-title {
    font-size: 11px;
    color: var(--ink-mute);
    letter-spacing: 2px;
    padding: 8px 10px 6px;
}

.side-group-title:not(:first-child) {
    margin-top: 8px;
    border-top: 1.5px dashed var(--line-soft);
    padding-top: 12px;
}

.side-link {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    border-radius: 12px;
    background: transparent;
    font-family: var(--font-round);
    font-size: 13px;
    font-weight: bold;
    color: var(--ink-soft);
    cursor: pointer;
    text-align: left;
    transition: background 0.15s ease;
}

.side-link:hover { background: rgba(110, 198, 255, 0.14); }

.side-link.active {
    background: linear-gradient(135deg, var(--blue-2), var(--pink-2));
    color: #fff;
    box-shadow: 0 4px 12px rgba(240, 98, 158, 0.3);
}

.view { display: none; }
.view.active { display: block; animation: fade-in 0.2s ease; }

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.panel-head h2 { margin-bottom: 0; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.panel-desc { font-size: 12.5px; color: var(--ink-mute); margin-bottom: 14px; }

/* 配置字段：单行紧凑，描述与单项重置收进 ? 气泡 */
.field-row {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr) 28px;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 12px;
}

.field-row:nth-child(odd) { background: rgba(110, 198, 255, 0.07); }
.field-row:hover { background: rgba(255, 196, 221, 0.14); }

.field-name { font-size: 13px; font-weight: bold; color: var(--ink); }
.field-unit { font-weight: normal; color: var(--ink-mute); font-size: 11.5px; }

.field-input input:not([type="checkbox"]), .field-input select {
    width: 100%;
    font-family: var(--font-round);
    font-size: 13px;
    color: var(--ink);
    padding: 7px 14px;
    border-radius: var(--radius-pill);
    border: 1.5px solid rgba(110, 198, 255, 0.4);
    background: rgba(255, 255, 255, 0.9);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field-input input:focus, .field-input select:focus {
    border-color: var(--pink-2);
    box-shadow: 0 0 0 3px rgba(255, 143, 192, 0.15);
}

.field-help { position: relative; min-height: 20px; }

.help-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 11px;
    color: var(--ink-mute);
    border: 1.5px solid rgba(139, 152, 181, 0.4);
    cursor: help;
    user-select: none;
}

.help-pop {
    display: none;
    position: absolute;
    right: 0;
    top: 26px;
    z-index: 5;
    width: 240px;
    padding: 10px 12px;
    background: #fff;
    border: 2px solid var(--card-border);
    border-radius: 12px;
    box-shadow: var(--shadow-pop);
    font-size: 12px;
    color: var(--ink-soft);
    line-height: 1.6;
}

.field-help:hover .help-pop,
.field-help:focus-within .help-pop { display: block; }

.reset-one {
    margin-top: 6px;
    font-size: 11px;
    padding: 3px 12px;
    border: none;
    border-radius: var(--radius-pill);
    background: var(--pink-1);
    color: var(--pink-3);
    font-weight: bold;
    cursor: pointer;
    font-family: var(--font-round);
}

/* 软糖开关 */
.switch { position: relative; width: 46px; height: 25px; display: inline-block; vertical-align: middle; }
.switch input { display: none; }
.switch .track {
    position: absolute; inset: 0;
    border-radius: var(--radius-pill);
    background: #d7e3f5;
    border: 2px solid #fff;
    transition: background 0.2s ease;
    cursor: pointer;
}
.switch .track::after {
    content: "";
    position: absolute; top: 1.5px; left: 2px;
    width: 18px; height: 18px; border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 5px rgba(43, 58, 85, 0.25);
    transition: transform 0.2s ease;
}
.switch input:checked + .track { background: linear-gradient(90deg, var(--blue-2), var(--pink-2)); }
.switch input:checked + .track::after { transform: translateX(20px); }

/* 幽灵按钮（次要操作不抢眼） */
.btn-ghost {
    background: transparent;
    border: 1.5px dashed rgba(139, 152, 181, 0.5);
    color: var(--ink-mute);
    box-shadow: none;
}

/* 五类记忆：群 chips + 分类表 */
.room-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }

.room-chip {
    padding: 7px 16px;
    border-radius: var(--radius-pill);
    border: 2px solid rgba(110, 198, 255, 0.4);
    background: rgba(255, 255, 255, 0.8);
    font-family: var(--font-round);
    font-size: 13px;
    font-weight: bold;
    color: var(--ink-soft);
    cursor: pointer;
}

.room-chip.active {
    background: linear-gradient(135deg, var(--blue-2), var(--pink-2));
    color: #fff;
    border-color: #fff;
}

.room-chip .cnt { font-size: 11px; opacity: 0.8; }

.kind-table { width: 100%; border-collapse: collapse; }
.kind-table th, .kind-table td {
    padding: 10px 12px;
    text-align: left;
    font-size: 13px;
    border-bottom: 1.5px dashed var(--line-soft);
}
.kind-table th { font-size: 12px; color: var(--ink-mute); letter-spacing: 1px; }
.kind-table td { color: var(--ink); }
.kind-table tr:hover td { background: rgba(255, 196, 221, 0.12); }
.kind-table .w-kind { width: 140px; }
.kind-table .w-count { width: 90px; }
.kind-table .w-ops { width: 90px; }

.kind-name { font-weight: bold; }
.kind-desc { font-size: 11.5px; color: var(--ink-mute); }

.kind-count {
    display: inline-block;
    min-width: 34px;
    text-align: center;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    background: linear-gradient(135deg, rgba(110, 198, 255, 0.2), rgba(255, 196, 221, 0.25));
    font-weight: bold;
    font-size: 12.5px;
    color: var(--blue-3);
}

/* 编辑器 */
.editor-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.editor-bar h2 { margin-bottom: 0; }
.editor-path { font-size: 12px; color: var(--ink-mute); font-family: var(--font-mono); }

.edit-table-box {
    overflow-x: auto;
    border: 1.5px solid var(--line-soft);
    border-radius: var(--radius-md);
}

.edit-table { width: 100%; border-collapse: collapse; }

.edit-table th {
    position: sticky;
    top: 0;
    background: linear-gradient(90deg, rgba(110, 198, 255, 0.25), rgba(255, 196, 221, 0.25));
    font-size: 12px;
    color: var(--ink-soft);
    letter-spacing: 1px;
    padding: 8px 10px;
    text-align: left;
}

.edit-table td { padding: 4px 8px; border-bottom: 1px dashed var(--line-soft); }

.edit-table input {
    width: 100%;
    border: 1.5px solid transparent;
    border-radius: 8px;
    background: transparent;
    font-family: var(--font-round);
    font-size: 12.5px;
    color: var(--ink);
    padding: 6px 8px;
    outline: none;
}

.edit-table input:focus { border-color: var(--pink-2); background: #fff; }

.edit-table .w-del { width: 44px; }

.del-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    opacity: 0.45;
    padding: 4px;
}

.del-btn:hover { opacity: 1; }

.editor-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.editor-actions.no-mt { margin-top: 0; }

.nested-node {
    border: 1.5px dashed var(--line-soft);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    margin: 8px 0;
}

.nested-node summary { cursor: pointer; font-size: 13px; font-weight: bold; color: var(--ink-soft); }

/* ---------- 15 工具类 ---------- */
.mt-8 { margin-top: 8px; }
.mt-10 { margin-top: 10px; }
.mb-20 { margin-bottom: 20px; }

.editor-panel { display: none; margin-top: 16px; }

.json-editor {
    width: 100%;
    margin-top: 6px;
    font-family: var(--font-mono);
    font-size: 13px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--ink);
    border: 2px solid rgba(110, 198, 255, 0.45);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    outline: none;
}

.json-editor:focus { border-color: var(--pink-2); box-shadow: 0 0 0 4px rgba(255, 143, 192, 0.16); }

/* ---------- 16 响应式 ---------- */
@media (max-width: 900px) {
    .page-body { grid-template-columns: 1fr; }
    .side-nav {
        position: static;
        display: flex;
        overflow-x: auto;
        gap: 6px;
        max-height: none;
        padding: 10px;
    }
    .side-group-title { display: none; }
    .side-link { white-space: nowrap; width: auto; flex: none; }
    .field-row { grid-template-columns: 1fr; gap: 6px; }
    .field-help { display: none; }
}

@media (max-width: 768px) {
    header { align-items: flex-start; padding: 14px 18px; }
    .two-col { grid-template-columns: 1fr; }
    .feed { height: 300px; }  /* 移动端消息流降高，避免一屏被占满 */
}

@media (max-width: 520px) {
    header { flex-direction: column; }
    .header-controls { width: 100%; justify-content: flex-start; }
    .platform-tab { flex: 1 1 100%; justify-content: center; }
    .field-pair { grid-template-columns: 1fr; }
}

/* ---------- 17 降级与无障碍 ---------- */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    :root {
        --card-bg: rgba(255, 255, 255, 0.96);
        --card-bg-strong: #ffffff;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .bubble { display: none; }
}

/* ---- 插件清单（数据页 · 插件开关） ---- */
.plugin-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-pill, 999px);
    font-size: 12px;
    line-height: 1.6;
}
.plugin-tag.on { background: rgba(126, 200, 160, 0.22); color: #2f7a55; }
.plugin-tag.off { background: rgba(150, 160, 180, 0.18); color: var(--ink-mute, #6b7a90); }
#plugins-table td.n { color: var(--ink-mute, #6b7a90); font-variant-numeric: tabular-nums; }

/* ---- 发言观测矩阵 ---- */
.speech-matrix { overflow-x: auto; margin: 4px 0 8px; }
.speech-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.speech-table th, .speech-table td {
    border: 1px solid var(--border-soft, rgba(140, 150, 170, 0.18));
    padding: 5px 10px; text-align: center;
}
.speech-table th:first-child, .speech-table td:first-child { text-align: left; }
.speech-table thead th { background: rgba(140, 150, 170, 0.10); }
.speech-table tbody tr:hover { background: rgba(140, 150, 170, 0.06); }
