/* 工具页通用样式 */
* { box-sizing: border-box; }
.page { min-height: 100vh; background: #f8fafc; padding-bottom: 40px; }

/* 顶部头图 */
.hero { padding: 20px 16px 16px; color: #fff; position: relative; overflow: hidden; background: linear-gradient(135deg, #8B5CF6, #6366F1); }
.hero::after { content: ''; position: absolute; right: -30px; top: -30px; width: 120px; height: 120px; border-radius: 50%; background: rgba(255,255,255,0.1); }
.hero::before { content: ''; position: absolute; left: -20px; bottom: -40px; width: 80px; height: 80px; border-radius: 50%; background: rgba(255,255,255,0.08); }
.back-btn { display: inline-flex; align-items: center; color: rgba(255,255,255,0.9); text-decoration: none; font-size: 13px; margin-bottom: 14px; position: relative; z-index: 1; }
.back-btn::before { content: '<'; margin-right: 4px; font-size: 16px; }
.hero-title { font-size: 24px; font-weight: 700; position: relative; z-index: 1; }
.hero-desc { font-size: 13px; opacity: 0.9; margin-top: 6px; position: relative; z-index: 1; line-height: 1.5; }

/* 兼容旧模板：诗人/名著等页面直接用 h1/p/back-link/container */
.hero > h1, .hero > h2, .hero > h3 { font-size: 24px; font-weight: 700; position: relative; z-index: 1; margin: 0; }
.hero > p { font-size: 13px; opacity: 0.9; margin-top: 6px; position: relative; z-index: 1; line-height: 1.5; }
.hero .back-link { display: inline-flex; align-items: center; color: rgba(255,255,255,0.9); text-decoration: none; font-size: 13px; margin-bottom: 14px; position: relative; z-index: 1; }
.hero .back-link::before { content: '<'; margin-right: 4px; font-size: 16px; }
.container { padding: 14px 16px; }

.hero-meta { display: flex; gap: 12px; margin-top: 12px; position: relative; z-index: 1; }
.hero-meta .tag { font-size: 11px; background: rgba(255,255,255,0.25); padding: 3px 10px; border-radius: 10px; }

/* 配色 */
.c-1 { background: linear-gradient(135deg, #8B5CF6, #6366F1); }
.c-2 { background: linear-gradient(135deg, #EC4899, #DB2777); }
.c-3 { background: linear-gradient(135deg, #06B6D4, #0891B2); }
.c-4 { background: linear-gradient(135deg, #F97316, #EA580C); }
.c-5 { background: linear-gradient(135deg, #10B981, #059669); }
.c-6 { background: linear-gradient(135deg, #F59E0B, #D97706); }
.c-7 { background: linear-gradient(135deg, #3B82F6, #2563EB); }
.c-8 { background: linear-gradient(135deg, #EF4444, #DC2626); }

/* 搜索栏 */
.search-bar { position: sticky; top: 0; z-index: 20; padding: 10px 16px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.search-input { width: 100%; padding: 9px 14px; border: 1px solid #e2e8f0; border-radius: 22px; font-size: 13px; outline: none; background: #f8fafc; }
.search-input:focus { border-color: #8B5CF6; background: #fff; }

/* 通用内容区 */
.content { padding: 14px 16px; }
.section { margin-bottom: 16px; }
.section-title { font-size: 16px; font-weight: 700; color: #1e293b; margin-bottom: 10px; display: flex; align-items: center; }
.section-title::before { content: ''; display: inline-block; width: 4px; height: 16px; background: #8B5CF6; border-radius: 2px; margin-right: 8px; }
.section-title .count { font-size: 12px; color: #94a3b8; font-weight: 400; margin-left: 6px; }

/* === 类型1: 列表类 (list) === */
.list-item { background: #fff; border-radius: 12px; padding: 14px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(0,0,0,0.03); }
.list-item-q { font-size: 14px; color: #1e293b; line-height: 1.6; display: flex; gap: 8px; }
.list-item-num { color: #8B5CF6; font-weight: 600; flex-shrink: 0; min-width: 24px; }
.list-item-text { flex: 1; }
.list-item-a { margin-top: 8px; padding: 8px 12px; background: #f0fdf4; border-left: 3px solid #10B981; border-radius: 6px; font-size: 13px; color: #166534; display: none; }
.list-item-a.show { display: block; }
.reveal-btn { margin-top: 8px; font-size: 12px; color: #8B5CF6; cursor: pointer; user-select: none; display: inline-flex; align-items: center; gap: 4px; }
.reveal-btn::before { content: '👀'; }

/* === 类型2: 卡片翻转类 (cards) === */
.card-deck { display: flex; flex-direction: column; gap: 12px; }
.flip-card { perspective: 1000px; height: 180px; cursor: pointer; }
.flip-inner { position: relative; width: 100%; height: 100%; transition: transform 0.5s; transform-style: preserve-3d; }
.flip-card.flipped .flip-inner { transform: rotateY(180deg); }
.flip-front, .flip-back { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; }
.flip-front { background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.flip-back { background: linear-gradient(135deg, #8B5CF6, #6366F1); color: #fff; transform: rotateY(180deg); box-shadow: 0 2px 8px rgba(99,102,241,0.3); }
.flip-front .big { font-size: 48px; font-weight: 700; color: #1e293b; }
.flip-front .hint { font-size: 12px; color: #94a3b8; margin-top: 12px; }
.flip-back .label { font-size: 12px; opacity: 0.8; margin-bottom: 6px; }
.flip-back .answer { font-size: 16px; font-weight: 600; line-height: 1.6; text-align: center; }
.card-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; padding: 0 4px; }
.card-nav-btn { width: 40px; height: 40px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; font-size: 18px; color: #64748b; box-shadow: 0 2px 6px rgba(0,0,0,0.08); cursor: pointer; }
.card-nav-btn:active { transform: scale(0.92); }
.card-nav-btn.disabled { opacity: 0.3; }
.card-counter { font-size: 13px; color: #64748b; }

/* === 类型3: 闯关测验类 (quiz) === */
.quiz-card { background: #fff; border-radius: 16px; padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.quiz-progress { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.quiz-progress-bar { flex: 1; height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; }
.quiz-progress-fill { height: 100%; background: linear-gradient(90deg, #8B5CF6, #6366F1); border-radius: 3px; transition: width 0.3s; }
.quiz-progress-text { font-size: 12px; color: #64748b; white-space: nowrap; }
.quiz-question { font-size: 18px; font-weight: 600; color: #1e293b; text-align: center; margin: 20px 0; line-height: 1.6; }
.quiz-hint { font-size: 12px; color: #94a3b8; text-align: center; margin-bottom: 16px; }
.quiz-options { display: flex; flex-direction: column; gap: 10px; }
.quiz-option { padding: 14px; background: #f8fafc; border: 2px solid #e2e8f0; border-radius: 12px; font-size: 14px; color: #1e293b; cursor: pointer; transition: all 0.15s; text-align: center; }
.quiz-option:active { transform: scale(0.98); }
.quiz-option.correct { background: #f0fdf4; border-color: #10B981; color: #166534; }
.quiz-option.wrong { background: #fef2f2; border-color: #EF4444; color: #991B1B; }
.quiz-input-row { display: flex; gap: 10px; }
.quiz-input { flex: 1; padding: 12px 16px; border: 2px solid #e2e8f0; border-radius: 12px; font-size: 16px; text-align: center; outline: none; }
.quiz-input:focus { border-color: #8B5CF6; }
.quiz-submit { padding: 12px 20px; background: linear-gradient(135deg, #8B5CF6, #6366F1); color: #fff; border-radius: 12px; font-size: 14px; font-weight: 500; cursor: pointer; }
.quiz-feedback { text-align: center; margin-top: 16px; padding: 12px; border-radius: 10px; font-size: 14px; display: none; }
.quiz-feedback.show { display: block; }
.quiz-feedback.ok { background: #f0fdf4; color: #166534; }
.quiz-feedback.no { background: #fef2f2; color: #991B1B; }
.quiz-action { text-align: center; margin-top: 20px; }
.quiz-next-btn { padding: 12px 32px; background: linear-gradient(135deg, #8B5CF6, #6366F1); color: #fff; border-radius: 24px; font-size: 14px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }

/* === 类型4: 分类浏览类 (categories) === */
.cat-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 10px; -webkit-overflow-scrolling: touch; }
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tab { padding: 7px 16px; background: #fff; border-radius: 20px; font-size: 13px; color: #64748b; white-space: nowrap; cursor: pointer; flex-shrink: 0; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.cat-tab.active { background: linear-gradient(135deg, #8B5CF6, #6366F1); color: #fff; }
.cat-content { background: #fff; border-radius: 12px; padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.03); }

/* === 类型5: 文章阅读类 (article) === */
.article-card { background: #fff; border-radius: 12px; padding: 18px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.03); }
.article-title { font-size: 16px; font-weight: 700; color: #1e293b; margin-bottom: 10px; }
.article-body { font-size: 14px; color: #334155; line-height: 1.8; }
.article-body p { margin-bottom: 10px; }
.article-body .tip { background: #fefce8; border-left: 3px solid #F59E0B; padding: 10px 12px; border-radius: 6px; margin: 10px 0; font-size: 13px; color: #92400e; }
.article-body .ex { background: #eff6ff; border-left: 3px solid #3B82F6; padding: 10px 12px; border-radius: 6px; margin: 10px 0; font-size: 13px; color: #1e40af; }
.article-body strong { color: #8B5CF6; }
.article-body ul { padding-left: 20px; margin: 8px 0; }
.article-body li { margin-bottom: 4px; }

/* 底部操作 */
.bottom-bar { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; padding: 10px 16px; display: flex; gap: 10px; box-shadow: 0 -2px 10px rgba(0,0,0,0.05); z-index: 30; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
.bb-btn { flex: 1; padding: 11px; border-radius: 22px; font-size: 13px; text-align: center; cursor: pointer; font-weight: 500; }
.bb-primary { background: linear-gradient(135deg, #8B5CF6, #6366F1); color: #fff; }
.bb-secondary { background: #f1f5f9; color: #64748b; }
.bb-btn:active { opacity: 0.85; }

/* 加载/空状态 */
.empty { text-align: center; padding: 60px 20px; color: #94a3b8; }
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.loading { text-align: center; padding: 40px; color: #94a3b8; }

/* 查看答案按钮：展开态（配合 tool-renderer.js 的 bindReveal 可反复折叠） */
.reveal-btn.is-open { color: #94a3b8; }
.reveal-btn.is-open::before { content: '🙈'; }
