/* ============================================
   AI+玄学 · 玄明子命理咨询 —— 样式表
   ============================================ */

/* ---------- CSS 变量 ---------- */
:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-sidebar: #12121f;
    --bg-input: #1e1e35;
    --bg-message-user: #2d1b69;
    --bg-message-ai: #1a1a2e;
    --bg-hover: #252545;
    --bg-card: #1e1e35;

    --text-primary: #e8e6f0;
    --text-secondary: #9b97b0;
    --text-muted: #6b6780;

    --accent: #7c5cbf;
    --accent-hover: #9370db;
    --accent-glow: rgba(124, 92, 191, 0.3);

    --border: #2a2a45;
    --border-light: #353555;

    --sidebar-width: 280px;
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.2s ease;
}

/* ---------- 全局重置 ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    height: 100dvh;           /* 动态视口高度，排除浏览器 UI */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
}

/* ---------- 滚动条美化 ---------- */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* ---------- App 容器 ---------- */
.app-container {
    display: flex;
    height: 100vh;                          /* 降级方案 */
    height: calc(var(--vh, 1vh) * 100);     /* JS 兜底方案 */
    height: 100dvh;                         /* 最优方案：动态视口高度 */
    width: 100vw;
}

/* ============================================
   登录/注册浮层
   ============================================ */
.auth-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    background-image: radial-gradient(ellipse at 50% 20%, rgba(124, 92, 191, 0.15) 0%, transparent 60%);
    /* 移动端适配：安全区内边距 */
    padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}

.auth-card {
    width: 380px;
    max-width: 90vw;
    padding: 40px 32px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
}

.auth-logo {
    font-size: 52px;
    margin-bottom: 12px;
    animation: float 3s ease-in-out infinite;
}

.auth-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
    background: linear-gradient(135deg, var(--accent), #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 28px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-form input {
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: border-color var(--transition);
    width: 100%;
}

.auth-form input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.auth-form input::placeholder {
    color: var(--text-muted);
}

/* ---------- 密码输入框容器（带眼睛图标） ---------- */
.password-wrapper {
    position: relative;
    width: 100%;
}

.password-wrapper input {
    padding-right: 44px; /* 为眼睛按钮留出空间 */
}

.password-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    border-radius: 4px;
    transition: color var(--transition);
}

.password-toggle:hover {
    color: var(--accent-hover);
}

.password-toggle .eye-icon {
    display: block;
}

.password-toggle .eye-icon[style*="display:none"],
.password-toggle .eye-icon[style*="display: none"] {
    display: none !important;
}

.auth-error {
    font-size: 13px;
    color: #ef4444;
    min-height: 18px;
    text-align: left;
}

.auth-btn {
    padding: 12px;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    margin-top: 4px;
}

.auth-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

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

.auth-switch {
    margin-top: 20px;
    font-size: 13px;
    color: var(--text-muted);
}

.auth-switch span {
    cursor: pointer;
}

.auth-switch strong {
    color: var(--accent-hover);
}

.auth-switch strong:hover {
    text-decoration: underline;
}

/* ============================================
   侧边栏
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition);
}

.sidebar-header {
    padding: 20px 16px;
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.logo-icon {
    font-size: 28px;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.new-chat-btn {
    width: 100%;
    padding: 10px 16px;
    background: transparent;
    border: 1px dashed var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition);
}

.new-chat-btn:hover {
    border-color: var(--accent);
    color: var(--accent-hover);
    background: var(--accent-glow);
}

/* ---------- 对话列表 ---------- */
.conversation-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.conv-item {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 2px;
    transition: background var(--transition);
}

.conv-item:hover {
    background: var(--bg-hover);
}

.conv-item.active {
    background: var(--bg-hover);
    border-left: 3px solid var(--accent);
}

.conv-item-title {
    flex: 1;
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conv-item.active .conv-item-title {
    color: var(--text-primary);
}

.conv-item-delete {
    opacity: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all var(--transition);
    flex-shrink: 0;
}

.conv-item:hover .conv-item-delete {
    opacity: 1;
}

.conv-item-delete:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* ---------- 侧边栏底部 ---------- */
.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

.sidebar-footer-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 8px;
}

/* 与上方 .tab-btn 同层级：默认低调，悬停再亮 */
.sidebar-footer-btn {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px 6px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 400;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.sidebar-footer-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar-footer-btn-icon {
    font-size: 15px;
    line-height: 1;
    opacity: 0.85;
}

.sidebar-user {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.user-name {
    font-size: 12px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.logout-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}

.logout-btn:hover {
    color: #ef4444;
    border-color: #ef4444;
}

/* ============================================
   打赏弹窗
   ============================================ */
.donate-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 500;
    align-items: center;
    justify-content: center;
}

.donate-modal.active {
    display: flex;
}

.donate-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.donate-modal-content {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px 28px;
    text-align: center;
    max-width: 340px;
    width: 90vw;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.donate-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    transition: color var(--transition);
    line-height: 1;
}

.donate-close:hover {
    color: var(--text-primary);
}

.donate-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.donate-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.donate-qrcode {
    width: 200px;
    height: auto;
    border-radius: 12px;
    margin-bottom: 12px;
}

.donate-hint {
    font-size: 12px;
    color: var(--text-muted);
}

/* ============================================
   主内容区
   ============================================ */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;             /* 同上，防止 flex 子项溢出 */
    position: relative;
    overflow: hidden;           /* 确保内容不溢出主容器 */
}

.menu-toggle {
    display: none;
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 50;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    padding: 8px;
    cursor: pointer;
    transition: all var(--transition);
}

.menu-toggle:hover {
    color: var(--text-primary);
    border-color: var(--accent);
}

/* ---------- 聊天区 ---------- */
.chat-area {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    min-height: 0;             /* 防止 flex 子项撑破容器 —— flex 布局关键技巧 */
}

/* ---------- 欢迎页 ---------- */
.welcome-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.welcome-icon {
    font-size: 64px;
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.welcome-screen h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--accent), #c084fc, #e879f9);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-screen p {
    color: var(--text-secondary);
    font-size: 15px;
    margin-bottom: 40px;
}

.welcome-hints {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    max-width: 560px;
    width: 100%;
}

.hint-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 14px;
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
}

.hint-card:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px var(--accent-glow);
}

.hint-icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.hint-text {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ---------- 消息容器 ---------- */
.messages-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
}

/* ---------- 消息气泡 ---------- */
.message {
    display: flex;
    gap: 12px;
    animation: fadeIn 0.3s ease;
}

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

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

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

.message.assistant .message-avatar {
    background: linear-gradient(135deg, #2d1b69, #7c5cbf);
}

.message.user .message-avatar {
    background: linear-gradient(135deg, #1e3a5f, #2563eb);
}

.message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: var(--radius);
    line-height: 1.7;
    font-size: 14px;
}

.message.assistant .message-content {
    background: var(--bg-message-ai);
    border: 1px solid var(--border);
    border-top-left-radius: 4px;
}

.message.user .message-content {
    background: var(--bg-message-user);
    border-top-right-radius: 4px;
}

/* ---------- AI 消息中的 Markdown 样式 ---------- */
.message-content h1,
.message-content h2,
.message-content h3 {
    margin: 12px 0 8px;
    color: var(--accent-hover);
}

.message-content h1 { font-size: 18px; }
.message-content h2 { font-size: 16px; }
.message-content h3 { font-size: 15px; }

.message-content p {
    margin-bottom: 8px;
}

.message-content ul,
.message-content ol {
    margin: 8px 0;
    padding-left: 20px;
}

.message-content li {
    margin-bottom: 4px;
}

.message-content strong {
    color: #c084fc;
}

.message-content code {
    background: rgba(124, 92, 191, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}

.message-content blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 12px;
    margin: 8px 0;
    color: var(--text-secondary);
}

.message-content table {
    border-collapse: collapse;
    margin: 8px 0;
    width: 100%;
}

.message-content th,
.message-content td {
    border: 1px solid var(--border);
    padding: 6px 10px;
    text-align: left;
    font-size: 13px;
}

.message-content th {
    background: var(--bg-hover);
    color: var(--accent-hover);
}

/* ---------- 打字指示器 ---------- */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* ---------- 输入区 ---------- */
.input-area {
    padding: 16px 20px 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));  /* 适配 iPhone 底部安全区 */
    border-top: 1px solid var(--border);
    background: var(--bg-primary);
    flex-shrink: 0;           /* 输入区不被压缩 */
}

.input-wrapper {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 12px;
    transition: border-color var(--transition);
}

.input-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-wrapper textarea {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 150px;
    line-height: 1.5;
    padding: 4px 0;
}

.input-wrapper textarea::placeholder {
    color: var(--text-muted);
}

.send-btn {
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    padding: 8px 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    flex-shrink: 0;
}

.send-btn:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

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

.send-btn.stop-mode {
    background: #ef4444;
    animation: pulse-stop 1.5s ease-in-out infinite;
}

.send-btn.stop-mode:hover {
    background: #dc2626;
}

@keyframes pulse-stop {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

.input-hint {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* ---------- 遮罩层 ---------- */
.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 90;
}

.overlay.active {
    display: block;
}

/* ============================================
   响应式设计
   ============================================ */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        height: calc(var(--vh, 1vh) * 100);
        height: 100dvh;
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .menu-toggle {
        display: flex;
    }

    /* 关键修复：消息容器顶部留出菜单按钮空间，防止首条消息被遮挡 */
    .messages-container {
        padding-top: 56px;
    }

    /* 欢迎页也要留出空间 */
    .welcome-screen {
        padding-top: 56px;
    }

    .welcome-hints {
        grid-template-columns: repeat(2, 1fr);
    }

    .message-content {
        max-width: 85%;
    }

    /* 移动端输入区紧凑化 */
    .input-area {
        padding: 10px 12px 12px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }

    .input-hint {
        display: none;          /* 移动端隐藏提示文字，节省空间 */
    }
}

@media (max-width: 480px) {
    .welcome-screen h1 {
        font-size: 22px;
    }

    .welcome-hints {
        grid-template-columns: 1fr;
    }

    .messages-container {
        padding: 12px;
        padding-top: 56px;     /* 保留菜单按钮空间 */
    }

    .input-area {
        padding: 8px 10px 10px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    }
}

/* ============================================
   匹配功能样式
   ============================================ */

/* 侧边栏Tab */
.sidebar-tabs {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 8px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.tab-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--accent-glow);
    color: var(--accent);
}

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

.unread-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #e74c3c;
    color: white;
    font-size: 11px;
    font-weight: bold;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Tab内容区 */
.tab-content {
    flex: 1;
    overflow-y: auto;
}

.match-history-hint,
.message-threads-list {
    padding: 20px;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.6;
}

/* ============ 匹配区域 ============ */
.match-area,
.messages-area {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    overflow-y: auto;
}

.match-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 400px;
}

.match-welcome-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.match-welcome h2 {
    font-size: 28px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.match-welcome p {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.match-entitlement-hint {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 16px !important;
    line-height: 1.5;
    max-width: 320px;
}

.match-entitlement-hint.match-ent-unlocked {
    color: #7dcea0;
}

.btn-start-match {
    padding: 14px 40px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-start-match:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--accent-glow);
}

.match-welcome-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 280px;
}

.btn-match-intro-edit {
    padding: 10px 24px;
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-match-intro-edit:hover {
    background: var(--accent);
    color: white;
}

.match-intro-modal .modal-subtitle {
    margin-bottom: 20px;
}

.profile-modal .profile-modal-edit-hint {
    margin-top: -8px;
    margin-bottom: 16px;
    text-align: left;
    max-width: 100%;
}

/* 匹配卡片 */
.match-card-container {
    width: 100%;
    max-width: 520px;
    padding: 20px;
}

.match-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    position: relative;
    animation: slideIn 0.3s ease;
}

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

.match-score-ring {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: conic-gradient(
        var(--accent) calc(var(--score) * 1%), 
        var(--bg-input) 0
    );
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
}

.score-inner {
    width: 100%;
    height: 100%;
    background: var(--bg-card);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    color: var(--accent);
}

.match-type-badge {
    display: inline-block;
    padding: 6px 14px;
    background: var(--accent-glow);
    color: var(--accent);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 20px;
}

.match-avatar {
    width: 80px;
    height: 80px;
    margin: 0 auto 16px;
}

.avatar-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: bold;
    color: white;
}

.match-username {
    text-align: center;
    font-size: 24px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.match-bio {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.5;
}

.match-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.info-item {
    background: var(--bg-input);
    padding: 12px;
    border-radius: var(--radius-sm);
    text-align: center;
}

.info-label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.info-value {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.match-description {
    background: var(--bg-input);
    padding: 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    border-left: 3px solid var(--accent);
}

.match-description p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

.match-reasons {
    margin-bottom: 20px;
}

.match-reasons h4 {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.match-reasons ul {
    list-style: none;
    padding: 0;
}

.match-reasons li {
    padding: 8px 12px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 14px;
}

.match-reasons li::before {
    content: '✓';
    color: var(--accent);
    font-weight: bold;
    margin-right: 8px;
}

.match-breakdown {
    margin-bottom: 24px;
}

.breakdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.breakdown-label {
    font-size: 13px;
    color: var(--text-secondary);
    min-width: 70px;
}

.breakdown-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
}

.breakdown-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    border-radius: 4px;
    transition: width 0.5s ease;
}

.breakdown-value {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 600;
    min-width: 45px;
    text-align: right;
}

.match-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.btn-skip,
.btn-message {
    flex: 1;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
}

.btn-skip {
    background: var(--bg-input);
    color: var(--text-secondary);
}

.btn-skip:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-message {
    background: var(--accent);
    color: white;
}

.btn-message:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-report {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--accent);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-report:hover {
    background: var(--accent-glow);
    border-color: var(--accent);
}

.contact-info-box {
    margin-top: 20px;
    padding: 16px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border: 1px dashed var(--accent);
    text-align: center;
}

.contact-info-box p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

.contact-info-box strong {
    color: var(--accent);
    font-size: 16px;
}

.contact-hint {
    font-size: 12px !important;
    margin-top: 4px !important;
}

.no-more-matches {
    text-align: center;
    padding: 60px 20px;
}

.no-more-matches .empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.no-more-matches h3 {
    font-size: 20px;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.no-more-matches p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.no-more-matches .btn-primary {
    padding: 12px 32px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 15px;
}

/* ============ 资料完善弹窗 ============ */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    background: var(--bg-input);
    border: none;
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ============ 站点公告弹窗 ============ */
.site-announce-overlay {
    z-index: 2100;
}

.announce-modal-container {
    width: min(520px, 94vw);
    max-height: min(85vh, 720px);
    padding: 0;
    display: flex;
    flex-direction: column;
}

.announce-modal-container .modal-close {
    top: 12px;
    right: 12px;
    z-index: 2;
}

.announce-modal-body {
    padding: 44px 28px 20px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    text-align: left;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.65;
}

.announce-modal-body .modal-title {
    text-align: left;
    margin-bottom: 12px;
    font-size: 1.35rem;
}

.announce-lead {
    font-size: 15px;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.announce-modal-body p {
    margin-bottom: 12px;
}

.announce-section-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 20px 0 10px;
}

.announce-section-title.warn {
    color: #f59e0b;
}

.announce-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin: 14px 0 6px;
}

.announce-list {
    margin: 0 0 8px 1rem;
    padding: 0;
    list-style: disc;
}

.announce-list li {
    margin-bottom: 6px;
}

.announce-footer {
    margin-top: 20px !important;
    color: var(--text-primary);
    font-weight: 500;
}

.announce-signoff {
    margin-bottom: 0 !important;
    color: var(--text-muted);
    font-size: 13px;
}

.announce-modal-actions {
    flex-shrink: 0;
    padding: 12px 28px 24px;
    border-top: 1px solid var(--border);
}

.announce-dismiss-btn {
    width: 100%;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent), #c084fc);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity var(--transition), transform 0.15s ease;
}

.announce-dismiss-btn:hover {
    opacity: 0.92;
}

.announce-dismiss-btn:active {
    transform: scale(0.98);
}

.profile-modal {
    width: 500px;
    padding: 40px;
}

.modal-title {
    font-size: 24px;
    color: var(--text-primary);
    margin-bottom: 8px;
    text-align: center;
}

.modal-subtitle {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 32px;
}

.profile-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-label {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.date-selectors {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 2fr;
    gap: 8px;
}

.date-selectors select,
.profile-form select,
.profile-form input,
.profile-form textarea {
    padding: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    transition: var(--transition);
}

.profile-form select:focus,
.profile-form input:focus,
.profile-form textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.profile-form textarea {
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
}

.form-link {
    font-size: 13px;
    color: var(--accent);
    text-decoration: none;
    transition: var(--transition);
}

.form-link:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* MBTI网格 */
.mbti-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.mbti-btn {
    padding: 12px 8px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.mbti-btn strong {
    font-size: 13px;
}

.mbti-btn span {
    font-size: 11px;
    color: var(--text-muted);
}

.mbti-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.mbti-btn.selected {
    background: var(--accent-glow);
    border-color: var(--accent);
    color: var(--accent);
}

.form-error {
    padding: 12px;
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.3);
    border-radius: var(--radius-sm);
    color: #e74c3c;
    font-size: 14px;
    text-align: center;
    display: none;
}

.form-error:not(:empty) {
    display: block;
}

.form-submit-btn {
    padding: 14px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.form-submit-btn:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 12px var(--accent-glow);
}

/* ============ 留言弹窗 ============ */
.message-modal {
    width: 600px;
    height: 600px;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.message-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.message-target-info h3 {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.message-target-info p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

.message-history-box {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message-item {
    display: flex;
}

.message-mine {
    justify-content: flex-end;
}

.message-theirs {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
    position: relative;
}

.message-mine .message-bubble {
    background: var(--accent);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-theirs .message-bubble {
    background: var(--bg-input);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.message-bubble p {
    margin: 0 0 6px 0;
    line-height: 1.5;
    word-wrap: break-word;
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
}

.message-input-box {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.message-input-box textarea {
    flex: 1;
    padding: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    resize: none;
    min-height: 50px;
    font-family: inherit;
}

.message-input-box textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.send-message-btn {
    padding: 12px 24px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.send-message-btn:hover {
    background: var(--accent-hover);
}

.empty-messages,
.loading-spinner-small {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
}

/* ============ 消息线程列表 ============ */
.thread-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.thread-item:hover {
    background: var(--bg-hover);
}

.thread-item.has-unread {
    background: rgba(124, 92, 191, 0.05);
}

.thread-avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    color: white;
    flex-shrink: 0;
}

.thread-info {
    flex: 1;
    min-width: 0;
}

.thread-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
}

.thread-header h4 {
    font-size: 15px;
    color: var(--text-primary);
    margin: 0;
}

.thread-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.thread-preview {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.unread-dot {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: #e74c3c;
    color: white;
    font-size: 11px;
    font-weight: bold;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============ 消息详情页 ============ */
.message-detail-view {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.no-thread-selected {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.no-thread-selected .empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.message-detail-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.message-detail-header h3 {
    font-size: 18px;
    color: var(--text-primary);
    margin: 0;
}

.message-detail-history {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.msg-item {
    display: flex;
}

.msg-mine {
    justify-content: flex-end;
}

.msg-theirs {
    justify-content: flex-start;
}

.msg-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
}

.msg-mine .msg-bubble {
    background: var(--accent);
    color: white;
    border-bottom-right-radius: 4px;
}

.msg-theirs .msg-bubble {
    background: var(--bg-input);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.msg-bubble p {
    margin: 0 0 6px 0;
    line-height: 1.5;
}

.msg-time {
    font-size: 11px;
    opacity: 0.7;
}

.message-detail-input {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.message-detail-input textarea {
    flex: 1;
    padding: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    resize: none;
    min-height: 50px;
    font-family: inherit;
}

.message-detail-input button {
    padding: 12px 24px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.message-detail-input button:hover {
    background: var(--accent-hover);
}

/* ============ AI报告弹窗 ============ */
.report-modal {
    width: 700px;
    max-height: 80vh;
    padding: 24px;
    position: relative;
}

.report-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.report-modal .modal-close {
    position: static;
    margin-right: auto;
}

.btn-copy-report {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-copy-report:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-copy-report svg {
    flex-shrink: 0;
}

.report-content {
    line-height: 1.8;
    overflow-y: auto;
    max-height: calc(80vh - 120px);
    padding: 0 16px;
}

.report-content h2 {
    color: var(--text-primary);
    font-size: 24px;
    margin-bottom: 24px;
    text-align: center;
}

.report-content h3 {
    color: var(--accent);
    font-size: 18px;
    margin: 32px 0 16px 0;
}

.report-content p {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.report-content ul {
    color: var(--text-secondary);
    padding-left: 24px;
}

.loading-spinner,
.loading-spinner-small {
    text-align: center;
    color: var(--text-muted);
    padding: 40px;
}

.loading-spinner-small {
    padding: 20px;
}

.error-message {
    text-align: center;
    color: #e74c3c;
    padding: 40px 20px;
}

/* ============ 响应式适配 ============ */
@media (max-width: 768px) {
    .profile-modal,
    .message-modal,
    .report-modal {
        width: 95vw;
        max-height: 85vh;
        padding: 24px;
    }
    
    .mbti-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }
    
    .mbti-btn {
        padding: 10px 4px;
    }
    
    .mbti-btn strong {
        font-size: 11px;
    }
    
    .mbti-btn span {
        font-size: 10px;
    }
    
    .match-card {
        padding: 24px 20px;
    }
    
    .match-info-grid {
        grid-template-columns: 1fr;
    }
    
    .date-selectors {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
}
