/* =========================================================================
 * StarSail AI 对话（chat）页面
 * 主题：深空星海 + 玻璃拟态 + 黄金锚 + 星际蓝
 * 与 starsea.html / my.html 共用同一套设计 token，确保跨页面视觉一致
 * ========================================================================= */


/* HTML5 [hidden] 默认 display:none 经常被 class 上的 display:flex/grid 覆盖，
   这里用 !important 兜底，避免 .modal-mask/.loading/.empty/.pill-menu 等
   元素在初始化时就"漏出来"变成全屏遮罩 */

[hidden] {
    display: none !important;
}

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

:root {
    /* 基础色板（与 starsea / my 保持一致） */
    --bg-deep: #06091a;
    --bg-mid: #0d1330;
    --bg-near: #162041;
    --ink-100: #f4f6ff;
    --ink-200: #c8cee8;
    --ink-300: #8a93b8;
    --ink-400: #5a628a;
    --ink-500: #3a4270;
    --line-soft: rgba(255, 255, 255, 0.08);
    --line-mid: rgba(255, 255, 255, 0.14);
    /* 品牌色 */
    --star-cyan: #6cc9ff;
    --star-cyan-soft: rgba(108, 201, 255, 0.18);
    --star-cyan-glow: rgba(108, 201, 255, 0.45);
    --anchor-gold: #f0c674;
    --anchor-gold-soft: rgba(240, 198, 116, 0.18);
    --anchor-gold-glow: rgba(240, 198, 116, 0.55);
    --danger: #ff6f7d;
    --success: #6ee7b7;
    --warning: #ffb86b;
    /* 尺寸 */
    --nav-height: 64px;
    --container-width: 1080px;
    --radius-lg: 22px;
    --radius-md: 14px;
    --radius-sm: 10px;
    --shadow-glow: 0 30px 80px -20px rgba(108, 201, 255, 0.25), 0 12px 40px -10px rgba(0, 0, 0, 0.5);
}

html,
body {
    height: 100%;
    width: 100%;
}

body {
    font-family: 'Outfit', 'PingFang SC', 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-deep);
    color: var(--ink-100);
    min-height: 100vh;
    position: relative;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    line-height: 1.5;
}


/* =========================================================================
 * 背景：星海 + 极光（与 starsea / my 页面一致）
 * ========================================================================= */

.cosmic-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    background: radial-gradient(ellipse at 18% 22%, rgba(85, 130, 255, 0.20) 0%, transparent 45%), radial-gradient(ellipse at 82% 78%, rgba(220, 130, 255, 0.16) 0%, transparent 50%), radial-gradient(ellipse at 50% 50%, rgba(40, 60, 120, 0.45) 0%, transparent 65%), linear-gradient(180deg, #06091a 0%, #0a0f2a 45%, #06091a 100%);
}

.cosmic-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 80px 80px;
    mask-image: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.6) 0%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.6) 0%, transparent 70%);
}

.starfield {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.star {
    position: absolute;
    background: #fff;
    border-radius: 50%;
    animation: twinkle var(--dur, 4s) ease-in-out infinite;
    animation-delay: var(--delay, 0s);
    opacity: 0;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
}

@keyframes twinkle {
    0%,
    100% {
        opacity: 0.15;
        transform: scale(0.7);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
}

.shooting-star {
    position: absolute;
    width: 120px;
    height: 1px;
    background: linear-gradient(90deg, transparent, #fff, transparent);
    opacity: 0;
    transform: rotate(-25deg);
    animation: shoot 7s linear infinite;
    animation-delay: var(--shoot-delay, 0s);
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.8));
}

@keyframes shoot {
    0% {
        opacity: 0;
        transform: translate(-10vw, -10vh) rotate(-25deg);
    }
    3% {
        opacity: 1;
    }
    20% {
        opacity: 0;
        transform: translate(110vw, 60vh) rotate(-25deg);
    }
    100% {
        opacity: 0;
        transform: translate(110vw, 60vh) rotate(-25deg);
    }
}

.aurora {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.45;
    pointer-events: none;
}

.aurora-1 {
    width: 480px;
    height: 480px;
    top: -120px;
    right: -120px;
    background: radial-gradient(circle, rgba(108, 201, 255, 0.45), transparent 70%);
    animation: aurora-float 14s ease-in-out infinite;
}

.aurora-2 {
    width: 520px;
    height: 520px;
    bottom: -180px;
    left: -180px;
    background: radial-gradient(circle, rgba(240, 198, 116, 0.35), transparent 70%);
    animation: aurora-float 18s ease-in-out infinite reverse;
}

@keyframes aurora-float {
    0%,
    100% {
        transform: translate(0, 0);
    }
    50% {
        transform: translate(40px, -30px);
    }
}


/* =========================================================================
 * 主舞台（与 starsea / my 一致）
 * ========================================================================= */

.stage {
    position: relative;
    z-index: 1;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 24px 24px 32px;
    /* 关键：减去 navbar 高度，避免 chat-container 超过视口导致输入框被遮挡 */
    min-height: calc(100vh - var(--nav-height));
    display: flex;
    flex-direction: column;
}


/* =========================================================================
 * Chat 容器：玻璃拟态卡片
 * ========================================================================= */

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: linear-gradient(180deg, rgba(14, 20, 50, 0.78) 0%, rgba(10, 15, 42, 0.78) 100%);
    border: 1px solid var(--line-mid);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-glow);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    overflow: hidden;
    position: relative;
}


/* =========================================================================
 * 状态条 / 应用信息条
 * ========================================================================= */

.chat-status-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--line-soft);
    font-size: 12px;
    color: var(--ink-300);
    flex-shrink: 0;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
    animation: pulse 2s infinite;
    display: inline-block;
}

.status-dot.disconnected {
    background: var(--danger);
    box-shadow: 0 0 8px var(--danger);
    animation: none;
}

@keyframes pulse {
    0%,
    100% {
        opacity: 0.7;
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

.app-info-bar {
    padding: 10px 20px;
    background: rgba(108, 201, 255, 0.06);
    border-bottom: 1px solid var(--line-soft);
    display: none;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    flex-shrink: 0;
}

.app-info-bar.visible {
    display: flex;
}

.app-info-bar .app-label {
    color: var(--star-cyan);
    font-weight: 500;
    margin-right: 6px;
}

.app-info-bar .app-id {
    color: var(--ink-300);
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
}

.app-info-bar .new-app-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line-mid);
    color: var(--ink-200);
    padding: 5px 12px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
    font-family: inherit;
}

.app-info-bar .new-app-btn:hover {
    border-color: var(--star-cyan);
    color: var(--star-cyan);
    background: var(--star-cyan-soft);
}


/* =========================================================================
 * 消息流
 * ========================================================================= */

.chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--line-mid);
    border-radius: 3px;
}

.message {
    display: flex;
    gap: 12px;
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message.ai {
    align-self: flex-start;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: linear-gradient(135deg, var(--anchor-gold) 0%, #d4a04a 100%);
    color: #1a1500;
    box-shadow: 0 0 12px rgba(240, 198, 116, 0.4);
}

.message.ai .message-avatar {
    background: linear-gradient(135deg, var(--star-cyan) 0%, #4a8fff 100%);
    color: var(--bg-deep);
    box-shadow: 0 0 12px var(--star-cyan-glow);
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
}

.message.user .message-bubble {
    background: linear-gradient(135deg, var(--star-cyan-soft) 0%, rgba(108, 201, 255, 0.08) 100%);
    color: var(--ink-100);
    border: 1px solid var(--star-cyan-soft);
    border-bottom-right-radius: 4px;
}

.message.ai .message-bubble {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line-soft);
    color: var(--ink-100);
    border-bottom-left-radius: 4px;
}

.message.system {
    align-self: center;
    max-width: 100%;
}

.message.system .message-bubble {
    background: transparent;
    border: none;
    text-align: center;
    color: var(--ink-300);
    font-size: 13px;
    padding: 8px 16px;
}

.message.system .message-bubble.error {
    color: var(--danger);
}

.message.system .message-bubble.success {
    color: var(--success);
}

.streaming-text {
    display: inline;
}

.streaming-cursor::after {
    content: "▊";
    animation: blink 1s step-end infinite;
    color: var(--star-cyan);
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

.status-step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 14px;
    color: var(--ink-300);
}

.status-step .spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--line-mid);
    border-top-color: var(--star-cyan);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

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

.status-step.done {
    color: var(--success);
}

.status-step.done .spinner {
    border-color: var(--success);
    animation: none;
    position: relative;
}

.status-step.done .spinner::after {
    content: "✓";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--success);
    font-size: 10px;
}


/* =========================================================================
 * 输入区：底部玻璃条
 * ========================================================================= */

.chat-input-area {
    flex-shrink: 0;
    padding: 14px 20px 16px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, rgba(255, 255, 255, 0.05) 100%);
    border-top: 1px solid var(--line-soft);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line-mid);
    border-radius: 22px;
    padding: 4px 4px 4px 16px;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    min-height: 48px;
}

.input-wrapper:focus-within {
    border-color: var(--star-cyan);
    box-shadow: 0 0 0 3px var(--star-cyan-soft);
    background: rgba(255, 255, 255, 0.06);
}

.chat-input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    padding: 4px 0;
    color: var(--ink-100);
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    outline: none;
    min-height: 40px;
    max-height: 160px;
    transition: none;
    font-family: inherit;
    box-sizing: border-box;
}

.chat-input::placeholder {
    color: var(--ink-400);
}

.send-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, var(--star-cyan) 0%, #4a8fff 100%);
    color: var(--bg-deep);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.1s, box-shadow 0.2s, opacity 0.2s;
    box-shadow: 0 4px 14px rgba(108, 201, 255, 0.35);
}

.send-btn svg {
    width: 18px;
    height: 18px;
}

.send-btn:hover {
    box-shadow: 0 6px 20px rgba(108, 201, 255, 0.5);
    transform: translateY(-1px);
}

.send-btn:active {
    transform: scale(0.95);
}

.send-btn:disabled {
    background: rgba(255, 255, 255, 0.08);
    color: var(--ink-400);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.send-btn:disabled:active {
    transform: none;
}

.input-hint {
    font-size: 11px;
    color: var(--ink-400);
    text-align: center;
    letter-spacing: 0.02em;
}


/* =========================================================================
 * 设备选择器（生成应用前必选的目标设备）
 * ========================================================================= */

.device-picker {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.device-picker label {
    font-size: 12px;
    color: var(--ink-300);
    font-weight: 500;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}


/* 跟随当前主题，避免 Windows / Chrome / Edge
   默认把 <select> 渲染成白底、控件样式突兀的问题 */

.device-select {
    flex: 0 0 auto;
    min-width: 200px;
    max-width: 280px;
    padding: 6px 28px 6px 12px;
    background-color: rgba(15, 21, 50, 0.85);
    color: var(--ink-100);
    border: 1px solid var(--line-mid);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    color-scheme: dark;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%238a93b8' d='M5 6L0 0h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 9px;
}


/* 展开后的下拉项：不少浏览器仍按系统主题渲染 option，
   显式指定深色背景 + 浅色文字，避免白底白字。 */

.device-select option {
    background-color: #0d1330;
    color: var(--ink-100);
}

.device-select option[value=""] {
    color: var(--ink-400);
}

.device-select:hover:not(:disabled) {
    border-color: var(--star-cyan);
    background-color: rgba(15, 21, 50, 1);
}

.device-select:focus {
    border-color: var(--star-cyan);
    box-shadow: 0 0 0 3px var(--star-cyan-soft);
    background-color: rgba(15, 21, 50, 1);
}

.device-select:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.device-picker-hint {
    font-size: 12px;
    color: var(--ink-400);
    flex: 1;
    min-width: 0;
}

@keyframes device-select-shake {
    0%,
    100% {
        transform: translateX(0);
    }
    20% {
        transform: translateX(-4px);
    }
    40% {
        transform: translateX(4px);
    }
    60% {
        transform: translateX(-3px);
    }
    80% {
        transform: translateX(2px);
    }
}

.device-select-shake {
    animation: device-select-shake 0.5s ease-in-out;
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 3px rgba(255, 111, 125, 0.16) !important;
}


/* =========================================================================
 * 消息内操作按钮（与 starsea / my 卡片风格一致）
 * ========================================================================= */

.message-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed var(--line-soft);
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--line-mid);
    background: rgba(255, 255, 255, 0.04);
    color: var(--ink-100);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.1s;
}

.action-btn:hover {
    border-color: var(--star-cyan);
    background: var(--star-cyan-soft);
}

.action-btn:active {
    transform: scale(0.97);
}

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

.action-btn.primary {
    background: linear-gradient(135deg, var(--anchor-gold) 0%, #d4a04a 100%);
    color: #1a1500;
    border-color: transparent;
    font-weight: 600;
}

.action-btn.primary:hover {
    filter: brightness(1.05);
    background: linear-gradient(135deg, var(--anchor-gold) 0%, #d4a04a 100%);
}

.action-btn .badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.2);
    font-size: 11px;
    font-weight: 500;
}


/* =========================================================================
 * 模态弹窗（与 starsea / my 一致）
 * ========================================================================= */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(3, 5, 14, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: backdropIn 0.18s ease;
}

.modal-backdrop.show {
    display: flex;
}

@keyframes backdropIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal {
    width: 100%;
    max-width: 460px;
    background: linear-gradient(180deg, #0e1432 0%, #0a0f2a 100%);
    border: 1px solid var(--line-mid);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-glow);
    padding: 22px 22px 18px;
    color: var(--ink-100);
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--ink-100);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-subtitle {
    font-size: 12px;
    color: var(--ink-300);
    margin-bottom: 18px;
    line-height: 1.6;
}

.field {
    margin-bottom: 14px;
}

.field label {
    display: block;
    font-size: 12px;
    color: var(--ink-300);
    margin-bottom: 6px;
}

.field label .required {
    color: var(--danger);
    margin-left: 2px;
}

.field input[type="text"],
.field select,
.field textarea {
    width: 100%;
    background: rgba(15, 21, 50, 0.6);
    border: 1px solid var(--line-mid);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    color: var(--ink-100);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.field input[type="text"]:focus,
.field select:focus,
.field textarea:focus {
    border-color: var(--star-cyan);
    box-shadow: 0 0 0 3px var(--star-cyan-soft);
}

.field textarea {
    min-height: 64px;
    resize: vertical;
}

.field .hint {
    font-size: 11px;
    color: var(--ink-400);
    margin-top: 4px;
}

.field .error {
    font-size: 11px;
    color: var(--danger);
    margin-top: 4px;
    min-height: 14px;
}

.checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    color: var(--ink-100);
    cursor: pointer;
    padding: 6px 0;
}

.checkbox-row input[type="checkbox"] {
    margin-top: 3px;
    accent-color: var(--star-cyan);
}

.checkbox-row .checkbox-desc {
    font-size: 12px;
    color: var(--ink-300);
    margin-top: 2px;
    line-height: 1.5;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 14px;
    border-top: 1px solid var(--line-soft);
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--line-mid);
    color: var(--ink-300);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.btn-ghost:hover {
    border-color: var(--ink-200);
    color: var(--ink-100);
    background: rgba(255, 255, 255, 0.04);
}

.btn-primary {
    background: linear-gradient(135deg, var(--star-cyan) 0%, #4a8fff 100%);
    border: 1px solid transparent;
    color: var(--bg-deep);
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.2s, opacity 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 14px rgba(108, 201, 255, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(108, 201, 255, 0.5);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: scale(0.97);
}

.btn-primary:disabled {
    background: rgba(255, 255, 255, 0.08);
    color: var(--ink-400);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.modal-info {
    font-size: 12px;
    color: var(--ink-300);
    background: var(--star-cyan-soft);
    border: 1px solid var(--star-cyan-soft);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    margin-top: 10px;
    line-height: 1.5;
}


/* =========================================================================
 * 发布弹窗 - 可见性选择
 * ========================================================================= */

.visibility-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

.visibility-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--line-light);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.visibility-option:hover {
    border-color: var(--star-cyan);
    background: rgba(255, 255, 255, 0.04);
}

.visibility-option input[type="radio"] {
    margin: 0;
    cursor: pointer;
    accent-color: var(--star-cyan);
}

.visibility-option:has(input[type="radio"]:checked) {
    border-color: var(--star-cyan);
    background: var(--star-cyan-soft);
}

.visibility-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--ink-100);
}

.visibility-hint {
    font-size: 12px;
    color: var(--ink-300);
    margin-left: auto;
}


/* =========================================================================
 * Toast 提示
 * ========================================================================= */

.toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    z-index: 2000;
    background: rgba(15, 21, 50, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--line-mid);
    color: var(--ink-100);
    padding: 10px 20px;
    border-radius: 999px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: 90vw;
    text-align: center;
}

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

.toast-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--star-cyan);
    flex-shrink: 0;
}

.toast.error {
    border-color: var(--danger);
}

.toast.error .toast-dot {
    background: var(--danger);
}

.toast.success {
    border-color: var(--success);
}

.toast.success .toast-dot {
    background: var(--success);
}


/* =========================================================================
 * 响应式
 * ========================================================================= */

@media (max-width: 900px) {
    .stage {
        padding: 16px 14px 24px;
        min-height: calc(100vh - var(--nav-height));
    }
    .chat-messages {
        padding: 18px 14px;
    }
    .chat-input-area {
        padding: 12px 14px 14px;
    }
    .message {
        max-width: 92%;
    }
}

@media (max-width: 600px) {
    .chat-messages {
        padding: 16px 12px;
        gap: 12px;
    }
    .message-bubble {
        font-size: 13px;
        padding: 10px 14px;
    }
    .chat-input-area {
        padding: 10px 12px 12px;
    }
    .device-select {
        min-width: 160px;
        max-width: 100%;
    }
    .input-wrapper {
        padding: 6px 6px 6px 14px;
    }
    .send-btn {
        width: 36px;
        height: 36px;
    }
    .send-btn svg {
        width: 16px;
        height: 16px;
    }
    .modal {
        padding: 18px 16px 14px;
    }
    .modal-title {
        font-size: 15px;
    }
    .action-btn {
        font-size: 12px;
        padding: 5px 12px;
    }
}