/* ================================================================
   Phone Farm — 设计系统
   ================================================================
   基准来自指定的六个值：
     页面底 #181922 / 容器底 #262834 / 容器描边 #3A3C4A
     主按钮 #D2BB7C → #C2A666 → #AD9154，按钮字 #241D13
     圆角 28px，阴影 rgba(0,0,0,.35) blur 16 offsetY 4

   其余令牌都是从这六个推出来的，改主色只需要改这一段：
   * 表面用「页面 < 凹陷 < 容器 < 抬起」四级，不靠阴影分层，靠明度差
   * 金色是唯一强调色，**只给主操作**。到处都是金就等于没有强调
   * 文字偏暖白（#F1EFEA 而非纯白），跟金色同色温，纯白配金会发脏
   ================================================================ */
:root {
  /* —— 表面 —— */
  --page:      #181922;   /* 页面底 */
  --sunken:    #1F2029;   /* 比页面更深一档：输入框、屏幕位、代码块 */
  --surface:   #262834;   /* 容器底 */
  --surface-2: #2F3140;   /* 容器内抬起一档：hover、次级块 */
  --surface-3: #383A4B;   /* 再抬一档：active、选中态底色 */

  /* —— 描边 —— */
  --line:    #3A3C4A;
  --line-2:  #4A4D5E;     /* 强调分隔 / hover 边 */

  /* —— 金 —— */
  --gold-1: #D2BB7C;
  --gold-2: #C2A666;
  --gold-3: #AD9154;
  --gold:   linear-gradient(180deg, #D2BB7C 0%, #C2A666 55%, #AD9154 100%);
  --gold-hover: linear-gradient(180deg, #DFCB92 0%, #D0B475 55%, #BC9F5F 100%);
  --on-gold: #241D13;
  --gold-soft: rgba(210, 187, 124, .12);   /* 极淡底色：选中、标签 */
  --gold-line: rgba(210, 187, 124, .30);
  --gold-ring: rgba(210, 187, 124, .40);   /* 聚焦光圈 */

  /* —— 文字 —— */
  --text:   #F1EFEA;
  --text-2: #BAB9C4;
  --muted:  #8B8A99;
  --subtle: #5E5D6B;

  /* —— 语义色（都往暖里压过，避免和金撞色）—— */
  --live:    #6BCB9B;
  --live-bg: rgba(107, 203, 155, .12);
  --fire:    #E58B84;
  --fire-bg: rgba(229, 139, 132, .12);
  --warn:    #E3B667;
  --warn-bg: rgba(227, 182, 103, .12);

  /* —— 圆角：28 是容器基准，其余按比例降 —— */
  --r-xl:   28px;
  --r-lg:   20px;
  --r-md:   14px;
  --r-sm:   10px;
  --r-pill: 999px;

  /* —— 阴影 —— */
  --shadow:    0 4px 16px rgba(0, 0, 0, .35);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .50);

  /* —— 字体 —— */
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", "PingFang SC",
          "Microsoft YaHei", sans-serif;
  --mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace;

  /* —— 动效：统一一条曲线，别每处自己写 —— */
  --ease: cubic-bezier(.4, 0, .2, 1);
  --fast: 120ms var(--ease);
  --slow: 220ms var(--ease);
}

/* ---------------- 基础 ---------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--page);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

::selection { background: var(--gold-ring); color: var(--on-gold); }

/* 滚动条：细、暗、hover 才明显，别抢画面 */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--line); border-radius: var(--r-pill);
  border: 3px solid transparent; background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--line-2); background-clip: content-box; }

/* 全局聚焦圈。鼠标点击不显示，键盘 Tab 才显示 */
:focus-visible {
  outline: 2px solid var(--gold-ring);
  outline-offset: 2px;
}

/* ---------------- 排印零件 ---------------- */
.eyebrow {
  font-size: 10.5px; font-weight: 600; letter-spacing: .09em;
  text-transform: uppercase; color: var(--muted);
}
.hint { font-size: 12px; color: var(--muted); line-height: 1.6; }
.hint em { color: var(--gold-1); font-style: normal; font-weight: 500; }
.mono, code { font-family: var(--mono); font-size: .92em; }
.err { color: var(--fire); font-size: 12px; min-height: 1em; }

/* ---------------- 按钮 ---------------- */
button {
  font: inherit;
  font-weight: 500;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 7px 14px;
  cursor: pointer;
  transition: background var(--fast), border-color var(--fast),
              color var(--fast), transform var(--fast);
  white-space: nowrap;
}
button:hover { background: var(--surface-3); border-color: var(--line-2); color: var(--text); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .4; cursor: not-allowed; transform: none; }

/* 主操作。金色渐变只给它 —— 一屏里最多出现一两个 */
button.go, .btn-primary {
  background: var(--gold);
  color: var(--on-gold);
  border: none;
  font-weight: 600;
  box-shadow: var(--shadow);
  padding: 8px 18px;
}
button.go:hover, .btn-primary:hover { background: var(--gold-hover); color: var(--on-gold); }
button.go:disabled { background: var(--surface-3); color: var(--muted); box-shadow: none; }

/* 次级：透明底，只有文字和描边 */
button.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
  padding: 6px 12px;
}
button.ghost:hover { background: var(--surface-2); color: var(--text); border-color: var(--line-2); }

.lang-toggle { min-width: 40px; font-family: var(--mono); font-size: 11px; letter-spacing: .04em; }

/* 图标按钮：正方形、无文字 */
button.preview-btn {
  width: 26px; height: 26px; padding: 0;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  background: transparent; border-color: transparent;
  color: var(--muted); font-size: 13px;
}
button.preview-btn:hover { background: var(--gold-soft); color: var(--gold-1); border-color: var(--gold-line); }

/* 按钮阵列 */
.btn-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.btn-grid.four { grid-template-columns: repeat(4, 1fr); }
.btn-grid button { padding: 9px 4px; font-size: 12px; }

/* ---------------- 表单 ---------------- */
input[type="text"], input[type="password"], input[type="number"], select, textarea {
  font: inherit;
  width: 100%;
  color: var(--text);
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 8px 12px;
  transition: border-color var(--fast), box-shadow var(--fast), background var(--fast);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold-line);
  box-shadow: 0 0 0 3px var(--gold-ring);
  background: var(--page);
}
input::placeholder { color: var(--subtle); }
input[type="number"] { font-family: var(--mono); text-align: center; }

select {
  appearance: none;
  padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}

/* 勾选框：自绘，原生的在暗底上是白方块，很脏 */
input[type="checkbox"] {
  appearance: none;
  width: 16px; height: 16px; flex: none;
  border: 1.5px solid var(--line-2);
  border-radius: 5px;
  background: var(--sunken);
  cursor: pointer;
  display: grid; place-items: center;
  transition: background var(--fast), border-color var(--fast);
}
input[type="checkbox"]:checked {
  background: var(--gold);
  border-color: var(--gold-3);
}
input[type="checkbox"]:checked::after {
  content: "";
  width: 4px; height: 8px;
  border: solid var(--on-gold);
  border-width: 0 2px 2px 0;
  transform: rotate(42deg) translate(-1px, -1px);
}
input[type="checkbox"]:disabled { opacity: .35; cursor: not-allowed; }

.row { display: flex; gap: 8px; align-items: center; }
.row > input { flex: 1; min-width: 0; }
/* 勾选框不能被 .row > input 的 flex:1 拉成一整条。
   两条规则特异度相同，靠顺序在后面压过去。 */
.row > input[type="checkbox"] { flex: none; width: 16px; }
.row.check {
  gap: 9px; cursor: pointer; user-select: none;
  padding: 8px 10px; border-radius: var(--r-md);
  color: var(--text-2); font-size: 12.5px;
  transition: background var(--fast);
}
.row.check:hover { background: var(--surface-2); }

/* ---------------- 顶栏 ---------------- */
.topbar {
  flex: none;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: nowrap;
  gap: 16px;
  height: 56px; padding: 0 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; flex: none; white-space: nowrap; }
.brand h1 {
  font-size: 14px; font-weight: 600; letter-spacing: -.01em;
  color: var(--text);
}
/* 品牌点：连上是活的绿，用呼吸表示"在线"而不是静态圆点 */
.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 0 3px var(--live-bg);
  animation: breathe 2.6s var(--ease) infinite;
}
@keyframes breathe { 0%, 100% { opacity: 1 } 50% { opacity: .45 } }

.admin-badge {
  font-size: 10px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  color: var(--gold-1); background: var(--gold-soft);
  border: 1px solid var(--gold-line);
  padding: 2px 8px; border-radius: var(--r-pill);
}

.stats {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--muted);
  min-width: 0; overflow-x: auto; scrollbar-width: none;
}
.stats::-webkit-scrollbar { display: none; }
.stats > span {
  display: inline-flex; align-items: baseline; gap: 4px;
  flex: none; white-space: nowrap;
  padding: 4px 11px;
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
}
.stats strong { color: var(--text); font-weight: 600; font-family: var(--mono); font-size: 12.5px; }
.stats .sel { border-color: var(--gold-line); background: var(--gold-soft); }
.stats .sel strong { color: var(--gold-1); }
.stats .link {
  color: var(--muted); text-decoration: none;
  padding: 6px 12px; border-radius: var(--r-pill);
  border: 1px solid transparent;
  transition: color var(--fast), background var(--fast), border-color var(--fast);
}
.stats .link:hover { color: var(--text); background: var(--surface-2); border-color: var(--line); }

/* ---------------- 控制台三栏 ---------------- */
.layout {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr) 300px;
  gap: 14px;
  padding: 14px;
}

/* —— 左：群控栏 —— */
.rail {
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 14px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow);
}
.rail-head { display: flex; flex-direction: column; gap: 5px; }
.rail-head .hint { font-size: 11.5px; }
.rail-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
/* 抽屉把手和关闭按钮只在手机端出现，桌面端左栏是常驻的 */
.rail-grip { display: none; }
.rail-close { display: none; padding: 4px 10px; }

.group { display: flex; flex-direction: column; gap: 8px; }
.group-label {
  font-size: 10.5px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--subtle);
}

/* —— 中：设备网格 —— */
.stage { overflow-y: auto; min-width: 0; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(184px, 1fr));
  gap: 12px;
  align-content: start;
}
.stage-empty {
  height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; color: var(--muted); text-align: center;
}
.stage-empty-icon { font-size: 30px; opacity: .5; }

.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: border-color var(--fast), transform var(--fast), box-shadow var(--fast);
}
.tile:hover { border-color: var(--line-2); transform: translateY(-1px); }
/* 选中：整卡描金 + 淡金内发光，一眼能从网格里扫出来 */
.tile.selected {
  border-color: var(--gold-line);
  box-shadow: var(--shadow), inset 0 0 0 1px var(--gold-soft);
}
/* 没在解码的小窗：别让人以为是黑屏坏了 */
.paused-hint {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  text-align: center;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--subtle);
  background: var(--sunken);
}
.tile.paused .paused-hint { display: flex; }
.tile.paused canvas { opacity: 0; }

.tile.previewing { border-color: var(--gold-2); box-shadow: var(--shadow), 0 0 0 1px var(--gold-2); }

.tile-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 9px 12px;
  border-bottom: 1px solid var(--line);
}
.pick { display: flex; align-items: center; gap: 8px; cursor: pointer; min-width: 0; }
.model {
  font-size: 12.5px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.state {
  font-size: 10px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  padding: 2px 8px; border-radius: var(--r-pill);
  background: var(--surface-3); color: var(--muted);
  white-space: nowrap;
}
.state-device { background: var(--live-bg); color: var(--live); }
.state-unauthorized { background: var(--warn-bg); color: var(--warn); }

.screen {
  position: relative;
  aspect-ratio: 9 / 16;
  background: var(--sunken);
  display: grid; place-items: center;
}
.screen canvas { width: 100%; height: 100%; object-fit: contain; display: block; }
.tap-layer { position: absolute; inset: 0; cursor: crosshair; touch-action: none; }
.offline { color: var(--subtle); font-size: 11.5px; }
.serial {
  position: absolute; left: 8px; bottom: 8px;
  font-family: var(--mono); font-size: 9.5px; color: var(--text-2);
  background: rgba(24, 25, 34, .78);
  backdrop-filter: blur(4px);
  padding: 2px 7px; border-radius: var(--r-pill);
  pointer-events: none;
}
/* 指令下发时闪一下，让人看见"这台收到了" */
@keyframes pulse {
  0%   { box-shadow: var(--shadow), 0 0 0 0 var(--gold-ring); }
  100% { box-shadow: var(--shadow), 0 0 0 10px rgba(210,187,124,0); }
}
.tile.pulse { animation: pulse 520ms var(--ease); }

/* 操控者徽标 */
.holder-badge {
  position: absolute; right: 8px; top: 8px;
  font-size: 9.5px; font-weight: 600;
  padding: 2px 8px; border-radius: var(--r-pill);
  background: var(--fire-bg); color: var(--fire);
  border: 1px solid rgba(229, 139, 132, .3);
  backdrop-filter: blur(4px);
  pointer-events: none;
}
.holder-badge.me { background: var(--live-bg); color: var(--live); border-color: rgba(107, 203, 155, .3); }
.holder-tag {
  font-size: 10px; font-weight: 600;
  padding: 2px 8px; border-radius: var(--r-pill);
  background: var(--fire-bg); color: var(--fire);
}
.holder-tag.me { background: var(--live-bg); color: var(--live); }

/* —— 右：大屏预览 —— */
.preview-panel {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.preview-empty {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 24px;
  color: var(--subtle); font-size: 12px; text-align: center;
}
.preview-empty::before {
  content: "⛶";
  font-size: 26px; opacity: .4;
}
.preview-content { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.preview-head {
  flex: none;
  display: flex; align-items: center; gap: 8px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
}
.preview-title {
  flex: 1; min-width: 0;
  font-size: 12.5px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.preview-head .ghost { padding: 4px 9px; }
.preview-screen {
  flex: 1; min-height: 0; position: relative;
  background: var(--sunken);
  display: grid; place-items: center;
  padding: 12px;
}
#preview-canvas {
  max-width: 100%; max-height: 100%;
  object-fit: contain; display: block;
  border-radius: var(--r-md);
}
#preview-tap { position: absolute; inset: 12px; cursor: crosshair; touch-action: none; }
/* 隐藏输入框：接管键盘输入，视觉上不存在但必须可聚焦 */
#preview-hidden-input {
  position: absolute; opacity: 0; pointer-events: none;
  width: 1px; height: 1px; padding: 0; border: none;
}
#preview-hidden-input:focus { outline: none; }

/* ---------------- 底部日志 ---------------- */
.console {
  flex: none;
  display: flex; align-items: center; gap: 12px;
  height: 42px; padding: 0 18px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.log { flex: 1; min-width: 0; overflow: hidden; height: 20px; }
.log-line {
  font-family: var(--mono); font-size: 11px;
  color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.log-line.err { color: var(--fire); }

/* ================================================================
   手机端：全屏操控单台 / 抽屉遮罩 / 底部导航
   ================================================================ */
.mob-navbar, .mob-overlay, .mob-backdrop { display: none; }

/* —— 全屏操控单台设备 —— */
.mob-overlay {
  position: fixed; top: 0; left: 0; right: 0; z-index: 80;
  /* 不能用 inset:0。iOS Safari 的地址栏和底部工具栏是**盖在** fixed 元素上的，
     inset:0 撑出来的高度包含了被工具栏遮住的那一截，结果 flex 布局里最后的
     快捷键条正好落在工具栏底下，永远看不见。
     dvh 会随工具栏收放实时变化，是唯一对得上真实可视区的单位；
     100vh 留给不支持 dvh 的旧浏览器兜底。 */
  height: 100vh;
  height: 100dvh;
  background: var(--page);
  flex-direction: column;
}
.mob-overlay-head {
  flex: none;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.mob-back-btn {
  width: 34px; height: 34px; padding: 0; flex: none;
  border-radius: var(--r-pill);
  display: grid; place-items: center; font-size: 16px;
}
.mob-device-title {
  flex: 1; min-width: 0;
  font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mob-sel-btn { flex: none; font-size: 12px; }
.mob-sel-btn.active {
  background: var(--gold); color: var(--on-gold);
  border-color: transparent; font-weight: 600;
}
.mob-holder {
  flex: none; text-align: center;
  font-size: 11px; font-weight: 600;
  padding: 5px; background: var(--fire-bg); color: var(--fire);
}
.mob-holder.me { background: var(--live-bg); color: var(--live); }

.mob-screen-wrap {
  flex: 1; min-height: 0; position: relative;
  background: #000;
  display: grid; place-items: center;
}
#mob-canvas { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
#mob-tap { position: absolute; inset: 0; touch-action: none; }

/* 加到主屏幕的引导条。iOS Safari 里网页无法自己隐藏地址栏
   （requestFullscreen 在 iPhone 上对非 video 元素无效），
   真全屏只有 PWA 一条路，所以这条提示是有实际用处的，不是装饰。 */
.mob-tip {
  flex: none;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 7px 12px;
  white-space: nowrap;
  background: var(--gold-soft);
  border-top: 1px solid var(--gold-line);
  font-size: 11.5px; line-height: 1.5; color: var(--gold-1);
}
.mob-tip b { font-weight: 600; }
.mob-tip button { flex: none; font-size: 11px; padding: 4px 11px; }

/* —— 悬浮控制球 —— */
.mob-fab {
  position: absolute; z-index: 5;
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
  touch-action: none;                 /* 自己处理拖动，别让页面跟着滚 */
}
.mob-fab-btn {
  width: 46px; height: 46px; padding: 0;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 17px; letter-spacing: -2px;
  color: var(--gold-1);
  background: rgba(38, 40, 52, .78);
  backdrop-filter: blur(10px);
  border: 1px solid var(--gold-line);
  box-shadow: var(--shadow);
  opacity: .55;                       /* 不用时淡下去，别挡画面 */
  transition: opacity var(--fast), transform var(--fast);
}
.mob-fab-btn:active { transform: scale(.92); }
.mob-fab.open .mob-fab-btn,
.mob-fab.dragging .mob-fab-btn { opacity: 1; }

.mob-fab-menu {
  display: none;
  flex-direction: column; gap: 5px;
  padding: 8px;
  background: rgba(30, 32, 42, .92);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
}
.mob-fab.open .mob-fab-menu { display: flex; }
.mob-fab-menu .mob-quick {
  flex: none;
  padding: 9px 14px; font-size: 12px;
  white-space: nowrap; text-align: left;
}
.mob-quick { padding: 9px 14px; font-size: 12px; }
/* 键盘开着的时候把 ⌨ 点亮，否则看不出当前处于输入模式 */
.mob-quick.active {
  background: var(--gold); color: var(--on-gold);
  border-color: transparent; font-weight: 600;
}
.mob-text-bar {
  flex: none;
  display: flex; gap: 8px; padding: 9px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--gold-line);   /* 在顶部，分隔线画在下边 */
}
/* 正在输入时把这条点亮，让人一眼知道字打在哪儿 */
.mob-text-bar input {
  border-color: var(--gold-line);
  background: var(--page);
}

/* —— 抽屉遮罩 —— */
.mob-backdrop {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(10, 11, 16, .7);
  backdrop-filter: blur(3px);
}

/* —— 底部导航 —— */
.mob-navbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  padding-bottom: max(9px, env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.mob-nav-count { display: flex; gap: 8px; font-size: 11.5px; color: var(--muted); }
.mob-nav-count strong { color: var(--text); font-family: var(--mono); }
.mob-nav-count .sel strong { color: var(--gold-1); }
.mob-nav-btn {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--gold); color: var(--on-gold);
  border: none; font-weight: 600; font-size: 12.5px;
  padding: 9px 16px;
  box-shadow: var(--shadow);
}
.mob-nav-icon { font-size: 13px; }

/* ================================================================
   登录页
   ================================================================ */
.login-body {
  display: grid; place-items: center;
  padding: 20px;
  overflow: auto;
  /* 一层极淡的金色辉光，把视线收到卡片上 */
  background:
    radial-gradient(760px 420px at 50% -8%, rgba(210, 187, 124, .07), transparent 62%),
    var(--page);
}
.login-card {
  width: 100%; max-width: 372px;
  padding: 30px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
}
.login-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.login-title { font-size: 19px; font-weight: 600; letter-spacing: -.015em; margin-bottom: 5px; }
.login-sub { font-size: 12.5px; color: var(--muted); margin-bottom: 22px; }
.login-card .field-group { margin-bottom: 14px; }
.login-card .field-label {
  display: block; margin-bottom: 6px;
  font-size: 11.5px; font-weight: 500; color: var(--text-2);
}
.login-card button.go { width: 100%; margin-top: 8px; padding: 11px; }
.login-lang { display: flex; }

/* ================================================================
   响应式
   ================================================================ */
@media (max-width: 1180px) {
  /* 预览面板先收掉：屏幕不够宽时，中间的设备网格优先 */
  .layout { grid-template-columns: 224px minmax(0, 1fr); }
  .preview-panel { display: none; }
}

@media (max-width: 860px) {
  body { overflow: auto; }
  .topbar { height: 52px; padding: 0 12px; gap: 8px; }
  /* 窄屏挤不下就把这些逐个收掉，剩下的一律 nowrap ——
     否则文字会被压成竖排，比隐藏还难看 */
  .topbar .brand h1 { display: none; }
  .topbar .stats { gap: 6px; }
  .topbar .stats > span,
  .topbar .stats .link,
  .topbar .stats button { flex: none; white-space: nowrap; }
  .topbar .stats > span { padding: 3px 9px; font-size: 11.5px; }
  .topbar .stats .link, .topbar .lang-toggle, .topbar .stats button { padding: 5px 10px; font-size: 11.5px; }

  /* 手机端改成整页滚，而不是让 .stage 内部滚。
     内部滚动容器在 iOS 上体验差：地址栏不会跟着收起，还会有嵌套橡皮筋。
     单列时也用不着 grid，block 让内容自然撑开、body 负责滚动。 */
  .layout {
    display: block;
    padding: 12px;
    padding-bottom: 76px;                       /* 给底部导航让位 */
  }
  .stage { overflow: visible; }
  .console { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px; }
  .mob-navbar { display: flex; }

  /* iOS Safari 在聚焦**字号小于 16px** 的输入框时，会自动把整个页面放大，
     等于每次调输入法画面都跳一下。viewport 里写 user-scalable=no 没用
     ——从 iOS 10 起 Safari 就忽略它了（无障碍考虑）。唯一可靠的办法就是
     把字号顶到 16px。 */
  input[type="text"], input[type="password"], input[type="number"],
  select, textarea { font-size: 16px; }

  /* 小窗不接触控：手指按在画面上会被当成触控事件发给真机，
     导致整页滚不动，而且容易误点到设备上的东西。
     手机端小窗只负责预览和挑选，点一下放大到全屏再操控。 */
  .grid .tap-layer { pointer-events: none; }
  .tile { cursor: pointer; }
  .tile:active { transform: scale(.985); }
  /* 放大按钮在手机上要看得见，它是"能点开"的唯一提示 */
  .tile .preview-btn {
    background: var(--gold-soft);
    border-color: var(--gold-line);
    color: var(--gold-1);
  }

  /* 群控面板变成底部抽屉。注意是**同一个元素**，不是另建一份 DOM —— 
     所以所有 batch 处理器不用改，手机上也照常工作。 */
  .rail {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 71;
    max-height: 84vh;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    border-left: none; border-right: none; border-bottom: none;
    box-shadow: var(--shadow-lg);
    padding-bottom: max(18px, env(safe-area-inset-bottom));
    transform: translateY(102%);
    transition: transform 280ms var(--ease);
    will-change: transform;
  }
  .rail.open { transform: translateY(0); }
  .rail-grip {
    display: block;
    width: 38px; height: 4px; border-radius: var(--r-pill);
    background: var(--line-2);
    margin: 0 auto 4px;
  }
  .rail-close { display: inline-flex; }
}

/* 登录页页脚：返回另一个入口 */
.login-footer { margin-top: 20px; text-align: center; font-size: 11.5px; }
.login-footer a {
  color: var(--muted); text-decoration: none;
  transition: color var(--fast);
}
.login-footer a:hover { color: var(--gold-1); }

/* 群控栏里每一行都带一个执行按钮，四五个实心金堆成一列太吵，
   强调色用滥就等于没有强调。这里降成描金款：仍然一眼看得出是操作，
   但不跟「登录」「创建用户」那种页面级主按钮抢注意力。 */
.rail button.go {
  background: transparent;
  color: var(--gold-1);
  border: 1px solid var(--gold-line);
  box-shadow: none;
}
.rail button.go:hover {
  background: var(--gold-soft);
  border-color: var(--gold-2);
  color: var(--gold-1);
}
