/* ===================================================================
   脑筋急转弯 (Brain Teasers) - 专属样式
   主题色：智慧紫 #7c3aed → 活力青 #0891b2 → 趣味黄 #f59e0b
   =================================================================== */

/* ---- CSS 变量 ---- */
:root {
    --bt-primary:       #7c3aed;
    --bt-primary-dark:  #6d28d9;
    --bt-secondary:     #0891b2;
    --bt-accent:        #f59e0b;
    --bt-accent-light:  #fde68a;
    --bt-green:         #059669;
    --bt-bg:            #f5f3ff;
    --bt-surface:       #ffffff;
    --bt-surface2:      #ede9fe;
    --bt-border:        #ddd6fe;
    --bt-border2:       #c4b5fd;
    --bt-text:          #1e1b4b;
    --bt-text2:         #2e1065;
    --bt-text-muted:    #6d28d9;
    --bt-toolbar-bg:    linear-gradient(100deg, #1e1b4b 0%, #2e1065 40%, #0c4a6e 100%);
    --bt-toolbar-text:  #ede9fe;
    --bt-shadow:        0 2px 12px rgba(124, 58, 237, .1);
    --bt-shadow-md:     0 4px 24px rgba(124, 58, 237, .15);
    --bt-radius:        10px;
    --bt-radius-sm:     6px;
    --bt-toolbar-h:     52px;
    --bt-history-w:     220px;
    --bt-config-w:      300px;
}

/* 暗黑模式变量 */
body.dark {
    --bt-bg:        #13111f;
    --bt-surface:   #1c1730;
    --bt-surface2:  #1a1428;
    --bt-border:    #2e2653;
    --bt-border2:   #3d3470;
    --bt-text:      #ede9fe;
    --bt-text2:     #ddd6fe;
    --bt-text-muted:#a78bfa;
    --bt-shadow:    0 2px 12px rgba(0,0,0,.45);
    --bt-shadow-md: 0 4px 24px rgba(0,0,0,.55);
}

/* ===== 主容器 ===== */
.bt-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 130px);
    min-height: 500px;
    background: var(--bt-bg);
    border: 1px solid var(--bt-border);
    border-radius: var(--bt-radius);
    overflow: hidden;
    box-shadow: var(--bt-shadow-md);
    transition: background .25s, border-color .25s;
}

.bt-container.fullscreen-mode {
    position: fixed;
    inset: 0;
    z-index: 9999;
    height: 100vh !important;
    border-radius: 0;
    border: none;
}

/* ===== 工具栏 ===== */
.bt-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    height: var(--bt-toolbar-h);
    background: var(--bt-toolbar-bg);
    color: var(--bt-toolbar-text);
    flex-shrink: 0;
    flex-wrap: wrap;
    position: relative;
    overflow: hidden;
}

/* 工具栏彩虹装饰条 */
.bt-toolbar::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(to right,
        #7c3aed, #0891b2, #f59e0b, #059669,
        #7c3aed, #ec4899, #0891b2);
    background-size: 200% 100%;
    opacity: .9;
    animation: btBarShimmer 5s ease-in-out infinite;
}

@keyframes btBarShimmer {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.toolbar-title {
    font-size: 14px;
    font-weight: 700;
    color: #c4b5fd;
    letter-spacing: .3px;
    white-space: nowrap;
    margin-right: 4px;
    text-shadow: 0 0 12px rgba(124,58,237,.6);
}

.bt-toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 11px;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 5px;
    background: rgba(255,255,255,.08);
    color: #ddd6fe;
    font-size: 12.5px;
    cursor: pointer;
    white-space: nowrap;
    transition: background .18s, border-color .18s, color .18s;
}
.bt-toolbar-btn:hover {
    background: rgba(255,255,255,.18);
    border-color: rgba(255,255,255,.35);
    color: #fff;
}
.bt-toolbar-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.bt-toolbar-btn-primary {
    background: linear-gradient(135deg, #7c3aed, #6d28d9) !important;
    border-color: transparent !important;
    color: #fff !important;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(124,58,237,.45);
}
.bt-toolbar-btn-primary:hover {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed) !important;
    box-shadow: 0 4px 14px rgba(124,58,237,.6);
}
.bt-toolbar-btn-primary.bt-btn-loading {
    background: linear-gradient(90deg, #3b0764, #7c3aed, #3b0764, #4c1d95) !important;
    background-size: 300% 100% !important;
    animation: btShimmer .8s infinite linear;
    box-shadow: none;
}

.bt-toolbar-btn-cancel {
    background: rgba(239,68,68,.18) !important;
    border-color: rgba(239,68,68,.35) !important;
    color: #fca5a5 !important;
}
.bt-toolbar-btn-cancel:hover {
    background: rgba(239,68,68,.32) !important;
}

@keyframes btShimmer {
    0%   { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
}

body.dark .bt-toolbar-btn-primary.bt-btn-loading {
    background: linear-gradient(90deg, #3b0764, #4c1d95, #3b0764, #2e1065) !important;
    background-size: 300% 100% !important;
    animation: btShimmer .8s infinite linear;
}

/* ===== 计数徽章（工具栏内） ===== */
.bt-stat-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.2);
    font-size: 12px;
    color: #c4b5fd;
    white-space: nowrap;
}
.bt-stat-num {
    font-weight: 700;
    color: #f59e0b;
}

/* ===== 主内容区 ===== */
.bt-main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ===== 历史记录面板（左） ===== */
.bt-history-panel {
    width: var(--bt-history-w);
    min-width: 180px;
    display: flex;
    flex-direction: column;
    background: var(--bt-surface2);
    border-right: 1px solid var(--bt-border);
    transition: background .25s, border-color .25s;
    flex-shrink: 0;
}

.bt-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px 10px;
    border-bottom: 1px solid var(--bt-border);
    flex-shrink: 0;
}
.bt-history-header h3 {
    margin: 0;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--bt-text2);
    white-space: nowrap;
}

.bt-history-count {
    font-size: 11px;
    color: var(--bt-text-muted);
    font-weight: 400;
    margin-left: 4px;
}

.bt-history-clear-btn {
    background: none;
    border: none;
    color: var(--bt-text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 2px 4px;
    border-radius: 4px;
    transition: color .18s, background .18s;
    line-height: 1;
}
.bt-history-clear-btn:hover {
    color: #ef4444;
    background: rgba(239,68,68,.1);
}

.bt-history-search {
    padding: 8px 10px;
    border-bottom: 1px solid var(--bt-border);
    flex-shrink: 0;
}
.bt-history-search input {
    width: 100%;
    padding: 5px 9px;
    border: 1px solid var(--bt-border);
    border-radius: 5px;
    font-size: 12px;
    background: var(--bt-surface);
    color: var(--bt-text);
    outline: none;
    transition: border-color .18s;
    box-sizing: border-box;
}
.bt-history-search input:focus {
    border-color: var(--bt-primary);
}
body.dark .bt-history-search input {
    background: var(--bt-surface2);
}

.bt-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
}

.bt-history-empty {
    text-align: center;
    color: var(--bt-text-muted);
    font-size: 12px;
    padding: 24px 8px;
    opacity: .7;
}

.bt-history-item {
    position: relative;
    padding: 10px 28px 10px 11px;
    border-radius: 7px;
    cursor: pointer;
    margin-bottom: 4px;
    border: 1px solid transparent;
    transition: background .18s, border-color .18s;
    background: var(--bt-surface);
}
.bt-history-item:hover {
    border-color: var(--bt-border2);
}
.bt-history-item.active {
    background: rgba(124,58,237,.08);
    border-color: rgba(124,58,237,.35);
}
body.dark .bt-history-item {
    background: rgba(255,255,255,.04);
}
body.dark .bt-history-item:hover {
    background: rgba(255,255,255,.08);
}
body.dark .bt-history-item.active {
    background: rgba(124,58,237,.15);
}

.bt-history-item-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--bt-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}

.bt-history-item-meta {
    font-size: 11px;
    color: var(--bt-text-muted);
    display: flex;
    gap: 4px;
    align-items: center;
    flex-wrap: wrap;
}

.bt-history-tag {
    background: rgba(124,58,237,.12);
    color: var(--bt-primary-dark);
    border-radius: 3px;
    padding: 0 4px;
    font-size: 10.5px;
    font-weight: 500;
}
body.dark .bt-history-tag {
    background: rgba(124,58,237,.22);
    color: #a78bfa;
}

/* 历史记录 - 难度标签颜色区分 */
.bt-history-tag.bt-history-tag-easy   { background: rgba(5,150,105,.12); color: #059669; }
.bt-history-tag.bt-history-tag-medium { background: rgba(245,158,11,.12); color: #b45309; }
.bt-history-tag.bt-history-tag-hard   { background: rgba(220,38,38,.12);  color: #dc2626; }
body.dark .bt-history-tag.bt-history-tag-easy   { background: rgba(5,150,105,.22);  color: #34d399; }
body.dark .bt-history-tag.bt-history-tag-medium { background: rgba(245,158,11,.22); color: #fbbf24; }
body.dark .bt-history-tag.bt-history-tag-hard   { background: rgba(220,38,38,.22);  color: #f87171; }

.bt-history-del-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--bt-text-muted);
    cursor: pointer;
    font-size: 11px;
    padding: 2px 4px;
    border-radius: 3px;
    opacity: 0;
    transition: opacity .18s, color .18s, background .18s;
}
.bt-history-item:hover .bt-history-del-btn {
    opacity: 1;
}
.bt-history-del-btn:hover {
    color: #ef4444;
    background: rgba(239,68,68,.1);
}

/* ===== 配置面板（中） ===== */
.bt-config-panel {
    width: var(--bt-config-w);
    min-width: 260px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--bt-border);
    background: var(--bt-surface);
    transition: background .25s, border-color .25s;
    flex-shrink: 0;
}

.bt-panel-header {
    padding: 10px 16px;
    border-bottom: 1px solid var(--bt-border);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 4px;
    min-height: 44px;
}
.bt-panel-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    color: var(--bt-text);
}
.bt-panel-tip {
    font-size: 11px;
    color: var(--bt-text-muted);
}

.bt-config-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.bt-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bt-section-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--bt-text2);
    display: flex;
    align-items: center;
    gap: 4px;
}
.bt-optional {
    font-size: 11px;
    color: var(--bt-text-muted);
    font-weight: 400;
}

/* 字数统计 */
.bt-char-count {
    font-size: 11px;
    color: var(--bt-text-muted);
    font-weight: 400;
    margin-left: auto;
    transition: color .18s;
}
.bt-char-count.near-limit { color: var(--bt-accent); }
.bt-char-count.at-limit   { color: #dc2626; }
body.dark .bt-char-count.at-limit { color: #f87171; }

/* 主题输入框 */
.bt-input {
    width: 100%;
    padding: 8px 11px;
    border: 1.5px solid var(--bt-border);
    border-radius: 7px;
    font-size: 13px;
    color: var(--bt-text);
    background: var(--bt-surface);
    outline: none;
    transition: border-color .18s, box-shadow .18s;
    box-sizing: border-box;
    font-family: inherit;
}
.bt-input:focus {
    border-color: var(--bt-primary);
    box-shadow: 0 0 0 3px rgba(124,58,237,.1);
}
body.dark .bt-input {
    background: var(--bt-surface2);
    border-color: var(--bt-border);
    color: var(--bt-text);
}
body.dark .bt-input::placeholder {
    color: var(--bt-text-muted);
    opacity: .7;
}

/* 主题标签快速选择 */
.bt-theme-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.bt-theme-tag-btn {
    padding: 4px 10px;
    border: 1.5px solid var(--bt-border);
    border-radius: 20px;
    background: var(--bt-surface);
    cursor: pointer;
    font-size: 12px;
    color: var(--bt-text2);
    white-space: nowrap;
    transition: all .18s;
}
.bt-theme-tag-btn:hover,
.bt-theme-tag-btn.active {
    border-color: var(--bt-secondary);
    background: rgba(8,145,178,.1);
    color: var(--bt-secondary);
}
body.dark .bt-theme-tag-btn {
    background: var(--bt-surface2);
    border-color: var(--bt-border);
    color: var(--bt-text);
}
body.dark .bt-theme-tag-btn:hover,
body.dark .bt-theme-tag-btn.active {
    border-color: #22d3ee;
    background: rgba(8,145,178,.18);
    color: #22d3ee;
}

/* 难度选择 */
.bt-difficulty-row {
    display: flex;
    gap: 6px;
}

.bt-diff-btn {
    flex: 1;
    padding: 8px 4px;
    border: 1.5px solid var(--bt-border);
    border-radius: 8px;
    background: var(--bt-surface);
    cursor: pointer;
    font-size: 12px;
    color: var(--bt-text2);
    text-align: center;
    transition: all .18s;
    font-weight: 500;
}
.bt-diff-btn .diff-icon {
    display: block;
    font-size: 18px;
    margin-bottom: 2px;
}
.bt-diff-btn .diff-label {
    display: block;
    font-size: 11.5px;
    font-weight: 600;
}
.bt-diff-btn.diff-easy.selected {
    border-color: #059669;
    background: rgba(5,150,105,.1);
    color: #059669;
    box-shadow: 0 0 0 2px rgba(5,150,105,.2);
}
.bt-diff-btn.diff-medium.selected {
    border-color: var(--bt-accent);
    background: rgba(245,158,11,.1);
    color: #b45309;
    box-shadow: 0 0 0 2px rgba(245,158,11,.2);
}
.bt-diff-btn.diff-hard.selected {
    border-color: #dc2626;
    background: rgba(220,38,38,.08);
    color: #dc2626;
    box-shadow: 0 0 0 2px rgba(220,38,38,.2);
}
.bt-diff-btn:not(.selected):hover {
    border-color: var(--bt-border2);
    background: var(--bt-surface2);
}
body.dark .bt-diff-btn {
    background: var(--bt-surface2);
    border-color: var(--bt-border);
    color: var(--bt-text);
}
body.dark .bt-diff-btn.diff-easy.selected {
    border-color: #34d399;
    background: rgba(5,150,105,.18);
    color: #34d399;
}
body.dark .bt-diff-btn.diff-medium.selected {
    border-color: #fbbf24;
    background: rgba(245,158,11,.18);
    color: #fbbf24;
}
body.dark .bt-diff-btn.diff-hard.selected {
    border-color: #f87171;
    background: rgba(220,38,38,.18);
    color: #f87171;
}

/* 数量滑块 */
.bt-count-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bt-count-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.bt-count-num {
    font-size: 22px;
    font-weight: 800;
    color: var(--bt-primary);
    line-height: 1;
}
body.dark .bt-count-num {
    color: #a78bfa;
}

.bt-count-unit {
    font-size: 13px;
    font-weight: 500;
    color: var(--bt-text-muted);
    margin-left: 3px;
}

.bt-count-quick {
    display: flex;
    gap: 5px;
}

.bt-count-quick-btn {
    padding: 3px 10px;
    border: 1.5px solid var(--bt-border);
    border-radius: 4px;
    background: var(--bt-surface);
    cursor: pointer;
    font-size: 12px;
    color: var(--bt-text2);
    font-weight: 600;
    transition: all .18s;
}
.bt-count-quick-btn:hover,
.bt-count-quick-btn.active {
    border-color: var(--bt-primary);
    background: rgba(124,58,237,.1);
    color: var(--bt-primary);
}
body.dark .bt-count-quick-btn {
    background: var(--bt-surface2);
    border-color: var(--bt-border);
    color: var(--bt-text);
}
body.dark .bt-count-quick-btn:hover,
body.dark .bt-count-quick-btn.active {
    border-color: #a78bfa;
    background: rgba(124,58,237,.2);
    color: #a78bfa;
}

.bt-count-slider {
    width: 100%;
    accent-color: var(--bt-primary);
    cursor: pointer;
}

/* 特别要求 */
.bt-extra-input {
    width: 100%;
    padding: 8px 11px;
    border: 1.5px solid var(--bt-border);
    border-radius: 7px;
    font-size: 12.5px;
    color: var(--bt-text);
    background: var(--bt-surface);
    outline: none;
    transition: border-color .18s, box-shadow .18s;
    box-sizing: border-box;
    font-family: inherit;
    resize: none;
    line-height: 1.5;
}
.bt-extra-input:focus {
    border-color: var(--bt-primary);
    box-shadow: 0 0 0 3px rgba(124,58,237,.1);
}
body.dark .bt-extra-input {
    background: var(--bt-surface2);
    border-color: var(--bt-border);
    color: var(--bt-text);
}

/* 配置面板底部操作 */
.bt-config-footer {
    padding: 12px 14px;
    border-top: 1px solid var(--bt-border);
    flex-shrink: 0;
    display: flex;
    gap: 8px;
}

.bt-inline-btn {
    flex: 1;
    padding: 9px 0;
    border: none;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .18s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}
.bt-inline-btn-primary {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: #fff;
    box-shadow: 0 2px 8px rgba(124,58,237,.35);
}
.bt-inline-btn-primary:hover {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    box-shadow: 0 4px 14px rgba(124,58,237,.5);
}
.bt-inline-btn-primary.bt-btn-loading {
    background: linear-gradient(90deg, #3b0764, #7c3aed, #3b0764, #4c1d95);
    background-size: 300% 100%;
    animation: btShimmer .8s infinite linear;
    box-shadow: none;
}
.bt-inline-btn-cancel {
    background: rgba(239,68,68,.1);
    color: #dc2626;
    border: 1.5px solid rgba(239,68,68,.25);
    flex: none;
    padding: 9px 14px;
}
.bt-inline-btn-cancel:hover {
    background: rgba(239,68,68,.18);
}
body.dark .bt-inline-btn-cancel {
    color: #fca5a5;
    border-color: rgba(239,68,68,.35);
}

/* ===== 结果面板（右） ===== */
.bt-result-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--bt-surface);
    transition: background .25s;
    overflow: hidden;
}

.bt-result-header {
    padding: 10px 16px;
    border-bottom: 1px solid var(--bt-border);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    gap: 8px;
    flex-wrap: wrap;
}
.bt-result-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    color: var(--bt-text);
    white-space: nowrap;
}

.bt-result-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.bt-result-action-btn {
    padding: 4px 10px;
    border: 1.5px solid var(--bt-border);
    border-radius: 5px;
    background: var(--bt-surface2);
    cursor: pointer;
    font-size: 12px;
    color: var(--bt-text2);
    white-space: nowrap;
    transition: all .18s;
    font-weight: 500;
}
.bt-result-action-btn:hover {
    border-color: var(--bt-primary);
    color: var(--bt-primary);
    background: rgba(124,58,237,.08);
}
body.dark .bt-result-action-btn {
    background: var(--bt-surface2);
    border-color: var(--bt-border);
    color: var(--bt-text);
}
body.dark .bt-result-action-btn:hover {
    border-color: #a78bfa;
    color: #a78bfa;
}

.bt-reveal-all-btn {
    padding: 4px 10px;
    border: 1.5px solid rgba(5,150,105,.4);
    border-radius: 5px;
    background: rgba(5,150,105,.08);
    cursor: pointer;
    font-size: 12px;
    color: #059669;
    font-weight: 600;
    transition: all .18s;
}
.bt-reveal-all-btn:hover {
    background: rgba(5,150,105,.15);
    border-color: #059669;
}
body.dark .bt-reveal-all-btn {
    color: #34d399;
    border-color: rgba(52,211,153,.4);
    background: rgba(5,150,105,.12);
}
body.dark .bt-reveal-all-btn:hover {
    background: rgba(5,150,105,.22);
}

.bt-result-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    position: relative;
}

/* ===== 占位区 ===== */
.bt-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
    text-align: center;
    padding: 20px;
    gap: 12px;
}

.bt-placeholder-brain {
    font-size: 64px;
    line-height: 1;
    animation: btBrainPulse 2s ease-in-out infinite;
}

@keyframes btBrainPulse {
    0%, 100% { transform: scale(1) rotate(-5deg); }
    50%       { transform: scale(1.1) rotate(5deg); }
}

.bt-placeholder-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--bt-text2);
    margin: 0;
}

.bt-placeholder-desc {
    font-size: 13px;
    color: var(--bt-text-muted);
    margin: 0;
    line-height: 1.6;
    max-width: 320px;
}

.bt-placeholder-steps {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 4px;
}

.bt-placeholder-step {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 20px;
    background: rgba(124,58,237,.08);
    border: 1px solid rgba(124,58,237,.2);
    font-size: 12px;
    color: var(--bt-primary);
    font-weight: 500;
}
body.dark .bt-placeholder-step {
    background: rgba(124,58,237,.15);
    border-color: rgba(167,139,250,.3);
    color: #a78bfa;
}

/* ===== 加载动画 ===== */
.bt-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
    gap: 18px;
}

.bt-loading-icons {
    display: flex;
    gap: 10px;
    height: 48px;
    align-items: center;
}
.bt-loading-icon {
    font-size: 24px;
    animation: btIconSpin 1.4s ease-in-out infinite;
}
.bt-loading-icon:nth-child(1) { animation-delay: 0s; }
.bt-loading-icon:nth-child(2) { animation-delay: .2s; }
.bt-loading-icon:nth-child(3) { animation-delay: .4s; }
.bt-loading-icon:nth-child(4) { animation-delay: .6s; }

@keyframes btIconSpin {
    0%, 100% { transform: translateY(0) scale(1); opacity: .8; }
    50%       { transform: translateY(-16px) scale(1.2); opacity: 1; }
}

.bt-loading-dots {
    display: flex;
    gap: 7px;
}
.bt-loading-dots span {
    width: 9px; height: 9px;
    border-radius: 50%;
    animation: btDotBounce 1s ease-in-out infinite;
}
.bt-loading-dots span:nth-child(1) { background: var(--bt-primary); }
.bt-loading-dots span:nth-child(2) { background: var(--bt-secondary); animation-delay: .15s; }
.bt-loading-dots span:nth-child(3) { background: var(--bt-accent);    animation-delay: .3s;  }

@keyframes btDotBounce {
    0%, 100% { transform: translateY(0); opacity: .7; }
    50%       { transform: translateY(-10px); opacity: 1; }
}

.bt-loading-text {
    font-size: 13.5px;
    color: var(--bt-text-muted);
    margin: 0;
    animation: btTextPulse 2s ease-in-out infinite;
}

body.dark .bt-loading-text {
    color: #94a3b8;
}

@keyframes btTextPulse {
    0%, 100% { opacity: .7; }
    50%       { opacity: 1; }
}

/* ===== 结果内容区 ===== */
.bt-result-content {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* 进度条（显示揭晓数量） */
.bt-progress-bar-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--bt-border);
}

.bt-progress-bar {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--bt-border);
    overflow: hidden;
}

.bt-progress-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(to right, var(--bt-primary), var(--bt-secondary));
    transition: width .4s ease;
}

/* 全部揭晓完成态 */
.bt-progress-fill.bt-progress-complete {
    background: linear-gradient(to right, #059669, #34d399, #0891b2);
    animation: btProgressComplete 1.5s ease-in-out 2;
}
@keyframes btProgressComplete {
    0%, 100% { filter: brightness(1); }
    50%       { filter: brightness(1.25); }
}

.bt-progress-text {
    font-size: 12px;
    color: var(--bt-text-muted);
    white-space: nowrap;
    font-weight: 600;
}

/* ===== 题目卡片 ===== */
.bt-riddle-card {
    border: 1.5px solid var(--bt-border);
    border-left: 3px solid var(--bt-primary);
    border-radius: 10px;
    overflow: hidden;
    background: var(--bt-surface);
    transition: border-color .2s, box-shadow .2s, transform .15s;
    box-shadow: var(--bt-shadow);
}
.bt-riddle-card:hover {
    border-color: var(--bt-border2);
    border-left-color: var(--bt-primary);
    box-shadow: 0 4px 16px rgba(124,58,237,.12);
    transform: translateY(-1px);
}
.bt-riddle-card.revealed {
    border-color: rgba(5,150,105,.4);
    border-left-color: #059669;
    background: rgba(5,150,105,.02);
}
body.dark .bt-riddle-card {
    background: var(--bt-surface);
    border-color: var(--bt-border);
    border-left-color: var(--bt-primary);  /* 保留左侧 accent 边框 */
}
body.dark .bt-riddle-card:hover {
    border-color: var(--bt-border2);
    border-left-color: var(--bt-primary);  /* 保留左侧 accent 边框 */
    box-shadow: 0 4px 20px rgba(0,0,0,.4);
}
body.dark .bt-riddle-card.revealed {
    border-color: rgba(52,211,153,.35);
    border-left-color: #34d399;
    background: rgba(5,150,105,.05);
}

.bt-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px 0;
}

.bt-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--bt-primary), var(--bt-primary-dark));
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    flex-shrink: 0;
}
.bt-riddle-card.revealed .bt-number {
    background: linear-gradient(135deg, #059669, #047857);
}

.bt-tags {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.bt-tag {
    padding: 2px 7px;
    border-radius: 3px;
    font-size: 10.5px;
    font-weight: 600;
    background: rgba(8,145,178,.1);
    color: var(--bt-secondary);
    border: 1px solid rgba(8,145,178,.25);
}
body.dark .bt-tag {
    background: rgba(8,145,178,.18);
    color: #22d3ee;
    border-color: rgba(8,145,178,.35);
}

.bt-question {
    padding: 12px 14px 8px;
    font-size: 14.5px;
    font-weight: 600;
    color: var(--bt-text);
    line-height: 1.6;
}

.bt-hint {
    padding: 0 14px 8px;
    font-size: 12px;
    color: var(--bt-accent);
    line-height: 1.5;
    font-style: italic;
}
body.dark .bt-hint {
    color: #fbbf24;
}

.bt-answer-box {
    padding: 0 14px 14px;
}

.bt-reveal-btn {
    width: 100%;
    padding: 8px 14px;
    border: 2px dashed var(--bt-border2);
    border-radius: 7px;
    background: rgba(124,58,237,.04);
    color: var(--bt-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.bt-reveal-btn:hover {
    border-color: var(--bt-primary);
    background: rgba(124,58,237,.1);
    transform: scale(1.01);
}
.bt-reveal-btn.hidden-after-reveal {
    display: none;
}
body.dark .bt-reveal-btn {
    border-color: var(--bt-border2);
    background: rgba(124,58,237,.08);
    color: #a78bfa;
}
body.dark .bt-reveal-btn:hover {
    border-color: #a78bfa;
    background: rgba(124,58,237,.18);
}

.bt-answer-text {
    margin-top: 8px;
    padding: 10px 14px;
    background: linear-gradient(135deg, rgba(5,150,105,.07) 0%, rgba(8,145,178,.07) 100%);
    border: 1.5px solid rgba(5,150,105,.3);
    border-radius: 8px;
    font-size: 13.5px;
    color: var(--bt-text);
    line-height: 1.6;
    animation: btAnswerReveal .35s ease;
}
.bt-answer-text strong {
    color: #059669;
    font-size: 15px;
}
.bt-answer-text em {
    color: var(--bt-text-muted);
    font-style: normal;
    font-size: 12.5px;
}
body.dark .bt-answer-text {
    background: linear-gradient(135deg, rgba(5,150,105,.1) 0%, rgba(8,145,178,.1) 100%);
    border-color: rgba(52,211,153,.3);
}
body.dark .bt-answer-text strong {
    color: #34d399;
}
body.dark .bt-answer-text em {
    color: var(--bt-text-muted);
}

@keyframes btAnswerReveal {
    0%   { opacity: 0; transform: translateY(-8px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* 错误状态 */
.bt-result-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    text-align: center;
    gap: 10px;
}
.bt-error-icon   { font-size: 36px; }
.bt-error-msg    { font-size: 14px; color: #ef4444; font-weight: 600; margin: 0; }
.bt-error-hint   { font-size: 12px; color: var(--bt-text-muted); margin: 0; }
.bt-retry-btn {
    padding: 7px 18px;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background .18s;
}
.bt-retry-btn:hover {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}
body.dark .bt-error-msg  { color: #fca5a5; }

/* ===== 示例模态框 ===== */
.bt-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 10000;
    backdrop-filter: blur(2px);
}

.bt-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10001;
    width: min(680px, 96vw);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    background: var(--bt-surface);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
    border: 1px solid var(--bt-border);
    overflow: hidden;
}

.bt-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--bt-border);
    flex-shrink: 0;
}
.bt-modal-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--bt-text);
}
.bt-modal-close {
    background: none;
    border: none;
    color: var(--bt-text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: color .18s, background .18s;
    line-height: 1;
}
.bt-modal-close:hover {
    color: #ef4444;
    background: rgba(239,68,68,.1);
}

.bt-modal-body {
    overflow-y: auto;
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.bt-example-card {
    padding: 12px 14px;
    border: 1.5px solid var(--bt-border);
    border-radius: 9px;
    cursor: pointer;
    transition: all .18s;
    background: var(--bt-surface2);
}
.bt-example-card:hover {
    border-color: var(--bt-primary);
    background: rgba(124,58,237,.05);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(124,58,237,.12);
}
body.dark .bt-example-card {
    background: var(--bt-surface2);
    border-color: var(--bt-border);
}
body.dark .bt-example-card:hover {
    border-color: #a78bfa;
    background: rgba(124,58,237,.12);
}

.bt-example-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--bt-text);
    margin-bottom: 6px;
}

.bt-example-meta {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.bt-example-badge {
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10.5px;
    font-weight: 600;
    background: rgba(124,58,237,.1);
    color: var(--bt-primary);
    border: 1px solid rgba(124,58,237,.2);
}
body.dark .bt-example-badge {
    background: rgba(124,58,237,.2);
    color: #a78bfa;
    border-color: rgba(167,139,250,.3);
}

.bt-example-desc {
    font-size: 11.5px;
    color: var(--bt-text-muted);
    line-height: 1.4;
}

/* ===== 自定义滚动条 (WebKit) ===== */
.bt-history-list::-webkit-scrollbar,
.bt-config-body::-webkit-scrollbar,
.bt-result-body::-webkit-scrollbar,
.bt-modal-body::-webkit-scrollbar    { width: 5px; }

.bt-history-list::-webkit-scrollbar-track,
.bt-config-body::-webkit-scrollbar-track,
.bt-result-body::-webkit-scrollbar-track,
.bt-modal-body::-webkit-scrollbar-track   { background: transparent; }

.bt-history-list::-webkit-scrollbar-thumb,
.bt-config-body::-webkit-scrollbar-thumb,
.bt-result-body::-webkit-scrollbar-thumb,
.bt-modal-body::-webkit-scrollbar-thumb {
    background: rgba(124,58,237,.22);
    border-radius: 3px;
}
.bt-history-list::-webkit-scrollbar-thumb:hover,
.bt-config-body::-webkit-scrollbar-thumb:hover,
.bt-result-body::-webkit-scrollbar-thumb:hover,
.bt-modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(124,58,237,.45);
}
body.dark .bt-history-list::-webkit-scrollbar-thumb,
body.dark .bt-config-body::-webkit-scrollbar-thumb,
body.dark .bt-result-body::-webkit-scrollbar-thumb,
body.dark .bt-modal-body::-webkit-scrollbar-thumb {
    background: rgba(167,139,250,.2);
}
body.dark .bt-history-list::-webkit-scrollbar-thumb:hover,
body.dark .bt-config-body::-webkit-scrollbar-thumb:hover,
body.dark .bt-result-body::-webkit-scrollbar-thumb:hover,
body.dark .bt-modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(167,139,250,.45);
}

/* ===== 响应式（≤639px） ===== */
@media (max-width: 639px) {
    .bt-main-content {
        flex-direction: column;
    }

    .bt-history-panel {
        width: 100%;
        min-width: unset;
        max-height: 180px;
        border-right: none;
        border-bottom: 1px solid var(--bt-border);
    }
    body.dark .bt-history-panel {
        border-bottom-color: var(--bt-border);
    }

    .bt-config-panel {
        width: 100%;
        min-width: unset;
        border-right: none;
        border-bottom: 1px solid var(--bt-border);
        max-height: 320px;
    }
    body.dark .bt-config-panel {
        border-bottom-color: var(--bt-border);
    }

    .bt-result-body {
        padding: 12px;
    }

    .bt-toolbar .toolbar-title {
        display: none;
    }

    .bt-stat-badge {
        display: none;
    }
}
