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

:root {
  --bg: #05070a;
  --ink: #eaf3f0;
  --dim: #6d7f7c;
  --mint: #3bffc1;
  --mint-dim: #1d8f6d;
  --alarm: #ff4257;
  --amber: #ffc45e;

  /* ---- 版式基准 ----
     所有页面共用同一列宽、同一套字号、同一条上边距，
     否则会像两个不同产品拼在一起                        */
  --w: 560px;          /* 内容列宽 */
  --pad: 56px;         /* 页面上边距 */
  --bar: 36px;         /* 顶部导航条高度（返回 / 我的记录所在那一行） */
  --gap-bar: 14px;     /* 导航条与标题区的间距 */

  --fs-display: clamp(54px, 8.4vw, 96px);
  --fs-h1: clamp(26px, 3.6vw, 36px);
  --fs-num: clamp(24px, 3vw, 30px);
  --fs-lead: clamp(14px, 1.4vw, 15px);
  --fs-body: 13px;
  --fs-label: 11px;
  --fs-micro: 10px;

  --lh-body: 1.8;

  --c-hi: #f2fffb;
  --c-text: #9fb2ae;
  --c-mute: #7b8d88;
  --c-faint: #55645f;
  --rule: rgba(255, 255, 255, 0.07);
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#app { position: fixed; inset: 0; }

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.55s ease, visibility 0.55s;
  overflow: hidden;
}

.screen.active {
  opacity: 1;
  visibility: visible;
}

.grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.5;
  background-image:
    radial-gradient(circle at 50% 120%, rgba(59, 255, 193, 0.10), transparent 55%),
    radial-gradient(circle at 12% -10%, rgba(59, 143, 255, 0.08), transparent 45%);
}

/* ---------------- 介绍页 ---------------- */

#intro {
  background: var(--bg);
  align-items: flex-start;
  overflow-y: auto;
}

.intro-inner {
  position: relative;
  z-index: 2;
  width: min(var(--w), calc(100% - 40px));
  /* 顶部留出一条导航条的高度，让标题和「我的记录」页从同一高度开始 */
  padding: calc(var(--pad) + var(--bar) + var(--gap-bar)) 0 64px;
  margin: 0 auto;
  text-align: left;
}

.eyebrow {
  font-size: var(--fs-label);
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: 0.18em;
  color: var(--mint);
  text-transform: uppercase;
  opacity: 0.85;
}

.title {
  margin-top: 18px;
  /* 大字号汉字的字形自带左边距，放大后视觉上会偏右，拉回来对齐正文 */
  margin-left: -0.03em;
  font-size: var(--fs-display);
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1;
  color: var(--c-hi);
}

.lede {
  margin-top: 20px;
  font-size: var(--fs-lead);
  font-weight: 400;
  line-height: var(--lh-body);
  color: var(--c-text);
  letter-spacing: 0.02em;
}

.lede span { color: var(--mint); font-weight: 500; }

.picker {
  display: flex;
  gap: 8px;
  margin-top: 32px;
}

.chip {
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--dim);
  height: 36px;
  padding: 0 20px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: transparent;
  cursor: pointer;
  transition: all 0.22s;
}

.chip:hover { color: #cfe6e0; border-color: rgba(59, 255, 193, 0.35); }

.chip.active {
  color: #04120d;
  background: var(--mint);
  border-color: var(--mint);
  box-shadow: 0 0 30px rgba(59, 255, 193, 0.30);
}

.primary {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  padding: 0 34px;
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.1em;
  white-space: nowrap;
  color: #04120d;
  background: var(--mint);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.28s, filter 0.2s;
  box-shadow: 0 0 0 rgba(59, 255, 193, 0);
}

/* 按钮不带外边距，间距由所在容器决定，避免各页各写一套 */
.intro-inner > .primary { margin-top: 32px; }

.primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
  box-shadow: 0 8px 46px rgba(59, 255, 193, 0.32);
}

.primary:active { transform: translateY(0); }

.primary::after {
  content: "";
  position: absolute;
  top: 0; left: -60%;
  width: 40%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,0.55), transparent);
  animation: sweep 3.6s ease-in-out infinite;
}

@keyframes sweep {
  0%, 55% { left: -60%; }
  85%, 100% { left: 130%; }
}

.result-actions {
  margin-top: 32px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  padding: 0 26px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: transparent;
  color: var(--c-text);
  font-family: inherit;
  font-size: var(--fs-body);
  letter-spacing: 0.08em;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.22s;
}

.ghost:hover { color: #eaf3f0; border-color: rgba(255,255,255,0.25); }

.ghost:disabled {
  opacity: 0.55;
  cursor: default;
  color: #9fb2ae;
  border-color: rgba(255, 255, 255, 0.1);
}

.privacy {
  margin-top: 18px;
  font-size: var(--fs-label);
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: 0.04em;
  color: var(--c-faint);
}

.how {
  margin-top: 44px;
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--rule);
  padding-top: 22px;
}

.how-item {
  display: flex;
  gap: 14px;
  align-items: baseline;
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: 0.02em;
  color: var(--c-mute);
}

.how-item b {
  font-size: var(--fs-micro);
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--mint-dim);
  font-variant-numeric: tabular-nums;
  flex: none;
}

/* ---------------- 久坐提醒卡片 ---------------- */

.reminder-card {
  margin-top: 32px;
  padding: 18px 20px 16px;
  border: 1px solid var(--rule);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.022);
  transition: border-color 0.3s, background 0.3s;
}

.reminder-card.on {
  border-color: rgba(59, 255, 193, 0.26);
  background: rgba(59, 255, 193, 0.035);
}

.reminder-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.reminder-title {
  font-size: var(--fs-body);
  font-weight: 400;
  letter-spacing: 0.08em;
  color: #dfefea;
}

.reminder-sub {
  margin-top: 6px;
  font-size: var(--fs-label);
  font-weight: 400;
  line-height: 1.65;
  letter-spacing: 0.02em;
  color: #6a7c77;
}

.switch {
  position: relative;
  flex: none;
  width: 44px;
  height: 25px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: background 0.25s, border-color 0.25s, box-shadow 0.25s;
  padding: 0;
}

.switch i {
  position: absolute;
  top: 50%;
  left: 3px;
  width: 17px;
  height: 17px;
  margin-top: -8.5px;
  border-radius: 50%;
  background: #8fa39d;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), background 0.25s;
}

.switch[aria-checked="true"] {
  background: rgba(59, 255, 193, 0.9);
  border-color: rgba(59, 255, 193, 0.9);
  box-shadow: 0 0 22px rgba(59, 255, 193, 0.35);
}

.switch[aria-checked="true"] i {
  transform: translateX(19px);
  background: #04120d;
}

.reminder-body {
  overflow: hidden;
  transition: opacity 0.28s, max-height 0.35s;
  max-height: 160px;
  opacity: 1;
  margin-top: 16px;
}

.reminder-card.on .reminder-body {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
}

.picker-sm {
  margin-top: 0;
}

.picker-sm .chip {
  height: 30px;
  padding: 0 14px;
  font-size: 12px;
}

.reminder-note {
  margin-top: 12px;
  font-size: var(--fs-label);
  font-weight: 400;
  line-height: 1.7;
  letter-spacing: 0.02em;
  color: var(--c-faint);
}

.reminder-live {
  display: none;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: #9fd8c7;
  font-variant-numeric: tabular-nums;
}

.reminder-card.on .reminder-live {
  display: flex;
}

.pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 12px var(--mint);
  animation: pulse 2s ease-in-out infinite;
  flex: none;
}

.linkish {
  margin-left: auto;
  padding: 2px 0;
  border: none;
  background: none;
  color: #6a7c77;
  font-family: inherit;
  font-size: 11.5px;
  letter-spacing: 0.06em;
  cursor: pointer;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.linkish:hover {
  color: #eaf3f0;
  border-bottom-color: rgba(255, 255, 255, 0.25);
}

/* ---------------- 到点浮层 ---------------- */

.reminder-toast {
  position: fixed;
  left: 50%;
  bottom: 46px;
  transform: translateX(-50%) translateY(18px);
  z-index: 60;
  width: min(420px, calc(100% - 40px));
  padding: 22px 24px;
  border-radius: 18px;
  border: 1px solid rgba(59, 255, 193, 0.3);
  background: rgba(8, 16, 14, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.6), 0 0 50px rgba(59, 255, 193, 0.12);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s, transform 0.35s, visibility 0.35s;
  text-align: left;
}

.reminder-toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.reminder-toast-title {
  font-size: 17px;
  font-weight: 400;
  letter-spacing: 0.06em;
  color: #f2fffb;
}

.reminder-toast-sub {
  margin-top: 8px;
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: 1.7;
  color: #8fa39d;
}

.reminder-toast-actions {
  display: flex;
  gap: 9px;
  margin-top: 18px;
}

.primary.sm,
.ghost.sm {
  margin-top: 0;
  height: 40px;
  padding: 0 18px;
  font-size: 12.5px;
  letter-spacing: 0.06em;
  width: auto;
  flex: none;
}

/* ---------------- 挑战页 ---------------- */

#stage { background: #000; }

/* 顶部与底部的暗色过渡层，保证 HUD 在任何画面上都能读清 */
#stage::before,
#stage::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 36%;
  z-index: 3;
  pointer-events: none;
}

#stage::before {
  top: 0;
  background: linear-gradient(
    to bottom,
    rgba(2, 4, 6, 0.82) 0%,
    rgba(2, 4, 6, 0.46) 42%,
    rgba(2, 4, 6, 0) 100%
  );
}

#stage::after {
  bottom: 0;
  background: linear-gradient(
    to top,
    rgba(2, 4, 6, 0.86) 0%,
    rgba(2, 4, 6, 0.40) 46%,
    rgba(2, 4, 6, 0) 100%
  );
}

.viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #000;
}

.video-bg, .video-fg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: scaleX(-1);
}

.video-bg {
  object-fit: cover;
  filter: blur(46px) brightness(0.28) saturate(1.6);
  transform: scaleX(-1) scale(1.18);
}

.video-fg {
  object-fit: contain;
  opacity: 0.92;
}

#overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 42%, rgba(0,0,0,0.62) 100%);
}

.scanline {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.10;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255,255,255,0.5) 0px,
    rgba(255,255,255,0.5) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: overlay;
}

.hud {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 5;
  pointer-events: none;
  padding: 0 clamp(20px, 4vw, 56px);
}

.hud-top {
  top: clamp(20px, 4vh, 46px);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.timer-wrap { display: flex; flex-direction: column; }

.timer {
  font-size: clamp(58px, 11vw, 104px);
  font-weight: 300;
  line-height: 0.92;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: #f0fffb;
  text-shadow: 0 0 42px rgba(59, 255, 193, 0.35);
  transition: color 0.3s;
}

.timer.warn {
  color: var(--alarm);
  text-shadow: 0 0 46px rgba(255, 66, 87, 0.55);
}

.timer-label {
  margin-top: 10px;
  font-size: 10px;
  letter-spacing: 0.18em;
  color: rgba(255, 255, 255, 0.55);
}

.meter {
  width: clamp(150px, 22vw, 260px);
  padding-top: 8px;
}

.meter-bar {
  position: relative;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.meter-bar i {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #1f7d63, var(--mint) 55%, var(--amber));
  box-shadow: 0 0 18px rgba(59, 255, 193, 0.6);
  transition: width 0.09s linear, background 0.3s;
}

.meter-row {
  display: flex;
  justify-content: space-between;
  margin-top: 9px;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.5);
}

.meter-row span:last-child {
  font-variant-numeric: tabular-nums;
  color: var(--mint);
}

.hud-bottom {
  bottom: clamp(30px, 6vh, 64px);
  text-align: center;
}

.coach {
  display: inline-block;
  font-size: clamp(14px, 1.8vw, 17px);
  font-weight: 400;
  letter-spacing: 0.16em;
  color: rgba(255, 255, 255, 0.82);
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.9);
  transition: color 0.25s;
}

.coach.hot { color: var(--mint); }
.coach.off { color: var(--alarm); }

.edge-alarm {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  opacity: 0;
  box-shadow: inset 0 0 0 0 rgba(255, 66, 87, 0);
  transition: opacity 0.2s;
}

.edge-alarm.on {
  opacity: 1;
  animation: edgePulse 1.1s ease-in-out infinite;
}

@keyframes edgePulse {
  0%, 100% { box-shadow: inset 0 0 60px 0 rgba(255, 66, 87, 0.35); }
  50%      { box-shadow: inset 0 0 130px 6px rgba(255, 66, 87, 0.62); }
}

.alarm-word {
  position: absolute;
  left: 50%;
  top: 33%;
  transform: translate(-50%, -50%) scale(0.94);
  z-index: 6;
  font-size: clamp(40px, 9vw, 88px);
  font-weight: 500;
  letter-spacing: 0.08em;
  color: #fff;
  text-shadow: 0 0 60px rgba(255, 66, 87, 0.9), 0 0 18px rgba(255, 66, 87, 0.8);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  white-space: nowrap;
}

.alarm-word.on {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  animation: wordShake 0.6s ease-in-out infinite;
}

@keyframes wordShake {
  0%, 100% { transform: translate(-50%, -50%) scale(1) rotate(-0.6deg); }
  50%      { transform: translate(-50%, -50%) scale(1.03) rotate(0.6deg); }
}

.quit {
  position: absolute;
  right: clamp(20px, 4vw, 56px);
  bottom: clamp(20px, 4vh, 44px);
  z-index: 8;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(8px);
  color: rgba(255, 255, 255, 0.38);
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.2s;
  overflow: hidden;
}

.quit:hover { color: rgba(255, 255, 255, 0.75); border-color: rgba(255,255,255,0.22); }

.quit .fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0%;
  background: rgba(255, 66, 87, 0.35);
  transition: width 0.06s linear;
}

.quit span { position: relative; z-index: 1; }

.boot {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  background: rgba(5, 7, 10, 0.94);
  transition: opacity 0.5s;
}

.boot.hide { opacity: 0; pointer-events: none; }

.boot-ring {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1.5px solid rgba(59, 255, 193, 0.16);
  border-top-color: var(--mint);
  animation: spin 0.9s linear infinite;
}

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

.boot p {
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--dim);
}

/* ---------------- 结果页 ---------------- */

#result { background: var(--bg); align-items: flex-start; overflow-y: auto; }

.result-inner {
  position: relative;
  z-index: 2;
  width: min(var(--w), calc(100% - 40px));
  margin: 0 auto;
  padding: calc(var(--pad) + var(--bar) + var(--gap-bar)) 0 64px;
}

.result-title {
  margin-top: 14px;
  font-size: var(--fs-h1);
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: 0.02em;
  color: var(--c-hi);
}

.result-sub {
  margin-top: 14px;
  font-size: var(--fs-lead);
  font-weight: 400;
  line-height: var(--lh-body);
  color: var(--c-text);
}

.stats {
  display: flex;
  gap: clamp(20px, 5vw, 48px);
  margin-top: 36px;
  padding: 24px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.stat { display: flex; flex-direction: column; gap: 10px; }

.stat b {
  font-size: var(--fs-num);
  font-weight: 300;
  line-height: 1;
  color: var(--mint);
  font-variant-numeric: tabular-nums;
}

.stat span {
  font-size: var(--fs-label);
  letter-spacing: 0.06em;
  color: var(--c-mute);
}

/* ---------------- 致命错误 ---------------- */

.fatal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 7, 10, 0.92);
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.fatal.on { opacity: 1; visibility: visible; }

.fatal-box {
  width: min(420px, calc(100% - 48px));
  text-align: center;
}

.fatal-box h3 {
  font-size: 20px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--c-hi);
}

.fatal-box .primary {
  margin-top: 22px;
}

.fatal-box p {
  margin-top: 14px;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.8;
  color: #7b8d88;
}

/* ---------------- 移动端 ---------------- */

@media (max-width: 640px) {
  :root {
    --pad: 26px;
    --bar: 34px;
    --gap-bar: 12px;
    --fs-h1: 26px;
  }
  .title { margin-top: 14px; }
  .lede { margin-top: 16px; }
  .picker { margin-top: 24px; }
  .intro-inner > .primary { width: 100%; margin-top: 26px; }
  .how { margin-top: 34px; gap: 11px; }
  .hud-top { flex-direction: column; gap: 14px; }
  .meter { width: 100%; }
  .stats { gap: 18px; flex-wrap: wrap; }
  .quit { bottom: auto; top: 50%; right: 12px; transform: translateY(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---------------- 个人中心 ---------------- */

.nav-pill {
  position: fixed;
  /* 与内容列的顶部导航条同高，右边与内容列右边缘对齐 */
  top: calc(var(--pad) - 1px);
  right: max(20px, calc((100% - var(--w)) / 2));
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px 9px 13px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.035);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: rgba(232, 240, 255, 0.62);
  font-family: inherit;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: color 0.25s, border-color 0.25s, box-shadow 0.25s, background 0.25s, opacity 0.25s;
}

.nav-pill svg {
  width: 15px;
  height: 15px;
  opacity: 0.9;
}

.nav-pill:hover {
  color: var(--mint);
  border-color: rgba(59, 255, 193, 0.38);
  background: rgba(59, 255, 193, 0.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 0 26px rgba(59, 255, 193, 0.14);
}

.nav-pill.hidden {
  opacity: 0;
  pointer-events: none;
}

#profile {
  display: block;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--pad) 0 72px;
}

.profile-inner {
  position: relative;
  z-index: 2;
  width: min(var(--w), calc(100% - 40px));
  margin: 0 auto;
}

.profile-topbar {
  display: flex;
  align-items: center;
  height: var(--bar);
  margin-bottom: var(--gap-bar);
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 32px;
  margin-left: -10px;
  padding: 0 14px 0 10px;
  border: none;
  border-radius: 999px;
  background: none;
  color: var(--mint);
  font-family: inherit;
  font-size: var(--fs-body);
  font-weight: 400;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

.back-btn svg {
  width: 17px;
  height: 17px;
}

.back-btn:hover {
  background: rgba(59, 255, 193, 0.09);
}

.back-btn:active {
  opacity: 0.55;
}

.profile-title {
  margin-top: 12px;
  font-size: var(--fs-h1);
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: 0.02em;
  color: var(--c-hi);
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 34px;
  padding: 24px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.pstat {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.pstat b {
  font-size: var(--fs-num);
  font-weight: 300;
  line-height: 1;
  color: var(--mint);
  font-variant-numeric: tabular-nums;
}

.pstat span {
  font-size: var(--fs-label);
  letter-spacing: 0.06em;
  color: var(--c-mute);
}

.section-block {
  margin-top: 36px;
}

.section-title {
  font-size: var(--fs-label);
  letter-spacing: 0.12em;
  color: #6d7f7c;
}

/* 热力图左上角汇总：总和 + 时间跨度 */
.heatmap-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

.heatmap-summary {
  font-size: var(--fs-label);
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--c-mute);
}

.heatmap-summary b {
  margin: 0 4px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.heatmap-range {
  flex: none;
  font-size: var(--fs-micro);
  letter-spacing: 0.06em;
  color: var(--c-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.heatmap-wrap {
  --hm-cell: 16px;
  --hm-gap: 5px;
  margin-top: 16px;
}

.heatmap-months {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: var(--hm-cell);
  gap: var(--hm-gap);
  height: 14px;
  margin-bottom: 7px;
  font-size: var(--fs-micro);
  letter-spacing: 0.03em;
  color: var(--c-faint);
}

.heatmap-months span {
  grid-row: 1;
  line-height: 14px;
  white-space: nowrap;
}

.heatmap {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, var(--hm-cell));
  grid-auto-columns: var(--hm-cell);
  gap: var(--hm-gap);
}

.heatmap i {
  display: block;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.045);
  transition: transform 0.15s;
}

.heatmap i.blank {
  background: transparent;
}

.heatmap i:hover {
  transform: scale(1.14);
}

.heatmap i.c1 { background: rgba(59, 255, 193, 0.16); }
.heatmap i.c2 { background: rgba(59, 255, 193, 0.42); }
.heatmap i.c3 {
  background: rgba(59, 255, 193, 0.78);
  box-shadow: 0 0 12px rgba(59, 255, 193, 0.3);
}

.heatmap i.today {
  outline: 1px solid rgba(59, 255, 193, 0.7);
  outline-offset: 1.5px;
}

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 12px;
  font-size: var(--fs-micro);
  letter-spacing: 0.08em;
  color: var(--c-faint);
}

.heatmap-legend i {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.045);
}

.heatmap-legend i.lv1 { background: rgba(59, 255, 193, 0.16); }
.heatmap-legend i.lv2 { background: rgba(59, 255, 193, 0.42); }
.heatmap-legend i.lv3 { background: rgba(59, 255, 193, 0.78); }

.recent {
  list-style: none;
  margin-top: 6px;
}

.recent li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: var(--fs-body);
  color: #8fa39d;
}

.recent li .when {
  color: #dfefea;
  font-variant-numeric: tabular-nums;
}

.recent li .when em {
  font-style: normal;
  font-size: var(--fs-label);
  color: #5f716c;
  margin-left: 10px;
}

.recent li .what {
  color: #5f716c;
  font-size: var(--fs-label);
  letter-spacing: 0.03em;
}

.recent li.empty {
  display: block;
  color: var(--c-faint);
  font-size: var(--fs-body);
  padding: 22px 0;
  border-bottom: none;
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 36px;
}

.ghost.danger {
  color: #b8606a;
  border-color: rgba(255, 66, 87, 0.18);
}

.ghost.danger:hover {
  color: #ff6b7a;
  border-color: rgba(255, 66, 87, 0.5);
  background: rgba(255, 66, 87, 0.06);
}

@media (max-width: 640px) {
  .nav-pill {
    padding: 8px 13px 8px 11px;
    font-size: 11.5px;
    gap: 6px;
  }
  .nav-pill svg { width: 14px; height: 14px; }
  .profile-stats { grid-template-columns: repeat(2, 1fr); gap: 18px 10px; }
  .heatmap-wrap { --hm-cell: 11px; --hm-gap: 2px; }
  .heatmap-months { font-size: 9px; }

  /* 动作区在窄屏上统一成网格：主操作占满一行，次操作均分 */
  .result-actions,
  .profile-actions {
    display: grid;
    gap: 9px;
  }
  .result-actions { grid-template-columns: 1fr 1fr; }
  .profile-actions { grid-template-columns: repeat(3, 1fr); }
  .result-actions .primary,
  .profile-actions .primary {
    grid-column: 1 / -1;
    width: 100%;
  }
  .result-actions .ghost,
  .profile-actions .ghost {
    width: 100%;
    padding: 0 10px;
  }
}

/* ---------------- 分享菜单 ---------------- */

.share-menu {
  position: fixed;
  z-index: 70;
  min-width: 168px;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #0a1015;
  background-image: linear-gradient(rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0));
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.62), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: menuIn 0.16s ease-out;
}

.share-menu[hidden] {
  display: none;
}

@keyframes menuIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.share-item {
  padding: 10px 14px;
  border: none;
  border-radius: 9px;
  background: none;
  color: #dfefea;
  font-family: inherit;
  font-size: var(--fs-body);
  font-weight: 400;
  letter-spacing: 0.03em;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.share-item:hover {
  background: rgba(59, 255, 193, 0.11);
  color: #fff;
}

.share-item:active {
  background: rgba(59, 255, 193, 0.18);
}

.share-item[hidden] {
  display: none;
}

/* ---------------- 轻提示 ---------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: max(34px, env(safe-area-inset-bottom, 0px));
  z-index: 80;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  background: rgba(18, 26, 30, 0.94);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  box-shadow: 0 12px 38px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  color: #eaf3f0;
  font-size: 12.5px;
  font-weight: 400;
  letter-spacing: 0.05em;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-50%) translateY(10px) scale(0.97);
  transition: opacity 0.26s ease, transform 0.26s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

.toast::before {
  content: "";
  flex: none;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 10px rgba(59, 255, 193, 0.8);
}

.toast:empty {
  opacity: 0;
}

/* ---------------- 单次记录详情 ---------------- */

.recent li[data-t] {
  cursor: pointer;
  transition: background 0.15s;
}

.recent li[data-t]:hover {
  background: rgba(255, 255, 255, 0.025);
}

.recent li[data-t]:active {
  background: rgba(59, 255, 193, 0.05);
}

.recent li .chev {
  font-style: normal;
  margin-left: 7px;
  color: #3f4d48;
  font-size: 15px;
  line-height: 1;
}

.record-sheet {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.record-sheet[hidden] {
  display: none;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 4, 6, 0.62);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fadeIn 0.22s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.sheet-body {
  position: relative;
  width: min(440px, calc(100% - 24px));
  margin-bottom: max(12px, env(safe-area-inset-bottom, 0px));
  padding: 12px 24px 24px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: #0c1318;
  box-shadow: 0 -12px 70px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  animation: sheetUp 0.3s cubic-bezier(0.2, 0.9, 0.3, 1);
}

@keyframes sheetUp {
  from { transform: translateY(36px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.sheet-handle {
  width: 34px;
  height: 4px;
  margin: 0 auto 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}

.sheet-time {
  font-size: var(--fs-label);
  letter-spacing: 0.1em;
  color: #6a7c77;
  text-align: center;
}

.sheet-main {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
}

.sheet-main b {
  font-size: 56px;
  font-weight: 300;
  line-height: 1;
  color: #f2fffb;
  font-variant-numeric: tabular-nums;
}

.sheet-main span {
  font-size: var(--fs-label);
  letter-spacing: 0.08em;
  color: #6a7c77;
}

.sheet-rows {
  margin-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.sheet-rows > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 13px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sheet-rows span {
  font-size: var(--fs-label);
  color: #6a7c77;
  letter-spacing: 0.04em;
}

.sheet-rows b {
  font-size: var(--fs-body);
  font-weight: 400;
  color: #dfefea;
  font-variant-numeric: tabular-nums;
}

.sheet-actions {
  display: flex;
  gap: 9px;
  margin-top: 22px;
}

.sheet-actions .primary,
.sheet-actions .ghost {
  flex: 1;
  margin-top: 0;
}

/* 菜单要浮在抽屉之上 */
.share-menu {
  z-index: 100;
}

/* ---------------- 热力图悬浮提示 ---------------- */

/* 热力图与上方的汇总、下方的图例共用同一条左基线，不做居中 */
.heatmap,
.heatmap-months {
  justify-content: start;
}

/* 热力图悬浮提示：由 JS 定位，避免伪元素被相邻格子盖住 */
.heat-tip {
  position: fixed;
  z-index: 120;
  padding: 6px 10px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #0d151a;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.7);
  color: #eaf3f0;
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.03em;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.heat-tip.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 640px) {
  .heat-tip { display: none; }
}

/* 月份刻度和格子必须用同一套显式列定义，否则居中后两边算出来不一样 */
.heatmap,
.heatmap-months {
  grid-template-columns: repeat(26, var(--hm-cell));
}

/* ---------------- 记录列表：悬浮态重做 ---------------- */

.recent {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.recent li:not(.empty) {
  padding: 11px 14px;
  margin: 0 -14px;
  border-bottom: none;
  border-radius: 10px;
  transition: background 0.16s ease, box-shadow 0.16s ease;
}

.recent li[data-t]:hover {
  background: rgba(255, 255, 255, 0.055);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.045);
}

.recent li[data-t]:active {
  background: rgba(59, 255, 193, 0.1);
  box-shadow: inset 0 0 0 1px rgba(59, 255, 193, 0.22);
}

.recent li .chev {
  transition: color 0.16s ease, transform 0.16s ease;
}

.recent li[data-t]:hover .chev {
  color: var(--mint);
  transform: translateX(2px);
}

/* ---------------- 首屏选择态 ---------------- */
/* 由 head 里的同步脚本把已保存的值写到 html 上，第一帧就是对的 */

html[data-dur="30"] #duration-picker .chip[data-duration="30"],
html[data-dur="60"] #duration-picker .chip[data-duration="60"],
html[data-dur="90"] #duration-picker .chip[data-duration="90"],
html[data-intv="30"] #reminder-intervals .chip[data-min="30"],
html[data-intv="60"] #reminder-intervals .chip[data-min="60"],
html[data-intv="90"] #reminder-intervals .chip[data-min="90"] {
  color: #04120d;
  background: var(--mint);
  border-color: var(--mint);
  box-shadow: 0 0 30px rgba(59, 255, 193, 0.3);
}
