/* style.css — 课程助手 Web 版 · 移动端优先（iOS Safari 友好） */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --green: #16a34a;
  --red: #dc2626;
  --orange: #ea580c;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1e293b;
  --sub: #64748b;
  --border: #e2e8f0;
  --radius: 14px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  overscroll-behavior-y: none;
}

/* ---------- 顶部栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  padding: calc(10px + var(--safe-top)) 14px 10px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { flex: 1; font-size: 17px; margin: 0; text-align: center; }
.topbar-acc { font-size: 12px; color: var(--sub); max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn {
  border: none; background: none; font-size: 26px; line-height: 1;
  color: var(--primary); padding: 2px 8px; cursor: pointer;
}

/* ---------- 主体 ---------- */
#main { padding: 12px 14px calc(76px + var(--safe-bottom)); min-height: 60vh; }
.view { display: none; animation: fade .18s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

h2 { font-size: 18px; margin: 6px 0 12px; }
h3 { font-size: 15px; margin: 14px 0 8px; color: var(--sub); font-weight: 600; }

.section-head { display: flex; align-items: center; justify-content: space-between; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.empty {
  text-align: center; color: var(--sub);
  padding: 32px 12px; font-size: 14px;
}

/* ---------- 账号 ---------- */
.platform-tabs {
  display: flex; background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden; margin-bottom: 12px;
}
.platform-tabs button {
  flex: 1; border: none; background: none; padding: 10px;
  font-size: 15px; color: var(--sub); cursor: pointer;
}
.platform-tabs button.active { background: var(--primary); color: #fff; font-weight: 600; }

.account-card { display: flex; align-items: center; gap: 12px; }
.account-card.current { border-color: var(--primary); }
.avatar {
  width: 46px; height: 46px; border-radius: 50%; overflow: hidden;
  background: var(--primary); color: #fff; display: flex;
  align-items: center; justify-content: center; font-size: 19px; flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.acc-info { flex: 1; min-width: 0; }
.acc-name { font-weight: 600; font-size: 15px; }
.acc-sub { color: var(--sub); font-size: 12.5px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-ops { display: flex; flex-direction: column; gap: 6px; }

/* ---------- 课程 / 活动 ---------- */
.course-card, .activity-card { cursor: pointer; }
.course-name { font-weight: 600; font-size: 15.5px; }
.course-sub { color: var(--sub); font-size: 13px; margin-top: 4px; }
.act-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.act-name { font-weight: 600; font-size: 15px; }
.act-desc { color: var(--sub); font-size: 13px; margin-top: 3px; }
.act-time { margin-left: auto; color: var(--sub); font-size: 12px; }
.activity-card.disabled { opacity: .55; cursor: default; }

/* ---------- 徽章 ---------- */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; line-height: 1.6;
}
.badge.green { background: #dcfce7; color: var(--green); }
.badge.blue  { background: #dbeafe; color: var(--primary); }
.badge.orange{ background: #ffedd5; color: var(--orange); }
.badge.gray  { background: #e2e8f0; color: var(--sub); }

/* ---------- 按钮 ---------- */
.btn {
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  border-radius: 11px; padding: 9px 16px; font-size: 14.5px; cursor: pointer;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.btn.danger  { color: var(--red); border-color: #fecaca; }
.btn.small   { padding: 5px 11px; font-size: 12.5px; border-radius: 8px; }
.btn.big     { width: 100%; padding: 14px; font-size: 16px; margin-top: 10px; }
.btn.block   { width: 100%; margin-top: 10px; }
.btn:disabled { opacity: .55; }

/* ---------- 表单 ---------- */
label { display: block; font-size: 13.5px; color: var(--sub); margin: 12px 0 4px; }
input, select {
  width: 100%; padding: 11px 12px; margin-top: 5px;
  border: 1px solid var(--border); border-radius: 10px;
  font-size: 15px; background: var(--card); color: var(--text);
  -webkit-appearance: none;
}
input:focus, select:focus { outline: 2px solid var(--primary); border-color: transparent; }
.input-row { display: flex; gap: 8px; align-items: center; }
.input-row input { flex: 1; margin-top: 5px; }

.check-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 4px; margin: 0; font-size: 14.5px; color: var(--text);
  cursor: pointer; -webkit-user-select: none; user-select: none;
}
.check-item:active { background: rgba(37, 99, 235, .07); border-radius: 8px; }
/* 复选框必须自绘：全局 input 的 -webkit-appearance:none 会抹掉 iOS 原生勾选标记 */
.check-item input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 21px; height: 21px;
  border: 2px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  padding: 0; margin: 0;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}
.check-item input[type="checkbox"]:checked {
  background: var(--primary);
  border-color: var(--primary);
}
.check-item input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 6px; top: 2px;
  width: 5px; height: 10px;
  border: solid #fff;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}
.check-group { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 4px 12px; }

.hint { color: var(--sub); font-size: 12.5px; line-height: 1.7; margin-top: 10px; }
.hint input { margin-top: 6px; }
.preset { background: var(--bg); border-radius: 8px; padding: 8px 10px; margin: 6px 0; font-size: 13px; }
.warn { color: var(--orange); font-size: 13px; }

/* ---------- 签到面板 ---------- */
.sign-head { display: flex; align-items: center; gap: 10px; }
.sign-action { margin-top: 14px; }
.result-row {
  display: flex; justify-content: space-between; gap: 10px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 11px 13px; margin-top: 8px; font-size: 14px;
}
.result-row.ok   { border-left: 4px solid var(--green); }
.result-row.fail { border-left: 4px solid var(--red); }
.result-row span:last-child { color: var(--sub); text-align: right; }

/* ---------- 底部导航 ---------- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; background: var(--card);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
}
.nav-item {
  flex: 1; border: none; background: none; cursor: pointer;
  padding: 9px 0 7px; font-size: 11.5px; color: var(--sub);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.nav-item span { font-size: 21px; line-height: 1.2; }
.nav-item.active { color: var(--primary); font-weight: 600; }

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(15, 23, 42, .45);
  display: none; align-items: flex-end; justify-content: center;
}
.modal.show { display: flex; }
.modal-body {
  background: var(--card); width: 100%; max-width: 520px;
  border-radius: 18px 18px 0 0; padding: 20px 18px calc(20px + var(--safe-bottom));
  max-height: 88vh; overflow-y: auto;
  animation: slideUp .22s ease;
}
@keyframes slideUp { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
.modal-body h2 { margin-top: 0; }
.modal-ops { display: flex; gap: 10px; margin-top: 20px; }
.modal-ops .btn { flex: 1; }

.video-box {
  width: 100%; aspect-ratio: 3 / 4; background: #0f172a;
  border-radius: 12px; overflow: hidden; margin: 10px 0;
  display: flex; align-items: center; justify-content: center; color: #94a3b8;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(84px + var(--safe-bottom));
  transform: translateX(-50%) translateY(12px);
  background: rgba(15, 23, 42, .92); color: #fff;
  padding: 10px 18px; border-radius: 11px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: all .22s ease;
  max-width: 86vw; text-align: center; z-index: 99;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: rgba(185, 28, 28, .95); }

/* ---------- IM 群签到横幅 ---------- */
.im-banner {
  position: fixed; left: 10px; right: 10px;
  top: calc(56px + var(--safe-top));
  z-index: 60;
  background: #fff7ed; border: 1px solid #fdba74;
  border-radius: 13px; padding: 12px 14px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .16);
  display: none; align-items: center; gap: 10px;
}
.im-banner.show { display: flex; animation: fade .2s ease; }
.im-banner-body { flex: 1; min-width: 0; }
.im-banner-title { font-size: 14.5px; font-weight: 600; color: #9a3412; }
.im-banner-sub { font-size: 12.5px; color: #c2410c; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.im-banner-ops { display: flex; gap: 6px; flex-shrink: 0; }
.im-dot {
  background: var(--green); color: #fff; font-size: 10px;
  padding: 1px 6px; border-radius: 999px; font-weight: 700;
}

/* ---------- 关于 ---------- */
.about a { color: var(--primary); }
.about p { font-size: 13.5px; line-height: 1.8; }
