/* ==========================================================================
   儿童习惯互动扫描工具
   - 主控制台：清爽偏白医疗体检风 + 全链路防穿帮单主按钮 + 小巧 CH-B 直达满分
   - 右上角《使用手册》弹窗：大人专属秘密指南
   - 全屏检测仪：保留深青蓝雷达 & 绘本级 B 超手绘色调
   ========================================================================== */
:root {
  --page-bg: #f3f8fb;
  --surface: #ffffff;
  --border-light: #e2edf4;
  --primary: #0ea5a4;
  --primary-dark: #0b8484;
  --sky: #0284c7;
  --mint: #10b981;
  --text-main: #152536;
  --text-sub: #5f758a;
  --text-muted: #8ea1b3;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  background: linear-gradient(180deg, #eaf5fb 0%, #f7fafc 40%, #ffffff 100%);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

/* ================= 控制台主页面（清爽明亮白色系） ================= */
.console-view {
  max-width: 780px;
  margin: 0 auto;
  padding: 18px 18px 46px;
}

/* 顶部工具栏：左品牌胶囊 + 右《使用手册》按钮 */
.top-utility-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 999px;
  background: #e6f7f6;
  border: 1px solid #bceae6;
  color: #0b8484;
  font-size: 12px;
  font-weight: 700;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.65);
  animation: pulse 1.6s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.8); }
}

.btn-guide {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid #d4e4ef;
  background: #ffffff;
  color: #365066;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(15, 45, 70, 0.06);
  transition: transform 0.12s ease, border-color 0.15s ease;
}

.btn-guide:hover {
  border-color: #8fd6d0;
  color: #0b8484;
}

.btn-guide:active {
  transform: scale(0.96);
}

.guide-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #f43f5e;
  border: 2px solid #ffffff;
  box-shadow: 0 0 6px rgba(244, 63, 94, 0.6);
}

.console-header {
  text-align: center;
  margin-bottom: 18px;
}

.console-header h1 {
  margin: 0 0 6px;
  font-size: 27px;
  font-weight: 800;
  color: #0f2537;
  letter-spacing: 0.01em;
}

.subtitle {
  margin: 0;
  color: var(--text-sub);
  font-size: 14px;
}

/* 宝宝名字档案卡片 */
.baby-profile-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 18px;
  padding: 14px 16px;
  margin-bottom: 20px;
  box-shadow: 0 6px 20px rgba(15, 45, 70, 0.05);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.profile-label {
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #eff9ff;
  border: 1px solid #d2ecfb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.profile-label strong {
  display: block;
  font-size: 15px;
  color: var(--text-main);
}

.profile-label small {
  display: block;
  font-size: 12px;
  color: var(--text-sub);
  margin-top: 2px;
}

.profile-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.baby-name-input {
  width: 100%;
  padding: 11px 38px 11px 14px;
  border-radius: 12px;
  border: 1.5px solid #d5e5f0;
  background: #f8fbfd;
  color: var(--text-main);
  font-size: 15px;
  font-weight: 600;
  outline: none;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.baby-name-input:focus {
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(14, 165, 164, 0.12);
}

.baby-name-input::placeholder {
  color: #99adbe;
  font-weight: 400;
}

.btn-clear-name {
  position: absolute;
  right: 10px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: #dde8f0;
  color: #4f6478;
  font-size: 12px;
  cursor: pointer;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 6px 2px 12px;
  font-size: 15.5px;
  font-weight: 800;
  color: #163046;
}

.count-pill {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: #e6f9f1;
  color: #059669;
}

/* 场景卡片网格 */
.scenario-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(305px, 1fr));
  gap: 14px;
}

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(15, 45, 70, 0.06);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.card:hover {
  border-color: #9ce2dc;
  box-shadow: 0 12px 28px rgba(14, 165, 164, 0.11);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.card-icon {
  width: 50px;
  height: 50px;
  border-radius: 15px;
  background: linear-gradient(135deg, #e8f8f7, #ebf5ff);
  border: 1px solid #d0eceb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 27px;
  flex-shrink: 0;
}

.card-meta {
  flex: 1;
  min-width: 0;
}

.card-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.card-title {
  font-size: 17px;
  font-weight: 800;
  color: #102333;
}

.card-code-tag {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: #edf5fa;
  color: #4f6f87;
}

.card-part {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--text-sub);
}

/* 防穿帮按钮区：左侧大方主按钮「开始扫描」+ 右侧小巧低调「CH-B」直达满分 */
.card-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: stretch;
}

.btn-launch {
  border: none;
  border-radius: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.12s ease, opacity 0.15s ease, background 0.15s ease;
}

.btn-launch:active {
  transform: scale(0.96);
}

.btn-scan-main {
  padding: 12px 14px;
  font-size: 14.5px;
  font-weight: 700;
  background: linear-gradient(135deg, #0ea5e9, #0ea5a4);
  color: #ffffff;
  box-shadow: 0 6px 14px rgba(14, 165, 164, 0.22);
}

/* 隐蔽直达满分版的小按钮：像医院探头通道参数，孩子完全看不懂 */
.btn-scan-b {
  padding: 0 12px;
  min-width: 68px;
  background: #f4f9fb;
  border: 1.5px solid #d5e6ef;
  color: #5b768c;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.btn-scan-b:hover {
  background: #e9f8f3;
  border-color: #9be0cb;
  color: #0e7a61;
}

.ch-b-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34d399;
  opacity: 0.85;
}

.console-footer {
  text-align: center;
  margin-top: 28px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.disclaimer-box {
  margin: 12px auto 0;
  max-width: 560px;
  padding: 9px 14px;
  border-radius: 10px;
  background: rgba(241, 246, 250, 0.85);
  border: 1px solid #e1ebf2;
  color: #8296a8;
  font-size: 11.5px;
  line-height: 1.55;
}

/* ================= 全屏检测仪页面（保留暗黑科技雷达 & B超色调） ================= */
.scanner-view {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #020b10;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.scanner-stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  max-width: calc(100vh * 16 / 9);
  max-height: calc(100vw * 9 / 16);
  background: #04131c;
  overflow: hidden;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
}

@media screen and (orientation: portrait) {
  .scanner-stage {
    width: 100vh;
    height: 100vw;
    max-width: calc(100vw * 16 / 9);
    max-height: calc(100vh * 9 / 16);
    transform: rotate(90deg);
    transform-origin: center center;
  }
}

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

/* 顶部仪器 HUD 状态栏 */
.hud-top {
  position: absolute;
  top: 10px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
  z-index: 10;
}

.hud-chip {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(125, 240, 232, 0.34);
  background: rgba(4, 24, 34, 0.74);
  color: #e6fffd;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: transform 0.12s ease;
}

.hud-chip:active {
  transform: scale(0.95);
}

.hud-exit {
  padding: 6px 13px 6px 10px;
}

.back-arrow {
  font-size: 18px;
  line-height: 1;
  margin-top: -1px;
  color: #6df8ee;
}

.back-label {
  font-size: 13px;
  letter-spacing: 0.02em;
}

.hud-sep {
  opacity: 0.35;
  margin: 0 2px;
}

.hud-code-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: rgba(175, 242, 238, 0.85);
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3ff0a5;
  box-shadow: 0 0 8px #3ff0a5;
  animation: pulse 1.2s infinite;
}

.hud-battery {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

.signal-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 10px;
}

.signal-bars i {
  display: block;
  width: 2.5px;
  background: rgba(130, 242, 232, 0.85);
  border-radius: 1px;
}
.signal-bars i:nth-child(1) { height: 4px; }
.signal-bars i:nth-child(2) { height: 7px; }
.signal-bars i:nth-child(3) { height: 10px; }

.mode-hint-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ffd166;
}
.mode-hint-dot.is-clean {
  background: #4ef6a8;
}

.battery-icon {
  position: relative;
  display: inline-block;
  width: 19px;
  height: 10px;
  border: 1.5px solid rgba(165, 244, 238, 0.85);
  border-radius: 2.5px;
  padding: 1.5px;
}

.battery-icon::after {
  content: "";
  position: absolute;
  right: -3.5px;
  top: 2px;
  width: 2px;
  height: 4px;
  background: rgba(165, 244, 238, 0.85);
  border-radius: 0 1px 1px 0;
}

.battery-fill {
  display: block;
  width: 88%;
  height: 100%;
  background: #5ef5be;
  border-radius: 1px;
}

.hud-result-badge {
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.03em;
  background: rgba(20, 28, 40, 0.84);
  border: 1px solid rgba(255, 210, 120, 0.55);
  color: #ffe3a3;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.hud-result-badge.is-clean {
  background: rgba(10, 62, 48, 0.88);
  border-color: rgba(110, 255, 200, 0.7);
  color: #ccffea;
}

.hud-subtitle {
  position: absolute;
  left: 44%;
  bottom: 12px;
  transform: translateX(-50%);
  max-width: 64%;
  padding: 6px 15px;
  border-radius: 999px;
  background: rgba(6, 16, 24, 0.74);
  border: 1px solid rgba(180, 235, 240, 0.22);
  color: #eef9fc;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  z-index: 10;
}

.hud-report-btn {
  position: absolute;
  right: 16px;
  bottom: 10px;
  z-index: 12;
  border: 1px solid rgba(130, 255, 224, 0.65);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.92), rgba(14, 165, 164, 0.94));
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 800;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  animation: fadeSlideUp 0.35s ease;
}

.hud-report-btn:active {
  transform: scale(0.95);
}

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.secret-toast {
  position: absolute;
  top: 46px;
  right: 16px;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(6, 24, 34, 0.84);
  border: 1px solid rgba(90, 245, 215, 0.4);
  color: #9bf7ef;
  font-size: 11px;
  font-family: ui-monospace, monospace;
  z-index: 15;
  pointer-events: none;
}

/* ================= 家长/老师专属《使用手册》弹窗 ================= */
.guide-modal,
.report-modal {
  position: fixed;
  inset: 0;
  z-index: 1500;
  background: rgba(15, 28, 42, 0.68);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}

.guide-sheet,
.report-sheet {
  width: 100%;
  max-width: 460px;
  max-height: 92vh;
  background: #ffffff;
  border-radius: 22px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 13px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.32);
  overflow-y: auto;
}

.guide-sheet-head,
.report-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.guide-sheet-head h3,
.report-sheet-head h3 {
  margin: 0;
  font-size: 16.5px;
  font-weight: 800;
  color: #0f2537;
}

.btn-close-modal {
  border: none;
  background: #eff5f9;
  color: #4f6478;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.guide-warn-box {
  padding: 10px 12px;
  border-radius: 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  font-size: 12.5px;
  line-height: 1.5;
}

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

.guide-step {
  display: flex;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  background: #f7fafd;
  border: 1px solid #e3eef5;
}

.step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #0ea5a4;
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.step-body {
  flex: 1;
  font-size: 13px;
  line-height: 1.6;
  color: #334e66;
}

.step-body strong {
  color: #0f2537;
  font-size: 14px;
}

.step-body p {
  margin: 4px 0 0;
}

.step-body ul {
  margin: 6px 0 0;
  padding-left: 16px;
}

.step-body li {
  margin-bottom: 5px;
}

.step-note {
  color: #0b8484;
  font-size: 12px;
}

.code-pill {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  vertical-align: baseline;
}

.code-pill.blue {
  background: #e0f2fe;
  color: #0369a1;
}

.code-pill.green {
  background: #dcfce7;
  color: #15803d;
}

.code-pill.dark {
  background: #e2e8f0;
  color: #1e293b;
}

.btn-guide-ok {
  border: none;
  border-radius: 13px;
  padding: 12px;
  background: linear-gradient(135deg, #0ea5e9, #0ea5a4);
  color: #ffffff;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
}

/* ================= 专属检测报告弹窗 ================= */
.report-name-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f5f9fc;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid #e1edf4;
  font-size: 13px;
  color: #3f566b;
}

.report-name-bar input {
  flex: 1;
  min-width: 0;
  border: 1px solid #d1e2ee;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 14px;
  color: #0f2537;
  outline: none;
}

.btn-mini-apply {
  border: none;
  border-radius: 8px;
  background: #0ea5a4;
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 12px;
  cursor: pointer;
}

.report-preview-wrap {
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid #e2eef5;
  background: #f7fafc;
  display: flex;
  justify-content: center;
}

.report-image {
  width: 100%;
  height: auto;
  max-height: 52vh;
  object-fit: contain;
  display: block;
}

.report-share-hint {
  margin: 0;
  text-align: center;
  font-size: 12px;
  color: #5f758a;
}

.report-actions {
  display: grid;
  grid-template-columns: 1.25fr 1fr 0.85fr;
  gap: 8px;
}

.report-actions button {
  border: none;
  border-radius: 12px;
  padding: 11px 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.btn-report-primary {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  color: #ffffff;
}

.btn-report-secondary {
  background: #e6f9f1;
  color: #059669;
}

.btn-report-ghost {
  background: #f1f5f9;
  color: #475569;
}

.global-toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(15, 37, 55, 0.92);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  z-index: 2000;
  box-shadow: 0 8px 24px rgba(15, 37, 55, 0.25);
}
