/* ============================================================
   户外视力筛查系统 - 平板端样式
   适配 1024x768 及以上平板屏幕
   ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #1677ff;
  --primary-hover: #0958d9;
  --primary-light: #e6f4ff;
  --success: #52c41a;
  --success-hover: #389e0d;
  --danger: #ff4d4f;
  --danger-hover: #cf1322;
  --warning: #faad14;
  --bg: #f0f2f5;
  --card-bg: #ffffff;
  --text: #1a1a1a;
  --text-secondary: #666;
  --text-hint: #999;
  --border: #e2e8f0;
  --border-light: #f0f0f0;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.06);
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 18px;
  line-height: 1.5;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* ==============================
   页面切换
   ============================== */
.page {
  display: none;
  height: 100vh;
  width: 100vw;
  position: absolute;
  top: 0; left: 0;
  background: var(--bg);
  /* 矮屏/缩放下内容超高时允许整页滚动，避免内容被裁且无滚动条 */
  overflow-y: auto;
}
.page.active {
  display: flex;
  flex-direction: column;
}
.hidden { display: none !important; }

/* ==============================
   登录页 (Page 1)
   ============================== */
#login-page {
  justify-content: center;
  align-items: center;
  background: linear-gradient(160deg, #e6f4ff 0%, #f0f5ff 40%, #f0f2f5 100%);
}

.login-header {
  text-align: center;
  margin-bottom: 48px;
}
.login-icon {
  font-size: 72px;
  margin-bottom: 16px;
}
.login-title {
  font-size: 36px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 2px;
}
.login-subtitle {
  font-size: 20px;
  color: var(--text-hint);
  margin-top: 8px;
}

.device-code-area {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 36px 48px;
  text-align: center;
  box-shadow: var(--shadow);
  margin-bottom: 32px;
  min-width: 380px;
}
.device-code-label {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.device-code-value {
  font-size: 48px;
  font-weight: 800;
  font-family: "SF Mono", "Consolas", "Courier New", monospace;
  letter-spacing: 8px;
  color: var(--primary);
  margin-bottom: 12px;
}
.device-code-hint {
  font-size: 16px;
  color: var(--text-hint);
}

.auth-status-area {
  text-align: center;
  min-width: 380px;
}
.auth-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.auth-status-text {
  font-size: 22px;
  color: var(--text-secondary);
  font-weight: 600;
}
.auth-status-text.authorized {
  color: var(--success);
}
.auth-status-text.unauthorized {
  color: var(--danger);
}

.btn-auth-retry {
  margin-top: 20px;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 16px 40px;
  font-size: 20px;
  font-weight: 600;
  border-radius: var(--radius);
  cursor: pointer;
  touch-action: manipulation;
}
.btn-auth-retry:active { background: var(--primary-hover); }

.login-footer {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
}
.btn-settings-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.8);
  border: 2px solid var(--border);
  padding: 14px 28px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--radius);
  cursor: pointer;
  touch-action: manipulation;
}
.btn-settings-entry:active { background: var(--primary-light); border-color: var(--primary); }
.gear-icon { font-size: 22px; }

/* ==============================
   模式选择页 (Page 2)
   ============================== */
.mode-topbar {
  background: var(--primary);
  color: #fff;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.mode-topbar-title {
  font-size: 24px;
  font-weight: 700;
}
.btn-settings-sm {
  background: rgba(255,255,255,0.18);
  border: none;
  color: #fff;
  font-size: 26px;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}
.btn-settings-sm:active { background: rgba(255,255,255,0.35); }

.mode-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px;
}

.mode-heading {
  font-size: 30px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 40px;
}

.mode-cards {
  display: flex;
  gap: 28px;
  width: 100%;
  max-width: 720px;
}

.mode-card {
  flex: 1;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 44px 32px;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  border: 3px solid transparent;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  touch-action: manipulation;
}
.mode-card:active {
  transform: scale(0.96);
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
}
.mode-card-vision { border-top: 5px solid var(--primary); }
.mode-card-refract { border-top: 5px solid var(--success); }

.mode-card-icon {
  font-size: 64px;
  margin-bottom: 16px;
}
.mode-card-name {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}
.mode-card-desc {
  font-size: 17px;
  color: var(--text-hint);
  line-height: 1.5;
}

/* ==============================
   检查页共用布局 (Page 3 & 4)
   ============================== */
.exam-topbar {
  background: var(--primary);
  color: #fff;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.btn-topbar-back {
  background: rgba(255,255,255,0.18);
  border: none;
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  touch-action: manipulation;
  white-space: nowrap;
}
.btn-topbar-back:active { background: rgba(255,255,255,0.35); }

.exam-topbar-title {
  flex: 1;
  font-size: 22px;
  font-weight: 700;
  text-align: center;
}

.exam-topbar-count {
  font-size: 17px;
  font-weight: 600;
  background: rgba(255,255,255,0.18);
  padding: 6px 14px;
  border-radius: 16px;
  white-space: nowrap;
}

.exam-topbar-device {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  background: rgba(255,255,255,0.18);
  padding: 6px 14px;
  border-radius: 16px;
  white-space: nowrap;
}
.dev-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  display: inline-block;
}
.dev-dot-off { background: #d9d9d9; }
.dev-dot-on { background: #52c41a; }

.btn-device-mini {
  background: rgba(255,255,255,0.18);
  border: none;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 8px;
  cursor: pointer;
  touch-action: manipulation;
  white-space: nowrap;
}
.btn-device-mini:active { background: rgba(255,255,255,0.35); }

.exam-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ==============================
   通用组件
   ============================== */
.data-section {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  width: 100%;
  max-width: 640px;
}

.section-heading {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-heading-toggle {
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
}
.section-heading-toggle:active { color: var(--primary); }

.toggle-arrow {
  font-size: 14px;
  transition: transform 0.2s;
  color: var(--text-hint);
}
.toggle-arrow.open { transform: rotate(180deg); }

.collapsible { overflow: hidden; }
.collapsible.hidden { display: none; }

.tag {
  padding: 4px 14px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  background: #f0f0f0;
  color: var(--text-secondary);
}
.tag-green { background: #f6ffed; color: var(--success); }
.tag-red { background: #fff2f0; color: var(--danger); }

/* ==============================
   未扫码提示区
   ============================== */
.idle-hint-box {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 36px 24px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  width: 100%;
  max-width: 640px;
  border: 2px dashed var(--border);
  margin-bottom: 16px;
}
.idle-hint-icon {
  font-size: 56px;
  margin-bottom: 12px;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.08); opacity: 0.7; }
}
.idle-hint-text {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.idle-hint-sub {
  font-size: 16px;
  color: var(--text-hint);
  margin-bottom: 16px;
}
.idle-manual-row {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.input-manual {
  flex: 1;
  max-width: 280px;
  padding: 16px 18px;
  font-size: 20px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  text-align: center;
}
.input-manual:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(22,119,255,0.12); }

.btn-manual-go {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 16px 28px;
  font-size: 18px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
}
.btn-manual-go:active { background: var(--primary-hover); }

/* ==============================
   统一搜索栏
   ============================== */
.search-bar {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 8px 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 640px;
  border: 2px solid var(--border);
}
.search-bar:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(22,119,255,0.10);
}

.search-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 22px;
  font-weight: 600;
  font-family: "SF Mono", "Consolas", "Courier New", monospace;
  padding: 10px 4px;
  min-width: 0;
  background: transparent;
  letter-spacing: 1px;
}
.search-input::placeholder {
  color: #c0c0c0;
  font-size: 17px;
  font-weight: 400;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

.search-display {
  font-size: 22px;
  font-weight: 700;
  font-family: "SF Mono", "Consolas", "Courier New", monospace;
  color: var(--primary);
  min-width: 120px;
  text-align: right;
  padding: 10px 6px;
}

.search-clear {
  background: none;
  border: none;
  color: var(--text-hint);
  font-size: 22px;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 8px;
  touch-action: manipulation;
  flex-shrink: 0;
}
.search-clear:active { background: var(--border-light); color: var(--text); }

.search-scan-btn {
  background: var(--primary);
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  padding: 10px 14px;
  border-radius: 8px;
  touch-action: manipulation;
  flex-shrink: 0;
  line-height: 1;
}
.search-scan-btn:active { background: var(--primary-hover); }

/* ==============================
   摄像头扫码弹窗
   ============================== */
.scan-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.95);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scan-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 28px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
}

.scan-hint {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 20px;
  font-weight: 600;
  z-index: 10;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}

.scan-video {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scan-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
  width: min(82vw, 480px);
  height: 220px;
  border: 3px solid var(--primary);
  border-radius: 16px;
  box-shadow: 0 0 0 999px rgba(0,0,0,0.45);
}

.scan-box {
  position: relative;
  width: 100%;
  height: 100%;
}

/* 手电筒按钮（Android 摄像头补光） */
.scan-torch {
  position: absolute;
  bottom: 130px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: 2px solid rgba(255,255,255,0.4);
  color: #fff;
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
}
.scan-torch.active {
  background: var(--primary);
  border-color: var(--primary);
}

/* 手动输入逃生入口 */
.scan-manual-btn {
  position: absolute;
  bottom: 48px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  background: rgba(255,255,255,0.9);
  color: var(--text);
  border: none;
  padding: 14px 36px;
  font-size: 18px;
  font-weight: 600;
  border-radius: var(--radius);
  cursor: pointer;
  touch-action: manipulation;
}
.scan-manual-btn:active { background: #fff; }

/* ==============================
   隐藏扫码输入框（废弃，保留兼容）
   ============================== */
.scan-hidden-input {
  position: fixed;
  left: -9999px;
  top: -9999px;
  width: 2px;
  height: 2px;
  opacity: 0;
  z-index: -1;
}

/* ==============================
   学生身份卡
   ============================== */
.student-card {
  background: var(--card-bg);
  color: var(--text);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  width: 100%;
  max-width: 640px;
}
.student-card-name {
  font-size: 34px;
  font-weight: 800;
  margin-bottom: 6px;
  color: var(--text);
}
.student-card-info {
  font-size: 20px;
  font-weight: 600;
  display: flex;
  gap: 20px;
  color: var(--text);
  margin-bottom: 8px;
}
.student-card-extra {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  font-size: 16px;
  color: var(--text-secondary);
}

/* ==============================
   戴镜情况选择
   ============================== */
.glasses-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.glasses-btn {
  padding: 20px 16px;
  font-size: 20px;
  font-weight: 700;
  border: 3px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
  touch-action: manipulation;
}
.glasses-btn:active { transform: scale(0.96); }
.glasses-btn.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

/* ==============================
   视力输入表格
   ============================== */
.vision-table {
  width: 100%;
}
.vt-header, .vt-row {
  display: grid;
  grid-template-columns: 70px 1fr 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px 4px;
}
.vt-header {
  border-bottom: 2px solid var(--border-light);
  margin-bottom: 4px;
}
.vt-row { border-bottom: 1px solid var(--border-light); }
.vt-row:last-child { border-bottom: none; }

.vt-cell { text-align: center; }
.vt-label {
  font-size: 15px;
  color: var(--text-hint);
  font-weight: 600;
}
.vt-eye {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  text-align: left;
}
.vt-input-wrap {
  display: flex;
  justify-content: center;
}
.vt-input {
  width: 100%;
  max-width: 130px;
  padding: 16px 10px;
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.2s;
  -moz-appearance: textfield;
}
.vt-input::-webkit-outer-spin-button,
.vt-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.vt-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22,119,255,0.12);
}
.vt-input::placeholder { color: #ccc; font-size: 20px; }

/* ==============================
   保存按钮
   ============================== */
.btn-save-main {
  width: 100%;
  background: var(--success);
  color: #fff;
  padding: 22px;
  font-size: 24px;
  font-weight: 800;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  touch-action: manipulation;
  letter-spacing: 1px;
}
.btn-save-main:active { background: var(--success-hover); }
.btn-save-main:disabled {
  background: #d9d9d9;
  color: #999;
  cursor: default;
}

/* 保存按钮区固定在页面底部，避免现场操作滚动（平滑录入） */
#vision-save-section,
#refract-save-section {
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin-bottom: 0;
  box-shadow: 0 -4px 14px rgba(0,0,0,0.1);
}

.btn-save-secondary {
  width: 100%;
  background: var(--card-bg);
  color: var(--text-secondary);
  padding: 18px;
  font-size: 20px;
  font-weight: 600;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  touch-action: manipulation;
}
.btn-save-secondary:active { background: #f5f5f5; }

/* ==============================
   验光仪品牌选择 + 连接
   ============================== */
.brand-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 16px;
}
.brand-btn {
  padding: 14px 20px;
  font-size: 17px;
  font-weight: 600;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.15s;
}
.brand-btn:active { transform: scale(0.95); }
.brand-btn.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.serial-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.btn-serial-connect {
  padding: 16px 32px;
  font-size: 18px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  touch-action: manipulation;
}
.btn-serial-connect:active { background: var(--primary-hover); }

.btn-serial-disconnect {
  padding: 16px 32px;
  font-size: 18px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--danger);
  color: #fff;
  cursor: pointer;
  touch-action: manipulation;
}
.btn-serial-disconnect:active { background: var(--danger-hover); }

/* ==============================
   屈光数据表格
   ============================== */
.refract-table {
  width: 100%;
}
.rt-header, .rt-row {
  display: grid;
  grid-template-columns: 80px 1fr 1fr 1fr;
  gap: 8px;
  align-items: center;
  padding: 10px 4px;
}
.rt-header {
  border-bottom: 2px solid var(--border-light);
  margin-bottom: 2px;
}
.rt-row { border-bottom: 1px solid var(--border-light); }
.rt-row:last-child, .rt-row-pd { border-bottom: none; }

.rt-cell { text-align: center; }
.rt-label {
  font-size: 15px;
  color: var(--text-hint);
  font-weight: 600;
}
.rt-eye {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  text-align: left;
}
.rt-val {
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.rt-val-pd {
  grid-column: span 3;
  text-align: left;
  padding-left: 24px;
}

/* ==============================
   手动输入屈光数据
   ============================== */
.manual-refract-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.mr-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.mr-label {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 140px;
  text-align: right;
}
.mr-input {
  flex: 1;
  padding: 14px 16px;
  font-size: 20px;
  font-weight: 600;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  text-align: center;
}
.mr-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22,119,255,0.12);
}
.mr-input::placeholder { color: #ccc; font-size: 16px; }

/* ==============================
   查询中提示
   ============================== */
.looking-up {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px;
}
.lu-spinner {
  width: 50px;
  height: 50px;
  border: 5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 20px;
}
.lu-text {
  font-size: 22px;
  color: var(--text-secondary);
  font-weight: 600;
}

/* ==============================
   设置页
   ============================== */
.settings-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.settings-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.settings-label {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.settings-input {
  padding: 16px 18px;
  font-size: 20px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
}
.settings-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22,119,255,0.12);
}
.settings-input[readonly] {
  background: #f5f5f5;
  color: var(--text-secondary);
}
.settings-hint {
  font-size: 14px;
  color: var(--text-hint);
}

/* ==============================
   验光仪选择弹窗
   ============================== */
.overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15,23,42,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
}

.overlay-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  max-width: 520px;
  width: 90%;
  /* 内容超高时允许卡片内部滚动，避免底部按钮在矮屏被截断 */
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.overlay-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 8px;
}

.overlay-desc {
  font-size: 16px;
  color: var(--text-hint);
  margin-bottom: 16px;
  line-height: 1.5;
}

/* 设备品牌型号列表 */
.ds-brand-list {
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 16px;
}

.ds-brand-group {
  margin-bottom: 12px;
}

.ds-brand-header {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-hint);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 6px 8px 4px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 4px;
}

.ds-device-row {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  margin: 4px 0;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
  touch-action: manipulation;
}
.ds-device-row:active { background: var(--border-light); }
.ds-device-row.active {
  border-color: var(--primary);
  background: rgba(22,119,255,0.06);
}

.ds-device-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: left;
}

.ds-device-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.ds-device-models {
  font-size: 13px;
  color: var(--text-hint);
  line-height: 1.4;
}

.overlay-btns {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.overlay-btn-primary {
  padding: 18px;
  font-size: 20px;
  font-weight: 700;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  touch-action: manipulation;
}
.overlay-btn-primary:active { background: var(--primary-hover); }

.overlay-btn-secondary {
  padding: 16px;
  font-size: 18px;
  font-weight: 600;
  background: #f1f5f9;
  color: var(--text-secondary);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  touch-action: manipulation;
}
.overlay-btn-secondary:active { background: var(--border); }

.overlay-btn-cancel {
  padding: 12px;
  font-size: 16px;
  background: none;
  border: none;
  color: var(--text-hint);
  cursor: pointer;
}
.overlay-btn-cancel:active { color: var(--text); }

/* ==============================
   Toast 提示
   ============================== */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--success);
  color: #fff;
  padding: 16px 32px;
  border-radius: var(--radius);
  font-size: 20px;
  font-weight: 700;
  z-index: 1000;
  box-shadow: 0 4px 16px rgba(82,196,26,0.35);
  animation: toastIn 0.3s ease;
}
.toast.hidden { display: none; }
@keyframes toastIn {
  from { transform: translateX(-50%) translateY(-20px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* ==============================
   错误覆盖层
   ============================== */
.error-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255,77,79,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}
.error-overlay.hidden { display: none; }

.error-box {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 44px;
  text-align: center;
  max-width: 440px;
  width: 90%;
  box-shadow: var(--shadow-lg);
}
.error-icon {
  font-size: 64px;
  margin-bottom: 16px;
}
.error-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--danger);
  margin-bottom: 10px;
}
.error-detail {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 28px;
  line-height: 1.5;
}
.btn-error-action {
  display: block;
  width: 100%;
  background: var(--primary);
  color: #fff;
  padding: 16px;
  font-size: 20px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-bottom: 12px;
  touch-action: manipulation;
}
.btn-error-action:active { background: var(--primary-hover); }
.btn-error-action:disabled { background: #d9d9d9; color: #999; }

.btn-error-dismiss {
  background: none;
  border: none;
  color: var(--text-hint);
  font-size: 18px;
  cursor: pointer;
  padding: 10px;
  width: 100%;
}
.btn-error-dismiss:active { color: var(--text-secondary); }

/* ==============================
   横向布局辅助
   ============================== */
.flex-row {
  display: flex;
  gap: 12px;
  align-items: center;
}
.flex-center {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ==============================
   第三轮 UX 改版新增样式
   ============================== */

/* C4：视力大按钮网格（3.0-5.3 共 24 档） */
.vision-field { margin-bottom: 20px; }
.vf-label {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.vf-label .vt-input { max-width: 110px; padding: 10px 8px; font-size: 20px; }
.vision-val-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
}
.vv-btn {
  min-height: 46px;
  font-size: 17px;
  font-weight: 700;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
  padding: 4px 0;
  touch-action: manipulation;
}
.vv-btn:active { transform: scale(0.94); }
.vv-btn.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

/* C4：屈光 SPH/CYL 步进按钮 */
.mr-stepper { display: flex; align-items: center; gap: 8px; flex: 1; }
.mr-step-btn {
  width: 52px;
  min-height: 52px;
  flex-shrink: 0;
  font-size: 26px;
  font-weight: 800;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--primary);
  cursor: pointer;
  touch-action: manipulation;
}
.mr-step-btn:active { background: var(--primary-light); }

/* C3：校验失败红框 */
.input-error {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 3px rgba(255,77,79,0.15) !important;
}

/* H6：监听状态颜色区分 + 数据到达闪绿 */
.tag-listening { background: #e6f4ff; color: var(--primary); }
@keyframes flashGreen {
  0% { background-color: #b7eb8f; }
  100% { background-color: transparent; }
}
.flash-green { animation: flashGreen 1s ease; }

/* C2/P1：待上传计数胶囊（橙色） */
.exam-topbar-count.pending { background: var(--warning); color: #fff; }

/* P4：Toast 分类型 */
.toast { background: #323232; box-shadow: var(--shadow-lg); }
.toast-success { background: var(--success); box-shadow: 0 4px 16px rgba(82,196,26,0.35); }
.toast-warning { background: var(--warning); box-shadow: 0 4px 16px rgba(250,173,20,0.35); }
.toast-error { background: var(--danger); box-shadow: 0 4px 16px rgba(255,77,79,0.35); }

/* C5/H5/H10：通用确认框 */
.confirm-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 998;
}
.confirm-overlay.hidden { display: none; }
.confirm-box {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 36px 40px;
  max-width: 480px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.confirm-message {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 28px;
  line-height: 1.6;
  white-space: pre-line;
}
.confirm-btns { display: flex; gap: 14px; }
.confirm-btn {
  flex: 1;
  padding: 16px;
  font-size: 20px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  touch-action: manipulation;
}
.confirm-btn-ok { background: var(--primary); color: #fff; }
.confirm-btn-ok:active { background: var(--primary-hover); }
.confirm-btn-cancel { background: #f1f5f9; color: var(--text-secondary); }
.confirm-btn-cancel:active { background: var(--border); }
