/* =====================================================
   AI诗歌生成 - 样式表  (前缀: apt-)
   ===================================================== */

/* ---- CSS 变量 ---- */
:root {
    --apt-primary:        #7c3aed;
    --apt-primary-hover:  #6d28d9;
    --apt-primary-light:  #f5f3ff;
    --apt-success:        #059669;
    --apt-warning:        #d97706;
    --apt-danger:         #dc2626;
    --apt-bg:             #f8f5ff;
    --apt-surface:        #ffffff;
    --apt-border:         #e5dff7;
    --apt-text:           #1e1333;
    --apt-text-muted:     #6b5c8e;
    --apt-text-light:     #a99bc0;
    --apt-shadow-sm:      0 1px 4px rgba(124,58,237,.10);
    --apt-shadow-md:      0 4px 14px rgba(124,58,237,.13);
    --apt-shadow-lg:      0 8px 28px rgba(124,58,237,.16);
    --apt-radius:         12px;
    --apt-radius-sm:      7px;
    --apt-toolbar-h:      50px;
    --apt-transition:     0.2s ease;

    /* 诗歌主题配色 */
    --pc-sunrise-bg:      linear-gradient(135deg, #fff7ed, #fef3c7);
    --pc-sunrise-border:  #f97316;
    --pc-sunrise-header:  linear-gradient(135deg, #fb923c, #f59e0b);
    --pc-dusk-bg:         linear-gradient(135deg, #fdf4ff, #fae8ff);
    --pc-dusk-border:     #a855f7;
    --pc-dusk-header:     linear-gradient(135deg, #a855f7, #7c3aed);
    --pc-midnight-bg:     linear-gradient(135deg, #eff6ff, #eef2ff);
    --pc-midnight-border: #3b82f6;
    --pc-midnight-header: linear-gradient(135deg, #3b82f6, #6366f1);
    --pc-forest-bg:       linear-gradient(135deg, #f0fdf4, #ecfdf5);
    --pc-forest-border:   #22c55e;
    --pc-forest-header:   linear-gradient(135deg, #22c55e, #10b981);
    --pc-ocean-bg:        linear-gradient(135deg, #ecfeff, #cffafe);
    --pc-ocean-border:    #06b6d4;
    --pc-ocean-header:    linear-gradient(135deg, #06b6d4, #0ea5e9);
    --pc-cherry-bg:       linear-gradient(135deg, #fff1f2, #fce7f3);
    --pc-cherry-border:   #f43f5e;
    --pc-cherry-header:   linear-gradient(135deg, #f43f5e, #ec4899);
}

/* 暗色主题 */
.apt-dark {
    --apt-primary:       #a78bfa;
    --apt-primary-hover: #c4b5fd;
    --apt-primary-light: #1e1333;
    --apt-bg:            #130d22;
    --apt-surface:       #1e1333;
    --apt-border:        #3a2c5c;
    --apt-text:          #f0ebff;
    --apt-text-muted:    #c4aef0;
    --apt-text-light:    #7b6aa0;
    --apt-shadow-sm:     0 1px 4px rgba(0,0,0,.35);
    --apt-shadow-md:     0 4px 14px rgba(0,0,0,.40);
    --apt-shadow-lg:     0 8px 28px rgba(0,0,0,.50);

    --pc-sunrise-bg:     linear-gradient(135deg, #2d1a00, #2e1f00);
    --pc-dusk-bg:        linear-gradient(135deg, #1c0d2d, #17072e);
    --pc-midnight-bg:    linear-gradient(135deg, #0c1a2e, #071e2f);
    --pc-forest-bg:      linear-gradient(135deg, #0a2d14, #072e1e);
    --pc-ocean-bg:       linear-gradient(135deg, #07202d, #062630);
    --pc-cherry-bg:      linear-gradient(135deg, #2d0a10, #2e0a1f);
}

/* ---- 全局容器 ---- */
.apt-container {
    display: flex;
    flex-direction: column;
    background: var(--apt-bg);
    border-radius: var(--apt-radius);
    overflow: hidden;
    box-shadow: var(--apt-shadow-lg);
    min-height: 640px;
    border: 1px solid var(--apt-border);
    transition: background var(--apt-transition), border-color var(--apt-transition);
}

/* ---- 工具栏 ---- */
.apt-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 12px;
    height: var(--apt-toolbar-h);
    background: var(--apt-surface);
    border-bottom: 1px solid var(--apt-border);
    flex-wrap: wrap;
    min-height: var(--apt-toolbar-h);
    transition: background var(--apt-transition), border-color var(--apt-transition);
}

.toolbar-group          { display: flex; align-items: center; gap: 2px; }
.toolbar-group--right   { margin-left: auto; }

.apt-toolbar-btn {
    padding: 5px 11px;
    border: 1px solid var(--apt-border);
    border-radius: var(--apt-radius-sm);
    background: var(--apt-surface);
    color: var(--apt-text);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--apt-transition);
    white-space: nowrap;
}

.apt-toolbar-btn:hover {
    background: var(--apt-primary-light);
    border-color: var(--apt-primary);
    color: var(--apt-primary);
}

.apt-toolbar-btn--ai {
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    color: #fff;
    border-color: transparent;
    font-weight: 600;
}

.apt-toolbar-btn--ai:hover {
    background: linear-gradient(135deg, #6d28d9, #4338ca);
    color: #fff;
    border-color: transparent;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(124,58,237,.40);
}

/* ---- 主内容区三列布局 ---- */
.apt-main-content {
    display: grid;
    grid-template-columns: 210px 1fr 1fr;
    min-height: 600px;
    overflow: hidden;
}

/* ---- 历史记录面板 ---- */
.apt-history-panel {
    border-right: 1px solid var(--apt-border);
    display: flex;
    flex-direction: column;
    background: var(--apt-surface);
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px 8px;
    border-bottom: 1px solid var(--apt-border);
    flex-shrink: 0;
}

.panel-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--apt-text);
}

.history-clear-btn {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid var(--apt-border);
    background: transparent;
    color: var(--apt-text-muted);
    cursor: pointer;
    transition: all var(--apt-transition);
}

.history-clear-btn:hover {
    border-color: var(--apt-danger);
    color: var(--apt-danger);
}

.history-search        { padding: 8px 10px; flex-shrink: 0; }
.history-search-wrap   { position: relative; }

.history-search-wrap input {
    width: 100%;
    padding: 5px 28px 5px 10px;
    border: 1px solid var(--apt-border);
    border-radius: var(--apt-radius-sm);
    font-size: 12px;
    background: var(--apt-bg);
    color: var(--apt-text);
    box-sizing: border-box;
    outline: none;
    transition: border-color var(--apt-transition);
}

.history-search-wrap input:focus { border-color: var(--apt-primary); }

.history-search-clear {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 11px;
    color: var(--apt-text-light);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
}

.history-search-clear:hover { color: var(--apt-danger); }

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--apt-border) transparent;
}

.history-list::-webkit-scrollbar        { width: 4px; }
.history-list::-webkit-scrollbar-track  { background: transparent; }
.history-list::-webkit-scrollbar-thumb  { background: var(--apt-border); border-radius: 4px; }

.history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 12px;
    color: var(--apt-text-light);
    font-size: 12px;
    text-align: center;
    gap: 6px;
}

.history-empty-icon { font-size: 30px; }
.history-empty-main { font-size: 12px; font-weight: 600; color: var(--apt-text-muted); }
.history-empty-sub  { font-size: 11px; }

.history-item {
    padding: 8px 10px;
    border-radius: var(--apt-radius-sm);
    cursor: pointer;
    border: 1px solid transparent;
    margin-bottom: 4px;
    transition: all var(--apt-transition);
}

.history-item:hover,
.history-item.active {
    background: var(--apt-primary-light);
    border-color: var(--apt-primary);
}

.history-item.active {
    box-shadow: inset 3px 0 0 var(--apt-primary);
}

.history-item-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--apt-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}

.history-item-meta {
    font-size: 11px;
    color: var(--apt-text-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.history-item-del {
    background: none;
    border: none;
    font-size: 11px;
    color: var(--apt-text-light);
    cursor: pointer;
    padding: 0 2px;
    opacity: 0;
    transition: opacity var(--apt-transition);
}

.history-item:hover .history-item-del { opacity: 1; }
.history-item-del:hover                { color: var(--apt-danger); }

.history-item-badge {
    display: inline-block;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 8px;
    background: var(--apt-primary-light);
    color: var(--apt-primary);
    margin-top: 3px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border: 1px solid var(--apt-border);
}

/* ---- 编辑器面板 ---- */
.apt-editor-panel {
    border-right: 1px solid var(--apt-border);
    display: flex;
    flex-direction: column;
    background: var(--apt-surface);
    overflow: hidden;
}

.editor-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px 8px;
    border-bottom: 1px solid var(--apt-border);
    flex-shrink: 0;
}

.editor-panel-title { font-size: 13px; font-weight: 600; color: var(--apt-text); }
.editor-panel-meta  { font-size: 11px; color: var(--apt-text-light); }

.apt-form {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px;
    scrollbar-width: thin;
    scrollbar-color: var(--apt-border) transparent;
}

.apt-form::-webkit-scrollbar        { width: 4px; }
.apt-form::-webkit-scrollbar-track  { background: transparent; }
.apt-form::-webkit-scrollbar-thumb  { background: var(--apt-border); border-radius: 4px; }

/* ---- 表单元素 ---- */
.apt-form-group { margin-bottom: 14px; }

.apt-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--apt-text);
    margin-bottom: 5px;
    border-bottom: 1px solid var(--apt-border);
    padding-bottom: 4px;
}

.apt-label-hint  { font-size: 11px; font-weight: 400; color: var(--apt-text-light); }
.required-mark   { color: var(--apt-danger); }

.apt-input,
.apt-select,
.apt-textarea {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--apt-border);
    border-radius: var(--apt-radius-sm);
    font-size: 13px;
    color: var(--apt-text);
    background: var(--apt-bg);
    box-sizing: border-box;
    outline: none;
    transition: border-color var(--apt-transition), box-shadow var(--apt-transition);
    font-family: inherit;
}

.apt-input:focus,
.apt-select:focus,
.apt-textarea:focus {
    border-color: var(--apt-primary);
    box-shadow: 0 0 0 3px rgba(124,58,237,.12);
}

.apt-textarea { resize: vertical; min-height: 68px; }

.apt-char-counter {
    font-size: 11px;
    color: var(--apt-text-light);
    text-align: right;
    margin-top: 3px;
    transition: color var(--apt-transition);
}

/* ---- 诗歌类型选择器 ---- */
.apt-type-selector {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 7px;
}

.apt-type-item { cursor: pointer; }
.apt-type-item input[type="radio"] { display: none; }

.apt-type-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 5px;
    border: 2px solid var(--apt-border);
    border-radius: var(--apt-radius-sm);
    background: var(--apt-bg);
    text-align: center;
    transition: all var(--apt-transition);
    gap: 2px;
    height: 100%;
    box-sizing: border-box;
}

.apt-type-item:hover .apt-type-card {
    border-color: var(--apt-primary);
    background: var(--apt-primary-light);
}

.apt-type-item input:checked + .apt-type-card {
    border-color: var(--apt-primary);
    background: var(--apt-primary-light);
    box-shadow: 0 0 0 2px rgba(124,58,237,.18);
    transform: scale(1.03);
}

.type-icon { font-size: 18px; }
.type-name { font-size: 12px; font-weight: 600; color: var(--apt-text); }
.type-desc { font-size: 10px; color: var(--apt-text-muted); line-height: 1.3; }

/* ---- 诗歌长度选择器 ---- */
.apt-length-selector {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 7px;
}

.apt-length-item { cursor: pointer; }
.apt-length-item input[type="radio"] { display: none; }

.apt-length-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 5px;
    border: 2px solid var(--apt-border);
    border-radius: var(--apt-radius-sm);
    background: var(--apt-bg);
    text-align: center;
    transition: all var(--apt-transition);
    gap: 2px;
}

.apt-length-item:hover .apt-length-card {
    border-color: var(--apt-primary);
    background: var(--apt-primary-light);
}

.apt-length-item input:checked + .apt-length-card {
    border-color: var(--apt-primary);
    background: var(--apt-primary-light);
    box-shadow: 0 0 0 2px rgba(124,58,237,.18);
    transform: scale(1.03);
}

.length-icon { font-size: 18px; }
.length-name { font-size: 12px; font-weight: 600; color: var(--apt-text); }
.length-desc { font-size: 10px; color: var(--apt-text-muted); }

/* ---- 快捷键提示 ---- */
.shortcut-hint {
    font-size: 0.8em;
    opacity: 0.7;
    color: var(--apt-text-muted);
    white-space: nowrap;
    align-self: center;
}

@media (max-width: 640px) { .shortcut-hint { display: none; } }

/* ---- 按钮 ---- */
.apt-form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
}

.apt-btn {
    padding: 9px 20px;
    border-radius: var(--apt-radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all var(--apt-transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.apt-btn--primary {
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    color: #fff;
    flex: 1;
    justify-content: center;
}

.apt-btn--primary:hover {
    background: linear-gradient(135deg, #6d28d9, #4338ca);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(124,58,237,.35);
}

.apt-btn--primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.apt-btn--secondary {
    background: var(--apt-bg);
    color: var(--apt-text-muted);
    border: 1px solid var(--apt-border);
}

.apt-btn--secondary:hover {
    border-color: var(--apt-primary);
    color: var(--apt-primary);
}

.apt-btn--secondary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* 键盘导航聚焦环 */
.apt-toolbar-btn:focus-visible,
.apt-btn:focus-visible,
.preview-action-btn:focus-visible,
.history-clear-btn:focus-visible,
.cancel-generate-btn:focus-visible {
    outline: 2px solid var(--apt-primary);
    outline-offset: 2px;
}

/* ---- 预览面板 ---- */
.apt-preview-panel {
    display: flex;
    flex-direction: column;
    background: var(--apt-bg);
    background-image: radial-gradient(circle, rgba(124,58,237,.05) 1px, transparent 1px);
    background-size: 22px 22px;
    overflow: hidden;
    position: relative;
}

.preview-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px 8px;
    border-bottom: 1px solid var(--apt-border);
    background: var(--apt-surface);
    flex-shrink: 0;
}

.preview-panel-header h3 { margin: 0; font-size: 13px; font-weight: 600; color: var(--apt-text); }

.preview-panel-actions { display: flex; gap: 6px; }

.preview-action-btn {
    padding: 4px 10px;
    font-size: 12px;
    border: 1px solid var(--apt-border);
    border-radius: 4px;
    background: var(--apt-surface);
    color: var(--apt-text-muted);
    cursor: pointer;
    transition: all var(--apt-transition);
}

.preview-action-btn:hover {
    border-color: var(--apt-primary);
    color: var(--apt-primary);
}

.preview-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    scrollbar-width: thin;
    scrollbar-color: var(--apt-border) transparent;
}

.preview-content::-webkit-scrollbar        { width: 4px; }
.preview-content::-webkit-scrollbar-track  { background: transparent; }
.preview-content::-webkit-scrollbar-thumb  { background: var(--apt-border); border-radius: 4px; }

/* 空状态 */
.preview-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
    color: var(--apt-text-light);
    text-align: center;
    gap: 10px;
}

.preview-empty-icon  { font-size: 52px; opacity: 0.65; }
.preview-empty-title { font-size: 16px; font-weight: 600; color: var(--apt-text-muted); }
.preview-empty-hint  { font-size: 13px; color: var(--apt-text-light); line-height: 1.7; }

/* 浮动动画 */
.apt-float-anim {
    animation: apt-float 2.8s ease-in-out infinite;
}

@keyframes apt-float {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-8px); }
}

/* 加载状态 */
.preview-loading {
    position: absolute;
    inset: 0;
    background: rgba(248,245,255,.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 10;
}

.apt-dark .preview-loading {
    background: rgba(19,13,34,.92);
}

.loading-quill {
    font-size: 40px;
    animation: apt-quill-bounce 1s ease-in-out infinite;
}

@keyframes apt-quill-bounce {
    0%, 100% { transform: scale(1) rotate(-5deg); }
    50%       { transform: scale(1.15) rotate(5deg); }
}

.loading-title { font-size: 15px; font-weight: 600; color: var(--apt-text); }
.loading-hint  { font-size: 12px; color: var(--apt-text-muted); text-align: center; max-width: 240px; }

/* Loading 动态小点 */
.apt-loading-dots span {
    animation: apt-dot-flash 1.4s infinite ease-in-out;
    opacity: 0;
}
.apt-loading-dots span:nth-child(1) { animation-delay: 0.0s; }
.apt-loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.apt-loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes apt-dot-flash {
    0%, 60%, 100% { opacity: 0; }
    30%           { opacity: 1; }
}

.cancel-generate-btn {
    padding: 6px 18px;
    border: 1px solid var(--apt-border);
    border-radius: var(--apt-radius-sm);
    background: var(--apt-surface);
    color: var(--apt-text-muted);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--apt-transition);
    margin-top: 4px;
}

.cancel-generate-btn:hover {
    border-color: var(--apt-danger);
    color: var(--apt-danger);
}

/* ============================================================
   诗歌卡片视觉样式
   ============================================================ */
.poem-card {
    width: 100%;
    max-width: 440px;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,.13), 0 2px 8px rgba(0,0,0,.09);
    border: 2px solid var(--apt-border);
    background: var(--apt-surface);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    animation: apt-card-in 0.42s cubic-bezier(0.4, 0, 0.2, 1) both;
}

@keyframes apt-card-in {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
}

.poem-card:hover {
    box-shadow: 0 12px 40px rgba(0,0,0,.17), 0 2px 8px rgba(0,0,0,.09);
    transform: translateY(-2px);
}

/* 主题边框色 */
.pc-palette-sunrise  { border-color: var(--pc-sunrise-border); }
.pc-palette-dusk     { border-color: var(--pc-dusk-border); }
.pc-palette-midnight { border-color: var(--pc-midnight-border); }
.pc-palette-forest   { border-color: var(--pc-forest-border); }
.pc-palette-ocean    { border-color: var(--pc-ocean-border); }
.pc-palette-cherry   { border-color: var(--pc-cherry-border); }

/* 诗歌卡片顶部 */
.poem-card-header {
    padding: 18px 20px 14px;
    color: #fff;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.pc-palette-sunrise  .poem-card-header { background: var(--pc-sunrise-header); }
.pc-palette-dusk     .poem-card-header { background: var(--pc-dusk-header); }
.pc-palette-midnight .poem-card-header { background: var(--pc-midnight-header); }
.pc-palette-forest   .poem-card-header { background: var(--pc-forest-header); }
.pc-palette-ocean    .poem-card-header { background: var(--pc-ocean-header); }
.pc-palette-cherry   .poem-card-header { background: var(--pc-cherry-header); }

.poem-card:not([class*="pc-palette-"]) .poem-card-header {
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
}

/* 标题区装饰光晕 */
.poem-card-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 80% 20%, rgba(255,255,255,.18) 0%, transparent 42%),
        radial-gradient(circle at 15% 85%, rgba(255,255,255,.12) 0%, transparent 38%);
    pointer-events: none;
}

.poem-card-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
    line-height: 1.4;
    font-family: 'Georgia', 'STSong', '宋体', serif;
}

.poem-card-type-badge {
    font-size: 11px;
    padding: 2px 9px;
    border-radius: 20px;
    background: rgba(255,255,255,.22);
    border: 1px solid rgba(255,255,255,.40);
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: 10px;
    align-self: flex-start;
    margin-top: 3px;
}

/* 诗歌正文区 */
.poem-card-body {
    padding: 22px 24px 18px;
    background: var(--apt-surface);
    position: relative;
    cursor: pointer;
    transition: filter var(--apt-transition);
}

.poem-card-body:hover { filter: brightness(0.975); }

.poem-card-body::after {
    content: "📑 点击复制";
    position: absolute;
    bottom: 12px;
    right: 16px;
    font-size: 11px;
    color: var(--apt-text-muted);
    background: rgba(255,255,255,0.88);
    padding: 2px 9px;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.08);
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.apt-dark .poem-card-body::after {
    background: rgba(19,13,34,0.88);
    border-color: rgba(255,255,255,0.12);
}

.poem-card-body:hover::after {
    opacity: 1;
    transform: translateY(0);
}

.pc-palette-sunrise  .poem-card-body { background: var(--pc-sunrise-bg); }
.pc-palette-dusk     .poem-card-body { background: var(--pc-dusk-bg); }
.pc-palette-midnight .poem-card-body { background: var(--pc-midnight-bg); }
.pc-palette-forest   .poem-card-body { background: var(--pc-forest-bg); }
.pc-palette-ocean    .poem-card-body { background: var(--pc-ocean-bg); }
.pc-palette-cherry   .poem-card-body { background: var(--pc-cherry-bg); }

.poem-text {
    font-size: 15px;
    color: var(--apt-text);
    line-height: 2.2;
    font-family: 'Georgia', 'STSong', '宋体', serif;
    white-space: pre-line;
    letter-spacing: 0.3px;
}

/* 诗歌分隔线 */
.poem-card-divider {
    height: 1px;
    border: none;
    margin: 14px 0;
    opacity: 0.25;
    background: currentColor;
}

/* 注释/赏析区 */
.poem-annotation {
    font-size: 12px;
    color: var(--apt-text-muted);
    font-style: italic;
    line-height: 1.8;
    background: rgba(124,58,237,.06);
    border-left: 3px solid var(--apt-primary);
    padding: 8px 12px;
    border-radius: 0 6px 6px 0;
}

/* 标签区 */
.poem-card-footer {
    padding: 10px 24px 14px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.pc-palette-sunrise  .poem-card-footer { background: var(--pc-sunrise-bg); }
.pc-palette-dusk     .poem-card-footer { background: var(--pc-dusk-bg); }
.pc-palette-midnight .poem-card-footer { background: var(--pc-midnight-bg); }
.pc-palette-forest   .poem-card-footer { background: var(--pc-forest-bg); }
.pc-palette-ocean    .poem-card-footer { background: var(--pc-ocean-bg); }
.pc-palette-cherry   .poem-card-footer { background: var(--pc-cherry-bg); }

.poem-tag {
    font-size: 11px;
    padding: 2px 9px;
    border-radius: 20px;
    background: var(--apt-primary-light);
    color: var(--apt-primary);
    border: 1px solid rgba(124,58,237,.18);
}

/* ---- Toast 通知 ---- */
.apt-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 10px 22px;
    border-radius: 24px;
    font-size: 13px;
    font-weight: 500;
    background: #1e1333;
    color: #fff;
    box-shadow: 0 4px 18px rgba(0,0,0,.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
    z-index: 9999;
    white-space: nowrap;
}

.apt-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.apt-toast--success { background: #059669; }
.apt-toast--error   { background: #dc2626; }
.apt-toast--warning { background: #d97706; }

/* ---- 模态框 ---- */
.apt-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.apt-modal.show {
    opacity: 1;
    pointer-events: all;
}

.apt-modal-content {
    background: var(--apt-surface);
    border-radius: var(--apt-radius);
    box-shadow: var(--apt-shadow-lg);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.96);
    transition: transform 0.2s ease;
    z-index: 99999;
}

.apt-modal.show .apt-modal-content { transform: scale(1); }

.apt-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--apt-border);
    flex-shrink: 0;
}

.apt-modal-header h3 { margin: 0; font-size: 15px; font-weight: 600; color: var(--apt-text); }

.apt-modal-close {
    background: none;
    border: none;
    font-size: 16px;
    color: var(--apt-text-muted);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all var(--apt-transition);
}

.apt-modal-close:hover { background: var(--apt-primary-light); color: var(--apt-primary); }

.apt-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

.template-modal-hint { font-size: 12px; color: var(--apt-text-muted); margin: 0 0 14px; }

.template-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.template-card {
    padding: 12px 14px;
    border: 1px solid var(--apt-border);
    border-radius: var(--apt-radius-sm);
    cursor: pointer;
    transition: all var(--apt-transition);
    background: var(--apt-bg);
}

.template-card:hover {
    border-color: var(--apt-primary);
    background: var(--apt-primary-light);
}

.template-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.template-card-icon { font-size: 20px; }
.template-card-name { font-size: 13px; font-weight: 600; color: var(--apt-text); }
.template-card-desc { font-size: 12px; color: var(--apt-text-muted); line-height: 1.5; }

/* ---- 快捷键提示行 ---- */
.apt-shortcut-tip {
    margin-top: 8px;
    font-size: 11px;
    color: var(--apt-text-light);
    line-height: 1.6;
    padding: 4px 2px 0;
}

/* ---- 周末/工作日语义背景 ---- */
.apt-weekend .apt-main-content {
    background: linear-gradient(160deg, #f8f5ff 0%, #f3eeff 100%);
}
.apt-dark .apt-weekend .apt-main-content { background: unset; }

/* ---- 全屏模式 ---- */
.apt-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    border-radius: 0;
    min-height: 100vh;
    box-shadow: none;
}

/* ---- 字数预警颜色 ---- */
.apt-char-counter.apt-char-warning { color: var(--apt-warning); }
.apt-char-counter.apt-char-danger  { color: var(--apt-danger);  }
.apt-char-counter.apt-char-danger span { font-weight: bold; }

/* ---- 骨架占位样式 ---- */
.poem-skeleton {
    width: 100%;
    max-width: 440px;
    border-radius: 14px;
    overflow: hidden;
    background: var(--apt-surface);
    border: 2px solid var(--apt-border);
}

.poem-sk-header {
    padding: 18px 20px 14px;
    background: var(--apt-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.poem-sk-bar {
    border-radius: 6px;
    background: var(--apt-border);
    animation: apt-sk-pulse 1.4s ease-in-out infinite;
}

.poem-sk-title { width: 140px; height: 22px; flex-shrink: 0; }
.poem-sk-badge { width: 60px;  height: 18px; flex-shrink: 0; }

.poem-sk-body {
    padding: 22px 24px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.poem-sk-line {
    height: 14px;
    border-radius: 4px;
    background: var(--apt-border);
    animation: apt-sk-pulse 1.4s ease-in-out infinite;
}

.poem-sk-line:nth-child(even) { animation-delay: 0.2s; }
.poem-sk-line:nth-child(3n)   { animation-delay: 0.4s; }

@keyframes apt-sk-pulse {
    0%, 100% { opacity: 0.55; }
    50%       { opacity: 0.28; }
}

/* ---- 响应式断点 ---- */
@media (max-width: 900px) {
    .apt-main-content { grid-template-columns: 180px 1fr 1fr; }
}

@media (max-width: 768px) {
    .apt-main-content { grid-template-columns: 1fr 1fr; }
    .apt-history-panel { display: none; }
    .apt-type-selector { grid-template-columns: 1fr 1fr 1fr; }
}

@media (max-width: 640px) {
    .apt-main-content {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }
    .apt-editor-panel {
        border-right: none;
        border-bottom: 1px solid var(--apt-border);
    }
    .apt-type-selector   { grid-template-columns: 1fr 1fr; }
    .apt-length-selector { grid-template-columns: 1fr 1fr 1fr; }
    .apt-preview-panel   { min-height: 360px; }
    .apt-toolbar         { gap: 2px; }
    .apt-toolbar-btn     { padding: 5px 8px; font-size: 12px; }
}
