/* ==========================================================================
 * app.css —— 班级任务小助手（桌面侧边栏 + 移动端顶栏 双形态）
 * ========================================================================== */

:root {
  --bg: #f5f3f0;
  --surface: #ffffff;
  --surface-2: #faf8f6;
  --ink: #292524;
  --ink-2: #57534e;
  --muted: #6f6a64;
  --faint: #a8a29e;
  --line: #e9e4de;
  --line-2: #d9d2c9;

  --accent: #e0662b;
  --accent-ink: #b5470f;
  --accent-soft: #fdeee3;

  --success: #1d9a5f;
  --success-solid: #157a4a;
  --success-deep: #124f33;
  --warning-ink: #b45309;
  --warning-soft: #fdf3e3;
  --danger: #dc4444;
  --danger-ink: #b91c1c;
  --danger-solid: #c02626;
  --danger-soft: #fdeeee;

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;

  --shadow-xs: 0 1px 2px rgba(41, 37, 36, .05);
  --shadow-sm: 0 1px 2px rgba(41, 37, 36, .04), 0 3px 10px rgba(41, 37, 36, .05);
  --shadow-md: 0 2px 4px rgba(41, 37, 36, .04), 0 10px 28px rgba(41, 37, 36, .09);
  --shadow-lg: 0 4px 10px rgba(41, 37, 36, .06), 0 20px 48px rgba(41, 37, 36, .13);

  --tr: .22s cubic-bezier(.4, 0, .2, 1);
  --spring: .28s cubic-bezier(.34, 1.56, .64, 1);

  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
    "HarmonyOS Sans SC", "MiSans", "Noto Sans SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --font-mono: "SF Mono", "Cascadia Code", "JetBrains Mono", "Roboto Mono", Consolas, monospace;

  --topbar-h: 56px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* 阻止下拉刷新误触（iOS 上误触会把整页刷掉，正在点名时很致命） */
html, body { overscroll-behavior-y: contain; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: row;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(640px 420px at 88% -6%, rgba(224, 102, 43, .075), transparent 68%),
    radial-gradient(720px 520px at -8% 104%, rgba(29, 154, 95, .055), transparent 68%);
}

::selection { background: rgba(224, 102, 43, .18); }
button { font-family: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
[hidden] { display: none !important; }

/* ============================ 离线横幅 ============================ */
.offline-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: .02em;
  background: var(--warning-soft);
  color: var(--warning-ink);
  border-bottom: 1px solid #f3ddb3;
}
.offline-bar[data-state="pending"] { background: #eef6f9; color: #1a6b8a; border-bottom-color: #cfe6ef; }

/* ============================== 侧边栏 ============================== */
.sidebar {
  width: 280px;
  min-width: 280px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 14px calc(14px + env(safe-area-inset-bottom));
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  z-index: 30;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 4px 14px;
  border-bottom: 1px solid var(--line);
}
.brand-mark {
  width: 40px; height: 40px;
  border-radius: 12px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #e8793d, #d4551d);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.15rem;
  box-shadow: 0 4px 12px rgba(212, 85, 29, .28), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.brand-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.brand-name { font-weight: 700; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  font-size: .7rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 99px;
  background: #e9f5ef;
  color: var(--success-solid);
  border: 1px solid #cbe8da;
  transition: var(--tr);
}
.sync-pill::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.sync-pill[data-state="pending"] { background: var(--warning-soft); color: var(--warning-ink); border-color: #f3ddb3; }
.sync-pill[data-state="offline"] { background: var(--danger-soft); color: var(--danger-ink); border-color: #f5caca; }

.btn-new-project {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  background: var(--success-solid);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  transition: var(--tr);
  box-shadow: 0 1px 2px rgba(18, 79, 51, .25), 0 4px 14px rgba(21, 122, 74, .22);
}
.btn-new-project:hover { background: var(--success-deep); transform: translateY(-1px); }
.btn-new-project:active { transform: scale(.97); }

.project-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
}
.project-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 8px 10px 12px;
  cursor: pointer;
  transition: var(--tr);
}
.project-item:hover { border-color: var(--line-2); box-shadow: var(--shadow-xs); }
.project-item.active {
  border-color: rgba(224, 102, 43, .45);
  background: #fdf3ec;
  box-shadow: 0 0 0 3px rgba(224, 102, 43, .07);
}
.pi-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pi-name { font-weight: 600; font-size: .875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-item.active .pi-name { color: var(--accent-ink); }
.pi-meta { font-size: .72rem; color: var(--muted); white-space: nowrap; }
.project-item-delete {
  width: 28px; height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  border: none;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  flex-shrink: 0;
  transition: var(--tr);
}
.project-item-delete:hover { background: var(--danger-soft); color: var(--danger-ink); }

.sidebar-footer {
  margin-top: auto;
  padding: 10px 4px 2px;
  border-top: 1px solid var(--line);
  font-size: .72rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: center;
}
.sidebar-footer a { color: var(--muted); text-decoration: none; cursor: pointer; }
.sidebar-footer a:hover { color: var(--accent-ink); }
#deviceInfo { flex-basis: 100%; color: var(--faint); margin-top: 2px; }

/* ============================== 主区域 ============================== */
.topbar { display: none; }

.main {
  flex: 1;
  min-width: 0;
  padding: 0 20px calc(40px + env(safe-area-inset-bottom));
  position: relative;
  z-index: 1;
}
.main-inner { max-width: 1160px; margin: 0 auto; }

.header { padding: 30px 12px 4px; text-align: center; }
.title {
  font-size: clamp(1.4rem, 3vw, 1.95rem);
  font-weight: 800;
  letter-spacing: .01em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.title-class { color: var(--accent); }
.title-sep { color: #d6cfc7; font-weight: 400; }
.badge {
  font-size: .72rem;
  font-weight: 600;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border: 1px solid rgba(224, 102, 43, .22);
  border-radius: 99px;
  padding: 4px 11px;
}
.subtitle { color: var(--muted); margin-top: 9px; font-size: .9rem; }

/* ------------------------------ 计时器 ------------------------------ */
.timer-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin: 20px auto 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 18px 26px;
  max-width: 940px;
  box-shadow: var(--shadow-sm);
}

.minute-adjuster-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  user-select: none;
  transition: var(--tr);
}
.minute-adjuster-wrap.disabled { opacity: .6; }
.minute-adjuster-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .8rem;
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
}
.minute-digit-group { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.minute-digit-btn {
  width: 38px; height: 26px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  color: var(--muted);
  display: grid;
  place-items: center;
  font-size: .8rem;
  line-height: 1;
  transition: var(--tr);
}
.minute-digit-btn:hover:not(:disabled) { background: #fff; color: var(--accent-ink); box-shadow: var(--shadow-xs); }
.minute-digit-btn:active:not(:disabled) { transform: scale(.9); }
.minute-digit-btn:disabled { opacity: .3; cursor: not-allowed; }
.minute-digit-display {
  width: 44px; height: 50px;
  background: #fff;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.7rem;
  font-weight: 700;
}
.minute-adjuster-wrap.disabled .minute-digit-display { opacity: .55; background: var(--surface-2); }
.minute-unit { font-size: .8rem; color: var(--muted); font-weight: 500; }

.timer-block { display: flex; flex-direction: column; align-items: center; gap: 7px; }
.timer-label { font-size: .7rem; font-weight: 600; letter-spacing: .12em; color: var(--muted); }
.timer-display {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  font-weight: 700;
  letter-spacing: .04em;
  line-height: 1.15;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 26px;
  min-width: 200px;
  text-align: center;
  box-shadow: inset 0 2px 6px rgba(41, 37, 36, .04);
  transition: color .3s, border-color .3s, background .3s;
}
.timer-display.urgent {
  color: #dc2626;
  border-color: rgba(220, 38, 38, .4);
  background: #fef7f7;
  animation: urgentPulse 1s infinite;
}
@keyframes urgentPulse {
  0%, 100% { box-shadow: inset 0 2px 6px rgba(41, 37, 36, .04), 0 0 0 0 rgba(220, 38, 38, .28); }
  50% { box-shadow: inset 0 2px 6px rgba(41, 37, 36, .04), 0 0 0 9px rgba(220, 38, 38, 0); }
}

.timer-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }

/* ------------------------------ 按钮 ------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: .875rem;
  cursor: pointer;
  transition: var(--tr);
  white-space: nowrap;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: scale(.96); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-start { background: var(--success-solid); color: #fff; box-shadow: 0 4px 14px rgba(21, 122, 74, .24); }
.btn-start:hover:not(:disabled) { background: var(--success-deep); }
.btn-pause { background: var(--warning-ink); color: #fff; }
.btn-pause:hover:not(:disabled) { background: #964307; }
.btn-ghost { background: var(--surface); color: var(--ink-2); border-color: var(--line-2); }
.btn-ghost:hover:not(:disabled) { border-color: var(--faint); color: var(--ink); }
.btn-danger { background: transparent; color: var(--danger-ink); border-color: rgba(220, 68, 68, .32); }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); border-color: var(--danger); }

/* ------------------------------ 统计 ------------------------------ */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 940px;
  margin: 0 auto 14px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-xs);
  transition: var(--tr);
}
.stat-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.stat-card.total .stat-dot { background: var(--faint); }
.stat-card.done .stat-dot { background: var(--success); }
.stat-card.remain .stat-dot { background: var(--warning-ink); }
.stat-number {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.1;
}
.stat-card.done .stat-number { color: var(--success-solid); }
.stat-card.remain .stat-number { color: var(--warning-ink); }
.stat-label { font-size: .78rem; color: var(--muted); font-weight: 500; margin-top: 2px; }
.stat-card.remain.alert { border-color: rgba(220, 38, 38, .45); background: #fef6f6; }
.stat-card.remain.alert .stat-number { color: var(--danger-ink); }

.progress-wrap {
  max-width: 940px;
  margin: 0 auto;
  height: 10px;
  background: #ece7e1;
  border-radius: 99px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(41, 37, 36, .06);
}
.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, #2bb673, var(--success-solid));
  transition: width .5s cubic-bezier(.22, 1, .36, 1);
}

/* ------------------------------ 学生网格 ------------------------------ */
.students-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  max-width: 1100px;
  margin: 22px auto 0;
  padding: 0 4px;
}
.student-card {
  border-radius: 12px;
  padding: 15px 6px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  font-weight: 600;
  font-size: .92rem;
  letter-spacing: .02em;
  color: var(--ink);
  border: 1px solid transparent;
  box-shadow: var(--shadow-xs);
  transition: transform var(--spring), box-shadow var(--tr), border-color var(--tr), opacity var(--tr);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  position: relative;
}
.student-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); z-index: 2; }
.student-card:active { transform: scale(.94); transition: transform .08s; }
.student-card.color-0 { background: #fbf2ef; border-color: #f2ded7; }
.student-card.color-1 { background: #eff4fa; border-color: #dde7f2; }
.student-card.color-2 { background: #eff7f1; border-color: #dcefe3; }
.student-card.color-3 { background: #fbf6ec; border-color: #f0e8d6; }
.student-card.color-4 { background: #f4f1fb; border-color: #e6e0f3; }

.student-card.removed { display: none; }
/* 已点击但服务端还没确认：淡虚线边框，用户知道「已记录、待同步」 */
.student-card.pending { border-style: dashed; border-color: var(--accent); opacity: .9; }
.student-card.popping {
  animation: popOut .4s cubic-bezier(.4, 0, .2, 1) forwards;
  pointer-events: none;
}
@keyframes popOut {
  0% { transform: scale(1); opacity: 1; }
  35% { transform: scale(1.08); opacity: .9; }
  100% { transform: scale(.55); opacity: 0; }
}
.student-card.expired {
  border-color: rgba(220, 38, 38, .55) !important;
  background: #fef5f5 !important;
  color: #7f1d1d;
  animation: cardAlert 1.1s ease-in-out infinite !important;
}
@keyframes cardAlert {
  0%, 100% { box-shadow: 0 0 0 3px rgba(220, 38, 38, .09); }
  50% { box-shadow: 0 0 0 6px rgba(220, 38, 38, .16); }
}

.empty {
  max-width: 1100px;
  margin: 12px auto 0;
  padding: 48px 20px;
  text-align: center;
}
.empty-title { font-size: 1.3rem; font-weight: 800; letter-spacing: .02em; }
.empty-sub { font-size: .875rem; color: var(--muted); margin-top: 8px; }

/* ------------------------------ Toast ------------------------------ */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translate(-50%, -160%);
  opacity: 0;
  background: #292524;
  color: #fff;
  padding: 12px 22px;
  border-radius: 99px;
  font-weight: 600;
  font-size: .92rem;
  box-shadow: var(--shadow-lg);
  transition: transform .4s cubic-bezier(.22, 1.4, .36, 1), opacity .25s ease;
  z-index: 1000;
  pointer-events: none;
  white-space: nowrap;
  max-width: 92vw;
  overflow: hidden;
  text-overflow: ellipsis;
  visibility: hidden;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
.toast.error { background: var(--danger-solid); }
.toast.warn { background: var(--warning-ink); }

.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 999; overflow: hidden; }
.confetti-layer i {
  position: absolute;
  top: -14px;
  opacity: 0;
  animation: confettiFall 2.4s cubic-bezier(.2, .6, .4, 1) forwards;
}
@keyframes confettiFall {
  0% { transform: translate3d(0, 0, 0) rotate(0); opacity: 1; }
  100% { transform: translate3d(var(--x, 0px), 106vh, 0) rotate(var(--r, 360deg)); opacity: 0; }
}

/* ------------------------------ 弹层 ------------------------------ */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(41, 37, 36, .32);
  z-index: 40;
}
.dialog {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(360px, 88vw);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 22px;
  z-index: 60;
}
.dialog h2 { font-size: 1.05rem; margin-bottom: 14px; }
.dialog input {
  width: 100%;
  padding: 11px 13px;
  font-size: 16px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  font-family: inherit;
  background: var(--surface-2);
  color: var(--ink);
}
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ============================== 移动端 ============================== */
@media (max-width: 1180px) { .students-grid { grid-template-columns: repeat(6, 1fr); } }
@media (max-width: 1024px) { .students-grid { grid-template-columns: repeat(5, 1fr); } }

@media (max-width: 900px) {
  body { flex-direction: column; }

  /* 顶部固定栏：班名 + 项目切换 + 同步状态 */
  .topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: calc(var(--topbar-h) + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 12px 0;
    background: rgba(255, 255, 255, .94);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--line);
    z-index: 50;
  }
  .topbar .brand-mark { width: 32px; height: 32px; border-radius: 9px; font-size: .95rem; }
  .tb-project {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    border: 1px solid var(--line-2);
    background: var(--surface-2);
    border-radius: 99px;
    font-size: .86rem;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
  }
  #tbProjectName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tb-caret { color: var(--faint); font-size: .7rem; }
  .sync-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--success); flex-shrink: 0; }
  .sync-dot[data-state="pending"] { background: var(--warning-ink); animation: pulseStatus 1.2s infinite; }
  .sync-dot[data-state="offline"] { background: var(--danger); }
  .tb-resync {
    width: 34px; height: 34px;
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 1rem;
    cursor: pointer;
    flex-shrink: 0;
  }
  @keyframes pulseStatus { 50% { opacity: .35; } }

  /* 侧边栏变成下拉面板 */
  .sidebar {
    position: fixed;
    top: calc(var(--topbar-h) + env(safe-area-inset-top));
    left: 0; right: 0;
    width: 100%;
    min-width: 0;
    height: auto;
    max-height: 62vh;
    z-index: 45;
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: transform .2s ease, opacity .2s ease;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 14px;
    gap: 10px;
  }
  .sidebar.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .sidebar-brand { display: none; }
  .sidebar-footer { display: none; }
  .project-list { max-height: 40vh; }

  .main {
    padding: calc(var(--topbar-h) + env(safe-area-inset-top) + 8px) 12px calc(40px + env(safe-area-inset-bottom));
  }
  .header { padding: 6px 4px 0; }
  .title { font-size: 1.2rem; gap: 6px; }
  .badge { display: none; }
  .subtitle { font-size: .78rem; margin-top: 6px; }

  /* 计时器吸顶：滚到名单时倒计时仍在视野里 */
  .timer-panel {
    position: sticky;
    top: calc(var(--topbar-h) + env(safe-area-inset-top));
    z-index: 20;
    margin: 10px auto 10px;
    padding: 12px 10px;
    gap: 10px 14px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, .97);
    backdrop-filter: blur(8px);
  }
  .timer-display { font-size: 1.9rem; min-width: 118px; padding: 5px 12px; }
  .timer-label { display: none; }
  .timer-block { gap: 0; }
  .minute-adjuster-wrap { padding: 5px 7px; gap: 5px; border-radius: 10px; }
  .minute-adjuster-label { display: none; }
  .minute-digit-group { gap: 1px; }
  .minute-digit-display { width: 30px; height: 34px; font-size: 1.15rem; border-radius: 8px; }
  .minute-digit-btn { width: 34px; height: 22px; font-size: .7rem; }  /* 手机仍保留足够触控面积 */
  .minute-unit { font-size: .72rem; }
  .btn { padding: 8px 11px; font-size: .78rem; min-height: 38px; }
  /* 计时进行中时收起时长设置，把屏幕留给名单 */
  .minute-adjuster-wrap.disabled { display: none; }
  .timer-panel:has(.minute-adjuster-wrap.disabled) { padding: 10px; }
  .timer-actions { gap: 6px; }
  .timer-actions .btn-danger { order: 9; }

  .stats { gap: 6px; margin-bottom: 10px; }
  .stat-card { padding: 8px 6px; justify-content: center; gap: 6px; flex-direction: column; text-align: center; }
  .stat-card .stat-dot { display: none; }
  .stat-number { font-size: 1.35rem; }
  .stat-label { font-size: .68rem; }
  .progress-wrap { height: 8px; }

  .students-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; padding: 0; }
  .toast { top: calc(var(--topbar-h) + env(safe-area-inset-top) + 10px); font-size: .84rem; padding: 10px 16px; }
}

@media (max-width: 560px) {
  .students-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .student-card { font-size: .84rem; padding: 12px 4px; }
  .title { font-size: 1.1rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
