/* ==========================================================================
   home 首页样式 —— 沿用平台既有多邻国风格令牌（见工作区 MEMORY.md）
   ========================================================================== */

:root {
  --dl-green: #58cc02;
  --dl-green-dark: #46a302;
  --dl-blue: #1cb0f6;
  --dl-blue-dark: #1899d6;
  --dl-gold: #ffc800;
  --dl-red: #ff4b4b;
  --dl-purple: #ce82ff;

  --text: #4b4b4b;
  --text-sub: #777777;
  --text-mute: #afafaf;
  --line: #e5e5e5;
  --bg: #f7f9fc;
  --card: #ffffff;
  --radius: 16px;
  --shadow: 0 2px 0 var(--line);
  --shadow-lift: 0 8px 24px rgba(31, 45, 61, 0.1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, 'PingFang SC', 'PingFang HK', 'Microsoft YaHei', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ------------------------------------------------------------ 顶栏 */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.2px;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--dl-green), var(--dl-blue));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 800;
}

.topbar-spacer {
  flex: 1;
}

.user-chip {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 14px;
  color: var(--text-sub);
}

.user-chip.on {
  display: inline-flex;
}

/* 右上角登录入口：传统站点风格，未登录时显示，登录后由 JS 隐藏 */
.login-link {
  display: inline-flex;
  align-items: center;
  padding: 8px 18px;
  border-radius: 999px;
  background: var(--dl-green);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  transition: filter 0.15s ease;
}

.login-link:hover {
  filter: brightness(1.05);
}

.login-link[hidden] {
  display: none;
}

.avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg);
  object-fit: cover;
  display: block;
}

.avatar-fallback {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--dl-blue);
  color: #fff;
  font-size: 13px;
  display: grid;
  place-items: center;
}

.link-btn {
  border: none;
  background: none;
  color: var(--text-mute);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 6px;
}

.link-btn:hover {
  color: var(--dl-red);
}

/* ------------------------------------------------------------ 标题区 */

.hero {
  padding: 36px 0 20px;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.hero p {
  margin: 0;
  color: var(--text-sub);
  font-size: 15px;
}

/* ------------------------------------------------------------ 登录面板 */

.auth-panel {
  margin: 18px 0 30px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}

.auth-panel .auth-copy {
  flex: 1 1 320px;
  min-width: 260px;
}

.auth-title {
  font-weight: 800;
  font-size: 18px;
  margin-bottom: 6px;
}

.auth-desc {
  color: var(--text-sub);
  font-size: 14px;
  margin: 0;
}

.btn {
  appearance: none;
  border: none;
  border-radius: 12px;
  padding: 13px 22px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.06s ease, filter 0.15s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-wechat {
  background: #07c160;
  color: #fff;
}

.btn-wechat:hover {
  filter: brightness(1.05);
}

.btn-ghost {
  background: var(--bg);
  color: var(--text-sub);
  border: 1px solid var(--line);
}

.btn-ghost:hover {
  color: var(--text);
}

.btn[disabled] {
  opacity: 0.6;
  cursor: progress;
}

.msg {
  margin-top: 10px;
  font-size: 13px;
  min-height: 18px;
  color: var(--text-mute);
}

.msg.error {
  color: var(--dl-red);
}

.msg.ok {
  color: var(--dl-green-dark);
}

/* ------------------------------------------------------------ 科目网格 */

.section-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 14px;
}

.section-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
}

/* 多个分组板块之间的纵向间距 */
#sections > .section-head:not(:first-child) {
  margin-top: 30px;
}

.section-head span {
  color: var(--text-mute);
  font-size: 13px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 14px;
  padding-bottom: 40px;
}

.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--accent, var(--dl-blue));
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
  border-color: #d8dee9;
}

.card.soon {
  cursor: not-allowed;
  opacity: 0.62;
}

.card.soon:hover {
  transform: none;
  box-shadow: var(--shadow);
}

.card-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.badge {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  background: var(--accent, var(--dl-blue));
  flex: 0 0 auto;
}

.card-name {
  font-weight: 800;
  font-size: 16px;
  line-height: 1.25;
}

.card-id {
  font-size: 12px;
  color: var(--text-mute);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.card-desc {
  color: var(--text-sub);
  font-size: 13px;
  margin: 0;
  min-height: 38px;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 4px;
}

.pill {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--text-mute);
  border: 1px solid var(--line);
}

.pill.live {
  background: rgba(88, 204, 2, 0.12);
  color: var(--dl-green-dark);
  border-color: rgba(88, 204, 2, 0.25);
}

.pill.soon {
  background: rgba(255, 200, 0, 0.15);
  color: #9a7600;
  border-color: rgba(255, 200, 0, 0.35);
}

.go {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent, var(--dl-blue));
}

/* ------------------------------------------------------------ 骨架/页脚 */

.skeleton {
  height: 128px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, #eef1f6 25%, #f6f8fb 37%, #eef1f6 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}

@keyframes shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: 0 0;
  }
}

footer {
  border-top: 1px solid var(--line);
  padding: 18px 0 28px;
  color: var(--text-mute);
  font-size: 12.5px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

footer code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: #eef1f6;
  padding: 1px 5px;
  border-radius: 4px;
}

@media (max-width: 640px) {
  .hero h1 {
    font-size: 24px;
  }
  .auth-panel {
    padding: 18px;
  }
  .btn-wechat {
    width: 100%;
    justify-content: center;
  }
}
