/* ============================================================
   爱（AI）跑团 · 外观主题层（深色模式 + 字号）
   由 theme.js 在 <html> 上设置 data-theme / data-fs
   data-theme: light | dark     data-fs: sm | md | lg | xl
   本文件在页面 <style> 之后加载，用 !important 确保覆盖
   ============================================================ */

/* ---------- 深色：通用容器 ---------- */
html[data-theme="dark"] body { background:#0d0a07 !important; }
html[data-theme="dark"] .wrap { background:#17130f !important; }
html[data-theme="dark"] .top,
html[data-theme="dark"] .topbar { background:linear-gradient(135deg,#5e1a13,#7d271c) !important; }

/* ---------- 深色：聊天区（play / room） ---------- */
html[data-theme="dark"] .msg.ai { background:#211b15 !important; border-color:#3a2e22 !important; color:#e8ddc8 !important;
  box-shadow:0 1px 3px rgba(0,0,0,.4) !important; }
html[data-theme="dark"] .msg.ai .who { color:#e0785f !important; }
html[data-theme="dark"] .msg.player { background:#26344c !important; color:#f2ecdf !important; }
html[data-theme="dark"] .msg.sys { background:#241d16 !important; border-color:#5a4a34 !important; color:#c9b48f !important; }
html[data-theme="dark"] .typing { color:#a8926e !important; }
html[data-theme="dark"] .cursor-blink::after { color:#e0785f !important; }
html[data-theme="dark"] .speak-btn { background:#241d16 !important; border-color:#3a2e22 !important; color:#c9b48f !important; }
html[data-theme="dark"] .speak-btn:active { background:#8e2c22 !important; color:#fff !important; }

/* ---------- 深色：输入区 ---------- */
html[data-theme="dark"] .inputbar { background:#1c1712 !important; border-top-color:#33291f !important; }
html[data-theme="dark"] .act { background:#241d16 !important; border-color:#5a4a34 !important; color:#e8c15a !important; }
html[data-theme="dark"] .act:active { background:#8e2c22 !important; color:#fff !important; }
html[data-theme="dark"] .typebox input { background:#241d16 !important; border-color:#3a2e22 !important; color:#e8ddc8 !important; }
html[data-theme="dark"] .typebox input::placeholder { color:#8a7a60 !important; }
html[data-theme="dark"] .typebox input:disabled { background:#1c1712 !important; color:#8a7a60 !important; }
html[data-theme="dark"] .wait-note { color:#a8926e !important; }

/* ---------- 深色：抽屉 ---------- */
html[data-theme="dark"] .drawer { background:#241d16 !important; color:#f0e6d2 !important; }
html[data-theme="dark"] .drawer ul li { border-bottom-color:#3a2d22 !important; color:#d9c9a8 !important; }
html[data-theme="dark"] .attr div, html[data-theme="dark"] .clue { background:#17130f !important; }

/* ---------- 深色：骰子 / 结局 ---------- */
html[data-theme="dark"] .dice-box { background:linear-gradient(160deg,#241d16,#1c1712) !important; }
html[data-theme="dark"] .dice-label { color:#a8926e !important; }
html[data-theme="dark"] .dice-num { color:#e0785f !important; }
html[data-theme="dark"] .ending { background:linear-gradient(160deg,#241d16,#1c1712) !important; }
html[data-theme="dark"] .ending .e-type { color:#e0785f !important; }
html[data-theme="dark"] .ending .e-name { color:#e8ddc8 !important; }
html[data-theme="dark"] .ending .e-stats { background:#17130f !important; color:#c9b48f !important; }
html[data-theme="dark"] .ending .e-actions .home { background:#2a231a !important; color:#c9b48f !important; }
html[data-theme="dark"] .sharebtns button { background:#2a231a !important; color:#c9b48f !important; }
html[data-theme="dark"] .sharecard canvas { box-shadow:0 6px 20px rgba(0,0,0,.55) !important; }

/* ---------- 深色：新手引导 ---------- */
html[data-theme="dark"] .guide-box { background:#211b15 !important; }
html[data-theme="dark"] .guide-box h3,
html[data-theme="dark"] .guide-box li b { color:#e0785f !important; }
html[data-theme="dark"] .guide-box li { color:#e8ddc8 !important; }

/* ---------- 深色：首页（剧本市场） ---------- */
html[data-theme="dark"] .tab { background:#211b15 !important; border-color:#3a2e22 !important; color:#c9b48f !important; }
html[data-theme="dark"] .tab.active { background:#8e2c22 !important; color:#fff !important; border-color:#8e2c22 !important; }
html[data-theme="dark"] .section-title h2 { color:#e8ddc8 !important; }
html[data-theme="dark"] .section-title span { color:#e0785f !important; }
html[data-theme="dark"] .list::-webkit-scrollbar-thumb { background:#3a2e22 !important; }
html[data-theme="dark"] .card { background:#211b15 !important; border-color:#33291f !important; box-shadow:0 2px 6px rgba(0,0,0,.35) !important; }
html[data-theme="dark"] .info .title { color:#e8ddc8 !important; }
html[data-theme="dark"] .info .sub { color:#a8926e !important; }
html[data-theme="dark"] .meta .pill { background:#2a231a !important; color:#c9b48f !important; }
html[data-theme="dark"] .community { background:#1c1712 !important; border-color:#5a4a34 !important; }
html[data-theme="dark"] .community .c1 { color:#c9b48f !important; }
html[data-theme="dark"] .loading { color:#a8926e !important; }
html[data-theme="dark"] .err { color:#e0785f !important; }

/* ---------- 深色：弹窗 ---------- */
html[data-theme="dark"] .modal-box { background:#211b15 !important; }
html[data-theme="dark"] .modal-box h3 { color:#e8ddc8 !important; }
html[data-theme="dark"] .modal-box p { color:#a8926e !important; }
html[data-theme="dark"] .modal-box .opt { background:#2a231a !important; border-color:#3a2e22 !important; color:#e8ddc8 !important; }
html[data-theme="dark"] .modal-box .opt:active { background:#33291f !important; }
html[data-theme="dark"] .modal-box .opt.cancel { background:#241d16 !important; color:#a8926e !important; }
html[data-theme="dark"] .modal-box input,
html[data-theme="dark"] .modal-box select { background:#241d16 !important; border-color:#3a2e22 !important; color:#e8ddc8 !important; }

/* ---------- 深色：联机房间 ---------- */
html[data-theme="dark"] .codebox { background:#211b15 !important; border-color:#5a4a34 !important; }
html[data-theme="dark"] .codebox .lb { color:#a8926e !important; }
html[data-theme="dark"] .codebox .code { color:#e0785f !important; }
html[data-theme="dark"] .codebox .hint { color:#a8926e !important; }
html[data-theme="dark"] .plist { background:#211b15 !important; border-color:#33291f !important; }
html[data-theme="dark"] .plist .ph { color:#a8926e !important; }
html[data-theme="dark"] .pitem { color:#e8ddc8 !important; border-bottom-color:#33291f !important; }
html[data-theme="dark"] .pitem .me { color:#e0785f !important; }
html[data-theme="dark"] .lobby .big.ghost { background:#2a231a !important; color:#c9b48f !important; }
html[data-theme="dark"] .lobby .tip { color:#a8926e !important; }
html[data-theme="dark"] .turnbar { background:#241d16 !important; border-bottom-color:#33291f !important; color:#c9b48f !important; }
html[data-theme="dark"] .turnbar .who { color:#e0785f !important; }
html[data-theme="dark"] .pip { background:#4a3c2c !important; }
/* 队伍情报面板 */
html[data-theme="dark"] .intel-h { color:#a8926e !important; }
html[data-theme="dark"] .intel-item { background:#241d16 !important; color:#c9b48f !important; }
html[data-theme="dark"] .intel-item.clue { border-left-color:#e0785f !important; }
html[data-theme="dark"] .intel-empty { color:#8a7a60 !important; }

/* ============================================================
   深色兜底：元素上的内联 style（需用属性选择器 + !important 才能覆盖）
   ============================================================ */
html[data-theme="dark"] [style*="background:#fff"],
html[data-theme="dark"] [style*="background: #fff"],
html[data-theme="dark"] [style*="background:#ffffff"] { background:#241d16 !important; }

html[data-theme="dark"] [style*="background:#fdf6e9"],
html[data-theme="dark"] [style*="background: #fdf6e9"] { background:#211b15 !important; }

html[data-theme="dark"] [style*="background:#efe3cc"],
html[data-theme="dark"] [style*="background:#f7f1e6"],
html[data-theme="dark"] [style*="background:#f5efe4"],
html[data-theme="dark"] [style*="background:#e8e0d0"] { background:#241d16 !important; }

html[data-theme="dark"] [style*="background:#f3ead8"],
html[data-theme="dark"] [style*="background:#eee2cc"],
html[data-theme="dark"] [style*="background:#efe8da"],
html[data-theme="dark"] [style*="background:#fbf6ec"] { background:#2a231a !important; }

/* 内联文字色 */
html[data-theme="dark"] [style*="color:#3a2d22"],
html[data-theme="dark"] [style*="color: #3a2d22"] { color:#e8ddc8 !important; }
html[data-theme="dark"] [style*="color:#6b5435"],
html[data-theme="dark"] [style*="color: #6b5435"] { color:#c9b48f !important; }
html[data-theme="dark"] [style*="color:#8a7a60"],
html[data-theme="dark"] [style*="color: #8a7a60"] { color:#a8926e !important; }
html[data-theme="dark"] [style*="color:#8e2c22"],
html[data-theme="dark"] [style*="color: #8e2c22"] { color:#e0785f !important; }
html[data-theme="dark"] [style*="color:#a8926e"] { color:#8a7a60 !important; }

/* 内联浅色描边（放在背景规则之后，只改描边色，不冲突） */
html[data-theme="dark"] [style*="#eee2cc"] { border-color:#33291f !important; }
html[data-theme="dark"] [style*="#e5d9c3"],
html[data-theme="dark"] [style*="#d5c7a8"],
html[data-theme="dark"] [style*="#e0d4bc"] { border-color:#3a2e22 !important; }

/* ============================================================
   字号档位（sm 小 / md 标准 / lg 大 / xl 超大）
   ============================================================ */

/* 聊天气泡——跑团最主要的阅读面 */
html[data-fs="sm"] .msg { font-size:13px !important; }
html[data-fs="lg"] .msg { font-size:16.5px !important; line-height:1.75 !important; }
html[data-fs="xl"] .msg { font-size:19px !important; line-height:1.85 !important; }

html[data-fs="sm"] .msg.sys { font-size:11.5px !important; }
html[data-fs="lg"] .msg.sys { font-size:14px !important; }
html[data-fs="xl"] .msg.sys { font-size:15.5px !important; }

/* 输入框 */
/* 输入框：16px 是 iOS 不触发聚焦自动放大的下限，最小档也不低于 16px */
html[data-fs="sm"] .typebox input { font-size:16px !important; }
html[data-fs="lg"] .typebox input { font-size:17px !important; }
html[data-fs="xl"] .typebox input { font-size:18px !important; }

/* 顶部标题 */
html[data-fs="lg"] .top .tt .t1, html[data-fs="lg"] .topbar .t1 { font-size:15.5px !important; }
html[data-fs="xl"] .top .tt .t1, html[data-fs="xl"] .topbar .t1 { font-size:17px !important; }

/* 首页卡片 */
html[data-fs="sm"] .info .title { font-size:13px !important; }
html[data-fs="lg"] .info .title { font-size:15.5px !important; }
html[data-fs="xl"] .info .title { font-size:17px !important; }
html[data-fs="sm"] .info .sub { font-size:10.5px !important; }
html[data-fs="lg"] .info .sub { font-size:12.5px !important; }
html[data-fs="xl"] .info .sub { font-size:13.5px !important; }
html[data-fs="lg"] .info .meta .pill, html[data-fs="xl"] .info .meta .pill { font-size:10.5px !important; }

/* 弹窗 / 抽屉正文 */
html[data-fs="lg"] .modal-box p, html[data-fs="xl"] .modal-box p { font-size:13px !important; }
html[data-fs="lg"] .drawer ul, html[data-fs="lg"] .drawer li { font-size:13.5px !important; }
html[data-fs="xl"] .drawer ul, html[data-fs="xl"] .drawer li { font-size:15px !important; }
html[data-fs="lg"] .guide-box li { font-size:14.5px !important; }
html[data-fs="xl"] .guide-box li { font-size:16px !important; }
html[data-fs="lg"] .ending .e-stats { font-size:13px !important; }
html[data-fs="xl"] .ending .e-stats { font-size:14.5px !important; }
html[data-fs="lg"] .pitem { font-size:15px !important; }
html[data-fs="xl"] .pitem { font-size:16.5px !important; }

/* ============================================================
   外观设置面板（Aa 按钮唤起的底部抽屉）
   ============================================================ */
.apt-theme-btn { background:rgba(0,0,0,.22); border:none; color:#fdf6e9; font-size:13px; font-weight:800;
  border-radius:14px; padding:5px 9px; cursor:pointer; font-family:inherit; line-height:1.2; }
.apt-theme-btn:active { opacity:.7; }
/* 深色模式下顶栏小按钮加深，避免在深红头里显眼 */
html[data-theme="dark"] .apt-theme-btn,
html[data-theme="dark"] .topbar .usermini,
html[data-theme="dark"] .top .usermini { background:rgba(0,0,0,.42) !important; color:#e8c15a !important; }

.apt-mask { position:fixed; inset:0; background:rgba(0,0,0,.45); z-index:200; display:none; }
.apt-mask.show { display:block; }
.apt-sheet { position:fixed; left:0; right:0; bottom:0; max-width:480px; margin:0 auto; z-index:201;
  background:#fdf6e9; color:#3a2d22; border-radius:20px 20px 0 0; padding:16px 18px calc(22px + env(safe-area-inset-bottom));
  transform:translateY(110%); transition:transform .28s ease; font-family:"PingFang SC","Microsoft YaHei",sans-serif; }
.apt-sheet.show { transform:translateY(0); }
.apt-sheet .apt-hd { display:flex; align-items:center; margin-bottom:12px; }
.apt-sheet .apt-hd b { font-size:15px; letter-spacing:1px; }
.apt-sheet .apt-x { margin-left:auto; background:none; border:none; font-size:17px; color:#8a7a60; cursor:pointer; }
.apt-sheet .apt-lbl { font-size:11px; letter-spacing:2px; color:#8a7a60; margin:12px 0 7px; }
.apt-seg { display:flex; gap:6px; }
.apt-seg button { flex:1; padding:10px 0; border-radius:14px; border:1px solid #e5d9c3; background:#fff;
  color:#6b5435; font-size:12.5px; font-weight:700; cursor:pointer; font-family:inherit; }
.apt-seg button.on { background:#8e2c22; border-color:#8e2c22; color:#fff; }
.apt-prev { margin-top:14px; background:#efe3cc; border-radius:14px; padding:12px 14px; font-size:14px; line-height:1.7; }
.apt-prev span { display:block; font-size:10px; letter-spacing:2px; color:#8a7a60; margin-bottom:5px; }
.apt-ok { width:100%; margin-top:14px; padding:13px; border:none; border-radius:16px; background:#8e2c22;
  color:#fff; font-size:15px; font-weight:800; cursor:pointer; font-family:inherit; }
.apt-note { font-size:10.5px; color:#a8926e; margin-top:9px; text-align:center; line-height:1.5; }

/* 面板自身跟随深色 */
html[data-theme="dark"] .apt-sheet { background:#211b15 !important; color:#e8ddc8 !important;
  box-shadow:0 -12px 40px rgba(0,0,0,.6) !important; }
html[data-theme="dark"] .apt-sheet .apt-x { color:#a8926e !important; }
html[data-theme="dark"] .apt-sheet .apt-lbl { color:#a8926e !important; }
html[data-theme="dark"] .apt-seg button { background:#2a231a !important; border-color:#3a2e22 !important; color:#c9b48f !important; }
html[data-theme="dark"] .apt-seg button.on { background:#8e2c22 !important; border-color:#8e2c22 !important; color:#fff !important; }
html[data-theme="dark"] .apt-prev { background:#17130f !important; }
html[data-theme="dark"] .apt-note { color:#8a7a60 !important; }