/* ============================================================
   theme.css —— 可爱课表系统 · 默认马卡龙主题
   配色 / 圆角 / 阴影 / 字体 全部走 CSS 变量，方便换肤覆盖。
   深色模式：html[data-theme="dark"] 覆盖底色/卡片/文字，
             保留自定义 primary/mint/purple 强调色。
   ============================================================ */

:root {
  --bg-color: #F7F0F5;
  --card-color: #FFFFFF;
  --primary: #FFD6DE;      /* 淡粉 */
  --accent: #FFB6C1;        /* 深一点的粉 */
  --mint: #E0F5E9;          /* 薄荷绿 */
  --purple: #E8E0F0;        /* 浅紫 */
  --text-main: #4A4A5A;
  --text-sub: #9A9AAB;
  --grad-from: #E8E0F0;     /* 顶部渐变起始（淡紫） */
  --grad-to: #FFE4E1;       /* 顶部渐变结束（蜜桃粉） */
  --card-radius: 20px;
  --card-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
  --font-family: -apple-system, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, sans-serif;
}

/* 深色模式：只压暗底色/卡片/文字，保留彩蛋般的强调色 */
html[data-theme="dark"] {
  --bg-color: #201c2b;
  --card-color: rgba(255, 255, 255, 0.07);
  --text-main: #f3eff9;
  --text-sub: #9d97ad;
  --grad-from: #2a2340;
  --grad-to: #3a2a35;
  --card-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

* { -webkit-tap-highlight-color: transparent; }

html, body {
  font-family: var(--font-family);
  color: var(--text-main);
  background: var(--bg-color);
  transition: background .5s ease, color .5s ease;
}

body {
  margin: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
  /* 给底部悬浮导航留空间，再叠加 iPhone 底部 Home 条安全区 */
  padding-bottom: calc(112px + env(safe-area-inset-bottom, 0px));
}

/* 背景层：渐变 + 可选背景图，带淡入淡出 */
#page-backdrop {
  position: fixed;
  inset: 0;
  z-index: -2;
  /* 低饱和度对角线渐变：淡紫 #E8E0F0 → 蜜桃粉 #FFE4E1（治愈系柔和） */
  background: linear-gradient(135deg, var(--grad-from) 0%, var(--bg-color) 50%, var(--grad-to) 100%);
  transition: background .6s ease;
}
#page-backdrop img.bg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  will-change: transform, opacity;
  transition: opacity 1.5s ease-in-out; /* 丝滑呼吸过渡 */
}
#page-backdrop img.bg-img.show {
  opacity: .9;
  animation: kenburns 46s ease-in-out infinite; /* 缓慢 Ken Burns 平移缩放，背景「呼吸」 */
}
@keyframes kenburns {
  0%   { transform: scale(1.0) translate(0, 0); }
  50%  { transform: scale(1.06) translate(-1.2%, -0.8%); }
  100% { transform: scale(1.0) translate(0, 0); }
}
#page-backdrop::after {
  content: "";
  position: absolute; inset: 0;
  /* 柔光遮罩，让字更清晰 */
  background: linear-gradient(180deg, rgba(255,255,255,.25), rgba(255,255,255,.05) 40%);
}
html[data-theme="dark"] #page-backdrop::after {
  background: linear-gradient(180deg, rgba(0,0,0,.25), rgba(0,0,0,.05) 40%);
}

/* ---------- 通用玻璃卡片 ---------- */
.card {
  background: var(--card-color);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255,255,255,.35);
  transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s ease;
}
.hover-lift:hover { transform: translateY(-3px) scale(1.015); }

/* 圆润胶囊 */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 15px; border-radius: 999px;
  background: var(--primary); color: var(--text-main);
  font-weight: 600; font-size: 13px;
}

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 11px; border-radius: 999px;
  background: rgba(255,255,255,.6); color: var(--text-sub);
  font-size: 12px; font-weight: 600;
}
html[data-theme="dark"] .chip { background: rgba(255,255,255,.08); }

/* ---------- 顶部渐变头部 ---------- */
.top-zone {
  background: linear-gradient(150deg, var(--grad-from), var(--grad-to));
  border-radius: 0 0 32px 32px;
  transition: background .6s ease;
}

/* 页头卡片版（自适应：手机/桌面通用，圆角渐变卡） */
.page-header {
  background: linear-gradient(150deg, var(--grad-from), var(--grad-to));
  border-radius: 28px;
  padding: 22px 20px;
  position: relative;
  overflow: hidden;
  transition: background .6s ease;
}
.page-header h1 { font-size: 24px; font-weight: 800; margin: 0; color: var(--text-main); }
.page-header p { color: var(--text-sub); font-size: 13px; font-weight: 600; margin: 5px 0 0; }
.page-header::after {
  content: "✦";
  position: absolute; right: 14px; top: 8px; font-size: 20px;
  color: rgba(255,255,255,.55);
}

/* ---------- 底部悬浮导航 ---------- */
.bottom-nav {
  position: fixed;
  left: 50%; transform: translateX(-50%);
  /* 贴近底部 + iPhone Home 条安全区，避免被挡住 */
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  display: flex; gap: 4px; align-items: center;
  padding: 8px;
  border-radius: 999px;
  background: var(--card-color);
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,.4);
  z-index: 60;
  animation: nav-in .5s cubic-bezier(.2,.8,.2,1) both;
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 15px; border-radius: 999px;
  text-decoration: none; color: var(--text-sub);
  font-size: 11px; font-weight: 600;
  transition: all .25s ease;
}
.bottom-nav a .nav-ico { font-size: 20px; line-height: 1; transition: transform .25s ease; }
.bottom-nav a.active {
  background: var(--primary); color: var(--text-main);
}
.bottom-nav a.active .nav-ico { transform: translateY(-2px) scale(1.1); }
.bottom-nav a:active { transform: scale(.92); }

/* ---------- 主要按钮 ---------- */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px; border-radius: 999px; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--primary));
  color: #fff; font-weight: 700; font-size: 15px;
  box-shadow: 0 8px 22px rgba(255, 150, 180, .4);
  transition: transform .2s ease, box-shadow .2s ease, filter .2s;
  font-family: var(--font-family);
}
.btn-primary:active { transform: scale(.95); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 999px; border: 1px solid rgba(0,0,0,.08); cursor: pointer;
  background: var(--card-color); color: var(--text-main); font-weight: 600; font-size: 14px;
  font-family: var(--font-family);
}
html[data-theme="dark"] .btn-ghost { border-color: rgba(255,255,255,.12); }

/* ---------- 记忆页 · 时间轴 ---------- */
.timeline { position: relative; padding-left: 22px; }
.timeline::before {
  content: ""; position: absolute; left: 7px; top: 4px; bottom: 4px;
  width: 2px; background: linear-gradient(var(--accent), var(--mint));
  border-radius: 2px;
}
.tl-item { position: relative; padding: 4px 0 14px; }
.tl-item::before {
  content: ""; position: absolute; left: -22px; top: 9px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--card-color); border: 3px solid var(--accent);
}

/* ---------- 动画 ---------- */
@keyframes nav-in { from { opacity: 0; transform: translateX(-50%) translateY(30px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes fade-up { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes float-y { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes pulse-soft { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes pop-in { 0% { opacity: 0; transform: scale(.6); } 70% { transform: scale(1.06); } 100% { opacity: 1; transform: scale(1); } }
@keyframes spin-slow { to { transform: rotate(360deg); } }

.fade-up { animation: fade-up .5s cubic-bezier(.2,.8,.2,1) both; }
.float-y { animation: float-y 3.4s ease-in-out infinite; }
.pulse-soft { animation: pulse-soft 2.2s ease-in-out infinite; }
.pop-in { animation: pop-in .45s cubic-bezier(.2,.8,.2,1) both; }

/* 逐条进入的课程卡片 */
.stagger > * { animation: fade-up .5s cubic-bezier(.2,.8,.2,1) both; }
.stagger > *:nth-child(1) { animation-delay: .04s; }
.stagger > *:nth-child(2) { animation-delay: .10s; }
.stagger > *:nth-child(3) { animation-delay: .16s; }
.stagger > *:nth-child(4) { animation-delay: .22s; }
.stagger > *:nth-child(5) { animation-delay: .28s; }
.stagger > *:nth-child(6) { animation-delay: .34s; }
.stagger > *:nth-child(7) { animation-delay: .40s; }
.stagger > *:nth-child(8) { animation-delay: .46s; }

/* ---------- 特效（花瓣/烟花）---------- */
.effect-layer { position: fixed; inset: 0; pointer-events: none; z-index: 200; overflow: hidden; }
.petal, .spark {
  position: absolute; top: -30px; border-radius: 50%;
  animation: fall linear forwards;
}
.petal { background: linear-gradient(180deg, #ffc7d6, #ff9eb8); }
.spark { background: #ffd36e; box-shadow: 0 0 8px #ffd36e; }
@keyframes fall {
  to { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* ---------- 装饰小元素 ---------- */
.sparkle { position: absolute; color: var(--accent); opacity: .7; animation: twinkle 2.4s ease-in-out infinite; }
@keyframes twinkle { 0%,100% { opacity: .25; transform: scale(.8); } 50% { opacity: .8; transform: scale(1.15); } }

/* 神秘按钮（限时彩蛋） */
.mystery-btn {
  position: fixed; right: 18px;
  bottom: calc(110px + env(safe-area-inset-bottom, 0px));
  z-index: 55;
  width: 54px; height: 54px; border-radius: 50%; border: none; cursor: pointer;
  background: radial-gradient(circle at 30% 30%, #ffd9e2, var(--accent));
  color: #fff; font-size: 24px; box-shadow: 0 8px 24px rgba(255,140,170,.5);
  animation: pulse-soft 2s ease-in-out infinite;
}

/* 滚动条 */
::-webkit-scrollbar { width: 0; height: 0; }

/* 文本选择 */
::selection { background: var(--primary); }

/* ---------- 统一表单样式（手机端友好，触控目标 ≥ 44px） ---------- */
input, select, textarea {
  font-family: var(--font-family);
  color: var(--text-main);
  /* ≥16px 避免 iPhone Safari 聚焦时自动放大页面 */
  font-size: 16px;
}
.input-text {
  width: 100%;
  padding: 13px 16px;
  border-radius: 14px;
  border: 1.5px solid rgba(0, 0, 0, .08);
  background: var(--card-color);
  outline: none;
  font-size: 16px;
  min-height: 46px;
  box-sizing: border-box;
  transition: border-color .2s ease, box-shadow .2s ease, background .3s;
}
.input-text::placeholder { color: var(--text-sub); opacity: .7; }
.input-text:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(255, 150, 180, .15);
}
html[data-theme="dark"] .input-text {
  border-color: rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .06);
}

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-sub);
  margin-bottom: 7px;
  letter-spacing: .02em;
}

/* ---------- 设置分区卡 ---------- */
.section-card {
  background: var(--card-color);
  border-radius: 24px;
  box-shadow: var(--card-shadow);
  border: 1px solid rgba(255, 255, 255, .35);
  padding: 20px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.section-title {
  display: flex; align-items: center; gap: 9px;
  font-size: 17px; font-weight: 800; margin-bottom: 4px;
}
.section-desc { font-size: 13px; color: var(--text-sub); line-height: 1.55; margin-bottom: 16px; }
.section-title .ico {
  width: 34px; height: 34px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px; font-size: 18px;
  background: var(--primary);
}
.divider { height: 1px; background: rgba(0,0,0,.06); margin: 16px 0; border: none; }
html[data-theme="dark"] .divider { background: rgba(255,255,255,.08); }

/* 底部小提示条 */
.hint-bar {
  text-align: center; font-size: 12px; color: var(--text-sub);
  padding: 6px 0 10px;
}

/* 苹果「添加到主屏幕」引导条 */
.pwa-hint {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  z-index: 59;
  display: flex; align-items: center; gap: 10px;
  max-width: calc(100vw - 32px);
  padding: 11px 16px; border-radius: 999px;
  background: var(--card-color); color: var(--text-main);
  box-shadow: var(--card-shadow); border: 1px solid rgba(255,255,255,.4);
  font-size: 13px; font-weight: 600;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  animation: fade-up .5s cubic-bezier(.2,.8,.2,1) both;
}
.pwa-hint .close { font-size: 18px; opacity: .5; cursor: pointer; padding: 0 2px; }

/* ============================================================
   课表网格（周 × 节），横向滚动 + 吸附表头/左列
   ============================================================ */
.schedule-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 20px;
  scrollbar-width: none;
}
.schedule-scroll::-webkit-scrollbar { display: none; }
.schedule-grid {
  border-collapse: separate;
  border-spacing: 4px;
  min-width: 720px; /* 桌面下不压缩 */
  table-layout: fixed;
  width: 100%;
}
.schedule-grid th,
.schedule-grid td {
  border-radius: 14px;
  box-sizing: border-box;
}
.schedule-grid thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--card-color);
  box-shadow: var(--card-shadow);
  border: 1px solid rgba(255,255,255,.4);
  padding: 9px 6px;
  font-size: 13px;
  text-align: center;
}
.schedule-grid thead th .wd { display: block; font-size: 11px; color: var(--text-sub); font-weight: 600; }
.schedule-grid thead th .num { display: block; font-size: 16px; font-weight: 800; }
.schedule-grid tbody th {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--card-color);
  border: 1px solid rgba(255,255,255,.4);
  width: 74px;
  font-weight: 700;
  color: var(--text-sub);
  text-align: center;
  font-size: 12px;
}
.schedule-grid tbody th .t { display: block; font-size: 10px; color: var(--text-sub); opacity: .75; font-weight: 500; }
.schedule-grid td.cell {
  background: rgba(255,255,255,.55);
  min-height: 60px;
  vertical-align: top;
}
html[data-theme="dark"] .schedule-grid td.cell { background: rgba(255,255,255,.04); }
.schedule-grid td.cell.today-col { background: var(--primary); background: rgba(255,214,222,.45); }
html[data-theme="dark"] .schedule-grid td.cell.today-col { background: rgba(255,150,180,.12); }

.course-box {
  display: block;
  border-radius: 12px;
  padding: 8px 9px;
  height: 100%;
  min-height: 56px;
  cursor: pointer;
  color: var(--text-main);
  text-align: left;
  transition: transform .18s ease, box-shadow .18s ease, filter .18s;
  box-shadow: 0 3px 10px rgba(0,0,0,.06);
  position: relative;
}
.course-box:active { transform: scale(.97); }
.course-box .cn { font-weight: 800; font-size: 12.5px; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.course-box .ct { font-size: 10px; opacity: .78; margin-top: 3px; line-height: 1.25; overflow: hidden; }
.course-box .flag { position: absolute; top: 5px; right: 6px; font-size: 11px; }

/* 课表周次切换 */
.week-switch {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 14px;
}
.week-switch .chip.active-week { background: linear-gradient(135deg,#B7A6D6,#FFB6C1); color: #fff; }

/* ============================================================
   通用模态 / 底部动作面板
   ============================================================ */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 120;
  display: flex; align-items: center; justify-content: center; padding: 18px;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.modal-card {
  width: 100%; max-width: 400px; max-height: 90vh; overflow-y: auto;
  background: var(--card-color); border-radius: 24px;
  border: 1px solid rgba(255,255,255,.45);
  box-shadow: 0 20px 60px rgba(0,0,0,.22);
  padding: 20px;
}

/* ============================================================
   打卡 / 心情 / 日记 / 留言
   ============================================================ */
.checkin-btn {
  position: relative;
  width: 100%;
  border: none; cursor: pointer;
  border-radius: 22px;
  padding: 20px 18px;
  background: linear-gradient(135deg, #FFB6C1, #F8A0B8);
  color: #fff; font-weight: 800; font-size: 17px;
  box-shadow: 0 12px 28px rgba(255,140,170,.4);
  transition: transform .15s ease, box-shadow .2s ease, filter .2s;
  overflow: hidden;
  font-family: var(--font-family);
}
.checkin-btn:active { transform: scale(.97); }
.checkin-btn.done {
  background: linear-gradient(135deg, #8FD8BF, #69c9a8);
  box-shadow: 0 12px 28px rgba(120,200,165,.4);
}
.checkin-btn .sub { display: block; font-size: 12px; font-weight: 600; opacity: .9; margin-top: 4px; }

.mini-cal { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.mini-cal .d {
  width: 34px; height: 34px; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  background: rgba(0,0,0,.04); color: var(--text-sub);
}
html[data-theme="dark"] .mini-cal .d { background: rgba(255,255,255,.06); }
.mini-cal .d.on { background: linear-gradient(135deg,#FFB6C1,#F8A0B8); color: #fff; box-shadow: 0 4px 10px rgba(255,140,170,.35); }
.mini-cal .d.today { outline: 2px dashed var(--accent); outline-offset: 1px; }

.mood-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.mood-btn {
  width: 52px; height: 52px; border-radius: 16px; border: 2px solid transparent;
  font-size: 28px; cursor: pointer; background: rgba(0,0,0,.04);
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s ease, border-color .15s ease, background .2s;
}
html[data-theme="dark"] .mood-btn { background: rgba(255,255,255,.06); }
.mood-btn:active { transform: scale(.9); }
.mood-btn.sel { border-color: var(--accent); background: var(--primary); transform: scale(1.08); }

/* 打卡顶栏 ⚙️ 自定义入口 */
.gear-btn {
  margin-left: auto; flex: none;
  width: 32px; height: 32px; border-radius: 11px; border: none; cursor: pointer;
  background: rgba(0,0,0,.05); font-size: 16px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s ease, background .2s;
}
html[data-theme="dark"] .gear-btn { background: rgba(255,255,255,.08); }
.gear-btn:active { transform: rotate(30deg) scale(.92); }

/* 打卡目标小标语 */
.ck-goal {
  margin-top: 12px; padding: 10px 14px; border-radius: 14px;
  background: rgba(255,214,222,.35); color: var(--text-main);
  font-size: 13px; font-weight: 600; line-height: 1.5;
}
html[data-theme="dark"] .ck-goal { background: rgba(255,150,180,.12); }

/* 自定义习惯 chips */
.habit-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.habit-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 9px 14px; border-radius: 999px; border: 2px solid transparent;
  background: rgba(0,0,0,.05); color: var(--text-main);
  font-size: 14px; font-weight: 700; cursor: pointer;
  transition: transform .13s ease, background .18s, border-color .18s;
}
html[data-theme="dark"] .habit-chip { background: rgba(255,255,255,.07); }
.habit-chip:active { transform: scale(.93); }
.habit-chip.done {
  background: var(--mint); border-color: #8FD8BF;
}
.habit-chip.done .hk-mark { opacity: 1; }
.habit-chip .hk-mark { opacity: .28; font-size: 12px; }

/* 自定义弹窗里的小字段 */
.ck-field { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.ck-field label { flex: none; font-size: 13px; font-weight: 700; color: var(--text-sub); width: 52px; }
.ck-field input { flex: 1; }

.diary-card { white-space: pre-wrap; line-height: 1.8; font-size: 14.5px; color: var(--text-main); }
.diary-source { font-size: 11px; opacity: .7; }

.encourage-bar {
  background: linear-gradient(135deg, var(--grad-from), var(--grad-to));
  border-radius: 18px; padding: 14px 16px;
  font-size: 14.5px; font-weight: 600; line-height: 1.6;
  color: var(--text-main);
}

.bubble-row { display: flex; margin-bottom: 12px; }
.bubble-row.her { justify-content: flex-end; }
.bubble-row.me { justify-content: flex-start; }
.bubble {
  max-width: 82%; padding: 11px 14px; border-radius: 16px;
  font-size: 14px; line-height: 1.6; white-space: pre-wrap;
}
.bubble.her { background: linear-gradient(135deg,#FFB6C1,#FF9EB8); color: #fff; border-bottom-right-radius: 6px; }
.bubble.me { background: var(--purple); color: var(--text-main); border-bottom-left-radius: 6px; }
.bubble .when { display: block; font-size: 10px; opacity: .65; margin-top: 5px; }

/* 轻提示 toast */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(120px + env(safe-area-inset-bottom, 0px));
  z-index: 150;
  max-width: calc(100vw - 40px);
  background: var(--card-color); color: var(--text-main);
  border: 1px solid rgba(255,255,255,.45);
  box-shadow: var(--card-shadow);
  border-radius: 18px; padding: 13px 18px;
  font-size: 14px; font-weight: 600; line-height: 1.55;
  white-space: pre-wrap; text-align: center;
  animation: pop-in .4s cubic-bezier(.2,.8,.2,1) both;
}

/* ============================================================
   苹果「液态玻璃」Liquid Glass
   —— 半透明 + backdrop 模糊 + 顶部高光棱边，浅色取主题卡色混透明
   （color-mix 不支持的旧浏览器自动回退成实色，不会破版）
   ============================================================ */
:root {
  --glass-border: rgba(255, 255, 255, .62);
  --glass-sheen: rgba(255, 255, 255, .55);   /* 顶部高光 */
  --glass-blur: blur(20px) saturate(150%);
}
html[data-theme="dark"] {
  --glass-border: rgba(255, 255, 255, .16);
  --glass-sheen: rgba(255, 255, 255, .14);
  --glass-blur: blur(26px) saturate(150%);
}

/* —— 背景里的「液态」漂浮光斑（给玻璃卡透出颜色与纵深感） —— */
.liquid-orbs { position: absolute; inset: 0; overflow: hidden; }
.liquid-orbs .orb {
  position: absolute; border-radius: 50%;
  filter: blur(70px); opacity: .5;
  will-change: transform;
  animation: orb-drift 26s ease-in-out infinite;
}
.liquid-orbs .orb-a {
  width: 52vw; height: 52vw; left: -12vw; top: -8vw;
  background: radial-gradient(circle at 35% 35%, #FFD6DE, #FF9EB8 62%, transparent 74%);
}
.liquid-orbs .orb-b {
  width: 44vw; height: 44vw; right: -10vw; top: 24vh;
  background: radial-gradient(circle at 40% 40%, #E0F5E9, #8FD8BF 62%, transparent 74%);
  animation-delay: -9s;
}
.liquid-orbs .orb-c {
  width: 48vw; height: 48vw; left: 22vw; bottom: -14vw;
  background: radial-gradient(circle at 40% 40%, #E8E0F0, #B7A6D6 62%, transparent 74%);
  animation-delay: -17s;
}
html[data-theme="dark"] .liquid-orbs .orb { opacity: .26; filter: blur(80px); }
@keyframes orb-drift {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  33%      { transform: translate3d(6vw, 4vh, 0) scale(1.08); }
  66%      { transform: translate3d(-5vw, -3vh, 0) scale(.94); }
}

/* —— 通用玻璃表面：卡片 / 分区 / 弹窗 / 导航 / 提示 ——
   用 color-mix 直写（旧浏览器解析失败自动回退上面的实色 --card-color） */
.card, .section-card, .modal-card, .bottom-nav, .toast, .pwa-hint {
  background: color-mix(in srgb, var(--card-color) 70%, transparent);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow:
    inset 0 1px 1px var(--glass-sheen),
    inset 0 -1px 1px rgba(255, 255, 255, .08),
    var(--card-shadow);
}
html[data-theme="dark"] .card,
html[data-theme="dark"] .section-card,
html[data-theme="dark"] .modal-card,
html[data-theme="dark"] .bottom-nav,
html[data-theme="dark"] .toast,
html[data-theme="dark"] .pwa-hint {
  background: rgba(255, 255, 255, .08);
  box-shadow:
    inset 0 1px 1px var(--glass-sheen),
    var(--card-shadow);
}

/* 顶部高光斜切（液态折射感），仅加在不会滚动的表面 */
.card, .section-card { position: relative; }
.card::before, .section-card::before, .page-header::before {
  content: "";
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(155deg, var(--glass-sheen) 0%, rgba(255,255,255,.06) 34%, rgba(255,255,255,0) 58%);
}

/* 页头/渐变大块：保留马卡龙渐变，加玻璃棱边与柔光 */
.encourage-bar, .checkin-btn, .top-zone {
  box-shadow: inset 0 1px 1px var(--glass-sheen), 0 12px 28px rgba(255, 140, 170, .28);
}
/* 小元素只加顶部高光棱边（不大面积柔光，避免糊成一团） */
.pill, .mini-cal .d.on, .habit-chip.done {
  box-shadow: inset 0 1px 1px var(--glass-sheen);
}

/* 表单输入：半透明玻璃，聚焦更清爽（旧浏览器回退实色） */
.input-text {
  background: color-mix(in srgb, var(--card-color) 78%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-color: var(--glass-border);
}
html[data-theme="dark"] .input-text { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.14); }

/* 课表粘性表头也玻璃化（内容从底下划过时有毛玻璃遮罩） */
.schedule-grid thead th, .schedule-grid tbody th {
  background: color-mix(in srgb, var(--card-color) 56%, transparent);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
}
html[data-theme="dark"] .schedule-grid thead th,
html[data-theme="dark"] .schedule-grid tbody th { background: rgba(255,255,255,.07); }

/* —— 减少动效偏好：尊重系统设置，关掉漂浮/闪烁类动画 —— */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .liquid-orbs .orb { animation: none !important; }
}

/* ==================== 课表双指缩放 + 高级玻璃感 ==================== */

/* 舞台玻璃：阴影/模糊/透明度随缩放联动（JS 每帧写 --blurPx/--shadowY/--shadowA/--bgA） */
.schedule-stage {
  --blurPx: 22px;
  --cardBlurPx: 14px;
  --shadowY: 12px;
  --shadowA: .16;
  --bgA: .58;
  background: rgba(255, 255, 255, var(--bgA));
  border-radius: 22px;
  -webkit-backdrop-filter: blur(var(--blurPx)) saturate(160%);
  backdrop-filter: blur(var(--blurPx)) saturate(160%);
  box-shadow:
    inset 0 1px 1px var(--glass-sheen),
    0 var(--shadowY) 34px -8px rgba(105, 78, 138, var(--shadowA));
  will-change: backdrop-filter;
}

/* 缩放目标：只动 transform（GPU 合成），保留单指横滚/竖滚，拦截双指交给 JS */
.schedule-zoom {
  transform: scale(var(--zoom, 1));
  transform-origin: 50% 50%;
  will-change: transform;
  touch-action: pan-x pan-y;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
.schedule-zoom.is-spring {
  transition: transform .5s cubic-bezier(.34, 1.56, .64, 1); /* 松手回弹 */
}

/* 次级信息：缩小到 0.8 以下丝滑隐藏（max-height 过渡，不改布局跳动） */
.schedule-zoom .ct.sec {
  max-height: 26px; opacity: 1; margin-top: 3px; overflow: hidden;
  transition: opacity .3s ease, max-height .3s ease, margin-top .3s ease;
}
.schedule-zoom.is-min .ct.sec { max-height: 0; opacity: 0; margin-top: 0; }

/* —— 高级感低饱和度课程卡（柔和玫瑰灰/鼠尾草绿/香芋紫 · 呼吸微动效）—— */
.course-box {
  background: color-mix(in srgb, var(--cc, #E3DBEE) 52%, transparent);
  -webkit-backdrop-filter: blur(10px) saturate(150%);
  backdrop-filter: blur(10px) saturate(150%);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .72);
  padding: 7px 8px;
  overflow: hidden;
  text-align: left;
  line-height: 1.3;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .7),
    0 4px 14px -6px rgba(105, 78, 138, .14);
  transition: transform .18s ease, filter .25s;
  animation: breathe 4s ease-in-out infinite;
}
.course-box:active { transform: scale(.97); }
.course-box .cn {
  color: #2f2b3a; font-weight: 800; font-size: 13px; line-height: 1.25;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}
.course-box .ct {
  color: #6d6479; font-size: 10.5px; opacity: 1; margin-top: 2px;
  line-height: 1.2; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
html[data-theme="dark"] .course-box { background: color-mix(in srgb, var(--cc, #E3DBEE) 40%, transparent); }
html[data-theme="dark"] .course-box .cn { color: #f6f2fb; }
html[data-theme="dark"] .course-box .ct { color: #b6aec6; }

/* ==================== 最终视觉美化 · 治愈系柔和玻璃 ==================== */

/* 今日主卡：深色半透明毛玻璃（取消原来的深灰大色块） */
.hero-glass {
  position: relative;
  padding: 22px 20px;
  border-radius: 28px;
  color: #fff;
  background: rgba(66, 54, 96, .52);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, .22);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, .22),
    0 18px 44px -12px rgba(96, 72, 130, .4);
  overflow: hidden;
}
.hero-glass::before {
  content: "";
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(155deg, rgba(255,255,255,.18) 0%, rgba(255,255,255,.02) 45%, rgba(255,255,255,0) 60%);
}
.hero-label { font-size: 12px; letter-spacing: .06em; font-weight: 700; color: rgba(255,255,255,.72); }
.hero-pill {
  display: inline-flex; align-items: center; padding: 4px 12px;
  border-radius: 999px; font-size: 12px; font-weight: 700;
  background: rgba(255,255,255,.16); color: #fff;
}
.hero-kicker { font-size: 13px; font-weight: 700; color: rgba(255,255,255,.78); margin-bottom: 6px; }
.hero-name { font-size: 26px; font-weight: 800; line-height: 1.25; letter-spacing: .01em; color: #fff; }
.hero-meta {
  display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center;
  margin-top: 8px; font-size: 13px; color: rgba(255,255,255,.62);
}
.hero-count {
  display: flex; align-items: center; gap: 10px;
  margin-top: 14px; font-size: 14px; font-weight: 700; color: #fff;
}
.hero-count-line {
  width: 26px; height: 2px; flex: none; border-radius: 2px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.85), transparent);
  box-shadow: 0 0 10px rgba(255,255,255,.65);
}
.hero-empty { font-size: 16px; font-weight: 600; color: rgba(255,255,255,.9); }

/* 今日课程卡：去掉左侧彩条，时间方块改为柔和半透明、无边框，卡片间距加大 */
.course-card { --cc: var(--primary); }
.time-chip { background: rgba(255, 255, 255, .5); border: none; }
.cc-dot {
  width: 8px; height: 8px; flex: none; border-radius: 50%;
  background: var(--cc, var(--primary)); opacity: .85;
}

/* 课表高亮修正：整列不再铺高饱和粉，改为极淡灰白；今天表头加低饱和淡紫小胶囊 */
.schedule-grid td.cell.today-col { background: rgba(255, 255, 255, .32); }
html[data-theme="dark"] .schedule-grid td.cell.today-col { background: rgba(255, 255, 255, .06); }
.schedule-grid thead th.today-head {
  background: color-mix(in srgb, var(--card-color) 62%, transparent);
  border-radius: 999px;
}
.schedule-grid thead th.today-head .num {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 28px; height: 28px; padding: 0 8px; border-radius: 999px;
  background: rgba(183, 166, 214, .34);
  color: #6b5f88;
}

/* 缩放 −/＋ 悬浮小按钮（双指太复杂时的兜底控制） */
.zoom-ctrl {
  position: absolute; top: 12px; right: 12px; z-index: 5;
  display: flex; gap: 6px;
}
.zoom-ctrl button {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.55); cursor: pointer;
  background: rgba(255,255,255,.5);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  color: var(--text-main); font-size: 18px; font-weight: 700; line-height: 1;
  box-shadow: 0 3px 10px rgba(105,78,138,.14);
  transition: transform .15s ease, background .2s;
}
.zoom-ctrl button:active { transform: scale(.9); }

/* 神秘礼物按钮：改为半透明毛玻璃小圆点，缩小、不打扰 */
.mystery-btn {
  width: 40px; height: 40px;
  background: rgba(255, 255, 255, .5);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, .55);
  color: #d98ca6; font-size: 16px;
  box-shadow: 0 4px 14px rgba(105, 78, 138, .18);
  animation: none;
}

/* ==================== 课表：PC 全宽铺满 · 手机横向滑动（表头 + 时间轴 sticky 锁定） ==================== */
.schedule-stage { padding: 8px; }

/* 横向滚动容器：手机可左右滑动，PC 铺满无横向滚动 */
.tt-scroll {
  overflow: auto;
  max-height: min(72vh, 620px);
  min-height: 400px;
  border-radius: 16px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

/* 头 + N 行网格：第 1 列时间轴 + 7 天课程列 */
.tt-grid {
  --tt-axis: 60px;
  --headH: 46px;
  --rowH: 74px;
  display: grid;
  grid-template-columns: var(--tt-axis) repeat(7, minmax(110px, 1fr));
  align-content: start;
}

/* 左上角「节次」：双轴 sticky 锁死 */
.tt-corner {
  grid-column: 1; grid-row: 1;
  position: sticky; top: 0; left: 0; z-index: 30;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--text-sub);
  background: color-mix(in srgb, var(--card-color) 94%, transparent);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border-right: 1px solid var(--glass-border);
  border-bottom: 1px solid var(--glass-border);
  border-radius: 16px 0 0 0;
}

/* 表头（周一~周日）：sticky 顶部锁死 */
.tt-day-head {
  grid-row: 1;
  position: sticky; top: 0; z-index: 20;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; min-width: 0; overflow: hidden;
  background: color-mix(in srgb, var(--card-color) 94%, transparent);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border-right: 1px solid var(--glass-border);
  border-bottom: 1px solid var(--glass-border);
}
.tt-day-head .wd { font-size: 11px; color: var(--text-sub); font-weight: 600; }
.tt-day-head .num { font-size: 16px; font-weight: 800; }
/* 今天（周四）只在表头用极小的低饱和胶囊高亮 */
.tt-day-head.today-head .num {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 26px; padding: 0 8px; border-radius: 999px;
  background: rgba(183, 166, 214, .30);
  color: #6b5f88;
}

/* 时间轴：sticky 左侧锁死 */
.tt-axis-cell {
  grid-column: 1;
  position: sticky; left: 0; z-index: 10;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; overflow: hidden;
  background: color-mix(in srgb, var(--card-color) 94%, transparent);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
  border-right: 1px solid var(--glass-border);
}
.tt-axis-cell .p { font-size: 11px; font-weight: 700; color: var(--text-sub); }
.tt-axis-cell .t { font-size: 9px; color: var(--text-sub); opacity: .78; font-weight: 500; }
/* 窄屏也显示起止时间（iOS 上更像原生课表）；时间轴略微收窄 */
@media (max-width: 480px) {
  .tt-grid { --tt-axis: 56px; }
  .tt-axis-cell .t { font-size: 8px; opacity: .7; }
}

/* 课程卡：网格项（margin 留 3px 呼吸间距）；课程名绝不截断 */
.tt-grid .course-box { margin: 3px; }
.tt-grid .course-box .cn { display: block; -webkit-line-clamp: unset; }
.tt-grid .course-box .ct.pc-only { display: none; }

/* PC（>=768px）：铺满全宽、无需横向滚动，列宽放宽并显示时间 / 老师 */
@media (min-width: 768px) {
  .tt-scroll { max-height: calc(100vh - 240px); }
  .tt-grid { --tt-axis: 74px; grid-template-columns: var(--tt-axis) repeat(7, minmax(76px, 1fr)); }
  .tt-grid .course-box .ct.pc-only { display: block; }
}

/* ==================== 悬浮按钮（＋ 加课 / ⛶ 全屏）—— 底部避让导航栏 + iOS 安全区 ==================== */
.tt-fab {
  position: fixed; z-index: 90;
  bottom: calc(80px + env(safe-area-inset-bottom));
  display: inline-flex; align-items: center; gap: 6px;
  padding: 12px 18px; border: none; cursor: pointer; border-radius: 999px;
  font-weight: 700; font-size: 14px; line-height: 1;
  font-family: var(--font-family);
  color: #fff;
  background: linear-gradient(135deg, #C7B8E3, #A99DD8);
  box-shadow: 0 12px 28px -8px rgba(120, 90, 170, .55);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  transition: transform .15s ease, box-shadow .2s ease;
}
.tt-fab:active { transform: scale(.94); }
.tt-fab .ico { font-size: 17px; line-height: 1; }
.tt-fab.plus { left: 16px; }
.tt-fab.fs { right: 16px; }
/* 全屏按钮仅在手机端显示 */
@media (min-width: 768px) { .tt-fab.fs, .sm-only { display: none !important; } }

/* ==================== 横屏全屏课表（从底部向上滑出 + 深色遮罩） ==================== */
.tt-fullscreen { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.tt-fs-mask {
  position: absolute; inset: 0;
  background: rgba(30, 22, 40, .55);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.tt-fs-panel {
  position: relative; z-index: 1;
  width: 100%; height: 100%;
  background: var(--card-color);
  border-radius: 22px 22px 0 0;
  display: flex; flex-direction: column;
  box-shadow: 0 -20px 60px rgba(0, 0, 0, .3);
  animation: ttSlideUp .38s cubic-bezier(.22, .9, .3, 1);
  overflow: hidden;
}
@keyframes ttSlideUp { from { transform: translateY(10%); opacity: .6; } to { transform: translateY(0); opacity: 1; } }

.tt-fs-top {
  flex: none; display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--glass-border);
}
.tt-fs-close {
  flex: none; border: 1px solid var(--glass-border); background: transparent; cursor: pointer;
  padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: 13px;
  font-family: var(--font-family); color: var(--text-main);
}
.tt-fs-weeks { flex: 1; display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.tt-fs-weeks button {
  border: 1px solid var(--glass-border); background: transparent; cursor: pointer;
  padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: 13px;
  font-family: var(--font-family); color: var(--text-main);
}
.tt-fs-weeks button.accent { background: linear-gradient(135deg, #C7B8E3, #A99DD8); color: #fff; border-color: transparent; }

.tt-fs-title {
  flex: none; padding: 10px 16px 2px;
  font-size: 13px; font-weight: 700; color: var(--text-sub);
}

.tt-fs-scroll { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; }
.tt-fs-grid {
  --tt-axis: 60px; --headH: 46px; --rowH: 76px;
  display: grid;
  grid-template-columns: var(--tt-axis) repeat(7, minmax(100px, 1fr));
  align-content: start;
}
.tt-fs-grid .course-box { margin: 3px; }
.tt-fs-grid .course-box .cn { display: block; -webkit-line-clamp: unset; }

/* ==================== 添加课程弹窗：星期胶囊 + 颜色色板 ==================== */
.wd-chip {
  flex: none; min-width: 52px; padding: 9px 0; border-radius: 999px;
  border: 1px solid var(--glass-border); background: transparent; cursor: pointer;
  font-size: 13px; font-weight: 600; font-family: var(--font-family); color: var(--text-main);
  transition: background .15s ease, color .15s ease, transform .15s ease;
}
.wd-chip.on { background: linear-gradient(135deg, #C7B8E3, #A99DD8); color: #fff; border-color: transparent; }
.wd-chip:active { transform: scale(.94); }
html[data-theme="dark"] .wd-chip { background: rgba(255, 255, 255, .06); }
.swatch {
  width: 34px; height: 34px; border-radius: 12px; cursor: pointer;
  border: 2px solid transparent; box-shadow: 0 2px 8px -2px rgba(0, 0, 0, .12);
  transition: transform .15s ease, border-color .15s ease;
}
.swatch.on { border-color: var(--text-main); transform: scale(1.08); }

/* 卡片「呼吸感」微动效：极细微阴影变化，4s 循环，让画面是「活」的 */
@keyframes breathe {
  0%, 100% { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .65), 0 4px 14px -6px rgba(105, 78, 138, .10); }
  50%      { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .65), 0 7px 20px -6px rgba(105, 78, 138, .20); }
}

/* ==================== 背景装扮（设置页） ==================== */
/* 圆润开关 */
.switch {
  position: relative; flex: none; width: 52px; height: 30px; border-radius: 999px;
  border: none; cursor: pointer; padding: 0;
  background: rgba(0, 0, 0, .12);
  transition: background .25s ease;
}
.switch .knob {
  position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
  transition: transform .25s cubic-bezier(.34, 1.56, .64, 1);
}
.switch.on { background: linear-gradient(135deg, var(--accent), var(--primary)); }
.switch.on .knob { transform: translateX(22px); }

/* 图库预览条 · 圆角缩略图 */
.bg-thumb {
  width: 64px; height: 96px; flex: none; border-radius: 14px; cursor: pointer;
  background-size: cover; background-position: center;
  border: 2px solid rgba(255, 255, 255, .6);
  box-shadow: 0 4px 12px -4px rgba(105, 78, 138, .3);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.bg-thumb:active { transform: scale(.92); }
.bg-thumb.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 40%, transparent);
}