/**
 * 汉字拼音在线转换 - 样式文件
 * 主题色：朱砂红 + 金色，体现中国传统文化美感
 */

/* ==================== 容器布局 ==================== */
.pinyin-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 140px);
    min-height: 500px;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 16px rgba(0,0,0,0.08);
    z-index: 99998;
}
/* ==================== 工具栏 ==================== */
.pinyin-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #c0392b 0%, #e74c3c 40%, #c0392b 100%);
    border-bottom: 1px solid #a93226;
    flex-wrap: wrap;
    flex-shrink: 0;
    row-gap: 6px;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.toolbar-group--right {
    margin-left: auto;
}

.toolbar-group + .toolbar-group {
    border-left: 1px solid rgba(255,255,255,0.25);
    padding-left: 8px;
    margin-left: 4px;
}

.toolbar-btn {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    padding: 5px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

.toolbar-btn:hover {
    background: rgba(255,255,255,0.28);
    border-color: rgba(255,255,255,0.6);
    transform: translateY(-1px);
}

.toolbar-btn.ai-btn {
    background: linear-gradient(135deg, rgba(255,215,0,0.3) 0%, rgba(255,215,0,0.2) 100%);
    border-color: rgba(255,215,0,0.6);
    color: #ffd700;
}

.toolbar-btn.ai-btn:hover {
    background: linear-gradient(135deg, rgba(255,215,0,0.45) 0%, rgba(255,215,0,0.35) 100%);
}

.toolbar-options {
    gap: 12px;
}

.option-label {
    display: flex;
    align-items: center;
    gap: 5px;
    color: rgba(255,255,255,0.9);
    font-size: 12px;
    cursor: pointer;
    user-select: none;
    padding: 5px 0 0;
}

.option-label input[type="checkbox"] {
    accent-color: #ffd700;
    width: 14px;
    height: 14px;
    cursor: pointer;
}

/* ==================== 主内容区 ==================== */
.pinyin-main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ==================== 历史记录面板 ==================== */
.pinyin-history-panel {
    width: 200px;
    min-width: 160px;
    max-width: 300px;
    border-right: 1px solid #e8e8e8;
    display: flex;
    flex-direction: column;
    background: #fafafa;
    flex-shrink: 0;
    resize: horizontal;
    overflow: auto;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: linear-gradient(to bottom, #fafafa, #f5f5f5);
    border-bottom: 1px solid #e8e8e8;
    flex-shrink: 0;
}

.history-title {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: #555;
}

.history-clear-btn {
    background: #fff0f0;
    border: none;
    color: #e74c3c;
    font-size: 11px;
    cursor: pointer;
    padding: 2px 7px;
    border-radius: 3px;
    transition: all 0.2s;
}

.history-clear-btn:hover {
    background: #fde8e8;
}

.history-search {
    padding: 8px 10px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.history-search input {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 11px;
    background: #fff;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s;
}

.history-search input:focus {
    border-color: #c0392b;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}

.history-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
}

.history-item:hover {
    background: #fff5f5;
}

.history-item.active {
    background: #fde8e8;
    box-shadow: inset 3px 0 0 #c0392b;
}

.history-item-text {
    font-size: 12px;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.history-item-time {
    font-size: 10px;
    color: #999;
    margin-top: 3px;
}

.history-empty {
    text-align: center;
    padding: 30px 10px;
    color: #bbb;
    font-size: 12px;
}

/* ==================== 输入面板 ==================== */
.input-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e8e8e8;
    min-width: 280px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid #eee;
    background: #fefefe;
    flex-shrink: 0;
}

.panel-title {
    font-size: 13px;
    font-weight: 600;
    color: #444;
}

.char-count {
    font-size: 11px;
    color: #999;
}

.char-count.warning {
    color: #e67e22;
}

.char-count.danger {
    color: #c0392b;
    font-weight: 600;
}

.pinyin-textarea {
    flex: 1;
    padding: 16px;
    border: none;
    outline: none;
    resize: none;
    font-size: 18px;
    line-height: 1.8;
    color: #333;
    background: #fff;
    font-family: "Microsoft YaHei", "SimSun", sans-serif;
    letter-spacing: 2px;
}

.pinyin-textarea::placeholder {
    font-size: 14px;
    color: #ccc;
    line-height: 1.8;
    letter-spacing: 0;
}

.input-actions {
    padding: 12px 16px;
    border-top: 1px solid #eee;
    background: #fafafa;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.example-chips {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.chip-label {
    font-size: 11px;
    color: #999;
    white-space: nowrap;
}

.example-chip {
    padding: 3px 10px;
    background: #fff;
    border: 1px solid #e0c8c8;
    border-radius: 12px;
    color: #c0392b;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.example-chip:hover {
    background: #c0392b;
    color: #fff;
    border-color: #c0392b;
}

.convert-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 11px;
    background: linear-gradient(135deg, #c0392b, #e74c3c);
    color: #fff;
    border: none;
    border-radius: 7px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 1px;
}

.convert-btn:hover {
    background: linear-gradient(135deg, #a93226, #c0392b);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(192,57,43,0.35);
}

.convert-btn:active {
    transform: translateY(0);
}

.convert-btn.loading {
    background: #aaa;
    cursor: not-allowed;
    pointer-events: none;
}

/* ==================== 结果面板 ==================== */
.result-panel {
    flex: 1.2;
    display: flex;
    flex-direction: column;
    min-width: 300px;
    background: #fff;
}

.result-actions {
    display: flex;
    gap: 6px;
}

/* 结果区头部右侧（含统计+按钮） */
.result-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* 结果统计字数 */
.result-stats {
    font-size: 11px;
    color: #999;
    background: #f5f5f5;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

body.dark .result-stats {
    color: #777;
    background: #2a2a2a;
}

/* 小号操作按钮（AI侧栏复制等） */
.action-btn--sm {
    font-size: 11px;
    padding: 2px 8px;
}

.action-btn {
    padding: 4px 10px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #555;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    background: #fff0f0;
    border-color: #c0392b;
    color: #c0392b;
}

.result-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 20px;
}

/* Light mode scrollbar */
.result-content::-webkit-scrollbar { width: 4px; }
.result-content::-webkit-scrollbar-track { background: #f5f5f5; }
.result-content::-webkit-scrollbar-thumb { background: #ddd; border-radius: 3px; }
.result-content::-webkit-scrollbar-thumb:hover { background: #c0392b; }

.result-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 200px;
    color: #bbb;
    text-align: center;
}

.placeholder-icon {
    font-size: 48px;
    margin-bottom: 14px;
    opacity: 0.5;
}

.placeholder-text {
    font-size: 15px;
    color: #bbb;
    margin-bottom: 8px;
}

.placeholder-sub {
    font-size: 12px;
    color: #ddd;
}

/* ==================== 拼音结果样式 ==================== */
.pinyin-result-block {
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 上下对照模式 */
.pinyin-pair-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    line-height: 1.4;
}

.pinyin-pair {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 24px;
}

.pinyin-text {
    font-size: 13px;
    color: #c0392b;
    font-weight: 500;
    letter-spacing: 0.5px;
    line-height: 1.6;
    white-space: nowrap;
}

.hanzi-text {
    font-size: 22px;
    color: #222;
    font-family: "Microsoft YaHei", "SimSun", serif;
    line-height: 1.3;
}

.pinyin-pair.space-char {
    min-width: 10px;
}

.pinyin-pair.punct-char .pinyin-text {
    color: transparent;
}

/* 多音字标注 */
.polyphone-mark {
    font-size: 9px;
    color: #e67e22;
    background: #fff3cd;
    border: 1px solid #f0ad4e;
    border-radius: 3px;
    padding: 0 3px;
    margin-left: 2px;
    vertical-align: super;
}

/* 纯拼音模式 */
.pinyin-plain-mode {
    font-size: 16px;
    line-height: 2;
    color: #333;
    word-spacing: 6px;
}

.pinyin-plain-mode .py-item {
    color: #c0392b;
    font-weight: 500;
}

/* 段落分隔 */
.result-paragraph {
    margin-bottom: 20px;
}

.result-paragraph + .result-paragraph {
    padding-top: 16px;
    border-top: 1px dashed #eee;
}

/* ==================== AI侧边栏 ==================== */
.ai-sidebar {
    position: fixed;
    top: 0;
    right: -420px;
    width: 400px;
    height: 100vh;
    background: #fff;
    box-shadow: -4px 0 20px rgba(0,0,0,0.12);
    z-index: 1000;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ai-sidebar.open {
    right: 0;
}

.ai-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #c0392b, #e74c3c);
    color: #fff;
    flex-shrink: 0;
}

.ai-sidebar-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.ai-close-btn {
    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: background 0.2s;
}

.ai-close-btn:hover {
    background: rgba(255,255,255,0.35);
}

.ai-sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ai-mode-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-mode-label {
    font-size: 12px;
    color: #666;
    font-weight: 600;
}

.ai-mode-buttons {
    display: flex;
    gap: 6px;
}

.mode-btn {
    flex: 1;
    padding: 6px 0;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #f9f9f9;
    color: #555;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.mode-btn.active {
    background: #c0392b;
    border-color: #c0392b;
    color: #fff;
    font-weight: 600;
}

.mode-btn:hover:not(.active) {
    border-color: #c0392b;
    color: #c0392b;
    background: #fff5f5;
}

.ai-input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ai-input-group label {
    font-size: 12px;
    color: #666;
    font-weight: 600;
}

.ai-input-group textarea {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.ai-input-group textarea:focus {
    border-color: #c0392b;
    box-shadow: 0 0 0 2px rgba(192,57,43,0.1);
}

.ai-actions {
    display: flex;
    gap: 8px;
}

.ai-btn-primary {
    flex: 1;
    padding: 10px;
    background: linear-gradient(135deg, #c0392b, #e74c3c);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-btn-primary:hover {
    background: linear-gradient(135deg, #a93226, #c0392b);
    transform: translateY(-1px);
}

.ai-btn-cancel {
    padding: 10px 16px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 6px;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-btn-cancel:hover {
    background: #fff0f0;
    border-color: #c0392b;
    color: #c0392b;
}

.ai-result-area {
    border: 1px solid #eee;
    border-radius: 6px;
    overflow: hidden;
}

.ai-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f5f5f5;
    border-bottom: 1px solid #eee;
    font-size: 12px;
    font-weight: 600;
    color: #555;
}

.ai-result-content {
    padding: 12px;
    font-size: 13px;
    line-height: 1.8;
    color: #333;
    max-height: 350px;
    overflow-y: auto;
    word-break: break-word;
}

.ai-result-content.loading-text::after {
    content: '';
    display: inline-block;
    width: 8px;
    height: 14px;
    background: #c0392b;
    animation: blink 0.8s step-end infinite;
    margin-left: 2px;
    vertical-align: text-bottom;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.ai-tips {
    padding: 10px 12px;
    background: #fffbf5;
    border: 1px solid #f0e6c8;
    border-radius: 6px;
    font-size: 11px;
    color: #666;
}

.ai-tips p {
    margin: 0 0 5px;
    font-weight: 600;
    color: #c0392b;
}

.ai-tips ul {
    margin: 0;
    padding-left: 16px;
}

.ai-tips li {
    margin-bottom: 3px;
}

/* ==================== AI遮罩层 ==================== */
.ai-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.3);
    z-index: 999;
    display: none;
}

.ai-overlay.visible {
    display: block;
}

/* ==================== Toast提示 ==================== */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: toastIn 0.3s ease;
    pointer-events: none;
}

.toast.success { background: #27ae60; }
.toast.error { background: #c0392b; }
.toast.info { background: #2980b9; }
.toast.warning { background: #e67e22; }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-12px); }
}

/* ==================== 全屏模式 ==================== */
.pinyin-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 800;
    border-radius: 0;
    box-shadow: none;
}

/* ==================== 暗黑模式 ==================== */
body.dark .pinyin-container {
    background: #1e1e1e;
    box-shadow: 0 2px 16px rgba(0,0,0,0.4);
}

body.dark .pinyin-toolbar {
    background: linear-gradient(135deg, #7b1a12 0%, #a93226 40%, #7b1a12 100%);
    border-color: #6b1008;
}

body.dark .pinyin-history-panel {
    background: #252525;
    border-color: #333;
}

body.dark .history-header {
    background: linear-gradient(to bottom, #252525, #222);
    border-color: #333;
}

body.dark .history-title {
    color: #bbb;
}

body.dark .history-clear-btn {
    background: #3a2020;
    color: #e74c3c;
}

body.dark .history-clear-btn:hover {
    background: #4a2020;
}

body.dark .history-search input {
    background: #2a2a2a;
    border-color: #444;
    color: #ccc;
}

body.dark .history-search input:focus {
    border-color: #e74c3c;
}

body.dark .history-item {
    border-color: #333;
}

body.dark .history-item:hover {
    background: #2a2020;
}

body.dark .history-item.active {
    background: #3a2020;
    box-shadow: inset 3px 0 0 #e74c3c;
}

body.dark .history-item-text {
    color: #ccc;
}

body.dark .history-item-time {
    color: #666;
}

body.dark .history-empty {
    color: #555;
}

body.dark .input-panel {
    border-color: #333;
}

body.dark .panel-header {
    background: #252525;
    border-color: #333;
}

body.dark .panel-title {
    color: #ccc;
}

body.dark .char-count {
    color: #666;
}

body.dark .pinyin-textarea {
    background: #1e1e1e;
    color: #ddd;
}

body.dark .pinyin-textarea::placeholder {
    color: #444;
}

body.dark .input-actions {
    background: #252525;
    border-color: #333;
}

body.dark .example-chip {
    background: #2a2a2a;
    border-color: #5a2a2a;
    color: #e74c3c;
}

body.dark .example-chip:hover {
    background: #e74c3c;
    color: #fff;
    border-color: #e74c3c;
}

body.dark .convert-btn {
    background: linear-gradient(135deg, #7b1a12, #a93226);
}

body.dark .convert-btn:hover {
    background: linear-gradient(135deg, #6b1008, #7b1a12);
    box-shadow: 0 4px 12px rgba(192,57,43,0.5);
}

body.dark .result-panel {
    background: #1e1e1e;
}

body.dark .result-content {
    background: #1e1e1e;
}

body.dark .action-btn {
    background: #2a2a2a;
    border-color: #444;
    color: #aaa;
}

body.dark .action-btn:hover {
    background: #3a2020;
    border-color: #e74c3c;
    color: #e74c3c;
}

body.dark .placeholder-text {
    color: #888;
}

body.dark .placeholder-sub {
    color: #666;
}

body.dark .hanzi-text {
    color: #eee;
}

body.dark .pinyin-text {
    color: #e74c3c;
}

body.dark .polyphone-mark {
    background: #3a2d00;
    border-color: #7a5c00;
    color: #f0ad4e;
}

body.dark .result-paragraph {
    border-color: #333;
}

body.dark .ai-sidebar {
    background: #1e1e1e;
    box-shadow: -4px 0 20px rgba(0,0,0,0.5);
}

body.dark .ai-sidebar-header {
    background: linear-gradient(135deg, #7b1a12, #a93226);
}

body.dark .mode-btn {
    background: #2a2a2a;
    border-color: #444;
    color: #aaa;
}

body.dark .mode-btn.active {
    background: #c0392b;
    border-color: #c0392b;
    color: #fff;
}

body.dark .mode-btn:hover:not(.active) {
    border-color: #e74c3c;
    color: #e74c3c;
    background: #2a2020;
}

body.dark .ai-input-group label {
    color: #aaa;
}

body.dark .ai-input-group textarea {
    background: #2a2a2a;
    border-color: #444;
    color: #ccc;
}

body.dark .ai-input-group textarea:focus {
    border-color: #e74c3c;
}

body.dark .ai-btn-primary {
    background: linear-gradient(135deg, #7b1a12, #a93226);
}

body.dark .ai-btn-cancel {
    background: #2a2a2a;
    border-color: #444;
    color: #aaa;
}

body.dark .ai-result-area {
    border-color: #333;
}

body.dark .ai-result-header {
    background: #252525;
    border-color: #333;
    color: #aaa;
}

body.dark .ai-result-content {
    color: #ddd;
}

body.dark .ai-tips {
    background: #252520;
    border-color: #3a3020;
    color: #888;
}

body.dark .ai-mode-label {
    color: #aaa;
}

/* ==================== 响应式布局 ==================== */
/* 640px~899px：隐藏历史面板，保留输入+结果 */
@media (max-width: 899px) {
    .pinyin-history-panel {
        display: none;
    }

    .toolbar-options {
        display: none;
    }
}

/* ≤639px：纵向堆叠 */
@media (max-width: 639px) {
    .pinyin-main-content {
        flex-direction: column;
    }

    .input-panel,
    .result-panel {
        min-width: unset;
        min-height: 250px;
    }

    .input-panel {
        border-right: none;
        border-bottom: 1px solid #e8e8e8;
    }

    .pinyin-container {
        height: auto;
        min-height: 100vh;
    }

    .ai-sidebar {
        width: 100%;
        right: -100%;
    }

    .pinyin-toolbar {
        gap: 4px;
        padding: 8px 10px;
    }

    .toolbar-btn {
        padding: 4px 8px;
        font-size: 11px;
    }
}

/* >=900px: display three columns */
@media (min-width: 900px) {
    .pinyin-history-panel {
        display: flex;
    }
}

/* Small convert button modifier (used in error state retry) */
.convert-btn.convert-btn--sm {
    width: auto;
    padding: 8px 24px;
    font-size: 13px;
    margin-top: 14px;
    letter-spacing: 0;
}

/* Loading animation class */
.placeholder-icon.spinning {
    animation: spin 1s linear infinite;
}

/* ==================== Hidden utility ==================== */
.pinyin-hidden {
    display: none !important;
}

/* ==================== Spin animation for loading ==================== */
@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ==================== Dark mode scrollbar tracks ==================== */
body.dark .result-content::-webkit-scrollbar-track {
    background: #1a1a1a;
}
body.dark .result-content::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 3px;
}
body.dark .ai-result-content::-webkit-scrollbar-track {
    background: #252525;
}
body.dark .ai-result-content::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 3px;
}
body.dark .history-list::-webkit-scrollbar-track {
    background: #252525;
}
body.dark .ai-sidebar-body::-webkit-scrollbar-track {
    background: #1e1e1e;
}

/* Polyphone pair highlight */
.pinyin-pair.has-polyphone {
    cursor: help;
}
.pinyin-pair.has-polyphone .hanzi-text {
    border-bottom: 2px dashed #e67e22;
}
body.dark .pinyin-pair.has-polyphone .hanzi-text {
    border-bottom-color: #f0ad4e;
}

/* History item footer (time + delete btn) */
.history-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 3px;
}
.history-item-del {
    background: none;
    border: none;
    color: #ccc;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
    border-radius: 3px;
    transition: color 0.15s, background 0.15s;
    opacity: 0;
}
.history-item:hover .history-item-del {
    opacity: 1;
}
.history-item-del:hover {
    color: #e74c3c;
    background: #fde8e8;
}
body.dark .history-item-del:hover {
    background: #3a2020;
    color: #e74c3c;
}

/* ==================== AI Markdown rendered styles ==================== */
.ai-result-content {
    white-space: normal;
}
.ai-result-content.loading-text {
    white-space: pre-wrap;
}
.ai-result-content h2 {
    margin: 14px 0 8px;
    color: #c0392b;
    font-size: 15px;
    font-weight: 700;
}
.ai-result-content h3 {
    margin: 12px 0 6px;
    color: #c0392b;
    font-size: 14px;
    font-weight: 600;
}
.ai-result-content h4 {
    margin: 10px 0 4px;
    color: #c0392b;
    font-size: 13px;
    font-weight: 600;
}
.ai-result-content ul {
    padding-left: 18px;
    margin: 4px 0;
}
.ai-result-content li {
    margin-bottom: 4px;
}
.ai-result-content strong {
    font-weight: 700;
    color: #333;
}
.ai-result-content em {
    font-style: italic;
    color: #555;
}
body.dark .ai-result-content h2,
body.dark .ai-result-content h3,
body.dark .ai-result-content h4 {
    color: #e74c3c;
}
body.dark .ai-result-content strong { color: #eee; }
body.dark .ai-result-content em { color: #aaa; }

/* ==================== Tone color coding ====================
 * 1st tone (阴平) = blue  · 2nd (阳平) = green
 * 3rd tone (上声) = orange · 4th (去声) = red · neutral = gray
 * =========================================================== */
.pinyin-text[data-tone="1"] { color: #2471a3; }
.pinyin-text[data-tone="2"] { color: #1e8449; }
.pinyin-text[data-tone="3"] { color: #d35400; }
.pinyin-text[data-tone="4"] { color: #c0392b; }
.pinyin-text[data-tone="0"] { color: #95a5a6; }

body.dark .pinyin-text[data-tone="1"] { color: #5dade2; }
body.dark .pinyin-text[data-tone="2"] { color: #52be80; }
body.dark .pinyin-text[data-tone="3"] { color: #f0b27a; }
body.dark .pinyin-text[data-tone="4"] { color: #e74c3c; }
body.dark .pinyin-text[data-tone="0"] { color: #717d7e; }

.pinyin-container.fullscreen {
    z-index: 99998;
}