/* 智能化教师管理平台 · 样式（采用 Paul 交流社区设计语言） */

:root {
  color-scheme: light;
  --bg: #f4f6fb;
  --glow-a: rgba(37, 99, 235, 0.14);
  --glow-b: rgba(99, 102, 241, 0.12);
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --text: #0f172a;
  --text-soft: #475569;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-soft: #eff4ff;
  --ok: #059669;
  --ok-soft: #ecfdf5;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --chart-average: #b45309;
  --shadow-lg: 0 30px 80px rgba(15, 23, 42, 0.12);
  --shadow-sm: 0 8px 24px rgba(15, 23, 42, 0.06);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --shell-max: min(2240px, calc(100vw - 80px));
  --font: "Inter", "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #070b14;
  --glow-a: rgba(59, 130, 246, 0.22);
  --glow-b: rgba(129, 140, 248, 0.16);
  --surface: #0f1624;
  --surface-muted: #131c2d;
  --text: #e6edf7;
  --text-soft: #b6c2d4;
  --muted: #8b9ab0;
  --line: #1e2a3d;
  --line-strong: #2b3a52;
  --accent: #6ea0ff;
  --accent-strong: #8ab4ff;
  --accent-soft: #14213a;
  --ok: #34d399;
  --ok-soft: #0c2a22;
  --danger: #fb7185;
  --danger-soft: #2a1218;
  --chart-average: #fbbf24;
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.3);
}

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

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

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

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(620px 420px at 8% -6%, var(--glow-a), transparent 70%),
    radial-gradient(760px 520px at 104% 104%, var(--glow-b), transparent 72%);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input,
textarea {
  font: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

/* ---------------------------------------------------------------- 主题开关 */

.icon {
  width: 18px;
  height: 18px;
  flex: none;
}

.icon-moon {
  display: none;
}

html[data-theme="dark"] .icon-sun {
  display: none;
}

html[data-theme="dark"] .icon-moon {
  display: block;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease, transform 160ms ease, background 160ms ease;
}

.icon-button:hover {
  border-color: var(--line-strong);
  color: var(--text);
  transform: translateY(-1px);
}

/* 固定在视口最右上角的深浅色开关 */
.theme-fab {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 100;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-sm);
}

/* ---------------------------------------------------------------- 品牌 */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  flex: none;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: linear-gradient(145deg, var(--accent), var(--accent-strong));
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.3);
}

html[data-theme="dark"] .brand-mark {
  color: #07111f;
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.brand-name em {
  margin-left: 4px;
  color: var(--muted);
  font-style: normal;
  font-weight: 500;
}

/* ---------------------------------------------------------------- 顶栏 / 导航 */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(18px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: var(--shell-max);
  margin: 0 auto;
  /* 右侧给固定的深浅色按钮留出空间 */
  padding: 13px 76px 13px 24px;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
}

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

.topnav a {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  transition: color 150ms ease;
}

.topnav a:hover {
  color: var(--text);
  text-decoration: none;
}

.topnav a.active {
  color: var(--accent);
  font-weight: 650;
}

/* 访客只看到站内介绍，登录后只看到业务导航 */
body[data-auth="guest"] .topnav-user,
body[data-auth="user"] .topnav-guest {
  display: none;
}

.menu-button {
  flex: none;
}

/* ---------------------------------------------------------------- 左侧滑出菜单 */

.menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 190;
  background: rgba(4, 10, 22, 0.52);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  backdrop-filter: blur(3px);
  transition: opacity 240ms ease, visibility 240ms;
}

.menu-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.menu-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  width: min(320px, 84vw);
  padding: 20px 16px;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  transform: translateX(-100%);
  visibility: hidden;
  transition: transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1), visibility 280ms;
}

.menu-drawer.is-open {
  transform: translateX(0);
  visibility: visible;
}

.menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 4px 4px 18px;
  border-bottom: 1px solid var(--line);
}

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

.menu-brand .brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 17px;
  box-shadow: none;
}

.menu-brand strong {
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.menu-close:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.menu-nav {
  display: grid;
  gap: 4px;
}

.menu-item {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  border-radius: 10px;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background 150ms ease, color 150ms ease;
}

.menu-item:hover {
  background: var(--surface-muted);
  color: var(--text);
  text-decoration: none;
}

.menu-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.menu-divider {
  height: 1px;
  margin: 10px 6px;
  background: var(--line);
}

.menu-user-slot {
  margin-top: auto;
  padding-top: 18px;
}

.menu-user {
  position: relative;
  z-index: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.menu-user::before {
  content: "";
  position: absolute;
  inset: 5px -5px -5px 5px;
  z-index: -1;
  border: 1px solid color-mix(in srgb, var(--accent) 12%, transparent);
  border-radius: 18px;
  background: linear-gradient(145deg, var(--accent-soft), color-mix(in srgb, var(--accent) 8%, transparent));
}

a.menu-user:hover {
  border-color: var(--line-strong);
  text-decoration: none;
}

.menu-user-static {
  cursor: default;
}

.menu-user-avatar-wrap {
  position: relative;
  z-index: 0;
  width: 44px;
  height: 44px;
  flex: none;
}

.menu-user-avatar-wrap::before {
  content: "";
  position: absolute;
  inset: 3px -3px -3px 3px;
  z-index: -1;
  border-radius: 14px;
  background: var(--accent);
  opacity: 0.16;
}

.menu-user-avatar {
  display: block;
  width: 44px;
  height: 44px;
  border: 2px solid var(--surface);
  border-radius: 14px;
  background: var(--surface-muted);
  object-fit: cover;
}

.menu-user-avatar-guest {
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 18px;
  font-weight: 700;
}

.menu-user-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.menu-user-copy strong {
  overflow: hidden;
  font-size: 13.5px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-user-copy small {
  color: var(--muted);
  font-size: 11.5px;
}

.menu-user-loading {
  opacity: 0.7;
}

.menu-logout {
  margin-top: 10px;
}

.menu-logout-button {
  width: 100%;
  justify-content: center;
}

body.menu-open {
  overflow: hidden;
}

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

.spa-views {
  min-height: calc(100vh - 132px);
  min-height: calc(100dvh - 132px);
}

.spa-view:not([hidden]) {
  animation: spa-view-enter 220ms ease both;
}

@keyframes spa-view-enter {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.page {
  width: 100%;
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: clamp(28px, 4vw, 48px) clamp(20px, 2.6vw, 40px) 56px;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--accent);
}

.muted {
  color: var(--muted);
}

.loading-line {
  margin: 8px 0;
}

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

.page-head h1 {
  margin: 0 0 6px;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.page-head p {
  max-width: 44em;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

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

.button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease,
    border-color 150ms ease, opacity 150ms ease, color 150ms ease;
}

.button:hover {
  text-decoration: none;
}

.button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.24);
}

.button.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.3);
}

html[data-theme="dark"] .button.primary {
  color: #07111f;
  box-shadow: 0 10px 24px rgba(110, 160, 255, 0.22);
}

html[data-theme="dark"] .button.primary:hover {
  box-shadow: 0 14px 30px rgba(110, 160, 255, 0.3);
}

.button.ghost {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text-soft);
}

.button.ghost:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

.button.danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 10px 24px color-mix(in srgb, var(--danger) 24%, transparent);
}

.button.danger:hover {
  transform: translateY(-1px);
}

html[data-theme="dark"] .button.danger {
  color: #1b0b10;
}

.button.danger-ghost {
  border-color: color-mix(in srgb, var(--danger) 35%, transparent);
  background: transparent;
  color: var(--danger);
}

.button.danger-ghost:hover {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  transform: none;
}

.button[data-loading="true"] {
  color: transparent;
  cursor: progress;
}

.button[data-loading="true"] .button-label {
  visibility: hidden;
}

.button[data-loading="true"]::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid color-mix(in srgb, var(--text) 25%, transparent);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.button.primary[data-loading="true"]::after {
  border-color: rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
}

html[data-theme="dark"] .button.primary[data-loading="true"]::after {
  border-color: rgba(7, 17, 31, 0.25);
  border-top-color: #07111f;
}

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

/* ---------------------------------------------------------------- 卡片 / 徽章 */

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

.card h2 {
  margin: 0 0 16px;
  font-size: 15px;
  font-weight: 700;
}

.card-lede {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border: 1px solid color-mix(in srgb, var(--ok) 26%, transparent);
  border-radius: 999px;
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

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

.hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  overflow: hidden;
  padding: clamp(28px, 4.5vw, 48px);
  border: 1px solid var(--line);
  border-radius: 26px;
  background:
    radial-gradient(540px 280px at 92% 6%, var(--glow-a), transparent 70%),
    var(--surface);
  box-shadow: var(--shadow-sm);
}

.hero-copy {
  position: relative;
  z-index: 1;
  max-width: 680px;
  min-width: 0;
}

.hero h1 {
  margin: 0;
  font-size: clamp(26px, 3.4vw, 38px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.hero-lede {
  max-width: 44em;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.hero-mark {
  display: grid;
  place-items: center;
  width: clamp(84px, 11vw, 132px);
  height: clamp(84px, 11vw, 132px);
  flex: none;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
  border-radius: 28px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--accent);
  font-size: clamp(34px, 5vw, 54px);
  font-weight: 700;
  transform: rotate(-4deg);
  user-select: none;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px;
}

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

.stat-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}

.stat-value-small {
  padding-top: 6px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.link-card {
  display: flex;
  flex-direction: column;
  padding: 22px;
  color: inherit;
  transition: transform 160ms ease, border-color 160ms ease;
}

.link-card:hover {
  text-decoration: none;
  transform: translateY(-2px);
  border-color: var(--line-strong);
}

.link-card h2 {
  margin: 12px 0 7px;
  font-size: 16px;
  font-weight: 650;
}

.link-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.link-index {
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

/* 登录后首页仪表盘 */
.home-dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr);
  grid-template-areas:
    "classes shortcuts"
    "tip shortcuts";
  align-items: start;
  gap: 16px;
  margin-top: 18px;
}

.home-classes {
  grid-area: classes;
  padding: 22px;
}

.home-tip {
  grid-area: tip;
}

.home-shortcuts {
  grid-area: shortcuts;
}

.home-side {
  display: contents;
}

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

.home-section-head .eyebrow {
  margin-bottom: 6px;
}

.home-section-head h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.01em;
}

.home-section-link {
  min-height: 38px;
  padding: 0 14px;
  font-size: 13px;
}

.home-loading {
  margin: 0;
  font-size: 13px;
}

.home-class-list {
  display: grid;
  gap: 10px;
}

.home-class-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-muted);
  color: inherit;
  text-decoration: none;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.home-class-row:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: var(--surface);
  text-decoration: none;
}

.home-class-avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 14px;
  font-weight: 700;
}

.home-class-info {
  display: grid;
  flex: 1;
  gap: 2px;
  min-width: 0;
}

.home-class-info strong {
  overflow: hidden;
  font-size: 15px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-class-info small {
  color: var(--muted);
  font-size: 12px;
}

.home-class-arrow {
  flex: none;
  color: var(--muted);
  font-size: 15px;
}

.home-shortcuts,
.home-tip {
  padding: 20px 22px;
}

.home-shortcuts h2,
.home-tip h2 {
  margin: 2px 0 12px;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.home-shortcut-list {
  display: grid;
  gap: 8px;
}

.home-shortcut-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: inherit;
  text-decoration: none;
  transition: border-color 150ms ease, background 150ms ease;
}

.home-shortcut-list a:hover {
  border-color: var(--line-strong);
  background: var(--surface-muted);
  text-decoration: none;
}

.home-shortcut-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12.5px;
  font-weight: 700;
}

.home-shortcut-text {
  display: grid;
  flex: 1;
  gap: 1px;
  min-width: 0;
}

.home-shortcut-text strong {
  font-size: 13.5px;
  font-weight: 650;
}

.home-shortcut-text small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-shortcut-arrow {
  color: var(--muted);
  font-size: 13px;
}

.home-tip p {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.75;
}

.home-tip-link {
  display: inline-block;
  margin-top: 10px;
  font-size: 12.5px;
  font-weight: 650;
}

/* ---------------------------------------------------------------- 访客首页（登录/注册前） */

.home {
  width: 100%;
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: clamp(28px, 4vw, 48px) clamp(20px, 2.6vw, 40px) 56px;
}

/* 访客首屏不套卡片：文字直接落在页面背景上 */
.hero.hero-plain {
  padding: 0 0 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.landing-page {
  max-width: 1180px;
}

.hero.landing-hero {
  gap: clamp(24px, 4vw, 56px);
  padding: clamp(20px, 3vw, 36px) 0 8px;
}

.landing-actions {
  align-items: center;
  gap: 10px;
}

.landing-cta {
  min-width: 148px;
}

.entry-hint {
  max-width: 44em;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.entry-hint a {
  font-weight: 650;
}

/* 首屏右侧装饰性座位预览 */
.landing-visual {
  flex: none;
  width: min(360px, 32vw);
}

.landing-preview {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(160deg, var(--surface), var(--surface-muted));
  box-shadow: var(--shadow-sm);
  transform: rotate(1.2deg);
}

.landing-preview-head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-soft);
  font-size: 12.5px;
}

.landing-preview-head strong {
  font-size: 13px;
}

.landing-preview-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.landing-preview-tag {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 650;
}

.landing-seats {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.landing-podium {
  display: block;
  width: 44%;
  margin: 0 auto 11px;
  padding: 3px 0;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-align: center;
}

html[data-theme="dark"] .landing-podium {
  color: #07111f;
}

.landing-seat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.landing-seat-grid span {
  position: relative;
  display: block;
  aspect-ratio: 1.4;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-muted);
}

.landing-seat-grid span.is-filled {
  border-color: color-mix(in srgb, var(--accent) 32%, transparent);
  background: var(--accent-soft);
}

.landing-seat-grid span.is-filled::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  transform: translate(-50%, -50%);
}

.landing-preview-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 11px;
}

.landing-preview-foot b {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.section-divider {
  height: 1px;
  margin: clamp(30px, 4vw, 44px) 0 0;
  border: 0;
  background: linear-gradient(90deg, transparent, var(--line) 6%, var(--line) 94%, transparent);
}

.section-block {
  margin-top: clamp(36px, 5vw, 56px);
  scroll-margin-top: 90px;
}

.section-divider + .section-block {
  margin-top: clamp(24px, 3vw, 32px);
}

.section-title {
  margin-bottom: 18px;
}

.section-title .eyebrow {
  margin-bottom: 6px;
}

.section-title h2 {
  margin: 0;
  font-size: clamp(20px, 2.4vw, 24px);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.section-title > p:last-child {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.board-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 160ms ease, border-color 160ms ease;
}

.board-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
}

.board-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}

.board-icon svg {
  width: 20px;
  height: 20px;
}

.board-card h3 {
  margin: 14px 0 7px;
  font-size: 16px;
  font-weight: 650;
}

.board-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.rules-panel,
.about-panel {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.rules-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rules-list li {
  display: grid;
  gap: 3px;
  padding-left: 14px;
  border-left: 2px solid var(--accent-soft);
}

.rules-list b {
  font-size: 14px;
  font-weight: 650;
}

.rules-list span {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}

.about-panel p {
  margin: 0 0 10px;
  color: var(--text-soft);
  font-size: 13.5px;
  line-height: 1.85;
}

.about-panel p:last-child {
  margin-bottom: 0;
}

.about-panel p.muted {
  color: var(--muted);
}

/* 三步引导 */
.step-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.step-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.step-index {
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.step-card h3 {
  margin: 10px 0 6px;
  font-size: 15px;
  font-weight: 650;
}

.step-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}

.landing-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

/* 关于平台 + 底部 CTA */
.landing-about-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.landing-about-panel h2 {
  margin: 2px 0 8px;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.landing-about-panel p {
  max-width: 62ch;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

.landing-final-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

@media (max-width: 900px) {
  .landing-visual {
    width: min(340px, 100%);
    margin: 0 auto;
  }

  /* 手机与平板保留两列功能卡，减少纵向长度 */
  .board-grid.landing-features {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .step-grid {
    grid-template-columns: 1fr;
    gap: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
  }

  .step-card {
    padding: 16px 18px;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    box-shadow: none;
  }

  .step-card:last-child {
    border-bottom: 0;
  }

  .landing-about-panel {
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  .landing-visual {
    display: none;
  }

  .landing-features .board-card {
    padding: 16px;
  }

  .landing-features .board-card h3 {
    font-size: 15px;
  }
}

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

.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(0, 0.96fr);
  gap: clamp(18px, 3vw, 40px);
  align-items: stretch;
  align-content: center;
  width: 100%;
  max-width: min(1600px, calc(100vw - 80px));
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: clamp(16px, 3vw, 40px);
}

.brand-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: clamp(28px, 4.2vw, 58px);
  border-radius: 28px;
  color: #f8fbff;
  background:
    radial-gradient(520px 360px at 88% 8%, rgba(96, 165, 250, 0.28), transparent 70%),
    radial-gradient(460px 320px at 4% 96%, rgba(129, 140, 248, 0.24), transparent 72%),
    linear-gradient(158deg, #08182d 0%, #0f2d55 52%, #174887 100%);
  box-shadow: var(--shadow-lg);
}

.brand-panel::after {
  content: "";
  position: absolute;
  right: -90px;
  bottom: -130px;
  width: 380px;
  height: 380px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  box-shadow:
    0 0 0 42px rgba(255, 255, 255, 0.035),
    0 0 0 86px rgba(255, 255, 255, 0.02);
  pointer-events: none;
}

.brand-panel .brand-mark {
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.14);
  box-shadow: none;
  color: #fff;
}

.brand-panel .brand-name em {
  color: rgba(226, 238, 255, 0.68);
}

html[data-theme="dark"] .brand-panel .brand-mark {
  color: #fff;
}

.brand-large {
  color: #fff;
}

.brand-panel-main {
  position: relative;
  z-index: 1;
}

.brand-copy {
  margin-top: clamp(42px, 8vh, 92px);
}

.brand-copy .eyebrow {
  color: rgba(191, 219, 254, 0.85);
}

.brand-copy h1 {
  margin: 0;
  font-size: clamp(30px, 3.4vw, 48px);
  font-weight: 700;
  line-height: 1.16;
  letter-spacing: -0.02em;
}

.brand-lede {
  max-width: 30em;
  margin: 18px 0 0;
  font-size: 15px;
  line-height: 1.8;
  color: rgba(220, 234, 255, 0.78);
}

.brand-points {
  display: grid;
  gap: 12px;
  margin: clamp(32px, 6vh, 60px) 0 0;
  padding: 0;
  list-style: none;
}

.brand-points li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: rgba(226, 238, 255, 0.86);
}

.tick {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #bfdbfe;
  font-size: 11px;
  font-weight: 700;
}

.brand-foot {
  position: relative;
  z-index: 1;
  margin: 36px 0 0;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: rgba(191, 219, 254, 0.5);
}

.form-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 0;
}

.auth-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  max-width: 480px;
  min-height: 700px;
  padding: clamp(28px, 4vw, 42px);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.card-head .eyebrow {
  margin-bottom: 8px;
}

.card-head h2 {
  margin: 0;
  font-size: clamp(23px, 2.4vw, 28px);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.card-head > p:last-child {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13.5px;
}

.auth-form {
  display: grid;
  gap: 16px;
  margin-top: 26px;
}

.stack-form {
  display: grid;
  gap: 14px;
  margin-top: 0;
}

.field {
  display: grid;
  gap: 7px;
}

.field > span:first-child {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
}

.field input,
.field textarea {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  color: var(--text);
  font-size: 14.5px;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--muted);
  opacity: 0.82;
}

.field textarea {
  min-height: 76px;
  line-height: 1.6;
  resize: vertical;
}

.field input:hover,
.field textarea:hover {
  border-color: var(--line-strong);
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.field select {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  color: var(--text);
  font-size: 14.5px;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.field select:hover {
  border-color: var(--line-strong);
}

.field select:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.select-shell {
  position: relative;
  display: block;
}

.select-shell select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-height: 48px;
  padding: 11px 40px 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.select-shell select:hover {
  border-color: var(--line-strong);
}

.select-shell select:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.select-shell::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 17px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.select-shell:focus-within::after {
  border-color: var(--accent);
}

.select-shell-sm select {
  min-height: 42px;
  padding: 9px 12px;
  padding-right: 40px;
  font-size: 13.5px;
}

.select-shell-sm::after {
  right: 15px;
}

.field-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.form-message {
  display: none;
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.55;
}

.form-message.is-error {
  display: block;
  border: 1px solid color-mix(in srgb, var(--danger) 28%, transparent);
  background: var(--danger-soft);
  color: var(--danger);
}

.form-message.is-success {
  display: block;
  border: 1px solid color-mix(in srgb, var(--ok) 28%, transparent);
  background: var(--ok-soft);
  color: var(--ok);
}

.submit-button {
  width: 100%;
  min-height: 50px;
  margin-top: 2px;
}

.switch {
  margin: 22px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.switch a {
  font-weight: 650;
}

.auth-note {
  max-width: 480px;
  margin: 16px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

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

.empty-state,
.guard-card,
.placeholder-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: clamp(40px, 7vw, 72px) 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.empty-state h2,
.guard-card h2,
.placeholder-card h2 {
  margin: 6px 0 0;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.empty-state p,
.guard-card p,
.placeholder-card p {
  max-width: 460px;
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.75;
}

.empty-state .button,
.guard-card .button,
.placeholder-card .button {
  margin-top: 14px;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 24px;
  font-weight: 700;
}

/* ---------------------------------------------------------------- 班级列表 */

.class-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: 16px;
}

.class-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.class-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.1);
  border-color: var(--line-strong);
}

.class-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.class-name {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  word-break: break-word;
}

.class-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

.class-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ---------------------------------------------------------------- 班级管理 */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.student-panel {
  padding: clamp(18px, 3vw, 26px);
}

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

.student-panel-head h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.student-search {
  width: min(240px, 45vw);
  min-height: 38px;
  margin-left: auto;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-muted);
  color: var(--text);
  font-size: 13.5px;
}

.student-search:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.student-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.student-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  transition: border-color 160ms ease;
}

.student-item:hover {
  border-color: var(--line-strong);
}

.student-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  color: var(--muted);
  user-select: none;
}

.student-avatar svg {
  width: 20px;
  height: 20px;
}

.student-index {
  min-width: 22px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.student-name {
  font-size: 14px;
  font-weight: 600;
  word-break: break-all;
}

/* ---------------------------------------------------------------- 3D 座位表 */

.seat-app {
  display: grid;
  gap: 14px;
}

.seat-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.seat-class-field,
.grade-class-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
}

.seat-class-field select,
.grade-class-field select {
  min-height: 38px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-muted);
  color: var(--text);
  font-size: 14px;
}

.seat-class-field select:focus,
.grade-class-field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.seat-tip,
.grade-tip {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.seat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* 点选学生后的操作条 */
.seat-selection {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: var(--radius-md);
  background: var(--accent-soft);
}

.seat-selection-text {
  margin-right: auto;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.seat-selection .button {
  min-height: 40px;
  padding: 0 14px;
  font-size: 12.5px;
}

/* 手机端操作条固定在底部，避免选中下方学生后看不到入口 */
@media (max-width: 900px) {
  .seat-selection {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    z-index: 1200;
    box-shadow: var(--shadow-lg);
  }
}

.seat-person.is-selected {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 10px;
}

.seat-waiting-item.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.seat-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(250px, 17vw, 340px);
  gap: 16px;
  align-items: stretch;
}

.seat-viewport {
  position: relative;
  min-height: 600px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 8%, var(--accent-soft), transparent 58%),
    linear-gradient(180deg, var(--surface-muted), var(--surface));
  perspective: 1200px;
  perspective-origin: 50% 40%;
  touch-action: none;
  cursor: grab;
}

.seat-viewport.is-panning {
  cursor: grabbing;
}

.seat-world {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  place-content: center;
  transform: translate3d(var(--pan-x, 0px), var(--pan-y, 0px), 0)
    rotateX(50deg) scale(var(--seat-zoom, 1));
  transform-origin: 50% 50%;
  transform-style: preserve-3d;
  will-change: transform;
}

/* 缩放控制：浮在视口右下角 */
.seat-zoom {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.seat-zoom-btn {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  color: var(--text);
  font-size: 20px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(6px);
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease,
    transform 140ms ease;
}

.seat-zoom-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.seat-zoom-btn:active:not(:disabled) {
  transform: scale(0.94);
}

.seat-zoom-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.seat-scene {
  width: max-content;
  transform-style: preserve-3d;
}

/* 讲台：台面 + 正面挡板 + 底座，拼成一个有厚度的讲台模型 */
.seat-podium {
  position: relative;
  width: 200px;
  height: 86px;
  margin: 0 auto 22px;
  transform-style: preserve-3d;
}

.podium-top {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 64px;
  border: 1px solid #d8c29a;
  border-radius: 12px;
  background: linear-gradient(150deg, #fdf7ec, #efe0c6 55%, #e0cba6);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.9),
    inset 0 -3px 0 rgba(150, 120, 80, 0.28),
    0 16px 24px rgba(15, 23, 42, 0.16);
  transform: translateZ(30px);
}

.podium-front {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 16px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 5px 5px 9px 9px;
  background: linear-gradient(180deg, #4a86f5, #1d4ed8 85%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -4px 8px rgba(12, 42, 120, 0.45),
    0 12px 20px rgba(29, 78, 216, 0.28);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.35em;
  text-indent: 0.35em;
  transform: rotateX(-50deg);
  transform-origin: top center;
}

html[data-theme="dark"] .podium-top {
  border-color: #3b465a;
  background: linear-gradient(150deg, #2c3442, #242c39 55%, #1d242f);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.06),
    inset 0 -3px 0 rgba(0, 0, 0, 0.5),
    0 16px 24px rgba(0, 0, 0, 0.45);
}

.seat-board {
  display: grid;
  grid-auto-flow: row;
  grid-auto-rows: 92px;
  gap: 10px;
  padding: 34px 48px 58px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(160deg, rgba(37, 99, 235, 0.1), rgba(37, 99, 235, 0.02) 60%),
    var(--surface-muted);
  box-shadow: 0 26px 60px rgba(15, 23, 42, 0.18);
  transform-style: preserve-3d;
}

.seat-cell {
  position: relative;
  display: grid;
  place-items: center;
  transform-style: preserve-3d;
}

/* 课桌模型：桌面 + 前挡板 + 两条桌腿 + 地面投影 */
.seat-desk {
  position: absolute;
  left: 7px;
  right: 7px;
  bottom: 6px;
  height: 36px;
  transform-style: preserve-3d;
  pointer-events: none;
}

.desk-top {
  position: absolute;
  inset: 0;
  border: 1px solid #d8c29a;
  border-radius: 8px;
  background: linear-gradient(150deg, #fcf6ea, #eddfc4 58%, #ddc9a4);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.9),
    inset 0 -2px 0 rgba(150, 120, 80, 0.25),
    0 8px 14px rgba(15, 23, 42, 0.12);
  transform: translateZ(16px);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.desk-apron {
  position: absolute;
  left: 3px;
  right: 3px;
  bottom: -3px;
  height: 12px;
  border-radius: 0 0 6px 6px;
  background: linear-gradient(180deg, #cbb68f, #b39d75);
  transform: translateZ(7px);
}

.desk-leg {
  position: absolute;
  bottom: -16px;
  width: 5px;
  height: 18px;
  border-radius: 2px;
  background: linear-gradient(180deg, #b9a37b, #8f7a55);
  transform: translateZ(2px);
}

.desk-leg-l {
  left: 7px;
}

.desk-leg-r {
  right: 7px;
}

.desk-shadow {
  position: absolute;
  left: 5px;
  right: 5px;
  bottom: -18px;
  height: 12px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.2);
  filter: blur(4px);
}

.seat-cell.is-empty .desk-top {
  border-style: dashed;
  border-color: #c7b28c;
  background: linear-gradient(150deg, #fbf6ec, #f1e6d1 60%, #e7d9bd);
}

.seat-cell.is-drop-over .desk-top {
  border-color: var(--accent);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.9),
    0 0 0 3px var(--accent-soft),
    0 8px 14px rgba(15, 23, 42, 0.12);
}

html[data-theme="dark"] .desk-top {
  border-color: #3b465a;
  background: linear-gradient(150deg, #2c3442, #242c39 58%, #1d242f);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.06),
    inset 0 -2px 0 rgba(0, 0, 0, 0.5),
    0 8px 14px rgba(0, 0, 0, 0.4);
}

html[data-theme="dark"] .desk-apron {
  background: linear-gradient(180deg, #333c4b, #262e3b);
}

html[data-theme="dark"] .desk-leg {
  background: linear-gradient(180deg, #39434f, #272e39);
}

html[data-theme="dark"] .desk-shadow {
  background: rgba(0, 0, 0, 0.5);
}

html[data-theme="dark"] .seat-cell.is-empty .desk-top {
  border-color: #46536a;
  background: linear-gradient(150deg, #202834, #1b222d 60%, #171d26);
}

.seat-slot {
  display: grid;
  place-items: center;
  transform-style: preserve-3d;
}

.seat-hole {
  visibility: hidden;
}

.seat-person,
.seat-add-seat,
.seat-add-column,
.seat-empty-dot {
  transform: rotateX(-50deg) translateZ(6px);
  transform-style: preserve-3d;
}

.seat-person {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 2px;
  max-width: 100%;
  /* 抬离地面，避免姓名被课桌模型遮住 */
  transform: rotateX(-50deg) translateZ(40px);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.seat-person:active {
  cursor: grabbing;
}

/* 座位人物上的标签提示图标 */
.seat-person-badges {
  position: absolute;
  top: -6px;
  left: 50%;
  display: flex;
  gap: 2px;
  pointer-events: none;
  transform: translate3d(-50%, 0, 2px);
}

.seat-badge {
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.3);
  font-size: 10px;
  line-height: 1;
}

.seat-badge-sleep {
  background: #eef2ff;
}

.seat-badge-talk {
  background: #fff7ed;
}

.seat-badge-relation {
  background: #f5f3ff;
}

html[data-theme="dark"] .seat-badge {
  background: var(--surface-muted);
}

.seat-viewport.is-flat .seat-person-badges {
  position: static;
  justify-content: center;
  order: -1;
  transform: none;
}

/* 坐姿人物模型：椅背在最后，上身、头、头发依次叠放 */
.seat-figure {
  position: relative;
  width: 26px;
  height: 30px;
  flex: none;
}

.pm-chair {
  position: absolute;
  top: 11px;
  left: 50%;
  width: 28px;
  height: 18px;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, #b9c3d6, #94a1bb);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transform: translateX(-50%);
}

.pm-body {
  position: absolute;
  top: 13px;
  left: 50%;
  width: 23px;
  height: 17px;
  border-radius: 10px 10px 4px 4px;
  background: linear-gradient(180deg, var(--pm-shirt, #4a86f5), var(--pm-shirt-dark, #1d4ed8));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 2px 4px rgba(15, 23, 42, 0.16);
  transform: translateX(-50%);
}

.pm-head {
  position: absolute;
  top: 0;
  left: 50%;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, #ffe7ca, #f0c49a 62%, #d9a373);
  box-shadow: inset -1px -1px 2px rgba(150, 90, 40, 0.22);
  transform: translateX(-50%);
}

/* 眼睛：让轮廓更像“人” */
.pm-head::before,
.pm-head::after {
  content: "";
  position: absolute;
  top: 9px;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #4a3a33;
}

.pm-head::before {
  left: 4px;
}

.pm-head::after {
  right: 4px;
}

.pm-hair {
  position: absolute;
  top: -1px;
  left: 50%;
  width: 18px;
  height: 7px;
  border-radius: 9px 9px 6px 6px;
  background: linear-gradient(180deg, #3a3440, #241f2b);
  transform: translateX(-50%);
}

.seat-waiting-item .student-avatar,
.seat-drag-ghost .student-avatar {
  width: 30px;
  height: 30px;
}

.seat-waiting-item .student-avatar svg,
.seat-drag-ghost .student-avatar svg {
  width: 18px;
  height: 18px;
}

html[data-theme="dark"] .pm-chair {
  background: linear-gradient(180deg, #3a4456, #2b3444);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.seat-person-name {
  max-width: 68px;
  padding: 0 5px;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.1);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-theme="dark"] .seat-person-name {
  background: rgba(15, 22, 36, 0.78);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.seat-empty-dot {
  width: 12px;
  height: 12px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 50%;
  background: transparent;
  opacity: 0.65;
  /* 抬到桌面之上，避免被课桌模型遮住 */
  transform: rotateX(-50deg) translateZ(30px);
}

.seat-add-seat,
.seat-add-column {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px dashed var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
}

.seat-add-seat:hover,
.seat-add-column:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

/* 座位右键 / 长按菜单 */
.seat-context-menu {
  position: fixed;
  z-index: 1100;
  display: grid;
  gap: 2px;
  min-width: 168px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.seat-context-item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--danger);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.seat-context-item:hover,
.seat-context-item:focus-visible {
  outline: none;
  background: var(--danger-soft);
}

.seat-context-profile {
  display: grid;
  gap: 3px;
  min-width: 180px;
  max-width: 240px;
  padding: 8px 12px 6px;
}

.seat-context-name {
  font-size: 13.5px;
}

.seat-context-line {
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.seat-context-line.is-muted {
  color: var(--muted);
}

.seat-context-tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}

.seat-tag-chip {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 600;
}

.seat-tag-sleep {
  background: #eef2ff;
  color: #4338ca;
}

.seat-tag-talk {
  background: #fff7ed;
  color: #c2410c;
}

html[data-theme="dark"] .seat-tag-sleep {
  background: #1e2340;
  color: #a5b4fc;
}

html[data-theme="dark"] .seat-tag-talk {
  background: #2a1d12;
  color: #fdba74;
}

.seat-context-item-edit {
  color: var(--accent-strong);
}

.seat-context-item-edit:hover,
.seat-context-item-edit:focus-visible {
  background: var(--accent-soft);
}

.seat-context-divider {
  display: block;
  height: 1px;
  margin: 4px 6px;
  background: var(--line);
}

/* 标签与关系弹窗 */
.meta-section {
  display: grid;
  gap: 8px;
}

.meta-section h3 {
  margin: 0;
  font-size: 14px;
}

.tag-toggle-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-toggle {
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-soft);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.tag-toggle:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.tag-toggle.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.meta-relation-list {
  max-height: 220px;
}

/* 智能分座弹窗 */
.smart-options {
  display: grid;
  gap: 8px;
}

.smart-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  cursor: pointer;
}

.smart-option input {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: var(--accent);
}

.smart-option-text {
  display: grid;
  gap: 2px;
  font-size: 13.5px;
}

.smart-option-text small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.smart-option.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.seat-waiting {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  transition: border-color 150ms ease, background 150ms ease;
}

.seat-waiting.is-drop-target {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.seat-waiting-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.seat-waiting-head h2 {
  margin: 0;
  font-size: 16px;
}

.seat-waiting-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  align-content: start;
  flex: 1;
  gap: 8px;
  min-height: 0;
  margin-top: 12px;
  overflow-y: auto;
}

.seat-waiting-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-muted);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.seat-waiting-item:active {
  cursor: grabbing;
}

.seat-waiting-name {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

/* 待入座头像：标签图标叠加在头像右上角 */
.seat-waiting-avatar {
  position: relative;
  display: inline-flex;
  flex: none;
}

.seat-waiting-tags {
  position: absolute;
  top: -5px;
  right: -6px;
  display: inline-flex;
  gap: 1px;
}

.seat-waiting-tags .seat-badge {
  width: 14px;
  height: 14px;
  font-size: 9px;
}

.seat-drag-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 6px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.28);
  pointer-events: none;
  will-change: transform;
}

.seat-drag-ghost span {
  font-size: 13px;
  font-weight: 600;
}

/* ---------------------------------------------------------------- 3D 预览开关 */

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

.seat-toggle-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-muted);
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
}

.toggle-switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
  transition: transform 160ms ease;
}

.toggle-switch[aria-checked="true"] {
  border-color: var(--accent);
  background: var(--accent);
}

.toggle-switch[aria-checked="true"] .toggle-switch-thumb {
  transform: translateX(20px);
}

.toggle-switch:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ---------------------------------------------------------------- 平面（关闭 3D 预览） */

.seat-viewport.is-flat {
  height: min(72vh, 720px);
  height: min(72dvh, 720px);
  min-height: 420px;
  overflow: auto;
  padding: 20px;
  perspective: none;
  cursor: auto;
  touch-action: auto;
}

.seat-viewport.is-flat .seat-world {
  position: static;
  inset: auto;
  display: block;
  transform: none;
  will-change: auto;
}

.seat-viewport.is-flat .seat-scene {
  width: max-content;
  margin: 0 auto;
  transform-style: flat;
}

.seat-viewport.is-flat .seat-zoom {
  display: none;
}

/* 平面模式下讲台变成一个普通横条 */
.seat-viewport.is-flat .seat-podium {
  display: block;
  width: 190px;
  height: auto;
  margin: 0 auto 16px;
}

.seat-viewport.is-flat .podium-top {
  display: none;
}

.seat-viewport.is-flat .podium-front {
  position: static;
  display: grid;
  height: auto;
  place-items: center;
  padding: 8px 12px;
  transform: none;
  font-size: 13px;
}

.seat-viewport.is-flat .seat-board {
  grid-auto-rows: 78px;
  padding: 18px;
  transform-style: flat;
}

.seat-viewport.is-flat .seat-cell {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-muted);
  transform-style: flat;
}

.seat-viewport.is-flat .seat-cell.is-empty {
  border-style: dashed;
  background: var(--surface);
}

.seat-viewport.is-flat .seat-cell.is-drop-over {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* 平面模式不展示 3D 课桌模型 */
.seat-viewport.is-flat .seat-desk {
  display: none;
}

.seat-viewport.is-flat .seat-person {
  position: static;
  flex-direction: column;
  gap: 1px;
  transform: none;
}

.seat-viewport.is-flat .seat-person-name {
  padding: 0 3px;
  background: transparent;
  box-shadow: none;
}

.seat-viewport.is-flat .seat-empty-dot,
.seat-viewport.is-flat .seat-add-seat,
.seat-viewport.is-flat .seat-add-column {
  transform: none;
}

@media (max-width: 900px) {
  .seat-workspace {
    grid-template-columns: 1fr;
  }

  .seat-viewport {
    min-height: 460px;
  }

  .seat-waiting-list {
    max-height: 280px;
  }
}

.empty-line {
  margin: 18px 0 0;
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

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

.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 18px;
}

.info-list {
  display: grid;
  gap: 12px;
  margin: 0;
}

.info-list > div {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
}

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

.info-list dd {
  margin: 0;
  color: var(--text-soft);
  font-size: 13.5px;
  font-weight: 500;
  word-break: break-all;
}

.logout-card {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.logout-card h2 {
  margin-bottom: 4px;
}

.logout-card .card-lede {
  margin: 0;
}

/* 邀请码 */
.invite-card {
  grid-column: 1 / -1;
}

.invite-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.invite-card-head h2 {
  margin-bottom: 6px;
}

.invite-card-head .card-lede {
  margin: 0;
}

.invite-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.invite-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.invite-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
  user-select: all;
}

.invite-state {
  padding: 2px 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 650;
}

.invite-state.is-used {
  border-color: var(--line);
  background: transparent;
  color: var(--text-soft);
}

.invite-meta {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.invite-copy {
  min-height: 44px;
  padding: 0 14px;
  font-size: 12px;
}

.invite-empty {
  margin: 12px 0 0;
  font-size: 12.5px;
}

@media (max-width: 640px) {
  .invite-card-head {
    flex-direction: column;
    align-items: stretch;
  }

  .invite-card-head .button {
    width: 100%;
  }

  .invite-meta {
    width: 100%;
    margin-left: 0;
  }
}

/* ---------------------------------------------------------------- 弹窗 */

.modal {
  width: min(560px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transition:
    opacity 180ms ease,
    transform 180ms ease,
    overlay 180ms ease allow-discrete,
    display 180ms ease allow-discrete;
}

.modal[open] {
  opacity: 1;
  transform: none;
}

@starting-style {
  .modal[open] {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
}

#import-students-modal {
  width: min(760px, calc(100vw - 32px));
}

.modal::backdrop {
  background: rgba(4, 10, 22, 0.58);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition:
    opacity 180ms ease,
    overlay 180ms ease allow-discrete,
    display 180ms ease allow-discrete;
}

.modal[open]::backdrop {
  opacity: 1;
}

@starting-style {
  .modal[open]::backdrop {
    opacity: 0;
  }
}

.modal-card {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 26px 0;
}

.modal-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.modal-close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 26px;
  overflow-y: auto;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 26px 24px;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}

.sample-table-wrap {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.sample-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.sample-table th,
.sample-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.sample-table th {
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sample-table tr:last-child td {
  border-bottom: 0;
}

.check-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  cursor: pointer;
}

.check-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.check-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 300px;
  padding: 4px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.check-list:empty {
  display: none;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 9px;
  cursor: pointer;
}

.check-item:hover {
  background: var(--surface-muted);
}

.check-item input {
  width: 16px;
  height: 16px;
  flex: none;
  accent-color: var(--accent);
}

.check-item .check-index {
  min-width: 24px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- 成绩 */

.grade-app {
  display: grid;
  gap: 14px;
}

.grade-status {
  display: grid;
  gap: 10px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.grade-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.grade-toolbar .button {
  margin-left: auto;
}

.grade-table .is-rank {
  color: var(--text-soft);
  font-weight: 600;
}

.grade-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.grade-actions .button,
.grade-actions .grade-menu {
  margin-left: 0;
}

.grade-menu {
  position: relative;
}

.grade-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  display: grid;
  gap: 8px;
  width: 272px;
  max-height: calc(100vh - 140px);
  max-height: calc(100dvh - 140px);
  overflow-y: auto;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.grade-popover-wide {
  width: 328px;
}

.grade-popover-title {
  margin: 2px 0 0;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.grade-popover-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.grade-check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-soft);
  font-size: 13.5px;
  cursor: pointer;
}

.grade-check input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.grade-check.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.grade-check.is-disabled input {
  cursor: not-allowed;
}

.grade-popover-more {
  gap: 10px;
}

.grade-popover-more .grade-check {
  padding: 6px 8px;
  border-radius: 10px;
  transition: background 140ms ease, color 140ms ease;
}

.grade-popover-more .grade-check:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.grade-popover-more .grade-check input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  position: relative;
  transition: border-color 140ms ease, background 140ms ease;
}

.grade-popover-more .grade-check input[type="checkbox"]:hover {
  border-color: var(--accent);
}

.grade-popover-more .grade-check input[type="checkbox"]:checked {
  border-color: var(--accent);
  background: var(--accent);
}

.grade-popover-more .grade-check input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: #ffffff;
}

.grade-popover-more .grade-check input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.grade-sort-modes {
  display: grid;
  gap: 6px;
}

.grade-sort-subjects {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.grade-baseline-field {
  margin: 0;
}

.grade-popover-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.share-options {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

/* 移动端把「更多 / 排序」面板放进弹窗，面板本体去掉浮层外观 */
.grade-modal .grade-popover {
  position: static;
  top: auto;
  right: auto;
  width: auto;
  max-height: none;
  overflow: visible;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.grade-modal .grade-popover > .grade-popover-title:first-child {
  display: none;
}

.grade-modal .grade-popover-actions {
  margin-top: 8px;
}

@media (max-width: 640px) {
  .grade-modal .grade-popover-actions {
    flex-direction: column;
  }

  .grade-modal .grade-popover-actions .button {
    width: 100%;
  }
}

.grade-exam-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.grade-exam-hint {
  margin-left: auto;
}

.grade-exam-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 0;
  scrollbar-width: thin;
}

.grade-exam-tab {
  flex: 0 0 auto;
  padding: 6px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 13px;
  cursor: pointer;
  transition: color 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.grade-exam-tab:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

.grade-exam-tab.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 600;
}

.grade-exam-add {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px dashed var(--line-strong);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.16s ease, border-color 0.16s ease;
}

.grade-exam-add:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.grade-exam-hint,
.grade-exam-empty {
  color: var(--muted);
  font-size: 12px;
}

.grade-exam-menu {
  position: fixed;
  z-index: 1200;
  min-width: 148px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.grade-exam-menu-item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--danger);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.grade-exam-menu-item:hover {
  background: var(--danger-soft);
}

.grade-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 12.5px;
}

.grade-overview {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
}

.grade-overview-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 12px;
}

.grade-overview-head h2 {
  margin: 0;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.grade-overview-note {
  color: var(--muted);
  font-size: 11.5px;
}

.grade-overview-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.grade-metric {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-muted);
}

.grade-metric span {
  color: var(--muted);
  font-size: 11.5px;
}

.grade-metric strong {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.grade-text-button {
  justify-self: start;
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}

.grade-text-button:hover {
  text-decoration: underline;
}

.grade-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.grade-table td.is-editable {
  cursor: text;
}

.grade-table td.is-editable:hover {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.grade-table td.is-editing {
  padding: 3px;
  background: var(--accent-soft);
}

.grade-table td.is-editable:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: var(--accent-soft);
}

.grade-cell-input {
  width: 100%;
  min-width: 58px;
  height: 32px;
  padding: 0 4px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: center;
}

.grade-cell-input::-webkit-inner-spin-button,
.grade-cell-input::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
}

.share-manage-list {
  display: grid;
  gap: 10px;
}

.share-manage-item {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-muted);
}

.share-manage-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.share-manage-title strong {
  font-size: 14px;
}

.share-manage-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.share-manage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.share-manage-actions .button {
  min-height: 44px;
  padding: 0 14px;
  font-size: 12.5px;
}

.share-state {
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.share-state.is-trend {
  border-color: color-mix(in srgb, var(--accent) 24%, transparent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.share-state.is-expired {
  border-color: color-mix(in srgb, var(--danger) 24%, transparent);
  background: var(--danger-soft);
  color: var(--danger);
}

.grade-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 13px;
}

.grade-table th,
.grade-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  text-align: center;
  white-space: nowrap;
}

.grade-table thead th {
  background: var(--surface-muted);
  color: var(--text-soft);
  font-weight: 600;
}

.grade-table tbody tr:last-child th,
.grade-table tbody tr:last-child td {
  border-bottom: 0;
}

.grade-table tbody tr:not(.grade-average-row):nth-child(even) td,
.grade-table tbody tr:not(.grade-average-row):nth-child(even) .grade-name-cell {
  background: color-mix(in srgb, var(--surface-muted) 55%, var(--surface));
}

.grade-table tbody tr:hover td,
.grade-table tbody tr:hover .grade-name-cell {
  background: var(--surface-muted);
}

.grade-table .grade-name-col,
.grade-table .grade-name-cell {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
  text-align: left;
}

.grade-table thead .grade-name-col {
  background: var(--surface-muted);
}

.grade-table .grade-name-cell {
  font-weight: 600;
}

.grade-table .is-total {
  color: var(--accent-strong);
  font-weight: 700;
}

.grade-table .is-up {
  color: var(--ok);
  font-weight: 600;
}

.grade-table .is-down {
  color: var(--danger);
  font-weight: 600;
}

.grade-table td.is-missing {
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 700;
}

.score-arrow {
  display: inline-block;
  margin-left: 4px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.score-arrow.is-up {
  color: var(--ok);
}

.score-arrow.is-down {
  color: var(--danger);
}

.grade-compare-field {
  display: grid;
  gap: 6px;
}

.unmatched-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 190px;
  padding: 2px 0 4px;
  overflow: auto;
}

.unmatched-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 13px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 600;
}

#grade-analysis-modal {
  width: min(820px, calc(100vw - 32px));
}

#student-profile-modal {
  width: min(760px, calc(100vw - 32px));
}

#confirm-modal,
#prompt-modal {
  width: min(440px, calc(100vw - 32px));
}

#grade-share-modal {
  width: min(520px, calc(100vw - 32px));
}

.share-card-canvas {
  display: block;
  width: 100%;
  max-width: 360px;
  margin: 0 auto 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #ffffff;
}

.share-url-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  word-break: break-all;
}

.share-url-line span {
  flex: 1;
  min-width: 0;
}

.share-url-line .button {
  flex: none;
}

.modal-message {
  margin: 0;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.75;
  white-space: pre-line;
}

.grade-average-row th,
.grade-average-row td {
  background: var(--surface-muted);
  color: var(--text-soft);
  font-weight: 600;
}

.grade-average-row .grade-name-cell {
  color: var(--accent-strong);
}

.student-name-button {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.student-name-button:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.seat-badge svg {
  width: 12px;
  height: 12px;
}

.seat-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.seat-tag-icon {
  width: 12px;
  height: 12px;
}

.tag-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tag-toggle-icon {
  width: 16px;
  height: 16px;
}

.relation-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  color: var(--text-soft);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.relation-toggle:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.relation-count {
  color: var(--muted);
  font-weight: 500;
}

.relation-panel {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.relation-search {
  width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
}

.relation-search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.relation-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.relation-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12.5px;
  font-weight: 600;
}

.relation-chip-remove {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.12);
  color: inherit;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.relation-chip-remove:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

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

.analysis-exam-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.analysis-exam {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-muted);
  font-size: 13px;
  cursor: pointer;
}

.analysis-exam input {
  accent-color: var(--accent);
}

.analysis-summary {
  color: var(--text-soft);
  font-size: 13px;
}

.analysis-section {
  margin-top: 16px;
}

.analysis-section h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.analysis-hint {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12.5px;
}

.analysis-list {
  display: grid;
  gap: 8px;
}

.analysis-item {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.analysis-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.analysis-item-head strong {
  font-size: 14px;
}

.analysis-delta {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.analysis-delta.is-up {
  color: var(--ok);
}

.analysis-delta.is-down {
  color: var(--danger);
}

.analysis-detail {
  margin: 0;
  color: var(--text-soft);
  font-size: 12.5px;
}

.profile-summary {
  margin: 0 0 12px;
  color: var(--text-soft);
  font-size: 13.5px;
}

.profile-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px;
}

.profile-chart {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.profile-chart-total {
  grid-column: 1 / -1;
}

.profile-average-line {
  fill: none;
  stroke: var(--chart-average);
  stroke-width: 2.2;
  stroke-dasharray: 7 5;
  stroke-linejoin: round;
  stroke-linecap: round;
  opacity: 0.95;
}

.profile-band {
  fill: var(--accent-soft);
  opacity: 0.85;
}

.profile-area-start {
  stop-color: var(--accent);
  stop-opacity: 0.24;
}

.profile-area-end {
  stop-color: var(--accent);
  stop-opacity: 0;
}

.profile-area {
  pointer-events: none;
}

.profile-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11.5px;
}

.profile-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.profile-legend-swatch {
  width: 16px;
  height: 3px;
  border-radius: 2px;
  background: var(--accent);
}

.profile-legend-swatch.is-average {
  height: 3px;
  background: repeating-linear-gradient(
    90deg,
    var(--chart-average) 0 5px,
    transparent 5px 8px
  );
}

.profile-legend-swatch.is-band {
  width: 14px;
  height: 10px;
  border-radius: 3px;
  background: var(--accent-soft);
}

.profile-chart h3 {
  margin: 0 0 6px;
  font-size: 14px;
}

.profile-chart-svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

.profile-grid-line {
  stroke: var(--line-strong);
  stroke-width: 1;
  stroke-dasharray: 4 5;
  opacity: 0.55;
}

.profile-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.8;
  stroke-linejoin: round;
  stroke-linecap: round;
  filter: drop-shadow(0 2px 3px rgba(37, 99, 235, 0.22));
}

.profile-point {
  fill: var(--surface);
  stroke: var(--accent);
  stroke-width: 2.4;
}

.profile-point.is-last {
  fill: var(--accent);
  stroke: var(--surface);
  stroke-width: 2.5;
}

.profile-point-label {
  fill: var(--text);
  font-size: 11px;
  font-weight: 700;
  paint-order: stroke;
  stroke: var(--surface);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.profile-average-label {
  fill: var(--chart-average);
  font-size: 10.5px;
  font-weight: 700;
  paint-order: stroke;
  stroke: var(--surface);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.profile-axis-label {
  fill: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.profile-trend {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

.profile-trend.is-up {
  color: var(--ok);
}

.profile-trend.is-down {
  color: var(--danger);
}

/* ---------------------------------------------------------------- 轻提示 / 页脚 */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 1200;
  max-width: min(90vw, 420px);
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  font-size: 13px;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.is-error {
  border-color: var(--danger);
  color: var(--danger);
}

.toast.is-success {
  border-color: var(--ok);
  color: var(--ok);
}

.foot {
  width: 100%;
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: 0 clamp(20px, 2.6vw, 40px) 36px;
  color: var(--muted);
  font-size: 12px;
}

/* ---------------------------------------------------------------- 宽屏适配 */

@media (min-width: 901px) {
  /* 桌面端顶栏已有完整导航，不再显示冗余的抽屉按钮 */
  .menu-button {
    display: none;
  }
}

@media (min-width: 1100px) {
  .profile-grid {
    max-width: 1180px;
    margin-inline: auto;
  }
}

@media (min-width: 1200px) {
  .seat-viewport {
    min-height: clamp(640px, 72vh, 920px);
    min-height: clamp(640px, 72dvh, 920px);
  }
}

@media (min-width: 1500px) {
  .stat-card {
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    gap: 28px;
  }

  .stat-value {
    font-size: 34px;
  }

  .stat-value-small {
    padding-top: 0;
  }

  .hero {
    padding-inline: clamp(36px, 3vw, 56px);
  }

  .hero-copy {
    max-width: 860px;
  }

  .student-list {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}

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

@media (max-width: 900px) {
  /* 窄屏不再让页面主体两侧各留 40px，避免内容被压成一条窄栏 */
  :root {
    --shell-max: 100%;
  }
}

@media (max-width: 980px) {
  .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .board-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  /* 移动端导航收进左侧抽屉 */
  .topnav {
    display: none;
  }

  .home-dashboard {
    grid-template-columns: 1fr;
    grid-template-areas:
      "classes"
      "shortcuts"
      "tip";
  }

  .auth-layout {
    grid-template-columns: 1fr;
    min-height: auto;
    max-width: 100%;
    padding: 14px;
  }

  .brand-panel {
    padding: 24px 26px;
    border-radius: 22px;
  }

  .brand-copy {
    margin-top: 24px;
  }

  .brand-copy h1 {
    font-size: clamp(24px, 5vw, 32px);
  }

  .brand-lede {
    margin-top: 10px;
    font-size: 13.5px;
  }

  .brand-points {
    display: none;
  }

  .brand-foot {
    display: none;
  }

  .form-panel {
    padding: 18px 0 40px;
  }

  .auth-card {
    min-height: 0;
  }

  .profile-grid {
    grid-template-columns: 1fr;
  }

  .logout-card {
    grid-column: auto;
  }
}

@media (max-width: 720px) {
  .topbar-inner {
    padding: 11px 68px 11px 16px;
  }

  .page {
    padding: 22px 16px 40px;
  }

  .home {
    padding: 22px 16px 40px;
  }

  .board-grid,
  .rules-list {
    grid-template-columns: 1fr;
  }

  .hero {
    align-items: flex-start;
    flex-direction: column;
    gap: 20px;
  }

  .hero-mark {
    display: none;
  }

  .student-list {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .topbar-inner {
    gap: 10px;
  }

  .brand-name em {
    display: none;
  }

  .brand-name {
    font-size: 14px;
  }

  .topnav {
    gap: 12px;
  }

  .topnav a {
    font-size: 13px;
  }

  .page-head {
    flex-direction: column;
    align-items: stretch;
  }

  .page-head .button {
    align-self: flex-start;
  }

  /* 学生名单头部：标题与人数一行，搜索框独占下一行 */
  .student-panel-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 12px;
  }

  .student-panel-head h2 {
    grid-column: 1;
    grid-row: 1;
  }

  .student-panel-head .badge {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  .student-search {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    margin-left: 0;
  }

  /* 手机端缩窄成绩表，尽量在一屏内显示更多科目列 */
  .grade-table {
    min-width: 100%;
    font-size: 12px;
  }

  .grade-table th,
  .grade-table td {
    padding: 7px 5px;
  }

  .grade-table .grade-name-col,
  .grade-table .grade-name-cell {
    padding-left: 8px;
    padding-right: 8px;
  }

  /* 手机端成绩工具栏：次要操作压成一行，减少纵向占用 */
  .grade-app {
    gap: 10px;
  }

  .grade-toolbar {
    padding: 10px 12px;
    gap: 8px;
  }

  .grade-actions {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
  }

  .grade-actions .button {
    width: 100%;
    min-height: 38px;
    padding: 0 2px;
    border-radius: 10px;
    font-size: 12.5px;
  }

  .grade-actions .grade-menu {
    min-width: 0;
  }

  .grade-actions .grade-menu > .button {
    width: 100%;
  }

  .grade-status {
    padding: 10px 12px;
    gap: 8px;
  }

  .grade-exam-bar {
    flex-wrap: nowrap;
  }

  .grade-exam-tabs {
    flex: 1 1 auto;
    min-width: 0;
    gap: 4px;
  }

  .grade-exam-hint {
    flex: none;
    font-size: 11px;
  }

  .grade-summary {
    padding-top: 8px;
  }

  .grade-summary [data-grade-note] {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: 11.5px;
    line-height: 1.5;
  }

  .grade-overview-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .grade-metric {
    padding: 8px 10px;
  }

  .grade-metric strong {
    font-size: 17px;
  }

  .stat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .stat-card {
    gap: 2px;
    padding: 12px 10px;
  }

  .stat-label {
    font-size: 11px;
  }

  .stat-value {
    font-size: 22px;
  }

  .stat-value-small {
    padding-top: 4px;
    font-size: 13px;
  }

  .home-classes,
  .home-shortcuts,
  .home-tip {
    padding: 16px;
  }

  .quick-grid {
    grid-template-columns: 1fr;
  }

  .student-list {
    grid-template-columns: 1fr;
  }

  .logout-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .modal {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
  }

  #import-students-modal {
    width: calc(100vw - 16px);
  }

  .modal-card {
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
  }

  .modal-actions {
    flex-direction: column;
  }

  .modal-actions .button {
    width: 100%;
  }
}

@media (max-width: 460px) {
  .theme-fab {
    top: 12px;
    right: 12px;
    width: 44px;
    height: 44px;
    border-radius: 12px;
  }

  .topbar-inner {
    padding-right: 62px;
  }

  .auth-layout {
    padding: 10px;
  }

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

@media (max-width: 360px) {
  .grade-actions .button {
    font-size: 11px;
  }

  .grade-exam-hint {
    display: none;
  }
}

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