/*
 * 道歉助手 - apology_helper.css
 * 主题色系（玫瑰粉暖情系）：
 *   主色1：#e91e8c  玫瑰粉（主按钮、激活态、边框高亮、加载点）
 *   主色2：#c2185b  深玫红（Hover态、渐变中间色、结果边框）
 *   主色3：#880e4f  暗酒红（渐变尾色、深色工具栏强调色）
 *   主色4：#f48fb1  浅粉（次要文字、图标装饰、禁用态降调）
 *   主色5：#fce4ec  极浅粉（面板背景底色、标签背景、历史条目填充）
 * 设计寓意：玫瑰粉象征爱与修复，温暖而不失庄重，营造真诚道歉的情感氛围
 */

/* ========== 道歉助手容器 ========== */
.ah-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 600px;
    background: #fff8f9;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

/* 全屏模式 */
.ah-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999;
    border-radius: 0;
    margin: 0;
}

/* ========== 顶部工具栏 ========== */
.ah-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: linear-gradient(135deg, #e91e8c 0%, #c2185b 50%, #880e4f 100%);
    color: white;
    flex-wrap: wrap;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(233, 30, 140, 0.35);
    flex-shrink: 0;
}

.toolbar-title {
    font-size: 14px;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.15);
    margin-right: 4px;
}

.toolbar-group {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.toolbar-btn {
    padding: 6px 10px;
    background: rgba(255,255,255,0.92);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: #c2185b;
    transition: all 0.2s;
    white-space: nowrap;
}

.toolbar-btn:hover:not(:disabled) {
    background: #fff;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}

.toolbar-btn:active:not(:disabled) {
    transform: translateY(0);
}

.toolbar-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.toolbar-btn-primary {
    background: rgba(255,255,255,0.95);
    color: #c2185b;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* ========== 主内容区 ========== */
.ah-main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ========== 左侧历史面板 ========== */
.ah-history-panel {
    width: 190px;
    background: #fff;
    border-right: 1px solid #fce4ec;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

.history-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: linear-gradient(to bottom, #fff5f7, #fce4ec);
    border-bottom: 1px solid #fce4ec;
    flex-shrink: 0;
}

.history-panel-header h3 {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: #c2185b;
}

.history-count {
    font-size: 11px;
    color: #e91e8c;
    font-weight: 400;
}

.history-clear-btn {
    background: #fce4ec;
    border: none;
    color: #c2185b;
    font-size: 11px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    transition: all 0.2s;
}

.history-clear-btn:hover {
    background: #f48fb1;
    color: #fff;
}

.history-search {
    padding: 8px;
    border-bottom: 1px solid #fce4ec;
    flex-shrink: 0;
}

.history-search input {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid #f8bbd0;
    border-radius: 4px;
    font-size: 12px;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
    background: #fff9fb;
}

.history-search input:focus {
    border-color: #e91e8c;
    box-shadow: 0 0 0 2px rgba(233,30,140,0.12);
}

.history-list {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 6px;
}

.history-empty {
    text-align: center;
    color: #ccc;
    font-size: 12px;
    padding: 20px 10px;
}

.history-item {
    display: flex;
    flex-direction: column;
    padding: 8px 10px;
    margin: 3px 0;
    background: #fff9fb;
    border: 1px solid #fce4ec;
    border-left: 3px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.history-item:hover {
    background: #fce4ec;
    border-left-color: #e91e8c;
    transform: translateX(2px);
}

.history-item.active {
    background: #fce4ec;
    border-left-color: #c2185b;
    box-shadow: 0 1px 3px rgba(194,24,91,0.15);
}

.history-item-target {
    font-weight: 600;
    font-size: 12px;
    color: #c2185b;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-item-reason {
    font-size: 11px;
    color: #888;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 2px;
}

.history-item-time {
    color: #bbb;
    font-size: 10px;
}

.history-item-del {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 16px;
    height: 16px;
    background: #fce4ec;
    border: none;
    color: #e91e8c;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s;
    padding: 0;
}

.history-item:hover .history-item-del {
    opacity: 1;
}

.history-item-del:hover {
    background: #e91e8c;
    color: #fff;
}

/* ========== 中间参数面板 ========== */
.ah-input-panel {
    width: 300px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-right: 1px solid #fce4ec;
    overflow: hidden;
}

.panel-header {
    padding: 12px 16px;
    background: linear-gradient(to bottom, #fff5f7, #fce4ec);
    border-bottom: 1px solid #fce4ec;
    flex-shrink: 0;
}

.panel-header h3 {
    margin: 0 0 2px 0;
    font-size: 13px;
    font-weight: 600;
    color: #c2185b;
}

.panel-tip {
    font-size: 11px;
    color: #ad1457;
    opacity: 0.7;
}

.ah-input-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px 14px;
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #ad1457;
    margin-bottom: 6px;
}

.label-tip {
    font-weight: 400;
    color: #aaa;
    font-size: 11px;
}

.label-required {
    color: #e91e8c;
}

/* 对象标签 */
.target-tags, .tone-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.target-tag, .tone-tag {
    padding: 4px 10px;
    background: #fff;
    border: 1px solid #f8bbd0;
    border-radius: 14px;
    font-size: 12px;
    color: #ad1457;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.target-tag:hover, .tone-tag:hover {
    background: #fce4ec;
    border-color: #e91e8c;
}

.target-tag.active, .tone-tag.active {
    background: linear-gradient(135deg, #e91e8c 0%, #c2185b 100%);
    color: #fff;
    border-color: #c2185b;
    box-shadow: 0 2px 6px rgba(233,30,140,0.3);
}

/* 压感动效 */
.target-tag-pressing, .tone-tag-pressing {
    transform: scale(0.95);
}

/* 输入框 */
.ah-input {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #f8bbd0;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
    background: #fff9fb;
    color: #333;
}

.ah-input:focus {
    border-color: #e91e8c;
    box-shadow: 0 0 0 2px rgba(233,30,140,0.12);
    background: #fff;
}

/* 多行文本框 */
.ah-textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #f8bbd0;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.6;
    font-family: inherit;
    resize: vertical;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
    background: #fff9fb;
    color: #333;
    min-height: 72px;
    max-height: 160px;
}

.ah-textarea:focus {
    border-color: #e91e8c;
    box-shadow: 0 0 0 2px rgba(233,30,140,0.12);
    background: #fff;
}

.char-count {
    text-align: right;
    font-size: 11px;
    color: #bbb;
    margin-top: 2px;
}

/* 下拉框 */
.ah-select {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #f8bbd0;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    background: #fff9fb;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
}

.ah-select:focus {
    border-color: #e91e8c;
    box-shadow: 0 0 0 2px rgba(233,30,140,0.12);
}

/* 长度选择器 */
.length-selector {
    display: flex;
    gap: 8px;
}

.length-btn {
    flex: 1;
    padding: 6px 4px;
    background: #fff;
    border: 1px solid #f8bbd0;
    border-radius: 6px;
    font-size: 12px;
    color: #ad1457;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-weight: 600;
}

.length-btn:hover {
    background: #fce4ec;
    border-color: #e91e8c;
}

.length-btn.active {
    background: linear-gradient(135deg, #e91e8c 0%, #c2185b 100%);
    color: #fff;
    border-color: #c2185b;
    box-shadow: 0 2px 6px rgba(233,30,140,0.3);
}

.length-hint {
    font-size: 10px;
    font-weight: 400;
    opacity: 0.8;
}

.length-btn.active .length-hint {
    opacity: 0.9;
}

/* 主生成按钮 */
.generate-main-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #e91e8c 0%, #c2185b 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(233,30,140,0.35);
    letter-spacing: 1px;
}

.generate-main-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #f06292 0%, #e91e8c 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(233,30,140,0.45);
}

.generate-main-btn:active:not(:disabled) {
    transform: translateY(0);
}

.generate-main-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.generate-hint {
    text-align: center;
    font-size: 11px;
    color: #ccc;
    margin: 6px 0 0;
}

/* ========== 右侧结果面板 ========== */
.ah-result-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
    overflow: hidden;
    min-width: 0;
}

.ah-result-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 24px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

/* 初始占位 */
.result-placeholder {
    text-align: center;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin: auto;   /* flex row内垂直居中 */
}

.placeholder-heart {
    font-size: 56px;
    animation: ahPlaceholderFloat 3s ease-in-out infinite;
    margin-bottom: 8px;
}

/* 占位图标上下浮动动画（规范：幅度8px、周期3s、ease-in-out无限循环） */
@keyframes ahPlaceholderFloat {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-8px); }
}

.placeholder-title {
    font-size: 16px;
    font-weight: 600;
    color: #c2185b;
    margin: 0;
}

.placeholder-desc {
    font-size: 13px;
    color: #aaa;
    margin: 0;
}

.placeholder-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 12px;
}

.apology-tag {
    background: #fce4ec;
    color: #c2185b;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
    cursor: default;
}

.apology-tag:hover {
    background: #f8bbd0;
    transform: scale(1.04);
}

/* AI三点弹跳加载指示器（规范：.ai-loading-indicator） */
.ai-loading-indicator {
    display: flex;
    gap: 7px;
    justify-content: center;
    align-items: center;
}

.ai-loading-dot {
    width: 9px;
    height: 9px;
    background: #e91e8c;
    border-radius: 50%;
    animation: ahDotBounce 1.4s ease-in-out infinite;
}

.ai-loading-dot:nth-child(2) { animation-delay: 0.2s; }
.ai-loading-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes ahDotBounce {
    0%, 80%, 100% { transform: scale(0.8) translateY(0);  opacity: 0.5; }
    40%            { transform: scale(1.2) translateY(-5px); opacity: 1;   }
}

/* 加载动画 */
.result-loading {
    text-align: center;
    padding: 60px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: 100%;
    margin-top: auto;    /* flex row内垂直居中 */
    margin-bottom: auto;
}

.loading-heart-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pulse-heart {
    font-size: 40px;
    animation: pulseHeart 1.8s ease-in-out infinite;
    display: inline-block;
}

@keyframes pulseHeart {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%       { transform: scale(1.2); opacity: 0.7; }
}

.loading-text {
    font-size: 14px;
    color: #e91e8c;
    font-weight: 500;
    /* 呼吸闪烁动画（规范：所有AI生成过程的加载文本需应用此动画） */
    animation: ahBreathText 1.8s ease-in-out infinite;
}

@keyframes ahBreathText {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

/* 道歉内容展示 */
.apology-content-wrapper {
    width: 100%;
    max-width: 560px;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: slideUp 0.4s cubic-bezier(.34,1.4,.64,1);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.apology-decoration-top,
.apology-decoration-bottom {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin: 12px 0;
}

.deco-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, #f8bbd0, transparent);
}

.deco-icon {
    font-size: 20px;
    color: #e91e8c;
}

.deco-dot {
    font-size: 14px;
    color: #f48fb1;
}

.apology-text {
    width: 100%;
    background: linear-gradient(135deg, #fff9fb 0%, #fce4ec 100%);
    border: 1px solid #f8bbd0;
    border-radius: 12px;
    padding: 24px 28px;
    font-size: 15px;
    line-height: 1.9;
    color: #333;
    white-space: pre-wrap;
    word-break: break-word;
    box-shadow: 0 4px 16px rgba(233,30,140,0.1);
    position: relative;
}

.apology-text::before {
    content: '"';
    position: absolute;
    top: 12px;
    left: 16px;
    font-size: 40px;
    color: #f8bbd0;
    font-family: Georgia, serif;
    line-height: 1;
    opacity: 0.6;
}

.apology-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
    justify-content: center;
}

.apology-action-btn {
    padding: 8px 20px;
    background: #fff;
    border: 1px solid #f8bbd0;
    border-radius: 20px;
    font-size: 13px;
    color: #c2185b;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.apology-action-btn:hover {
    background: #fce4ec;
    border-color: #e91e8c;
    transform: translateY(-1px);
}

.apology-action-regen {
    background: linear-gradient(135deg, #e91e8c 0%, #c2185b 100%);
    color: #fff;
    border-color: #c2185b;
    box-shadow: 0 2px 8px rgba(233,30,140,0.25);
}

.apology-action-regen:hover {
    background: linear-gradient(135deg, #f06292 0%, #e91e8c 100%);
    color: #fff;
    border-color: #e91e8c;
}

/* 错误块 */
.ah-error-block {
    text-align: center;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin: auto;   /* flex row内垂直居中 */
}

.error-icon {
    font-size: 40px;
}

.error-msg {
    font-size: 13px;
    color: #e57373;
    margin: 0;
    font-weight: 500;
}

.error-hint {
    font-size: 12px;
    color: #aaa;
    margin: 0;
}

.error-retry-btn {
    padding: 8px 20px;
    background: #fce4ec;
    border: 1px solid #f8bbd0;
    border-radius: 6px;
    font-size: 13px;
    color: #c2185b;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 4px;
}

.error-retry-btn:hover {
    background: #f48fb1;
    color: #fff;
}

/* 结果元信息 */
.result-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 11px;
    margin-top: 4px;
}

.result-meta-target, .result-meta-tone {
    background: #fce4ec;
    color: #c2185b;
    padding: 2px 8px;
    border-radius: 8px;
    font-weight: 500;
}

.result-time {
    color: #bbb;
}

/* ========== 示例模态框 ========== */
.ah-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 100001;
    backdrop-filter: blur(2px);
}

.ah-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100002;
    width: 90%;
    max-width: 580px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.ah-modal-content {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.18);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 80vh;
    /* 弹性缓动入场动效（规范：示例导入模态框必须使用此弹性动效） */
    animation: modalBounceIn 0.35s cubic-bezier(.34,1.4,.64,1);
}

@keyframes modalBounceIn {
    from { opacity: 0; transform: scale(0.88); }
    to   { opacity: 1; transform: scale(1); }
}

.ah-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: linear-gradient(135deg, #e91e8c 0%, #c2185b 100%);
    color: #fff;
    flex-shrink: 0;
}

.ah-modal-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.ah-modal-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.ah-modal-close:hover {
    background: rgba(255,255,255,0.4);
}

.ah-modal-body {
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* 示例卡片 */
.example-card {
    display: flex;
    flex-direction: column;
    padding: 12px 14px;
    background: #fff9fb;
    border: 1px solid #fce4ec;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.example-card:hover {
    background: #fce4ec;
    border-color: #e91e8c;
    transform: translateX(3px);
}

.example-card-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.example-card-title span:first-child {
    font-size: 13px;
    font-weight: 600;
    color: #c2185b;
}

.example-card-badge {
    font-size: 10px;
    background: #fce4ec;
    color: #e91e8c;
    padding: 2px 8px;
    border-radius: 8px;
    font-weight: 500;
}

.example-card-desc {
    font-size: 12px;
    color: #888;
    margin: 0 0 8px;
}

.example-card-import {
    align-self: flex-end;
    padding: 5px 14px;
    background: linear-gradient(135deg, #e91e8c 0%, #c2185b 100%);
    border: none;
    border-radius: 12px;
    font-size: 12px;
    color: #fff;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.example-card-import:hover {
    box-shadow: 0 2px 8px rgba(233,30,140,0.4);
    transform: translateY(-1px);
}

/* ========== 暗黑模式 (body.dark) ========== */
body.dark .ah-container {
    background: #1a0d10;
}

body.dark .ah-toolbar {
    background: linear-gradient(135deg, #6d1830 0%, #4a0e1f 50%, #2d0810 100%);
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

body.dark .toolbar-btn {
    background: rgba(255,255,255,0.12);
    color: #f48fb1;
}

body.dark .toolbar-btn:hover:not(:disabled) {
    background: rgba(255,255,255,0.22);
}

body.dark .toolbar-btn-primary {
    background: rgba(255,255,255,0.18);
    color: #f48fb1;
}

body.dark .ah-history-panel {
    background: #1f0d13;
    border-right-color: rgba(248,187,208,0.15);
}

body.dark .history-panel-header {
    background: #2a1018;
    border-bottom-color: rgba(248,187,208,0.15);
}

body.dark .history-panel-header h3 {
    color: #f48fb1;
}

body.dark .history-clear-btn {
    background: rgba(248,187,208,0.12);
    color: #f48fb1;
}

body.dark .history-clear-btn:hover {
    background: rgba(248,187,208,0.25);
}

body.dark .history-search {
    border-bottom-color: rgba(248,187,208,0.15);
}

body.dark .history-search input {
    background: #1a0d10;
    border-color: rgba(248,187,208,0.2);
    color: #f0d6de;
}

body.dark .history-search input::placeholder {
    color: #664455;
}

body.dark .history-search input:focus {
    border-color: #e91e8c;
    box-shadow: 0 0 0 2px rgba(233,30,140,0.2);
}

body.dark .history-item {
    background: #280f17;
    border-color: rgba(248,187,208,0.15);
}

body.dark .history-item:hover {
    background: #3a1522;
    border-left-color: #e91e8c;
}

body.dark .history-item.active {
    background: #3a1522;
    border-left-color: #c2185b;
}

body.dark .history-item-target {
    color: #f48fb1;
}

body.dark .history-item-reason {
    color: #886677;
}

body.dark .history-item-time {
    color: #664455;
}

body.dark .history-item-del {
    background: rgba(248,187,208,0.12);
    color: #f48fb1;
}

body.dark .history-item-del:hover {
    background: #e91e8c;
    color: #fff;
}

body.dark .history-empty {
    color: #664455;
}

body.dark .ah-input-panel {
    background: #1f0d13;
    border-right-color: rgba(248,187,208,0.15);
}

body.dark .panel-header {
    background: #2a1018;
    border-bottom-color: rgba(248,187,208,0.15);
}

body.dark .panel-header h3 {
    color: #f48fb1;
}

body.dark .panel-tip {
    color: #f48fb1;
    opacity: 0.6;
}

body.dark .ah-input-body {
    background: #1f0d13;
}

body.dark .form-group label {
    color: #f48fb1;
}

body.dark .label-tip {
    color: #664455;
}

body.dark .target-tag, body.dark .tone-tag {
    background: #280f17;
    border-color: rgba(248,187,208,0.2);
    color: #f48fb1;
}

body.dark .target-tag:hover, body.dark .tone-tag:hover {
    background: #3a1522;
    border-color: #e91e8c;
}

body.dark .target-tag.active, body.dark .tone-tag.active {
    background: linear-gradient(135deg, #6d1830 0%, #4a0e1f 100%);
    color: #f48fb1;
    border-color: #6d1830;
}

body.dark .ah-input {
    background: #280f17;
    border-color: rgba(248,187,208,0.2);
    color: #f0d6de;
}

body.dark .ah-input:focus {
    border-color: #e91e8c;
    background: #2a1018;
}

body.dark .ah-input::placeholder {
    color: #664455;
}

body.dark .ah-textarea {
    background: #280f17;
    border-color: rgba(248,187,208,0.2);
    color: #f0d6de;
}

body.dark .ah-textarea:focus {
    border-color: #e91e8c;
    background: #2a1018;
}

body.dark .ah-textarea::placeholder {
    color: #664455;
}

body.dark .char-count {
    color: #664455;
}

body.dark .ah-select {
    background: #280f17;
    border-color: rgba(248,187,208,0.2);
    color: #f0d6de;
}

body.dark .ah-select:focus {
    border-color: #e91e8c;
}

body.dark .length-btn {
    background: #280f17;
    border-color: rgba(248,187,208,0.2);
    color: #f48fb1;
}

body.dark .length-btn:hover {
    background: #3a1522;
    border-color: #e91e8c;
}

body.dark .length-btn.active {
    background: linear-gradient(135deg, #6d1830 0%, #4a0e1f 100%);
    color: #f48fb1;
    border-color: #6d1830;
}

body.dark .generate-hint {
    color: #664455;
}

body.dark .ah-result-panel {
    background: #1a0d10;
}

body.dark .ah-result-body {
    background: #1a0d10;
}

body.dark .placeholder-title {
    color: #f48fb1;
}

body.dark .placeholder-desc {
    color: #664455;
}

body.dark .apology-tag {
    background: #280f17;
    color: #f48fb1;
}

body.dark .apology-tag:hover {
    background: #3a1522;
}

body.dark .apology-text {
    background: linear-gradient(135deg, #1f0d13 0%, #280f17 100%);
    border-color: rgba(248,187,208,0.2);
    color: #f0d6de;
}

body.dark .apology-text::before {
    color: rgba(248,187,208,0.25);
}

body.dark .deco-line {
    background: linear-gradient(to right, transparent, rgba(248,187,208,0.3), transparent);
}

body.dark .deco-icon {
    color: #f48fb1;
}

body.dark .deco-dot {
    color: #664455;
}

body.dark .apology-action-btn {
    background: #280f17;
    border-color: rgba(248,187,208,0.2);
    color: #f48fb1;
}

body.dark .apology-action-btn:hover {
    background: #3a1522;
    border-color: #e91e8c;
}

body.dark .apology-action-regen {
    background: linear-gradient(135deg, #6d1830 0%, #4a0e1f 100%);
    color: #f48fb1;
    border-color: #6d1830;
}

body.dark .ah-modal-overlay {
    background: rgba(0,0,0,0.6);
}

body.dark .ah-modal-content {
    background: #1f0d13;
}

body.dark .ah-modal-header {
    background: linear-gradient(135deg, #6d1830 0%, #4a0e1f 100%);
}

body.dark .ah-modal-body {
    background: #1f0d13;
}

body.dark .example-card {
    background: #280f17;
    border-color: rgba(248,187,208,0.15);
}

body.dark .example-card:hover {
    background: #3a1522;
    border-color: #e91e8c;
}

body.dark .example-card-title span:first-child {
    color: #f48fb1;
}

body.dark .example-card-badge {
    background: rgba(248,187,208,0.12);
    color: #f48fb1;
}

body.dark .example-card-desc {
    color: #886677;
}

body.dark .result-meta-target,
body.dark .result-meta-tone {
    background: rgba(248,187,208,0.12);
    color: #f48fb1;
}

body.dark .result-time {
    color: #664455;
}

body.dark .error-msg {
    color: #f48fb1;
}

body.dark .error-hint {
    color: #664455;
}

body.dark .error-retry-btn {
    background: linear-gradient(135deg, #3a1522 0%, #280f17 100%);
    border-color: rgba(248,187,208,0.2);
    color: #f48fb1;
}

body.dark .error-retry-btn:hover {
    background: linear-gradient(135deg, #e91e8c 0%, #c2185b 100%);
    color: #fff;
    border-color: #e91e8c;
}

/* ========== 自定义滚动条（玫瑰粉主题） ========== */
.history-list::-webkit-scrollbar,
.ah-input-body::-webkit-scrollbar,
.ah-result-body::-webkit-scrollbar,
.ah-modal-body::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

.history-list::-webkit-scrollbar-track,
.ah-input-body::-webkit-scrollbar-track,
.ah-result-body::-webkit-scrollbar-track,
.ah-modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.history-list::-webkit-scrollbar-thumb,
.ah-input-body::-webkit-scrollbar-thumb,
.ah-result-body::-webkit-scrollbar-thumb,
.ah-modal-body::-webkit-scrollbar-thumb {
    background: #f8bbd0;
    border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb:hover,
.ah-input-body::-webkit-scrollbar-thumb:hover,
.ah-result-body::-webkit-scrollbar-thumb:hover,
.ah-modal-body::-webkit-scrollbar-thumb:hover {
    background: #e91e8c;
}

/* 道歉内容左侧品牌色装饰线（与历史激活条呼应） */
.apology-text::after {
    content: '';
    position: absolute;
    left: 0;
    top: 20px;
    bottom: 20px;
    width: 3px;
    background: linear-gradient(to bottom, #e91e8c, #c2185b, transparent);
    border-radius: 0 2px 2px 0;
}

/* ========== 暗黑模式补充 ========== */
body.dark .generate-main-btn {
    background: linear-gradient(135deg, #8d1b4a 0%, #6d1830 100%);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

body.dark .generate-main-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #e91e8c 0%, #c2185b 100%);
    box-shadow: 0 6px 16px rgba(233,30,140,0.45);
}

body.dark .generate-main-btn:disabled {
    opacity: 0.45;
}

body.dark .ai-loading-dot {
    background: #f48fb1;
}

body.dark .loading-text {
    color: #f48fb1;
}

body.dark .apology-action-regen:hover {
    background: linear-gradient(135deg, #e91e8c 0%, #c2185b 100%);
    color: #fff;
    border-color: #e91e8c;
}

body.dark .apology-text::after {
    background: linear-gradient(to bottom, #c2185b, transparent);
}

/* 暗黑模式滚动条 */
body.dark .history-list::-webkit-scrollbar-thumb,
body.dark .ah-input-body::-webkit-scrollbar-thumb,
body.dark .ah-result-body::-webkit-scrollbar-thumb,
body.dark .ah-modal-body::-webkit-scrollbar-thumb {
    background: rgba(248,187,208,0.2);
}

body.dark .history-list::-webkit-scrollbar-thumb:hover,
body.dark .ah-input-body::-webkit-scrollbar-thumb:hover,
body.dark .ah-result-body::-webkit-scrollbar-thumb:hover,
body.dark .ah-modal-body::-webkit-scrollbar-thumb:hover {
    background: #e91e8c;
}

/* ========== 响应式设计 ========== */
@media (max-width: 768px) {
    /* 移动端：历史面板变为顶部横向滚动条（规范） */
    .ah-main-content {
        flex-direction: column;
    }

    .ah-history-panel {
        width: 100%;
        height: auto;
        max-height: 110px;
        border-right: none;
        border-bottom: 1px solid #fce4ec;
        flex-shrink: 0;
        overflow: hidden;
    }

    .ah-history-panel .history-search {
        display: none;
    }

    .ah-history-panel .history-panel-header {
        padding: 6px 12px;
    }

    .ah-history-panel .history-list {
        display: flex !important;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 4px 8px;
        -webkit-overflow-scrolling: touch;
    }

    .ah-history-panel .history-item {
        flex-shrink: 0;
        width: 150px;
        margin: 0 4px 0 0;
    }

    .ah-input-panel {
        width: 100%;
        height: auto;
        max-height: none;
        border-right: none;
        border-bottom: 1px solid #fce4ec;
    }

    .ah-result-panel {
        flex: 1;
        min-height: 200px;
    }

    /* 移动端复制按鈕强制可见（规范） */
    .apology-action-btn {
        opacity: 1 !important;
    }

    /* 移动端历史删除按钮始终显示（触屏设备无hover） */
    .history-item-del {
        opacity: 1;
    }

    /* 移动端结果区内边距适当缩减 */
    .ah-result-body {
        padding: 16px;
    }

    /* 暗黑模式下移动端面板横向分隔线颜色修正 */
    body.dark .ah-history-panel {
        border-bottom-color: rgba(248,187,208,0.15);
    }

    body.dark .ah-input-panel {
        border-bottom-color: rgba(248,187,208,0.15);
    }
}

@media (max-width: 560px) {
    .ah-input-panel {
        max-height: 50vh;
        overflow-y: auto;
    }

    .ah-result-panel {
        min-height: 35vh;
    }
}
