/* 安全教育平台 —— 工程安全正式配色（深蓝灰 + 安全橙） */
:root {
  --ink: #1a1f26;
  --ink-soft: #2d3640;
  --muted: #5a6570;
  --muted-2: #7a858f;
  --line: #d5dbe3;
  --line-soft: #e8ecf1;
  --card: #ffffff;
  --bg: #eef1f4;
  --bg-deep: #e5e9ee;
  --brand: #1e2f4d;
  --brand-mid: #2a4068;
  --brand-soft: #eef1f6;
  --accent: #c45c1a;
  --accent-deep: #a34a14;
  --ok: #2f6b45;
  --ok-soft: #e9f3ec;
  --bad: #b42318;
  --bad-soft: #f8eaea;
  --warn-soft: #fff4e8;
  --warn-ink: #8a4b12;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(26, 31, 38, 0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
               "Noto Sans CJK SC", sans-serif;
  background:
    radial-gradient(900px 420px at 8% -8%, rgba(30, 47, 77, 0.07), transparent 55%),
    radial-gradient(700px 380px at 100% 0%, rgba(196, 92, 26, 0.05), transparent 48%),
    linear-gradient(180deg, var(--bg) 0%, #f5f6f8 52%, var(--bg-deep) 100%);
  color: var(--ink);
  line-height: 1.6;
  padding: 14px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  min-height: 100vh;
  min-height: 100dvh;
  letter-spacing: 0.01em;
}
a { color: var(--brand-mid); text-decoration: none; }
.container { max-width: 680px; margin: 0 auto; width: 100%; }

/* 品牌区 */
.page-home { padding-top: 8px; padding-bottom: 28px; }
.home-wrap { max-width: 720px; }
.home-brand { margin: 6px 4px 22px; }
.home-eyebrow {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--brand-mid);
  font-weight: 700;
  margin-bottom: 10px;
  padding: 4px 10px;
  border: 1px solid rgba(42, 64, 104, 0.22);
  border-radius: 999px;
  background: rgba(255,255,255,0.65);
}
.home-title {
  font-family: "Songti SC", "STSong", "SimSun", serif;
  font-size: clamp(28px, 7vw, 38px);
  line-height: 1.22;
  color: var(--ink);
  font-weight: 700;
  margin-bottom: 10px;
}
.home-lead {
  color: var(--muted);
  font-size: 15px;
  max-width: 28em;
  line-height: 1.65;
}
.home-foot {
  margin: 20px 6px 0;
  font-size: 12px;
  color: var(--muted-2);
  text-align: center;
  line-height: 1.5;
}

/* 两大板块 */
.home-plates { display: grid; gap: 14px; }
.home-plate {
  display: block;
  text-decoration: none;
  color: inherit;
  border-radius: 18px;
  padding: 22px 20px 20px;
  border: 1px solid rgba(18, 26, 34, 0.08);
  background: rgba(255,255,255,0.92);
  box-shadow: var(--shadow);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease;
}
.home-plate:active { transform: scale(0.985); }
.home-plate .home-tile-kicker,
.home-kicker {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--brand-mid);
  margin-bottom: 10px;
}
.home-plate h2 {
  font-family: "Songti SC", "STSong", "SimSun", serif;
  font-size: 23px;
  color: var(--ink);
  margin: 0 0 10px;
  line-height: 1.3;
}
.home-plate > p {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 12px;
  line-height: 1.6;
}
.home-plate-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--brand);
  margin-top: 4px;
}
.home-plate-learn {
  background: linear-gradient(155deg, #ffffff 0%, #f1f3f7 100%);
  border-top: 3px solid var(--brand-mid);
}
.home-plate-intake {
  background: linear-gradient(155deg, #ffffff 0%, #faf6f2 100%);
  border-top: 3px solid var(--accent);
}
.home-plate-intake .home-kicker,
.home-plate-intake .home-tile-kicker { color: var(--accent-deep); }
.home-plate-list {
  margin: 0 0 14px 1.1em;
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.7;
}
.home-plate-list li { margin-bottom: 2px; }

/* 卡片与表单 */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px 18px;
  margin-bottom: 14px;
  border: 1px solid rgba(18, 26, 34, 0.06);
  box-shadow: var(--shadow);
}
.card h1 {
  font-family: "Songti SC", "STSong", "SimSun", serif;
  font-size: 24px;
  color: var(--ink);
  margin-bottom: 6px;
  line-height: 1.3;
}
.card h2 {
  font-size: 15px;
  color: var(--brand-mid);
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: 0.04em;
}
.subtitle {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 18px;
  line-height: 1.6;
}

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 7px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.form-group input {
  width: 100%;
  padding: 14px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 16px;
  background: #fbfcfd;
  color: var(--ink);
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-group input:focus {
  outline: none;
  border-color: var(--brand-mid);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(42, 64, 104, 0.14);
}
.form-hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted-2);
}

.btn-primary, .btn-link, .btn-disabled, .btn-test {
  display: inline-block;
  width: 100%;
  padding: 14px 18px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  min-height: 50px;
}
.btn-primary {
  background: linear-gradient(180deg, #334e78 0%, var(--brand) 100%);
  color: #fff;
  box-shadow: 0 8px 18px rgba(30, 47, 77, 0.22);
}
.btn-primary:active { opacity: 0.92; }
.btn-primary:disabled,
.btn-disabled {
  background: #cfd6dd;
  color: #8a95a1;
  box-shadow: none;
  cursor: not-allowed;
}
.btn-link {
  background: var(--line-soft);
  color: var(--brand);
  margin-top: 10px;
}
.btn-large { padding: 16px 20px; font-size: 17px; }
.btn-test {
  background: #fff8ef;
  color: #8a4b16;
  border: 1px dashed #d4a574;
  margin-top: 10px;
}

.alert {
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 14px;
  font-size: 14px;
  line-height: 1.65;
}
.alert-error { background: var(--bad-soft); color: var(--bad); border: 1px solid #ecd2d2; }
.alert-warn { background: var(--warn-soft); color: var(--warn-ink); border: 1px solid #eadcc3; }
.alert-success { background: var(--ok-soft); color: var(--ok); border: 1px solid #cfe5d9; }

.tips {
  margin-top: 18px;
  padding: 14px;
  background: #f3f5f8;
  border-radius: 12px;
  font-size: 12.5px;
  color: var(--muted);
  border: 1px solid var(--line-soft);
}
.tips p { margin-bottom: 4px; }
.tips p:first-child { color: var(--ink-soft); font-weight: 700; }

.step-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}
.step-bar span {
  flex: 1;
  height: 4px;
  border-radius: 99px;
  background: var(--line-soft);
}
.step-bar span.on { background: var(--brand-mid); }

.profile-strip {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border-radius: 14px;
  background: var(--brand-soft);
  border: 1px solid rgba(42, 64, 104, 0.12);
  margin: 12px 0 16px;
}
.profile-photos {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.profile-photos figure {
  margin: 0;
  text-align: center;
}
.profile-photos img {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  display: block;
}
.profile-photos figcaption {
  font-size: 10px;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.2;
}
.profile-strip img {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  flex-shrink: 0;
}
.profile-meta { min-width: 0; }
.profile-meta strong {
  display: block;
  font-size: 17px;
  color: var(--ink);
  margin-bottom: 4px;
}
.profile-meta p {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.45;
  word-break: break-all;
}

.welcome { margin-bottom: 8px; }
.welcome h1 {
  font-family: "Songti SC", "STSong", "SimSun", serif;
  font-size: 24px;
  color: var(--ink);
}
.welcome p { color: var(--muted); font-size: 14px; margin-top: 6px; }
.dash-ok { color: var(--ok); font-weight: 700; margin-top: 10px; }
.dash-photo { display: none; }

.exam-list { margin: 8px 0 4px; }
.exam-item {
  display: flex;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 10px;
  align-items: center;
  background: #fff;
}
.exam-item.passed {
  border-color: rgba(31, 107, 69, 0.35);
  background: var(--ok-soft);
}
.exam-item.locked-item {
  opacity: 0.78;
  background: #f7f9fb;
}
.exam-info { flex: 1; min-width: 0; }
.exam-info h3 {
  font-size: 15.5px;
  color: var(--ink);
  margin-bottom: 4px;
  line-height: 1.4;
}
.exam-info p { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.exam-result { margin-top: 8px; font-size: 13px; }
.exam-action { flex-shrink: 0; }
.exam-action .btn-primary,
.exam-action .btn-disabled,
.exam-action .btn-link {
  width: auto;
  min-width: 92px;
  padding: 10px 12px;
  font-size: 13.5px;
  min-height: 42px;
  margin-top: 0;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  margin-left: 4px;
  font-weight: 700;
  vertical-align: middle;
}
.tag-pass { background: var(--ok); color: #fff; }
.tag-fail { background: #8a95a1; color: #fff; }
.tag-wait { background: #e7edf2; color: #526171; }

.notice {
  margin-top: 14px;
  padding: 14px 16px;
  background: var(--brand-soft);
  border-radius: 12px;
  font-size: 13px;
  border: 1px solid rgba(42, 64, 104, 0.12);
}
.notice h3 {
  color: var(--brand);
  font-size: 13px;
  margin-bottom: 8px;
  letter-spacing: 0.04em;
}
.notice ol { margin-left: 1.15em; color: var(--ink-soft); }
.notice li { margin-bottom: 4px; line-height: 1.55; }
.actions { margin-top: 14px; text-align: center; }

.learn-placeholder {
  margin: 12px 0 8px;
  padding: 16px;
  border: 1px dashed rgba(42, 64, 104, 0.28);
  border-radius: 12px;
  background: rgba(238, 241, 246, 0.65);
}
.learn-placeholder h3 { font-size: 15px; margin-bottom: 8px; color: var(--ink); }
.learn-placeholder ul { margin: 0 0 10px 18px; color: var(--muted); font-size: 14px; line-height: 1.65; }
.learn-note { font-size: 13px; color: var(--brand-mid); }

.confirm-box {
  margin-top: 16px;
  padding: 14px;
  background: #f4f6f8;
  border-radius: 12px;
  border: 1px solid var(--line);
}
.confirm-check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 14px;
  margin-bottom: 10px;
  line-height: 1.5;
  color: var(--ink-soft);
}
.confirm-check input {
  margin-top: 3px;
  transform: scale(1.15);
  flex-shrink: 0;
}
.locked-item { opacity: 0.78; }
.reading-body { min-height: 120px; }

/* 拍照 */
.page-photo { padding-bottom: 0; }
.photo-card { padding-bottom: 120px; }
.photo-stage {
  width: 100%;
  max-width: 420px;
  margin: 0 auto 12px;
  aspect-ratio: 3 / 4;
  max-height: min(62vh, 520px);
  background: #111827;
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  border: 1px solid #111;
}
.photo-stage video.cam-live,
.photo-stage .photo-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #111827;
}
.photo-stage video.cam-live { z-index: 1; transform: scaleX(-1); }
.photo-stage .photo-preview {
  z-index: 2; transform: none; opacity: 0; pointer-events: none;
}
.photo-stage .photo-preview.is-show { opacity: 1; }
.photo-stage video.cam-live.is-hide { opacity: 0; }
.photo-stage canvas {
  position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none;
}
.photo-guide {
  pointer-events: none;
  position: absolute; inset: 10% 14%;
  border: 2px dashed rgba(255,255,255,0.45);
  border-radius: 50% / 42%;
  z-index: 3;
}
.photo-guide-id {
  inset: 22% 6%;
  border-radius: 10px;
  border-style: solid;
  border-color: rgba(255,255,255,0.55);
}
.photo-guide.is-hide { display: none; }
.page-photo-id .cam-live {
  object-fit: cover;
}
.photo-tip {
  font-size: 13px; color: var(--muted); text-align: center;
  margin: 0 4px 14px; min-height: 2.6em; line-height: 1.5;
}
.photo-dock {
  position: fixed; left: 0; right: 0; bottom: 0;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  background: rgba(255,255,255,0.96);
  border-top: 1px solid var(--line);
  box-shadow: 0 -6px 20px rgba(0,0,0,0.06);
  z-index: 40;
}
.photo-dock .btn-primary,
.photo-dock .btn-link { margin-top: 0; min-height: 48px; font-size: 16px; }
.photo-dock-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px;
}
.photo-dock-row.single { grid-template-columns: 1fr; }
.photo-fallback-hint {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 15px; font-weight: 600; z-index: 2; padding: 20px;
  text-align: center; background: rgba(17,24,39,.72);
}

/* 答题页 */
.quiz-container { padding: 0; }
.quiz-header {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 12px 14px; background: var(--brand); color: #fff;
  border-radius: 12px 12px 0 0;
  position: sticky; top: 0; z-index: 20;
}
.quiz-header h2 { font-size: 15px; color: #fff; margin: 0; }
.quiz-header p { font-size: 12px; margin: 2px 0 0; opacity: 0.9; }
.timer { font-size: 16px; font-weight: bold; white-space: nowrap; }
.timer.warning { color: #ffd700; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.5; } }

.progress-bar {
  position: relative; height: 28px; background: #e0e0e0; margin-bottom: 12px;
}
.progress-fill {
  position: absolute; left: 0; top: 0; height: 100%;
  background: var(--ok); width: 0;
}
.progress-text {
  position: relative; z-index: 2; line-height: 28px;
  text-align: center; color: #333; font-size: 12px; font-weight: 600;
}

.question {
  background: #fff; border-radius: 12px; padding: 14px;
  margin-bottom: 10px; border: 1px solid var(--line-soft);
}
.q-title { font-size: 15px; font-weight: 600; color: #333; margin-bottom: 10px; line-height: 1.55; }
.q-num {
  display: inline-block; width: 24px; height: 24px;
  background: var(--brand); color: #fff; border-radius: 50%;
  text-align: center; line-height: 24px; font-size: 12px; margin-right: 6px;
}
.q-type {
  display: inline-block; padding: 1px 6px; font-size: 11px;
  background: var(--brand-soft); color: var(--brand); border-radius: 4px; margin-right: 6px;
}
.q-options { display: flex; flex-direction: column; gap: 8px; }
.q-option {
  display: flex; align-items: flex-start; padding: 12px;
  border: 1px solid var(--line); border-radius: 10px;
  cursor: pointer; min-height: 48px;
}
.q-option:has(input:checked) {
  border-color: var(--brand-mid); background: #f3f5f9;
}
.q-option input[type=radio] {
  margin-right: 10px; margin-top: 4px; transform: scale(1.15); flex-shrink: 0;
}
.opt-letter {
  display: inline-block; width: 26px; height: 26px; flex-shrink: 0;
  border-radius: 50%; background: #f0f2f5; color: #555;
  text-align: center; line-height: 26px; font-size: 13px;
  font-weight: bold; margin-right: 10px;
}
.q-option input[type=radio]:checked + .opt-letter {
  background: var(--brand); color: #fff;
}
.opt-text { flex: 1; font-size: 15px; padding-top: 2px; line-height: 1.45; }

.submit-area {
  margin-top: 12px; text-align: center;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
}
.submit-tip { color: var(--bad); font-size: 13px; margin-bottom: 10px; }

.result-card { text-align: center; padding: 28px 16px; }
.result-icon { font-size: 48px; margin-bottom: 8px; }
.result-card h1 { font-size: 44px; margin-bottom: 4px; }
.result-pass h1 { color: var(--ok); }
.result-fail h1 { color: var(--bad); }
.result-status { font-size: 16px; color: #555; margin-bottom: 14px; }
.result-stats {
  display: flex; justify-content: space-around; flex-wrap: wrap; gap: 8px;
  padding: 12px 0; margin-bottom: 14px;
  border-top: 1px solid #eee; border-bottom: 1px solid #eee;
}
.result-stats div { font-size: 13px; color: #666; }
.answer-review-title { border-bottom: 2px solid var(--brand); padding-bottom: 6px; margin-bottom: 10px; }
.answer-item {
  padding: 12px; border-left: 4px solid; margin-bottom: 10px; border-radius: 4px;
}
.answer-item.correct { border-color: var(--ok); background: var(--ok-soft); }
.answer-item.wrong { border-color: var(--bad); background: var(--bad-soft); }
.answer-q { font-size: 14px; margin-bottom: 6px; line-height: 1.5; }
.answer-num {
  display: inline-block; width: 22px; height: 22px;
  background: var(--brand); color: #fff; border-radius: 50%;
  text-align: center; line-height: 22px; font-size: 11px; margin-right: 6px;
}
.answer-status { font-weight: bold; margin-right: 6px; }
.answer-detail { font-size: 12px; color: #666; padding-left: 28px; }
.user-ans { color: var(--bad); font-weight: 600; }
.right-ans { color: var(--ok); font-weight: 600; }
.explain { color: var(--brand-mid); font-style: italic; padding: 4px 0; }
code { background: #f0f2f5; padding: 2px 6px; border-radius: 4px; font-size: 12px; }

@media (max-width: 420px) {
  .exam-item { flex-wrap: wrap; }
  .exam-action { width: 100%; }
  .exam-action .btn-primary,
  .exam-action .btn-disabled,
  .exam-action .btn-link { width: 100%; }
}
