/* =========================================================
 *  课表网站 · 样式
 *  手机优先，同时适配平板 / 桌面
 * ========================================================= */

/* ---------- 主题变量 ---------- */
:root {
  --font: "PingFang SC", "HarmonyOS Sans SC", "Noto Sans SC", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 20px;
  --radius-sm: 12px;
  --shell: 1100px;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

/* 极光 AURORA */
[data-theme="aurora"] {
  --bg-1: #eef1ff; --bg-2: #f7f0ff; --bg-3: #eaf7ff;
  --mesh-a: #7c5cff; --mesh-b: #38bdf8; --mesh-c: #f472b6;
  --ink: #171a2b; --ink-soft: #4a5070; --ink-mute: #878da8;
  --surface: rgba(255, 255, 255, .72);
  --surface-solid: #ffffff;
  --line: rgba(23, 26, 43, .08);
  --accent: #6d5efc; --accent-ink: #ffffff;
  --cell: rgba(23, 26, 43, .045);
  --cell-today: rgba(109, 94, 252, .1);
  --shadow: 0 18px 50px -20px rgba(60, 50, 140, .45);
}
/* 糖果 CANDY */
[data-theme="candy"] {
  --bg-1: #fff1f6; --bg-2: #fff7ea; --bg-3: #f3f0ff;
  --mesh-a: #ff7ab8; --mesh-b: #ffb347; --mesh-c: #8b7bff;
  --ink: #2a1830; --ink-soft: #5c4568; --ink-mute: #9a86a6;
  --surface: rgba(255, 255, 255, .74);
  --surface-solid: #ffffff;
  --line: rgba(42, 24, 48, .08);
  --accent: #ff5c9e; --accent-ink: #ffffff;
  --cell: rgba(42, 24, 48, .045);
  --cell-today: rgba(255, 92, 158, .1);
  --shadow: 0 18px 50px -20px rgba(150, 60, 120, .4);
}
/* 薄荷 MINT */
[data-theme="mint"] {
  --bg-1: #ecfdf7; --bg-2: #f2fbff; --bg-3: #f7fff4;
  --mesh-a: #2dd4bf; --mesh-b: #60a5fa; --mesh-c: #a3e635;
  --ink: #0f2620; --ink-soft: #3d5a52; --ink-mute: #7e9a92;
  --surface: rgba(255, 255, 255, .72);
  --surface-solid: #ffffff;
  --line: rgba(15, 38, 32, .08);
  --accent: #0fa47f; --accent-ink: #ffffff;
  --cell: rgba(15, 38, 32, .045);
  --cell-today: rgba(15, 164, 127, .1);
  --shadow: 0 18px 50px -20px rgba(20, 110, 90, .35);
}
/* 日落 SUNSET */
[data-theme="sunset"] {
  --bg-1: #fff4ec; --bg-2: #ffeef2; --bg-3: #fdf1e3;
  --mesh-a: #ff8a4c; --mesh-b: #f43f7a; --mesh-c: #ffc857;
  --ink: #2b1a14; --ink-soft: #5f4034; --ink-mute: #a18476;
  --surface: rgba(255, 255, 255, .74);
  --surface-solid: #ffffff;
  --line: rgba(43, 26, 20, .08);
  --accent: #f0503a; --accent-ink: #ffffff;
  --cell: rgba(43, 26, 20, .045);
  --cell-today: rgba(240, 80, 58, .1);
  --shadow: 0 18px 50px -20px rgba(160, 60, 30, .4);
}

/* 樱花粉 SAKURA */
[data-theme="sakura"] {
  --bg-1: #fff2f6; --bg-2: #ffeef4; --bg-3: #fff6f9;
  --mesh-a: #ff9ec4; --mesh-b: #ffc2d8; --mesh-c: #ffb8cf;
  --ink: #3a2430; --ink-soft: #6b4a5c; --ink-mute: #a8899a;
  --surface: rgba(255, 255, 255, .84);
  --surface-solid: #ffffff;
  --line: rgba(58, 36, 48, .07);
  --accent: #f078a6; --accent-ink: #ffffff;
  --cell: rgba(58, 36, 48, .03);
  --cell-today: rgba(240, 120, 166, .13);
  --shadow: 0 18px 50px -20px rgba(210, 120, 160, .38);
}
/* 樱花粉背景下减弱网格，避免发灰 */
[data-theme="sakura"] .bg-grid { opacity: .28; }
[data-theme="sakura"] .bg-mesh { filter: blur(52px) saturate(125%); }

/* 深色模式 */
[data-dark="true"] {
  --bg-1: #0c0d16; --bg-2: #121320; --bg-3: #0a0f18;
  --ink: #eef0ff; --ink-soft: #b3b8d4; --ink-mute: #767c9c;
  --surface: rgba(28, 30, 46, .72);
  --surface-solid: #1b1d2e;
  --line: rgba(255, 255, 255, .1);
  --cell: rgba(255, 255, 255, .06);
  --shadow: 0 18px 50px -20px rgba(0, 0, 0, .8);
}
[data-theme="aurora"][data-dark="true"] { --accent: #9b8cff; --accent-ink: #16112b; --cell-today: rgba(155, 140, 255, .14); }
[data-theme="candy"][data-dark="true"] { --accent: #ff8cbc; --accent-ink: #2a1830; --cell-today: rgba(255, 140, 188, .14); }
[data-theme="mint"][data-dark="true"] { --accent: #3ee0b8; --accent-ink: #06231c; --cell-today: rgba(62, 224, 184, .14); }
[data-theme="sunset"][data-dark="true"] { --accent: #ff8a6a; --accent-ink: #2b1410; --cell-today: rgba(255, 138, 106, .14); }
[data-theme="sakura"][data-dark="true"] { --accent: #ff9dbd; --accent-ink: #2a1620; --cell-today: rgba(255, 157, 189, .14); }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg-1);
  line-height: 1.6;
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom);
  transition: background .5s var(--ease), color .3s var(--ease);
}

/* ---------- 背景 ---------- */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.bg-mesh {
  position: absolute; inset: -30%;
  background:
    radial-gradient(38% 38% at 18% 12%, color-mix(in srgb, var(--mesh-a) 42%, transparent), transparent 70%),
    radial-gradient(42% 42% at 82% 18%, color-mix(in srgb, var(--mesh-b) 34%, transparent), transparent 72%),
    radial-gradient(48% 48% at 50% 88%, color-mix(in srgb, var(--mesh-c) 34%, transparent), transparent 72%),
    linear-gradient(160deg, var(--bg-1), var(--bg-2) 50%, var(--bg-3));
  filter: blur(40px) saturate(115%);
  animation: drift 26s ease-in-out infinite alternate;
}
[data-dark="true"] .bg-mesh { filter: blur(60px) saturate(130%) brightness(.62); }
@keyframes drift {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(-3%, 2%, 0) scale(1.06); }
  100% { transform: translate3d(2%, -2%, 0) scale(1.02); }
}
.bg-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, var(--line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 20%, transparent 78%);
  opacity: .55;
}

/* ---------- 顶部栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  transition: background .3s var(--ease), backdrop-filter .3s;
}
.topbar.scrolled {
  background: color-mix(in srgb, var(--bg-1) 72%, transparent);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: var(--shell); margin: 0 auto;
  display: flex; align-items: center; gap: 10px;
}
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  text-decoration: none; color: var(--ink);
  font-weight: 700; letter-spacing: .2px;
  min-width: 0;
}
.brand-mark {
  width: 30px; height: 30px; flex: 0 0 30px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--mesh-a), var(--mesh-b));
  color: #fff; font-size: 15px; font-weight: 800;
  box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--mesh-a) 80%, transparent);
}
.brand-text { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topnav { margin-left: auto; display: flex; gap: 2px; }
.topnav-link {
  text-decoration: none; color: var(--ink-soft);
  font-size: 13.5px; padding: 7px 11px; border-radius: 999px;
  transition: background .2s, color .2s;
}
.topnav-link:hover, .topnav-link.active { background: var(--surface); color: var(--ink); }
.icon-btn {
  flex: 0 0 auto; width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-soft);
  cursor: pointer; transition: transform .3s var(--ease), background .2s;
  backdrop-filter: blur(10px);
}
.icon-btn:active { transform: scale(.9); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: 26px 20px 10px;
  max-width: var(--shell); margin: 0 auto;
}
.hero-inner {
  display: flex; align-items: center; gap: 16px;
  animation: rise .7s var(--ease) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.avatar {
  flex: 0 0 auto;
  width: 76px; height: 76px; border-radius: 26px;
  display: grid; place-items: center;
  font-size: 30px; font-weight: 800; color: #fff;
  background: linear-gradient(140deg, var(--mesh-a), var(--mesh-b) 60%, var(--mesh-c));
  box-shadow: 0 16px 34px -14px color-mix(in srgb, var(--mesh-a) 90%, transparent);
  overflow: hidden;
  position: relative;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(150deg, rgba(255,255,255,.35), transparent 55%);
  pointer-events: none;
}

.hero-text { min-width: 0; }
.eyebrow {
  margin: 0 0 2px; font-size: 12px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-mute); font-weight: 600;
}
.hero-title {
  margin: 0; font-size: clamp(26px, 7.5vw, 40px); line-height: 1.15;
  font-weight: 800; letter-spacing: -.02em;
  background: linear-gradient(100deg, var(--ink) 30%, var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { margin: 4px 0 0; color: var(--ink-soft); font-size: 14px; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  font-size: 12px; padding: 4px 10px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--ink-soft); backdrop-filter: blur(8px);
}
.hero-glow {
  position: absolute; top: -40px; right: -60px; width: 260px; height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--mesh-b) 50%, transparent), transparent 65%);
  filter: blur(30px); z-index: -1; opacity: .8;
  pointer-events: none;
}

/* ---------- 通用区块 ---------- */
.section {
  max-width: var(--shell); margin: 0 auto;
  padding: 18px 20px 6px;
}
.section-head {
  display: flex; align-items: baseline; gap: 12px;
  margin-bottom: 12px;
}
.section-title {
  margin: 0; font-size: 18px; font-weight: 750;
  letter-spacing: -.01em;
}
.ghost-btn {
  margin-left: auto;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-soft); font: inherit; font-size: 13px;
  padding: 6px 12px; border-radius: 999px; cursor: pointer;
  backdrop-filter: blur(10px); transition: background .2s, transform .2s;
}
.ghost-btn:active { transform: scale(.95); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
}

/* ---------- 今日卡片 ---------- */
.today-card { padding: 16px 16px 8px; animation: rise .7s .06s var(--ease) both; }
.today-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.today-date { margin: 0; font-size: 12.5px; color: var(--ink-mute); font-weight: 600; letter-spacing: .04em; }
.today-title { margin: 2px 0 0; font-size: 17px; font-weight: 750; }
.now-badge {
  margin-left: auto; flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 650;
  padding: 5px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
}
.now-badge::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.8); } }

.today-list { list-style: none; margin: 0; padding: 0; }

/* 日期切换 */
.day-chips {
  display: flex; gap: 6px; overflow-x: auto;
  margin: 0 0 10px; padding-bottom: 2px;
  scrollbar-width: none;
}
.day-chips::-webkit-scrollbar { display: none; }
.day-chip {
  flex: 0 0 auto;
  font: inherit; font-size: 12.5px; font-weight: 600;
  padding: 6px 13px; border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-solid); color: var(--ink-soft);
  cursor: pointer; transition: all .2s var(--ease);
}
.day-chip:active { transform: scale(.94); }
.day-chip.on {
  background: var(--accent); color: var(--accent-ink);
  border-color: transparent;
  box-shadow: 0 6px 16px -8px var(--accent);
}
.today-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 4px;
  border-top: 1px solid var(--line);
  cursor: pointer;
  transition: background .2s;
  border-radius: 12px;
}
.today-item:first-child { border-top: 0; }
.today-item:active { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.today-time {
  flex: 0 0 auto; width: 84px;
  display: flex; align-items: baseline; gap: 2px;
  font-variant-numeric: tabular-nums;
  font-size: 12.5px; font-weight: 650; color: var(--ink-soft);
  line-height: 1.35; white-space: nowrap;
}
.today-time b { font-weight: 700; color: var(--ink-soft); }
.today-time i { font-style: normal; color: var(--ink-mute); font-weight: 500; }
.today-time span { display: inline; color: var(--ink-mute); font-weight: 500; font-size: 11.5px; }
.today-bar { flex: 0 0 4px; align-self: stretch; border-radius: 4px; background: var(--c, var(--accent)); min-height: 28px; }
.today-main { min-width: 0; flex: 1; }
.today-name { font-weight: 650; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.today-meta { font-size: 12.5px; color: var(--ink-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.today-item.is-now { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.today-item.is-now .today-name::after {
  content: " · 上课中"; color: var(--accent); font-size: 12px; font-weight: 700;
}
.today-empty {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 22px 0 26px; color: var(--ink-mute); font-size: 14px; text-align: center;
}
.today-empty b { color: var(--ink-soft); font-size: 15px; }

/* ---------- 周次标签 ---------- */
.week-tabs {
  display: grid;
  grid-template-columns: 30px repeat(7, minmax(0, 1fr));
  gap: 6px;
  padding: 2px 10px 12px;
}
/* 节次列占位，让 7 个日期卡与课表 7 列宽度完全一致 */
.week-tabs::before { content: ""; }
.week-tabs::-webkit-scrollbar { display: none; }
.week-tab {
  flex: 0 0 auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 0; padding: 7px 2px;
  border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-soft);
  font: inherit; cursor: pointer;
  transition: transform .25s var(--ease), background .25s, color .25s, border-color .25s;
  backdrop-filter: blur(10px);
}
.week-tab small { font-size: 10.5px; opacity: .7; letter-spacing: .02em; }
.week-tab b { font-size: 13.5px; font-weight: 700; }
.week-tab.active {
  background: var(--accent); color: var(--accent-ink);
  border-color: transparent;
  box-shadow: 0 10px 24px -12px color-mix(in srgb, var(--accent) 90%, transparent);
}
.week-tab.today-tab:not(.active)::after {
  content: ""; display: block; width: 4px; height: 4px; border-radius: 50%;
  background: var(--accent); margin-top: 2px;
}
.week-tab:active { transform: scale(.94); }

/* ---------- 课表网格 ---------- */
.timetable-wrap {
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  padding: 10px;
  overflow: hidden;
  animation: rise .7s .1s var(--ease) both;
}
.timetable {
  display: grid;
  grid-template-columns: 30px repeat(7, minmax(0, 1fr));
  gap: 6px;
}
.tt-corner, .tt-head {
  font-size: 11px; font-weight: 650; color: var(--ink-mute);
  text-align: center; padding: 4px 0 6px;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
}
.tt-head small { font-size: 9.5px; opacity: .65; font-weight: 500; }
.tt-head.today { color: var(--accent); }
.tt-head.today small { opacity: 1; font-weight: 700; }

.tt-period {
  font-size: 10.5px; color: var(--ink-mute);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0; text-align: center; line-height: 1.25;
  font-variant-numeric: tabular-nums;
  padding: 2px 0;
}
.tt-period b { font-size: 12px; color: var(--ink-soft); font-weight: 650; }

.tt-cell {
  border-radius: 8px;
  background: var(--cell);
  min-height: 40px;
}
.tt-cell.is-today { background: var(--cell-today); }

.tt-block {
  position: relative;
  border-radius: 12px;
  padding: 6px 6px 7px;
  color: #fff;
  font-size: 11.5px; line-height: 1.25;
  cursor: pointer;
  overflow: hidden;
  display: flex; flex-direction: column; gap: 2px;
  background: linear-gradient(160deg, var(--c1), var(--c2));
  box-shadow: 0 8px 18px -10px var(--c2), inset 0 1px 0 rgba(255, 255, 255, .28);
  transition: transform .25s var(--ease), filter .25s;
  animation: pop .5s var(--ease) both;
}
@keyframes pop { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: none; } }
.tt-block:active { transform: scale(.96); filter: brightness(1.06); }
.tt-block::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(140deg, rgba(255, 255, 255, .22), transparent 52%);
  pointer-events: none;
}
.tt-block-name {
  font-weight: 700; font-size: 11.5px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden; text-overflow: ellipsis;
  word-break: break-word;
}
.tt-block-room {
  margin-top: auto;
  font-size: 10px; opacity: .92; font-weight: 550;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 紧凑模式（窄屏） */
@media (max-width: 560px) {
  .timetable { grid-template-columns: 30px repeat(7, minmax(0, 1fr)); gap: 6px; }
  .timetable-wrap { padding: 10px; }
  .tt-block { padding: 5px 4px; border-radius: 10px; }
  .tt-block-name { font-size: 10.5px; -webkit-line-clamp: 4; }
  .tt-block-room { font-size: 9px; }
  .tt-head { font-size: 10px; }
  .tt-head small { font-size: 8.5px; }
  .tt-period b { font-size: 11px; }
  .tt-period { font-size: 9px; }
}

/* ---------- 列表视图 ---------- */
.list-view { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.list-day {
  font-size: 12.5px; font-weight: 700; color: var(--ink-mute);
  letter-spacing: .06em; margin: 14px 2px 2px;
}
.list-day:first-child { margin-top: 0; }
.list-item {
  display: flex; gap: 12px; align-items: center;
  padding: 12px 14px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--line);
  cursor: pointer; transition: transform .2s var(--ease);
}
.list-item:active { transform: scale(.985); }
.list-color { flex: 0 0 4px; align-self: stretch; border-radius: 4px; background: linear-gradient(var(--c1), var(--c2)); }
.list-main { min-width: 0; flex: 1; }
.list-name { font-weight: 650; font-size: 14.5px; }
.list-meta { font-size: 12.5px; color: var(--ink-mute); }
.list-arrow { color: var(--ink-mute); font-size: 16px; }

/* ---------- 照片墙 ---------- */
.gallery-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}
.gallery-item {
  position: relative; border-radius: 16px; overflow: hidden;
  aspect-ratio: 4 / 3; background: var(--surface);
  border: 1px solid var(--line); cursor: zoom-in;
  box-shadow: var(--shadow);
}
.gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s var(--ease); }
.gallery-item:active img { transform: scale(1.04); }
.gallery-cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 14px 12px 9px; font-size: 12px; color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, .62));
}
.lightbox {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(6, 8, 18, .92);
  display: grid; place-items: center; padding: 16px;
  animation: fade .25s ease both;
}
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 14px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- 小贴士 ---------- */
.tips-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tips-list li {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: 13.5px; color: var(--ink-soft);
}
.tips-list li::before {
  content: "✿"; color: var(--accent); font-size: 13px; line-height: 1.7;
}

/* ---------- 页脚 ---------- */
.footer {
  max-width: var(--shell); margin: 26px auto 0;
  padding: 20px 20px calc(86px + env(safe-area-inset-bottom));
  text-align: center; color: var(--ink-soft); font-size: 12.5px;
}
.footer p { margin: 0 0 4px; }
.footer-hint { opacity: .75; font-size: 11.5px; }

/* ---------- 编辑按钮 ---------- */
.edit-fab {
  position: fixed; z-index: 60;
  right: calc(16px + env(safe-area-inset-right));
  bottom: calc(18px + env(safe-area-inset-bottom));
  display: inline-flex; align-items: center; gap: 6px;
  padding: 11px 16px 11px 14px;
  border: 0; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink);
  font: inherit; font-size: 13.5px; font-weight: 650;
  cursor: pointer;
  box-shadow: 0 16px 34px -12px color-mix(in srgb, var(--accent) 90%, transparent);
  transition: transform .25s var(--ease), opacity .25s;
}
.edit-fab:active { transform: scale(.94); }
.edit-fab.off { opacity: 0; pointer-events: none; transform: translateY(16px); }

/* ---------- 周次切换栏 ---------- */
.week-bar {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 12px;
  padding: 7px;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.week-bar[hidden] { display: none; }
.week-arrow {
  width: 38px; height: 38px; flex: none;
  border-radius: 12px; border: 1px solid var(--line);
  background: var(--cell); color: var(--ink);
  font-size: 19px; line-height: 1; font-weight: 600;
  cursor: pointer; padding: 0;
}
.week-arrow:disabled { opacity: .32; }
.week-arrow:active:not(:disabled) { background: var(--cell-today); }
.week-label {
  flex: 1; text-align: center;
  font-size: 14.5px; font-weight: 700; color: var(--ink);
  background: none; border: none; padding: 6px 4px; cursor: pointer;
}
.week-now {
  flex: none;
  font-size: 12px; font-weight: 600;
  color: var(--accent); background: var(--cell-today);
  border: none; border-radius: 999px; padding: 8px 12px; cursor: pointer;
}
.week-now[disabled] { opacity: .35; }

/* ---------- 底部弹层 ---------- */
.overlay-layer {
  position: fixed; inset: 0; z-index: 100;
}
.overlay-layer[hidden] { display: none !important; }

.sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(10, 12, 24, .42);
  animation: fade .22s ease both;
}
.sheet {
  position: fixed; z-index: 110;
  left: 0; right: 0; bottom: 0;
  max-height: 82dvh; overflow-y: auto;
  background: var(--surface-solid);
  border-radius: 26px 26px 0 0;
  padding: 8px 20px calc(24px + env(safe-area-inset-bottom));
  box-shadow: 0 -20px 60px -24px rgba(0, 0, 0, .5);
  animation: sheetUp .38s var(--ease) both;
  overscroll-behavior: contain;
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
@media (min-width: 720px) {
  .sheet {
    left: 50%; right: auto; bottom: auto; top: 50%;
    width: 520px; transform: translate(-50%, -50%);
    border-radius: 24px; padding: 20px 24px 24px;
    animation: sheetPop .32s var(--ease) both;
  }
  @keyframes sheetPop { from { opacity: 0; transform: translate(-50%, -46%) scale(.96); } to { opacity: 1; transform: translate(-50%, -50%); } }
}
.sheet-grip {
  width: 38px; height: 4px; border-radius: 4px;
  background: var(--line); margin: 6px auto 14px;
}
@media (min-width: 720px) { .sheet-grip { display: none; } }
.sheet-close {
  position: absolute; top: 14px; right: 14px;
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--line); background: transparent;
  color: var(--ink-mute); font-size: 14px; cursor: pointer;
}
.sheet-title { margin: 0 0 2px; font-size: 20px; font-weight: 750; letter-spacing: -.01em; }
.sheet-sub { margin: 0 0 16px; color: var(--ink-mute); font-size: 13px; }

.detail-hero {
  border-radius: 18px; padding: 16px;
  color: #fff; margin-bottom: 14px;
  background: linear-gradient(150deg, var(--c1), var(--c2));
  box-shadow: 0 16px 34px -18px var(--c2);
}
.detail-hero .dh-name { font-size: 19px; font-weight: 750; margin: 0; }
.detail-hero .dh-when { font-size: 13px; opacity: .9; margin: 3px 0 0; }
.detail-rows { display: grid; gap: 1px; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); }
.detail-row {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 12px 14px; background: var(--surface-solid);
  font-size: 14px;
}
.detail-row + .detail-row { border-top: 1px solid var(--line); }
.detail-row dt { color: var(--ink-mute); margin: 0; }
.detail-row dd { margin: 0; font-weight: 600; text-align: right; }
.detail-note {
  margin-top: 12px; padding: 12px 14px; border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  color: var(--ink-soft); font-size: 13px;
}

/* ---------- 减少动画偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}

/* ---------- 桌面端放大 ---------- */
@media (min-width: 900px) {
  .hero { padding-top: 40px; }
  .timetable { grid-template-columns: 52px repeat(7, minmax(0, 1fr)); gap: 7px; }
  .tt-block { padding: 9px 9px 10px; }
  .tt-block-name { font-size: 12.5px; }
  .tt-block-room { font-size: 11px; }
  .tt-period b { font-size: 13px; }
  .tt-head { font-size: 12px; }
}