/* 定睛 · 基础样式与页面组件
   无第三方依赖；所有颜色走 theme.css 令牌。 */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
}

a {
  color: inherit;
  text-decoration: none;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 70%, transparent);
  outline-offset: 4px;
  border-radius: 8px;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- 顶栏 ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, #fff 86%, transparent);
  backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1040px;
  margin: 0 auto;
  height: 64px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--gaze-soft);
  color: var(--gaze);
  display: grid;
  place-items: center;
  flex: none;
}

.brand-mark svg {
  width: 16px;
  height: 16px;
}

.brand-name {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.6px;
}

.brand-sub {
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--text-3);
  margin-left: 2px;
  white-space: nowrap;
}

.nav {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
}

.nav a {
  color: var(--text-2);
  padding: 8px 12px;
  border-radius: 99px;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}

.nav a:hover {
  color: var(--text);
  background: var(--surface-2);
}

.nav a[aria-current="page"] {
  color: var(--text);
  background: var(--surface-2);
  font-weight: 550;
}

.nav-account {
  border: 1px solid var(--line-strong) !important;
  padding: 7px 14px !important;
  margin-left: 4px;
  color: var(--text) !important;
}

.nav-account.is-user {
  border-color: transparent !important;
  background: var(--green-soft) !important;
  color: var(--green-ink) !important;
}

.nav-account .dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  margin-right: 6px;
  vertical-align: 1px;
}

/* ---------- 通用布局 ---------- */

.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 56px 24px 88px;
}

.page.wide {
  max-width: 1000px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}

.page-head h1 {
  font-size: clamp(30px, 4.4vw, 42px);
  font-weight: 650;
  letter-spacing: -0.045em;
  line-height: 1.15;
  margin: 0;
}

.page-head p {
  margin: 8px 0 0;
  font-size: 13.5px;
  color: var(--text-2);
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--text-3);
  margin: 0 0 14px;
}

.section-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.4px;
  margin: 0;
}

.section-note {
  font-size: 11.5px;
  color: var(--text-3);
  margin: 6px 0 0;
}

/* ---------- 按钮 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border-radius: var(--pill);
  padding: 13px 24px;
  font-size: 14px;
  font-weight: 550;
  transition: transform 0.15s, background 0.15s, border-color 0.15s;
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-quiet {
  border-color: var(--line-strong);
  color: var(--text-2);
  background: transparent;
}

.btn-quiet:hover {
  color: var(--text);
  border-color: var(--text-3);
}

.btn-ink {
  background: var(--text);
  color: var(--bg);
}

.btn-ink:hover {
  opacity: 0.88;
}

.btn-danger {
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  color: var(--danger);
  background: transparent;
}

.btn-danger:hover {
  background: color-mix(in srgb, var(--danger) 6%, transparent);
}

.btn-small {
  padding: 9px 16px;
  font-size: 12px;
}

.btn-block {
  width: 100%;
}

.text-link {
  font-size: 13px;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
}

.text-link:hover {
  text-decoration: underline;
}

/* ---------- 首页 ---------- */

.home-hero {
  padding: 58px 24px 0;
  max-width: 820px;
  margin: 0 auto;
}

.home-intro {
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--text-3);
  margin: 0 0 18px;
}

.target-card {
  position: relative;
  display: grid;
  grid-template-columns: 1.12fr 0.88fr;
  align-items: center;
  gap: 18px;
  background: var(--surface-2);
  border-radius: var(--radius-lg);
  padding: 46px 44px 42px;
  overflow: hidden;
  min-height: 330px;
  box-shadow: var(--shadow-sm);
}

.target-copy {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.target-copy .day {
  font-size: 12.5px;
  color: var(--text-3);
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 9px;
}

.day-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 4px 10px;
  font-size: 11px;
  color: var(--text-2);
}

.target-number {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0;
  line-height: 0.95;
}

.target-number .num {
  font-size: clamp(58px, 9vw, 92px);
  font-weight: 650;
  letter-spacing: -0.06em;
  font-variant-numeric: tabular-nums;
}

.target-number .unit {
  font-size: 19px;
  color: var(--text-2);
  font-weight: 500;
}

.target-note {
  font-size: 13px;
  color: var(--text-2);
  margin: 16px 0 0;
  line-height: 1.75;
  max-width: 250px;
}

.target-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 30px;
  flex-wrap: wrap;
}

.today-line {
  margin: 18px 0 0;
  font-size: 12px;
  color: var(--green-ink);
  display: flex;
  align-items: center;
  gap: 7px;
}

.today-line .tick {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 10px;
  flex: none;
}

.target-visual {
  position: relative;
  justify-self: center;
  width: min(260px, 30vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  flex: none;
}

.visual-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid var(--gaze-line);
}

.visual-ring.a {
  inset: 0;
}

.visual-ring.b {
  inset: 15%;
  border-color: color-mix(in srgb, var(--green) 42%, transparent);
  border-width: 1.5px;
}

.visual-ring.c {
  inset: 30%;
  border-color: var(--gaze-line);
}

.visual-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--gaze);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--gaze) 6%, transparent);
}

.visual-caption {
  position: absolute;
  bottom: -4px;
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: 0.05em;
}

.home-note {
  margin: 22px auto 0;
  max-width: 820px;
  padding: 0 24px;
}

.home-note-card {
  border: 1px solid var(--line);
  background: color-mix(in srgb, #fff 60%, transparent);
  border-radius: 18px;
  padding: 18px 22px;
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--text-2);
}

.home-note-card b {
  color: var(--text);
  font-weight: 600;
}

.home-links {
  display: flex;
  align-items: center;
  gap: 22px;
  margin: 26px auto 0;
  max-width: 820px;
  padding: 0 24px;
  font-size: 12.5px;
  color: var(--text-3);
  flex-wrap: wrap;
}

.home-links a {
  color: var(--accent);
}

.home-links a:hover {
  text-decoration: underline;
}

.foot-note {
  max-width: 820px;
  margin: 64px auto 0;
  padding: 26px 24px 0;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.8;
}

/* ---------- 进度 ---------- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 20px 20px 17px;
  border: 1px solid var(--line);
}

.stat-card .label {
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.03em;
}

.stat-card .value {
  font-size: 30px;
  font-weight: 650;
  letter-spacing: -0.045em;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.stat-card .value small {
  font-size: 12px;
  font-weight: 450;
  color: var(--text-2);
  margin-left: 4px;
  letter-spacing: 0;
}

.stat-card .sub {
  font-size: 10.5px;
  color: var(--text-3);
  margin-top: 5px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 24px 20px;
  margin-bottom: 18px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.legend {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 10.5px;
  color: var(--text-3);
  flex-wrap: wrap;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--green);
}

.legend i.line {
  height: 2px;
  width: 12px;
  border-radius: 2px;
  background: var(--gaze);
}

.chart {
  width: 100%;
  height: auto;
  touch-action: pan-y;
}

.chart text {
  font-family: var(--font);
  fill: var(--text-3);
}

.chart .axis {
  stroke: var(--line);
}

.chart .bar {
  fill: var(--green);
  opacity: 0.82;
}

.chart .bar.target {
  fill: var(--green);
  opacity: 0.18;
}

.chart .refocus-line {
  stroke: var(--gaze);
  stroke-width: 1.2;
  fill: none;
  opacity: 0.75;
}

.chart .refocus-dot {
  fill: var(--gaze);
  r: 2.2;
}

.chart .steady-line {
  stroke: var(--gaze);
  stroke-width: 1.4;
  fill: none;
}

.chart .empty-line {
  stroke: var(--line-strong);
  stroke-dasharray: 4 6;
  fill: none;
}

.empty-state {
  padding: 26px 0 20px;
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.9;
}

.empty-state a {
  color: var(--accent);
}

.heat-wrap {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 8px;
  align-items: start;
}

.weekday-labels {
  display: grid;
  grid-template-rows: repeat(7, 1fr);
  gap: 5px;
  font-size: 9px;
  color: var(--text-3);
  padding-top: 0;
}

.weekday-labels span {
  height: 16px;
  line-height: 16px;
}

.heat-grid {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, 1fr);
  gap: 5px;
  justify-content: start;
}

.heat-cell {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid transparent;
}

.heat-cell[data-level="1"] {
  background: #e7eddf;
}

.heat-cell[data-level="2"] {
  background: #cbdab9;
}

.heat-cell[data-level="3"] {
  background: #a3bd8c;
}

.heat-cell[data-level="4"] {
  background: var(--green);
}

.heat-cell.today {
  border-color: var(--gaze);
}

.heat-cell.future {
  opacity: 0.35;
}

.heat-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--text-3);
  margin-top: 14px;
}

.heat-legend .heat-cell {
  width: 12px;
  height: 12px;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.data-note {
  font-size: 10.5px;
  color: var(--text-3);
  margin: 10px 0 0;
  line-height: 1.7;
}

/* ---------- 设置 ---------- */

.settings-stack {
  display: grid;
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 24px;
}

.card-head {
  padding: 20px 0 12px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.card-head h2 {
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: -0.3px;
  margin: 0;
}

.card-head span {
  font-size: 10.5px;
  color: var(--text-3);
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

.row:first-of-type {
  border-top: 0;
}

.row .row-label {
  min-width: 0;
}

.row .row-label strong {
  display: block;
  font-size: 13px;
  font-weight: 550;
  letter-spacing: -0.1px;
}

.row .row-label small {
  display: block;
  font-size: 11px;
  color: var(--text-3);
  margin-top: 3px;
  line-height: 1.6;
}

.row .row-control {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

.target-readonly {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 20px 0 6px;
}

.target-readonly .num {
  font-size: 46px;
  font-weight: 650;
  letter-spacing: -0.05em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.target-readonly .unit {
  font-size: 14px;
  color: var(--text-2);
}

.formula {
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.8;
  margin: 0 0 18px;
  padding: 10px 14px;
  background: var(--surface-2);
  border-radius: 10px;
}

.formula code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10.5px;
  color: var(--text-2);
}

.segmented {
  display: inline-flex;
  background: var(--surface-2);
  border-radius: 99px;
  padding: 3px;
  gap: 2px;
}

.segmented button {
  padding: 7px 13px;
  border-radius: 99px;
  font-size: 11.5px;
  color: var(--text-2);
  transition: background 0.15s, color 0.15s;
}

.segmented button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  font-weight: 550;
}

.slider-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.slider-wrap input[type="range"] {
  width: 132px;
  accent-color: var(--gaze);
}

.dot-preview {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--train-bg);
  display: grid;
  place-items: center;
  flex: none;
}

.dot-preview i {
  display: block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--train-dot);
}

.swatches {
  display: flex;
  gap: 8px;
}

.swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.swatch[aria-pressed="true"] {
  border-color: var(--gaze);
}

.switch {
  position: relative;
  width: 44px;
  height: 26px;
  border-radius: 99px;
  background: #d6d6dc;
  transition: background 0.18s;
  flex: none;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.18s;
}

.switch[aria-checked="true"] {
  background: var(--green);
}

.switch[aria-checked="true"]::after {
  transform: translateX(18px);
}

.account-line {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.account-line .state {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

.danger-card {
  border-color: color-mix(in srgb, var(--danger) 18%, transparent);
}

/* ---------- 登录 / 注册 ---------- */

.auth-page {
  min-height: calc(100dvh - 64px);
  display: grid;
  place-items: center;
  padding: 40px 20px 60px;
}

.auth-card {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 34px 32px 30px;
  box-shadow: var(--shadow);
}

.auth-head {
  text-align: center;
  margin-bottom: 24px;
}

.auth-head h1 {
  font-size: 24px;
  letter-spacing: -0.04em;
  margin: 0 0 8px;
  font-weight: 650;
}

.auth-head p {
  font-size: 12px;
  color: var(--text-2);
  margin: 0;
  line-height: 1.75;
}

.auth-tabs {
  display: flex;
  background: var(--surface-2);
  border-radius: 99px;
  padding: 3px;
  margin-bottom: 22px;
}

.auth-tabs button {
  flex: 1;
  padding: 9px;
  border-radius: 99px;
  font-size: 12.5px;
  color: var(--text-2);
}

.auth-tabs button[aria-selected="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  font-weight: 550;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 11.5px;
  color: var(--text-2);
  margin-bottom: 7px;
}

.input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}

.strength {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.strength-bars {
  display: flex;
  gap: 3px;
  flex: 1;
}

.strength-bars i {
  height: 3px;
  flex: 1;
  border-radius: 2px;
  background: var(--line);
  transition: background 0.15s;
}

.strength[data-level="1"] i:nth-child(1),
.strength[data-level="2"] i:nth-child(-n + 2),
.strength[data-level="3"] i {
  background: var(--green);
}

.strength small {
  font-size: 10px;
  color: var(--text-3);
  min-width: 54px;
  text-align: right;
}

.auth-note {
  font-size: 10.5px;
  color: var(--text-3);
  line-height: 1.8;
  margin: 14px 0 0;
}

.form-error {
  font-size: 11.5px;
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 7%, transparent);
  border-radius: 10px;
  padding: 9px 12px;
  margin: 0 0 16px;
  line-height: 1.6;
}

.auth-foot {
  text-align: center;
  font-size: 11px;
  color: var(--text-3);
  margin-top: 18px;
}

.auth-submit {
  margin-top: 18px;
}

.auth-foot a {
  color: var(--accent);
}

/* ---------- 小结 ---------- */

.summary-page {
  min-height: calc(100dvh - 64px);
  display: grid;
  place-items: center;
  padding: 48px 20px 70px;
}

.summary-card {
  width: min(600px, 100%);
  text-align: center;
}

.summary-mark {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  margin: 0 auto 26px;
  display: grid;
  place-items: center;
  background: var(--green-soft);
  color: var(--green-ink);
  font-size: 24px;
}

.summary-mark.aborted {
  background: var(--surface-2);
  color: var(--text-2);
}

.summary-eyebrow {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-3);
  margin: 0 0 14px;
}

.summary-headline {
  font-size: clamp(28px, 4.6vw, 40px);
  font-weight: 650;
  letter-spacing: -0.045em;
  line-height: 1.25;
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.summary-facts {
  margin: 30px auto 0;
  max-width: 380px;
  display: grid;
  gap: 0;
}

.fact-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 2px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.fact-row span {
  color: var(--text-3);
}

.fact-row strong {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.fact-row .delta {
  font-size: 10.5px;
  color: var(--green-ink);
  margin-left: 8px;
  font-weight: 450;
}

.fact-row .delta.down {
  color: var(--text-3);
}

.summary-next {
  font-size: 12px;
  color: var(--text-2);
  margin: 22px 0 0;
  line-height: 1.8;
}

.summary-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 34px;
  flex-wrap: wrap;
}

/* ---------- 训练台 ---------- */

.train-page {
  background: var(--train-bg);
  color: var(--train-text);
  height: 100dvh;
  overflow: hidden;
}

.train {
  position: fixed;
  inset: 0;
  display: block;
  transition: background 0.25s;
}

.train-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(20px, env(safe-area-inset-top)) 26px 0;
  gap: 16px;
}

.train-brand {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.4px;
  color: var(--train-text);
  opacity: 0.9;
}

.train-meta {
  font-size: 11.5px;
  color: var(--train-muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.train-hint {
  position: absolute;
  top: max(52px, calc(env(safe-area-inset-top) + 46px));
  left: 26px;
  z-index: 4;
  font-size: 11.5px;
  color: var(--train-muted);
  margin: 0;
  letter-spacing: 0.02em;
}

.focus {
  position: absolute;
  width: var(--ring-size, 420px);
  height: var(--ring-size, 420px);
  transform: translate(-50%, -50%);
  transition: left 0.4s ease, top 0.4s ease;
  z-index: 2;
}

.focus .ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.focus .ring circle {
  fill: none;
  vector-effect: non-scaling-stroke;
}

.ring-track {
  stroke: var(--train-track);
  stroke-width: 1.2;
}

.ring-progress {
  stroke: var(--train-ring);
  stroke-width: 2.2;
  stroke-linecap: round;
  transform-origin: 50% 50%;
  transition: stroke-dashoffset 0.12s linear;
}

.focus .dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--dot-size, 12px);
  height: var(--dot-size, 12px);
  margin: calc(var(--dot-size, 12px) / -2) 0 0 calc(var(--dot-size, 12px) / -2);
  border-radius: 50%;
  background: var(--dot-color, var(--train-dot));
  box-shadow: 0 0 20px color-mix(in srgb, var(--dot-color, var(--train-dot)) 38%, transparent);
}

.focus .time {
  position: absolute;
  left: 50%;
  top: calc(100% - 46px);
  transform: translateX(-50%);
  font-size: 12px;
  color: var(--train-muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.train-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 0 26px calc(22px + env(safe-area-inset-bottom));
}

.key-hint {
  font-size: 10.5px;
  color: var(--train-muted);
  line-height: 1.9;
  letter-spacing: 0.02em;
  max-width: 190px;
}

.refocus-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: 99px;
  border: 1px solid var(--train-line);
  background: var(--train-surface);
  color: var(--train-text);
  font-size: 13px;
  transition: transform 0.12s, background 0.15s;
  backdrop-filter: blur(10px);
}

.refocus-btn:hover {
  background: color-mix(in srgb, var(--train-text) 10%, transparent);
}

.refocus-btn:active {
  transform: scale(0.97);
}

.refocus-btn .glyph {
  font-size: 15px;
  line-height: 1;
  color: var(--train-ring);
}

.refocus-btn .count {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  min-width: 14px;
  text-align: center;
}

.refocus-btn.pulse .count {
  animation: countPulse 0.3s ease;
}

@keyframes countPulse {
  50% {
    transform: translateY(-2px) scale(1.12);
  }
}

.train-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ghost-btn {
  padding: 10px 14px;
  border-radius: 99px;
  font-size: 11.5px;
  color: var(--train-muted);
  border: 1px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.ghost-btn:hover {
  color: var(--train-text);
  border-color: var(--train-line);
}

.veil {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 28px;
  background: color-mix(in srgb, var(--train-bg) 86%, transparent);
  backdrop-filter: blur(18px);
  text-align: center;
}

.veil-inner {
  max-width: 360px;
}

.veil h2 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin: 0 0 10px;
}

.veil p {
  font-size: 12.5px;
  color: var(--train-muted);
  line-height: 1.9;
  margin: 0 0 26px;
}

.veil .btn-primary {
  background: var(--train-ring);
  color: #12140f;
  font-weight: 600;
}

.veil .btn-primary:hover {
  filter: brightness(1.08);
}

.veil .btn-quiet {
  border-color: var(--train-line);
  color: var(--train-text);
}

/* ---------- 通用组件 ---------- */

.dialog {
  border: 0;
  padding: 0;
  border-radius: 20px;
  width: min(420px, 92vw);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}

.dialog::backdrop {
  background: rgba(16, 18, 20, 0.5);
  backdrop-filter: blur(6px);
}

.dialog-body {
  padding: 26px 26px 22px;
}

.dialog-body h2 {
  font-size: 17px;
  letter-spacing: -0.3px;
  margin: 0 0 10px;
}

.dialog-body p {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.8;
  margin: 0 0 20px;
}

.dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(12px);
  background: rgba(29, 29, 31, 0.92);
  color: #fff;
  font-size: 12px;
  padding: 10px 18px;
  border-radius: 99px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 60;
  max-width: 86vw;
  text-align: center;
}

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

.sync-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  color: var(--text-3);
}

.sync-hint .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
}

/* ---------- 响应式 ---------- */

@media (max-width: 900px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .target-card {
    padding: 38px 32px 34px;
    grid-template-columns: 1.15fr 0.85fr;
  }

  .target-visual {
    width: min(210px, 26vw);
  }
}

@media (max-width: 650px) {
  .topbar-inner {
    height: 58px;
    padding: 0 18px;
  }

  .brand-sub {
    display: none;
  }

  .nav {
    gap: 0;
    font-size: 11.5px;
  }

  .nav a {
    padding: 7px 9px;
  }

  .nav-account {
    padding: 6px 11px !important;
  }

  .page {
    padding: 36px 18px 70px;
  }

  .home-hero {
    padding: 34px 18px 0;
  }

  .target-card {
    display: block;
    padding: 30px 26px 28px;
    min-height: 0;
    border-radius: 24px;
  }

  .target-visual {
    position: absolute;
    right: -6px;
    top: 8px;
    width: 132px;
    opacity: 0.6;
  }

  .visual-caption {
    display: none;
  }

  .target-number .num {
    font-size: clamp(56px, 15vw, 76px);
  }

  .target-note {
    max-width: 200px;
    font-size: 12px;
  }

  .target-actions {
    margin-top: 24px;
    gap: 10px;
  }

  .btn {
    padding: 12px 20px;
    font-size: 13px;
  }

  .home-note,
  .home-links,
  .foot-note {
    padding-left: 18px;
    padding-right: 18px;
  }

  .stats-grid {
    gap: 10px;
  }

  .stat-card {
    padding: 16px 16px 14px;
  }

  .stat-card .value {
    font-size: 25px;
  }

  .panel {
    padding: 20px 18px 16px;
    border-radius: 20px;
  }

  .page-head h1 {
    font-size: 30px;
  }

  .card {
    padding: 4px 18px;
    border-radius: 20px;
  }

  .row {
    align-items: flex-start;
    gap: 12px;
  }

  .row .row-control {
    width: 100%;
    justify-content: flex-start;
  }

  .slider-wrap {
    width: 100%;
    justify-content: space-between;
  }

  .auth-card {
    padding: 28px 22px 24px;
    border-radius: 22px;
  }

  .summary-card {
    padding: 0 4px;
  }

  .summary-actions {
    gap: 10px;
  }

  .train-top {
    padding: max(16px, env(safe-area-inset-top)) 18px 0;
  }

  .train-hint {
    top: max(46px, calc(env(safe-area-inset-top) + 40px));
    left: 18px;
    font-size: 10.5px;
  }

  .train-bottom {
    padding: 0 18px calc(18px + env(safe-area-inset-bottom));
    gap: 10px;
  }

  .refocus-btn {
    padding: 13px 18px;
  }

  .key-hint {
    display: none;
  }

  .focus .time {
    top: calc(100% + 12px);
    font-size: 11px;
  }
}

@media (max-width: 380px) {
  .nav a {
    padding: 6px 7px;
  }

  .nav-account {
    padding: 5px 9px !important;
  }

  .target-actions .btn {
    padding: 11px 16px;
    font-size: 12.5px;
  }

  .heat-cell {
    width: 16px;
    height: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .topbar,
  .veil,
  .refocus-btn {
    backdrop-filter: none;
  }

  .topbar {
    background: var(--surface);
  }

  .veil {
    background: var(--train-bg);
  }
}
