/* ============================================================
   广告性别刻板印象调研问卷 —— 移动优先样式表
   适用页面：index.html（模块一：筛选与知情同意）
   ============================================================ */

/* ------------------------------------------------------------
   1. 设计变量
   ------------------------------------------------------------ */
:root {
  /* 主色 */
  --brand:          #4f46e5;
  --brand-light:    #6366f1;
  --brand-soft:     #eef2ff;   /* 选中态背景 */

  /* 中性色 */
  --bg:             #f4f5fa;
  --card:           #ffffff;
  --text:           #1f2330;
  --text-sub:       #6b7280;
  --border:         #e4e7f0;
  --border-strong:  #cdd2e4;

  /* 提示色 */
  --danger:         #c0392b;
  --danger-bg:      #fef2f2;
  --danger-border:  #fbd5d5;

  /* 圆角 */
  --radius-card:    16px;
  --radius-item:    12px;

  /* 阴影 */
  --shadow-card:    0 4px 20px rgba(23, 27, 51, .06);
  --shadow-btn:     0 6px 16px rgba(79, 70, 229, .28);

  /* 布局 */
  --max-width:      560px;
  --gutter:         16px;
}


/* ------------------------------------------------------------
   2. 基础重置
   ------------------------------------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gutter) calc(40px + env(safe-area-inset-bottom));
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue",
               Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}


/* ------------------------------------------------------------
   3. 标题区
   ------------------------------------------------------------ */
h1 {
  margin: 28px 0 10px;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: .3px;
  text-align: center;
}

/* 预计完成时间：小胶囊 */
h1 + p {
  width: fit-content;
  margin: 0 auto 20px;
  padding: 4px 14px;
  border-radius: 999px;
  background: var(--card);
  box-shadow: var(--shadow-card);
  color: var(--text-sub);
  font-size: .8125rem;
  line-height: 1.6;
}

/* 模块标题 */
h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  padding-left: 2px;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
}

h2::before {
  content: "";
  flex: 0 0 auto;
  width: 4px;
  height: 18px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--brand-light), var(--brand));
}


/* ------------------------------------------------------------
   4. 表单卡片
   ------------------------------------------------------------ */
form {
  padding: 22px var(--gutter);
  border-radius: var(--radius-card);
  background: var(--card);
  box-shadow: var(--shadow-card);
  animation: card-in .35s ease-out both;
}

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

/* 题干 */
#screenForm > p {
  margin: 26px 0 12px;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.5;
}

#screenForm > p:first-of-type {
  margin-top: 0;
}

/* 隐藏源码里用于撑高度的 <br><br>，改用 margin 控制间距 */
#screenForm br {
  display: none;
}


/* ------------------------------------------------------------
   5. 选项（label）—— 整块可点，拇指友好
   ------------------------------------------------------------ */
label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  margin-bottom: 8px;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-item);
  background: var(--card);
  color: var(--text);
  font-size: .9375rem;
  line-height: 1.45;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .18s ease,
              background-color .18s ease,
              box-shadow .18s ease;
}

/* 复选框那一行：文字较长，顶对齐 */
label:has(input[type="checkbox"]) {
  align-items: flex-start;
  line-height: 1.55;
}

/* 按下反馈（移动端） */
label:active {
  background: #f7f8fc;
}

/* 选中态 */
label:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .10);
}

/* 键盘聚焦 */
label:has(input:focus-visible) {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}


/* ------------------------------------------------------------
   6. 单选 / 复选框
   ------------------------------------------------------------ */
input[type="radio"],
input[type="checkbox"] {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--brand);   /* 一行搞定原生控件配色 */
  cursor: pointer;
}

/* 复选框与多行文字的首行对齐 */
input[type="checkbox"] {
  margin-top: 2px;
}


/* ------------------------------------------------------------
   7. 提交按钮
   ------------------------------------------------------------ */
#screenForm button[type="submit"] {
  display: block;
  width: 100%;
  min-height: 52px;
  margin-top: 26px;
  padding: 14px 20px;
  border: 0;
  border-radius: var(--radius-item);
  background: linear-gradient(135deg, var(--brand-light), var(--brand));
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: .5px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow: var(--shadow-btn);
  transition: transform .12s ease,
              box-shadow .18s ease,
              filter .18s ease;
}

#screenForm button[type="submit"]:active {
  transform: translateY(1px);
  box-shadow: 0 3px 10px rgba(79, 70, 229, .24);
}

#screenForm button[type="submit"]:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}


/* ------------------------------------------------------------
   8. 提示信息区（替代 alert）
   ------------------------------------------------------------ */
#message {
  margin: 16px 0 0;
  font-size: .9375rem;
  line-height: 1.6;
}

/* 没有内容时完全占位消失 */
#message:empty {
  display: none;
}

#message:not(:empty) {
  padding: 14px 16px;
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-item);
  background: var(--danger-bg);
  color: var(--danger);
  animation: msg-in .22s ease-out;
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}


/* ------------------------------------------------------------
   9. 响应式微调
   ------------------------------------------------------------ */

/* 稍大屏手机 / 平板 */
@media (min-width: 480px) {
  :root { --gutter: 24px; }

  h1 {
    margin-top: 36px;
    font-size: 1.375rem;
  }

  form {
    padding: 28px 24px;
  }
}

/* 小屏手机（iPhone SE 等 320–360px） */
@media (max-width: 360px) {
  :root { --gutter: 12px; }

  h1 { font-size: 1.125rem; }

  form { padding: 18px 14px; }

  label {
    padding: 10px 12px;
    font-size: .9rem;
  }
}

/* 有鼠标悬停的设备才加 hover 效果，避免移动端“粘住” */
@media (hover: hover) and (pointer: fine) {
  label:hover {
    border-color: var(--border-strong);
  }

  label:has(input:checked):hover {
    border-color: var(--brand);
  }

  #screenForm button[type="submit"]:hover {
    filter: brightness(1.06);
  }
}

/* 尊重系统「减弱动态效果」设置 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}