/* ========================================
   校园无忧圈 H5 - 全局样式
   ======================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --primary: #ff7d00;
  --primary-dark: #e56d00;
  --primary-light: #fff3e6;
  --success: #07c160;
  --warning: #fa9d3b;
  --danger: #e64340;
  --text: #2b2b33;
  --text-light: #9a9aa5;
  --bg: #f5f6f8;
  --card: #fff;
  --border: #ededf0;
  --shadow: 0 2px 14px rgba(31, 32, 65, 0.06);
  --shadow-md: 0 8px 28px rgba(31, 32, 65, 0.10);
  --radius: 16px;
  --radius-sm: 10px;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ===== 全屏加载过渡层（进入/登录期间显示，避免首页干等） ===== */
.app-loading {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #eef4ff 0%, #f6f2ff 100%);
  transition: opacity .3s ease;
}
.app-loading.hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  display: none;
}
.app-loading-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  transform: translateY(-8%);
}
.app-loading-logo .logo-img {
  width: 88px;
  height: 88px;
  border-radius: 24px;
  box-shadow: 0 10px 30px rgba(56,108,255,0.25);
}
.app-loading-spinner {
  width: 30px;
  height: 30px;
  border: 3px solid rgba(56,108,255,0.2);
  border-top-color: #386cff;
  border-radius: 50%;
  animation: app-loading-spin .8s linear infinite;
}
@keyframes app-loading-spin {
  to { transform: rotate(360deg); }
}
.app-loading-text {
  font-size: 14px;
  color: #6b7280;
  letter-spacing: 1px;
}

.page {
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}

.main-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-bottom: calc(56px + env(safe-area-inset-bottom));
}

.hidden {
  display: none !important;
}

/* 底部 Tab 导航 */
.bottom-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: 56px;
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 12px rgba(0,0,0,0.04);
}

.tabbar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 100%;
  color: var(--text-light);
  cursor: pointer;
  transition: color .2s;
}

.tabbar-item .tabbar-icon {
  font-size: 20px;
  line-height: 1;
}

.tabbar-item .tabbar-text {
  font-size: 10px;
  font-weight: 600;
}

.tabbar-item.active {
  color: var(--primary);
}

.tabbar-item:active {
  opacity: 0.7;
}

/* ========================================
   登录页
   ======================================== */
#login-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 28px;
  background: linear-gradient(180deg, #fff3e6 0%, #fdf6ef 32%, #f5f6f8 60%);
}

.login-header {
  margin-top: 7vh;
  text-align: center;
}

.login-logo .logo-img {
  width: 86px;
  height: 86px;
  border-radius: 24px;
  object-fit: cover;
  box-shadow: 0 10px 28px rgba(250,157,59,0.32);
}

.logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--warning), #ffbd6d);
  color: #fff;
  font-size: 32px;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(250,157,59,0.28);
}

.login-header h1 {
  margin-top: 18px;
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
}

.login-subtitle {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-light);
}

.login-form {
  width: 100%;
  max-width: 420px;
  margin-top: 22px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 26px 22px;
  box-shadow: var(--shadow-md);
}

.form-group {
  margin-bottom: 20px;
}

.captcha-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.captcha-input {
  flex: 1;
}

.captcha-img {
  width: 128px;
  height: 50px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f5f6f8;
  cursor: pointer;
  object-fit: cover;
  flex-shrink: 0;
}

.form-label {
  display: block;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 8px;
  font-weight: 500;
}

.form-input {
  width: 100%;
  height: 50px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fafafb;
  font-size: 16px;
  color: var(--text);
  transition: border-color .2s, box-shadow .2s, background .2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255,125,0,0.12);
}

.form-input::placeholder {
  color: #bbb;
}

.btn {
  border: none;
  cursor: pointer;
  font-size: 16px;
  border-radius: var(--radius);
  transition: opacity .2s, transform .1s;
}

.btn:active {
  opacity: .85;
  transform: scale(.98);
}

.btn-primary {
  height: 50px;
  background: linear-gradient(135deg, var(--primary), #ff9a3d);
  color: #fff;
  font-weight: 700;
  font-size: 17px;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(255,125,0,0.32);
}

.btn-block {
  width: 100%;
}

.btn-ghost {
  background: transparent;
  color: var(--primary);
  border: 1px solid rgba(255,125,0,0.3);
}

.btn-sm {
  height: 30px;
  font-size: 13px;
  padding: 0 12px;
  border-radius: 8px;
}

.btn-small {
  height: 30px;
  font-size: 13px;
  padding: 0 12px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.login-tip {
  margin-top: 22px;
  text-align: center;
  font-size: 12px;
  color: var(--text-light);
  line-height: 1.7;
}

/* 登录等待提示：首次登录需连接教务系统，加载较慢，引导用户耐心等待 */
.login-wait-hint {
  margin-top: 14px;
  padding: 9px 12px;
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
  color: var(--primary);
  background: rgba(255,125,0,0.08);
  border: 1px solid rgba(255,125,0,0.18);
  border-radius: 8px;
}
.login-wait-hint b {
  color: var(--primary);
  font-weight: 700;
}

.login-contact {
  display: block;
  margin-top: 12px;
  text-align: center;
  font-size: 13px;
  color: var(--primary);
  text-decoration: none;
}

.login-contact:active {
  opacity: 0.7;
}

.login-footer {
  position: fixed;
  bottom: 24px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 11px;
  color: #ccc;
}

/* ========================================
   主界面
   ======================================== */
#main-page {
  background: var(--bg);
}

.topbar {
  background: linear-gradient(135deg, var(--primary), #ff9a3d);
  color: #fff;
  padding-top: env(safe-area-inset-top);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(255,125,0,0.25);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
}

.topbar-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-title::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.25);
}

.topbar .btn-ghost {
  color: #fff;
  border-color: rgba(255,255,255,0.45);
  background: rgba(255,255,255,0.12);
}

/* 用户卡片 */
.user-card {
  display: flex;
  align-items: center;
  margin: 16px;
  padding: 18px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.user-avatar {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), #ffab4d);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 600;
  margin-right: 14px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(255,125,0,0.25);
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 17px;
  font-weight: 700;
}

.user-detail {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 功能模块 */
.module-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 0 16px;
}

.module-item {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 8px;
  text-align: center;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .1s, box-shadow .2s;
}

.module-item:active {
  transform: scale(.95);
}

.module-item:hover {
  box-shadow: var(--shadow-md);
}

.module-icon {
  width: 46px;
  height: 46px;
  margin: 0 auto 10px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 600;
  color: #fff;
}

.icon-timetable { background: linear-gradient(135deg, #ff7d00, #ffab4d); }
.icon-grades { background: linear-gradient(135deg, #07c160, #35d97f); }
.icon-exams { background: linear-gradient(135deg, #fa9d3b, #f8b668); }
.icon-profile { background: linear-gradient(135deg, #9c6bff, #b892ff); }

.module-text {
  font-size: 12px;
  color: var(--text);
}

/* 内容区域 */
.content-area {
  flex: 1;
  min-height: 0;
  padding: 12px;
  display: flex;
  flex-direction: column;
}

/* tab 内容：默认隐藏；显示时使用 flex 列布局 */
.tab-content {
  display: none;
  flex-direction: column;
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  min-height: 0;
  flex: 1;
}

.tab-content:not(.hidden) {
  display: flex !important;
}

/* 课表容器样式已合并至 WakeUp 风格区块 */

/* 全屏模式：切换到课表时隐藏首页用户卡片和功能按钮，让课表更专注 */
.main-page.tab-fullscreen .user-card,
.main-page.tab-fullscreen .module-grid {
  display: none;
}

.tab-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}

.tab-header h3 {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tab-header h3::before {
  content: '';
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--primary), #ffab4d);
}

.term-select {
  display: flex;
  align-items: center;
  gap: 6px;
}

.term-select select {
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 6px;
  font-size: 12px;
  background: #fafafb;
  color: #55555e;
  font-weight: 500;
  cursor: pointer;
}

/* ===== 课表页面顶部（WAKEUP 风格） ===== */

.timetable-page {
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.timetable-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

/* 顶部标题栏：一行，左侧柔和日期 + 右侧查询 */
.tt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  flex-shrink: 0;
  gap: 12px;
  flex-wrap: wrap;
}

.tt-date-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

/* 柔和日期：小号、浅色、非黑体，去掉粗黑感 */
.tt-date-big {
  font-size: 19px;
  font-weight: 600;
  color: #ff758c;
  letter-spacing: 0.5px;
  line-height: 1;
  white-space: nowrap;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
}

.tt-date-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-light);
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
}

.tt-date-meta .sep {
  color: var(--border);
}

/* 操作区：上下对齐到右侧，保持一行 */
.tt-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* 简洁图标按钮 */
.icon-btn {
  border: none;
  background: #f2f3f5;
  color: #55555e;
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  line-height: 1.3;
}

.icon-btn:active {
  opacity: .75;
}

.icon-btn.active {
  background: var(--primary);
  color: #fff;
}

/* 周一~周日选择栏（WakeUp：首格月份，余下星期+日期） */
.tt-weekdays {
  display: grid;
  grid-template-columns: 36px repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 14px;
  flex-shrink: 0;
}

.tt-weekdays .tt-wd {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 2px;
  border-radius: 14px;
  font-size: 12px;
  color: var(--text-light);
  font-weight: 500;
  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: all .15s;
}

.tt-weekdays .tt-wd .tt-wd-name {
  font-size: 12px;
}

.tt-weekdays .tt-wd .tt-wd-date {
  font-size: 11px;
  opacity: 0.85;
}

.tt-weekdays .tt-wd.active {
  background: #ff758c;
  color: #fff;
  box-shadow: 0 4px 12px rgba(255,117,140,0.35);
}

/* 月份首格 */
.tt-weekdays .month-cell {
  background: rgba(255,255,255,0.85);
  color: var(--text);
  font-weight: 700;
  gap: 0;
  padding: 6px 2px;
}

.tt-weekdays .month-cell .month-num {
  font-size: 18px;
  line-height: 1.1;
}

.tt-weekdays .month-cell .month-text {
  font-size: 11px;
  opacity: 0.8;
}

/* 第二行控制条：周次导航 + 学期选择，横向两端分布 */
.tt-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* 顶部操作区内的周次导航 */
.tt-weeknav {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-wrap: nowrap;
}

.tt-weeknav .week-btn {
  border: none;
  background: #f2f3f5;
  color: #55555e;
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  line-height: 1.3;
}

.tt-weeknav .week-btn:active {
  opacity: .75;
}

.tt-weeknav .week-btn.active {
  background: var(--primary);
  color: #fff;
}

/* 兼容旧结构 */
.tt-header-actions .week-btn {
  border: none;
  background: #f2f3f5;
  color: #55555e;
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  line-height: 1.3;
}

.tt-header-actions .week-btn:active {
  opacity: .75;
}

.tt-header-actions .week-btn.active {
  background: var(--primary);
  color: #fff;
}

/* 查询按钮统一为浅灰风格，与周导航一致，避免橙色块突兀 */
.tt-header-actions .btn-small {
  height: 28px;
  font-size: 12px;
  padding: 0 12px;
  background: #f2f3f5;
  color: #55555e;
  border-radius: 10px;
  font-weight: 500;
}

.week-hint {
  text-align: center;
  color: var(--text-light);
  font-size: 12px;
  padding: 4px 0 16px;
}

/* 加载 / 空状态 */
.loading {
  text-align: center;
  color: var(--text-light);
  padding: 40px 0;
  font-size: 14px;
}

.loading::after {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 8px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty {
  text-align: center;
  color: var(--text-light);
  padding: 40px 0;
  font-size: 14px;
}

.error-box {
  text-align: center;
  color: var(--danger);
  padding: 30px 0;
  font-size: 14px;
}

/* ===== 课表主体（WAKEUP 风格） ===== */

/* 课表容器：圆角卡片，浮在背景上，撑满面板 */
#timetable-container {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  border-radius: 20px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.06);
  border: 1px solid rgba(255,255,255,0.6);
  overflow: hidden;
}

.tt-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

/* 课表网格：左侧时间轴 + 7 天等宽，按大节精确行高，撑满整屏无留白 */
.tt-grid {
  display: grid;
  grid-template-columns: 40px repeat(7, 1fr);
  grid-auto-rows: 1fr;
  gap: 1px;
  background: rgba(0,0,0,0.04);
  height: 100%;
  padding: 4px;
}

/* 节次轴：小节号 + 时间段 */
.tt-time {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 8px;
  gap: 2px;
  color: var(--text);
  background: transparent;
  line-height: 1.2;
  overflow: hidden;
}
.tt-time .tt-big {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.tt-time .tt-clock {
  font-size: 7px;
  color: var(--text-light);
  white-space: nowrap;
}

/* 空白背景格：半透明底 */
.tt-cell {
  background: rgba(255,255,255,0.45);
  border-radius: 8px;
}

/* 课程卡片：WakeUp 彩色毛玻璃圆角块 */
.course-cell {
  width: calc(100% - 6px);
  height: calc(100% - 6px);
  min-width: 0;
  border-radius: 14px;
  padding: 6px 6px;
  margin: 3px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  z-index: 2;
  box-sizing: border-box;
  background: rgba(255,255,255,0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.10);
  border: 1px solid rgba(255,255,255,0.45);
}

.course-cell::after {
  content: '';
  position: absolute;
  top: 8px;
  right: 8px;
  width: 7px;
  height: 7px;
  background: rgba(255,255,255,0.9);
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  opacity: 0.85;
  pointer-events: none;
}

.course-cell:active {
  opacity: .9;
  transform: scale(.98);
}

/* 课程类型小标签 */
.course-cell .c-tag {
  align-self: flex-start;
  display: inline-block;
  background: rgba(255,255,255,0.30);
  color: #fff;
  border-radius: 6px;
  padding: 1px 5px;
  font-size: 9px;
  line-height: 1.5;
  flex-shrink: 0;
  font-weight: 600;
  margin-bottom: 3px;
  backdrop-filter: blur(4px);
}

/* 课程名：加粗、最多 3 行换行显示（列宽足够时自然换行，避免竖排），超出省略 */
.course-cell .c-name {
  font-weight: 700;
  line-height: 1.25;
  font-size: 12px;
  color: #fff;
  word-break: break-word;
  overflow-wrap: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  letter-spacing: 0.2px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

/* 教室地点：@教室 格式，白色 */
.course-cell .c-room {
  font-size: 9px;
  line-height: 1.2;
  margin-top: 3px;
  color: rgba(255,255,255,0.95);
  word-break: break-word;
  overflow-wrap: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 教师：卡片上仅显示课程名+地点，首页隐藏教师（详情弹窗里仍可看） */
.course-cell .c-teacher {
  display: none;
  color: rgba(255,255,255,0.9);
  font-size: 9px;
  line-height: 1.2;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 底部：教师 + 周次/单双周 */
.course-cell .c-footer {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 9px;
  line-height: 1.25;
  color: rgba(255,255,255,0.85);
  margin-top: auto;
}

.course-cell .c-footer span {
  display: block;
  word-break: break-word;
  overflow-wrap: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 兼容旧结构 */
.course-cell .c-weeks {
  color: rgba(255,255,255,0.9);
  font-size: 9px;
  line-height: 1.2;
  margin-bottom: 2px;
  word-break: break-word;
  overflow-wrap: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.course-cell .c-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
  font-size: 9px;
  color: #fff;
  line-height: 1.2;
  margin-bottom: 2px;
}

.course-cell .c-more {
  font-size: 10px;
  font-weight: 600;
  margin-top: 3px;
  text-align: center;
  color: #fff;
  opacity: 0.95;
}

/* 同一时间段多门课时，每门课独立一行 */
.course-cell .c-name:not(:first-of-type) {
  margin-top: 2px;
  border-top: 1px dashed rgba(255,255,255,0.35);
  padding-top: 2px;
}

/* 多课程合并时的紧凑显示 */
.course-cell.compact {
  padding: 5px 5px;
}

.course-cell.compact .c-name {
  font-size: 10px;
  line-height: 1.25;
  -webkit-line-clamp: 2;
  margin-bottom: 0;
}

.course-cell.compact .c-name:not(:first-of-type) {
  margin-top: 2px;
  padding-top: 2px;
  border-top: 1px dashed rgba(255,255,255,0.3);
}

.course-cell.compact .c-tag,
.course-cell.compact .c-room,
.course-cell.compact .c-teacher,
.course-cell.compact .c-footer {
  display: none;
}

/* 课程块在窄屏下自动缩小字号 */
@media (max-width: 380px) {
  .course-cell .c-name { font-size: 10px; }
  .course-cell .c-room,
  .course-cell .c-teacher { font-size: 8px; }
  .tt-grid { grid-template-columns: 36px repeat(7, 1fr); }
  .tt-weekdays { grid-template-columns: 34px repeat(7, 1fr); }
  /* 窄屏节次栏很窄，隐藏时间段只留大节号，避免截断 */
  .tt-time .tt-clock { display: none; }
}

/* 课表（列表模式） */
.course-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.course-item {
  background: #fafafa;
  border-radius: 8px;
  padding: 12px;
  border-left: 4px solid var(--primary);
}

.course-item .ci-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.course-item .ci-name {
  font-weight: 600;
  font-size: 15px;
}

.course-item .ci-meta {
  font-size: 13px;
  color: var(--text-light);
  line-height: 1.8;
}

.course-item .ci-tag {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  margin-right: 6px;
}

/* 成绩样式 */
.grade-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.grade-stat {
  background: #fafafa;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}

.grade-stat .gs-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
}

.grade-stat .gs-label {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

.grade-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.grade-table th, .grade-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.grade-table th {
  background: #fafafa;
  font-weight: 500;
  color: var(--text-light);
  white-space: nowrap;
}

.grade-table td {
  color: var(--text);
}

.grade-pass { color: var(--success); font-weight: 600; }
.grade-fail { color: var(--danger); font-weight: 600; }

/* 考试样式 */
.exam-item {
  display: flex;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.exam-item:last-child {
  border-bottom: none;
}

.exam-date {
  text-align: center;
  flex-shrink: 0;
  background: var(--primary-light);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--primary);
  font-weight: 600;
  font-size: 13px;
}

.exam-info {
  flex: 1;
  min-width: 0;
}

.exam-info .ei-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.exam-info .ei-meta {
  font-size: 12px;
  color: var(--text-light);
  line-height: 1.7;
}

/* 成绩便利贴墙 */
.grades-wall {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 22px;
  padding: 8px 4px 20px;
}

.sticky-note {
  position: relative;
  border-radius: 4px;
  padding: 16px 14px 14px;
  box-shadow: 3px 5px 14px rgba(0,0,0,0.12);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  transition: transform .2s, box-shadow .2s;
}
.sticky-note:hover {
  transform: rotate(0deg) scale(1.01) !important;
  box-shadow: 5px 8px 20px rgba(0,0,0,0.18);
  z-index: 2;
}
.sticky-tape {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 70px;
  height: 18px;
  background: rgba(255,255,255,0.55);
  border: 1px solid rgba(0,0,0,0.04);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.sticky-title {
  font-size: 15px;
  font-weight: 700;
  color: #4a4a4a;
  text-align: center;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px dashed rgba(0,0,0,0.12);
}
.sticky-stat {
  display: flex;
  justify-content: center;
  gap: 12px;
  font-size: 12px;
  color: #666;
  margin-bottom: 10px;
}
.sticky-header {
  display: grid;
  grid-template-columns: 1fr 38px 46px 38px;
  gap: 4px;
  font-size: 11px;
  color: #888;
  padding: 6px 2px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  text-align: center;
}
.sticky-header span:first-child { text-align: left; }
.sticky-row {
  display: grid;
  grid-template-columns: 1fr 38px 46px 38px;
  gap: 4px;
  padding: 7px 2px;
  border-bottom: 1px dashed rgba(0,0,0,0.08);
  font-size: 12px;
  color: #444;
  align-items: center;
  text-align: center;
}
.sticky-row:last-child { border-bottom: none; }
.sticky-course {
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sticky-credit, .sticky-point { color: #666; }
.sticky-grade { font-weight: 700; }

/* 成绩按学期分组 */
.term-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.term-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f3f5f9;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: all .2s;
}

.term-btn:hover {
  background: var(--primary-light);
}

.term-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.term-btn.active .term-count {
  background: rgba(255,255,255,0.25);
  color: #fff;
}

.term-count {
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 10px;
  padding: 0 7px;
  font-size: 11px;
  line-height: 1.7;
}

.term-stat {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--text-light);
}

.term-stat > div {
  background: #fafafa;
  border-radius: 8px;
  padding: 8px 14px;
}

.term-stat .ts-num {
  font-weight: 700;
  color: var(--primary);
  font-size: 15px;
}

/* 考试按日期分组 */
.exam-group {
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--card);
}

.exam-group .eg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--primary-light);
  padding: 11px 14px;
  font-weight: 600;
  font-size: 14px;
  color: var(--primary);
}

.exam-group .eg-count {
  font-size: 12px;
  font-weight: 500;
  background: rgba(255,125,0,0.12);
  border-radius: 10px;
  padding: 1px 8px;
}

.exam-group .exam-item {
  padding: 12px 14px;
}

.exam-group .ei-ico {
  margin-right: 4px;
  opacity: .7;
}

/* 个人信息样式 */
.profile-list {
  display: flex;
  flex-direction: column;
}

.profile-item {
  display: flex;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}

.profile-item:last-child {
  border-bottom: none;
}

.profile-item .pi-label {
  width: 90px;
  color: var(--text-light);
  font-size: 14px;
  flex-shrink: 0;
}

.profile-item .pi-value {
  flex: 1;
  font-size: 14px;
  color: var(--text);
  word-break: break-all;
}

/* 每日课表提醒卡片 */
.reminder-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  padding: 16px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--border);
}
.reminder-info {
  flex: 1;
  margin-right: 12px;
}
.reminder-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.reminder-desc {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
  line-height: 1.5;
}
.reminder-btn {
  flex-shrink: 0;
  padding: 8px 18px;
  border: none;
  border-radius: 20px;
  background: var(--primary, #4c8bf5);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  transition: opacity .2s;
}
.reminder-btn:active {
  opacity: .8;
}
.reminder-btn.reminder-on {
  background: #52c41a;
}
.reminder-btn:disabled {
  opacity: .6;
  cursor: not-allowed;
}

/* ========================================
   我的：应用网格 + 可折叠个人信息卡片 + 应用子视图
   ======================================== */
.profile-tab {
  gap: 12px;
}

.profile-home {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 应用入口区：手机桌面图标风格 */
.apps-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px 8px;
  padding: 4px 2px 6px;
}

.app-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  user-select: none;
  transition: transform .12s;
}

.app-item:active {
  transform: scale(.9);
}

.app-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.12);
}

.icon-app-ranking {
  background: linear-gradient(135deg, #ff9500, #ffd60a);
  box-shadow: 0 6px 16px rgba(255,149,0,.35);
}

.app-name {
  font-size: 12px;
  color: var(--text);
}

/* 个人信息折叠卡片 */
.profile-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.profile-card-head {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  cursor: pointer;
  transition: background .15s;
}

.profile-card-head:active {
  background: #fafafa;
}

.profile-card-main {
  flex: 1;
  min-width: 0;
}

.profile-card-arrow {
  color: var(--text-light);
  font-size: 14px;
  flex-shrink: 0;
  margin-left: 10px;
  transition: transform .25s ease;
}

.profile-card.open .profile-card-arrow {
  transform: rotate(180deg);
}

.profile-card-body {
  border-top: 1px solid var(--border);
  padding: 4px 16px 14px;
  animation: profile-expand .22s ease;
}

@keyframes profile-expand {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.profile-card-foot {
  display: flex;
  justify-content: flex-end;
  padding-top: 6px;
}

/* 应用子视图（学院排名等） */
.app-view {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  flex: 1;
}

.app-view-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-view-back {
  border: none;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 14px;
  padding: 7px 14px;
  border-radius: 20px;
  cursor: pointer;
  flex-shrink: 0;
}

.app-view-back:active {
  opacity: .75;
}

.app-view-title {
  flex: 1;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  margin-right: 82px;
}

/* 学院排名 */
.ranking-scope-bar {
  display: flex;
  gap: 8px;
  background: #f2f3f5;
  border-radius: 22px;
  padding: 4px;
}

.ranking-scope-item {
  flex: 1;
  text-align: center;
  padding: 8px 0;
  border-radius: 18px;
  color: var(--text-light);
  font-size: 13px;
  cursor: pointer;
  transition: all .2s;
}

.ranking-scope-item.active {
  background: #fff;
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(31,32,65,.08);
}

.ranking-desc {
  font-size: 12px;
  color: var(--text-light);
  line-height: 1.6;
  padding: 0 4px;
}

.ranking-me-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #fff6e9, #fff);
  border: 1px solid rgba(255,125,0,.35);
  border-radius: 14px;
  padding: 12px 16px;
}

.ranking-me-label {
  font-size: 13px;
  color: var(--text-light);
}

.ranking-me-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
}

.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ranking-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

.ranking-item.me {
  background: linear-gradient(135deg, #fff7ec, #fff);
  border: 1px solid rgba(255,125,0,.45);
}

.ranking-badge {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.ranking-badge.gold   { background: linear-gradient(135deg, #ffd700, #ff9d00); }
.ranking-badge.silver { background: linear-gradient(135deg, #c3c8d1, #98a0ab); }
.ranking-badge.bronze { background: linear-gradient(135deg, #e59a6c, #c87a45); }
.ranking-badge.plain  { background: #f2f3f5; color: var(--text-light); }

.ranking-info {
  flex: 1;
  min-width: 0;
}

.ranking-name {
  font-size: 15px;
  font-weight: 600;
}

.ranking-name .me-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 400;
  color: var(--primary);
  background: var(--primary-light);
  border-radius: 4px;
  padding: 1px 6px;
  margin-left: 6px;
  vertical-align: 1px;
}

.ranking-meta {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 3px;
}

.ranking-score {
  text-align: right;
  flex-shrink: 0;
}

.ranking-gpa {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.1;
}

.ranking-avg {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 2px;
}

.ranking-empty {
  text-align: center;
  color: var(--text-light);
  font-size: 13px;
  line-height: 1.7;
  padding: 28px 12px;
}

.ranking-empty .re-icon {
  font-size: 40px;
  display: block;
  margin-bottom: 10px;
}

/* Toast */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.75);
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 999;
  max-width: 80%;
  text-align: center;
  pointer-events: none;
}

/* 课程详情弹层 */
.course-detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}
.course-detail-modal {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 340px;
  max-height: 75vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 30px rgba(0,0,0,0.2);
  animation: cdPop .18s ease-out;
}
@keyframes cdPop {
  from { transform: scale(.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.cd-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
}
.cd-close {
  border: none;
  background: none;
  font-size: 22px;
  line-height: 1;
  color: var(--text-light);
  cursor: pointer;
  padding: 0 2px;
}
.cd-body {
  overflow-y: auto;
  padding: 6px 16px 16px;
}
.cd-block {
  padding: 12px 0;
}
.cd-block + .cd-block {
  border-top: 1px dashed var(--border);
}
.cd-row {
  display: flex;
  padding: 5px 0;
  font-size: 14px;
}
.cd-k {
  width: 46px;
  flex-shrink: 0;
  color: var(--text-light);
}
.cd-v {
  flex: 1;
  color: var(--text);
  word-break: break-all;
}

/* 响应式 */
@media (max-width: 380px) {
  .module-grid { grid-template-columns: repeat(2, 1fr); }
  .tt-grid { grid-template-columns: 34px repeat(7, 1fr); }
  .tt-weekdays { grid-template-columns: 30px repeat(7, 1fr); }
}

@media (min-width: 720px) {
  /* 桌面/平板：内容居中，限制最大宽度，课表更舒展 */
  #main-page { max-width: 860px; margin: 0 auto; }
  .content-area { padding: 16px 24px; }
  .tt-grid { grid-template-columns: 50px repeat(7, 1fr); }
  .tt-weekdays { grid-template-columns: 46px repeat(7, 1fr); }
  .course-cell .c-name { font-size: 13px; }
}


