/* 学习监督模式页样式 */
.study {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 8px 16px;
  position: relative;
}

/* ---- 顶部状态行（计时 + 专注状态） ---- */
.status-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 480px;
  margin: 4px 0 12px;
}

.timer {
  background: rgba(255, 255, 255, 0.92);
  color: #2f6fd6;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  font-size: 16px;
  padding: 6px 12px;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.state-badge {
  background: rgba(255, 255, 255, 0.92);
  color: #6b7280;
  font-weight: 700;
  font-size: 14px;
  padding: 6px 12px;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
.state-badge[data-state="focus"]  { color: #15803d; background: #e7f9ee; }
.state-badge[data-state="away"]   { color: #b45309; background: #fef3c7; }
.state-badge[data-state="absent"] { color: #b91c1c; background: #fee2e2; }

/* ---- 提醒弹窗 ---- */
.reminder {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.7);
  background: rgba(255, 255, 255, 0.97);
  color: #2f6fd6;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  max-width: 80%;
  padding: 16px 20px;
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(47, 111, 214, 0.35);
  opacity: 0;
  z-index: 5;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}
.reminder.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* ---- 摄像头小窗 ---- */
.cam {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 120px;
  height: 90px;
  border-radius: 14px;
  overflow: hidden;
  border: 3px solid #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  background: #1f2937;
  z-index: 6;
}
.cam video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* 自拍镜像 */
}
.cam-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(31, 41, 55, 0.75);
  text-align: center;
}
.cam-overlay.hidden { display: none; }
.cam-msg {
  color: #d1d5db;
  font-size: 11px;
  line-height: 1.5;
  padding: 6px;
}

/* ---- 控制区 ---- */
.controls {
  background: rgba(255, 255, 255, 0.9);
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}

.ctrl-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.ctrl-btn {
  border: 2px solid #dbe7f5;
  background: #fff;
  color: #2f6fd6;
  font-size: 14px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
}

.ctrl-label {
  font-size: 13px;
  color: #6b7280;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ctrl-label input[type="range"] { width: 90px; accent-color: #4a9eff; }
#sens-val { font-weight: 700; color: #2f6fd6; min-width: 34px; }

.ctrl-check {
  font-size: 13px;
  color: #6b7280;
  display: flex;
  align-items: center;
  gap: 4px;
}
.ctrl-check input { accent-color: #4a9eff; width: 16px; height: 16px; }

.ctrl-main {
  display: flex;
  gap: 10px;
}

.big-btn {
  flex: 1;
  border: none;
  background: linear-gradient(135deg, #3ecf8e, #1fa866);
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  padding: 14px 0;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(31, 168, 102, 0.35);
}
.big-btn.secondary {
  background: linear-gradient(135deg, #ffb84d, #f59e0b);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}
.big-btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.big-btn:active:not(:disabled) { transform: scale(0.97); }

/* ---- 小结卡片 ---- */
.summary {
  margin-top: 12px;
  background: #f3f8ff;
  border: 2px solid #dbe7f5;
  border-radius: 16px;
  padding: 12px 16px;
}
.summary h3 { font-size: 15px; color: #2f6fd6; margin-bottom: 8px; }
.summary table { width: 100%; border-collapse: collapse; font-size: 14px; }
.summary td { padding: 4px 0; color: #4b5563; }
.summary td:last-child { text-align: right; color: #111827; font-weight: 600; }
.summary-note { margin-top: 8px; font-size: 13px; color: #8a94a6; }
.big-link {
  display: inline-block;
  margin-top: 6px;
  background: linear-gradient(135deg, #3ecf8e, #1fa866);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  padding: 8px 18px;
  border-radius: 999px;
  text-decoration: none;
  box-shadow: 0 3px 8px rgba(31, 168, 102, 0.3);
}

/* ---- 身份识别卡片 ---- */
.ident {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 86%;
  max-width: 380px;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 18px;
  box-shadow: 0 12px 34px rgba(47, 111, 214, 0.35);
  padding: 16px;
  z-index: 9;
}
.ident[hidden] { display: none; }
.ident-body { display: flex; flex-direction: column; gap: 8px; }
.ident-title { font-size: 15px; font-weight: 700; color: #2f6fd6; text-align: center; }
.ident-ask { font-size: 17px; text-align: center; color: #111827; margin-bottom: 4px; }
.ident-others { display: flex; flex-direction: column; gap: 8px; }
.ident-btn {
  border: 2px solid #dbe7f5;
  background: #fff;
  color: #2f6fd6;
  font-size: 15px;
  font-weight: 700;
  padding: 10px 0;
  border-radius: 999px;
  cursor: pointer;
}
.ident-btn.ok {
  border: none;
  background: linear-gradient(135deg, #3ecf8e, #1fa866);
  color: #fff;
}
.ident-btn.ghost {
  border-color: transparent;
  color: #8a94a6;
  font-weight: 600;
}
.ident-btn small { color: #9ca3af; font-weight: 400; }

/* ---- 欢迎语 ---- */
.greeting {
  position: absolute;
  top: 58px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.96);
  color: #2f6fd6;
  font-size: 17px;
  font-weight: 800;
  padding: 12px 20px;
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(47, 111, 214, 0.3);
  z-index: 9;
  white-space: nowrap;
  animation: greet-pop 0.35s ease;
}
@keyframes greet-pop {
  from { opacity: 0; transform: translateX(-50%) scale(0.8); }
  to { opacity: 1; transform: translateX(-50%) scale(1); }
}

/* ---- 语音问答浮层（录像监控同时开口问） ---- */
.float-mic {
  position: fixed;
  right: 14px;
  bottom: calc(86px + env(safe-area-inset-bottom));
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #4a9eff, #2f6fd6);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  z-index: 90;
  box-shadow: 0 4px 14px rgba(47, 111, 214, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s;
}
.float-mic:active { transform: scale(0.92); }
.float-mic.live {
  background: #ef4444;
  animation: micPulse 1.3s infinite;
}
@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45); }
  50% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
}

/* ---- 开始/结束：常驻在对话框上方（与对话框同一版面，互不遮挡） ---- */
.start-wrap {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 480px;
  margin: 2px 0 10px;
}

/* ---- 对话记录面板（位于按钮下方，可上下翻阅历史问答） ---- */
.chat-panel {
  width: 100%;
  max-width: 480px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #dbe7f5;
  border-radius: 16px;
  z-index: 4;
  box-shadow: 0 6px 22px rgba(15, 23, 42, 0.12);
  overflow: hidden;
  margin-bottom: 6px;
}
.chat-panel[hidden] { display: none; }
.cp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid #eef2f7;
  font-size: 14px;
  font-weight: 700;
  color: #2f6fd6;
}
.cp-ops { display: flex; gap: 6px; }
.cp-btn {
  border: 1px solid #dbe7f5;
  background: #fff;
  color: #6b7280;
  font-size: 12px;
  border-radius: 999px;
  padding: 3px 10px;
  cursor: pointer;
}
.cp-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.6;
}
.cp-line { margin: 2px 0; white-space: pre-wrap; word-break: break-word; }
.cp-line.q { color: #1f2937; font-weight: 600; }
.cp-line.a { color: #2f6fd6; }
.cp-line.err { color: #b91c1c; }
.cp-line.hint { color: #9aa5b5; text-align: center; margin-top: 24px; }
.cp-line.status { color: #6b7280; text-align: center; font-size: 12px; }

/* 语音确认框（识别文字可编辑后发送） */
.cp-confirm {
  border: 1px solid #dbe7f5;
  border-radius: 12px;
  padding: 8px;
  background: #f8fbff;
  margin: 6px 0;
}
.cp-confirm-text {
  width: 100%;
  box-sizing: border-box;
  font-size: 14px;
  line-height: 1.6;
  padding: 8px 10px;
  border: 2px solid #dbe7f5;
  border-radius: 10px;
  font-family: inherit;
  resize: vertical;
}
.cp-confirm-btns {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.cp-confirm-btn {
  flex: 1;
  border: none;
  border-radius: 999px;
  padding: 9px 0;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  background: #eef2f7;
  color: #334155;
}
.cp-confirm-btn.go { background: linear-gradient(135deg, #4a9eff, #2f6fd6); color: #fff; }
.cp-confirm-btn.ghost { background: transparent; color: #8a94a6; font-weight: 600; }

/* ================= 横屏全屏学习模式 ================= */
.fs-entry {
  border: 2px solid #4a9eff;
  background: #fff;
  color: #2f6fd6;
  font-size: 13px;
  font-weight: 700;
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
}
.fs-mode .top,
.fs-mode .study,
.fs-mode .controls,
.fs-mode .foot,
.fs-mode .privacy-banner { display: none; }

.fs-mode .app { height: 100dvh; max-width: none; background: #0f172a; }
.fs-view {
  width: 100%;
  height: 100%;
  display: flex;
  background: #0f172a;
}
.fs-view[hidden] { display: none; }

/* 左：大画面（孩子自己 / 摄像头） */
.fs-left {
  flex: 1.25;
  min-width: 0;
  position: relative;
  background: #000;
}
.fs-left video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* 自拍镜像 */
}
.fs-corner {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  gap: 8px;
  z-index: 2;
}
.fs-actions {
  position: absolute;
  bottom: 14px;
  left: 12px;
  display: flex;
  gap: 8px;
  z-index: 2;
}
.fs-actions .tool-btn,
.fs-exit {
  border: none;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.92);
  color: #2f6fd6;
}
.fs-actions .tool-btn:disabled { opacity: 0.5; }
.fs-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #cbd5e1;
  font-size: 15px;
  background: rgba(15, 23, 42, 0.7);
  text-align: center;
  padding: 20px;
  z-index: 1;
  cursor: pointer;
}
.fs-hint[hidden] { display: none; }
.fs-left .reminder { z-index: 6; }
.fs-left .greeting {
  top: 64px;
  color: #fff;
  background: rgba(15, 23, 42, 0.85);
  box-shadow: none;
}

/* 右：对话历史（上）+ 浮动麦克风（下） */
.fs-right {
  width: 42%;
  max-width: 460px;
  min-width: 300px;
  display: flex;
  flex-direction: column;
  background: #f6f9ff;
  position: relative;
}
.fs-exit-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  color: #2f6fd6;
  font-size: 13px;
  font-weight: 700;
}
.fs-chat-slot { flex: 1; min-height: 0; display: flex; flex-direction: column; padding-bottom: 84px; }
.fs-mode .fs-chat-slot .chat-panel {
  max-width: none;
  flex: 1;
  margin: 0 12px;
  border: none;
}
/* 全屏下麦克风固定到右侧底部中央偏右 */
.fs-mode .float-mic {
  right: 20px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  width: 64px;
  height: 64px;
  font-size: 28px;
  z-index: 95;
}

@media (orientation: portrait) {
  /* 手机竖屏时若仍进入：左右各占半屏仍可用，但提示横屏更好 */
  .fs-left { flex: 1; }
  .fs-right { width: 52%; min-width: 0; }
  /* 竖屏且处于分屏布局中：提示横放（iOS 无法用代码强制横屏，只能引导手动旋转） */
  .fs-rotate { display: block; }
}
.fs-rotate {
  display: none;
  position: absolute;
  left: 50%;
  bottom: 20%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  max-width: 86%;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 14px 18px;
  border-radius: 16px;
  z-index: 4;
  line-height: 1.6;
}
.fs-rotate .tool-btn {
  margin-top: 10px;
  background: #fff;
  color: #0f172a;
  font-weight: 700;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
}
