/* ============================================================
   组件层
   ============================================================ */

/* ---------------- 顶部导航（≥900px 显示） ---------------- */
.topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--topbar-h);
  background: rgba(255,255,255,.82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar__inner {
  height: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--page-pad);
  display: flex;
  align-items: center;
  gap: var(--sp-6);
}

.topbar__nav { display: flex; gap: var(--sp-1); margin-left: auto; }

.topbar__link {
  position: relative;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}

.topbar__link:hover { color: var(--text-1); background: var(--bg-subtle); }

.topbar__link.is-active { color: #fff; background: var(--grad-brand); box-shadow: var(--sh-brand); }

@media (min-width: 900px) {
  .topbar { display: block; }
}

/* ---------------- 品牌 ---------------- */
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.brand__mark {
  flex: none;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--grad-brand);
  box-shadow: var(--sh-brand);
}

.brand__name {
  font-size: 15px; font-weight: 700; letter-spacing: -.01em;
  white-space: nowrap; color: var(--text-1);
}

/* 大号品牌（Hero） */
.hero__brand { display: flex; align-items: center; gap: 12px; }

.hero__brand .brand__mark { width: 38px; height: 38px; border-radius: 12px; }

.hero__title {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.25;
}

.hero__sub {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-3);
  letter-spacing: .01em;
}

@media (min-width: 900px) {
  .hero__title { font-size: 27px; }
  .hero__sub { font-size: 14px; }
}

/* ---------------- Hero ---------------- */
.hero { padding-top: 20px; }
@media (min-width: 900px) { .hero { padding-top: var(--sp-8); } }

.hero__row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

/* ---------------- 搜索 ---------------- */
.search { position: relative; margin-top: var(--sp-5); }

.search__box {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 50px;
  padding: 0 8px 0 16px;
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-2);
  transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.search__box:focus-within {
  border-color: var(--brand-300);
  box-shadow: 0 0 0 3px rgba(108,92,231,.12), var(--sh-2);
}

.search__icon { flex: none; color: var(--text-3); }

.search__input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: none;
  font-size: 15px;
  outline: none;
}

.search__input::placeholder { color: var(--text-4); }

.search__btn {
  flex: none;
  height: 36px;
  padding: 0 18px;
  border-radius: var(--r-md);
  background: var(--grad-brand);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--sh-brand);
  transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}

.search__btn:active { transform: scale(.97); }

.search__clear {
  flex: none;
  display: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--bg-subtle);
  color: var(--text-3);
  font-size: 13px;
  line-height: 1;
}
.search__clear.is-show { display: grid; place-items: center; }

/* 搜索结果面板 */
.search__panel {
  position: absolute;
  left: 0; right: 0;
  top: calc(100% + 8px);
  z-index: 70;
  max-height: 62vh;
  overflow-y: auto;
  padding: var(--sp-2);
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-3);
  display: none;
}
.search__panel.is-open { display: block; }

.search__group + .search__group { margin-top: var(--sp-2); }

.search__group-label {
  padding: 6px 10px 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--text-4);
}

.search__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border-radius: var(--r-sm);
  text-align: left;
  transition: background var(--dur) var(--ease);
}
.search__item:hover { background: var(--bg-subtle); }

.search__item-main { min-width: 0; flex: 1; }
.search__item-title {
  font-size: 14px; font-weight: 600; color: var(--text-1);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.search__item-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* ---------------- 数据更新时间 ---------------- */
.update-bar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: var(--sp-3);
  padding: 5px 11px;
  font-size: 12px;
  color: var(--text-2);
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
}

.update-bar__dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--st-open-dot);
  box-shadow: 0 0 0 3px var(--st-open-bg);
}

/* ---------------- 状态徽章 ---------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.5;
}

.badge__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }

.badge--open     { color: var(--st-open-fg);     background: var(--st-open-bg); }
.badge--upcoming { color: var(--st-upcoming-fg); background: var(--st-upcoming-bg); }
.badge--waiting  { color: var(--st-waiting-fg);  background: var(--st-waiting-bg); }
.badge--finished { color: var(--st-finished-fg); background: var(--st-finished-bg); }
.badge--warn     { color: var(--warn-fg);        background: var(--warn-bg); }
.badge--ok        { color: var(--ok-fg);          background: var(--ok-bg); }
.badge--pending   { color: var(--pending-fg);     background: var(--pending-bg); }
.badge--bad       { color: var(--bad-fg);         background: var(--bad-bg); }

/* 远程回退提示条（开发环境：remote 不可用时显示） */
.fallback-banner {
  position: sticky; top: 0; z-index: 50;
  padding: 8px 14px; text-align: center;
  font-size: 13px; font-weight: 600;
  color: var(--warn-fg); background: var(--warn-bg);
  border-bottom: 1px solid color-mix(in srgb, var(--warn-fg) 25%, transparent);
}

.badge--level {
  color: var(--text-2);
  background: var(--bg-subtle);
  font-weight: 500;
}

/* ---------------- 卡片通用 ---------------- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.card--hover:hover {
  box-shadow: var(--sh-2);
  border-color: var(--line-strong);
  transform: translateY(-2px);
}

/* ---------------- 今日考试动态 ---------------- */
.pulse-grid { display: grid; gap: var(--sp-3); }
@media (min-width: 900px) { .pulse-grid { grid-template-columns: repeat(3, 1fr); gap: var(--sp-4); } }

.pulse {
  position: relative;
  overflow: hidden;
  padding: var(--sp-4);
}

.pulse::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--tone, var(--st-finished-dot));
}

.pulse--open     { --tone: var(--st-open-dot); }
.pulse--upcoming { --tone: var(--st-upcoming-dot); }
.pulse--waiting  { --tone: var(--st-waiting-dot); }
.pulse--finished { --tone: var(--st-finished-dot); }

.pulse__top {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-2); margin-bottom: 10px;
}

.pulse__name {
  font-size: 15px; font-weight: 700; color: var(--text-1);
  line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

.pulse__meta {
  margin-top: 10px;
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-2);
}

.pulse__meta b { color: var(--tone); font-weight: 700; }

.pulse__arrow { color: var(--text-4); flex: none; }

/* ---------------- 倒计时卡片 ---------------- */
.cd-scroll {
  display: flex;
  gap: var(--sp-3);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 6px;
  margin: 0 calc(var(--page-pad) * -1);
  padding-inline: var(--page-pad);
  scrollbar-width: none;
}
.cd-scroll::-webkit-scrollbar { display: none; }

@media (min-width: 900px) {
  .cd-scroll {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    overflow: visible;
    margin: 0;
    padding-inline: 0;
  }
}

.cd {
  flex: 0 0 78%;
  max-width: 300px;
  scroll-snap-align: start;
  position: relative;
  overflow: hidden;
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
}

@media (min-width: 900px) { .cd { flex: none; max-width: none; } }

.cd--soon { border-color: var(--brand-200); background: var(--grad-brand-soft); }

.cd__top {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--sp-2);
  min-height: 22px;
}

.cd__region {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600; color: var(--text-2);
  background: var(--bg-subtle);
  padding: 3px 8px; border-radius: var(--r-pill);
}

.cd__name {
  margin-top: 10px;
  font-size: 15px; font-weight: 700; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 44px;
}

.cd__count {
  margin-top: var(--sp-4);
  display: flex; align-items: baseline; gap: 5px;
}

.cd__days {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-size: 44px;
  font-weight: 800;
  line-height: .95;
  letter-spacing: -.03em;
  color: var(--brand-600);
}

.cd--finished .cd__days { color: var(--text-3); font-size: 32px; }

.cd__unit { font-size: 14px; font-weight: 600; color: var(--text-2); }

.cd__label { margin-top: 2px; font-size: 12px; color: var(--text-3); }

.cd__bar {
  margin-top: var(--sp-3);
  height: 4px;
  border-radius: var(--r-pill);
  background: var(--bg-subtle);
  overflow: hidden;
}

.cd__bar > i {
  display: block; height: 100%;
  border-radius: var(--r-pill);
  background: var(--grad-brand);
  transition: width .5s var(--ease);
}

.cd__foot {
  margin-top: auto;
  padding-top: var(--sp-3);
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-2);
  font-size: 12px;
  color: var(--text-3);
  border-top: 1px dashed var(--line);
}

.cd__foot b {
  font-family: var(--font-num);
  font-weight: 700;
  color: var(--text-1);
}

/* ---------------- 报名提醒 ---------------- */
.remind {
  position: relative;
  padding: var(--sp-4);
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
}

.remind::before {
  content: "";
  position: absolute; inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: var(--grad-brand-line);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: .32;
  pointer-events: none;
}

.remind + .remind { margin-top: var(--sp-3); }

.remind__top {
  display: flex; align-items: flex-start; gap: var(--sp-3);
}

.remind__bell {
  flex: none;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: var(--st-open-bg);
  color: var(--st-open-fg);
}

.remind__name {
  font-size: 15px; font-weight: 700; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.remind__left {
  margin-top: 6px;
  font-size: 13px; color: var(--text-2);
}
.remind__left b {
  font-family: var(--font-num);
  font-size: 17px; font-weight: 800; color: var(--warn-fg);
}

.remind__range {
  margin-top: var(--sp-3);
  padding: 10px 12px;
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-2);
  background: var(--bg-inset);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-size: 13px;
  color: var(--text-2);
}

.remind__range b {
  font-family: var(--font-num);
  font-weight: 700; color: var(--text-1); letter-spacing: .01em;
}

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}
.btn:active { transform: scale(.97); }

.btn--primary { background: var(--grad-brand); color: #fff; box-shadow: var(--sh-brand); }
.btn--ghost { background: var(--bg-subtle); color: var(--text-2); }
.btn--ghost:hover { background: var(--brand-50); color: var(--brand-600); }
.btn--sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: var(--r-sm); }

/* ---------------- 公告卡片 ---------------- */
.anno-grid { display: grid; gap: var(--sp-3); }
@media (min-width: 900px) { .anno-grid { grid-template-columns: repeat(2, 1fr); gap: var(--sp-4); } }

.anno { padding: var(--sp-4); display: flex; flex-direction: column; gap: 12px; }

.anno__title {
  font-size: 15px; font-weight: 700; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.anno__tags { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.anno__loc {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600; color: var(--text-2);
}

.anno__stats {
  display: flex; align-items: center; gap: var(--sp-4);
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  font-size: 12px;
  color: var(--text-3);
}

.anno__stat { display: flex; flex-direction: column; gap: 2px; }
.anno__stat b {
  font-family: var(--font-num);
  font-size: 14px; font-weight: 700; color: var(--text-1);
}

.anno__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }

.anno__source {
  font-size: 12px; color: var(--text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------------- 地区入口 ---------------- */
.region {
  padding: var(--sp-4);
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
}

.region__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-2);
}

@media (min-width: 600px) { .region__grid { grid-template-columns: repeat(6, 1fr); } }
@media (min-width: 900px) { .region__grid { grid-template-columns: repeat(9, 1fr); } }

.region__item {
  height: 40px;
  display: grid; place-items: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  background: var(--bg-inset);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  transition: all var(--dur) var(--ease);
}

.region__item:hover {
  color: var(--brand-600);
  background: var(--brand-50);
  border-color: var(--brand-200);
}

.region__item.is-hot {
  color: var(--brand-700);
  background: var(--bg-surface);
  border-color: var(--brand-200);
  font-weight: 600;
}

/* ---------------- 免责声明 ---------------- */
.disclaimer {
  margin-top: var(--sp-8);
  padding: var(--sp-4);
  font-size: 12px;
  line-height: 1.75;
  color: var(--text-3);
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

.disclaimer b { color: var(--text-2); font-weight: 600; }

.demo-note {
  margin-top: var(--sp-3);
  padding: 9px 12px;
  font-size: 12px;
  color: var(--up-fg, var(--st-upcoming-fg));
  background: var(--st-upcoming-bg);
  border-radius: var(--r-sm);
}

/* ---------------- 底部导航（移动端） ---------------- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 80;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex;
  background: rgba(255,255,255,.9);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--line);
}

@media (min-width: 900px) { .tabbar { display: none; } }

.tabbar__item {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  font-size: 11px;
  color: var(--text-3);
  transition: color var(--dur) var(--ease);
}

.tabbar__item.is-active { color: var(--brand-600); font-weight: 600; }
.tabbar__item svg { width: 22px; height: 22px; }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + 24px);
  z-index: 200;
  transform: translate(-50%, 12px);
  max-width: min(88vw, 420px);
  padding: 11px 16px;
  font-size: 13px;
  line-height: 1.5;
  color: #fff;
  background: rgba(21,24,33,.92);
  border-radius: var(--r-md);
  box-shadow: var(--sh-3);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s var(--ease), transform .2s var(--ease);
  text-align: center;
}

.toast.is-show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 900px) {
  .toast { bottom: 32px; }
}
