/* =============================================
   谜语工具 - riddle.css
   灯笼/古风主题，温暖琥珀色调，三栏布局
   ============================================= */

/* ========== 主容器 ========== */
.rd-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 600px;
    background: #fdf8f0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 14px rgba(180, 90, 20, 0.10);
    transition: all 0.3s ease;
    border: 1px solid #f0d9b5;
}

.rd-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;
    border: none;
}

/* ========== 顶部工具栏 ========== */
.rd-toolbar {
    display: flex;
    align-items: center;
    padding: 7px 12px;
    background: linear-gradient(135deg, #c0392b 0%, #922b21 50%, #7b241c 100%);
    color: white;
    flex-wrap: wrap;
    gap: 8px;
    box-shadow: 0 2px 10px rgba(192, 57, 43, 0.40);
    flex-shrink: 0;
    min-height: 36px;
}

.rd-toolbar .toolbar-title {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    letter-spacing: 0.5px;
    margin-right: 8px;
}

.toolbar-group {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.toolbar-group--right {
    margin-left: auto;
}

.rd-btn {
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.92);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: #922b21;
    transition: all 0.2s;
    white-space: nowrap;
}

.rd-btn:hover:not(:disabled) {
    background: #fff;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.rd-btn:active:not(:disabled) {
    transform: translateY(0);
}

.rd-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.rd-btn-primary {
    background: linear-gradient(135deg, #fff3cd 0%, #ffe0b2 100%);
    color: #7b241c;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.rd-btn-primary:hover:not(:disabled) {
    background: #fff;
    color: #922b21;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ========== 模式切换 ========== */
.mode-switcher {
    display: flex;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 5px;
    padding: 2px;
    gap: 2px;
}

.mode-btn {
    padding: 3px 10px;
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.80);
    transition: all 0.2s;
    white-space: nowrap;
}

.mode-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
}

.mode-btn.active {
    background: rgba(255, 255, 255, 0.92);
    color: #922b21;
    font-weight: 700;
}

/* ========== 主内容区：三栏 ========== */
.rd-main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    background: #fdf8f0;
}

/* ========== 左栏：历史记录 ========== */
.rd-history-panel {
    width: 210px;
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid #f0d9b5;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.history-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: linear-gradient(to bottom, #fffbf5 0%, #fdf3e3 100%);
    border-bottom: 1px solid #f0d9b5;
    flex-shrink: 0;
}

.history-panel-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #7b241c;
}

.history-count {
    font-size: 11px;
    color: #e59866;
    font-weight: 400;
}

.history-clear-btn {
    background: #fff0f0;
    border: none;
    color: #e74c3c;
    font-size: 11px;
    cursor: pointer;
    padding: 2px 7px;
    border-radius: 3px;
    transition: background 0.2s;
    white-space: nowrap;
}

.history-clear-btn:hover {
    background: #fde8e8;
}

body.dark .history-clear-btn {
    background: #3d1515;
    color: #f87171;
    border: none;
}

body.dark .history-clear-btn:hover {
    background: #5a1515;
}

.history-search {
    padding: 8px;
    border-bottom: 1px solid #f0d9b5;
    flex-shrink: 0;
}

.history-search input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #f0d9b5;
    border-radius: 4px;
    font-size: 12px;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
    color: #374151;
    background: #fffbf5;
}

.history-search input:focus {
    border-color: #c0392b;
    box-shadow: 0 0 0 2px rgba(192, 57, 43, 0.10);
    background: #fff;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
}

.history-list::-webkit-scrollbar { width: 4px; }
.history-list::-webkit-scrollbar-track { background: transparent; }
.history-list:hover::-webkit-scrollbar-track { background: #fdf3e3; }
.history-list::-webkit-scrollbar-thumb { background: #f0b27a; border-radius: 2px; }
.history-list::-webkit-scrollbar-thumb:hover { background: #c0392b; }

.history-empty {
    text-align: center;
    color: #e59866;
    font-size: 12px;
    padding: 28px 8px;
    user-select: none;
}

.history-item {
    display: flex;
    flex-direction: column;
    padding: 9px 11px;
    margin: 3px 0;
    background: #fffbf5;
    border: 1px solid #f0d9b5;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    animation: rdHiFadeIn 0.2s ease;
}

@keyframes rdHiFadeIn {
    from { opacity: 0; transform: translateX(-4px); }
    to   { opacity: 1; transform: translateX(0); }
}

.history-item:hover {
    background: #fdf3e3;
    border-color: #e59866;
    transform: translateX(2px);
}

.history-item.active {
    background: #fdebd0;
    border-color: #e59866;
    box-shadow: inset 3px 0 0 #c0392b, 0 1px 3px rgba(192, 57, 43, 0.15);
}

.history-item-del {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    background: #fde8e8;
    color: #e74c3c;
    border: none;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
    padding: 0;
    line-height: 1;
}

.history-item:hover .history-item-del { opacity: 1; }

.history-item-del:hover {
    background: #e74c3c;
    color: #fff;
}

.history-item-title {
    font-size: 12px;
    font-weight: 600;
    color: #1e293b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 22px;
    margin-bottom: 2px;
}

.history-item-sub {
    font-size: 11px;
    color: #c0392b;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-item-time {
    font-size: 10px;
    color: #94a3b8;
}

/* ========== 中栏：输入区 ========== */
.rd-input-panel {
    width: 350px;
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid #f0d9b5;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.rd-result-panel {
    flex: 1;
    background: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 300px;
}

/* ========== 面板通用头部 ========== */
.panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    background: linear-gradient(to bottom, #fffbf5 0%, #fdf3e3 100%);
    border-bottom: 1px solid #f0d9b5;
    flex-shrink: 0;
}

.panel-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #7b241c;
    white-space: nowrap;
}

.panel-tip {
    font-size: 11px;
    color: #e59866;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-meta {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex-shrink: 1;
    overflow: hidden;
}

.result-meta-tag {
    font-size: 11px;
    color: #7b241c;
    background: #fdebd0;
    padding: 2px 10px;
    border-radius: 10px;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 1;
}

.result-time {
    font-size: 11px;
    color: #94a3b8;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ========== 输入区表单 ========== */
.rd-input-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px;
}

.rd-input-body::-webkit-scrollbar { width: 4px; }
.rd-input-body::-webkit-scrollbar-track { background: transparent; }
.rd-input-body:hover::-webkit-scrollbar-track { background: #fdf3e3; }
.rd-input-body::-webkit-scrollbar-thumb { background: #f0b27a; border-radius: 2px; }
.rd-input-body::-webkit-scrollbar-thumb:hover { background: #c0392b; }

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: flex;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 5px;
}

.required-mark { color: #c0392b; margin-left: 2px; }

.label-tip {
    font-size: 11px;
    font-weight: 400;
    color: #9ca3af;
}

body.dark .label-tip { color: #6b5535; }

.rd-input,
.rd-select,
.rd-textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #f0d9b5;
    border-radius: 5px;
    font-size: 13px;
    color: #374151;
    background: #fffbf5;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
    font-family: inherit;
}

.rd-input:focus,
.rd-select:focus,
.rd-textarea:focus {
    border-color: #c0392b;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.08);
}

.rd-input:hover:not(:focus),
.rd-select:hover:not(:focus),
.rd-textarea:hover:not(:focus) {
    border-color: #e59866;
    background: #fff;
}

.rd-input::placeholder,
.rd-textarea::placeholder { color: #c4b5a0; }

.rd-textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.6;
}

.char-count {
    text-align: right;
    font-size: 11px;
    color: #94a3b8;
    margin-top: 3px;
}

.char-count.warn { color: #e67e22; }
.char-count.danger { color: #e74c3c; font-weight: 600; }

/* ========== 谜语类型网格 ========== */
.type-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.type-option {
    cursor: pointer;
    display: block;
}

.type-option input[type="radio"] { display: none; }

.type-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 4px;
    border: 1.5px solid #f0d9b5;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #7b241c;
    background: #fffbf5;
    transition: all 0.2s;
    cursor: pointer;
    user-select: none;
    width: 100%;
    text-align: center;
    white-space: normal;
    word-break: break-word;
    min-height: 34px;
    line-height: 1.4;
}

.type-btn:hover {
    border-color: #e59866;
    background: #fdf3e3;
}

.type-option input[type="radio"]:checked + .type-btn {
    border-color: #c0392b;
    background: #fdebd0;
    color: #7b241c;
    font-weight: 700;
    box-shadow: 0 1px 4px rgba(192, 57, 43, 0.15);
}

/* ========== 数量选择器 ========== */
.quantity-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.qty-btn {
    width: 30px;
    height: 30px;
    border: 1.5px solid #f0d9b5;
    border-radius: 50%;
    background: #fffbf5;
    color: #7b241c;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 1;
    padding: 0;
}

.qty-btn:hover {
    border-color: #c0392b;
    background: #fdebd0;
}

.qty-val {
    font-size: 18px;
    font-weight: 700;
    color: #c0392b;
    min-width: 24px;
    text-align: center;
}

.qty-hint {
    font-size: 12px;
    color: #9ca3af;
}

/* ========== 热门主题标签 ========== */
.topic-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.topic-tag {
    padding: 4px 10px;
    background: #fffbf5;
    border: 1px solid #f0d9b5;
    border-radius: 12px;
    font-size: 12px;
    color: #7b241c;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.topic-tag:hover {
    background: #fdebd0;
    border-color: #c0392b;
    transform: translateY(-1px);
}

.topic-tag.active {
    background: #c0392b;
    border-color: #922b21;
    color: #fff;
}

/* ========== 经典谜面列表 ========== */
.classic-riddles {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.classic-item {
    padding: 8px 12px;
    background: #fffbf5;
    border: 1px solid #f0d9b5;
    border-left: 3px solid #e59866;
    border-radius: 5px;
    font-size: 12px;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.5;
}

.classic-item:hover {
    background: #fdf3e3;
    border-color: #c0392b;
    border-left-color: #c0392b;
    transform: translateX(2px);
}

/* ========== 结果展示区 ========== */
.rd-result-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    position: relative;
}

.rd-result-body::-webkit-scrollbar { width: 5px; }
.rd-result-body::-webkit-scrollbar-track { background: transparent; }
.rd-result-body:hover::-webkit-scrollbar-track { background: #fdf3e3; }
.rd-result-body::-webkit-scrollbar-thumb { background: #f0b27a; border-radius: 3px; }
.rd-result-body::-webkit-scrollbar-thumb:hover { background: #c0392b; }

/* ========== 占位区 ========== */
.result-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 200px;
    gap: 10px;
    user-select: none;
}

.lantern-animation {
    position: relative;
    margin-bottom: 8px;
}

.lantern {
    font-size: 52px;
    display: block;
    animation: rdLanternSwing 3s ease-in-out infinite;
    transform-origin: top center;
}

@keyframes rdLanternSwing {
    0%, 100% { transform: rotate(-8deg); }
    50%       { transform: rotate(8deg); }
}

.placeholder-title {
    font-size: 15px;
    font-weight: 600;
    color: #7b241c;
    margin: 0;
}

.placeholder-desc {
    font-size: 12px;
    color: #b08050;
    margin: 0;
    text-align: center;
}

/* ========== 加载状态 ========== */
.result-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 200px;
    gap: 20px;
}

.rd-loading-anim {
    display: flex;
    gap: 8px;
}

.rd-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #c0392b;
    animation: rdDotBounce 1.2s ease-in-out infinite;
}

.rd-dot:nth-child(2) { animation-delay: 0.2s; }
.rd-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes rdDotBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40%           { transform: scale(1.1); opacity: 1; }
}

.loading-text {
    font-size: 13px;
    color: #7b241c;
    margin: 0;
    text-align: center;
}

/* ========== 结果内容 ========== */
.rd-result-content {
    animation: rdFadeInUp 0.35s ease;
}

@keyframes rdFadeInUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* 谜语卡片 */
.riddle-card {
    background: linear-gradient(135deg, #fff9f0 0%, #fdf3e3 100%);
    border: 1px solid #f0d9b5;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: 0 2px 8px rgba(180, 90, 20, 0.06);
    position: relative;
    overflow: hidden;
}

.riddle-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, #c0392b, #e59866);
    border-radius: 10px 0 0 10px;
}

.riddle-card-index {
    position: absolute;
    top: 10px;
    right: 12px;
    font-size: 11px;
    color: #e59866;
    font-weight: 600;
    background: #fff;
    padding: 2px 7px;
    border-radius: 8px;
    border: 1px solid #f0d9b5;
}

.riddle-section {
    margin-bottom: 10px;
}

.riddle-section:last-child { margin-bottom: 0; }

.riddle-label {
    font-size: 11px;
    font-weight: 700;
    color: #922b21;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.riddle-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, #f0d9b5, transparent);
}

.riddle-text {
    font-size: 14px;
    color: #374151;
    line-height: 1.7;
    padding-left: 4px;
}

.riddle-answer {
    font-size: 14px;
    color: #c0392b;
    font-weight: 700;
    line-height: 1.7;
    padding: 5px 10px 5px 10px;
    background: linear-gradient(to right, rgba(192, 57, 43, 0.07), transparent);
    border-radius: 5px;
    border-left: 3px solid rgba(192, 57, 43, 0.35);
}

.riddle-explain {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.7;
    padding-left: 4px;
    font-style: italic;
}

/* 答案折叠 */
.answer-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    background: #fff;
    border: 1.5px dashed #e59866;
    border-radius: 20px;
    font-size: 12px;
    color: #c0392b;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    margin-top: 4px;
}

.answer-toggle:hover {
    background: #fdebd0;
    border-color: #c0392b;
}

.answer-toggle .toggle-icon { transition: transform 0.2s; }
.answer-toggle.revealed .toggle-icon { transform: rotate(180deg); }

.answer-content {
    display: none;
    margin-top: 6px;
}

/* 猜谜底结果 */
.guess-result-card {
    background: linear-gradient(135deg, #fff9f0 0%, #fdf3e3 100%);
    border: 1px solid #f0d9b5;
    border-radius: 10px;
    padding: 18px;
    box-shadow: 0 2px 8px rgba(180, 90, 20, 0.06);
    position: relative;
}

.guess-result-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, #e59866, #c0392b);
    border-radius: 10px 0 0 10px;
}

/* 错误提示 */
.rd-error-box {
    background: #fff5f5;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
}

.rd-error-box .error-icon { font-size: 28px; }
.rd-error-box .error-msg  { font-size: 13px; color: #b91c1c; }

/* 错误重试按钮统一类名（规范要求） */
.error-retry-btn {
    padding: 6px 18px;
    background: #c0392b;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.error-retry-btn:hover { background: #922b21; }

/* ========== 示例弹窗 ========== */
.rd-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 10000;
}

.rd-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10001;
    width: min(640px, 92vw);
    max-height: 80vh;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.rd-modal-content {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

.rd-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #c0392b 0%, #7b241c 100%);
    color: #fff;
    flex-shrink: 0;
}

.rd-modal-header h3 { margin: 0; font-size: 15px; font-weight: 600; color: #fff; }

.rd-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.rd-modal-close:hover { background: rgba(255, 255, 255, 0.35); }

.rd-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    align-content: start;
}

.rd-modal-body::-webkit-scrollbar { width: 5px; }
.rd-modal-body::-webkit-scrollbar-track { background: #f9f9f9; }
.rd-modal-body::-webkit-scrollbar-thumb { background: #f0b27a; border-radius: 3px; }
.rd-modal-body::-webkit-scrollbar-thumb:hover { background: #c0392b; }

/* 示例卡片 */
.example-card {
    background: #fffbf5;
    border: 1.5px solid #f0d9b5;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.example-card:hover {
    border-color: #c0392b;
    background: #fdf3e3;
    box-shadow: 0 3px 10px rgba(192, 57, 43, 0.10);
    transform: translateY(-2px);
}

.example-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.example-icon { font-size: 20px; flex-shrink: 0; }

.example-title {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.example-badge {
    font-size: 10px;
    padding: 2px 7px;
    background: #fdebd0;
    color: #922b21;
    border-radius: 8px;
    white-space: nowrap;
    flex-shrink: 0;
}

.example-desc {
    font-size: 11px;
    color: #6b7280;
    line-height: 1.5;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* ========== 全部揭晓操作栏 ========== */
.rd-result-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px dashed #f0d9b5;
}

.rd-expand-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 14px;
    background: #fff;
    border: 1px solid #e59866;
    border-radius: 14px;
    font-size: 12px;
    color: #7b241c;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    white-space: nowrap;
}

.rd-expand-all-btn:hover {
    background: #fdebd0;
    border-color: #c0392b;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(192, 57, 43, 0.12);
}

.rd-expand-all-btn.all-revealed {
    background: #fdebd0;
    border-color: #c0392b;
    color: #922b21;
    font-weight: 600;
}

.rd-cards-count {
    font-size: 11px;
    color: #b08050;
    user-select: none;
}

/* ========== 模式说明提示 ========== */
.mode-hint {
    margin: 0;
    padding: 8px 16px;
    background: linear-gradient(to right, #fdf3e3, #fffbf5);
    border-bottom: 1px solid #f0d9b5;
    font-size: 11px;
    color: #7b241c;
    line-height: 1.5;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 5px;
}

.mode-hint-icon { font-size: 13px; flex-shrink: 0; }

body.dark .mode-hint {
    background: linear-gradient(to right, #2a1a08, #221208);
    border-bottom-color: #3d2b10;
    color: #e59866;
}

/* ========== 谜语卡片复制按钮 ========== */
.riddle-card-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 10px;
    padding: 4px 12px;
    background: #fff;
    border: 1px solid #f0d9b5;
    border-radius: 12px;
    font-size: 11px;
    color: #7b241c;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.riddle-card-copy-btn:hover {
    background: #fdebd0;
    border-color: #c0392b;
    color: #c0392b;
    transform: translateY(-1px);
}

.riddle-card-copy-btn.copied {
    background: #d1fae5;
    border-color: #10b981;
    color: #065f46;
}

body.dark .riddle-card-copy-btn {
    background: #2a1a08;
    border-color: #3d2b10;
    color: #e59866;
}

body.dark .riddle-card-copy-btn:hover {
    background: #3d2510;
    border-color: #c0392b;
    color: #f0b27a;
}

body.dark .riddle-card-copy-btn.copied {
    background: #064e3b;
    border-color: #10b981;
    color: #6ee7b7;
}

/* ========== Toast 提示 ========== */
.rd-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(30, 20, 10, 0.88);
    color: #fff;
    padding: 9px 20px;
    border-radius: 20px;
    font-size: 13px;
    z-index: 19999;
    pointer-events: none;
    opacity: 0;
    transition: all 0.25s ease;
    white-space: nowrap;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.rd-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ========== 抖动动画 ========== */
@keyframes rdShake {
    0%, 100% { transform: translateX(0); }
    15%, 55%, 85% { transform: translateX(-5px); }
    35%, 70% { transform: translateX(5px); }
}

.rd-input.shake,
.rd-select.shake,
.rd-textarea.shake {
    animation: rdShake 0.5s ease-in-out;
    border-color: #e74c3c !important;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.12) !important;
}

/* ========== 暗黑模式 ========== */
body.dark .rd-container {
    background: #1a1208;
    border-color: #3d2b10;
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.40);
}

body.dark .rd-toolbar {
    background: linear-gradient(135deg, #7b1a12 0%, #5a1209 50%, #3d0d06 100%);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

body.dark .rd-main-content { background: #1a1208; }

body.dark .rd-history-panel {
    background: #211508;
    border-right-color: #3d2b10;
}

body.dark .history-panel-header {
    background: linear-gradient(to bottom, #2a1a08, #211508);
    border-bottom-color: #3d2b10;
}

body.dark .history-panel-header h3 { color: #f0b27a; }

body.dark .history-search { border-bottom-color: #3d2b10; }

body.dark .history-search input {
    border-color: #3d2b10;
    background: #2a1a08;
    color: #e2c9a0;
}

body.dark .history-search input:focus {
    border-color: #c0392b;
    background: #221208;
    box-shadow: 0 0 0 2px rgba(192, 57, 43, 0.20);
}

body.dark .history-search input::placeholder { color: #6b5535; }

body.dark .history-list:hover::-webkit-scrollbar-track { background: #2a1a08; }
body.dark .history-list::-webkit-scrollbar-thumb { background: #7b3a15; }
body.dark .history-list::-webkit-scrollbar-thumb:hover { background: #c0392b; }

body.dark .history-empty { color: #7b5535; }

body.dark .history-item {
    background: #2a1a08;
    border-color: #3d2b10;
}

body.dark .history-item:hover {
    background: #341f0a;
    border-color: #7b3a15;
}

body.dark .history-item.active {
    background: #3d2510;
    border-color: #9b4a20;
    box-shadow: inset 3px 0 0 #e59866;
}

body.dark .history-item-title { color: #e2c9a0; }
body.dark .history-item-sub   { color: #e59866; }
body.dark .history-item-time  { color: #6b5535; }
body.dark .history-item-del   { background: #3d1515; color: #f87171; }
body.dark .history-item-del:hover { background: #b91c1c; color: #fff; }

body.dark .rd-input-panel {
    background: #211508;
    border-right-color: #3d2b10;
}

body.dark .rd-result-panel { background: #211508; }

body.dark .panel-header {
    background: linear-gradient(to bottom, #2a1a08, #211508);
    border-bottom-color: #3d2b10;
}

body.dark .panel-header h3 { color: #f0b27a; }
body.dark .panel-tip        { color: #7b5535; }
body.dark .result-meta-tag  { background: #3d2510; color: #f0b27a; }
body.dark .result-time      { color: #9b8060; }

body.dark .rd-input-body:hover::-webkit-scrollbar-track { background: #2a1a08; }
body.dark .rd-input-body::-webkit-scrollbar-thumb { background: #7b3a15; }
body.dark .rd-input-body::-webkit-scrollbar-thumb:hover { background: #c0392b; }

body.dark .form-group label { color: #c9a87a; }

body.dark .rd-select { color-scheme: dark; }

body.dark .rd-input,
body.dark .rd-select,
body.dark .rd-textarea {
    background: #2a1a08;
    border-color: #3d2b10;
    color: #e2c9a0;
}

body.dark .rd-input:focus,
body.dark .rd-select:focus,
body.dark .rd-textarea:focus {
    border-color: #c0392b;
    background: #221208;
    box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.15);
}

body.dark .rd-input:hover:not(:focus),
body.dark .rd-select:hover:not(:focus),
body.dark .rd-textarea:hover:not(:focus) {
    border-color: #7b3a15;
    background: #2a1a08;
}

body.dark .rd-input::placeholder,
body.dark .rd-textarea::placeholder { color: #6b5535; }

body.dark .type-btn {
    background: #2a1a08;
    border-color: #3d2b10;
    color: #f0b27a;
}

body.dark .type-btn:hover {
    background: #341f0a;
    border-color: #7b3a15;
}

body.dark .type-option input[type="radio"]:checked + .type-btn {
    border-color: #c0392b;
    background: #3d2510;
    color: #f0b27a;
}

body.dark .qty-btn {
    background: #2a1a08;
    border-color: #3d2b10;
    color: #f0b27a;
}

body.dark .qty-btn:hover {
    background: #3d2510;
    border-color: #c0392b;
}

body.dark .qty-val { color: #f0b27a; }
body.dark .qty-hint { color: #6b5535; }

body.dark .topic-tag {
    background: #2a1a08;
    border-color: #3d2b10;
    color: #f0b27a;
}

body.dark .topic-tag:hover {
    background: #3d2510;
    border-color: #c0392b;
}

body.dark .topic-tag.active {
    background: #7b1a12;
    border-color: #c0392b;
    color: #fff;
}

body.dark .classic-item {
    background: #2a1a08;
    border-color: #3d2b10;
    border-left-color: #7b3a15;
    color: #c9a87a;
}

body.dark .classic-item:hover {
    background: #341f0a;
    border-color: #c0392b;
    border-left-color: #c0392b;
}

body.dark .char-count { color: #6b5535; }
body.dark .char-count.warn   { color: #e67e22; }
body.dark .char-count.danger { color: #e74c3c; }

body.dark .rd-result-body::-webkit-scrollbar-track { background: #1a1208; }
body.dark .rd-result-body:hover::-webkit-scrollbar-track { background: #2a1a08; }
body.dark .rd-result-body::-webkit-scrollbar-thumb { background: #7b3a15; }
body.dark .rd-result-body::-webkit-scrollbar-thumb:hover { background: #c0392b; }

body.dark .placeholder-title { color: #f0b27a; }
body.dark .placeholder-desc  { color: #7b5535; }

body.dark .loading-text { color: #f0b27a; }
body.dark .rd-dot { background: #e59866; }

body.dark .riddle-card {
    background: linear-gradient(135deg, #2a1a08, #221208);
    border-color: #3d2b10;
}

body.dark .riddle-card-index {
    background: #211508;
    border-color: #3d2b10;
    color: #e59866;
}

body.dark .riddle-label  { color: #f0b27a; }
body.dark .riddle-text   { color: #e2c9a0; }
body.dark .riddle-answer {
    color: #f0b27a;
    background: linear-gradient(to right, rgba(229, 152, 102, 0.10), transparent);
    border-left-color: rgba(229, 152, 102, 0.40);
}
body.dark .riddle-explain { color: #9b8060; }

body.dark .answer-toggle {
    background: #2a1a08;
    border-color: #7b3a15;
    color: #f0b27a;
}

body.dark .answer-toggle:hover {
    background: #3d2510;
    border-color: #c0392b;
}

body.dark .guess-result-card {
    background: linear-gradient(135deg, #2a1a08, #221208);
    border-color: #3d2b10;
}

body.dark .rd-error-box {
    background: #2a0f0f;
    border-color: #7b1a1a;
}

body.dark .rd-error-box .error-msg { color: #f87171; }

body.dark .error-retry-btn {
    background: #922b21;
    color: #fff;
}
body.dark .error-retry-btn:hover { background: #7b241c; }

/* 暗黑模式下弹窗 */
body.dark .rd-modal {
    background: #211508;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
}

body.dark .rd-modal-body { background: #211508; }
body.dark .rd-modal-body::-webkit-scrollbar-track { background: #1a1208; }
body.dark .rd-modal-body::-webkit-scrollbar-thumb { background: #7b3a15; }
body.dark .rd-modal-body::-webkit-scrollbar-thumb:hover { background: #c0392b; }

body.dark .example-card {
    background: #2a1a08;
    border-color: #3d2b10;
}

body.dark .example-card:hover {
    background: #341f0a;
    border-color: #c0392b;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

body.dark .example-title  { color: #e2c9a0; }
body.dark .example-badge  { background: #3d2510; color: #f0b27a; }
body.dark .example-desc   { color: #9b8060; }

body.dark .mode-switcher { background: rgba(255, 255, 255, 0.08); }

body.dark .rd-result-actions { border-bottom-color: #3d2b10; }

body.dark .rd-expand-all-btn {
    background: #2a1a08;
    border-color: #7b3a15;
    color: #f0b27a;
}

body.dark .rd-expand-all-btn:hover {
    background: #3d2510;
    border-color: #c0392b;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

body.dark .rd-expand-all-btn.all-revealed {
    background: #3d2510;
    border-color: #c0392b;
    color: #f0b27a;
}

body.dark .rd-cards-count { color: #7b5535; }

/* ========== 响应式 ========== */
@media (max-width: 900px) {
    .rd-history-panel { display: none; }
    .rd-input-panel   { width: 300px; }
}

@media (max-width: 640px) {
    .rd-input-panel {
        width: 100%;
        max-width: 100%;
        border-right: none;
        border-bottom: 1px solid #f0d9b5;
    }

    body.dark .rd-input-panel {
        border-bottom-color: #3d2b10;
    }
    .rd-main-content { flex-direction: column; }
    .rd-result-panel { min-height: 300px; }
    .type-grid { grid-template-columns: repeat(2, 1fr); }
    .rd-modal-body { grid-template-columns: 1fr; }
}

/* ========== 打印样式 ========== */
@media print {
    .rd-toolbar,
    .rd-history-panel,
    .rd-input-panel,
    .rd-result-actions,
    .rd-modal-overlay,
    .rd-modal { display: none !important; }

    .rd-container {
        height: auto !important;
        overflow: visible !important;
        box-shadow: none !important;
        border: none !important;
    }

    .rd-main-content {
        overflow: visible !important;
    }

    .rd-result-panel {
        width: 100% !important;
        overflow: visible !important;
    }

    .rd-result-body {
        overflow: visible !important;
        height: auto !important;
        max-height: none !important;
    }

    .answer-content { display: block !important; }
    .riddle-card-copy-btn { display: none !important; }
}
