:root {
  --bg: #f5f6fa;
  --card: #ffffff;
  --text: #1c2333;
  --muted: #8a93a6;
  --line: #e8ebf2;
  --brand: #3b5bdb;
  --brand-soft: #eef1ff;
  --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
body { padding-bottom: 76px; min-height: 100vh; }
button { font-family: inherit; cursor: pointer; }
button:active { transform: scale(.97); }

.wrap { max-width: 760px; margin: 0 auto; padding: 0 14px; }

/* ---------- header ---------- */
header { background: linear-gradient(135deg, #3b5bdb 0%, #5b6ee1 60%, #7b8cf0 100%); color: #fff; padding: 20px 0 16px; }
header .wrap { display: flex; align-items: center; justify-content: space-between; }
header .sem { font-size: 15px; font-weight: 700; }
header .meta { font-size: 12px; opacity: .8; }
header .wk-badge { background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.35); border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 600; }

/* ---------- view container ---------- */
.view { display: none; animation: fade .18s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- day header (今天/日视图共用) ---------- */
.day-hero { background: var(--card); border-radius: var(--radius); padding: 18px 16px; margin-top: 14px; box-shadow: 0 3px 14px rgba(28,35,51,.05); }
.day-hero .big { font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.day-hero .big .wd { font-size: 16px; font-weight: 600; color: var(--muted); margin-left: 8px; }
.day-hero .sub { color: var(--muted); font-size: 13px; margin-top: 5px; }
.day-hero .now { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.day-hero .now .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); flex: 0 0 auto; animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .3; } }

/* ---------- course cards ---------- */
.course-list { margin-top: 12px; }
.cls { position: relative; background: var(--card); border-radius: 12px; padding: 14px 16px 14px 18px; margin-bottom: 10px; box-shadow: 0 3px 12px rgba(28,35,51,.05); overflow: hidden; }
.cls::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent, #3b5bdb); }
.cls .top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.cls .name { font-size: 15.5px; font-weight: 700; line-height: 1.3; }
.cls .time { flex: 0 0 auto; text-align: right; font-size: 13px; font-weight: 700; color: var(--accent, #3b5bdb); white-space: nowrap; }
.cls .time .seclbl { display: block; font-size: 11px; color: var(--muted); font-weight: 500; margin-top: 2px; }
.cls .info { margin-top: 7px; font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 12px; }
.cls .info .loc::before { content: "📍 "; }
.cls .info .tea::before { content: "👤 "; }
.cls.ongoing { box-shadow: 0 0 0 2px var(--accent), 0 3px 14px rgba(28,35,51,.08); }
.cls.ongoing .tag { background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; margin-left: 8px; vertical-align: 2px; }
.cls.done { opacity: .55; }

.empty { text-align: center; color: var(--muted); padding: 46px 0 30px; }
.empty .emoji { font-size: 44px; }
.empty .t { font-size: 15px; font-weight: 600; margin-top: 10px; color: var(--text); }
.empty .s { font-size: 12.5px; margin-top: 4px; }

/* ---------- date switcher (日视图) ---------- */
.datesw { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: 12px; padding: 10px; margin-top: 14px; box-shadow: 0 3px 12px rgba(28,35,51,.05); }
.datesw .arrow { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-size: 18px; font-weight: 700; color: var(--text); }
.datesw .center { flex: 1 1 auto; text-align: center; cursor: pointer; }
.datesw .center .d { font-size: 16px; font-weight: 700; }
.datesw .center .w { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.datesw .today-mini { flex: 0 0 auto; height: 40px; padding: 0 12px; border-radius: 10px; border: none; background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 13px; }

/* ---------- week nav ---------- */
.weeknav { display: flex; align-items: center; gap: 8px; background: var(--card); border-radius: 12px; padding: 10px; margin-top: 14px; box-shadow: 0 3px 12px rgba(28,35,51,.05); }
.weeknav .arrow { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-size: 17px; font-weight: 700; color: var(--text); }
.weeknav .center { flex: 1 1 auto; text-align: center; }
.weeknav .center .d { font-size: 15.5px; font-weight: 700; }
.weeknav .center .w { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.weeknav .today-mini { flex: 0 0 auto; height: 38px; padding: 0 11px; border-radius: 10px; border: none; background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 12.5px; }
.weekpills { display: flex; gap: 6px; overflow-x: auto; padding: 12px 14px 0; scrollbar-width: none; }
.weekpills::-webkit-scrollbar { display: none; }
.weekpills .pill { flex: 0 0 auto; width: 40px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 13px; font-weight: 600; }
.weekpills .pill.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.weekpills .pill.today { box-shadow: inset 0 0 0 1.5px var(--brand); }

/* ---------- week list (mobile) ---------- */
.week-list { margin-top: 14px; }
.wday { background: var(--card); border-radius: 12px; margin-bottom: 10px; overflow: hidden; box-shadow: 0 3px 12px rgba(28,35,51,.05); }
.wday .head { padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; font-size: 13.5px; font-weight: 700; border-bottom: 1px solid var(--line); }
.wday .head.today-h { color: var(--brand); }
.wday .head .cnt { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.wday .body { padding: 8px 12px; }
.wday .mini { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 8px; }
.wday .mini + .mini { border-top: 1px dashed var(--line); }
.wday .mini .bar { width: 3px; align-self: stretch; min-height: 26px; border-radius: 2px; background: var(--accent); }
.wday .mini .mtime { flex: 0 0 auto; font-size: 12px; font-weight: 700; color: var(--accent); width: 84px; }
.wday .mini .mname { flex: 1 1 auto; font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.wday .mini .minfo { font-size: 11px; color: var(--muted); font-weight: 400; margin-top: 1px; }
.wday .none { color: var(--muted); font-size: 12.5px; padding: 12px 6px; text-align: center; }

/* ---------- week grid (desktop) ---------- */
.week-grid-wrap { display: none; margin-top: 14px; overflow-x: auto; background: var(--card); border-radius: 12px; box-shadow: 0 3px 12px rgba(28,35,51,.05); }
.week-grid { border-collapse: collapse; width: 100%; min-width: 700px; }
.week-grid th { padding: 10px 6px; font-size: 13px; border-bottom: 1px solid var(--line); }
.week-grid th .d { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
.week-grid th.today-col { color: var(--brand); }
.week-grid td { vertical-align: top; border-bottom: 1px solid var(--line); padding: 4px; height: 58px; }
.week-grid .tcorner { width: 52px; font-size: 11px; color: var(--muted); text-align: center; vertical-align: middle; background: #fafbfe; }
.week-grid .gcard { border-radius: 7px; padding: 5px 6px; color: #fff; font-size: 11px; line-height: 1.3; margin-bottom: 4px; }
.week-grid .gcard .n { font-weight: 700; }
.week-grid .gcard .s { opacity: .85; font-size: 10px; }

/* ---------- month view ---------- */
.monthnav { display: flex; align-items: center; gap: 8px; background: var(--card); border-radius: 12px; padding: 10px; margin-top: 14px; box-shadow: 0 3px 12px rgba(28,35,51,.05); }
.monthnav .arrow { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-size: 17px; font-weight: 700; }
.monthnav .title { flex: 1 1 auto; text-align: center; font-size: 16px; font-weight: 700; }
.monthnav .today-mini { flex: 0 0 auto; height: 38px; padding: 0 11px; border-radius: 10px; border: none; background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 12.5px; }
.cal { background: var(--card); border-radius: 12px; margin-top: 14px; padding: 8px 6px 12px; box-shadow: 0 3px 12px rgba(28,35,51,.05); }
.cal .row { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal .dow { text-align: center; font-size: 11.5px; color: var(--muted); padding: 8px 0; font-weight: 600; }
.cal .day { position: relative; aspect-ratio: 1 / 1.05; border-radius: 9px; text-align: center; padding-top: 5px; cursor: pointer; font-size: 13px; }
.cal .day .num { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; }
.cal .day.today .num { background: var(--brand); color: #fff; font-weight: 700; }
.cal .day.other { color: #c4c9d6; }
.cal .day .dots { position: absolute; bottom: 5px; left: 0; right: 0; display: flex; justify-content: center; gap: 3px; }
.cal .day .dots i { width: 5px; height: 5px; border-radius: 50%; display: block; }
.cal .day .dots .more { width: auto; height: auto; font-size: 9px; color: var(--muted); font-style: normal; }

/* ---------- bottom sheet (month day click) ---------- */
.sheet-mask { position: fixed; inset: 0; background: rgba(20,24,38,.45); z-index: 50; display: none; animation: fade .18s ease; }
.sheet-mask.show { display: block; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 51; background: #fff; border-radius: 18px 18px 0 0; padding: 14px 16px calc(16px + env(safe-area-inset-bottom)); max-height: 72vh; overflow-y: auto; transform: translateY(100%); transition: transform .22s ease; }
.sheet.show { transform: none; }
.sheet .grab { width: 40px; height: 4px; background: var(--line); border-radius: 2px; margin: 0 auto 12px; }
.sheet h3 { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.sheet .sub { font-size: 12px; color: var(--muted); margin-bottom: 12px; }

/* ---------- bottom tab bar ---------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: #fff; border-top: 1px solid var(--line); display: flex; padding-bottom: env(safe-area-inset-bottom); }
.tabbar .tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 9px; background: none; border: none; color: var(--muted); font-size: 11px; font-weight: 600; }
.tabbar .tab .ic { font-size: 20px; line-height: 1; }
.tabbar .tab.active { color: var(--brand); }

/* ---------- responsive: desktop week grid ---------- */
@media (min-width: 760px) {
  .week-grid-wrap { display: block; }
  .week-list { display: none; }
}

.footer-note { text-align: center; color: var(--muted); font-size: 11px; margin: 22px 0 10px; }
