/* ==========================================================================
 * 微信对话生成器 /tool/wechat-dialogue-generator
 * 设计主题：深松绿（#0E7A5A）+ 墨岩（#14201D）+ 暖宣纸（#F6F5F1）
 * 提供完整的浅色 / 深色双主题，深色由 <html data-theme="dark"> 触发
 * （与站点导航栏的月亮/太阳按钮同一套机制）
 *
 * 手机外观（状态栏图标 / 气泡 / 红包转账卡片）的位图素材由
 * scripts/build-wechat-icons.js 统一抽取并内联为 data URI，
 * 生成结果见 wechat-dialogue-generator-icons.css。
 * ========================================================================== */

/* ===================== 设计令牌 ===================== */
.wdg-page {
    --wdg-bg: #f5f4ef;
    --wdg-canvas: #f7f6f1;
    --wdg-surface: #ffffff;
    --wdg-surface-2: #fbfaf6;
    --wdg-surface-3: #f1efe7;
    --wdg-ink: #14201d;
    --wdg-ink-2: #4e5c57;
    --wdg-ink-3: #66726d;
    --wdg-line: #e4e1d7;
    --wdg-line-2: #efede5;
    --wdg-brand: #0e7a5a;
    --wdg-brand-2: #0a6249;
    --wdg-brand-soft: #e5f3ed;
    --wdg-brand-line: #bfe3d5;
    --wdg-accent: #c2662d;
    --wdg-accent-soft: #fbeee3;
    --wdg-danger: #c0392b;
    --wdg-danger-soft: #fbeae7;
    --wdg-hero-1: #0d2f27;
    --wdg-hero-2: #0a4a37;
    --wdg-hero-3: #0e7a5a;
    --wdg-shadow-sm: 0 1px 2px rgba(20, 32, 29, .05), 0 8px 20px -14px rgba(20, 32, 29, .28);
    --wdg-shadow: 0 1px 2px rgba(20, 32, 29, .05), 0 20px 44px -28px rgba(20, 32, 29, .38);
    --wdg-radius: 18px;
    --wdg-radius-sm: 11px;
    --wdg-scale: .86;
    color: var(--wdg-ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    line-height: 1.7;
    font-variant-numeric: tabular-nums;
    -webkit-font-smoothing: antialiased;
}

:root[data-theme="dark"] .wdg-page {
    --wdg-bg: #0b100f;
    --wdg-canvas: #0d1312;
    --wdg-surface: #141b19;
    --wdg-surface-2: #172020;
    --wdg-surface-3: #1d2724;
    --wdg-ink: #e7edea;
    --wdg-ink-2: #aebbb6;
    --wdg-ink-3: #8e9c97;
    --wdg-line: #232e2a;
    --wdg-line-2: #1c2624;
    --wdg-brand: #34c48d;
    --wdg-brand-2: #5ad9a7;
    --wdg-brand-soft: #102e25;
    --wdg-brand-line: #1f4a3c;
    --wdg-accent: #e0a06c;
    --wdg-accent-soft: #2b2118;
    --wdg-danger: #e27a6a;
    --wdg-danger-soft: #2c1a17;
    --wdg-hero-1: #060c0a;
    --wdg-hero-2: #08251c;
    --wdg-hero-3: #0b3f31;
    --wdg-shadow-sm: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 24px -18px rgba(0, 0, 0, .8);
    --wdg-shadow: 0 1px 2px rgba(0, 0, 0, .45), 0 24px 50px -30px rgba(0, 0, 0, .9);
}

.wdg-page *,
.wdg-page *::before,
.wdg-page *::after { box-sizing: border-box; }

.wdg-page h1,
.wdg-page h2,
.wdg-page h3 {
    margin: 0;
    font-family: inherit;
    letter-spacing: -.2px;
    line-height: 1.28;
}

.wdg-page p { margin: 0; }

.wdg-page button,
.wdg-page input,
.wdg-page select,
.wdg-page textarea {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

.wdg-page code {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: .92em;
    background: var(--wdg-surface-3);
    border: 1px solid var(--wdg-line-2);
    border-radius: 5px;
    padding: 1px 5px;
    color: var(--wdg-ink-2);
}

/* ===================== 画布 ===================== */
.wdg-canvas {
    position: relative;
    padding: 22px;
    border-radius: 26px;
    background:
        radial-gradient(900px 380px at 8% -6%, rgba(14, 122, 90, .07), transparent 62%),
        radial-gradient(720px 340px at 96% 0%, rgba(194, 102, 45, .06), transparent 60%),
        var(--wdg-canvas);
    border: 1px solid var(--wdg-line);
}

:root[data-theme="dark"] .wdg-canvas {
    background:
        radial-gradient(900px 380px at 8% -6%, rgba(52, 196, 141, .09), transparent 62%),
        radial-gradient(720px 340px at 96% 0%, rgba(224, 160, 108, .05), transparent 60%),
        var(--wdg-canvas);
}

/* ===================== 首屏 ===================== */
.wdg-hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 344px;
    gap: 30px;
    align-items: stretch;
    padding: 34px 34px 30px;
    border-radius: 22px;
    overflow: hidden;
    color: #fff;
    background:
        radial-gradient(620px 300px at 88% -20%, rgba(90, 217, 167, .28), transparent 66%),
        radial-gradient(520px 260px at -8% 120%, rgba(90, 217, 167, .16), transparent 62%),
        linear-gradient(150deg, var(--wdg-hero-1) 0%, var(--wdg-hero-2) 52%, var(--wdg-hero-3) 128%);
    box-shadow: 0 26px 60px -40px rgba(6, 40, 30, .9);
}

.wdg-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, .055) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .055) 1px, transparent 1px);
    background-size: 46px 46px;
    mask-image: radial-gradient(80% 70% at 70% 10%, #000 20%, transparent 78%);
    -webkit-mask-image: radial-gradient(80% 70% at 70% 10%, #000 20%, transparent 78%);
    pointer-events: none;
}

.wdg-hero-copy,
.wdg-quick { position: relative; z-index: 1; }

.wdg-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 26px;
    padding: 0 12px 0 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .26);
    background: rgba(255, 255, 255, .08);
    font-size: 12px;
    letter-spacing: .02em;
    color: rgba(255, 255, 255, .86);
}

.wdg-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #5ad9a7;
    box-shadow: 0 0 0 4px rgba(90, 217, 167, .18);
}

.wdg-page h1 {
    margin: 16px 0 0;
    font-size: clamp(30px, 3.4vw, 42px);
    font-weight: 700;
    letter-spacing: -1px;
    line-height: 1.12;
    color: #fff;
}

.wdg-lead {
    margin-top: 12px;
    max-width: 48ch;
    font-size: 15.5px;
    line-height: 1.78;
    color: rgba(255, 255, 255, .82);
}

.wdg-cta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 22px;
}

.wdg-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 34px;
    margin: 26px 0 0;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, .14);
}

.wdg-metrics > div { display: flex; flex-direction: column-reverse; gap: 2px; }

.wdg-metrics dt {
    font-size: 12px;
    letter-spacing: .04em;
    color: rgba(255, 255, 255, .72);
}

.wdg-metrics dd {
    margin: 0;
    font-size: 13px;
    color: rgba(255, 255, 255, .78);
}

.wdg-metrics dd b {
    font-size: 22px;
    font-weight: 700;
    color: #7ef0c2;
    margin-right: 2px;
}

/* 首屏右侧：快速开始 */
.wdg-quick {
    display: flex;
    flex-direction: column;
    padding: 18px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, .22);
    background: rgba(255, 255, 255, .11);
    box-shadow: 0 18px 40px -30px rgba(0, 0, 0, .9), inset 0 1px 0 rgba(255, 255, 255, .1);
    backdrop-filter: blur(16px) saturate(150%);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
}

.wdg-quick-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }

.wdg-quick-head b { font-size: 14.5px; color: #fff; letter-spacing: .01em; }

.wdg-quick-head span { font-size: 12px; color: rgba(255, 255, 255, .6); }

.wdg-quick-presets { display: flex; flex-direction: column; gap: 7px; }

.wdg-preset {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    width: 100%;
    padding: 9px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, .14);
    background: rgba(255, 255, 255, .05);
    text-align: left;
    cursor: pointer;
    transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

.wdg-preset b { font-size: 13.5px; font-weight: 600; color: #fff; }

.wdg-preset span { font-size: 11.5px; color: rgba(255, 255, 255, .68); }

.wdg-preset:hover {
    background: rgba(255, 255, 255, .14);
    border-color: rgba(126, 240, 194, .5);
    transform: translateX(2px);
}

.wdg-quick-note {
    margin-top: auto;
    padding-top: 12px;
    font-size: 11.5px;
    line-height: 1.6;
    color: rgba(255, 255, 255, .64);
}

/* ===================== 按钮 ===================== */
.wdg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 15px;
    border-radius: 9px;
    border: 1px solid var(--wdg-line);
    background: var(--wdg-surface);
    color: var(--wdg-ink);
    font-size: 13.5px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: background .16s ease, border-color .16s ease, color .16s ease, transform .12s ease;
}

.wdg-btn:hover { border-color: var(--wdg-brand-line); color: var(--wdg-brand); }

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

.wdg-btn:focus-visible {
    outline: 2px solid var(--wdg-brand);
    outline-offset: 2px;
}

.wdg-btn--primary {
    background: var(--wdg-brand);
    border-color: var(--wdg-brand);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 6px 16px -10px rgba(14, 122, 90, .8);
}

.wdg-btn--primary:hover {
    background: var(--wdg-brand-2);
    border-color: var(--wdg-brand-2);
    color: #fff;
}

:root[data-theme="dark"] .wdg-btn--primary { color: #05130f; }

.wdg-btn--ghost {
    background: transparent;
    border-color: var(--wdg-line);
    color: var(--wdg-ink-2);
}

.wdg-btn--ghost:hover { background: var(--wdg-brand-soft); border-color: var(--wdg-brand-line); color: var(--wdg-brand); }

.wdg-btn--quiet {
    background: transparent;
    border-color: transparent;
    color: var(--wdg-ink-2);
}

.wdg-btn--quiet:hover { background: var(--wdg-surface-3); color: var(--wdg-ink); }

.wdg-btn--danger { color: var(--wdg-danger); border-color: rgba(192, 57, 43, .32); background: transparent; }

.wdg-btn--danger:hover { background: var(--wdg-danger-soft); border-color: var(--wdg-danger); color: var(--wdg-danger); }

.wdg-btn--lg { height: 42px; padding: 0 20px; font-size: 14.5px; border-radius: 10px; }

.wdg-btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }

.wdg-btnrow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

/* 首屏内的按钮配色（深色底上） */
.wdg-hero .wdg-btn--primary {
    background: #ffffff;
    border-color: #ffffff;
    color: #0a5540;
    box-shadow: 0 10px 26px -14px rgba(0, 0, 0, .9);
}

.wdg-hero .wdg-btn--primary:hover { background: #e9fbf4; border-color: #e9fbf4; color: #084434; }

.wdg-hero .wdg-btn--ghost {
    background: rgba(255, 255, 255, .07);
    border-color: rgba(255, 255, 255, .3);
    color: #fff;
}

.wdg-hero .wdg-btn--ghost:hover { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .55); color: #fff; }

.wdg-hero .wdg-btn--quiet { color: rgba(255, 255, 255, .78); }

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

/* ===================== 主布局 ===================== */
.wdg-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 428px;
    gap: 20px;
    align-items: start;
    margin-top: 20px;
}

.wdg-editor { min-width: 0; }

.wdg-stage {
    position: sticky;
    top: 76px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wdg-panel {
    padding: 22px 22px 24px;
    border-radius: var(--wdg-radius);
    border: 1px solid var(--wdg-line);
    background: var(--wdg-surface);
    box-shadow: var(--wdg-shadow-sm);
}

.wdg-panel + .wdg-panel { margin-top: 18px; }

.wdg-panel-head { margin-bottom: 16px; }

.wdg-panel-kicker {
    display: inline-block;
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--wdg-brand);
}

.wdg-panel-head h2 { font-size: 21px; font-weight: 700; }

.wdg-panel-head p {
    margin-top: 6px;
    font-size: 13.5px;
    color: var(--wdg-ink-2);
}

/* ===================== 选项卡（分段控件） ===================== */
.wdg-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 22px;
    padding: 4px;
    border-radius: 12px;
    background: var(--wdg-surface-3);
    border: 1px solid var(--wdg-line-2);
}

.wdg-tab {
    position: relative;
    height: 34px;
    padding: 0 16px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--wdg-ink-2);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: color .16s ease, background .16s ease, box-shadow .16s ease;
}

.wdg-tab:hover { color: var(--wdg-ink); }

.wdg-tab.is-active {
    background: var(--wdg-surface);
    color: var(--wdg-ink);
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(20, 32, 29, .1), 0 6px 14px -12px rgba(20, 32, 29, .7);
}

:root[data-theme="dark"] .wdg-tab.is-active { box-shadow: 0 1px 2px rgba(0, 0, 0, .5); }

.wdg-tabs-hint {
    margin-left: auto;
    padding-right: 8px;
    font-size: 11.5px;
    color: var(--wdg-ink-2);
}

.wdg-tabpanel { display: none; }

.wdg-tabpanel.is-active { display: block; animation: wdg-fade .24s ease; }

@keyframes wdg-fade {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: none; }
}

/* ===================== 区块 ===================== */
.wdg-block + .wdg-block {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px dashed var(--wdg-line);
}

.wdg-block-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
}

.wdg-step {
    flex: none;
    width: 26px;
    height: 26px;
    margin-top: 2px;
    border-radius: 8px;
    background: var(--wdg-brand-soft);
    border: 1px solid var(--wdg-brand-line);
    color: var(--wdg-brand);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .02em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wdg-block-head h2 { font-size: 16.5px; font-weight: 700; }

.wdg-block-head p {
    margin-top: 3px;
    font-size: 12.5px;
    line-height: 1.65;
    color: var(--wdg-ink-2);
}

/* ===================== 表单 ===================== */
.wdg-field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(196px, 1fr));
    gap: 14px;
}

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

.wdg-label {
    display: block;
    margin-bottom: 6px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--wdg-ink-2);
}

.wdg-unit {
    font-size: 11.5px;
    font-weight: 400;
    color: var(--wdg-ink-3);
}

.wdg-input,
.wdg-select,
.wdg-textarea {
    width: 100%;
    border: 1px solid var(--wdg-line);
    background: var(--wdg-surface-2);
    border-radius: 9px;
    padding: 8px 11px;
    font-size: 14px;
    outline: none;
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.wdg-input::placeholder,
.wdg-textarea::placeholder { color: var(--wdg-ink-3); }

.wdg-input:hover,
.wdg-select:hover,
.wdg-textarea:hover { border-color: var(--wdg-brand-line); }

.wdg-input:focus,
.wdg-select:focus,
.wdg-textarea:focus {
    border-color: var(--wdg-brand);
    background: var(--wdg-surface);
    box-shadow: 0 0 0 3px rgba(14, 122, 90, .13);
}

:root[data-theme="dark"] .wdg-input:focus,
:root[data-theme="dark"] .wdg-select:focus,
:root[data-theme="dark"] .wdg-textarea:focus { box-shadow: 0 0 0 3px rgba(52, 196, 141, .18); }

.wdg-textarea { min-height: 84px; resize: vertical; line-height: 1.65; }

/* 文件选择：统一成按钮风格 */
.wdg-page input[type="file"] {
    padding: 6px 8px;
    font-size: 12.5px;
    color: var(--wdg-ink-2);
    cursor: pointer;
}

.wdg-page input[type="file"]::file-selector-button {
    margin-right: 10px;
    padding: 5px 12px;
    border: 1px solid var(--wdg-brand-line);
    border-radius: 7px;
    background: var(--wdg-brand-soft);
    color: var(--wdg-brand);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.wdg-page input[type="file"]::file-selector-button:hover {
    background: var(--wdg-brand);
    border-color: var(--wdg-brand);
    color: #fff;
}

.wdg-select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 30px;
    background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
    background-position: calc(100% - 16px) 51%, calc(100% - 11px) 51%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    cursor: pointer;
}

.wdg-input--tiny { width: 110px; }

.wdg-range { width: 100%; height: 22px; accent-color: var(--wdg-brand); cursor: pointer; }

.wdg-hint {
    font-size: 11.5px;
    line-height: 1.6;
    color: var(--wdg-ink-3);
}

.wdg-inline-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.wdg-label--inline { margin: 0; }

.wdg-field--inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.wdg-field--inline .wdg-label { margin: 0; }

/* 是 / 否 分段选择 */
.wdg-seg {
    display: inline-flex;
    padding: 3px;
    border-radius: 9px;
    border: 1px solid var(--wdg-line);
    background: var(--wdg-surface-3);
    gap: 2px;
}

.wdg-seg-item { position: relative; display: inline-flex; }

.wdg-seg-item input {
    position: absolute;
    inset: 0;
    opacity: 0;
    margin: 0;
    cursor: pointer;
}

.wdg-seg-item span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 26px;
    padding: 0 12px;
    border-radius: 7px;
    font-size: 12.5px;
    color: var(--wdg-ink-2);
    cursor: pointer;
    transition: all .15s ease;
}

.wdg-seg-item:has(input:checked) span {
    background: var(--wdg-brand);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 6px -3px rgba(14, 122, 90, .9);
}

:root[data-theme="dark"] .wdg-seg-item:has(input:checked) span { color: #04120e; }

.wdg-seg-item:has(input:focus-visible) span { outline: 2px solid var(--wdg-brand); outline-offset: 2px; }

/* 开关 */
.wdg-switch {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
}

.wdg-switch input { position: absolute; opacity: 0; width: 0; height: 0; }

.wdg-switch-track {
    position: relative;
    width: 40px;
    height: 23px;
    flex: none;
    border-radius: 999px;
    background: var(--wdg-surface-3);
    border: 1px solid var(--wdg-line);
    transition: background .18s ease, border-color .18s ease;
}

.wdg-switch-track i {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .24);
    transition: transform .18s ease;
}

.wdg-switch input:checked + .wdg-switch-track {
    background: var(--wdg-brand);
    border-color: var(--wdg-brand);
}

.wdg-switch input:checked + .wdg-switch-track i { transform: translateX(17px); }

.wdg-switch-text { font-size: 12.5px; color: var(--wdg-ink-2); }

/* ===================== 角色卡 ===================== */
.wdg-users {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.wdg-user {
    position: relative;
    width: 100px;
    padding: 10px 8px 8px;
    border-radius: 13px;
    border: 1px solid var(--wdg-line);
    background: var(--wdg-surface-2);
    text-align: center;
    transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}

.wdg-user:hover { border-color: var(--wdg-brand-line); }

.wdg-user.is-speaker {
    border-color: var(--wdg-brand);
    background: var(--wdg-brand-soft);
    box-shadow: 0 0 0 3px rgba(14, 122, 90, .1);
}

:root[data-theme="dark"] .wdg-user.is-speaker { box-shadow: 0 0 0 3px rgba(52, 196, 141, .12); }

.wdg-user-avatar {
    position: relative;
    width: 46px;
    height: 46px;
    margin: 0 auto 7px;
    border-radius: 9px;
    background: var(--wdg-surface-3);
    border: 1px solid var(--wdg-line-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    overflow: hidden;
    cursor: pointer;
}

.wdg-user-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.wdg-user-avatar input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.wdg-user-name {
    width: 100%;
    padding: 2px 3px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    text-align: center;
    font-size: 12.5px;
    font-weight: 600;
}

.wdg-user-name:hover { border-color: var(--wdg-line); }

.wdg-user-name:focus { border-color: var(--wdg-brand); background: var(--wdg-surface); outline: none; }

.wdg-user-pick {
    position: absolute;
    right: 3px;
    bottom: 28px;
    width: 21px;
    height: 21px;
    border-radius: 50%;
    border: 2px solid var(--wdg-surface);
    background: var(--wdg-surface-3);
    color: var(--wdg-ink-2);
    font-size: 10.5px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .15s ease;
}

.wdg-user-pick:hover { background: var(--wdg-brand); color: #fff; border-color: var(--wdg-surface); }

.wdg-user.is-speaker .wdg-user-pick { background: var(--wdg-brand); color: #fff; }

/* 深色下品牌绿偏亮，白字对比不足，改深色字 */
:root[data-theme="dark"] .wdg-user-pick:hover,
:root[data-theme="dark"] .wdg-user.is-speaker .wdg-user-pick { color: #04120e; }

.wdg-user-del {
    position: absolute;
    right: -7px;
    top: -7px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--wdg-surface);
    background: var(--wdg-danger);
    color: #fff;
    font-size: 11px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transform: scale(.8);
    transition: opacity .15s ease, transform .15s ease;
}

.wdg-user:hover .wdg-user-del,
.wdg-user:focus-within .wdg-user-del { opacity: 1; transform: none; }

/* 触屏设备没有 hover，删除按钮常显 */
@media (hover: none) {
    .wdg-user-del { opacity: 1; transform: none; }
}

.wdg-user-add {
    width: 100px;
    min-height: 100px;
    border: 1px dashed var(--wdg-line);
    border-radius: 13px;
    background: transparent;
    color: var(--wdg-ink-3);
    font-size: 24px;
    cursor: pointer;
    transition: all .16s ease;
}

.wdg-user-add:hover { border-color: var(--wdg-brand); color: var(--wdg-brand); background: var(--wdg-brand-soft); }

/* ===================== 消息构建器 ===================== */
.wdg-composer {
    padding: 14px;
    border-radius: 14px;
    border: 1px solid var(--wdg-line);
    background: var(--wdg-surface-2);
}

.wdg-composer-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.wdg-composer-label { font-size: 12px; color: var(--wdg-ink-3); }

.wdg-sender-chip {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 10px;
    border-radius: 999px;
    background: var(--wdg-brand-soft);
    border: 1px solid var(--wdg-brand-line);
    color: var(--wdg-brand);
    font-size: 12px;
    font-weight: 600;
}

.wdg-type-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}

.wdg-type {
    height: 30px;
    padding: 0 14px;
    border-radius: 8px;
    border: 1px solid var(--wdg-line);
    background: var(--wdg-surface);
    color: var(--wdg-ink-2);
    font-size: 13px;
    cursor: pointer;
    transition: all .15s ease;
}

.wdg-type:hover { border-color: var(--wdg-brand-line); color: var(--wdg-brand); }

.wdg-type.is-active {
    background: var(--wdg-brand);
    border-color: var(--wdg-brand);
    color: #fff;
    font-weight: 600;
}

:root[data-theme="dark"] .wdg-type.is-active { color: #04120e; }

.wdg-amount-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px dashed var(--wdg-brand-line);
    background: var(--wdg-brand-soft);
}

.wdg-amount-row .wdg-label { margin: 0; }

.wdg-amount-row .wdg-input { background: var(--wdg-surface); }

.wdg-fieldset[hidden],
.wdg-amount-row[hidden] { display: none !important; }

.wdg-err {
    display: none;
    margin-top: 10px;
    padding: 7px 11px;
    border-radius: 8px;
    border: 1px solid rgba(192, 57, 43, .28);
    background: var(--wdg-danger-soft);
    color: var(--wdg-danger);
    font-size: 12.5px;
}

.wdg-err.is-on { display: block; }

/* ===================== 消息列表 ===================== */
.wdg-msglist {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-height: 360px;
    overflow-y: auto;
}

.wdg-msglist:empty::after {
    content: "还没有消息。可以在上面写一条，或点「套用示例，先看效果」一键生成。";
    display: block;
    padding: 26px 10px;
    border: 1px dashed var(--wdg-line);
    border-radius: 12px;
    text-align: center;
    font-size: 12.5px;
    color: var(--wdg-ink-3);
}

.wdg-msgrow {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: var(--wdg-surface-2);
    font-size: 13px;
    transition: border-color .14s ease, background .14s ease;
}

.wdg-msgrow:hover { border-color: var(--wdg-line); background: var(--wdg-surface); }

.wdg-msgrow[draggable="true"] { cursor: grab; }

.wdg-msgrow[draggable="true"]:active { cursor: grabbing; }

.wdg-msgrow.is-editing { border-color: var(--wdg-brand); background: var(--wdg-brand-soft); }

.wdg-msgrow.is-dragging { opacity: .4; }

.wdg-msgrow.is-drop { border-color: var(--wdg-brand); background: var(--wdg-brand-soft); }

.wdg-msgrow-no {
    width: 20px;
    flex: none;
    font-size: 11.5px;
    color: var(--wdg-ink-3);
    text-align: center;
}

.wdg-msgrow-who {
    flex: none;
    width: 78px;
    font-size: 12.5px;
    color: var(--wdg-ink-2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.wdg-msgrow-tag {
    flex: none;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--wdg-surface-3);
    color: var(--wdg-ink-2);
    font-size: 11px;
}

.wdg-msgrow-act { flex: none; display: flex; gap: 3px; }

.wdg-msgrow-act button {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--wdg-ink-3);
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    transition: all .14s ease;
}

.wdg-msgrow-act button:hover { background: var(--wdg-surface-3); border-color: var(--wdg-line); color: var(--wdg-brand); }

.wdg-msgrow-edit {
    flex: 1;
    min-width: 0;
    padding: 4px 8px;
    border: 1px solid var(--wdg-brand);
    border-radius: 6px;
    background: var(--wdg-surface);
    font-size: 13px;
}

/* ===================== 手机预览 ===================== */
.wdg-stagecard {
    padding: 14px;
    border-radius: var(--wdg-radius);
    border: 1px solid var(--wdg-line);
    background: var(--wdg-surface);
    box-shadow: var(--wdg-shadow-sm);
}

.wdg-stagecard-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.wdg-stagecard-head b { display: block; font-size: 14px; }

.wdg-stagecard-head span { display: block; font-size: 11.5px; color: var(--wdg-ink-3); }

.wdg-live {
    display: inline-flex !important;
    align-items: center;
    gap: 5px;
    height: 22px;
    padding: 0 9px;
    border-radius: 999px;
    background: var(--wdg-brand-soft);
    border: 1px solid var(--wdg-brand-line);
    color: var(--wdg-brand) !important;
    font-size: 11px !important;
}

.wdg-live i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    animation: wdg-pulse 1.8s ease-in-out infinite;
}

@keyframes wdg-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .35; transform: scale(.75); }
}

.wdg-device {
    width: max-content;
    max-width: 100%;
    margin: 0 auto;
    padding: 13px 13px 16px;
    border-radius: 32px;
    background: linear-gradient(160deg, #2b3431 0%, #141a18 62%, #0d1211 100%);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, .1),
        inset 0 2px 6px rgba(255, 255, 255, .06),
        0 20px 40px -26px rgba(10, 20, 16, .8);
}

:root[data-theme="dark"] .wdg-device {
    background: linear-gradient(160deg, #202927 0%, #121917 60%, #0a100e 100%);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, .07),
        0 20px 40px -26px rgba(0, 0, 0, .9);
}

.wdg-device::before {
    content: "";
    display: block;
    width: 52px;
    height: 4px;
    margin: 0 auto 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .14);
}

.wdg-phone-wrap {
    width: calc(390px * var(--wdg-scale));
    height: calc(844px * var(--wdg-scale));
    margin: 0 auto;
    overflow: hidden;
    border-radius: 22px;
}

.wdg-phone-wrap.is-ear { height: calc(620px * var(--wdg-scale)); }

.wdg-stage-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 12px;
}

.wdg-stage-actions .wdg-btn { flex: 1 1 auto; min-width: 0; font-size: 12.5px; height: 34px; }

.wdg-stage-tip {
    padding: 0 4px;
    font-size: 11.5px;
    line-height: 1.6;
    color: var(--wdg-ink-3);
}

/* ---------------- 手机本体（导出长图依赖这些固定尺寸） ---------------- */
.wdg-phone {
    width: 390px;
    height: 844px;
    transform: scale(var(--wdg-scale));
    transform-origin: top left;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    background: #ededed;
    border-radius: 22px;
    font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: #111;
}

.wdg-phone.is-ear { height: 620px; }

.wdg-phone-bar {
    flex: none;
    height: 44px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 4px;
    background: #ededed;
    color: #111;
}

.wdg-phone-time { flex: 1; font-size: 15px; font-weight: 600; }

.wdg-phone-status { display: flex; align-items: center; gap: 5px; }

.wdg-net-text,
.wdg-bat-text { font-size: 11px; font-weight: 700; color: #111; }

.wdg-phone-nav {
    flex: none;
    height: 44px;
    padding: 0 17px;
    display: flex;
    align-items: center;
    position: relative;
    background: #ededed;
    border-bottom: .5px solid #d5d5d5;
}

.wdg-phone-nav-left {
    flex: none;
    width: 50px;
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
}

.wdg-phone-nav-right {
    flex: none;
    width: 50px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.wdg-phone-nav-title {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    overflow: hidden;
    white-space: nowrap;
    font-size: 17px;
    font-weight: 500;
    color: #111;
}

/* 未读消息数：返回箭头右侧的灰色圆形徽标 */
.wdg-phone-nav-badge {
    flex: none;
    width: 24px;
    height: 24px;
    border-radius: 12px;
    background: #d5d5d5;
    color: #353535;
    font-size: 12px;
    font-weight: 600;
    line-height: 24px;
    text-align: center;
    overflow: hidden;
}

.wdg-phone-nav-badge.is-empty { display: none; }

.wdg-phone-back,
.wdg-phone-more { display: flex; align-items: center; justify-content: center; }

.wdg-phone-back { width: 9px; justify-content: flex-start; }

.wdg-phone-more { width: 34px; }

.wdg-phone-body {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.wdg-phone-body::-webkit-scrollbar { width: 0; height: 0; }

.wdg-chat { position: relative; padding: 12px; min-height: 100%; }

/* ---------------- 消息气泡 ---------------- */
.wdg-msg {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-bottom: 16px;
}

.wdg-msg.is-right { flex-direction: row-reverse; }

.wdg-msg-avatar {
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: 5px;
    background: #f1f1f1;
    color: #999;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.wdg-msg-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.wdg-msg-main { position: relative; min-width: 0; max-width: 236px; }

.wdg-msg-text {
    position: relative;
    display: inline-block;
    max-width: 236px;
    padding: 9px 12px;
    border-radius: 6px;
    background: #fff;
    color: #111;
    font-size: 16px;
    line-height: 1.45;
    word-break: break-word;
    white-space: pre-wrap;
}

.wdg-msg-text::before {
    content: "";
    position: absolute;
    top: 16px;
    left: -4px;
    width: 8px;
    height: 8px;
    background: #fff;
    border-bottom-left-radius: 2px;
    transform: rotate(45deg);
}

.wdg-msg.is-right .wdg-msg-text { background: #98e970; }

.wdg-msg.is-right .wdg-msg-text::before {
    left: auto;
    right: -3px;
    background: #98e970;
    border-bottom-left-radius: 0;
    border-top-right-radius: 2px;
}

.wdg-msg-image {
    display: block;
    max-width: 180px;
    max-height: 180px;
    border-radius: 5px;
    border: 1px solid #d5d5d5;
    background: #f4f4f4;
    object-fit: cover;
}

.wdg-msg-voice {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 78px;
    padding: 11px 13px;
    border-radius: 6px;
    background: #fff;
    color: #111;
    font-size: 15px;
}

.wdg-msg-voice::before {
    content: "";
    position: absolute;
    top: 16px;
    left: -4px;
    width: 8px;
    height: 8px;
    background: #fff;
    border-bottom-left-radius: 2px;
    transform: rotate(45deg);
}

.wdg-msg.is-right .wdg-msg-voice { background: #98e970; }

.wdg-msg.is-right .wdg-msg-voice::before {
    left: auto;
    right: -3px;
    background: #98e970;
    border-bottom-left-radius: 0;
    border-top-right-radius: 2px;
}

.wdg-msg-voice em { font-style: normal; font-size: 13px; }

.wdg-msg-unread {
    position: absolute;
    top: 10px;
    right: -9px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #e75e58;
}

.wdg-msg-stamp { margin-top: 3px; font-size: 11px; color: #b2b2b2; }

.wdg-msg.is-right .wdg-msg-stamp { text-align: right; }

/* 红包 / 转账卡片 */
.wdg-msg-card {
    position: relative;
    width: 230px;
    border-radius: 6px;
    overflow: hidden;
    background: #f79c46;
    color: #fff;
}

.wdg-msg-card::before {
    content: "";
    position: absolute;
    top: 13px;
    left: -5px;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-right: 6px solid #f79c46;
}

.wdg-msg.is-right .wdg-msg-card::before {
    left: auto;
    right: -5px;
    border-right: none;
    border-left: 6px solid #f79c46;
}

.wdg-msg-card-head {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 12px 12px 10px;
}

.wdg-msg-card-icon {
    flex: none;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    background: rgba(255, 255, 255, .28);
    display: flex;
    align-items: center;
    justify-content: center;
}

.wdg-msg-card-title { font-size: 14.5px; line-height: 1.3; }

.wdg-msg-card-title em {
    display: block;
    font-style: normal;
    font-size: 11.5px;
    opacity: .85;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wdg-msg-card-foot {
    padding: 5px 12px;
    background: rgba(0, 0, 0, .08);
    color: #fdecd6;
    font-size: 12px;
}

.wdg-msg-card-amount { font-size: 13px; opacity: .95; }

.wdg-msg-card.is-transfer { background: #f79c46; }

.wdg-msg-card.is-transfer.is-done { background: #f8e2c6; color: #8a5a24; }

.wdg-msg-card.is-transfer.is-done .wdg-msg-card-foot { background: rgba(0, 0, 0, .05); color: #a97b46; }

.wdg-msg-card.is-transfer.is-done::before { border-right-color: #f8e2c6; }

.wdg-msg.is-right .wdg-msg-card.is-transfer.is-done::before { border-left-color: #f8e2c6; }

.wdg-msg-card.is-claimed { background: #f6cf9b; color: #8a5a24; }

.wdg-msg-card.is-claimed::before { border-right-color: #f6cf9b; }

.wdg-msg.is-right .wdg-msg-card.is-claimed::before { border-left-color: #f6cf9b; }

.wdg-msg-card.is-claimed .wdg-msg-card-foot { background: rgba(0, 0, 0, .05); color: #a97b46; }

.wdg-msg-card.is-claimed .wdg-msg-card-head { opacity: .82; }

.wdg-msg-del {
    position: absolute;
    top: -10px;
    left: -26px;
    z-index: 5;
    width: 20px;
    height: 20px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: #f5222d;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
    display: none;
}

.wdg-msg.is-right .wdg-msg-del { left: auto; right: -26px; }

.wdg-msg:hover .wdg-msg-del { display: block; }

.wdg-msg-claim {
    position: absolute;
    right: 8px;
    bottom: 7px;
    z-index: 4;
    padding: 2px 9px;
    border: 0;
    border-radius: 4px;
    background: rgba(0, 0, 0, .22);
    color: #fff;
    font-size: 11px;
    cursor: pointer;
    display: none;
}

.wdg-msg-card:hover .wdg-msg-claim { display: block; }

/* 时间 / 系统提示 */
.wdg-msg-time { margin: 4px 0 14px; text-align: center; font-size: 12px; color: #b2b2b2; }

.wdg-msg-system { margin: 4px 0 14px; text-align: center; }

.wdg-msg-system span {
    display: inline-block;
    max-width: 78%;
    padding: 4px 9px;
    border-radius: 4px;
    background: rgba(0, 0, 0, .08);
    color: #6d6d6d;
    font-size: 12px;
    line-height: 1.5;
    word-break: break-word;
}

.wdg-chat-empty { padding: 40px 10px; text-align: center; font-size: 13px; color: #9a9a9a; }

/* 底部输入栏 */
.wdg-phone-input {
    flex: none;
    padding: 6px 10px 0;
    background: #f6f6f6;
    border-top: .5px solid #dcdcdc;
}

.wdg-phone-input-row { display: flex; align-items: center; gap: 8px; }

.wdg-phone-input-box {
    flex: 1;
    height: 34px;
    padding: 0 10px;
    border-radius: 5px;
    background: #fff;
    color: #b7b7b7;
    font-size: 14px;
    display: flex;
    align-items: center;
}

.wdg-phone-say {
    display: none;
    height: 34px;
    line-height: 34px;
    text-align: center;
    border: 1px solid #dcdcdc;
    border-radius: 5px;
    background: #fff;
    color: #4a4a4a;
    font-size: 14px;
}

.wdg-phone.is-voice .wdg-phone-input-row { display: none; }

.wdg-phone.is-voice .wdg-phone-say { display: block; }

.wdg-phone-home { height: 22px; display: flex; align-items: center; justify-content: center; }

.wdg-phone-home i { display: block; width: 134px; height: 5px; border-radius: 3px; background: #1a1a1a; }

/* 手机夜间模式（只影响手机预览，与站点深色主题互不影响） */
.wdg-phone.is-night { background: #111; }

.wdg-phone.is-night .wdg-phone-bar,
.wdg-phone.is-night .wdg-phone-nav { background: #1f1f1f; color: #e6e6e6; }

.wdg-phone.is-night .wdg-phone-nav-title { color: #e6e6e6; }

.wdg-phone.is-night .wdg-net-text,
.wdg-phone.is-night .wdg-bat-text { color: #e6e6e6; }

.wdg-phone.is-night .wdg-phone-body,
.wdg-phone.is-night .wdg-chat { background: #111; }

.wdg-phone.is-night .wdg-msg-text { background: #2c2c2c; color: #e6e6e6; }

.wdg-phone.is-night .wdg-msg-text::before { background: #2c2c2c; }

.wdg-phone.is-night .wdg-msg.is-right .wdg-msg-text { background: #3eb575; color: #fff; }

.wdg-phone.is-night .wdg-msg.is-right .wdg-msg-text::before { background: #3eb575; }

.wdg-phone.is-night .wdg-msg-voice::before { background: #2c2c2c; }

.wdg-phone.is-night .wdg-msg.is-right .wdg-msg-voice::before { background: #3eb575; }

.wdg-phone.is-night .wdg-msg-time { color: #6d6d6d; }

.wdg-phone.is-night .wdg-msg-system span { background: rgba(255, 255, 255, .12); color: #cfcfcf; }

.wdg-phone.is-night .wdg-phone-input { background: #1f1f1f; }

.wdg-phone.is-night .wdg-phone-input-box { background: #2c2c2c; color: #7a7a7a; }

.wdg-phone.is-night .wdg-phone-say { background: #2c2c2c; border-color: #2c2c2c; color: #cfcfcf; }

.wdg-phone.is-night .wdg-phone-home i { background: #e6e6e6; }

/* ===================== 统计 / 下载卡片 ===================== */
.wdg-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
    gap: 10px;
}

.wdg-stat {
    padding: 11px 12px;
    border-radius: 11px;
    border: 1px solid var(--wdg-line);
    background: var(--wdg-surface-2);
}

.wdg-stat span { display: block; font-size: 11.5px; color: var(--wdg-ink-3); }

.wdg-stat b { font-size: 20px; font-weight: 700; color: var(--wdg-brand); letter-spacing: -.3px; }

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

.wdg-export-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 14px;
    border-radius: 13px;
    border: 1px solid var(--wdg-line);
    background: var(--wdg-surface-2);
    transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}

.wdg-export-card:hover {
    border-color: var(--wdg-brand-line);
    transform: translateY(-2px);
    box-shadow: var(--wdg-shadow-sm);
}

.wdg-export-icon {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 8px;
    margin-bottom: 8px;
    border-radius: 6px;
    background: var(--wdg-brand-soft);
    border: 1px solid var(--wdg-brand-line);
    color: var(--wdg-brand);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .06em;
}

.wdg-export-card b { font-size: 14px; font-weight: 700; }

.wdg-export-card p {
    margin: 4px 0 12px;
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--wdg-ink-2);
    min-height: 40px;
}

.wdg-export-card .wdg-btn { width: 100%; }

/* CSV 折叠 */
.wdg-csv {
    margin-top: 18px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid var(--wdg-line);
    background: var(--wdg-surface-2);
}

.wdg-csv summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    color: var(--wdg-ink-2);
}

.wdg-csv summary::-webkit-details-marker { display: none; }

.wdg-csv summary::before {
    content: "+";
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 1px solid var(--wdg-line);
    background: var(--wdg-surface);
    color: var(--wdg-brand);
    font-size: 13px;
    line-height: 16px;
    text-align: center;
}

.wdg-csv[open] summary::before { content: "−"; }

.wdg-csv .wdg-hint { padding-bottom: 8px; }

.wdg-csv[open] .wdg-hint { display: block; }

.wdg-pre {
    margin: 0 0 14px;
    padding: 12px 14px;
    max-height: 240px;
    overflow: auto;
    border-radius: 10px;
    background: #101a17;
    color: #cfe3da;
    font-family: ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace;
    font-size: 12px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ===================== 录制 ===================== */
.wdg-record {
    padding: 14px;
    border-radius: 13px;
    border: 1px solid var(--wdg-line);
    border-left: 3px solid var(--wdg-brand);
    background: var(--wdg-surface-2);
}

.wdg-record-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.wdg-record-status {
    margin-top: 11px;
    padding: 8px 12px;
    border-radius: 9px;
    background: var(--wdg-surface-3);
    color: var(--wdg-ink-2);
    font-size: 12.5px;
}

.wdg-record-status.is-recording {
    background: var(--wdg-brand-soft);
    color: var(--wdg-brand);
    font-weight: 600;
}

.wdg-record-status.is-recording::before {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 7px;
    border-radius: 50%;
    background: #e5484d;
    animation: wdg-pulse 1.2s ease-in-out infinite;
}

.wdg-record-out { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.wdg-record-out[hidden] { display: none; }

/* ===================== 使用说明 / FAQ ===================== */
.wdg-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: wdg-step;
}

.wdg-steps li {
    position: relative;
    padding: 14px 14px 14px 46px;
    border-radius: 12px;
    border: 1px solid var(--wdg-line);
    background: var(--wdg-surface-2);
    counter-increment: wdg-step;
}

.wdg-steps li::before {
    content: counter(wdg-step, decimal-leading-zero);
    position: absolute;
    left: 14px;
    top: 15px;
    width: 22px;
    height: 22px;
    border-radius: 7px;
    background: var(--wdg-brand-soft);
    border: 1px solid var(--wdg-brand-line);
    color: var(--wdg-brand);
    font-size: 10.5px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
}

.wdg-steps b { display: block; font-size: 14px; margin-bottom: 4px; }

.wdg-steps p { font-size: 12.5px; line-height: 1.7; color: var(--wdg-ink-2); }

.wdg-faq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 10px;
    align-items: start;
}

.wdg-faq-item {
    border: 1px solid var(--wdg-line);
    border-radius: 11px;
    background: var(--wdg-surface-2);
    overflow: hidden;
    transition: border-color .16s ease;
}

.wdg-faq-item:hover { border-color: var(--wdg-brand-line); }

.wdg-faq-item summary {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 12px 14px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}

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

.wdg-faq-item summary::before {
    content: "+";
    flex: none;
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 1px solid var(--wdg-line);
    background: var(--wdg-surface);
    color: var(--wdg-brand);
    font-size: 13px;
    line-height: 16px;
    text-align: center;
}

.wdg-faq-item[open] summary::before { content: "−"; }

.wdg-faq-a {
    padding: 0 14px 13px 41px;
    font-size: 12.5px;
    line-height: 1.75;
    color: var(--wdg-ink-2);
}

.wdg-faq-a b { color: var(--wdg-ink); }

.wdg-faq-a code { margin: 0 2px; }

/* ===================== 提示条 ===================== */
.wdg-toast {
    position: fixed;
    left: 50%;
    bottom: 34px;
    z-index: 9999;
    max-width: 86vw;
    padding: 10px 18px;
    border-radius: 999px;
    background: rgba(16, 26, 23, .94);
    color: #fff;
    font-size: 13.5px;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(14px);
    transition: opacity .22s ease, transform .22s ease;
    box-shadow: 0 12px 30px -12px rgba(0, 0, 0, .6);
    backdrop-filter: blur(8px);
}

.wdg-toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===================== 录制结果弹窗 ===================== */
.wdg-modal {
    position: fixed;
    inset: 0;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(8, 16, 13, .62);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.wdg-modal[hidden] { display: none; }

.wdg-modal-box {
    position: relative;
    width: min(430px, 100%);
    max-height: 88vh;
    overflow: auto;
    padding: 18px;
    border-radius: 18px;
    border: 1px solid var(--wdg-line);
    background: var(--wdg-surface);
    box-shadow: var(--wdg-shadow);
    animation: wdg-pop .22s ease;
}

@keyframes wdg-pop {
    from { opacity: 0; transform: translateY(10px) scale(.98); }
    to { opacity: 1; transform: none; }
}

.wdg-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.wdg-modal-title { font-size: 16px; font-weight: 700; }

.wdg-modal-close {
    width: 30px;
    height: 30px;
    flex: none;
    border: 1px solid var(--wdg-line);
    border-radius: 9px;
    background: var(--wdg-surface-2);
    color: var(--wdg-ink-2);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.wdg-modal-close:hover { background: var(--wdg-surface-3); color: var(--wdg-ink); }

.wdg-modal-video {
    display: block;
    width: 100%;
    max-height: 40vh;
    margin-bottom: 8px;
    border-radius: 10px;
    background: #101a17;
    object-fit: contain;
}

.wdg-modal-video[hidden] { display: none; }

.wdg-modal-gifbox { padding-top: 8px; border-top: 1px solid var(--wdg-line-2); }

.wdg-modal-gifbox summary { font-size: 12.5px; color: var(--wdg-ink-2); cursor: pointer; }

img.wdg-modal-video {
    width: auto;
    max-width: 100%;
    max-height: 44vh;
    margin: 10px auto 0;
    background: #f1f1f1;
}

.wdg-modal-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

/* ===================== 响应式 ===================== */
@media (max-width: 1240px) {
    .wdg-layout { grid-template-columns: minmax(0, 1fr) 388px; }
    .wdg-hero { grid-template-columns: minmax(0, 1fr) 310px; gap: 24px; }
    .wdg-page { --wdg-scale: .8; }
}

@media (max-width: 1080px) {
    .wdg-hero { grid-template-columns: minmax(0, 1fr); }
    .wdg-quick-presets {
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 8px;
    }
    .wdg-preset { padding: 9px 10px; }
    .wdg-quick-note { margin-top: 12px; }
}

@media (max-width: 720px) {
    .wdg-quick-presets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 矮屏（笔记本常见 768 / 800）把手机预览整体缩小，保证右侧预览与导出按钮不被裁掉 */
@media (min-width: 981px) and (max-height: 920px) {
    .wdg-page { --wdg-scale: .76; }
    .wdg-stage-tip { display: none; }
}

@media (min-width: 981px) and (max-height: 820px) {
    .wdg-page { --wdg-scale: .62; }
    .wdg-stage-tip { display: none; }
}

@media (min-width: 981px) and (max-height: 780px) {
    .wdg-page { --wdg-scale: .58; }
}

@media (max-width: 980px) {
    .wdg-layout { grid-template-columns: minmax(0, 1fr); }
    .wdg-stage { position: static; order: -1; }
    .wdg-page { --wdg-scale: .78; }
    .wdg-canvas { padding: 16px; border-radius: 20px; }
    .wdg-hero { padding: 26px 24px; }
}

@media (max-width: 640px) {
    .wdg-page { --wdg-scale: .66; }
    .wdg-canvas { padding: 12px; border-radius: 16px; }
    .wdg-hero { padding: 22px 18px; border-radius: 16px; }
    .wdg-page h1 { font-size: 27px; letter-spacing: -.5px; }
    .wdg-lead { font-size: 14px; }
    .wdg-panel { padding: 16px 14px 18px; }
    .wdg-metrics { gap: 10px 22px; }
    .wdg-metrics dd b { font-size: 19px; }
    .wdg-tabs { flex-wrap: wrap; }
    .wdg-tabs-hint { display: none; }
    .wdg-tab { flex: 1 1 auto; padding: 0 10px; font-size: 12.5px; }
    .wdg-stage-actions .wdg-btn { flex: 1 1 46%; }
    .wdg-faq-grid { grid-template-columns: minmax(0, 1fr); }
    .wdg-export-grid { grid-template-columns: minmax(0, 1fr); }
    .wdg-msgrow-who { width: 58px; }
    .wdg-block-head h2 { font-size: 15.5px; }
}

/* ===================== 打印单 ===================== */
.wdg-sheet { display: none; }

@media print {
    body * { visibility: hidden !important; }

    .wdg-sheet,
    .wdg-sheet * { visibility: visible !important; }

    .wdg-sheet {
        display: block;
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        padding: 0;
        color: #000;
        background: #fff;
    }
}

.wdg-sheet-inner {
    font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 12px;
    line-height: 1.7;
    color: #111;
}

.wdg-sheet-title { margin-bottom: 4px; font-size: 18px; font-weight: 700; text-align: center; }

.wdg-sheet-sub { margin-bottom: 14px; text-align: center; font-size: 12px; color: #666; }

.wdg-sheet-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 22px;
    margin-bottom: 12px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
}

.wdg-sheet-meta b { margin-left: 6px; }

.wdg-sheet-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }

.wdg-sheet-table th,
.wdg-sheet-table td {
    padding: 5px 8px;
    border: 1px solid #ccc;
    text-align: left;
    vertical-align: top;
    word-break: break-word;
}

.wdg-sheet-table th { background: #f2f2f2; }

.wdg-sheet-foot {
    margin-top: 14px;
    padding-top: 8px;
    border-top: 1px dashed #ccc;
    font-size: 11px;
    color: #666;
}

/* ===================== 时间选择器 ===================== */
.wdg-time-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

@media (max-width: 640px) {
    .wdg-time-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .wdg-user,
    .wdg-user-add { width: 84px; }
    .wdg-user-add { min-height: 92px; }
    .wdg-user-avatar { width: 42px; height: 42px; }
    .wdg-kbd-hint { display: none; }
    .wdg-msgrow-tag { display: none; }
    .wdg-msgrow-act button { width: 28px; height: 28px; font-size: 13px; }
}

.wdg-time-preview {
    margin-top: 10px;
    padding: 7px 11px;
    border-radius: 9px;
    border: 1px solid var(--wdg-brand-line);
    background: var(--wdg-brand-soft);
    color: var(--wdg-brand);
    font-size: 12.5px;
    font-weight: 600;
}
