/* =============================================
   英语单词工具 - english_word.css
   三栏布局：历史 | 查询 | 结果
   主题色：深蓝/靛蓝 英语学习风格
   ============================================= */

/* ========== 主容器 ========== */
.ew-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 600px;
    background: #f0f4ff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(21, 101, 192, 0.1);
    transition: all 0.3s ease;
}

/* 全屏模式 */
.ew-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999;
    border-radius: 0;
    margin: 0;
    min-height: unset;
}

/* ========== 顶部工具栏 ========== */
.ew-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 14px;
    min-height: 40px;
    background: linear-gradient(135deg, #1565c0 0%, #0d47a1 100%);
    color: #fff;
    flex-wrap: wrap;
    gap: 6px;
    box-shadow: 0 2px 10px rgba(13, 71, 161, 0.4);
    flex-shrink: 0;
    position: relative; /* 进度条绝对定位基准 */
}

.ew-toolbar .toolbar-group {
    display: flex;
    gap: 5px;
    align-items: center;
    flex-wrap: wrap;
}

.ew-toolbar-title {
    font-size: 13px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.95);
    letter-spacing: 0.5px;
    margin-right: 6px;
    font-family: 'Georgia', serif;
}

.ew-toolbar-btn {
    padding: 4px 11px;
    background: rgba(255, 255, 255, 0.92);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: #1565c0;
    transition: all 0.2s;
    white-space: nowrap;
    line-height: 1.5;
}

.ew-toolbar-btn:hover:not(:disabled) {
    background: #fff;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18);
}

.ew-toolbar-btn:active:not(:disabled) {
    transform: translateY(0);
}

.ew-toolbar-btn:disabled {
    opacity: 0.42;
    cursor: not-allowed;
}

/* 主操作按钮（查询） */
.ew-toolbar-btn-primary {
    background: linear-gradient(135deg, #42a5f5 0%, #1976d2 100%);
    color: #fff !important;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(66, 165, 245, 0.45);
}

.ew-toolbar-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #64b5f6 0%, #42a5f5 100%) !important;
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(66, 165, 245, 0.55) !important;
}

/* 查询按钮 loading 流光动画 */
.ew-toolbar-btn-primary.ew-btn-loading {
    background: linear-gradient(90deg, #1976d2 0%, #42a5f5 35%, #1976d2 65%, #0d47a1 100%) !important;
    background-size: 200% 100% !important;
    animation: ewBtnShimmer 1.4s ease-in-out infinite;
    cursor: not-allowed;
    box-shadow: 0 2px 10px rgba(66, 165, 245, 0.5) !important;
}

@keyframes ewBtnShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* 取消按钮 */
.ew-toolbar-btn-cancel {
    background: rgba(255, 82, 82, 0.85) !important;
    color: #fff !important;
    font-weight: 600;
}

.ew-toolbar-btn-cancel:hover {
    background: #ff5252 !important;
    box-shadow: 0 3px 8px rgba(255, 82, 82, 0.3) !important;
}

/* ========== 主内容：三栏 ========== */
.ew-main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    background: #f0f4ff;
}

/* ========== 左栏：历史记录 ========== */
.ew-history-panel {
    width: 190px;
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid #dce8fb;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ew-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: linear-gradient(to bottom, #f0f7ff 0%, #e8f0fe 100%);
    border-bottom: 1px solid #dce8fb;
    flex-shrink: 0;
}

.ew-history-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #1565c0;
}

.ew-history-count {
    font-size: 11px;
    color: #90a4ae;
    font-weight: 400;
}

.ew-history-clear-btn {
    background: #fff0f0;
    border: none;
    color: #ef5350;
    font-size: 13px;
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 3px;
    transition: background 0.2s;
    line-height: 1;
}

.ew-history-clear-btn:hover { background: #fde8e8; }

.ew-history-search {
    padding: 7px;
    border-bottom: 1px solid #dce8fb;
    flex-shrink: 0;
}

.ew-history-search input {
    width: 100%;
    padding: 5px 9px;
    border: 1px solid #c5d8f7;
    border-radius: 4px;
    font-size: 12px;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
    color: #37474f;
    background: #f8faff;
}

.ew-history-search input:focus {
    border-color: #1976d2;
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.12);
}

.ew-history-search input::placeholder { color: #90a4ae; }

.ew-history-list {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* iOS Safari 滑动惯性 */
    padding: 6px;
    background: #fff;
}

.ew-history-list::-webkit-scrollbar { width: 4px; }
.ew-history-list::-webkit-scrollbar-track { background: #f8faff; }
.ew-history-list::-webkit-scrollbar-thumb { background: #c5d8f7; border-radius: 2px; }

.ew-history-empty {
    padding: 24px 12px;
    text-align: center;
    color: #90a4ae;
    font-size: 12px;
    line-height: 1.8;
}

.ew-history-empty small { font-size: 11px; color: #b0bec5; }

.ew-history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    margin: 3px 2px;
    background: #f8faff;
    border: 1px solid #dce8fb;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    animation: ewFadeIn 0.2s ease;
}

.ew-history-item:hover {
    background: #e8f0fe;
    border-color: #90caf9;
    transform: translateX(2px);
}

.ew-history-item.active {
    background: #e3f2fd;
    border-color: #42a5f5;
    box-shadow: 0 1px 4px rgba(66, 165, 245, 0.2);
}

.ew-history-item-main {
    flex: 1;
    min-width: 0;
}

.ew-history-item-word {
    font-weight: 600;
    font-size: 13px;
    color: #1565c0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: 'Georgia', serif;
    margin-bottom: 2px;
}

.ew-history-item-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: #78909c;
}

.ew-history-item-mode {
    background: #e8f0fe;
    color: #1565c0;
    padding: 0 4px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 500;
}

.ew-history-item.active .ew-history-item-mode {
    background: #bbdefb;
}

.ew-history-item-del {
    width: 18px;
    height: 18px;
    background: transparent;
    color: #b0bec5;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.15s;
    flex-shrink: 0;
    margin-left: 4px;
    padding: 0;
}

.ew-history-item:hover .ew-history-item-del {
    opacity: 1;
    background: #ffebee;
    color: #ef5350;
}

/* ========== 中栏：输入面板 ========== */
.ew-input-panel {
    width: 280px;
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid #dce8fb;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ew-panel-header {
    display: flex;
    flex-direction: column;
    padding: 12px 16px 8px;
    background: linear-gradient(to bottom, #f0f7ff 0%, #e8f0fe 100%);
    border-bottom: 1px solid #dce8fb;
    flex-shrink: 0;
}

.ew-panel-header h3 {
    margin: 0 0 3px 0;
    font-size: 13px;
    font-weight: 600;
    color: #1565c0;
}

.ew-panel-tip {
    font-size: 11px;
    color: #78909c;
}

.ew-input-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* iOS Safari 滑动惯性 */
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ew-input-body::-webkit-scrollbar { width: 4px; }
.ew-input-body::-webkit-scrollbar-track { background: #f8faff; }
.ew-input-body::-webkit-scrollbar-thumb { background: #c5d8f7; border-radius: 2px; }

/* 搜索框 */
.ew-search-box {
    display: flex;
    align-items: center;
    border: 2px solid #c5d8f7;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.ew-search-box:focus-within {
    border-color: #1976d2;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

.ew-search-input {
    flex: 1;
    padding: 9px 12px;
    border: none;
    outline: none;
    font-size: 14px;
    color: #263238;
    background: transparent;
    font-family: 'Georgia', 'Times New Roman', serif;
    font-style: italic;
}

.ew-search-input::placeholder {
    color: #90a4ae;
    font-style: italic;
    font-family: 'Georgia', serif;
}

.ew-search-btn {
    padding: 0 14px;
    height: 38px;
    background: linear-gradient(135deg, #1976d2 0%, #0d47a1 100%);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    font-family: 'Georgia', serif;
    transition: all 0.2s;
    letter-spacing: 0.5px;
}

.ew-search-btn:hover {
    background: linear-gradient(135deg, #42a5f5 0%, #1976d2 100%);
}

.ew-search-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 字数统计 */
.ew-char-counter {
    font-size: 11px;
    color: #90a4ae;
    text-align: right;
    margin-top: -6px;
    transition: color 0.2s;
}

.ew-char-counter.warning { color: #ff9800; }
.ew-char-counter.limit   { color: #f44336; font-weight: 600; }

/* 查询模式 */
.ew-mode-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ew-mode-label {
    font-size: 11px;
    font-weight: 600;
    color: #546e7a;
    letter-spacing: 0.3px;
}

.ew-mode-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.ew-mode-option {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 7px 10px;
    border: 1.5px solid #dce8fb;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: #546e7a;
    background: #f8faff;
    transition: all 0.2s;
    user-select: none;
}

.ew-mode-option:hover {
    border-color: #90caf9;
    background: #e8f0fe;
    color: #1565c0;
}

.ew-mode-option.selected {
    border-color: #1976d2;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: #1565c0;
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(25, 118, 210, 0.2);
}

.ew-mode-icon { font-size: 14px; }

/* 模式切换提示 */
.ew-mode-hint {
    font-size: 11px;
    color: #1976d2;
    background: #e3f2fd;
    padding: 4px 8px;
    border-radius: 4px;
    border-left: 3px solid #1976d2;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.3s ease;
}

.ew-mode-hint.visible {
    max-height: 60px;
    opacity: 1;
}

/* 热门单词 */
.ew-quick-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ew-quick-label {
    font-size: 11px;
    font-weight: 600;
    color: #546e7a;
}

.ew-quick-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.ew-quick-tag {
    padding: 3px 10px;
    background: #e8f0fe;
    color: #1565c0;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid #bbdefb;
    transition: all 0.2s;
    font-family: 'Georgia', serif;
    font-style: italic;
}

.ew-quick-tag:hover {
    background: #1976d2;
    color: #fff;
    border-color: #1976d2;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(25, 118, 210, 0.3);
}

/* 使用说明 */
.ew-tips-box {
    background: linear-gradient(135deg, #e8f0fe 0%, #f0f7ff 100%);
    border: 1px solid #c5d8f7;
    border-left: 3px solid #1976d2;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 12px;
    color: #546e7a;
    line-height: 1.6;
}

.ew-tips-box p {
    margin: 0 0 6px 0;
    font-weight: 600;
    color: #1565c0;
}

.ew-tips-box ul {
    margin: 0;
    padding-left: 16px;
}

.ew-tips-box li {
    margin-bottom: 3px;
}

.ew-tips-box strong {
    color: #1565c0;
}

/* ========== 右栏：结果面板 ========== */
.ew-result-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
    overflow: hidden;
    min-width: 300px;
}

.ew-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(to bottom, #f0f7ff 0%, #e8f0fe 100%);
    border-bottom: 1px solid #dce8fb;
    flex-shrink: 0;
}

.ew-result-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #1565c0;
}

.ew-result-meta {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ew-result-word-label {
    font-size: 14px;
    font-weight: 700;
    color: #1565c0;
    font-family: 'Georgia', serif;
    font-style: italic;
}

.ew-result-mode-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: #e3f2fd;
    color: #1565c0;
    font-weight: 500;
    border: 1px solid #bbdefb;
}

.ew-result-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    position: relative;
    -webkit-overflow-scrolling: touch; /* iOS Safari 滑动惯性 */
    scroll-behavior: smooth;
}

.ew-result-body::-webkit-scrollbar { width: 5px; }
.ew-result-body::-webkit-scrollbar-track { background: #f8faff; }
.ew-result-body::-webkit-scrollbar-thumb { background: #c5d8f7; border-radius: 3px; }

/* ========== 占位提示 ========== */
.ew-result-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 40px 20px;
    color: #90a4ae;
    text-align: center;
}

.ew-placeholder-icon {
    font-size: 52px;
    margin-bottom: 16px;
    opacity: 0.6;
    animation: ewPlaceholderFloat 3s ease-in-out infinite;
}

@keyframes ewPlaceholderFloat {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-7px); }
}

.ew-placeholder-title {
    font-size: 16px;
    font-weight: 600;
    color: #546e7a;
    margin: 0 0 12px;
}

.ew-placeholder-desc {
    font-size: 13px;
    color: #90a4ae;
    margin: 4px 0;
    line-height: 1.5;
}

/* ========== 加载动画 ========== */
.ew-result-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 40px 20px;
}

.ew-loading-wave {
    display: flex;
    gap: 5px;
    margin-bottom: 16px;
}

.ew-loading-wave span {
    display: block;
    width: 8px;
    height: 8px;
    background: #1976d2;
    border-radius: 50%;
    animation: ewWave 1.2s ease-in-out infinite;
}

.ew-loading-wave span:nth-child(2) { animation-delay: 0.1s; }
.ew-loading-wave span:nth-child(3) { animation-delay: 0.2s; }
.ew-loading-wave span:nth-child(4) { animation-delay: 0.3s; }
.ew-loading-wave span:nth-child(5) { animation-delay: 0.4s; }

@keyframes ewWave {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30%            { transform: translateY(-10px); opacity: 1; }
}

.ew-loading-text {
    font-size: 13px;
    color: #78909c;
    margin: 0;
    animation: ewBreathText 1.8s ease-in-out infinite;
}

@keyframes ewBreathText {
    0%, 100% { opacity: 0.5; }
    50%      { opacity: 1; }
}

/* ========== AI 结果内容样式 ========== */
.ew-result-content {
    animation: ewFadeIn 0.3s ease;
}

/* blockquote 重置（防止浏览器默认margin缩进异常） */
.ew-result-content blockquote {
    margin: 0;
    padding: 0;
}

/* AI输出通用标签样式兜底（h2/h3/h5/code/strong/a/em） */
.ew-result-content h2,
.ew-result-content h3,
.ew-result-content h5 {
    font-size: 13px;
    font-weight: 700;
    color: #1565c0;
    margin: 12px 0 6px;
    font-family: sans-serif;
    line-height: 1.4;
}

.ew-result-content code {
    background: #e8f0fe;
    color: #1565c0;
    padding: 1px 5px;
    border-radius: 3px;
    font-family: 'Courier New', Consolas, monospace;
    font-size: 12px;
    font-style: normal;
}

.ew-result-content strong {
    color: #1a237e;
    font-weight: 700;
}

.ew-result-content em {
    color: #37474f;
    font-style: italic;
}

.ew-result-content a {
    color: #1976d2;
    text-decoration: none;
    border-bottom: 1px solid rgba(25, 118, 210, 0.3);
    transition: border-color 0.2s;
}

.ew-result-content a:hover {
    border-bottom-color: #1976d2;
}

/* 词条根容器 */
.ew-entry {
    font-family: 'Georgia', 'Times New Roman', serif;
}

/* 词条头部：单词 + 音标 */
.ew-head {
    background: linear-gradient(135deg, #1565c0 0%, #0d47a1 100%);
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 16px;
    color: #fff;
    box-shadow: 0 3px 12px rgba(13, 71, 161, 0.25);
}

.ew-word-main {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
    font-style: italic;
}

.ew-pron {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.ew-pron-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ew-pron-label {
    background: rgba(255, 255, 255, 0.2);
    color: #bbdefb;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 3px;
    font-family: sans-serif;
}

.ew-pron-ipa {
    font-size: 14px;
    color: #e3f2fd;
    font-family: 'Arial', 'Helvetica', sans-serif;
    letter-spacing: 0.5px;
}

/* 词义分组 */
.ew-senses {
    margin-bottom: 14px;
}

.ew-pos-group {
    margin-bottom: 12px;
    padding: 10px 14px;
    background: #f8faff;
    border-radius: 6px;
    border-left: 3px solid #42a5f5;
}

.ew-pos-tag {
    display: inline-block;
    padding: 2px 8px;
    background: #1976d2;
    color: #fff;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    font-family: sans-serif;
    margin-bottom: 6px;
    font-style: normal;
    letter-spacing: 0.3px;
}

/* 词性颜色区分（通过 JS 动态添加类名） */
.ew-pos-tag.pos-verb  { background: #388e3c; }
.ew-pos-tag.pos-adj   { background: #7b1fa2; }
.ew-pos-tag.pos-adv   { background: #e65100; }
.ew-pos-tag.pos-prep  { background: #00838f; }
.ew-pos-tag.pos-pron  { background: #0277bd; }
.ew-pos-tag.pos-conj  { background: #6a1e8c; }

.ew-sense-list {
    margin: 0;
    padding-left: 18px;
}

.ew-sense-list li {
    margin-bottom: 4px;
    font-size: 14px;
    color: #263238;
    line-height: 1.6;
    font-family: sans-serif;
}

/* 各小节容器 */
.ew-section {
    margin-bottom: 14px;
    padding: 12px 14px;
    background: #f8faff;
    border-radius: 6px;
    border: 1px solid #dce8fb;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.ew-section:hover {
    border-color: #90caf9;
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.08);
}

.ew-section h4 {
    margin: 0 0 10px 0;
    font-size: 13px;
    font-weight: 700;
    color: #1565c0;
    font-family: sans-serif;
    display: flex;
    align-items: center;
    gap: 5px;
    padding-bottom: 6px;
    border-bottom: 1px solid #dce8fb;
}

/* 例句 */
.ew-examples {
    margin: 0;
    padding: 0;
    list-style: none;
}

.ew-examples li {
    margin-bottom: 10px;
    padding: 8px 12px;
    background: #fff;
    border-radius: 5px;
    border-left: 3px solid #42a5f5;
}

.ew-example-en {
    display: block;
    font-size: 13px;
    color: #1a237e;
    font-style: italic;
    line-height: 1.5;
    margin-bottom: 4px;
}

.ew-example-zh {
    display: block;
    font-size: 12px;
    color: #546e7a;
    font-family: sans-serif;
    font-style: normal;
    line-height: 1.4;
}

/* 相关词 */
.ew-related-section {
    background: #f0f7ff;
    border-color: #bbdefb;
}

.ew-related-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 2px;
}

.ew-syn-tag,
.ew-ant-tag,
.ew-related-tag {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Georgia', serif;
    font-style: italic;
    display: inline-block;
}

.ew-syn-tag {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.ew-syn-tag:hover {
    background: #2e7d32;
    color: #fff;
    transform: translateY(-1px);
}

.ew-ant-tag {
    background: #fce4ec;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

.ew-ant-tag:hover {
    background: #c62828;
    color: #fff;
    transform: translateY(-1px);
}

.ew-related-tag {
    background: #e8f0fe;
    color: #1565c0;
    border: 1px solid #90caf9;
}

.ew-related-tag:hover {
    background: #1565c0;
    color: #fff;
    transform: translateY(-1px);
}

/* 词素高亮（深度解析模式） */
.ew-morpheme {
    display: inline-block;
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #ffcc80;
    border-radius: 3px;
    padding: 0 5px;
    font-size: 12px;
    font-weight: 600;
    font-style: normal;
    font-family: sans-serif;
}

/* 深度解析 section 样式 */
.ew-section p {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: #37474f;
    line-height: 1.7;
    font-family: sans-serif;
}

.ew-section ul, .ew-section ol {
    margin: 0;
    padding-left: 18px;
}

.ew-section li {
    margin-bottom: 5px;
    font-size: 13px;
    color: #37474f;
    line-height: 1.6;
    font-family: sans-serif;
}

.ew-section table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    font-family: sans-serif;
}

.ew-section th, .ew-section td {
    padding: 6px 10px;
    border: 1px solid #dce8fb;
    text-align: left;
}

.ew-section th {
    background: #e8f0fe;
    color: #1565c0;
    font-weight: 600;
}

/* ========== 错误提示 ========== */
.ew-result-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px 40px;
    text-align: center;
    min-height: 220px;
}

.ew-error-icon { font-size: 40px; margin-bottom: 12px; }

.ew-error-msg {
    font-size: 14px;
    color: #e53935;
    font-weight: 500;
    margin: 0 0 8px;
}

.ew-error-tip {
    font-size: 12px;
    color: #78909c;
    margin: 0;
}

/* 错误重试按钮 */
.ew-result-error-retry {
    margin-top: 16px;
    padding: 8px 24px;
    background: linear-gradient(135deg, #e53935 0%, #b71c1c 100%);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(229, 57, 53, 0.3);
    letter-spacing: 0.3px;
}

.ew-result-error-retry:hover {
    background: linear-gradient(135deg, #ef5350 0%, #e53935 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(229, 57, 53, 0.45);
}

.ew-result-error-retry:active {
    transform: translateY(0);
}

/* ========== 模态框 ========== */
@keyframes meOverlayFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes meModalSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, calc(-50% + 14px)) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.ew-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.38);
    z-index: 100001;
    backdrop-filter: blur(2px);
    animation: meOverlayFadeIn 0.2s ease;
}

.ew-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 540px;
    max-width: calc(100vw - 32px);
    max-height: 80vh;
    background: #fff;
    border-radius: 10px;
    z-index: 100002;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    animation: meModalSlideIn 0.32s cubic-bezier(.34, 1.4, .64, 1) both;
}

.ew-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: linear-gradient(135deg, #1565c0 0%, #0d47a1 100%);
    color: #fff;
    flex-shrink: 0;
}

.ew-modal-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
}

.ew-modal-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ew-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.ew-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* 示例卡片网格 */
.ew-example-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}

.ew-example-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: #f8faff;
    border: 1.5px solid #dce8fb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.ew-example-card:hover {
    background: #e8f0fe;
    border-color: #1976d2;
    box-shadow: 0 3px 10px rgba(25, 118, 210, 0.15);
    transform: translateY(-2px);
}

.ew-example-icon { font-size: 20px; flex-shrink: 0; margin-top: 1px; }

.ew-example-info { flex: 1; min-width: 0; }

.ew-example-word {
    font-size: 15px;
    font-weight: 700;
    color: #1565c0;
    font-family: 'Georgia', serif;
    font-style: italic;
    margin-bottom: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ew-example-type-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    background: #bbdefb;
    color: #1565c0;
    border-radius: 8px;
    font-family: sans-serif;
    margin-bottom: 4px;
    font-style: normal;
}

.ew-example-desc {
    font-size: 11px;
    color: #78909c;
    line-height: 1.4;
    font-family: sans-serif;
}

/* ========== 抖动动画（输入验证） ========== */
@keyframes ewShake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-6px); }
    40%       { transform: translateX(6px); }
    60%       { transform: translateX(-4px); }
    80%       { transform: translateX(4px); }
}

.ew-search-box.shake {
    animation: ewShake 0.4s ease;
    border-color: #ef5350 !important;
}

/* ========== 淡入动画 ========== */
@keyframes ewFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ========== 响应式布局 ========== */
@media (max-width: 900px) {
    .ew-input-panel { width: 240px; }
    .ew-history-panel { width: 160px; }
}

@media (max-width: 720px) {
    .ew-main-content { flex-direction: column; }
    .ew-history-panel { width: 100%; height: 120px; border-right: none; border-bottom: 1px solid #dce8fb; flex-direction: row; overflow: hidden; }
    .ew-history-list { flex-direction: row; overflow-x: auto; overflow-y: hidden; padding: 6px; display: flex; gap: 6px; }
    .ew-history-item { min-width: 120px; }
    .ew-input-panel { width: 100%; border-right: none; border-bottom: 1px solid #dce8fb; }
    .ew-result-panel { min-width: unset; }
}

/* ========== 暗黑模式（body.dark 前缀） ========== */
body.dark .ew-container {
    background: #0f172a;
}

body.dark .ew-toolbar {
    background: linear-gradient(135deg, #0d2a5e 0%, #0a1e45 100%);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

body.dark .ew-toolbar-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #90caf9;
}

body.dark .ew-toolbar-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.18);
}

body.dark .ew-toolbar-btn-primary {
    background: linear-gradient(135deg, #1565c0 0%, #0d47a1 100%) !important;
    color: #fff !important;
}

body.dark .ew-toolbar-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%) !important;
}

body.dark .ew-main-content {
    background: #0f172a;
}

/* 历史面板 */
body.dark .ew-history-panel {
    background: #1e2d40;
    border-right-color: rgba(144, 202, 249, 0.15);
}

body.dark .ew-history-header {
    background: linear-gradient(to bottom, #1a2c42 0%, #162436 100%);
    border-bottom-color: rgba(144, 202, 249, 0.15);
}

body.dark .ew-history-header h3 { color: #90caf9; }

body.dark .ew-history-clear-btn {
    background: rgba(239, 83, 80, 0.15);
    color: #ef9a9a;
}

body.dark .ew-history-search input {
    background: #0f172a;
    border-color: rgba(144, 202, 249, 0.2);
    color: #e2e8f0;
}

body.dark .ew-history-search input::placeholder { color: #4a6070; }

body.dark .ew-history-search input:focus {
    border-color: #42a5f5;
    box-shadow: 0 0 0 2px rgba(66, 165, 245, 0.15);
}

body.dark .ew-history-list { background: #1e2d40; }

body.dark .ew-history-empty { color: #4a6070; }
body.dark .ew-history-empty small { color: #374a5a; }

body.dark .ew-history-item {
    background: #16293d;
    border-color: rgba(144, 202, 249, 0.15);
}

body.dark .ew-history-item:hover {
    background: #1e3550;
    border-color: rgba(66, 165, 245, 0.4);
}

body.dark .ew-history-item.active {
    background: #1a3760;
    border-color: #42a5f5;
}

body.dark .ew-history-item-word { color: #90caf9; }
body.dark .ew-history-item-meta { color: #4a6070; }
body.dark .ew-history-item-mode { background: rgba(144, 202, 249, 0.12); color: #90caf9; }

/* 输入面板 */
body.dark .ew-input-panel {
    background: #1e2d40;
    border-right-color: rgba(144, 202, 249, 0.15);
}

body.dark .ew-panel-header {
    background: linear-gradient(to bottom, #1a2c42 0%, #162436 100%);
    border-bottom-color: rgba(144, 202, 249, 0.15);
}

body.dark .ew-panel-header h3 { color: #90caf9; }
body.dark .ew-panel-tip { color: #4a6070; }

body.dark .ew-input-body::-webkit-scrollbar-track { background: #162436; }
body.dark .ew-input-body::-webkit-scrollbar-thumb { background: rgba(144, 202, 249, 0.2); }

body.dark .ew-search-box {
    background: #0f172a;
    border-color: rgba(144, 202, 249, 0.2);
}

body.dark .ew-search-box:focus-within {
    border-color: #42a5f5;
    box-shadow: 0 0 0 3px rgba(66, 165, 245, 0.12);
}

body.dark .ew-search-input {
    color: #e2e8f0;
    background: transparent;
}

body.dark .ew-search-input::placeholder { color: #4a6070; }

body.dark .ew-search-btn {
    background: linear-gradient(135deg, #1565c0 0%, #0d47a1 100%);
}

body.dark .ew-char-counter         { color: #4a6070; }
body.dark .ew-char-counter.warning { color: #ffa726; }  /* 暗黑下警告橙，高于 body.dark .ew-char-counter 特异性 */
body.dark .ew-char-counter.limit   { color: #ef5350; font-weight: 600; }  /* 暗黑下超限红 */

body.dark .ew-mode-label { color: #78909c; }

body.dark .ew-mode-option {
    background: #162436;
    border-color: rgba(144, 202, 249, 0.18);
    color: #78909c;
}

body.dark .ew-mode-option:hover {
    background: #1a3550;
    border-color: #42a5f5;
    color: #90caf9;
}

body.dark .ew-mode-option.selected {
    background: linear-gradient(135deg, #1a3760 0%, #162e50 100%);
    border-color: #42a5f5;
    color: #90caf9;
}

body.dark .ew-mode-hint {
    background: rgba(66, 165, 245, 0.1);
    color: #64b5f6;
    border-left-color: #42a5f5;
}

body.dark .ew-quick-label { color: #78909c; }

body.dark .ew-quick-tag {
    background: rgba(144, 202, 249, 0.1);
    color: #90caf9;
    border-color: rgba(144, 202, 249, 0.2);
}

body.dark .ew-quick-tag:hover {
    background: #1976d2;
    color: #fff;
    border-color: #1976d2;
}

body.dark .ew-tips-box {
    background: linear-gradient(135deg, rgba(21, 101, 192, 0.15) 0%, rgba(15, 23, 42, 0.5) 100%);
    border-color: rgba(144, 202, 249, 0.2);
    border-left-color: #42a5f5;
    color: #78909c;
}

body.dark .ew-tips-box p { color: #90caf9; }
body.dark .ew-tips-box strong { color: #90caf9; }

/* 结果面板 */
body.dark .ew-result-panel { background: #1e2d40; }

body.dark .ew-result-header {
    background: linear-gradient(to bottom, #1a2c42 0%, #162436 100%);
    border-bottom-color: rgba(144, 202, 249, 0.15);
}

body.dark .ew-result-header h3 { color: #90caf9; }
body.dark .ew-result-word-label { color: #90caf9; }
body.dark .ew-result-mode-badge { background: rgba(144, 202, 249, 0.1); color: #90caf9; border-color: rgba(144, 202, 249, 0.2); }

body.dark .ew-result-body::-webkit-scrollbar-track { background: #162436; }
body.dark .ew-result-body::-webkit-scrollbar-thumb { background: rgba(144, 202, 249, 0.2); }

body.dark .ew-placeholder-title { color: #78909c; }
body.dark .ew-placeholder-desc  { color: #4a6070; }

body.dark .ew-loading-wave span { background: #42a5f5; }
body.dark .ew-loading-text { color: #4a6070; }

body.dark .ew-error-msg { color: #ef9a9a; }
body.dark .ew-error-tip { color: #4a6070; }
body.dark .ew-result-error-retry {
    background: linear-gradient(135deg, #7f1010 0%, #5c0a0a 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
body.dark .ew-result-error-retry:hover {
    background: linear-gradient(135deg, #9c1515 0%, #7f1010 100%);
}

/* AI结果内容暗黑 */
body.dark .ew-head {
    background: linear-gradient(135deg, #0d2a5e 0%, #0a1e45 100%);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
}

body.dark .ew-pos-group {
    background: #162436;
    border-left-color: #1976d2;
}

body.dark .ew-sense-list li { color: #c5d8f7; }

body.dark .ew-section {
    background: #162436;
    border-color: rgba(144, 202, 249, 0.15);
}

body.dark .ew-section:hover {
    border-color: rgba(66, 165, 245, 0.4);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

body.dark .ew-section h4 {
    color: #90caf9;
    border-bottom-color: rgba(144, 202, 249, 0.15);
}

body.dark .ew-section p,
body.dark .ew-section li { color: #90a4ae; }

body.dark .ew-section th { background: rgba(21, 101, 192, 0.3); color: #90caf9; }
body.dark .ew-section td { border-color: rgba(144, 202, 249, 0.15); color: #90a4ae; }

body.dark .ew-examples li {
    background: #1e2d40;
    border-left-color: #1976d2;
}

body.dark .ew-example-en { color: #90caf9; }
body.dark .ew-example-zh { color: #78909c; }

body.dark .ew-related-section { background: rgba(21, 101, 192, 0.1); border-color: rgba(144, 202, 249, 0.15); }

body.dark .ew-syn-tag { background: rgba(46, 125, 50, 0.2); color: #81c784; border-color: rgba(129, 199, 132, 0.3); }
body.dark .ew-syn-tag:hover { background: #2e7d32; color: #fff; }

body.dark .ew-ant-tag { background: rgba(198, 40, 40, 0.15); color: #ef9a9a; border-color: rgba(239, 154, 154, 0.3); }
body.dark .ew-ant-tag:hover { background: #c62828; color: #fff; }

body.dark .ew-related-tag { background: rgba(21, 101, 192, 0.15); color: #90caf9; border-color: rgba(144, 202, 249, 0.25); }
body.dark .ew-related-tag:hover { background: #1565c0; color: #fff; }

body.dark .ew-morpheme { background: rgba(230, 81, 0, 0.15); color: #ffb74d; border-color: rgba(255, 183, 77, 0.3); }

/* AI输出通用标签暗黑覆盖 */
body.dark .ew-result-content h2,
body.dark .ew-result-content h3,
body.dark .ew-result-content h5 { color: #90caf9; }

body.dark .ew-result-content code {
    background: rgba(144, 202, 249, 0.12);
    color: #90caf9;
}

body.dark .ew-result-content strong { color: #c5d8f7; }
body.dark .ew-result-content em { color: #78909c; }

body.dark .ew-result-content a {
    color: #64b5f6;
    border-bottom-color: rgba(100, 181, 246, 0.3);
}

body.dark .ew-result-content a:hover { border-bottom-color: #64b5f6; }

/* 模态框暗黑 */
body.dark .ew-modal {
    background: #1e2d40;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

body.dark .ew-modal-body { background: #1e2d40; }

body.dark .ew-example-card {
    background: #162436;
    border-color: rgba(144, 202, 249, 0.15);
}

body.dark .ew-example-card:hover {
    background: #1a3550;
    border-color: #42a5f5;
}

body.dark .ew-example-word { color: #90caf9; }
body.dark .ew-example-type-badge { background: rgba(144, 202, 249, 0.15); color: #90caf9; }
body.dark .ew-example-desc { color: #4a6070; }

body.dark .ew-modal-overlay { background: rgba(0, 0, 0, 0.6); }

/* ========== 进度条 ========== */
.ew-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.15);
    overflow: hidden;
    z-index: 10;
}

.ew-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #64b5f6 0%, #81d4fa 100%);
    transition: width 0.25s ease-out;
}

.ew-progress-fill.complete {
    background: linear-gradient(90deg, #4caf50 0%, #00bcd4 100%);
    animation: ewProgressPulse 0.5s ease-in-out 2;
}

@keyframes ewProgressPulse {
    0%, 100% { filter: brightness(1); }
    50%       { filter: brightness(1.7); }
}

/* ========== Toast 提示 ========== */
.ew-toast-container {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.ew-toast {
    padding: 9px 20px;
    background: #323232;
    color: #fff;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.28s ease, transform 0.28s ease;
    pointer-events: none;
    white-space: nowrap;
    max-width: 320px;
}

.ew-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.ew-toast.success { background: #2e7d32; }
.ew-toast.warn    { background: #e65100; }
.ew-toast.info    { background: #37474f; }

body.dark .ew-toast         { background: #455a64; }
body.dark .ew-toast.success { background: #1b5e20; }
body.dark .ew-toast.warn    { background: #bf360c; }
body.dark .ew-toast.info    { background: #263238; }
