/* ============================================================
 * style.css — 智趣云班 3.0 前端样式（桌面优先，自适应移动设备）
 * 设计基线：桌面全宽舒适阅读 → 手机/iPad自动收缩优化触摸
 * ============================================================ */

:root {
  --brand: #4A6CF7;
  --brand-dark: #3B56D8;
  --accent: #F5A623;
  --bg: #F4F6FB;
  --card: #FFFFFF;
  --line: #E5E9F2;
  --text: #1F2733;
  --text-sub: #7A8494;
  --ok: #22A06B;
  --warn: #E8645A;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(31, 39, 51, 0.06);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  padding-bottom: 0;
}
/* 移动端防抖：键盘弹起不重排——布局视口固定（100dvh 在安卓键盘弹起时会缩小导致整页跳动，弃用；100vh 在部分 WebView 同样随视觉视口变化，改用百分比链） */
#view-teacher, #view-student { padding-bottom: calc(64px + var(--safe-bottom)); }
html { -webkit-text-size-adjust: 100%; }
html, body { height: 100%; }
#app { max-width: 1200px; margin: 0 auto; min-height: 100%; }
@media (max-width: 768px) { #app { max-width: 100%; } }
@media (max-width: 480px) { #app { max-width: 100%; } }

.hidden { display: none !important; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 18px;
  border: none; border-radius: 12px;
  font-size: 16px; cursor: pointer;
  background: #EEF1F8; color: var(--text);
  text-decoration: none;
  transition: opacity 0.15s, transform 0.05s;
}
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--brand); color: #fff; }
.btn.ghost { background: transparent; color: var(--brand); }
.btn.danger { background: var(--warn); color: #fff; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 14px; border-radius: 9px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: 0.6; pointer-events: none; }
#class-feature-links .btn { white-space: nowrap; font-size: 12px; padding: 0 6px; border-radius: 999px; justify-content: center; }

.login-brand { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 48px 24px 20px; }
.brand-logo {
  width: 56px; height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--brand), #7C9CFF);
  display: flex; align-items: center; justify-content: center;
  font-size: 30px;
  box-shadow: 0 8px 24px rgba(74, 108, 247, 0.30);
}
.login-brand h1 { margin: 0; font-size: 26px; letter-spacing: 1px; }
.login-brand h1 span { color: var(--brand); }
.brand-sub { margin: 6px 0 0; color: var(--text-sub); font-size: 14px; }

.login-card {
  background: var(--card); margin: 0 20px;
  padding: 22px 20px 18px;
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.role-tabs { display: flex; background: #EEF1F8; border-radius: 12px; padding: 4px; margin-bottom: 18px; }
.role-tab {
  flex: 1; min-height: 40px; border: none; border-radius: 9px;
  background: transparent; font-size: 16px; color: var(--text-sub); cursor: pointer;
}
.role-tab.active { background: #fff; color: var(--brand); font-weight: 600; box-shadow: 0 1px 4px rgba(31,39,51,0.08); }

.login-form label { display: block; font-size: 13px; color: var(--text-sub); margin: 12px 0 6px; }
.login-form input, .login-form select {
  width: 100%; min-height: 46px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 11px;
  font-size: 16px; background: #fff; color: var(--text); outline: none;
}
.login-form input:focus, .login-form select:focus { border-color: var(--brand); }
.login-form .btn { margin-top: 20px; }
.login-hint { text-align: center; color: var(--text-sub); font-size: 12px; margin: 16px 0 0; }

.app-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: var(--card); border-bottom: 1px solid var(--line);
}
.app-title { font-size: 18px; font-weight: 700; color: var(--brand); }
.app-header .who { font-size: 13px; color: var(--text-sub); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  max-width: 1200px; margin: 0 auto;
  display: flex;
  background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: var(--safe-bottom);
}
@media (max-width: 768px) { .tabbar { max-width: 100%; } }
.tabbar .tab {
  flex: 1; min-width: 0; min-height: 54px; border: none; background: transparent;
  font-size: 12px; color: var(--text-sub); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 4px 2px;
  white-space: nowrap; overflow: hidden;
}
@media (max-width: 480px) {
  .tabbar .tab { font-size: 10px; min-height: 46px; padding: 2px 0; }
}
@media (max-width: 380px) {
  .tabbar .tab { font-size: 9px; min-height: 44px; }
}
.tabbar .tab.active { color: var(--brand); font-weight: 600; }
.tabbar .tab .badge-dot {
  position: absolute; top: 4px; right: 4px; width: 8px; height: 8px;
  background: var(--warn); border-radius: 50%; border: 2px solid var(--card);
}

.content { padding: 14px 16px 24px; }
@media (max-width: 480px) { .content { padding: 10px 12px 20px; } }
.content h2 { font-size: 17px; margin: 4px 0 12px; }
@media (max-width: 480px) { .content h2 { font-size: 15px; } }
.list-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.list-head h2 { margin: 0; }

.card-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.card-item { display: block; text-decoration: none; color: inherit; }
.card-item .card-title { font-size: 16px; font-weight: 600; }
.card-item .card-sub { font-size: 13px; color: var(--text-sub); margin-top: 4px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.done-summary { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 14px; color: var(--text-sub); }
.done-summary strong { font-size: 16px; }

/* 我的页功能宫格 */
.me-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 12px; }
.me-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 14px 8px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  text-decoration: none; color: var(--text); font-size: 13px; min-height: 78px;
  transition: transform 0.05s, box-shadow 0.15s;
}
.me-item .me-icon { font-size: 24px; line-height: 1; }
.me-item:active { transform: scale(0.97); }
@media (max-width: 480px) { .me-grid { grid-template-columns: repeat(3, 1fr); } }
/* 我的页身份卡（学号+姓名） */
.me-identity { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; }
.me-id-row { display: flex; align-items: center; gap: 10px; }
.me-id-label { font-size: 12px; color: var(--text-secondary, #666); width: 44px; flex-shrink: 0; }
.me-id-value { font-size: 16px; font-weight: 700; }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 12px; background: #EEF1F8; color: var(--text-sub);
}
.badge.brand { background: rgba(74,108,247,0.12); color: var(--brand); }
.badge.ok { background: rgba(34,160,107,0.12); color: var(--ok); }
.badge.warn { background: rgba(232,100,90,0.12); color: var(--warn); }

.empty { text-align: center; color: var(--text-sub); padding: 48px 0; font-size: 14px; }

.student-info { margin: 12px 16px 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stu-class-info { font-size: 12px; color: var(--text2, #666); font-weight: 400; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stu-name-no { font-size: 12px; color: var(--text2, #666); font-weight: 400; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex-shrink: 0; }
.stu-assets { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.points { font-size: 14px; font-weight: 700; color: var(--accent); cursor: pointer; padding: 4px 8px; border-radius: 8px; transition: background .15s; }
.points:hover { background: rgba(255, 170, 0, 0.14); }
.stars { font-size: 13px; font-weight: 600; color: #b45309; background: #fef3c7; padding: 3px 10px; border-radius: 999px; }
.stu-pwd-btn { padding: 3px 10px; font-size: 12px; flex-shrink: 0; }
/* 学生积分明细弹窗 */
.sd-summary { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.sd-sum-item { text-align: center; padding: 10px 6px; border-radius: 10px; background: #f8f9fa; }
.sd-sum-item .sd-num { font-size: 20px; font-weight: 700; color: var(--brand); }
.sd-sum-item .sd-lab { font-size: 11px; color: var(--text-sub); margin-top: 2px; }
.sd-sheet-list { display: flex; flex-direction: column; gap: 6px; }
.sd-sheet-item { background: #fff; border: 1px solid #f0f2f7; border-radius: 8px; padding: 10px 12px; }
.sd-sheet-main { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sd-sheet-reason { font-size: 13px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sd-sheet-tag { font-size: 11px; background: #e8f4fd; color: #2980b9; padding: 1px 6px; border-radius: 4px; white-space: nowrap; }
.sd-sheet-meta { font-size: 11px; color: var(--text-sub); margin-top: 4px; }
.sd-pos { color: #27ae60; font-weight: 600; }
.sd-neg { color: #e74c3c; font-weight: 600; }

.subject-strip { height: 5px; border-radius: 3px; margin: -14px -16px 10px; }

.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  max-width: 1200px; margin: 0 auto;
  background: var(--card);
  border-radius: 18px 18px 0 0;
  padding: 24px 24px calc(80px + var(--safe-bottom));
  box-shadow: 0 -6px 30px rgba(0,0,0,0.12);
  max-height: 85vh; overflow-y: auto;
  transform: translateY(0);
  transition: transform 0.25s ease;
}
@media (max-width: 768px) { .sheet { max-width: 100%; } }
@media (max-width: 480px) {
  .sheet { padding: 18px 16px calc(70px + var(--safe-bottom)); }
  .sheet h3 { font-size: 16px; }
  .sheet input, .sheet select { font-size: 14px; min-height: 40px; }
  .sheet .actions { flex-direction: column; gap: 8px; }
  .sheet .actions .btn { width: 100%; }
  .sheet .row { flex-direction: column; }
}
.sheet h3 { margin: 0 0 14px; font-size: 17px; }
.sheet label { display: block; font-size: 13px; color: var(--text-sub); margin: 10px 0 5px; }
.sheet input, .sheet select, .sheet textarea {
  width: 100%; min-height: 44px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 10px;
  font-size: 15px; outline: none; font-family: inherit;
}
.sheet textarea { padding: 10px 12px; min-height: 80px; resize: vertical; }
.sheet .row { display: flex; gap: 10px; }
.sheet .row > * { flex: 1; }
.sheet .actions { display: flex; gap: 10px; margin-top: 18px; }
.sheet .actions .btn { flex: 1; }
.subject-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.check-label { display: flex; align-items: center; gap: 4px; font-size: 14px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.check-label input { width: auto; min-height: auto; }
.mask { position: fixed; inset: 0; z-index: 20; background: rgba(15, 20, 35, 0.45); }

.toast {
  position: fixed; left: 50%; bottom: 90px; z-index: 40;
  transform: translateX(-50%);
  max-width: 80%; padding: 10px 18px;
  background: rgba(31, 39, 51, 0.92); color: #fff;
  font-size: 14px; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s; white-space: nowrap;
}
.toast.show { opacity: 1; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.tag-green { background: #e6f7e6; color: #389e0d; }
.tag-gray { background: #f0f0f0; color: #5A6B83; }

/* ========== 桌面端专属优化（≥1200px） ========== */
@media (min-width: 1200px) {
  body { background: #eef1f5; }
  #app {
    background: var(--bg);
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
    box-shadow: 0 0 30px rgba(0,0,0,0.04);
  }
  .content { padding: 20px 28px 32px; }
  .card { padding: 18px 22px; }
  .login-brand { padding: 56px 24px 24px; }
  .login-card { margin: 0 auto; max-width: 420px; }
  .sheet { padding: 28px 28px calc(80px + var(--safe-bottom)); }
  .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  .grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
  .grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 16px; }
}

/* ========== 平板端优化（768px~1200px） ========== */
@media (min-width: 768px) and (max-width: 1199px) {
  .content { padding: 18px 24px 28px; }
  .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  .grid-3 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
}

/* ========== 手机端优化（<768px） ========== */
@media (max-width: 767px) {
  .content { padding: 12px 14px 20px; }
  .card { padding: 12px 14px; }
  .login-card { margin: 0 14px; padding: 18px 16px 16px; }
  .login-brand { padding: 40px 18px 16px; }
  .login-brand h1 { font-size: 22px; }
  .sheet { padding: 20px 20px calc(72px + var(--safe-bottom)); }
}

/* ========== 学生卡片成长记录面板 ========== */
.student-record-card { transition: background 0.15s; }
.student-record-card:hover { background: #f0f4ff; }
.student-record-card:active { background: #e8eeff; }

.record-type-btn { border-radius: 999px; padding: 6px 16px; font-size: 13px; transition: all 0.15s; }
.record-type-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }

.phrase-tag {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 13px;
  background: #f0f4ff;
  color: var(--brand);
  cursor: pointer;
  border: 1px solid #d6e0ff;
  transition: all 0.15s;
  user-select: none;
}
.phrase-tag:hover { background: #e0e8ff; border-color: var(--brand); }
.phrase-tag:active { background: var(--brand); color: #fff; }

.sheet-record { padding: 0 0 12px; }
.sheet-record h3 { margin: 0 0 6px; font-size: 17px; font-weight: 600; }

/* ============================================================
 * 工作台 / 学习台 样式
 * ============================================================ */
.dash-greeting { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.dash-sub { font-size: 13px; color: var(--text-sub); margin-bottom: 14px; }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.dash-card { background: #fff; border-radius: 12px; padding: 14px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.dash-card .num { font-size: 28px; font-weight: 700; color: var(--brand); }
.dash-card .num.warn { color: var(--warn); }
.dash-card .num.ok { color: var(--ok); }
.dash-card .label { font-size: 12px; color: var(--text-sub); margin-top: 2px; }
.dash-section-title { font-size: 15px; font-weight: 600; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.dash-quick-links { display: flex; gap: 8px; flex-wrap: wrap; }
.dash-quick-links a { padding: 8px 14px; border-radius: 10px; background: #f0f2f7; font-size: 13px; color: var(--text); text-decoration: none; transition: all .15s; }
.dash-quick-links a:hover { background: var(--brand); color: #fff; }
.dash-class-list { display: flex; gap: 8px; flex-wrap: wrap; }
.dash-class-item { padding: 8px 14px; border-radius: 10px; background: #f0f2f7; font-size: 13px; color: var(--text); text-decoration: none; transition: all .15s; }
.dash-class-item:hover { background: var(--brand); color: #fff; }
.dash-class-item.active { background: var(--brand); color: #fff; font-weight: 600; }
.dash-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
/* 本月学习热力 · 日历表（参与日绿色深浅表示参与强度，长方形格子撑满卡片，足迹图风格） */
.heat-cal { margin: 6px 0; width: 100%; }
.hc-head { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 4px; }
.hc-head-cell { font-size: 10px; color: var(--text-sub); text-align: center; }
.hc-body { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.hc-cell {
  width: auto; height: 26px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
  background: #f0f2f7; color: #8A94A3;
  cursor: default; transition: transform .1s;
}
.hc-cell:hover { transform: scale(1.15); }
.hc-empty { background: transparent; }
.hc-today { box-shadow: 0 0 0 2px var(--brand); }
.hc-l0 { background: #f0f2f7; color: #8A94A3; }
.hc-l1 { background: #d7f0dd; color: #2e7d32; }
.hc-l2 { background: #a5e3b5; color: #1b5e20; }
.hc-l3 { background: #5fc979; color: #fff; }
.hc-l4 { background: #1e9e4a; color: #fff; }
.hc-legend { display: flex; align-items: center; gap: 4px; margin-top: 10px; justify-content: flex-end; font-size: 10px; color: var(--text-sub); }
.hc-legend-label { margin: 0 2px; }
.hc-lg-cell { width: 12px; height: 12px; border-radius: 3px; font-size: 0; }
.hc-lg-cell:hover { transform: none; }
.dash-tree { display: flex; align-items: center; gap: 10px; }
.dash-tree svg { width: 80px; height: 80px; flex-shrink: 0; }
.dash-tree-info { font-size: 13px; color: var(--text-sub); }
.dash-tree-info strong { font-size: 22px; color: var(--brand); }
.dash-star-box { background: linear-gradient(135deg,#fef3c7,#fde68a); border-radius: 10px; padding: 12px; margin-bottom: 14px; }
.dash-star-box .star-num { font-size: 24px; font-weight: 700; color: #b45309; }
.dash-star-box .star-sub { font-size: 12px; color: #92400e; margin-top: 2px; }
.dash-pending-list { list-style: none; padding: 0; margin: 0; }
.dash-pending-list li { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid #f0f2f7; }
.dash-pending-list li:last-child { border-bottom: none; }
.dash-pending-list .p-title { font-size: 14px; }
.dash-pending-list .p-type { font-size: 13px; color: #5A6472; margin-left: 8px; }
.dash-pending-list .p-action { font-size: 13px; color: var(--brand); text-decoration: none; flex-shrink: 0; }
.dash-select { width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; outline: none; margin-bottom: 10px; background: #fff; }
.dash-rank-list { list-style: none; padding: 0; margin: 0; }
.dash-rank-list li { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 14px; }

/* ========== 手机端补充优化（<480px） ========== */
@media (max-width: 480px) {
  .app-header { padding: 10px 12px; }
  .app-title { font-size: 16px; }
  .student-info { margin: 10px 12px 0; flex-direction: column; gap: 6px; align-items: flex-start; }
  .stu-assets { width: 100%; justify-content: flex-start; gap: 4px; flex-wrap: nowrap; }
  .student-info .points { flex: 1 1 0; min-width: 0; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .student-info .points { font-size: 14px; }
  .stu-assets .points { min-width: 0; flex: 0 1 auto; font-size: 12px; padding: 3px 6px; white-space: nowrap; overflow: visible; text-overflow: clip; text-align: left; }
  .stu-assets .stars { flex-shrink: 0; font-size: 11px; padding: 2px 6px; }
  .stu-assets .stu-pwd-btn { flex-shrink: 0; padding: 3px 6px; }
  @media (max-width: 340px) { .stu-assets { flex-wrap: wrap; } }
  .grid-2, .grid-3 { grid-template-columns: 1fr 1fr; }
  .dash-grid { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
  .dash-row { grid-template-columns: 1fr; }
  .dash-quick-links { display: grid; grid-template-columns: repeat(3, 1fr); }
  .dash-quick-links a { text-align: center; white-space: nowrap; padding: 10px 6px; }
  .dash-card .num { font-size: 20px; }
  .dash-card { padding: 10px 6px; }
  .hc-head-cell { font-size: 9px; }
  .hc-cell { height: 20px; font-size: 10px; border-radius: 4px; }
  .toast { bottom: 70px; font-size: 13px; padding: 8px 14px; }
  .card-list { gap: 8px; }
  .card { padding: 10px 12px; }
  .list-head { flex-direction: column; gap: 8px; align-items: stretch; }
  .list-head .btn { width: 100%; }
  .site-footer { padding: 14px 12px calc(64px + var(--safe-bottom)); }
}

/* ========== 备案页脚 ========== */
.site-footer {
  text-align: center;
  padding: 16px 12px calc(64px + var(--safe-bottom));
  font-size: 12px;
  line-height: 1.8;
  color: var(--text-sub);
}
.site-footer a {
  color: var(--text-sub);
  text-decoration: none;
  margin: 0 4px;
  display: inline-block;
  vertical-align: middle;
}
.site-footer .beian-icon {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  margin-right: 4px;
}
.site-footer .footer-sep { margin: 0 2px; color: var(--line); }

/* 待完成任务分页（每页3项，超过显示数字页码） */
.pager { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 12px 0 4px; flex-wrap: wrap; }
.pager-btn { min-width: 34px; height: 30px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--text-sub); font-size: 13px; cursor: pointer; }
.pager-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.pager-btn:disabled { opacity: .45; cursor: not-allowed; }