/* ============================================================
   6班点名器 · 基础样式（设计令牌 + 通用组件）
   风格：纯白背景 / 圆角 / 毛玻璃 / iOS 原生质感 / 无渐变
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; }
img, svg { display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { list-style: none; padding: 0; }

:root {
  color-scheme: light;

  /* 颜色 */
  --bg: #ffffff;
  --label: #1c1c1e;
  --label-2: rgba(60, 60, 67, 0.60);
  --label-3: rgba(60, 60, 67, 0.34);
  --sep: rgba(60, 60, 67, 0.10);
  --hairline: rgba(60, 60, 67, 0.14);
  --fill: rgba(120, 120, 128, 0.12);
  --fill-2: rgba(120, 120, 128, 0.07);
  --accent: #007aff;
  --accent-tint: rgba(0, 122, 255, 0.10);
  --danger: #ff3b30;
  --danger-tint: rgba(255, 59, 48, 0.10);
  --green: #34c759;

  /* 毛玻璃 */
  --glass: rgba(255, 255, 255, 0.70);
  --glass-strong: rgba(255, 255, 255, 0.86);

  /* 圆角 */
  --r-pill: 999px;
  --r-xl: 32px;
  --r-lg: 22px;
  --r-md: 14px;
  --r-sm: 10px;

  /* 阴影：低透明度、大扩散，像浮在纸面上 */
  --shadow-card: 0 1px 1px rgba(0, 0, 0, 0.02), 0 12px 32px -12px rgba(0, 0, 0, 0.13);
  --shadow-float: 0 2px 6px rgba(0, 0, 0, 0.04), 0 20px 48px -16px rgba(0, 0, 0, 0.18);
  --shadow-accent: 0 8px 24px -8px rgba(0, 122, 255, 0.55);

  /* 动效曲线：iOS 的弹性减速感 */
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
          "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei",
          "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
  background: var(--bg);
  color: var(--label);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.45;
  letter-spacing: -0.011em;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

/* ---------- 毛玻璃 ---------- */

.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid var(--sep);
  box-shadow: var(--shadow-card);
}

.glass-bar {
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
}

/* 顶栏：内容从下方滚过时能明显看到毛玻璃 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--sep);
}
.topbar-inner {
  max-width: 620px;
  margin: 0 auto;
  height: 56px;
  padding: 0 16px;
  padding-top: env(safe-area-inset-top, 0);
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.brand-mark {
  width: 26px; height: 26px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  display: grid;
  place-items: center;
  letter-spacing: 0;
  box-shadow: 0 3px 10px -3px rgba(0, 122, 255, 0.7);
}
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 4px; }

.icon-btn {
  width: 40px; height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--label-2);
  cursor: pointer;
  transition: background 0.18s var(--ease), color 0.18s var(--ease), transform 0.18s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.icon-btn:hover { background: var(--fill-2); color: var(--label); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn.is-off { color: var(--label-3); }
.icon-btn svg { width: 20px; height: 20px; }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 54px;
  padding: 0 24px;
  border: 0;
  border-radius: var(--r-pill);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.015em;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.2s var(--ease), background 0.2s var(--ease),
              box-shadow 0.25s var(--ease), color 0.2s var(--ease), opacity 0.2s var(--ease);
}
.btn:active:not(:disabled) { transform: scale(0.968); }
.btn svg { width: 19px; height: 19px; flex: 0 0 auto; }
.btn .btn-icon { display: inline-flex; align-items: center; justify-content: center; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-accent);
}
.btn-primary:disabled {
  background: rgba(120, 120, 128, 0.16);
  color: var(--label-3);
  box-shadow: none;
  cursor: default;
}
.btn-block { width: 100%; }

.btn-ghost { background: var(--fill); color: var(--label); }
.btn-soft { background: var(--accent-tint); color: var(--accent); }
.btn-danger { background: var(--danger-tint); color: var(--danger); }

.btn-sm {
  height: 38px;
  padding: 0 15px;
  font-size: 15px;
  gap: 6px;
}
.btn-sm svg { width: 16px; height: 16px; }

.btn-plain {
  height: auto;
  padding: 6px 8px;
  background: transparent;
  color: var(--accent);
  font-size: 15px;
  font-weight: 500;
}
.btn-plain:active { opacity: 0.5; transform: none; }
.btn-plain.danger { color: var(--danger); }

/* ---------- 卡片 / 分组列表 ---------- */

.card {
  border-radius: var(--r-xl);
  padding: 26px;
}

.panel {
  border-radius: var(--r-lg);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 15px 18px 11px;
}
.panel-head h2 {
  font-size: 13px;
  font-weight: 600;
  color: var(--label-2);
  letter-spacing: 0.02em;
}
.panel-note {
  font-size: 13px;
  color: var(--label-3);
  font-weight: 400;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 18px;
  position: relative;
}
.row + .row::before {
  content: "";
  position: absolute;
  left: 18px; right: 0; top: 0;
  height: 1px;
  background: var(--sep);
}
.row-tappable { cursor: pointer; transition: background 0.15s var(--ease); }
.row-tappable:active { background: var(--fill-2); }

.row-main { flex: 1; min-width: 0; }
.row-title {
  font-size: 16px;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-sub { font-size: 13px; color: var(--label-3); margin-top: 1px; }
.row-trail { font-size: 14px; color: var(--label-3); flex: 0 0 auto; }

/* ---------- 表单 ---------- */

.field {
  width: 100%;
  height: 48px;
  padding: 0 15px;
  border-radius: var(--r-md);
  background: var(--fill-2);
  border: 1px solid transparent;
  font-size: 17px;
  outline: none;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
  -webkit-appearance: none;
}
.field::placeholder { color: var(--label-3); }
.field:focus {
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-tint);
}
textarea.field {
  height: auto;
  min-height: 108px;
  padding: 13px 15px;
  line-height: 1.5;
  resize: vertical;
  font-size: 16px;
}
.field-group { display: flex; gap: 9px; align-items: center; }
.field-group .field { flex: 1; }

/* iOS 开关 */
.switch {
  position: relative;
  display: inline-flex;
  width: 51px;
  height: 31px;
  flex: 0 0 auto;
}
.switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.switch .track {
  position: absolute;
  inset: 0;
  border-radius: var(--r-pill);
  background: var(--fill);
  transition: background 0.28s var(--ease);
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 27px; height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 1px 1px rgba(0, 0, 0, 0.16);
  transition: transform 0.28s var(--ease), width 0.2s var(--ease);
}
.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:active + .track::after { width: 30px; }
.switch input:checked:active + .track::after { transform: translateX(17px); }

/* 滑杆 */
.range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 28px;
  background: transparent;
  cursor: pointer;
  margin: 0;
}
.range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: var(--fill);
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 26px; height: 26px;
  margin-top: -11px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22), 0 0 0 0.5px rgba(0, 0, 0, 0.06);
}
.range::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: var(--fill);
}
.range::-moz-range-thumb {
  width: 26px; height: 26px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22), 0 0 0 0.5px rgba(0, 0, 0, 0.06);
}

/* ---------- 标签 / 徽标 ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  background: var(--fill);
  color: var(--label-2);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
}
.badge-accent { background: var(--accent-tint); color: var(--accent); }

/* ---------- 空态 ---------- */

.empty {
  padding: 34px 20px 40px;
  text-align: center;
  color: var(--label-3);
  font-size: 15px;
  line-height: 1.6;
}

/* ---------- 提示条 ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom, 0));
  transform: translate(-50%, 26px);
  z-index: 90;
  max-width: min(88vw, 420px);
  padding: 13px 20px;
  border-radius: var(--r-pill);
  background: rgba(28, 28, 30, 0.92);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease), transform 0.4s var(--ease-out);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 13px 15px;
  border-radius: var(--r-md);
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 14px;
  line-height: 1.5;
}
.notice.warn { background: rgba(255, 149, 0, 0.12); color: #c26a00; }
.notice svg {
  width: 17px; height: 17px;
  flex: 0 0 auto;
  margin-top: 1px;
}
.notice code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.06);
}

/* ---------- 工具类 ---------- */

.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;
}
.hidden { display: none !important; }
.mono {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}
.spin { animation: spin 0.85s 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;
  }
}
