:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --success: #059669;
    --success-light: #ecfdf5;
    --warning: #d97706;
    --warning-light: #fffbeb;
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --bg: #f0f2f5;
    --bg-card: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.06), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 25px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
    --shadow-xl: 0 20px 50px -12px rgba(0,0,0,0.15);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
    background: linear-gradient(180deg, #eef2ff 0%, #f0f2f5 30%, #f0f2f5 100%);
    color: var(--text);
    font-size: 15px;
    line-height: 1.7;
    min-height: 100vh;
}

/* ========== Logo ========== */
.logo-container {
    position: absolute;
    top: 28px;
    left: 28px;
    z-index: 100;
}

.logo-container img {
    width: 72px;
    height: 72px;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(79, 70, 229, 0.2));
    transition: transform 0.3s ease, filter 0.3s ease;
}

.logo-container img:hover {
    transform: scale(1.05);
    filter: drop-shadow(0 4px 12px rgba(79, 70, 229, 0.35));
}

/* ========== 主内容区 ========== */
.main-content {
    padding: 110px 32px 60px;
    max-width: 1020px;
    margin: 0 auto;
}

.title {
    text-align: center;
    margin-bottom: 40px;
}

.title h1 {
    font-size: 34px;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}

.title p {
    font-size: 16px;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

/* ========== 面板 ========== */
.panel {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    margin-bottom: 28px;
    border: 1px solid transparent;
    background-clip: padding-box;
    position: relative;
    transition: box-shadow 0.3s ease;
}

.panel:hover {
    box-shadow: 0 12px 30px -6px rgba(0,0,0,0.1), 0 4px 8px -4px rgba(0,0,0,0.06);
}

.panel-header {
    padding: 18px 28px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    background: linear-gradient(180deg, #fafbfd 0%, #fff 100%);
    border-radius: var(--radius) var(--radius) 0 0;
}

.panel-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 700;
    white-space: nowrap;
    color: var(--text);
}

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

.panel-body {
    padding: 24px 28px;
}

/* ========== 按钮 ========== */
.btn {
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.45);
    transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(79, 70, 229, 0.3);
}

.btn-outline {
    background: #fff;
    border: 1.5px solid var(--border);
    color: var(--text-secondary);
}

.btn-outline:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.btn-success {
    background: var(--success);
    color: white;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.25);
}

.btn-success:hover:not(:disabled) {
    opacity: 0.92;
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.35);
    transform: translateY(-1px);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12.5px;
    border-radius: 8px;
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    filter: grayscale(20%);
}

/* ========== 标签 ========== */
.tag {
    padding: 7px 16px;
    border: 1.5px solid var(--border);
    border-radius: 24px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    background: #fff;
    white-space: nowrap;
    letter-spacing: 0.2px;
}

.tag:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
    transform: translateY(-1px);
}

.tag.active {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
    box-shadow: 0 2px 10px rgba(79, 70, 229, 0.3);
}

/* ========== 找灵感链接 ========== */
.inspiration-hint {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 400;
    margin-left: 6px;
}

.find-inspiration-link {
    color: var(--primary);
    cursor: pointer;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: rgba(79, 70, 229, 0.3);
    transition: all 0.2s ease;
    padding: 4px 6px;
    margin: -4px -2px;
    display: inline-block;
    min-height: 28px;
}

.find-inspiration-link:hover {
    color: var(--primary-hover);
    text-decoration-color: var(--primary);
}

/* ========== 输入框 ========== */
.input {
    width: 100%;
    padding: 14px 18px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    transition: all 0.25s ease;
    background: #f8fafc;
    line-height: 1.6;
}

.input:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.08);
}

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

/* ========== 文章内容区 ========== */
.article-content {
    min-height: 320px;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 15px;
    line-height: 1.9;
    background: #f8fafc;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 20px 24px;
    transition: all 0.25s ease;
}

.article-content:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.08);
}

.article-content:empty::before {
    content: '文章将在这里展示...';
    color: var(--text-muted);
    font-size: 15px;
}

.article-content h2 {
    font-size: 22px;
    margin: 24px 0 14px;
    font-weight: 700;
    color: var(--text);
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-light);
}

.article-content strong {
    color: var(--primary);
    font-weight: 600;
}

.article-content blockquote {
    border-left: 4px solid var(--primary);
    padding: 8px 16px;
    margin: 16px 0;
    color: var(--text-secondary);
    font-style: italic;
    background: var(--primary-light);
    border-radius: 0 8px 8px 0;
}

.article-error {
    margin-top: 14px;
    padding: 14px 18px;
    background: var(--danger-light);
    border-radius: var(--radius-sm);
    color: var(--danger);
    font-size: 13.5px;
    border: 1px solid rgba(220, 38, 38, 0.15);
    font-weight: 500;
}

/* ========== 高亮标记 ========== */
.highlight-danger {
    background: rgba(239, 68, 68, 0.12);
    border-bottom: 2px wavy var(--danger);
    padding: 2px 5px;
    cursor: pointer;
    border-radius: 3px;
    transition: background 0.2s;
}

.highlight-danger:hover {
    background: rgba(239, 68, 68, 0.22);
}

.highlight-warning {
    background: rgba(217, 119, 6, 0.12);
    border-bottom: 2px wavy var(--warning);
    padding: 2px 5px;
    cursor: pointer;
    border-radius: 3px;
    transition: background 0.2s;
}

.highlight-warning:hover {
    background: rgba(217, 119, 6, 0.22);
}

/* ========== 风格标签行 ========== */
.style-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ========== 提炼按钮行 ========== */
.extract-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    flex-wrap: wrap;
}

/* ========== 轻修 checkbox ========== */
.light-check-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    padding: 6px 12px;
    border: 1.5px solid transparent;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.light-check-label:has(input:checked) {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.light-check-label input[type="checkbox"] {
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: var(--primary);
}

/* ========== 弹窗 ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: #fff;
    border-radius: var(--radius);
    max-width: 620px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    transform: translateY(10px);
    transition: transform 0.3s ease;
}

.modal-overlay.show .modal {
    transform: translateY(0);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(180deg, #fafbfd 0%, #fff 100%);
}

.modal-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    background: #fff;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--danger-light);
    color: var(--danger);
    border-color: var(--danger);
}

.modal-body {
    padding: 16px 20px;
    max-height: 55vh;
    overflow-y: auto;
    background: #f5f6f8;
}

.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: #fafbfd;
}

/* ========== 对话区（微信风格） ========== */
.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.chat-message {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

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

.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #07c160 0%, #06ad56 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(7, 193, 96, 0.2);
}

.chat-message.user .chat-avatar {
    background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
    box-shadow: 0 2px 8px rgba(100, 116, 139, 0.2);
}

.chat-bubble {
    max-width: 70%;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
    overflow-wrap: break-word;
    position: relative;
    background: #fff;
    color: #1e293b;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.chat-message.user .chat-bubble {
    background: linear-gradient(135deg, #95ec69 0%, #7ddb52 100%);
    color: #000;
    box-shadow: 0 2px 8px rgba(125, 219, 82, 0.25);
}

.chat-bubble::after {
    content: '';
    position: absolute;
    top: 12px;
    left: -6px;
    border: 6px solid transparent;
    border-right-color: #fff;
    border-left: 0;
}

.chat-message.user .chat-bubble::after {
    left: auto;
    right: -6px;
    border: 6px solid transparent;
    border-left-color: #95ec69;
    border-right: 0;
}

/* ========== 选项卡片（微信风格） ========== */
.inspiration-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.inspiration-card {
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
    display: flex;
    align-items: center;
    gap: 12px;
    user-select: none;
    border-radius: 8px;
    border: 1.5px solid #e5e5e5;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.inspiration-card:hover:not(.disabled) {
    background: #e7f7ee;
    border-color: #07c160;
    box-shadow: 0 2px 8px rgba(7, 193, 96, 0.1);
    transform: translateX(2px);
}

.inspiration-card:active:not(.disabled) {
    background: #d4f0e0;
    transform: translateX(0);
}

.inspiration-card.disabled {
    opacity: 0.4;
    cursor: default;
    background: #fafafa;
}

.inspiration-card .card-letter {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: linear-gradient(135deg, #07c160 0%, #06ad56 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(7, 193, 96, 0.2);
}

.inspiration-card .card-text {
    flex: 1;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
}

.inspiration-card .card-check {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #ddd;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: transparent;
    transition: all 0.25s ease;
}

.inspiration-card:hover:not(.disabled) .card-check {
    border-color: #07c160;
    color: #07c160;
    background: rgba(7, 193, 96, 0.08);
}

/* ========== 采用按钮（最终结果卡片内） ========== */
.final-adopt-btn {
    flex-shrink: 0;
    padding: 6px 16px;
    border-radius: 6px;
    border: 1.5px solid #07c160;
    background: #fff;
    color: #07c160;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: inherit;
}

.final-adopt-btn:hover {
    background: linear-gradient(135deg, #07c160 0%, #06ad56 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(7, 193, 96, 0.25);
}

/* ========== 旧结果卡片（兜底） ========== */
.inspiration-result-card {
    padding: 18px;
    background: #fff;
    border-radius: 8px;
    flex: 1;
    min-width: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.inspiration-result-card .result-content {
    font-size: 13.5px;
    line-height: 1.75;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 260px;
    overflow-y: auto;
}

/* ========== 聊天输入行 ========== */
.chat-input-row {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.chat-text-input {
    flex: 1;
    padding: 12px 16px;
    border: 1.5px solid #e5e5e5;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    outline: none;
    transition: all 0.25s ease;
}

.chat-text-input:focus {
    border-color: #07c160;
    box-shadow: 0 0 0 3px rgba(7, 193, 96, 0.08);
}

.chat-text-input::placeholder {
    color: #b0b0b0;
}

/* ========== 修改弹窗 ========== */
.edit-label {
    font-size: 12.5px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.edit-original {
    background: rgba(239, 68, 68, 0.06);
    padding: 14px 16px;
    border-radius: 8px;
    margin-bottom: 18px;
    font-size: 13.5px;
    line-height: 1.6;
    border: 1px solid rgba(239, 68, 68, 0.1);
}

.edit-error {
    margin-top: 14px;
    padding: 10px 14px;
    background: var(--danger-light);
    border-radius: var(--radius-sm);
    color: var(--danger);
    font-size: 12.5px;
    border: 1px solid rgba(220, 38, 38, 0.15);
}

/* ========== Toast 提示 ========== */
.toast {
    position: fixed;
    top: 28px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: #fff;
    padding: 14px 28px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    white-space: pre-line;
    text-align: center;
    max-width: 440px;
    box-shadow: var(--shadow-xl);
}
.toast.show { opacity: 1; }

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .main-content {
        padding: 120px 16px 40px;
    }

    .logo-container {
        top: 16px;
        left: 16px;
    }

    .logo-container img {
        width: 48px;
        height: 48px;
    }

    .title h1 {
        font-size: 24px;
    }

    .title p {
        font-size: 13px;
    }

    .title {
        margin-bottom: 28px;
    }

    .panel {
        margin-bottom: 20px;
    }

    .panel-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 14px 16px;
        gap: 8px;
    }

    .panel-header-left {
        font-size: 15px;
    }

    .panel-header-right {
        width: 100%;
    }

    .panel-body {
        padding: 16px;
    }

    /* 移动端按钮：确保触控高度 ≥ 42px */
    .btn {
        font-size: 12px;
        padding: 9px 14px;
        min-height: 42px;
    }

    .btn-sm {
        padding: 6px 10px;
        font-size: 11px;
        min-height: 36px;
    }

    /* 移动端标签：缩小尺寸，减少折行 */
    .tag {
        padding: 5px 10px;
        font-size: 11px;
        min-height: 34px;
        display: inline-flex;
        align-items: center;
    }

    /* 提炼行：移动端左对齐 + 紧凑间距 */
    .extract-row {
        justify-content: flex-start;
        gap: 6px;
        margin-top: 14px;
    }

    /* 输入框移动端 */
    .input {
        padding: 12px 14px;
        font-size: 13px;
    }

    /* 文章区移动端 */
    .article-content {
        min-height: 240px;
        padding: 14px 16px;
        font-size: 14px;
        line-height: 1.75;
    }

    .article-content h2 {
        font-size: 18px;
    }

    /* 弹窗移动端 */
    .modal-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .modal {
        max-width: 100%;
        border-radius: var(--radius) var(--radius) 0 0;
        max-height: 90vh;
    }

    .modal-header {
        padding: 14px 16px;
    }

    .modal-body {
        padding: 12px 14px;
        max-height: 50vh;
    }

    .modal-footer {
        padding: 12px 14px;
        gap: 8px;
    }

    .modal-close {
        width: 36px;
        height: 36px;
    }

    /* 聊天消息移动端 */
    .chat-bubble {
        max-width: 78%;
        font-size: 13px;
        padding: 10px 12px;
    }

    .chat-avatar {
        width: 34px;
        height: 34px;
        font-size: 17px;
    }

    /* 灵感卡片移动端 */
    .inspiration-card {
        padding: 12px;
    }

    .inspiration-card .card-letter {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }

    .inspiration-card .card-text {
        font-size: 13px;
    }

    .final-adopt-btn {
        padding: 8px 14px;
        min-height: 36px;
    }

    /* Toast 移动端 */
    .toast {
        top: 16px;
        max-width: 90vw;
        padding: 12px 20px;
        font-size: 13px;
    }
}
