/*
 * hud.css —— 长者端大字叠层 + 家属端 + 调试抽屉（R 线）
 *
 * 契约 §9「视觉与适老化硬数值」全部在本文件落地（3D 场景不承担任何文字与对比度责任）：
 *   正文对比度 ≥ 4.5:1  ｜ 大字 ≥ 3:1  ｜ 点击目标主界面 ≥ 60×60，其他 ≥ 44×44
 *   主要文字 ≥ 18dp/pt，界面最大字体 ≥ 30dp/pt  ｜ 行距 ≥ 1.3，段距 ≥ 行距 × 2.3
 *   不得仅用颜色传达信息（状态一律「图标/文字 + 颜色」双编码）
 *   200% 缩放不丢内容与功能
 *
 * 配色对（2026-10-03 实测 WCAG 对比度，白底）：
 *   #1f2933 on #ffffff  = 14.76:1   正文（≥4.5:1）
 *   #46535f on #ffffff  =  7.89:1   次要文字（≥4.5:1）
 *   #2f7f86 on #ffffff  =  4.67:1   主色文字 / 图标（≥4.5:1）
 *   #ffffff on #2f7f86  =  4.67:1   主按钮（≥4.5:1）
 *   #8a5a00 on #fff8e6  =  5.59:1   警示文字（≥4.5:1）
 *   #6b7785 on #ffffff  =  4.56:1   未点亮的药格灯描边（非文本 ≥3:1）
 */

:root {
  --ink: #1f2933;
  --ink-soft: #46535f;
  --teal: #2f7f86;
  --teal-dark: #1f626a;
  --paper: #ffffff;
  --paper-warm: #fff8ef;
  --warn: #8a5a00;
  --warn-bg: #fff8e6;
  --line: #d8cfc4;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(40, 30, 20, 0.18);
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #efe3d4;
  color: var(--ink);
  font-family: var(--font);
  font-size: 20px; /* 主要文字 ≥ 18px；行距 ≥ 1.3 */
  line-height: 1.45;
}

body.view-family {
  background: #f4f6f8;
}

/* ── 主屏布局 ─────────────────────────────────────────────────────── */

.main-view {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.scene {
  position: absolute;
  inset: 0;
}

.scene-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.stage-caption {
  position: absolute;
  left: 28px;
  bottom: 18px;
  margin: 0;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink-soft);
  font-size: 18px;
  line-height: 1.3;
}

/* ── 长者端叠层 ───────────────────────────────────────────────────── */

.hud {
  position: absolute;
  inset: 0;
  pointer-events: none; /* 只有卡片本身可点，其余不挡场景 */
}

.hud__card {
  /* v1.11：用户口径「左上角时间确认的屏幕缩小一点」；v1.14 再收一轮
     （用户口径「左上角提示屏和右下角控制台再缩小一点，让观众看清主要场景」）——
     继续只收**卡片占位**（宽/内边距/外边距）与次要文字：
     主文案 38px、正文 22px、一键确认 ≥60×60 这三条适老化硬数值**不动**。 */
  position: absolute;
  top: 14px;
  left: 14px;
  width: min(392px, 26vw);
  padding: 12px 16px 14px;
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
  pointer-events: auto;
}

/* 固定演示模式：整块再缩一档（缩放不改字号，只改占位）。
 * ⚠️ 用 `body.is-scripted` 而不是给卡片加类 —— 大字卡每次 `hud.render()` 都会被重建，
 * 加在元素上的类会被冲掉（实测过）。 */
body.is-scripted .hud__card,
.hud__card--compact {
  transform: scale(0.82);
  transform-origin: 14px 14px;
}

.hud__card--idle {
  background: var(--paper);
}

.hud__card--warn {
  background: var(--warn-bg);
  border-left: 10px solid var(--warn);
}

.hud__row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.hud__chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  min-height: 46px;
  padding: 5px 14px;
  border-radius: 14px;
  background: var(--teal);
  color: #ffffff;
  font-size: 26px; /* 界面最大字体档位之一（缩卡后仍 ≥18pt） */
  font-weight: 700;
  letter-spacing: 1px;
}

.hud__greet {
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
}

.hud__headline {
  margin: 14px 0 0;
  font-size: 38px; /* ≥ 30dp/pt（缩卡后仍是大字档） */
  font-weight: 800;
  line-height: 1.25;
  color: var(--ink);
}

.hud__detail {
  margin: 11px 0 0;
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
}

.hud__hint {
  margin: 8px 0 0;
  font-size: 20px;
  color: var(--ink-soft);
}

.hud__status {
  margin: 7px 0 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--teal-dark);
}

.hud__actions {
  display: flex;
  gap: 14px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.hud__button {
  min-width: 190px;
  min-height: 72px; /* 点击目标 ≥ 60×60（缩卡后仍达标） */
  padding: 14px 26px;
  border: 3px solid transparent;
  border-radius: 14px;
  font-family: inherit;
  font-size: 28px;
  font-weight: 800;
  cursor: pointer;
}

.hud__button--primary {
  background: var(--teal);
  color: #ffffff;
}

.hud__button--primary:hover,
.hud__button--primary:focus-visible {
  background: var(--teal-dark);
}

.hud__button--ghost {
  background: #ffffff;
  color: var(--teal-dark);
  border-color: var(--teal);
}

.hud__button[disabled] {
  background: #e6e6e6;
  color: #6b6b6b;
  border-color: #cfcfcf;
  cursor: default;
}

/* 药格灯：状态不仅用颜色编码，同时给出「已取走 / 待取」文字 */
.hud__grid {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 2px solid var(--line);
}

.hud__lamp {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
}

.hud__dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid #6b7785; /* 非文本 ≥3:1（实测 4.56:1） */
  background: #ffffff;
}

.hud__dot--done {
  background: var(--teal);
  border-color: var(--teal-dark);
}

.hud__dot--now {
  background: #ffd479;
  border-color: var(--warn);
}

.hud__dot--missed {
  background: #ffffff;
  border-color: var(--warn);
  border-style: dashed;
}

.hud__meta {
  position: absolute;
  top: 34px;
  right: 34px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  pointer-events: auto;
}

.hud__clockbox {
  padding: 12px 22px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  text-align: right;
}

.hud__clocktext {
  font-size: 34px;
  font-weight: 800;
}

.hud__clocksub {
  font-size: 18px;
  color: var(--ink-soft);
}

.hud__toggle {
  min-height: 60px;
  min-width: 60px;
  padding: 12px 20px;
  border-radius: 14px;
  border: 3px solid var(--teal);
  background: #ffffff;
  color: var(--teal-dark);
  font-family: inherit;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
}

/* 提示时的低频/灯效视觉（与 audio.js 的通道切换同步） */
.hud__card--pulse {
  animation: hud-pulse 1.2s ease-in-out infinite;
}

@keyframes hud-pulse {
  0%,
  100% {
    outline: 0 solid rgba(47, 127, 134, 0);
  }
  50% {
    outline: 12px solid rgba(47, 127, 134, 0.35);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hud__card--pulse {
    animation: none;
  }
}

/* ── 顶栏提示 ─────────────────────────────────────────────────────── */

.banner {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 12px 24px;
  background: var(--warn-bg);
  border-bottom: 3px solid var(--warn);
  color: var(--warn);
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  z-index: 5;
}

.banner__item {
  margin: 0;
}

/* ── 家属端（副屏，?view=family）───────────────────────────────────── */

.family-view {
  min-height: 100%;
  overflow: auto;
}

.family-view[hidden] {
  display: none;
}

.family {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 24px 60px;
  font-size: 18px;
}

.family__header {
  display: flex;
  align-items: baseline;
  gap: 18px;
  flex-wrap: wrap;
}

.family__title {
  margin: 0 0 12px;
  font-size: 34px;
}

.family__offline {
  margin: 0;
  padding: 6px 14px;
  border-radius: 10px;
  background: var(--warn-bg);
  color: var(--warn);
  font-weight: 700;
}

.family__card {
  margin: 20px 0;
  padding: 20px 22px;
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: 0 4px 14px rgba(40, 30, 20, 0.08);
}

.family__h2 {
  margin: 0 0 14px;
  font-size: 24px;
}

.family__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.family__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.family__label {
  font-size: 16px;
  color: var(--ink-soft);
}

.family__input {
  min-height: 52px; /* 其他点击目标 ≥ 44 */
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: 10px;
  font-family: inherit;
  font-size: 18px;
  color: var(--ink);
  background: #ffffff;
}

.family__button {
  min-height: 60px;
  margin-top: 14px;
  padding: 12px 22px;
  border: 3px solid transparent;
  border-radius: 12px;
  background: var(--teal);
  color: #ffffff;
  font-family: inherit;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
}

.family__button--ghost {
  background: #ffffff;
  color: var(--teal-dark);
  border-color: var(--teal);
}

.family__button--small {
  min-height: 48px;
  margin: 8px 10px 0 0;
  padding: 8px 16px;
  font-size: 18px;
}

.family__list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.family__item {
  padding: 14px 16px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fdfdfd;
}

.family__text {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}

.family__meta {
  margin: 6px 0 0;
  font-size: 16px;
  color: var(--ink-soft);
}

.family__empty {
  margin: 0;
  padding: 14px 16px;
  border-radius: 12px;
  background: #f6f6f6;
  color: var(--ink-soft);
  font-size: 18px;
}

.family__actions {
  display: flex;
  flex-wrap: wrap;
}

/* ── 调试抽屉（默认隐藏，绝不进入观众第一眼）───────────────────────── */

.debug {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 20;
  width: min(430px, 42vw);
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 16px 18px 20px;
  border-radius: 16px;
  background: rgba(24, 30, 36, 0.94);
  color: #eef3f6;
  font-size: 16px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.debug[hidden] {
  display: none;
}

.debug__close {
  min-height: 44px;
  margin-bottom: 12px;
  padding: 8px 14px;
  border: 2px solid #6f8494;
  border-radius: 10px;
  background: transparent;
  color: #eef3f6;
  font-family: inherit;
  font-size: 16px;
  cursor: pointer;
}

.debug__section {
  margin-bottom: 16px;
}

.debug__title {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 700;
  color: #8fd3d9;
}

.debug__row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.debug__button {
  min-height: 44px;
  padding: 8px 14px;
  border: 2px solid #4d6472;
  border-radius: 10px;
  background: #232d36;
  color: #eef3f6;
  font-family: inherit;
  font-size: 16px;
  cursor: pointer;
}

.debug__button:hover {
  background: #2f3d49;
}

.debug__input {
  min-height: 44px;
  padding: 8px 10px;
  border: 2px solid #4d6472;
  border-radius: 10px;
  background: #182026;
  color: #eef3f6;
  font-family: inherit;
  font-size: 16px;
}

.debug__status {
  margin: 6px 0 0;
  font-size: 16px;
  color: #b9c8d2;
  line-height: 1.4;
}

/* ── 200% 缩放 / 窄屏：不丢内容与功能 ───────────────────────────────── */

@media (max-width: 1100px) {
  .hud__card {
    width: min(560px, 78vw);
    padding: 20px 22px 22px;
  }

  .hud__headline {
    font-size: 36px;
  }

  .hud__button {
    min-width: 180px;
    font-size: 28px;
  }
}

@media (max-width: 720px) {
  .hud__card {
    left: 16px;
    right: 16px;
    top: 16px;
    width: auto;
  }

  .hud__meta {
    top: auto;
    bottom: 84px;
    right: 16px;
  }

  .debug {
    width: calc(100vw - 32px);
  }
}

/* ── 交互控制台（controls.js，S 线）─────────────────────────────────
 * 演示操作台：把契约里已有的命令接到按钮上。
 * 对比度沿用本文件顶部的实测配色对；按钮最小高度 44px（点击目标硬数值）。
 * ⚠️ 拍摄模式（?film=1）不挂载本面板，所以它不会进画面。
 */
.console {
  position: fixed;
  /* 放右下角：左上是长者端大字卡，右上是演示时钟/语音角标，只有右下是空的 */
  right: 14px;
  bottom: 24px;
  z-index: 60;
  /* v1.14：再收一档（用户口径「右下角控制台再缩小一点」）——它是给演示者用的，不是给观众看的 */
  width: min(322px, 24vw);
  max-height: min(62vh, 560px);
  overflow: auto;
  padding: 9px 11px 10px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  font-size: 13.5px;
  line-height: 1.35;
}

.console--compact {
  transform: scale(0.86);
  transform-origin: bottom right;
}

/* ── v1.14：左下角演示控制条（模式切换 + 家属端副屏）────────────────────
 * 用户口径「左下角设置一个按键，点击即可弹出家属端副屏」+「做成可切换模式的平台」。
 * 它只有两个控件，放在左下角的空白处，不遮主场景。 */
.dock {
  position: fixed;
  left: 14px;
  bottom: 24px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 13.5px;
}

.dock__seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.dock__button {
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  padding: 7px 12px;
  cursor: pointer;
  white-space: nowrap;
}

.dock__button[aria-pressed="true"] {
  background: var(--brand, #2f7f86);
  color: #fff;
}

.dock__button--family {
  border: 1px solid var(--brand, #2f7f86);
  border-radius: 999px;
  color: var(--brand, #2f7f86);
  font-weight: 600;
}

.dock__button:hover {
  filter: brightness(1.06);
}

.dock__hint {
  color: var(--ink-2, #5b6b6f);
  padding-left: 4px;
}

/* ── v1.14：取药特写（`body.shot-delivery`）──────────────────────────────
 * 用户口径「让观众看清机器人如何递药和水、老人拿起药和水食用，不要有遮挡」。
 * 递药那几秒里：演示者的控制台压到几乎看不见、调试抽屉与大字卡让位，画面留给取药动作。
 * 只是透明度，不改任何布局与点击（控制台仍可用）。 */
body.shot-delivery .console {
  opacity: 0.16;
}

body.shot-delivery .hud__card {
  opacity: 0.62;
}

body.shot-delivery .debug {
  opacity: 0.2;
}

/* 固定演示模式：控制台本来就只是演示者用的，整体再收一点 */
body.is-scripted .console {
  opacity: 0.72;
}

.console__button {
  font-size: 14.5px;
}

.console[hidden] {
  display: none;
}

.console__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.console__title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.5px;
}

.console__toggle {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink-soft);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.console__section {
  padding-top: 7px;
  margin-top: 7px;
  border-top: 1px solid var(--line);
}

.console__section:first-of-type {
  padding-top: 0;
  margin-top: 0;
  border-top: 0;
}

.console__label {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.6px;
}

/* 用网格而不是 flex 换行：按钮宽高一致，整体高度可预期（不会突然多出一行） */
.console__row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(var(--btn, 94px), 1fr));
  gap: 8px;
}

.console__row--wide {
  --btn: 132px;
}

.console__row--tight {
  --btn: 78px;
}

.console__button {
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.console__button:hover {
  border-color: var(--teal);
  color: var(--teal-dark);
}

.console__button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.console__button--primary {
  background: var(--teal);
  border-color: var(--teal);
  color: var(--paper);
  font-weight: 600;
}

.console__button--primary:hover {
  background: var(--teal-dark);
  border-color: var(--teal-dark);
  color: var(--paper);
}

/* 选中态不能只靠颜色：加粗 + 描边 + 前缀点 */
.console__button--on {
  background: var(--teal-dark);
  border-color: var(--teal-dark);
  color: var(--paper);
  font-weight: 600;
}

.console__note {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--ink-soft);
}

.console__status {
  margin: 0 0 8px;
  padding: 7px 9px;
  border-radius: 9px;
  background: var(--paper-warm);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-soft);
}

/* 第二行回显（机器人视角：感应到谁、还有多远）——比主行弱一档 */
.console__status--sub {
  margin-top: -4px;
  font-size: 12.5px;
  border-style: dashed;
}

/* 自由视角的光标提示 */
.scene-canvas.is-orbiting {
  cursor: grab;
}

.scene-canvas.is-dragging {
  cursor: grabbing;
}

@media (max-width: 1100px) {
  .console {
    width: min(340px, 92vw);
    max-height: 46vh;
    bottom: 56px;
    right: 12px;
  }
}

/* ══ v1.16：页内「手机屏」家属端 + 所有小窗口可点击收起/展开 ═══════════════
 * 用户口径：①「家属端副屏可以用一个手机屏幕展示」②「所有小窗口都可以点击收起打开」。
 * 一律只改**表现**：收起只是 `display:none` / 高度归零，功能与控制台命令一条不少。 */

/* 手机壳：右侧竖屏，窄视口自动收窄 */
.phone {
  position: fixed;
  right: 14px;
  top: 12px;
  bottom: 12px;
  z-index: 70;
  width: min(392px, 30vw);
  display: flex;
  align-items: stretch;
  transition: width 0.18s ease, height 0.18s ease;
}

.phone__frame {
  position: relative;
  flex: 1;
  border-radius: 38px;
  background: #0d1114;
  padding: 12px 10px 16px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
  border: 1px solid #232a2f;
  overflow: hidden;
}

/* 听筒/刘海 */
.phone__notch {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 96px;
  height: 18px;
  border-radius: 0 0 12px 12px;
  background: #05080a;
}

.phone__screen {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 26px;
  background: #fff;
  display: block;
}

/* 收起后只剩一条窄条 */
.phone.is-collapsed {
  bottom: auto;
  height: 46px;
}

.phone.is-collapsed .phone__frame {
  border-radius: 14px;
  padding: 6px 10px;
}

.phone.is-collapsed .phone__screen,
.phone.is-collapsed .phone__notch {
  display: none;
}

.phone.is-collapsed .phone__title {
  display: block;
}

.phone__title {
  display: none;
  color: #e8f1f2;
  font-size: 13.5px;
  line-height: 22px;
  text-align: center;
}

/* 收起/展开按钮：小圆片，跟着各窗口 */
.collapse-toggle {
  position: fixed;
  z-index: 80;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
}

.collapse-toggle--hud {
  top: 16px;
  left: 414px;
}

body.is-hud-collapsed .collapse-toggle--hud {
  left: 16px;
}

#hud.is-collapsed .hud__card,
#hud.is-collapsed .hud__clock,
#hud.is-collapsed .hud__voice {
  display: none;
}

.collapse-toggle--console {
  right: 344px;
  bottom: 30px;
}

body.is-console-collapsed .collapse-toggle--console {
  right: 16px;
}

/* 控制台收起：只留那颗圆片（其余全部隐藏） */
.console.is-collapsed > *:not(.collapse-toggle) {
  display: none;
}

.console.is-collapsed {
  width: auto;
  max-height: none;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.collapse-toggle--dock {
  left: 14px;
  bottom: 82px;
}

body.is-dock-collapsed .collapse-toggle--dock {
  bottom: 24px;
}

.dock.is-collapsed .dock__seg,
.dock.is-collapsed .dock__hint,
.dock.is-collapsed .dock__button--family {
  display: none;
}

.dock.is-collapsed {
  padding: 6px 8px;
}

.dock.is-collapsed::before {
  content: '控制条已收起';
  color: var(--ink-2, #5b6b6f);
  font-size: 13px;
}

.collapse-toggle--phone {
  right: 16px;
  top: 22px;
}

.phone.is-collapsed .collapse-toggle--phone {
  top: 18px;
}

/* v1.16：控制条上的版本角标（缓存排查用：不是 v1.16 就是拿了旧文件） */
.dock__version {
  font-size: 12px;
  color: #fff;
  background: var(--brand, #2f7f86);
  border-radius: 999px;
  padding: 3px 8px;
  letter-spacing: 0.4px;
}

/* ══ v1.18：家属端「手机推送」 ═══════════════════════════════════════════
 * 用户口径：「当吃药时间到，但老人由于在卫生间或者出门了导致未吃药，
 * 需要在手机端设置一个消息弹出提示家属」。
 * 它是我们自己的叠层（画在手机壳里、队友那个 iframe 的**上面**），不去改队友的文件。 */
.phone__push {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 34px;
  z-index: 5;
  border-radius: 16px;
  padding: 10px 12px 9px;
  background: rgba(18, 22, 26, 0.95);
  color: #f2f7f8;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transform: translateY(-140%);
  opacity: 0;
  transition: transform 0.28s ease, opacity 0.28s ease;
  pointer-events: none;
}

.phone__push.on {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.phone__push-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #9fb3b8;
}

.phone__push-app {
  font-weight: 700;
  color: #7fd4ff;
  letter-spacing: 0.4px;
}

.phone__push-title {
  margin-top: 3px;
  font-size: 14.5px;
  font-weight: 700;
}

.phone__push-body {
  margin-top: 3px;
  font-size: 13px;
  line-height: 1.42;
  color: #dfe9ea;
}

.phone__push-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 7px;
}

.phone__push-ok {
  border: 0;
  border-radius: 999px;
  padding: 5px 12px;
  font: inherit;
  font-size: 12.5px;
  background: #2f7f86;
  color: #fff;
  cursor: pointer;
}

/* 手机屏收着时，按钮上留个红点 */
.dock__button--family.has-badge::after {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 6px;
  border-radius: 50%;
  background: #e2493f;
  box-shadow: 0 0 0 2px rgba(226, 73, 63, 0.25);
}

/* ══ v1.19：固定演示「播放器」+ 字幕条（用户口径：做成像视频一样能播的片子，随时暂停讲解）══ */
.player {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 75;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(14, 18, 22, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.32);
  color: #eef6f7;
  font-size: 13px;
  min-width: min(720px, 52vw);
}

.player__btn {
  border: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #eef6f7;
  font-size: 14px;
  cursor: pointer;
}

.player__btn--play {
  width: 42px;
  height: 42px;
  background: var(--brand, #2f7f86);
  font-size: 15px;
}

.player__btn:hover {
  filter: brightness(1.15);
}

.player__mid {
  flex: 1;
  min-width: 220px;
}

.player__chapter {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player__track {
  margin-top: 5px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
}

.player__track > i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--brand, #2f7f86);
  transition: width 0.25s ease;
}

.player__count {
  font-variant-numeric: tabular-nums;
  color: #9fb3b8;
  min-width: 44px;
  text-align: right;
}

body.is-paused .player__btn--play {
  background: #d8a12a;
}

/* 字幕条：旁白 + 小护 + 奶奶，三种文本分层显示，底部居中，大字（适老化） */
.caption {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  z-index: 74;
  width: min(980px, 74vw);
  padding: 12px 18px;
  border-radius: 14px;
  background: rgba(10, 14, 17, 0.78);
  color: #f4f9fa;
  text-align: center;
  opacity: 0;
  transition: opacity 0.24s ease;
  pointer-events: none;
}

.caption.on {
  opacity: 1;
}

.caption__narration {
  margin: 0 0 6px;
  font-size: 14.5px;
  font-style: italic;
  color: #b9cdd2;
  line-height: 1.5;
}

.caption__line {
  margin: 2px 0;
  line-height: 1.45;
}

.caption__line--robot {
  font-size: 19px;
  font-weight: 600;
  color: #8fe3f0;
}

.caption__line--elder {
  font-size: 17px;
  color: #ffd9a8;
}

/* v1.20：固定演示片名「保卫老人」（用户口径：帮我命名一下：保卫老人） */
.player__brand {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #8fe3f0;
  padding-right: 6px;
  border-right: 1px solid rgba(255, 255, 255, 0.18);
  margin-right: 2px;
  white-space: nowrap;
}

/* v1.20：录制模式（?record=1）—— 隐藏所有 UI，只留 3D 画面与字幕 */
body.is-record .dock,
body.is-record .console,
body.is-record .player,
body.is-record .phone,
body.is-record .debug,
body.is-record .banner,
body.is-record .stage-caption,
body.is-record .collapse-toggle,
body.is-record #hud {
  display: none !important;
}

body.is-record .caption {
  bottom: 36px;
  width: min(1100px, 84vw);
}

/* v1.20：固定演示模式下把控制条抬到播放器上方，并把字幕再抬高一点 ——
 * 修"播放器压住左下控制条"（实测重叠 27px，右上那颗「家属端手机屏」会被点不到） */
body.is-scripted .dock {
  bottom: 92px;
}

body.is-scripted .dock__hint {
  max-width: 30vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.is-scripted .caption {
  bottom: 148px;
}

body.is-scripted .collapse-toggle--dock {
  bottom: 150px;
}

/* v1.21：家属端手机屏上的「家属端 / 机器人设置」切换（把队友最新那份也放进主演示）
 * ⚠️ 必须放在手机壳**内部**：壳是 overflow:hidden，原先放 bottom:-34px 会被整块裁掉（点不到） */
.phone__tabs {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 26px;
  display: flex;
  gap: 6px;
  z-index: 7;
}

.phone.is-collapsed .phone__tabs {
  display: none;
}

/* 顶部让出一点位置给切换条，别压在内容上 */
.phone__screen {
  margin-top: 26px;
  height: calc(100% - 26px);
}

.phone__tab {
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(14, 18, 22, 0.9);
  color: #dfeaec;
  font: inherit;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

.phone__tab.is-on {
  background: var(--brand, #2f7f86);
  border-color: transparent;
  color: #fff;
}

/* v1.21：左下角「她没吃药」演示模块 */
.dock__seg--missed {
  border-color: #d8a12a;
}

.dock__seg--missed .dock__button {
  color: #a8730b;
}

.dock__seg--missed .dock__button:hover {
  background: rgba(216, 161, 42, 0.16);
}

/* v1.22：取药动作字幕（用户口径：看不出她在干什么）—— 大字、深底、居中偏下，一眼能读 */
.act {
  position: fixed;
  left: 50%;
  bottom: 218px;
  transform: translate(-50%, 8px);
  z-index: 76;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(12, 16, 20, 0.86);
  border: 1px solid rgba(143, 227, 240, 0.35);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.act.on {
  opacity: 1;
  transform: translate(-50%, 0);
}

.act__who {
  font-size: 15px;
  color: #9fb3b8;
  border-right: 1px solid rgba(255, 255, 255, 0.18);
  padding-right: 10px;
}

.act__what {
  font-size: 24px;
  font-weight: 700;
  color: #8fe3f0;
  letter-spacing: 0.5px;
}

body.is-scripted .act {
  bottom: 262px;
}

/* v1.23：概念片浮层（用户给的视频，已转 H.264 放在 recordings/） */
.concept {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(6, 9, 12, 0.82);
}

.concept.on {
  display: flex;
}

.concept__box {
  width: min(1040px, 86vw);
  border-radius: 16px;
  background: #0d1114;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.concept__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: #e8f1f2;
  font-size: 14px;
}

.concept__head span {
  color: #9fb3b8;
  font-size: 12.5px;
}

.concept__head b {
  color: #8fe3f0;
}

.concept__close {
  margin-left: auto;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: transparent;
  color: #dfeaec;
  border-radius: 999px;
  padding: 5px 12px;
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}

.concept__video {
  display: block;
  width: 100%;
  max-height: 72vh;
  background: #000;
}

/* 录制模式（出片）里不出现概念片浮层 */
body.is-record .concept {
  display: none !important;
}

/* v1.24 写实化：镜头暗角（纯 CSS 叠层，pointer-events:none，不影响点击） */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 95;
  background: radial-gradient(ellipse at 50% 48%, rgba(0, 0, 0, 0) 52%, rgba(0, 0, 0, 0.16) 82%, rgba(0, 0, 0, 0.30) 100%);
}
