/* ==========================================================================
   默契挑战 · 设计系统
   移动端优先：微信内置浏览器 375px 宽度为第一优先适配目标
   ========================================================================== */

:root {
  /* 主色：珊瑚红 + 暖橙，传达亲密与游戏感 */
  --色-主: #ff4d5e;
  --色-主深: #e6364a;
  --色-主浅: #ffe8ea;
  --色-暖: #ff9a3c;
  --色-暖浅: #fff2e2;
  --色-点缀: #7c5cff;
  --色-点缀浅: #f0ecff;
  --色-成功: #12b76a;
  --色-成功浅: #e6f8ef;
  --色-警示: #f04438;
  --色-警示浅: #fdecea;

  /* 中性色 */
  --色-底: #fff9f5;
  --色-卡: #ffffff;
  --色-文字: #2b2118;
  --色-次要文字: #7a6a5d;
  --色-弱文字: #a89a8d;
  --色-边: #f0e4da;
  --色-边深: #e4d4c6;

  /* 圆角与阴影 */
  --圆角-小: 10px;
  --圆角: 16px;
  --圆角-大: 22px;
  --圆角-胶囊: 999px;
  --阴影-小: 0 1px 2px rgba(80, 50, 30, 0.06);
  --阴影: 0 6px 18px rgba(120, 70, 40, 0.09);
  --阴影-大: 0 14px 40px rgba(120, 70, 40, 0.16);

  /* 间距 */
  --间距-1: 4px;
  --间距-2: 8px;
  --间距-3: 12px;
  --间距-4: 16px;
  --间距-5: 24px;
  --间距-6: 32px;

  /* 字号 */
  --字号-小: 13px;
  --字号: 15px;
  --字号-大: 17px;
  --字号-标题: 21px;
  --字号-巨大: 34px;

  --过渡: 180ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

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

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: var(--色-底);
  color: var(--色-文字);
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei',
    'Helvetica Neue', Arial, sans-serif;
  font-size: var(--字号);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 顶部装饰性渐变光晕 */
body::before {
  content: '';
  position: fixed;
  inset: 0 0 auto 0;
  height: 220px;
  background: linear-gradient(160deg, var(--色-主浅) 0%, rgba(255, 249, 245, 0) 78%);
  pointer-events: none;
  z-index: 0;
}

/* ---------- 布局 ---------- */
.容器 {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  padding: var(--间距-4) var(--间距-4) var(--间距-6);
}

.页面头 {
  display: flex;
  align-items: center;
  gap: var(--间距-3);
  padding: var(--间距-3) 0 var(--间距-4);
}

.页面头 .返回 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--圆角-胶囊);
  background: var(--色-卡);
  border: 1px solid var(--色-边);
  color: var(--色-次要文字);
  font-size: var(--字号-大);
  text-decoration: none;
  box-shadow: var(--阴影-小);
  flex-shrink: 0;
}

.页面头 .标题 {
  font-size: var(--字号-标题);
  font-weight: 700;
  margin: 0;
  letter-spacing: 0.2px;
}

.页面头 .副标题 {
  margin: 0;
  color: var(--色-次要文字);
  font-size: var(--字号-小);
}

/* ---------- 卡片 ---------- */
.卡 {
  background: var(--色-卡);
  border: 1px solid var(--色-边);
  border-radius: var(--圆角-大);
  padding: var(--间距-4);
  box-shadow: var(--阴影);
  margin-bottom: var(--间距-4);
}

.卡.紧凑 {
  padding: var(--间距-3);
  border-radius: var(--圆角);
}

.卡.无边框 {
  border-color: transparent;
  box-shadow: var(--阴影-小);
}

/* ---------- 按钮 ---------- */
.按钮 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--间距-2);
  width: 100%;
  min-height: 50px;
  padding: 0 var(--间距-4);
  border: none;
  border-radius: var(--圆角-胶囊);
  background: linear-gradient(135deg, var(--色-主) 0%, var(--色-暖) 100%);
  color: #fff;
  font-size: var(--字号-大);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(255, 77, 94, 0.28);
  transition: transform var(--过渡), box-shadow var(--过渡), opacity var(--过渡);
}

.按钮:active:not(:disabled) {
  transform: scale(0.975);
  box-shadow: 0 4px 12px rgba(255, 77, 94, 0.24);
}

.按钮:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.按钮.次要 {
  background: var(--色-卡);
  color: var(--色-主深);
  border: 1.5px solid var(--色-主);
  box-shadow: none;
}

.按钮.幽灵 {
  background: var(--色-主浅);
  color: var(--色-主深);
  box-shadow: none;
}

.按钮.危险 {
  background: var(--色-警示浅);
  color: var(--色-警示);
  box-shadow: none;
}

.按钮.小 {
  min-height: 38px;
  font-size: var(--字号);
  width: auto;
  padding: 0 var(--间距-4);
}

.按钮组 {
  display: flex;
  gap: var(--间距-3);
  align-items: center;
}

.按钮组 .按钮 {
  width: auto;
  flex: 1;
}

/* ---------- 表单 ---------- */
.标签 {
  display: block;
  font-size: var(--字号-小);
  font-weight: 600;
  color: var(--色-次要文字);
  margin-bottom: var(--间距-2);
}

.输入,
.文本域 {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--色-边深);
  border-radius: var(--圆角);
  background: var(--色-卡);
  color: var(--色-文字);
  font-size: var(--字号);
  font-family: inherit;
  line-height: 1.6;
  transition: border-color var(--过渡), box-shadow var(--过渡);
}

.输入:focus,
.文本域:focus {
  outline: none;
  border-color: var(--色-主);
  box-shadow: 0 0 0 3px var(--色-主浅);
}

.文本域 {
  resize: vertical;
  min-height: 68px;
}

.字段 {
  margin-bottom: var(--间距-3);
}

.字数 {
  display: block;
  text-align: right;
  font-size: 12px;
  color: var(--色-弱文字);
  margin-top: 2px;
}

.字数.超出 {
  color: var(--色-警示);
}

/* ---------- 首页英雄区 ---------- */
.英雄 {
  text-align: center;
  padding: var(--间距-6) var(--间距-4) var(--间距-5);
}

.英雄 .标志 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
  border-radius: 26px;
  background: linear-gradient(135deg, var(--色-主) 0%, var(--色-暖) 100%);
  color: #fff;
  font-size: 38px;
  margin-bottom: var(--间距-3);
  box-shadow: 0 12px 28px rgba(255, 77, 94, 0.32);
  animation: 浮动 3.2s ease-in-out infinite;
}

@keyframes 浮动 {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

.英雄 h1 {
  margin: 0 0 var(--间距-2);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.英雄 p {
  margin: 0;
  color: var(--色-次要文字);
  font-size: var(--字号);
}

/* ---------- 步骤条 ---------- */
.步骤 {
  display: flex;
  gap: var(--间距-3);
  margin: var(--间距-5) 0;
}

.步骤 .项 {
  flex: 1;
  text-align: center;
}

.步骤 .序号 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--圆角-胶囊);
  background: var(--色-主浅);
  color: var(--色-主深);
  font-weight: 700;
  margin-bottom: var(--间距-2);
}

.步骤 .文字 {
  font-size: 12px;
  color: var(--色-次要文字);
  line-height: 1.4;
}

/* ---------- 题目编辑 ---------- */
.题目块 {
  border: 1px solid var(--色-边);
  border-radius: var(--圆角);
  padding: var(--间距-3);
  margin-bottom: var(--间距-3);
  background: var(--色-卡);
  transition: box-shadow var(--过渡);
}

.题目块:focus-within {
  box-shadow: 0 0 0 3px var(--色-主浅);
}

.题目块 .头 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--间距-2);
}

.题目块 .编号 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 8px;
  border-radius: var(--圆角-胶囊);
  background: var(--色-主);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.选项行 {
  display: flex;
  align-items: center;
  gap: var(--间距-2);
  margin-bottom: var(--间距-2);
}

.选项行 .正确标记 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--圆角-胶囊);
  border: 1.5px solid var(--色-边深);
  background: var(--色-卡);
  color: var(--色-弱文字);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--过渡);
}

.选项行 .正确标记.选中 {
  background: var(--色-成功);
  border-color: var(--色-成功);
  color: #fff;
}

.选项行 .输入 {
  flex: 1;
}

.图标按钮 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: var(--圆角-小);
  background: transparent;
  color: var(--色-弱文字);
  font-size: 17px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--过渡), color var(--过渡);
}

.图标按钮:active {
  background: var(--色-主浅);
  color: var(--色-主深);
}

.图标按钮:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ---------- 答题选项 ---------- */
.题面 {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.5;
  margin: 0 0 var(--间距-4);
}

.选项列表 {
  display: flex;
  flex-direction: column;
  gap: var(--间距-3);
}

.选项 {
  display: flex;
  align-items: center;
  gap: var(--间距-3);
  width: 100%;
  padding: 15px 16px;
  border: 1.5px solid var(--色-边深);
  border-radius: var(--圆角);
  background: var(--色-卡);
  color: var(--色-文字);
  font-size: var(--字号-大);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: all var(--过渡);
}

.选项:active {
  transform: scale(0.985);
}

.选项 .序号 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--圆角-胶囊);
  background: var(--色-暖浅);
  color: #b46a12;
  font-weight: 700;
  font-size: var(--字号-小);
  flex-shrink: 0;
}

.选项.选中 {
  border-color: var(--色-主);
  background: var(--色-主浅);
  box-shadow: 0 0 0 3px rgba(255, 77, 94, 0.12);
}

.选项.选中 .序号 {
  background: var(--色-主);
  color: #fff;
}

.选项.正确 {
  border-color: var(--色-成功);
  background: var(--色-成功浅);
}

.选项.正确 .序号 {
  background: var(--色-成功);
  color: #fff;
}

.选项.错误 {
  border-color: var(--色-警示);
  background: var(--色-警示浅);
}

.选项.错误 .序号 {
  background: var(--色-警示);
  color: #fff;
}

.选项:disabled {
  cursor: default;
}

/* ---------- 进度条 ---------- */
.进度 {
  display: flex;
  align-items: center;
  gap: var(--间距-3);
  margin-bottom: var(--间距-4);
}

.进度 .轨道 {
  flex: 1;
  height: 8px;
  border-radius: var(--圆角-胶囊);
  background: var(--色-边);
  overflow: hidden;
}

.进度 .填充 {
  height: 100%;
  border-radius: var(--圆角-胶囊);
  background: linear-gradient(90deg, var(--色-主) 0%, var(--色-暖) 100%);
  transition: width 300ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.进度 .计数 {
  font-size: var(--字号-小);
  font-weight: 700;
  color: var(--色-次要文字);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* ---------- 成绩 ---------- */
.成绩环 {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--间距-4) 0;
}

.成绩环 .分数 {
  font-size: 56px;
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(135deg, var(--色-主) 0%, var(--色-暖) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-variant-numeric: tabular-nums;
}

.成绩环 .满分 {
  font-size: var(--字号-大);
  color: var(--色-弱文字);
  margin-top: var(--间距-2);
}

.评级 {
  display: inline-block;
  margin-top: var(--间距-3);
  padding: 6px 18px;
  border-radius: var(--圆角-胶囊);
  background: var(--色-主浅);
  color: var(--色-主深);
  font-weight: 700;
  font-size: var(--字号-大);
}

/* ---------- 对照列表 ---------- */
.对照项 {
  display: flex;
  gap: var(--间距-3);
  padding: var(--间距-3) 0;
  border-bottom: 1px solid var(--色-边);
}

.对照项:last-child {
  border-bottom: none;
}

.对照项 .标记 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--圆角-胶囊);
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}

.对照项 .标记.对 {
  background: var(--色-成功浅);
  color: var(--色-成功);
}

.对照项 .标记.错 {
  background: var(--色-警示浅);
  color: var(--色-警示);
}

.对照项 .内容 {
  flex: 1;
  min-width: 0;
}

.对照项 .题干 {
  font-weight: 600;
  margin: 0 0 var(--间距-1);
  word-break: break-word;
}

.对照项 .明细 {
  font-size: var(--字号-小);
  color: var(--色-次要文字);
  margin: 0;
  word-break: break-word;
}

.对照项 .明细 b {
  color: var(--色-文字);
  font-weight: 600;
}

.对照项 .明细 .错答 {
  color: var(--色-警示);
}

/* ---------- 排行榜 ---------- */
.排行项 {
  display: flex;
  align-items: center;
  gap: var(--间距-3);
  padding: var(--间距-3) 0;
  border-bottom: 1px solid var(--色-边);
}

.排行项:last-child {
  border-bottom: none;
}

.排行项 .名次 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  border-radius: var(--圆角-胶囊);
  background: var(--色-边);
  color: var(--色-次要文字);
  font-weight: 700;
  font-size: var(--字号-小);
  flex-shrink: 0;
}

.排行项 .名次.前三 {
  background: linear-gradient(135deg, var(--色-主) 0%, var(--色-暖) 100%);
  color: #fff;
}

.排行项 .昵称 {
  flex: 1;
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.排行项 .得分 {
  font-weight: 800;
  color: var(--色-主深);
  font-variant-numeric: tabular-nums;
}

/* ---------- 统计数字 ---------- */
.统计格 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: var(--间距-3);
}

.统计格 .格 {
  text-align: center;
  padding: var(--间距-3) var(--间距-2);
  border-radius: var(--圆角);
  background: var(--色-底);
}

.统计格 .数值 {
  font-size: 24px;
  font-weight: 800;
  color: var(--色-主深);
  font-variant-numeric: tabular-nums;
}

.统计格 .名称 {
  font-size: 12px;
  color: var(--色-次要文字);
}

/* 逐题正确率条 */
.正确率行 {
  margin-bottom: var(--间距-3);
}

.正确率行 .顶 {
  display: flex;
  justify-content: space-between;
  gap: var(--间距-2);
  font-size: var(--字号-小);
  margin-bottom: var(--间距-1);
}

.正确率行 .题干 {
  color: var(--色-文字);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.正确率行 .百分比 {
  color: var(--色-次要文字);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.正确率行 .轨道 {
  height: 8px;
  border-radius: var(--圆角-胶囊);
  background: var(--色-边);
  overflow: hidden;
}

.正确率行 .填充 {
  height: 100%;
  border-radius: var(--圆角-胶囊);
  background: linear-gradient(90deg, var(--色-成功) 0%, #6ee7b7 100%);
}

/* ---------- 二维码与分享 ---------- */
.二维码框 {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--间距-3);
  padding: var(--间距-4);
  border-radius: var(--圆角);
  background: var(--色-卡);
  border: 1px dashed var(--色-边深);
}

.二维码框 canvas {
  display: block;
  width: 220px;
  height: 220px;
  max-width: 100%;
  border-radius: var(--圆角-小);
  background: #fff;
}

.链接框 {
  display: flex;
  align-items: center;
  gap: var(--间距-2);
  padding: 10px 12px;
  border-radius: var(--圆角);
  background: var(--色-底);
  border: 1px solid var(--色-边);
  font-size: var(--字号-小);
  color: var(--色-次要文字);
  word-break: break-all;
}

.链接框 .文本 {
  flex: 1;
  min-width: 0;
}

.提示条 {
  display: flex;
  gap: var(--间距-2);
  padding: var(--间距-3);
  border-radius: var(--圆角);
  background: var(--色-暖浅);
  color: #8a5210;
  font-size: var(--字号-小);
  line-height: 1.6;
}

.提示条.信息 {
  background: var(--色-点缀浅);
  color: #4b3bb0;
}

.提示条.成功 {
  background: var(--色-成功浅);
  color: #0a7a48;
}

.提示条.错误 {
  background: var(--色-警示浅);
  color: #b42318;
}

/* ---------- 页脚 ---------- */
.页脚 {
  text-align: center;
  padding: var(--间距-5) var(--间距-4) var(--间距-4);
  color: var(--色-弱文字);
  font-size: 12px;
  line-height: 1.8;
}

.页脚 a {
  color: var(--色-次要文字);
  text-decoration: none;
  border-bottom: 1px solid var(--色-边深);
}

.页脚 .分隔 {
  margin: 0 6px;
  color: var(--色-边深);
}

/* ---------- 轻提示 ---------- */
.轻提示 {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translate(-50%, 20px);
  max-width: 82vw;
  padding: 11px 20px;
  border-radius: var(--圆角-胶囊);
  background: rgba(43, 33, 24, 0.92);
  color: #fff;
  font-size: var(--字号);
  box-shadow: var(--阴影-大);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--过渡), transform var(--过渡);
  z-index: 100;
}

.轻提示.显示 {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- 加载态 ---------- */
.骨架 {
  border-radius: var(--圆角);
  background: linear-gradient(90deg, var(--色-边) 25%, #f7ede4 50%, var(--色-边) 75%);
  background-size: 200% 100%;
  animation: 流光 1.4s ease-in-out infinite;
  height: 18px;
  margin-bottom: var(--间距-3);
}

@keyframes 流光 {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.加载中 {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--间距-3);
  padding: var(--间距-6) 0;
  color: var(--色-次要文字);
  font-size: var(--字号-小);
}

.加载中 .转圈 {
  width: 30px;
  height: 30px;
  border: 3px solid var(--色-边);
  border-top-color: var(--色-主);
  border-radius: 50%;
  animation: 旋转 800ms linear infinite;
}

@keyframes 旋转 {
  to {
    transform: rotate(360deg);
  }
}

/* 空状态 */
.空状态 {
  text-align: center;
  padding: var(--间距-6) var(--间距-4);
  color: var(--色-弱文字);
}

.空状态 .图案 {
  font-size: 44px;
  margin-bottom: var(--间距-3);
  opacity: 0.7;
}

/* ---------- 动画 ---------- */
.入场 {
  animation: 入场 320ms cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

@keyframes 入场 {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.隐藏 {
  display: none !important;
}

/* ---------- 桌面端微调 ---------- */
@media (min-width: 720px) {
  .容器 {
    padding-top: var(--间距-5);
  }
  .英雄 {
    padding-top: var(--间距-6);
  }
}

/* 尊重系统减弱动画设置 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
