/* ---------- 颜色：Apple 系统色（浅色 / 深色） ---------- */
:root {
  color-scheme: light dark;

  --bg: #f2f2f7;
  --card: #ffffff;
  --card-2: #f2f2f7;
  --label: #000000;
  --label-2: rgba(60, 60, 67, 0.6);
  --label-3: rgba(60, 60, 67, 0.3);
  --sep: rgba(60, 60, 67, 0.29);
  --fill: rgba(120, 120, 128, 0.2);
  --fill-2: rgba(120, 120, 128, 0.16);
  --fill-3: rgba(118, 118, 128, 0.12);
  --hover: rgba(120, 120, 128, 0.08);
  --seg-on: #ffffff;

  --accent: #007aff;
  --red: #ff3b30;
  --orange: #ff9500;
  --yellow: #ffcc00;
  --green: #34c759;
  --teal: #30b0c7;
  --indigo: #5856d6;
  --purple: #af52de;
  --pink: #ff2d55;
  --gray: #8e8e93;

  --material: rgba(252, 252, 254, 0.72);
  --material-edge: rgba(0, 0, 0, 0.08);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 6px 20px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.04), 0 16px 40px rgba(0, 0, 0, 0.12);

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", system-ui, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, "Cascadia Mono", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --card: #1c1c1e;
    --card-2: #2c2c2e;
    --label: #ffffff;
    --label-2: rgba(235, 235, 245, 0.6);
    --label-3: rgba(235, 235, 245, 0.3);
    --sep: rgba(84, 84, 88, 0.65);
    --fill: rgba(120, 120, 128, 0.36);
    --fill-2: rgba(120, 120, 128, 0.32);
    --fill-3: rgba(118, 118, 128, 0.24);
    --hover: rgba(120, 120, 128, 0.16);
    --seg-on: #636366;
    --accent: #0a84ff;
    --red: #ff453a;
    --orange: #ff9f0a;
    --yellow: #ffd60a;
    --green: #30d158;
    --teal: #40c8e0;
    --indigo: #5e5ce6;
    --purple: #bf5af2;
    --pink: #ff375f;
    --material: rgba(36, 36, 38, 0.72);
    --material-edge: rgba(255, 255, 255, 0.1);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.3), 0 16px 40px rgba(0, 0, 0, 0.5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --card: #1c1c1e;
  --card-2: #2c2c2e;
  --label: #ffffff;
  --label-2: rgba(235, 235, 245, 0.6);
  --label-3: rgba(235, 235, 245, 0.3);
  --sep: rgba(84, 84, 88, 0.65);
  --fill: rgba(120, 120, 128, 0.36);
  --fill-2: rgba(120, 120, 128, 0.32);
  --fill-3: rgba(118, 118, 128, 0.24);
  --hover: rgba(120, 120, 128, 0.16);
  --seg-on: #636366;
  --accent: #0a84ff;
  --red: #ff453a;
  --orange: #ff9f0a;
  --yellow: #ffd60a;
  --green: #30d158;
  --teal: #40c8e0;
  --indigo: #5e5ce6;
  --purple: #bf5af2;
  --pink: #ff375f;
  --material: rgba(36, 36, 38, 0.72);
  --material-edge: rgba(255, 255, 255, 0.1);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.3), 0 16px 40px rgba(0, 0, 0, 0.5);
}
:root[data-theme="light"] { color-scheme: light; }

/* ---------- 基础 ---------- */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--label);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.38;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

body { transition: background-color 0.25s ease, color 0.25s ease; }

::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

button, input, select { font: inherit; color: inherit; letter-spacing: inherit; }

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 2px;
}

code {
  font-family: var(--mono);
  font-size: 0.88em;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--fill-3);
}

/* ---------- 页面骨架 ---------- */
.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 56px 28px 72px 104px;
}
@media (max-width: 640px) {
  .page { padding: 28px 16px 48px 76px; }
}

.large-title {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.01em;
}
.subtitle { margin: 0 0 8px; color: var(--label-2); font-size: 15px; max-width: 60ch; }

/* ---------- 分组列表（iOS 设置风格） ---------- */
.section-header {
  margin: 32px 0 7px;
  padding: 0 16px;
  font-size: 13px;
  color: var(--label-2);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.section-footer {
  margin: 0;
  padding: 7px 16px 0;
  font-size: 13px;
  color: var(--label-2);
  line-height: 1.4;
}

.group {
  background: var(--card);
  border-radius: var(--r);
  overflow: hidden;
}

.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  padding: 10px 16px;
  border: 0;
  background: none;
  color: var(--label);
  text-align: left;
  text-decoration: none;
  font-size: 16px;
}
.row + .row::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 16px;
  height: 0.5px;
  background: var(--sep);
}
.group.icons .row + .row::before { left: 58px; }
a.row, button.row { cursor: pointer; transition: background-color 0.12s; }
a.row:hover, button.row:hover { background: var(--hover); text-decoration: none; }
a.row:active, button.row:active { background: var(--fill-2); }

.row .icon {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: #fff;
}
.row .icon svg { width: 18px; height: 18px; }
.row .text { flex: 1; min-width: 0; }
.row .title { display: block; }
.row .detail { display: block; margin-top: 1px; font-size: 13px; color: var(--label-2); }
.row .value { flex: none; color: var(--label-2); font-size: 15px; }
.row .chev { flex: none; width: 8px; height: 14px; color: var(--label-3); }
.row.destructive { color: var(--red); }
.row.action { color: var(--accent); }

/* ---------- 控件 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: 0;
  border-radius: 10px;
  background: var(--fill-3);
  color: var(--accent);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.12s, filter 0.12s, transform 0.12s;
}
.btn:hover { background: var(--fill-2); text-decoration: none; }
.btn:active { transform: scale(0.97); }
.btn.filled { background: var(--accent); color: #fff; }
.btn.filled:hover { filter: brightness(1.08); }

.segmented {
  display: inline-flex;
  padding: 2px;
  border-radius: 9px;
  background: var(--fill-3);
}
.segmented button {
  min-width: 64px;
  padding: 5px 14px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--label);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.18s, box-shadow 0.18s;
}
.segmented button[aria-pressed="true"] {
  background: var(--seg-on);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
}

.select {
  appearance: none;
  -webkit-appearance: none;
  padding: 6px 30px 6px 12px;
  border: 0;
  border-radius: 8px;
  background: var(--fill-3) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 16'%3E%3Cpath d='M1.5 6 5 2.5 8.5 6M1.5 10 5 13.5 8.5 10' fill='none' stroke='%238e8e93' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 10px center / 8px 13px;
  color: var(--label);
  font-size: 15px;
  cursor: pointer;
}
.select option { background: var(--card); color: var(--label); }
