/* ============================================================
   sls-mode.css · 操作模式（按钮式 / 滑动式）
   手机（含微信内置浏览器）强制「按钮式」；平板 / 电脑可选，选择会记住。
   按钮式 = 一屏一件事：宫格选功能 → 单区块全屏 → 底部固定按钮返回/翻屏。
   所有需要「滑」「拖」「拽」的操作，都在这里给出按钮替代。
   ============================================================ */

:root{
  --im-ink:#0f172a;
  --im-sub:#64748b;
  --im-line:#e2e8f0;
  --im-bg:#f5f7fb;
  --im-card:#ffffff;
  --im-blue:#2563eb;
  --im-blue-soft:#eef4ff;
  --im-safe:env(safe-area-inset-bottom, 0px);
}

/* 按钮式下：给底部操作条留位置，别把页面最后一行盖住 */
html[data-imode="button"] body{
  padding-bottom: calc(72px + var(--im-safe)) !important;
  overscroll-behavior-x: none;
}
html[data-imode="button"]{
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

/* 按钮式下，靠 hover 才出现的操作一律常显（手机没有 hover） */
html[data-imode="button"] .im-hover-only{ opacity:1 !important; visibility:visible !important; }

/* 只在某一模式下显示的元件 */
html[data-imode="button"] .im-scroll-only{ display:none !important; }
html[data-imode="scroll"] .im-button-only{ display:none !important; }

/* ------------------------------------------------------------
   ① 底部固定按钮条
   ------------------------------------------------------------ */
#slsBar{
  position:fixed; left:0; right:0; bottom:0; z-index:180;
  display:none; gap:8px; align-items:stretch;
  padding:8px 10px calc(8px + var(--im-safe));
  background:rgba(255,255,255,.94);
  border-top:1px solid var(--im-line);
  box-shadow:0 -8px 24px -18px rgba(15,23,42,.5);
  backdrop-filter:saturate(180%) blur(12px);
  -webkit-backdrop-filter:saturate(180%) blur(12px);
  font-family:inherit;
}
html[data-imode="button"] #slsBar{ display:flex; }
#slsBar button{
  flex:1 1 0; min-width:0; min-height:50px;
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px;
  border:1px solid var(--im-line); border-radius:14px; background:#fff;
  color:var(--im-ink); font:inherit; font-size:11.5px; font-weight:700; line-height:1.1;
  cursor:pointer; padding:6px 4px; -webkit-tap-highlight-color:transparent;
  transition:transform .12s ease, background .15s, border-color .15s;
}
#slsBar button i{ font-style:normal; font-size:17px; line-height:1 }
#slsBar button:active{ transform:scale(.96); background:var(--im-blue-soft); border-color:#bfd3fd; }
#slsBar button.on{ background:var(--im-blue-soft); border-color:#bfd3fd; color:#1d4ed8; }
#slsBar button[disabled]{ opacity:.42; }
#slsBar .im-bar-main{ flex:1.35 1 0; }

/* ------------------------------------------------------------
   ② 宫格首页
   ------------------------------------------------------------ */
#slsHome{
  position:fixed; inset:0; z-index:170; display:none;
  background:linear-gradient(170deg,#f7f9fe 0%,#f2f5fb 60%,#eef3fb 100%);
  overflow-y:auto; -webkit-overflow-scrolling:touch; overscroll-behavior:contain;
  padding:calc(16px + env(safe-area-inset-top,0px)) 14px calc(84px + var(--im-safe));
  font-family:inherit; color:var(--im-ink);
}
#slsHome.on{ display:block; animation:imFade .18s ease both }
@keyframes imFade{ from{opacity:0; transform:translateY(6px)} to{opacity:1; transform:none} }

.sls-hd{ display:flex; align-items:center; justify-content:space-between; gap:10px; margin:2px 2px 14px }
.sls-hd h1{ margin:0; font-size:20px; font-weight:800; letter-spacing:-.4px; line-height:1.25 }
.sls-hd p{ margin:4px 0 0; font-size:12.5px; color:var(--im-sub); line-height:1.55 }
.sls-hd .im-badge{
  flex:0 0 auto; font-size:11px; font-weight:800; color:#1d4ed8; background:var(--im-blue-soft);
  border:1px solid #d9e6ff; border-radius:999px; padding:5px 10px; white-space:nowrap;
}

#slsHomeGrid{ display:grid; grid-template-columns:1fr 1fr; gap:11px }
.sls-tile{
  position:relative; display:flex; flex-direction:column; align-items:flex-start; gap:5px;
  min-height:104px; padding:14px 13px 13px;
  border:1px solid #e6ecf8; border-radius:18px; background:var(--im-card);
  box-shadow:0 10px 24px -22px rgba(15,23,42,.75);
  font:inherit; text-align:left; cursor:pointer; color:var(--im-ink);
  -webkit-tap-highlight-color:transparent; transition:transform .14s ease, box-shadow .16s, border-color .16s;
  overflow:hidden;
}
.sls-tile:active{ transform:scale(.975); border-color:#bfd3fd; box-shadow:0 6px 18px -16px rgba(37,99,235,.6) }
.sls-tile .ic{
  display:flex; align-items:center; justify-content:center;
  width:38px; height:38px; border-radius:12px; font-size:19px; line-height:1;
  background:var(--im-blue-soft); border:1px solid #e0ebff; margin-bottom:3px;
}
.sls-tile b{ font-size:14.5px; font-weight:800; letter-spacing:-.2px; line-height:1.3 }
.sls-tile em{ font-style:normal; font-size:11.5px; color:var(--im-sub); line-height:1.45 }
.sls-tile .n{
  position:absolute; top:11px; right:11px; font-size:10.5px; font-weight:800; color:#94a3b8;
}
.sls-tile.noico .ic{
  background:var(--im-blue); border-color:var(--im-blue); color:#fff;
  font-size:16px; font-weight:800;
}
.sls-tile.wide{ grid-column:1 / -1; flex-direction:row; align-items:center; gap:12px; min-height:72px }
.sls-tile.wide .ic{ margin:0 }
.sls-tile .tx{ display:flex; flex-direction:column; gap:3px; min-width:0 }

.sls-tip{
  margin:14px 2px 0; padding:12px 13px; border-radius:14px;
  background:#fff; border:1px dashed #d9e2f2; color:var(--im-sub);
  font-size:12px; line-height:1.65;
}
.sls-tip b{ color:var(--im-ink) }

/* ------------------------------------------------------------
   ③ 单区块全屏聚焦层
   ------------------------------------------------------------ */
#slsStage{
  position:fixed; inset:0; z-index:160; display:none;
  background:#fff; overflow-y:auto; -webkit-overflow-scrolling:touch; overscroll-behavior:contain;
  font-family:inherit; color:var(--im-ink);
}
#slsStage.on{ display:block }
#slsStageHead{
  position:sticky; top:0; z-index:3; display:flex; align-items:center; gap:10px;
  min-height:54px; padding:calc(8px + env(safe-area-inset-top,0px)) 12px 8px;
  background:rgba(255,255,255,.96); border-bottom:1px solid var(--im-line);
  backdrop-filter:saturate(180%) blur(10px); -webkit-backdrop-filter:saturate(180%) blur(10px);
}
#slsStageHead .bk{
  flex:0 0 auto; display:inline-flex; align-items:center; gap:5px;
  min-height:38px; padding:0 13px; border-radius:999px;
  border:1px solid var(--im-line); background:#fff; color:var(--im-ink);
  font:inherit; font-size:13px; font-weight:800; cursor:pointer;
}
#slsStageHead .bk:active{ background:var(--im-blue-soft) }
#slsStageHead .tt{
  flex:1 1 auto; min-width:0; font-size:14.5px; font-weight:800; letter-spacing:-.2px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
#slsStageBody{ padding:14px 14px calc(96px + var(--im-safe)) }
#slsStageBody .sls-in-stage{ margin:0 !important; max-width:none !important; width:auto !important }

/* 聚焦时，页面本体不上不下地留在后面，避免抖动 */
html.sls-focus body > *:not(#slsStage):not(#slsBar):not(#slsHome):not(#slsModeChip){ }

/* ------------------------------------------------------------
   ④ 平板 / 电脑 的模式切换胶囊
   ------------------------------------------------------------ */
#slsModeChip{
  position:fixed; right:14px; bottom:calc(14px + var(--im-safe)); z-index:190;
  display:none; align-items:center; gap:7px;
  padding:9px 14px; min-height:40px; border-radius:999px;
  border:1px solid #dbe4f5; background:rgba(255,255,255,.96); color:#0f172a;
  font:inherit; font-size:12.5px; font-weight:800; cursor:pointer;
  box-shadow:0 10px 26px -16px rgba(15,23,42,.55);
  backdrop-filter:blur(8px); -webkit-backdrop-filter:blur(8px);
}
#slsModeChip:hover{ border-color:#bfd3fd; background:#fff }
#slsModeChip i{ font-style:normal; font-size:15px }
#slsModeChip.on{ border-color:#bfd3fd }
html.sls-chip-on #slsModeChip{ display:inline-flex }
html[data-imode="button"] #slsModeChip{ bottom:calc(78px + var(--im-safe)) }

/* ------------------------------------------------------------
   ⑤ 把「滑」和「拖」换成按钮
   ------------------------------------------------------------ */

/* 横向滚动容器：加左右两个按钮，并禁掉手指横滑 */
.sls-hwrap{ position:relative }
.sls-hstep{
  display:flex; gap:8px; justify-content:flex-end; margin:6px 0 2px;
}
.sls-hstep button{
  min-width:56px; min-height:40px; border-radius:12px;
  border:1px solid var(--im-line); background:#fff; color:var(--im-ink);
  font:inherit; font-size:15px; font-weight:800; cursor:pointer;
}
.sls-hstep button:active{ background:var(--im-blue-soft) }
.sls-hstep button[disabled]{ opacity:.35 }
html[data-imode="button"] .sls-hscroll{ touch-action:pan-y; scroll-behavior:smooth; }

/* 数字/难度滑块：加 − / + */
.sls-step{ display:inline-flex; align-items:center; gap:6px; vertical-align:middle }
.sls-step button{
  width:38px; height:38px; border-radius:11px; border:1px solid var(--im-line); background:#fff;
  color:var(--im-ink); font:inherit; font-size:18px; font-weight:800; line-height:1; cursor:pointer;
}
.sls-step button:active{ background:var(--im-blue-soft) }
.sls-step .v{ min-width:2.4em; text-align:center; font-size:13px; font-weight:800 }

/* 拖拽排序项：右上角上移/下移 */
.sls-move{ display:inline-flex; gap:6px; margin-left:6px }
.sls-move button{
  width:34px; height:34px; border-radius:10px; border:1px solid var(--im-line); background:#fff;
  color:#334155; font:inherit; font-size:13px; font-weight:800; cursor:pointer; line-height:1;
}
.sls-move button:active{ background:var(--im-blue-soft) }

/* 手机上没有 hover：所有 :hover 才显示的按钮改为常显 */
@media (hover:none){
  html[data-imode="button"] .im-hover-only{ opacity:1 !important; visibility:visible !important }
}

/* ------------------------------------------------------------
   ⑥ 小屏适配
   ------------------------------------------------------------ */
@media (max-width:360px){
  #slsHomeGrid{ gap:9px }
  .sls-tile{ min-height:96px; padding:12px 11px }
  .sls-tile b{ font-size:13.5px }
}
@media (min-width:768px){
  #slsHome{ padding-left:max(14px, 8vw); padding-right:max(14px, 8vw) }
  #slsHomeGrid{ grid-template-columns:repeat(3, 1fr); gap:14px }
  .sls-tile{ min-height:118px }
  #slsStage{ left:50%; transform:translateX(-50%); width:min(860px, 100%); border-left:1px solid var(--im-line); border-right:1px solid var(--im-line) }
  #slsStageHead{ padding-left:16px; padding-right:16px }
  #slsStageBody{ padding:18px 20px calc(96px + var(--im-safe)) }
}

/* 深色系统 */
@media (prefers-color-scheme: dark){
  html[data-imode="button"] #slsBar{ background:rgba(17,24,39,.94); border-top-color:#1f2937 }
  #slsBar button{ background:#111827; color:#e5e7eb; border-color:#1f2937 }
  #slsHome{ background:#0b1220; color:#e5e7eb }
  .sls-tile{ background:#111827; border-color:#1f2937; color:#e5e7eb }
  .sls-tile em, .sls-hd p{ color:#94a3b8 }
  .sls-tile .ic{ background:#16213a; border-color:#1f2937 }
  #slsStage{ background:#0b1220; color:#e5e7eb }
  #slsStageHead{ background:rgba(17,24,39,.96); border-bottom-color:#1f2937 }
  #slsStageHead .bk{ background:#111827; color:#e5e7eb; border-color:#1f2937 }
  .sls-tip{ background:#111827; border-color:#1f2937; color:#94a3b8 }
  #slsModeChip{ background:rgba(17,24,39,.96); color:#e5e7eb; border-color:#1f2937 }
}

/* ============================================================
   ROUND35 · 管理端 / 题库端：屏幕固定，只有内部滚动
   （sls-mode.js 给 html 挂 sls-fixscr；页面本身不滚，内容区内部滚）
   ============================================================ */
html.sls-fixscr, html.sls-fixscr body{ height:100% !important; }
html.sls-fixscr body{
  overflow:hidden !important;
  display:flex; flex-direction:column;
}
/* admin：header / nav 留在顶部，main 内部滚 */
html.sls-fixscr body > main{
  flex:1 1 auto; min-height:0; width:100%;
  overflow-y:auto; -webkit-overflow-scrolling:touch; overscroll-behavior:contain;
}
/* bank：.app 整体内部滚 */
html.sls-fixscr body > .app{
  flex:1 1 auto; min-height:0; width:100%;
  overflow-y:auto; -webkit-overflow-scrolling:touch; overscroll-behavior:contain;
}
/* __SLS_R289_ADMINMODE__ 管理端解锁后内容挂在 #admMount 里，body > main 这条匹配不到。
   按钮式下让 header / nav 留在顶部，只有 main 内部滚，切回按钮式也不会卡住。 */
html.sls-fixscr #admMount{
  flex:1 1 auto; min-height:0; width:100%;
  display:flex; flex-direction:column; overflow:hidden;
}
html.sls-fixscr #admMount > main{
  flex:1 1 auto; min-height:0; width:100%;
  overflow-y:auto; -webkit-overflow-scrolling:touch; overscroll-behavior:contain;
}
