/* ============ 基础与主题 ============ */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff4ff;
  --text: #1f2430;
  --text-2: #5b6472;
  --text-3: #97a0af;
  --bg: #f7f8fb;
  --card: #ffffff;
  --border: #e6e9f0;
  --danger: #e5484d;
  --success: #12a150;
  --warn: #f59e0b;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(31, 36, 48, .06);
  --shadow-lg: 0 12px 40px rgba(31, 36, 48, .16);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body, #app { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  overflow: hidden;
  /* 安卓 WebView 只随包带了 Regular 字重的宋/楷，允许合成粗体并锁定字号缩放 */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  font-synthesis: weight;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(120,130,150,.35); border-radius: 4px; }

/* ============ 通用组件 ============ */
.view { height: 100%; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + var(--safe-t)) 16px 10px;
  background: var(--card); border-bottom: 1px solid var(--border);
  flex-shrink: 0; min-height: calc(56px + var(--safe-t));
}
.topbar h1 { font-size: 18px; font-weight: 700; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .sub { font-size: 12px; color: var(--text-3); font-weight: 400; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 19px; color: var(--text-2); transition: background .15s; flex-shrink: 0;
}
.icon-btn:active { background: rgba(0,0,0,.07); }
.icon-btn.active { background: var(--primary-soft); color: var(--primary); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: 10px; font-size: 15px; font-weight: 600;
  background: var(--primary); color: #fff; transition: transform .1s, background .15s;
}
.btn:active { transform: scale(.97); }
.btn.secondary { background: #eef1f6; color: var(--text); }
.btn.ghost { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn.danger { background: #fdecec; color: var(--danger); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.page { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 16px; }

/* ============ 文稿列表 ============ */
.home-head { padding: 20px 4px 14px; }
.home-head h2 { font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.home-head p { color: var(--text-2); font-size: 14px; margin-top: 4px; }
.script-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.script-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow);
  transition: transform .12s, box-shadow .12s; text-align: left;
}
.script-card:active { transform: scale(.99); }
.script-card .sc-title { font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.script-card .sc-preview {
  color: var(--text-2); font-size: 13px; height: 40px; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical;
}
.script-card .sc-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); margin-top: auto; }
.script-card .sc-actions { display: flex; gap: 8px; border-top: 1px solid var(--border); padding-top: 10px; }
.script-card .sc-actions button {
  flex: 1; padding: 8px 0; border-radius: 8px; font-size: 13px; font-weight: 600;
  background: var(--primary-soft); color: var(--primary);
}
.script-card .sc-actions button.run { background: var(--primary); color: #fff; }
.script-card .sc-actions button.del { background: #fdecec; color: var(--danger); flex: 0 0 40px; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 20px; background: var(--primary-soft); color: var(--primary); font-size: 11px; font-weight: 600; }
.empty {
  text-align: center; padding: 70px 24px; color: var(--text-3);
}
.empty .big { font-size: 52px; margin-bottom: 12px; }
.fab {
  position: fixed; right: 22px; bottom: calc(22px + var(--safe-b));
  width: 58px; height: 58px; border-radius: 50%; background: var(--primary); color: #fff;
  font-size: 28px; box-shadow: 0 8px 24px rgba(37,99,235,.4); z-index: 20;
  display: flex; align-items: center; justify-content: center;
}
.fab:active { transform: scale(.94); }
.help-card { margin-top: 22px; background: var(--primary-soft); border-radius: var(--radius); padding: 16px 18px; font-size: 13px; color: #35507c; }
.help-card b { color: var(--primary-dark); }
.help-card ul { margin: 8px 0 0 18px; }
.help-card li { margin: 3px 0; }

/* ============ 编辑器（新建/编辑文稿） ============ */
.editor-wrap { background: var(--bg); }
.editor-main {
  flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  display: flex; justify-content: center;
}
.editor-inner {
  width: 100%; max-width: 860px; min-height: 100%;
  display: flex; flex-direction: column;
  padding: 16px 16px calc(14px + var(--safe-b));
}
.ed-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: border-color .16s, box-shadow .16s;
  animation: editor-in .34s cubic-bezier(.22,.8,.32,1) both;
}
.ed-title-card { padding: 11px 18px 12px; }
.ed-title-card:focus-within,
.ed-text-card:focus-within {
  border-color: #b9ccf7; box-shadow: 0 0 0 3px rgba(37,99,235,.13), var(--shadow);
}
.ed-field-label {
  display: block; font-size: 12px; font-weight: 600; letter-spacing: .3px;
  color: var(--text-3); margin-bottom: 2px;
}
.title-input {
  width: 100%; border: none; outline: none; background: transparent;
  font-size: 19px; font-weight: 700; padding: 3px 0;
}
.title-input::placeholder { color: #b6bdc9; font-weight: 600; }

.editor-toolbar {
  display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; flex-shrink: 0;
  animation: editor-in .34s cubic-bezier(.22,.8,.32,1) .05s both;
}
.editor-toolbar button {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: 10px; font-size: 13px; font-weight: 600;
  background: var(--card); color: var(--text-2);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  transition: background .15s, color .15s, border-color .15s, transform .1s;
}
.editor-toolbar button svg { width: 16px; height: 16px; flex-shrink: 0; }
@media (hover: hover) {
  .editor-toolbar button:hover { color: var(--primary); border-color: #c3d3f6; background: var(--primary-soft); }
  .editor-toolbar #clearBtn:hover { color: var(--danger); border-color: #f3c4c6; background: #fdecec; }
}
.editor-toolbar button:active { transform: scale(.96); }
.editor-toolbar #clearBtn { color: #c4565a; }

.ed-text-card { flex: 1; min-height: 340px; margin-top: 10px; display: flex; animation-delay: .1s; }
.script-textarea {
  flex: 1; min-height: 0; width: 100%; border: none; outline: none; resize: none;
  background: transparent; border-radius: var(--radius);
  padding: 18px 20px; font-size: 17px; line-height: 2;
}
.script-textarea::placeholder { color: #b6bdc9; }

.editor-status {
  display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-shrink: 0;
  padding: 2px 2px 0; font-size: 12px; color: var(--text-3);
  animation: editor-in .34s cubic-bezier(.22,.8,.32,1) .15s both;
}
.ed-pill {
  background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow);
  color: var(--text-2); font-weight: 600; padding: 4px 12px; border-radius: 20px;
}
.editor-status #statSave { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; color: var(--success); }
.editor-status #statSave::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  background: var(--success); box-shadow: 0 0 0 3px rgba(18,161,80,.14);
  transition: background .2s, box-shadow .2s;
}
.editor-status #statSave.editing { color: var(--warn); }
.editor-status #statSave.editing::before { background: var(--warn); box-shadow: 0 0 0 3px rgba(245,158,11,.16); }

@keyframes editor-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* 顶栏内 SVG 图标 */
.ed-back svg { width: 21px; height: 21px; }
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.editor-runbar {
  display: flex; gap: 10px; padding: 10px 14px calc(10px + var(--safe-b));
  background: var(--card); border-top: 1px solid var(--border);
}
@media (max-width: 480px) {
  .editor-inner { padding: 12px 12px calc(12px + var(--safe-b)); }
  .editor-toolbar { gap: 7px; }
  .editor-toolbar button { padding: 7px 12px; font-size: 12.5px; }
  .ed-text-card { min-height: 300px; }
}

/* ============ 提词舞台 ============ */
.prompter { position: fixed; inset: 0; background: #000; z-index: 30; display: flex; flex-direction: column; }
#stage-scroll {
  flex: 1; overflow-y: auto; overflow-x: hidden; position: relative;
  scrollbar-width: none;
}
#stage-scroll::-webkit-scrollbar { display: none; }
#stage-content {
  position: relative; padding: 45vh 0; margin: 0 auto;
  font-size: 48px; font-weight: 500; line-height: 1.8; color: #fff;
  word-break: break-word;
}
#stage-content .para { padding: .15em 0; transition: opacity .2s; }
/* 段落提行：每段开头空两字 */
#stage-content.indent .para { text-indent: 2em; }
.mirror-h #stage-content { transform: scaleX(-1); }
.mirror-v #stage-content { transform: scaleY(-1); }
.mirror-h.mirror-v #stage-content { transform: scale(-1, -1); }

#stage-cues { position: absolute; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
.cue-line {
  position: absolute; left: 3%; right: 3%; top: calc(42% - 1px); height: 2px;
  background: rgba(245, 158, 11, .85); box-shadow: 0 0 12px rgba(245,158,11,.6);
}
.cue-mask-top { position: absolute; inset: 0 0 58% 0; background: linear-gradient(to bottom, rgba(0,0,0,.78), rgba(0,0,0,.25)); }
.cue-mask-bottom { position: absolute; inset: 42% 0 0 0; background: linear-gradient(to top, rgba(0,0,0,.78), rgba(0,0,0,.25)); }
.progress-bar { position: absolute; left: 0; right: 0; top: 0; height: 3px; background: rgba(255,255,255,.12); z-index: 6; }
.progress-bar i { display: block; height: 100%; width: 0; background: var(--primary); }

/* 控制条 */
.p-controls {
  position: absolute; left: 8px; right: 8px; bottom: calc(8px + var(--safe-b)); z-index: 10;
  display: flex; align-items: center; justify-content: center; gap: 4px; flex-wrap: wrap;
  padding: 8px 10px; border-radius: 16px;
  background: rgba(20, 22, 28, .72); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,.1); transition: opacity .35s, transform .35s;
}
.p-controls.hidden-ui { opacity: 0; pointer-events: none; transform: translateY(12px); }
.pc-btn {
  min-width: 42px; height: 42px; padding: 0 8px; border-radius: 10px; color: rgba(255,255,255,.82);
  display: inline-flex; align-items: center; justify-content: center; font-size: 18px; gap: 4px;
  white-space: nowrap;
}
.pc-btn:active { background: rgba(255,255,255,.14); }
/* 控制条内线性 SVG 图标尺寸统一 */
.pc-btn .pc-ico { width: 17px; height: 17px; display: block; }
/* 字号 A- / A+ 按钮：+- 作为 A 的右上角标 */
.fs-btn { font-size: 16px; font-weight: 600; padding: 0 9px; }
.fs-btn sup {
  font-size: .58em; font-weight: 700; line-height: 0;
  position: relative; top: -.42em; left: 1px;
}
.pc-btn.active { background: var(--primary); color: #fff; }
.pc-btn.voice-on { background: var(--success); color: #fff; animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(18,161,80,.5);} 50% { box-shadow: 0 0 0 8px rgba(18,161,80,0);} }
.pc-play { width: 54px; height: 54px; border-radius: 50%; background: #fff; color: #111; font-size: 22px; }
.pc-play:active { transform: scale(.93); }
.pc-slider-wrap { display: flex; align-items: center; gap: 6px; color: rgba(255,255,255,.75); font-size: 12px; padding: 0 6px; }
.pc-slider { -webkit-appearance: none; appearance: none; width: 110px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.25); outline: none; }
.pc-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #fff; }
.pc-slider::-moz-range-thumb { width: 16px; height: 16px; border: none; border-radius: 50%; background: #fff; }
.p-status {
  position: absolute; top: calc(10px + var(--safe-t)); left: 50%; transform: translateX(-50%); z-index: 9;
  display: flex; gap: 8px; align-items: center; font-size: 12px; color: rgba(255,255,255,.85);
  background: rgba(20,22,28,.6); padding: 5px 14px; border-radius: 20px; backdrop-filter: blur(10px);
  transition: opacity .35s;
}
.p-status.hidden-ui { opacity: 0; pointer-events: none; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #8a93a5; }
.dot.live { background: var(--success); }
.dot.rec { background: var(--danger); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .25; } }

/* 麦克风电平表（人声模式自检：说话跳动=麦克风正常） */
[hidden] { display: none !important; }
.v-meter {
  width: 56px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.2);
  overflow: hidden; margin-left: 2px;
}
.v-meter i {
  display: block; height: 100%; width: 0; border-radius: 3px;
  background: linear-gradient(90deg, #34d399, #fbbf24, #f87171);
  transition: width .09s linear;
}
/* 环境问题警告条 */
.env-warn {
  position: absolute; top: calc(54px + var(--safe-t)); left: 50%; transform: translateX(-50%);
  z-index: 45; max-width: min(92%, 560px);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center;
  background: rgba(24,26,33,.92); border: 1px solid rgba(248,113,113,.55);
  color: #fecaca; font-size: 12.5px; line-height: 1.55;
  padding: 10px 14px; border-radius: 12px; backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
}
.env-warn button {
  border: none; border-radius: 8px; padding: 6px 12px; font-size: 12.5px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
}
#envFixBtn { background: var(--primary); color: #fff; }
#envCloseBtn { background: rgba(255,255,255,.12); color: rgba(255,255,255,.85); }

/* 设置抽屉 */
.drawer-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; opacity: 0; pointer-events: none; transition: opacity .25s; }
.drawer-mask.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 92vw); z-index: 41;
  background: var(--card); border-radius: 18px 0 0 18px; transform: translateX(105%);
  transition: transform .28s cubic-bezier(.22,.9,.3,1); display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
.drawer header { padding: calc(16px + var(--safe-t)) 18px 12px; font-size: 17px; font-weight: 700; border-bottom: 1px solid var(--border); }
.drawer .body { flex: 1; overflow-y: auto; padding: 8px 18px 20px; }
.set-row { padding: 12px 0; border-bottom: 1px solid #f0f2f6; }
.set-row label { display: flex; justify-content: space-between; font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.set-row label output { color: var(--primary); font-weight: 600; }
.set-row input[type=range] { width: 100%; accent-color: var(--primary); }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button {
  padding: 7px 13px; border-radius: 8px; font-size: 13px; font-weight: 600;
  background: #eef1f6; color: var(--text-2);
}
.seg button.on { background: var(--primary); color: #fff; }
/* 字体选择按钮：按钮上的字样用该字体本身渲染，所见即所得 */
.seg-font { gap: 8px; }
.seg-font button {
  padding: 8px 14px; font-size: 16px; font-weight: 500; line-height: 1.25;
  min-width: 52px; text-align: center;
}
.swatches { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.swatch { width: 30px; height: 30px; border-radius: 8px; border: 2px solid transparent; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.swatch.on { border-color: var(--primary); }
.switch { position: relative; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 100%; height: 100%; }
.switch i {
  position: absolute; inset: 0; border-radius: 20px; background: #cfd6e2; transition: background .2s; pointer-events: none;
}
.switch i::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.switch input:checked + i { background: var(--primary); }
.switch input:checked + i::after { transform: translateX(20px); }
.set-row .row-flex { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.set-row .desc { font-size: 12px; color: var(--text-3); margin-top: 5px; }
.voice-meter { height: 10px; border-radius: 5px; background: #eef1f6; overflow: hidden; margin-top: 8px; }
.voice-meter i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--success), var(--warn)); transition: width .12s; }

/* 倒计时遮罩 */
.countdown {
  position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.82);
  display: flex; align-items: center; justify-content: center; color: #fff;
  font-size: 130px; font-weight: 800; backdrop-filter: blur(6px);
}
.countdown.go { font-size: 80px; color: var(--success); }

/* 录制小窗 */
.cam-pip {
  position: absolute; z-index: 12; width: 150px; border-radius: 14px; overflow: hidden;
  right: 14px; bottom: 96px; box-shadow: 0 8px 28px rgba(0,0,0,.5);
  background: #000; border: 2px solid rgba(255,255,255,.25); touch-action: none;
}
.cam-pip video { width: 100%; display: block; transform: scaleX(-1); }
.cam-pip .cam-bar { display: flex; gap: 4px; padding: 5px; background: rgba(0,0,0,.55); }
.cam-pip .cam-bar button { flex: 1; color: #fff; font-size: 12px; padding: 4px 0; border-radius: 6px; background: rgba(255,255,255,.16); }

/* 弹层 */
.layer { position: fixed; inset: 0; z-index: 100; pointer-events: none; }
.modal-mask { position: absolute; inset: 0; background: rgba(20,24,35,.5); display: flex; align-items: center; justify-content: center; pointer-events: auto; padding: 20px; }
.modal {
  background: #fff; border-radius: 18px; width: min(420px, 100%); max-height: 86vh; overflow-y: auto;
  padding: 22px; box-shadow: var(--shadow-lg);
}
.modal h3 { font-size: 18px; margin-bottom: 6px; }
.modal .m-desc { font-size: 13px; color: var(--text-2); margin-bottom: 14px; }
.modal .m-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal .m-actions .btn { flex: 1; }
.qr-box { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 10px 0; }
.qr-box canvas, .qr-box img { border-radius: 10px; }
.qr-url { font-size: 12px; color: var(--text-2); word-break: break-all; text-align: center; background: #f4f6fa; padding: 8px 10px; border-radius: 8px; }
.code-big { font-size: 34px; font-weight: 800; letter-spacing: 6px; text-align: center; color: var(--primary); }
.qr-warn { font-size: 13px; line-height: 1.55; color: #8a5a00; background: #fff6e0; border: 1px solid #f2d98a; border-radius: 10px; padding: 9px 12px; margin-bottom: 8px; text-align: left; }
#qrSwitch button.on { background: var(--primary); color: #fff; }
.toast {
  position: absolute; left: 50%; bottom: 16%; transform: translateX(-50%);
  background: rgba(20,22,28,.92); color: #fff; padding: 10px 20px; border-radius: 22px;
  font-size: 14px; max-width: 86vw; text-align: center; pointer-events: none;
  animation: toast-in .25s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } }

/* ============ 遥控器页面 ============ */
.remote-view { max-width: 520px; margin: 0 auto; width: 100%; flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; }
.remote-status { text-align: center; padding: 16px 16px 10px; flex-shrink: 0; }
.remote-status .rs-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--text-3); margin-right: 8px; vertical-align: middle; }
.remote-status.connected .rs-dot { background: var(--success); box-shadow: 0 0 0 5px rgba(18,161,80,.15); }
.remote-status h2 { font-size: 19px; margin-top: 6px; }
.remote-status .rp { height: 6px; border-radius: 3px; background: #e6e9f0; margin: 12px 8px 0; overflow: hidden; }
.remote-status .rp i { display: block; height: 100%; width: 0; background: var(--primary); transition: width .3s; }
.remote-pad { flex: 1 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px 16px; align-content: start; }
.rp-btn {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 13px 8px; font-size: 15px; font-weight: 700; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.rp-btn .ico { font-size: 24px; line-height: 1.2; }
.rp-btn:active { background: var(--primary-soft); }
.rp-btn.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.rp-btn.wide { grid-column: 1 / -1; background: var(--primary); color: #fff; padding: 14px; font-size: 17px; flex-direction: row; justify-content: center; }
.rp-btn.wide:active { background: var(--primary-dark); }
.rp-btn.script-pick { background: var(--card); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow); padding: 11px; font-size: 15px; }
.rp-btn.script-pick:active { background: var(--primary-soft); }
.rscr-item {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  padding: 13px 14px; border-radius: 12px; background: #f4f6fa; margin-bottom: 8px;
  font-size: 15px; font-weight: 600; color: var(--text);
  transition: transform .12s, background .15s, box-shadow .15s;
}
.rscr-item.on { background: var(--primary-soft); color: var(--primary); box-shadow: inset 0 0 0 1.5px var(--primary); }
.rscr-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rscr-tick { color: var(--primary); margin-left: 10px; flex-shrink: 0; }

/* 手机端设置弹层（控件复用电脑端 set-row / seg / switch / swatch 同款样式） */
.rset-mask { position: fixed; inset: 0; z-index: 200; background: rgba(20,24,35,.5); display: none; }
.rset-mask.open { display: block; }
.rset-sheet {
  position: absolute; left: 0; right: 0; top: 0; bottom: 0; max-width: 520px; margin: 0 auto;
  background: var(--card); display: flex; flex-direction: column;
  animation: rset-up .25s ease;
}
@keyframes rset-up { from { transform: translateY(24px); opacity: .4; } }
.rset-sheet header {
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
  padding: calc(14px + var(--safe-t)) 14px 12px 18px;
  font-size: 17px; font-weight: 700; border-bottom: 1px solid var(--border);
}
.rset-sheet .body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 18px calc(20px + var(--safe-b)); }
.remote-connect { padding: 0 16px; display: flex; gap: 10px; flex-shrink: 0; }
.remote-connect input {
  flex: 1; border: 1.5px solid var(--border); border-radius: 10px; padding: 12px 14px;
  font-size: 20px; letter-spacing: 4px; text-align: center; outline: none;
}
.remote-connect input:focus { border-color: var(--primary); }
.remote-info { font-size: 12px; color: var(--text-3); text-align: center; padding: 8px 20px calc(16px + var(--safe-b)); flex-shrink: 0; }

/* 矮屏手机进一步压缩，保证可滚动且按钮不拥挤 */
@media (max-height: 700px) {
  .remote-status { padding: 10px 16px 6px; }
  .remote-status .rp { margin-top: 8px; }
  .remote-pad { gap: 8px; padding: 10px 14px; }
  .rp-btn { padding: 9px 6px; font-size: 14px; border-radius: 12px; }
  .rp-btn .ico { font-size: 20px; }
  .rp-btn.wide { padding: 11px; font-size: 16px; }
}

/* ============ 响应式 ============ */
@media (max-width: 768px) {
  body { font-size: 14px; }
  .home-head h2 { font-size: 22px; }
  .script-grid { grid-template-columns: 1fr; gap: 10px; }
  .page { padding: 12px; }
  .pc-slider { width: 80px; }
  .pc-btn { min-width: 38px; height: 38px; font-size: 16px; }
  .pc-label { display: none; }
  .cam-pip { width: 104px; bottom: 108px; }
  .countdown { font-size: 96px; }
  .drawer {
    width: 100vw; border-radius: 18px 18px 0 0; top: auto; bottom: 0; height: 92vh;
    transform: translateY(105%);
  }
  .drawer.open { transform: none; animation: slide-up .28s; }
  @keyframes slide-up { from { transform: translateY(100%); } }
}
@media (min-width: 769px) {
  .fab { display: none; }
  .new-btn-desktop { display: inline-flex !important; }
}
