/* ============================================================
   安全常识问答 — 样式（Chrome 61 基线层）
   约束：无 flex gap / aspect-ratio / clamp / inset / 逻辑属性 / :has
   主题：扩展 · 安全蓝（醒目/安心）
   ============================================================ */

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

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
               "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: #f5f7fa;
  color: #1f2329;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-flex-direction: column;
  flex-direction: column;
  height: 100vh;
  height: calc(var(--app-height, 100vh));
}

/* ---------- 顶栏 ---------- */
.app-header {
  -webkit-box-flex: 0;
  -webkit-flex: 0 0 auto;
  flex: 0 0 auto;
  padding-top: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
  background: #ffffff;
  border-bottom: 1px solid #e5e6eb;
}

.header-brand {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  padding: 10px 16px;
}

.header-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  margin-right: 8px;
}

.header-name {
  font-size: 17px;
  font-weight: 600;
}

.header-streak {
  position: absolute;
  right: 12px;
  top: calc(10px + var(--safe-area-inset-top, env(safe-area-inset-top, 0px)));
  font-size: 12px;
  color: #2f6b8a;
}

/* ---------- 主区 ---------- */
.app-main {
  -webkit-box-flex: 1;
  -webkit-flex: 1 1 auto;
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}

.view {
  padding: 16px;
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
}

/* ---------- 首页 ---------- */
.home-wrap { text-align: center; }

.home-title {
  font-size: 26px;
  margin: 24px 0 6px;
  color: #2f6b8a;
}

.home-sub {
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 24px;
}

.level-card {
  display: block;
  width: 100%;
  background: #ffffff;
  border: 1px solid #e5e6eb;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
  text-align: left;
  cursor: pointer;
}

.level-card:active { background: #f2f4f7; }

.level-name {
  font-size: 17px;
  font-weight: 600;
  color: #1f2329;
}

.level-best {
  font-size: 13px;
  color: #86909c;
  margin-top: 4px;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-block;
  background: #ffffff;
  border: 1px solid #c9cdd4;
  border-radius: 24px;
  padding: 12px 28px;
  font-size: 15px;
  color: #1f2329;
  cursor: pointer;
  margin: 8px 6px;
}

.btn-primary {
  background: #2f6b8a;
  border-color: #2f6b8a;
  color: #ffffff;
}

.btn-checkin { background: #fff7e6; border-color: #ffd591; color: #d46b08; }

.btn-danger { color: #f5222d; border-color: #ffa39e; }

.hidden-entry {
  width: 0;
  height: 0;
  opacity: 0;
  border: none;
  padding: 0;
}

/* ---------- 答题页 ---------- */
.quiz-wrap {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-flex-direction: column;
  flex-direction: column;
}

.game-top {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: justify;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  margin-bottom: 14px;
}

.game-back {
  background: none;
  border: none;
  font-size: 15px;
  color: #4e5969;
  cursor: pointer;
  padding: 4px 8px;
}

.game-prog { font-size: 14px; font-weight: 600; }

.game-timer { font-size: 14px; color: #86909c; }

.question {
  font-size: 19px;
  font-weight: 600;
  line-height: 1.5;
  margin: 8px 0 20px;
  padding: 16px;
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid #e5e6eb;
  text-align: center;
}

.options { display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column; }

.option {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  background: #ffffff;
  border: 2px solid #e5e6eb;
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  text-align: left;
  font-size: 16px;
  color: #1f2329;
}

.option:active { background: #f2f4f7; }

.option-idx {
  -webkit-box-flex: 0;
  -webkit-flex: 0 0 auto;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #eef2f6;
  color: #4e5969;
  font-weight: 700;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  margin-right: 12px;
}

.option-txt { -webkit-box-flex: 1; -webkit-flex: 1 1 auto; flex: 1 1 auto; }

.option.correct {
  border-color: #52c41a;
  background: #f6ffed;
}

.option.correct .option-idx { background: #52c41a; color: #ffffff; }

.option.dim { opacity: 0.5; }

.answer-feedback {
  min-height: 48px;
  font-size: 14px;
  line-height: 1.5;
  padding: 12px;
  border-radius: 12px;
  margin-top: 6px;
}

.answer-feedback.ok { background: #f6ffed; color: #389e0d; }

.answer-feedback.miss { background: #fff1f0; color: #cf1322; }

/* ---------- 结算 ---------- */
.result-wrap { text-align: center; }

.result-title { font-size: 40px; margin: 30px 0 4px; }

.result-sub { font-size: 18px; font-weight: 600; margin-bottom: 16px; }

.result-row { font-size: 15px; color: #4e5969; margin: 4px 0; }

.result-best { font-size: 14px; color: #2f6b8a; margin-top: 6px; font-weight: 600; }

/* ---------- 家长面板 ---------- */
.parent-wrap { text-align: center; }

.parent-title { font-size: 20px; margin: 20px 0 12px; }

.parent-row { font-size: 14px; color: #4e5969; margin: 6px 0; }
.parent-row.small { font-size: 13px; color: #86909c; }

.parent-sub { font-size: 15px; margin: 16px 0 6px; color: #1f2329; }

/* ---------- 页脚 ---------- */
.app-footer {
  -webkit-box-flex: 0;
  -webkit-flex: 0 0 auto;
  flex: 0 0 auto;
  padding-bottom: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
}
