@media (max-width: 768px) {
/* ═══ R286 手机版适配层（mobile.css）
   原则：所有规则只在 ≤768px 窄屏（手机）生效；电脑版渲染零影响。
   R286b：公共头部收成细条+点击弹出菜单（见 .wk-mbar/.wk-mpan）。
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

/* ── 0. 全局基础 ── */
html { -webkit-text-size-adjust: 100%; }
body { touch-action: manipulation; }           /* 去掉点按300ms延迟 */
img, video { max-width: 100%; height: auto; }
table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
/* iOS聚焦自动放大防护：输入控件字号≥16px */
textarea, input[type=text], input[type=number], input[type=password], input[type=search], input[type=email], select { font-size: 16px !important; }
/* 装饰动画全关（省电省性能） */
.wkbg i { animation: none !important; }
/* 蜗小壳：手机上整体隐藏 */
#wkpFab, #wkpPan { display: none !important; }
/* 弹窗统一不超屏 */
.mask { padding: 10px; }
.modal { width: min(420px, 94vw) !important; }

/* ── 1. 公共头部（_header.html / .wk-top）：细条+弹出菜单 ── */
/* mobile.js 把原头部内容搬进 .wk-mpan 面板，这里只管样式 */
.wk-top { display: block !important; padding: 0 !important; gap: 0 !important; background: rgba(13,13,18,.94) !important; }
.wk-mbar { display: flex; align-items: center; justify-content: space-between; padding: 6px 12px; }
.wk-mbrand { font-size: 12px; font-weight: 700; color: #bfc8e8; letter-spacing: 1px; }
.wk-mtoggle { font-size: 12px; color: #e8e8f2; background: rgba(29,29,41,.55); border: 1px solid rgba(255,255,255,.10); border-radius: 14px; padding: 5px 12px; }
.wk-mpan { display: none; position: absolute; top: 100%; left: 0; right: 0; background: rgba(16,16,24,.98); border-bottom: 1px solid rgba(255,255,255,.08); padding: 12px; gap: 8px; flex-wrap: wrap; z-index: 99; box-shadow: 0 12px 30px rgba(0,0,0,.5); }
.wk-top.wk-mopen .wk-mpan { display: flex; }
/* 面板内所有小按钮：统一"两个字"大小（和退出一样大），无图标 */
.wk-mpan a, .wk-mpan button, .wk-mpan #creditBar, .wk-mpan span[onclick] {
  font-size: 12px !important; padding: 6px 12px !important; border-radius: 14px !important;
  background: rgba(29,29,41,.55) !important; border: 1px solid rgba(255,255,255,.10) !important;
  color: #e8e8f2 !important; text-shadow: none !important; white-space: nowrap; letter-spacing: .4px;
}
.wk-mpan svg { display: none !important; }
.wk-mpan select { font-size: 12px !important; padding: 5px 8px !important; border-radius: 14px !important; max-width: 160px; }
.wk-mpan #creditBal { font-size: 12px !important; margin-left: 4px; color: #9fd8d2 !important; }
.wk-mpan .wk-mtheme { display: inline-flex; }

/* ── 2. 首页（home.html）── */
.hero { padding: 44px 16px 28px; }
.hero h2 { font-size: 24px; letter-spacing: 1px; }
.hero > div { width: 100% !important; white-space: normal !important; }
.container { padding: 18px 14px 60px; }
.section-title { font-size: 17px; margin: 26px 0 12px; }
/* 15个入口方块：手机两列紧凑 */
.grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }
.card { height: auto !important; min-height: 112px; padding: 13px 12px; border-radius: 13px; }
.card .head { gap: 8px; min-height: 26px; margin-bottom: 8px; }
.card .head svg.cicon { width: 22px !important; height: 22px !important; }
.card h3 { font-size: 14px; }
.card p { font-size: 11px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card .enter-hint { font-size: 11px; }
.card .formtag { display: none; }
.card.disabled .lock { top: 8px; right: 8px; }
footer { font-size: 11px; padding: 16px 10px; }

/* ── 3. 工作台顶栏（original.html / novelbook.html 共用 .top/.wtabs）── */
/* 关键修复：标签条窄屏换行占满整行，四个标签全部可见可点 */
.top { flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
.top .back { padding: 6px 10px; font-size: 12px; }
.top .ptitle { max-width: 40vw; }
.top .wtabs { order: 9; width: 100%; margin: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.wtabs .t { padding: 8px 13px; font-size: 13px; flex: 1 0 auto; }

/* ── 4. 剧本工作台（original.html，5剧本共用）── */
#tocBox { width: 100% !important; position: static !important; }
#charToc { max-height: 190px; }
#relCards { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
.epsgrid, .sgrid, .pgrid { flex-direction: column; }
.sidepanel, .sside, .slist { width: 100% !important; position: static !important; max-height: none !important; }
.chlist { width: 100% !important; position: static !important; max-height: 240px !important; }
.epeditor, .editor { min-width: 0 !important; }
#pane_script { margin-left: 0 !important; margin-right: 0 !important; }
#charEdMask > div { padding: 16px 14px !important; max-height: 92vh; }
#charEdMask .frow { flex-wrap: wrap; }
.epopts { grid-template-columns: repeat(2, 1fr) !important; }
.btnrow { flex-wrap: wrap; gap: 8px; }

/* ── 5. 小说工作台（novelbook.html 长篇+短篇共用）── */
.editor { min-width: 0 !important; }
.sidepanel { width: 100% !important; position: static !important; max-height: none !important; }
.chlist { width: 100% !important; position: static !important; max-height: 240px !important; }
#pane_idea { padding: 0 4px; }
#edThemePanel { width: min(308px, 88vw) !important; }
#chFlowToc, #olFlowToc { width: 118px; }

/* ── 6. 脑洞页（create.html / novel.html / short.html）── */
.wrap { padding: 26px 14px 90px; }
.proj { flex-wrap: wrap; }

}

/* 首页活动条（手机简化版） */
.hero > div a { color:#ffd9e6 !important; text-decoration:none; font-size:13px; }

/* ═══ R286d 首页标题徽章 + 脑洞页精简 ═══ */
.section-title { margin: 26px 0 14px; }
.section-title .wk-sticon { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, #3d4bff, #00c2ff); font-size: 15px; box-shadow: 0 2px 8px rgba(61, 75, 255, .35); flex: 0 0 30px; }
.section-title .wk-sttext { font-size: 16.5px; font-weight: 800; letter-spacing: 1px; }
#lenRow::-webkit-scrollbar { display: none; }
.frow .flab { width: auto !important; flex: 0 0 auto !important; }
#ideaSkillSel { max-width: none !important; width: auto !important; flex: 1 !important; min-width: 0; padding: 7px 10px; }
#m_create { min-width: 0 !important; flex: 1 !important; padding: 7px 10px; }
#btnImport { padding: 8px 12px !important; font-size: 12.5px !important; }
#btnImport svg { margin-right: 3px !important; width: 13px; height: 13px; }
#btnBrain { padding: 13px 26px !important; font-size: 15px !important; white-space: nowrap; }
.mysec h3 { flex-wrap: nowrap; gap: 12px; }
.mysec h3 .btn-next { padding: 2px 0 !important; border: none !important; background: none !important; box-shadow: none !important; color: #8fd3ff; font-size: 13px; white-space: nowrap; }
.sktab { white-space: nowrap; padding: 6px 11px !important; font-size: 12.5px !important; }

/* ═══ R286g novel/short 脑洞页精简 ═══ */
#m_idea { max-width: none !important; flex: 1 !important; min-width: 0; padding: 7px 10px; }
#btnImportToggle { padding: 8px 12px !important; font-size: 12.5px !important; white-space: nowrap; }
#btnIdea, #btnCreate, #btnUpload { padding: 11px 14px !important; font-size: 13.5px !important; white-space: nowrap; }
#ideaSkillSel { max-width: none !important; width: auto !important; flex: 1 !important; min-width: 0; padding: 7px 10px; }
#lenRow { flex-wrap: nowrap !important; overflow-x: auto; }
#lenRow .tag { white-space: nowrap; flex-shrink: 0; }

/* ── R286i 人物小传手机重构 ── */
#relCards { display: none !important; }
#tocBox { display: none !important; }
#mCharChips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
#mCharChips .m-chip { background: var(--panel2); border: 1px solid var(--border); color: var(--text); border-radius: 18px; padding: 8px 16px; font-size: 14px; cursor: pointer; }
#mCharChips .m-chip.add { color: #8fa6ff; border-color: rgba(143, 166, 255, .4); }
#mCharReader { display: none; position: fixed; inset: 0; background: rgba(5, 5, 10, .8); z-index: 400; align-items: flex-end; justify-content: center; }
#mCharReader.show { display: flex; }
#mCharReader .m-rd-box { background: var(--panel); border: 1px solid var(--border); border-radius: 16px 16px 0 0; width: 100%; max-height: 86vh; overflow-y: auto; padding: 18px 16px 26px; position: relative; }
#mCharReader h3 { margin: 0 0 10px; font-size: 17px; padding-right: 40px; }
#mCharReader pre { white-space: pre-wrap; word-break: break-word; font-family: inherit; font-size: 14.5px; line-height: 1.8; color: var(--text); margin: 0; }
#mCharReader #mRdX { position: absolute; top: 12px; right: 12px; background: var(--panel2); border: 1px solid var(--border); border-radius: 50%; width: 30px; height: 30px; color: var(--muted); font-size: 13px; cursor: pointer; }
#mCharReader .m-rd-foot { margin-top: 16px; display: flex; gap: 8px; }
#mCharReader #mRdEdit { flex: 1; background: var(--panel2); border: 1px solid var(--border); color: var(--text); border-radius: 10px; padding: 10px 0; font-size: 14px; cursor: pointer; }
#mCharsBar { display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 390; background: var(--panel); border-top: 1px solid var(--border); padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); gap: 10px; }
#mCharsBar .btn { flex: 1; margin: 0; }
/* ── R286i 粗纲间距删除 ── */
#pane_eps .card > .ephead { margin-bottom: 6px !important; gap: 6px; }
#pane_eps .ephead > div { flex-wrap: nowrap !important; overflow-x: auto; width: 100%; }
#pane_eps .card > .btnrow { margin-top: 4px !important; }
/* ── R286i 「总共多少集」收起栏 ── */
#mEpBar { border: 1px solid var(--border); border-radius: 12px; background: var(--panel2); margin: 8px 0; overflow: hidden; }
#mEpBarHead { display: flex; justify-content: space-between; align-items: center; padding: 11px 14px; font-size: 14px; font-weight: 700; cursor: pointer; color: var(--text); }
#mEpBarHead .m-arrow { transition: transform .2s; color: var(--muted); }
#mEpBarBody { display: none; padding: 0 12px 12px; }
#mEpBar.open #mEpBarBody { display: block; }
#mEpBar.open #mEpBarHead .m-arrow { transform: rotate(180deg); }
#mEpBarBody .epopts { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 10px; }
#mEpBarBody .epopts button { background: var(--panel); border: 1px solid var(--border); color: var(--text); border-radius: 10px; padding: 8px 14px; font-size: 13px; cursor: pointer; }
#mEpBarBody .epopts button.on { border-color: #6d7dff; color: #a9b2ff; background: rgba(109, 125, 255, .14); }
#mCharReader #mRdX { z-index: 5; width: 34px; height: 34px; line-height: 1; }
#mCharReader h3 { pointer-events: none; }
#mCharReader pre { pointer-events: auto; }

}
