/* ============================================================
   专升本 · 打卡  |  样式表
   移动优先 / iOS 风格 / 支持深色模式与安全区
   ============================================================ */

:root {
  --bg: #f3f4f9;
  --bg-soft: #e9ebf3;
  --card: #ffffff;
  --card-2: #f5f6fb;
  --text: #14161c;
  --text-2: #575d68;
  --muted: #8d93a0;
  --line: rgba(18, 22, 34, 0.075);
  --line-strong: rgba(18, 22, 34, 0.14);
  --shadow: 0 1px 2px rgba(16, 20, 32, 0.04), 0 10px 26px -16px rgba(16, 20, 32, 0.28);
  --study: #6c5ce7;
  --study-2: #9686ff;
  --study-soft: rgba(108, 92, 231, 0.11);
  --fit: #16b98a;
  --fit-2: #46d9ae;
  --fit-soft: rgba(22, 185, 138, 0.12);
  --warn: #ff9f45;
  --danger: #ff5a5f;
  --accent: var(--study);
  --accent-2: var(--study-2);
  --tab-bg: rgba(243, 244, 249, 0.82);
  --radius: 20px;
  --tab-h: 58px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

[data-theme="dark"] {
  --bg: #0c0e13;
  --bg-soft: #161a22;
  --card: #171a21;
  --card-2: #1e222b;
  --text: #f1f3f8;
  --text-2: #c3c9d4;
  --muted: #868d9b;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 12px 30px -18px rgba(0, 0, 0, 0.8);
  --study: #8677ff;
  --study-2: #a99bff;
  --study-soft: rgba(134, 119, 255, 0.16);
  --fit: #2fd3a1;
  --fit-2: #63e6bd;
  --fit-soft: rgba(47, 211, 161, 0.15);
  --tab-bg: rgba(12, 14, 19, 0.78);
}

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

html {
  -webkit-text-size-adjust: 100%;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

button {
  font-family: inherit;
  color: inherit;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

button,
a {
  touch-action: manipulation;
}

h1,
h2,
h3,
p {
  margin: 0;
}

b,
.dial-time,
.cd-days b,
.stat b {
  font-variant-numeric: tabular-nums;
}

.app {
  max-width: 520px;
  margin: 0 auto;
  padding: 0 16px calc(var(--tab-h) + 34px + var(--safe-bottom));
}

.view {
  display: none;
}

.view.is-active {
  display: block;
  animation: viewIn 0.26s cubic-bezier(0.22, 0.61, 0.36, 1);
}

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

.muted {
  color: var(--muted);
  font-size: 12.5px;
}

.view-foot {
  margin: 26px 0 4px;
  text-align: center;
  font-size: 11.5px;
  color: var(--muted);
  opacity: 0.8;
  letter-spacing: 0.02em;
}

/* ---------------- 今日 ---------------- */

.hero {
  padding-top: calc(var(--safe-top) + 20px);
}

.hero-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

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

.hero-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.chip-streak {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 7px 12px 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-size: 12px;
  box-shadow: var(--shadow);
  transition: transform 0.15s;
}

.chip-streak:active {
  transform: scale(0.95);
}

.chip-streak .flame {
  font-size: 13px;
}

.chip-streak b {
  font-size: 15px;
  font-weight: 700;
}

.chip-streak .unit {
  color: var(--muted);
}

.countdown {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  margin-top: 16px;
  padding: 15px 16px;
  border: none;
  border-radius: var(--radius);
  overflow: hidden;
  text-align: left;
  color: #fff;
  background: linear-gradient(120deg, #5f4fe0 0%, #7b6bff 52%, #9a7bff 100%);
  box-shadow: 0 14px 30px -18px rgba(108, 92, 231, 0.9);
  transition: transform 0.16s;
}

[data-theme="dark"] .countdown {
  background: linear-gradient(120deg, #4a3ec4 0%, #6a5ae0 52%, #8168f0 100%);
}

.countdown:active {
  transform: scale(0.985);
}

.countdown::after {
  content: "";
  position: absolute;
  right: -46px;
  top: -62px;
  width: 148px;
  height: 148px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0) 66%);
  pointer-events: none;
}

.cd-days {
  display: flex;
  align-items: baseline;
  gap: 2px;
  min-width: 74px;
}

.cd-days b {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}

.cd-days span {
  font-size: 12px;
  opacity: 0.82;
}

.cd-text {
  flex: 1;
  min-width: 0;
}

.cd-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cd-sub {
  font-size: 11.5px;
  opacity: 0.78;
  margin-top: 1px;
}

.cd-edit {
  flex: 0 0 auto;
  font-size: 11.5px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.rings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.ring-card {
  padding: 13px 14px 14px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.rc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.rc-label {
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}

.rc-label i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c);
}

.rc-goal {
  font-size: 11px;
  color: var(--muted);
}

.rc-ring {
  position: relative;
  width: 96px;
  height: 96px;
  margin: 8px auto 6px;
}

.rc-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-track {
  fill: none;
  stroke: var(--line);
  stroke-width: 8;
}

.ring-bar {
  fill: none;
  stroke: var(--c);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.55s cubic-bezier(0.4, 0, 0.2, 1);
}

.rc-val {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 1px;
  padding-top: 34px;
}

.rc-val b {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.rc-val small {
  font-size: 10.5px;
  color: var(--muted);
}

.rc-foot {
  text-align: center;
  font-size: 11.5px;
  color: var(--muted);
}

.rc-foot.is-done {
  color: var(--c);
  font-weight: 600;
}

.quick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.quick-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
  text-align: left;
  transition: transform 0.14s;
}

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

.q-ico {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 12px;
  font-size: 17px;
}

.quick-study .q-ico {
  background: var(--study-soft);
}

.quick-fit .q-ico {
  background: var(--fit-soft);
}

.q-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.q-main b {
  font-size: 13.5px;
  font-weight: 600;
}

.q-main small {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

/* ---------------- 通用卡片 ---------------- */

.card {
  margin-top: 14px;
  padding: 15px 16px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.card-head h2 {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.card-head-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mini-btn {
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card-2);
  font-size: 12px;
  color: var(--text-2);
  transition: transform 0.14s;
}

.mini-btn:active {
  transform: scale(0.94);
}

.empty {
  padding: 20px 6px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}

.empty .em {
  display: block;
  font-size: 22px;
  margin-bottom: 6px;
  opacity: 0.85;
}

/* ---------------- 记录条 ---------------- */

.rec-list {
  margin-top: 2px;
}

.rec {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.rec:last-child {
  border-bottom: none;
  padding-bottom: 2px;
}

.rec-ico {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 11px;
  font-size: 16px;
  background: var(--rc-soft, var(--card-2));
}

.rec-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.rec-main b {
  font-size: 13.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rec-main small {
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rec-min {
  display: flex;
  align-items: baseline;
  gap: 1px;
  flex: 0 0 auto;
}

.rec-min b {
  font-size: 16px;
  font-weight: 700;
}

.rec-min small {
  font-size: 10.5px;
  color: var(--muted);
}

.rec-del {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  opacity: 0.6;
}

.rec-del:active {
  background: var(--card-2);
}

/* ---------------- 任务 ---------------- */

.task-form {
  display: flex;
  gap: 8px;
  margin: 8px 0 4px;
}

.task-form input {
  flex: 1;
  min-width: 0;
  padding: 10px 13px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: var(--card-2);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
}

.task-form input::placeholder {
  color: var(--muted);
  font-size: 13.5px;
}

.task-form input:focus {
  outline: none;
  border-color: var(--study);
  background: var(--card);
}

.task-form button {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 12px;
  background: var(--study-soft);
  color: var(--study);
  font-size: 19px;
  font-weight: 600;
}

.task-form button:active {
  transform: scale(0.94);
}

.task-list {
  margin-top: 2px;
}

.task {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.task:last-child {
  border-bottom: none;
}

.tick {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border-radius: 50%;
  border: 1.6px solid var(--line-strong);
  background: transparent;
  display: grid;
  place-items: center;
  color: transparent;
  font-size: 12px;
  font-weight: 700;
  transition: all 0.18s;
}

.task.done .tick {
  background: var(--study);
  border-color: var(--study);
  color: #fff;
}

.t-text {
  flex: 1;
  font-size: 14px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.task.done .t-text {
  color: var(--muted);
  text-decoration: line-through;
}

/* ---------------- 专注 ---------------- */

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: calc(var(--safe-top) + 18px);
  margin-bottom: 14px;
}

.page-head h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.view[data-view="focus"] {
  --accent: var(--study);
  --accent-2: var(--study-2);
}

.view[data-view="focus"][data-kind="fitness"] {
  --accent: var(--fit);
  --accent-2: var(--fit-2);
}

.seg {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 12px;
  background: var(--bg-soft);
}

.seg button {
  border: none;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: 9px;
  transition: all 0.18s;
  white-space: nowrap;
}

.seg button.on {
  background: var(--card);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(16, 20, 32, 0.12);
}

.seg-kind {
  margin-bottom: 14px;
}

.seg-kind button {
  flex: 1;
  padding: 9px 0;
  font-size: 14px;
}

.seg-range button {
  padding: 6px 9px;
  font-size: 12px;
}

.seg-mode {
  margin: 12px 0 18px;
}

.seg-mode button {
  flex: 1;
  padding: 8px 0;
}

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 0 -16px;
  padding: 2px 16px 6px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 13px;
  color: var(--text-2);
  transition: all 0.18s;
}

.chip.on {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 18px -10px var(--accent);
  font-weight: 600;
}

.chip .em {
  font-size: 13.5px;
}

.dial-wrap {
  position: relative;
  width: min(272px, 74vw);
  aspect-ratio: 1 / 1;
  margin: 16px auto 6px;
}

.dial {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  overflow: visible;
}

.dial-track {
  fill: none;
  stroke: var(--line);
  stroke-width: 11;
}

.dial-bar {
  fill: none;
  stroke: var(--accent);
  stroke-width: 11;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.3s linear, stroke 0.2s;
  filter: drop-shadow(0 0 8px color-mix(in srgb, var(--accent) 45%, transparent));
}

.dial-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.dial-time {
  font-size: 46px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--text);
}

.dial-sub {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.dial-wrap.is-running .dial-sub {
  color: var(--accent);
  font-weight: 600;
}

.controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn {
  height: 52px;
  border: none;
  border-radius: 16px;
  font-size: 15px;
  font-weight: 600;
  transition: transform 0.14s, opacity 0.2s;
}

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

.btn-ghost {
  flex: 0 0 auto;
  min-width: 68px;
  padding: 0 14px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text-2);
  font-size: 14px;
  box-shadow: var(--shadow);
}

.btn-ghost.is-on {
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 700;
}

.btn-primary {
  flex: 1;
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 14px 26px -14px var(--accent);
}

.btn-primary.is-running {
  background: linear-gradient(135deg, #ff9f45, #ffb86b);
  box-shadow: 0 14px 26px -14px #ff9f45;
}

.tip {
  margin-top: 14px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

/* ---------------- 统计 ---------------- */

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat {
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.stat .s-label {
  font-size: 11.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat b {
  display: block;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 2px;
}

.stat b small {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  margin-left: 2px;
}

.chart {
  margin: 6px -4px 0;
}

.chart svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.legend {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--muted);
}

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

.dot {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  display: inline-block;
}

.dot-study {
  background: var(--study);
}

.dot-fit {
  background: var(--fit);
}

.bars {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.bar-row .b-top {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  margin-bottom: 5px;
}

.bar-row .b-top span:first-child {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text-2);
}

.bar-row .b-top b {
  font-weight: 600;
  font-size: 12.5px;
}

.bar-track {
  height: 8px;
  border-radius: 99px;
  background: var(--bg-soft);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--c);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.heat {
  display: flex;
  gap: 3px;
  margin-top: 12px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.heat::-webkit-scrollbar {
  display: none;
}

.heat-days {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 0 0 auto;
  padding-top: 0;
}

.heat-days span {
  height: 12px;
  font-size: 9px;
  color: var(--muted);
  line-height: 12px;
  width: 14px;
  text-align: left;
}

.heat-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 0 0 auto;
}

.cell {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: var(--bg-soft);
}

.cell.l1 {
  background: rgba(108, 92, 231, 0.22);
}

.cell.l2 {
  background: rgba(108, 92, 231, 0.42);
}

.cell.l3 {
  background: rgba(108, 92, 231, 0.66);
}

.cell.l4 {
  background: rgba(108, 92, 231, 0.86);
}

.cell.l5 {
  background: var(--study);
}

[data-theme="dark"] .cell.l1 {
  background: rgba(134, 119, 255, 0.24);
}
[data-theme="dark"] .cell.l2 {
  background: rgba(134, 119, 255, 0.44);
}
[data-theme="dark"] .cell.l3 {
  background: rgba(134, 119, 255, 0.66);
}
[data-theme="dark"] .cell.l4 {
  background: rgba(134, 119, 255, 0.85);
}

.heat-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 8px;
  font-size: 10px;
  color: var(--muted);
}

.badges {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px 6px;
  margin-top: 12px;
}

.badge {
  text-align: center;
  opacity: 0.34;
  filter: grayscale(1);
  transition: all 0.3s;
}

.badge.got {
  opacity: 1;
  filter: none;
}

.badge .b-ico {
  font-size: 23px;
  line-height: 1.2;
}

.badge .b-name {
  font-size: 10px;
  color: var(--text-2);
  margin-top: 2px;
  line-height: 1.3;
}

/* ---------------- 我的 ---------------- */

.profile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border-radius: var(--radius);
  color: #fff;
  background: linear-gradient(120deg, #5a4bdb 0%, #7d6cff 55%, #9b7dff 100%);
  box-shadow: 0 16px 34px -20px rgba(108, 92, 231, 0.95);
  overflow: hidden;
  position: relative;
}

[data-theme="dark"] .profile {
  background: linear-gradient(120deg, #4437b8 0%, #6152d8 55%, #7a5fe0 100%);
}

.profile::after {
  content: "";
  position: absolute;
  right: -30px;
  bottom: -60px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.22), transparent 68%);
}

.avatar {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  border-radius: 50%;
  font-size: 22px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.2);
  border: 1.5px solid rgba(255, 255, 255, 0.36);
}

.p-info h2 {
  font-size: 17px;
  font-weight: 700;
}

.p-info p {
  font-size: 11.5px;
  opacity: 0.82;
  margin-top: 2px;
}

.list-card {
  padding: 2px 16px;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 13px 0;
  border: none;
  background: none;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 14.5px;
}

.row:last-child {
  border-bottom: none;
}

.row .r-left {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.row .r-ico {
  font-size: 15px;
  width: 18px;
  text-align: center;
}

.row .r-val {
  color: var(--muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}

.row .chev {
  color: var(--muted);
  opacity: 0.5;
  font-size: 16px;
  margin-left: 2px;
}

.link-card {
  padding: 2px 16px;
}

.link-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 0;
  border: none;
  background: none;
  font-size: 14.5px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.link-row:last-child {
  border-bottom: none;
}

/* 开关 */
.switch {
  position: relative;
  width: 44px;
  height: 27px;
  flex: 0 0 44px;
  border-radius: 99px;
  background: var(--line-strong);
  border: none;
  padding: 0;
  transition: background 0.22s;
}

.switch::after {
  content: "";
  position: absolute;
  top: 2.5px;
  left: 2.5px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.22s cubic-bezier(0.3, 1.3, 0.5, 1);
}

.switch.on {
  background: var(--fit);
}

.switch.on::after {
  transform: translateX(17px);
}

/* ---------------- 标签栏 ---------------- */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  max-width: 520px;
  margin: 0 auto;
  padding: 7px 10px calc(7px + var(--safe-bottom));
  background: var(--tab-bg);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
  border-top: 1px solid var(--line);
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 3px 0 1px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.02em;
  transition: color 0.18s, transform 0.12s;
}

.tab svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tab.is-on {
  color: var(--study);
}

.tab:active {
  transform: scale(0.94);
}

/* ---------------- 弹层 ---------------- */

.sheet-mask {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(8, 10, 16, 0);
  transition: background 0.26s;
}

.sheet-mask.in {
  background: rgba(8, 10, 16, 0.46);
}

.sheet {
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 18px calc(18px + var(--safe-bottom));
  background: var(--card);
  border-radius: 24px 24px 0 0;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.24);
}

.sheet-mask.in .sheet {
  transform: none;
}

.sheet-grab {
  width: 38px;
  height: 4px;
  border-radius: 99px;
  background: var(--line-strong);
  margin: 6px auto 14px;
}

.sheet h3 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.sheet-sub {
  font-size: 12.5px;
  color: var(--muted);
  margin: 4px 0 16px;
  line-height: 1.6;
}

.f {
  margin-bottom: 12px;
}

.f > label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 6px 3px;
}

.f input,
.f select,
.f textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
}

.f textarea {
  min-height: 76px;
  resize: vertical;
  font-size: 15px;
}

.f input:focus,
.f select:focus,
.f textarea:focus {
  outline: none;
  border-color: var(--study);
  background: var(--card);
}

/* iOS 日期控件保留原生外观，避免显示异常 */
.f input[type="date"],
.f input[type="file"] {
  -webkit-appearance: auto;
  appearance: auto;
}

.f .hint {
  font-size: 11.5px;
  color: var(--muted);
  margin: 6px 0 0 3px;
}

.f-row {
  display: flex;
  gap: 10px;
}

.f-row .f {
  flex: 1;
  min-width: 0;
}

.color-pick {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  padding: 2px 2px 0;
}

.color-pick button {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid transparent;
  background-clip: content-box;
  padding: 2px;
}

.color-pick button.on {
  border-color: var(--text);
}

.sheet-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.btn-sheet {
  flex: 1;
  height: 50px;
  border: none;
  border-radius: 15px;
  background: var(--card-2);
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  transition: transform 0.14s;
}

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

.btn-sheet.primary {
  background: linear-gradient(135deg, var(--study), var(--study-2));
  color: #fff;
  box-shadow: 0 12px 24px -14px var(--study);
}

.btn-sheet.danger {
  background: rgba(255, 90, 95, 0.12);
  color: var(--danger);
}

.btn-sheet.ghost {
  background: var(--card-2);
  color: var(--text-2);
}

.sheet-stack {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 16px;
}

.sheet-note {
  margin-top: 14px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.75;
  background: var(--card-2);
  border-radius: 14px;
  padding: 12px 14px;
}

.sheet-note b {
  color: var(--text-2);
}

.ol {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.9;
  color: var(--text-2);
}

.ol li::marker {
  color: var(--muted);
}

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

#toast-root {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--tab-h) + 26px + var(--safe-bottom));
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  max-width: 84%;
  padding: 10px 16px;
  border-radius: 13px;
  background: rgba(22, 24, 32, 0.93);
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  animation: toastIn 0.26s cubic-bezier(0.2, 1.2, 0.4, 1);
  box-shadow: 0 10px 26px -12px rgba(0, 0, 0, 0.6);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.toast.out {
  animation: toastOut 0.22s forwards;
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* ---------------- 其它 ---------------- */

.spin {
  animation: spin 1s linear infinite;
}

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

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

@media (min-width: 600px) {
  body {
    background: var(--bg-soft);
  }
  .app {
    background: var(--bg);
    min-height: 100vh;
    box-shadow: 0 0 60px -20px rgba(0, 0, 0, 0.18);
  }
  .tabbar {
    border-radius: 0;
  }
}
