:root {
  --bg:#FFFFFF; --fg:#111111; --dim:#707070; --line:#E6E6E6;
  --accent:#0052D9; --btn-bg:#0052D9; --btn-fg:#FFFFFF; --r:8px;
  --p1:#E34D59; --p2:#2BA471; --p3:#0594FA; --p4:#E37318; --p5:#7C4DFF;

  --panel:#FFFFFF;
  --w-app:600px;
  --pad-x:24px;
  --h-btn:68px;
  --h-input:56px;
  --h-card:52px;
  --h-option:56px;
  --fs-title:34px;
  --fs-cut:36px;
  --fs-cut-sm:30px;
  --fs-subtitle:24px;
  --fs-question:20px;
  --fs-body:18px;
  --fs-aux:13px;
  --fs-micro:11px;
  --lh-cut:1.34;
  --ring-c:163.36;
}

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

body {
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  min-height: 100vh;
}

#app {
  width: 100%;
  max-width: var(--w-app);
  margin: 0 auto;
  padding: 72px var(--pad-x);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

section[data-screen] { display: none; }
section[data-screen].active { display: flex; flex-direction: column; gap: 16px; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

/* ---------- 输入屏 ---------- */
h1 { text-align: center; font-size: var(--fs-title); }
.sub { text-align: center; color: var(--dim); font-size: var(--fs-body); }

#task-input {
  width: 100%;
  height: var(--h-input);
  background: linear-gradient(180deg, #FFFFFF 0%, #F7F9FD 100%);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--fg);
  font-size: var(--fs-body);
  padding: 0 16px;
  outline: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .9),
    0 2px 0 #E2E8F3,
    0 8px 18px rgba(17, 34, 68, .07);
}
#task-input:focus { border-color: var(--accent); }

/* 主按钮：类 3D 蓝渐变凸起，按压下沉 */
.primary {
  width: 100%;
  height: var(--h-btn);
  background: linear-gradient(180deg, #0E7AFF 0%, #0052D9 55%, #0043AC 100%);
  color: var(--btn-fg);
  font-size: var(--fs-body);
  font-weight: 600;
  border-radius: var(--r);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .4),
    inset 0 -2px 0 rgba(0, 34, 102, .5),
    0 4px 0 #003384,
    0 12px 24px rgba(0, 82, 217, .3);
  transition: background .2s ease, transform .1s ease, box-shadow .1s ease;
}
.primary:hover {
  background: linear-gradient(180deg, #1E86FF 0%, #005CE8 55%, #004DBE 100%);
}
.primary:active {
  transform: translateY(3px);
  box-shadow:
    inset 0 2px 8px rgba(0, 28, 84, .5),
    0 1px 0 #003384,
    0 4px 10px rgba(0, 82, 217, .2);
}

.hint { color: var(--dim); font-size: var(--fs-aux); text-align: center; min-height: 18px; }

/* ---------- 选监工屏 ---------- */
.persona-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: var(--h-card);
  background: linear-gradient(180deg, #FFFFFF 0%, #F6F8FC 100%);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  padding: 0 14px 0 0;
  text-align: left;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .9),
    0 2px 0 #E2E8F3,
    0 8px 18px rgba(17, 34, 68, .07);
}
.persona-card:active {
  border-color: var(--accent);
  transform: translateY(2px);
  box-shadow: inset 0 2px 5px rgba(17, 34, 68, .08), 0 1px 0 #E2E8F3;
}
.bar { width: 3px; align-self: stretch; flex: none; }
.bar-0 { background: var(--p1); }
.bar-1 { background: var(--p2); }
.bar-2 { background: var(--p3); }
.bar-3 { background: var(--p4); }
.bar-4 { background: var(--p5); }
.p-name { font-size: var(--fs-body); flex: none; }
.p-tag { font-size: var(--fs-aux); color: var(--dim); }

/* ---------- 问题屏 ---------- */
.intro { color: var(--dim); font-size: var(--fs-aux); }
.question { font-size: var(--fs-question); }

.option {
  width: 100%;
  height: var(--h-option);
  background: linear-gradient(180deg, #FFFFFF 0%, #F6F8FC 100%);
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-size: var(--fs-body);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .9),
    0 2px 0 #E2E8F3,
    0 8px 18px rgba(17, 34, 68, .07);
}
.option:active {
  border-color: var(--accent);
  background: #EAF1FF;
  transform: translateY(2px);
  box-shadow: inset 0 2px 5px rgba(17, 34, 68, .08), 0 1px 0 #E2E8F3;
}

/* 次按钮：纯文字 + 底部 1px 虚线，与主按钮形状完全不同 */
.ghost,
.dashed {
  align-self: center;
  background: none;
  border: none;
  border-radius: 0;
  color: var(--dim);
  font-size: var(--fs-aux);
  padding: 4px 0 6px;
  border-bottom: 1px dashed var(--dim);
  text-decoration: none;
}

/* ---------- 任务卡屏 ---------- */
.mission-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.task-name { font-size: var(--fs-aux); color: var(--dim); }

/* 倒计时环：SVG 灰底圈 + 红进度圈 */
.ring { position: relative; width: 56px; height: 56px; flex: none; }
.ring svg { position: absolute; inset: 0; }
.ring-track { fill: none; stroke: var(--line); stroke-width: 2; }
.ring-progress {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-dasharray: var(--ring-c);
  stroke-dashoffset: calc(var(--ring-c) * (1 - var(--progress, 1)));
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}
#ring-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--fg);
}

/* 屏幕中央字幕：24px 深色字，出现淡入 / 清空淡出 */
.subtitle {
  font-size: var(--fs-subtitle);
  color: var(--fg);
  text-align: center;
  min-height: 34px;
  opacity: 0;
  transition: opacity .25s ease;
}
.subtitle:not(:empty) { opacity: 1; }

.cut-text {
  font-size: var(--fs-cut);
  font-weight: 700;
  line-height: var(--lh-cut);
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cut-text.small { font-size: var(--fs-cut-sm); }
.sub-hint {
  text-align: center;
  color: var(--dim);
  font-size: var(--fs-micro);
  line-height: 1.7;
}
.split-tag { text-align: center; color: var(--dim); font-size: var(--fs-micro); }
.cut-progress { text-align: center; color: var(--dim); font-size: var(--fs-aux); }
.renew-slot { height: 28px; }

/* ---------- 完成屏 ---------- */
.done-line { text-align: center; font-size: var(--fs-question); min-height: 28px; }
#report-block {
  margin: 14px 0 0;
  padding: 18px 16px 4px;
  border: 1px dashed var(--line);
  border-radius: var(--r);
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}
.grade {
  font-size: 64px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  color: var(--fg);
}
#report-advice { font-size: var(--fs-aux); color: var(--dim); min-height: 0; }
#report-actions { display: flex; flex-direction: column; width: 100%; gap: 6px; margin-top: 4px; }
.hidden { display: none !important; }

/* ---------- 拖延类型结果卡 ---------- */
.type-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}
.type-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}
.type-emoji { font-size: 52px; line-height: 1; }
.type-name { font-size: 26px; font-weight: 800; color: var(--fg); }
.type-code { color: var(--dim); font-size: var(--fs-micro); letter-spacing: 2px; }
.type-tag { color: var(--fg); font-size: var(--fs-body); }
.type-advice {
  padding: 10px 14px;
  border-radius: var(--r);
  font-size: var(--fs-aux);
  color: var(--fg);
  background: linear-gradient(180deg, #FFFFFF 0%, #F6F8FC 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 2px 0 #E2E8F3, 0 8px 18px rgba(17,34,68,.07);
}
.type-tone { color: var(--dim); font-size: var(--fs-micro); }
.type-result .primary { margin-top: 6px; }

/* ---------- 六维雷达图 ---------- */
.radar-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  width: 100%;
}
.radar-wrap { position: relative; width: 236px; }
#radar-svg { width: 100%; display: block; }
.radar-grid { fill: none; stroke: var(--line); }
.radar-axis { stroke: #DCE3F0; }
.radar-data {
  fill: rgba(0,82,217,.16);
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linejoin: round;
}
.radar-dot { fill: var(--accent); }
.radar-label {
  position: absolute;
  font-size: 12px;
  color: var(--dim);
  transform: translate(-50%, -50%);
  white-space: nowrap;
}
.rl-start   { left: 50%; top: 4%; }
.rl-exec    { left: 88%; top: 30%; }
.rl-rate    { left: 88%; top: 71%; }
.rl-focus   { left: 50%; top: 95%; }
.rl-stamina { left: 12%; top: 71%; }
.rl-help    { left: 12%; top: 30%; }

/* ---------- 考试确认卡 ---------- */
.exam-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: var(--r);
}
.exam-date-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: var(--fs-body);
}
#exam-date {
  flex: none;
  font-family: inherit;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--fg);
  font-size: var(--fs-body);
  padding: 8px 10px;
  outline: none;
}
#exam-date:focus { border-color: var(--accent); }
#exam-cuts { display: flex; flex-direction: column; gap: 10px; }
.exam-cut {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  background: linear-gradient(180deg, #FFFFFF 0%, #F6F8FC 100%);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .9),
    0 2px 0 #E2E8F3,
    0 8px 18px rgba(17, 34, 68, .07);
}
.exam-cut-text { font-size: var(--fs-body); font-weight: 600; }
.exam-cut-sub { font-size: var(--fs-micro); color: var(--dim); }

/* ---------- 历史进度折线 ---------- */
#history-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  width: 100%;
}
.history-wrap { width: 220px; }
#history-svg { width: 100%; display: block; }
.hist-line { stroke: var(--line); stroke-width: 1; stroke-dasharray: 4 3; }
.hist-data {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linejoin: round;
}
.hist-dot { fill: var(--accent); }

/* ---------- 愤怒态：3px 红内描边 + 单次脉冲 ---------- */
body.angry {
  box-shadow: inset 0 0 0 3px var(--p1);
  animation: angryPulse .5s ease-out 1;
}
@keyframes angryPulse {
  0%   { box-shadow: inset 0 0 0 3px var(--p1), 0 0 0 0 transparent; }
  50%  { box-shadow: inset 0 0 0 3px var(--p1), 0 0 34px 6px color-mix(in srgb, var(--p1) 50%, transparent); }
  100% { box-shadow: inset 0 0 0 3px var(--p1); }
}

/* ---------- 空输入抖动 ---------- */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
.shake { animation: shake .25s ease 2; }

/* ---------- 超时弹窗浮层（页面内，非 alert） ---------- */
.overdue-popup {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--pad-x);
  background: color-mix(in srgb, var(--bg) 55%, transparent);
}
.popup-card {
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: linear-gradient(180deg, #FFFFFF 0%, #F6F8FC 100%);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 24px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .9),
    0 3px 0 #E2E8F3,
    0 16px 40px rgba(17, 34, 68, .16);
}
.popup-card p {
  text-align: center;
  font-size: var(--fs-question);
  line-height: 1.5;
}
.popup-card .ghost { align-self: center; }

/* ---------- 右上角静音开关 ---------- */
.mute-btn {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 20;
  background: linear-gradient(180deg, #FFFFFF 0%, #F6F8FC 100%);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: var(--fs-aux);
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .9),
    0 2px 0 #E2E8F3,
    0 4px 10px rgba(17, 34, 68, .08);
}
.mute-btn:active { transform: translateY(2px); box-shadow: inset 0 2px 5px rgba(17, 34, 68, .08); }
.mute-btn.muted {
  color: var(--dim);
  border-color: var(--dim);
}

/* ---------- demo 声音解锁提示 ---------- */
.sound-hint {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 14px;
  z-index: 20;
  color: var(--dim);
  font-size: 12px;
  text-align: center;
  cursor: pointer;
}

/* ---------- 第三次提醒 / 报时 / 清空记录 ---------- */
.repeat-hint {
  font-size: 12px;
  color: var(--dim);
  margin: 10px 0 0;
  text-align: center;
}
.sleep-line {
  margin-top: 16px;
  font-size: 11px;
  opacity: .6;
  color: var(--fg);
  text-align: center;
  cursor: pointer;
}
.sleep-line p { margin: 2px 0; }
.micro-link {
  margin-top: 18px;
  background: none;
  border: none;
  color: var(--dim);
  font-size: 12px;
  text-decoration: underline;
  text-decoration-style: dashed;
  cursor: pointer;
}

/* ---------- 无障碍：关掉所有动画与过渡 ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001s !important;
  }
}

/* ---------- 性格测试 / 路线屏 ---------- */
#quiz-options,
#route-list { display: flex; flex-direction: column; gap: 12px; }
.route-card { position: relative; text-align: left; padding: 0 16px; }
.rec-badge {
  position: absolute;
  top: -8px;
  right: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
}
.rec-badge::after { content: "为你推荐"; }
.persona-card { position: relative; }
.persona-card .rec-badge { top: 50%; right: 12px; transform: translateY(-50%); }
.persona-extra { display: flex; gap: 16px; justify-content: center; }

/* ---------- 教练角标 ---------- */
.expert-tag {
  text-align: center;
  color: var(--dim);
  font-size: var(--fs-aux);
  min-height: 18px;
}

/* ---------- 弹窗附加行 ---------- */
.popup-extra { text-align: center; font-size: var(--fs-aux); color: var(--accent); }
#auto-hint { min-height: 0; }

/* ---------- 设置按钮（左上角） ---------- */
.opt-btn { right: auto; left: 12px; }

/* ---------- 面板浮层 ---------- */
.panel-overlay {
  position: fixed;
  inset: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--pad-x);
  background: color-mix(in srgb, var(--bg) 55%, transparent);
}
.panel-title { text-align: center; font-size: var(--fs-question); }
.opt-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: linear-gradient(180deg, #FFFFFF 0%, #F6F8FC 100%);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 10px 14px;
  text-align: left;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .9),
    0 2px 0 #E2E8F3,
    0 6px 12px rgba(17, 34, 68, .06);
}
.opt-row:active { transform: translateY(2px); box-shadow: inset 0 2px 5px rgba(17, 34, 68, .08), 0 1px 0 #E2E8F3; }
.opt-row.on { border-color: var(--accent); }
.opt-name { font-size: var(--fs-body); flex: none; }
.opt-desc { font-size: var(--fs-micro); color: var(--dim); flex: 1; text-align: left; }
.opt-state { font-size: var(--fs-micro); color: var(--dim); flex: none; }
.opt-row.on .opt-state { color: var(--accent); }
.opt-penalty {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: var(--fs-aux);
  color: var(--dim);
}
#opt-penalty,
.panel-input {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--fg);
  font-size: var(--fs-body);
  padding: 10px 12px;
  outline: none;
}
#opt-penalty:focus,
.panel-input:focus { border-color: var(--accent); }
.tone-row { display: flex; gap: 8px; }
.tone-btn {
  flex: 1;
  background: linear-gradient(180deg, #FFFFFF 0%, #F6F8FC 100%);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 8px 0;
  font-size: var(--fs-aux);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .9),
    0 2px 0 #E2E8F3,
    0 6px 12px rgba(17, 34, 68, .06);
}
.tone-btn.on {
  border-color: var(--accent);
  color: var(--accent);
  background: #EAF1FF;
}
.tone-btn:active { transform: translateY(2px); box-shadow: inset 0 2px 5px rgba(17, 34, 68, .08); }

/* ---------- 首页 hero 背景（腾讯官网式，仅输入屏） ---------- */
body.hero-on {
  background:
    radial-gradient(1100px 620px at 88% -12%, rgba(122, 170, 255, .5), transparent 62%),
    radial-gradient(820px 520px at -12% 112%, rgba(0, 82, 217, .55), transparent 58%),
    linear-gradient(160deg, #0A2A66 0%, #0B4BC8 48%, #2F74F6 100%);
}
body.hero-on::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 42%, #000 25%, transparent 78%);
  mask-image: radial-gradient(ellipse 90% 70% at 50% 42%, #000 25%, transparent 78%);
}
body.hero-on h1 { color: #FFFFFF; }
body.hero-on .sub { color: rgba(255, 255, 255, .74); }
body.hero-on .hint,
body.hero-on .repeat-hint,
body.hero-on .split-tag { color: rgba(255, 255, 255, .68); }
