:root {
  --primary: #076242;
  --gold: #ae9d47;
  --lime: #d4e157;
  --green: #2e7d32;
  --bg: #ffffff;
  --surface: #f5f7f6;
  --border: #e0e6e3;
  --text-secondary: #5f6f68;
  --danger: #c62828;
  --rank-row-h: 2.125rem;
  --rank-head-h: 2rem;
  --page-header-h: 3.25rem;
}

.hidden { display: none !important; }

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: #1a1a1a;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 72rem; margin: 0 auto; padding: 0 .875rem; }
header {
  position: sticky; top: 0; z-index: 50;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(8px);
}
.header-inner { height: var(--page-header-h); display: flex; align-items: center; gap: .75rem; }
.header-actions { display: flex; gap: .5rem; margin-left: auto; align-items: center; }
.logo { width: 2.25rem; height: 2.25rem; border-radius: .5rem; object-fit: cover; }
.title { font-size: 1rem; font-weight: 700; color: var(--primary); margin: 0; }
.subtitle { font-size: .6875rem; color: var(--text-secondary); margin: 0; }
.nav-link {
  margin-left: auto;
  padding: .5rem 1rem;
  border-radius: .5rem;
  border: 1px solid var(--border);
  font-size: .875rem;
}

main { padding: .875rem 0 1rem; display: grid; gap: 1rem; }

/* 公示页：左榜右栏，一屏内展示 */
.page-split {
  display: grid;
  gap: .875rem;
  align-items: stretch;
}
.sidebar-column {
  display: grid;
  gap: .625rem;
  align-content: start;
  min-width: 0;
}
@media (min-width: 1024px) {
  .page-split {
    grid-template-columns: minmax(0, 1fr) 19rem;
    gap: 1rem;
    min-height: calc(100vh - var(--page-header-h) - 2.5rem);
  }
  .rankings-column {
    display: flex;
    flex-direction: column;
    gap: .625rem;
    min-height: 0;
    max-height: calc(100vh - var(--page-header-h) - 2rem);
  }
  .sidebar-column {
    position: sticky;
    top: calc(var(--page-header-h) + .5rem);
    max-height: calc(100vh - var(--page-header-h) - 1rem);
    overflow-y: auto;
  }
}
@media (max-width: 1023px) {
  .page-split { grid-template-columns: 1fr; }
  .rankings-column { order: 1; }
  .sidebar-column { order: 2; }
}
.rankings-column { display: grid; gap: .875rem; min-width: 0; }
.rank-panel { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.rank-panel-team {
  flex: 0 0 auto;
  max-height: min(38vh, calc(var(--rank-row-h) * 8 + var(--rank-head-h) + 3rem));
}
.rank-panel-student { flex: 1 1 auto; min-height: 0; }
.rank-panel-team .table-scroll,
.rank-panel-student .table-scroll,
.rank-panel .table-scroll {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
  min-height: 0;
}
.rank-panel-team .table-scroll {
  max-height: calc(var(--rank-row-h) * 8 + var(--rank-head-h));
}
.rank-panel-student .table-scroll {
  max-height: none;
}
@media (min-width: 1024px) {
  .rank-panel-student .table-scroll {
    max-height: calc(100vh - var(--page-header-h) - 14rem);
  }
}
.sidebar-block { margin: 0; }
.sidebar-column .hero { padding: .875rem 1rem; }
.sidebar-column .hero h2 { font-size: 1.0625rem !important; }
.sidebar-column .stats { grid-template-columns: repeat(3, 1fr); gap: .375rem; }
.sidebar-column .stat { padding: .375rem .5rem; }
.sidebar-column .stat-label { font-size: .625rem; }
.sidebar-column .stat-value { font-size: .875rem; margin-top: .125rem; }
.sidebar-column .checkin-tip { padding: .625rem .75rem; }
.sidebar-column .checkin-tip-title { font-size: .8125rem; }
.sidebar-column .checkin-tip-text { font-size: .75rem; }
.sidebar-column .notice { padding: .75rem; }
.sidebar-column .notice-list { font-size: .75rem; margin-top: .35rem; }
.sidebar-column .query-card .query-form { padding: .75rem; }
.sidebar-column .meta-block { padding: .625rem .75rem; }
.meta-block {
  border: 1px solid var(--border);
  border-radius: .75rem;
  padding: .875rem 1rem;
  background: var(--surface);
  display: grid;
  gap: .5rem;
}
.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  font-size: .8125rem;
}
.meta-row strong { color: var(--primary); font-size: .875rem; }
.card-head-gold { background: rgba(174,157,71,.12); }
.card-head.compact { padding: .5rem .75rem; }
.card-head-meta { margin-left: auto; font-size: .6875rem; flex-shrink: 0; white-space: nowrap; }
.card-head-split { flex-direction: column; align-items: stretch; gap: .375rem; }
.card-head-row { display: flex; align-items: center; gap: .375rem; flex-wrap: wrap; width: 100%; }
.card-head-row .tabs { flex: 0 1 auto; }
.week-tabs { margin-left: auto; }
.week-tabs .tab { padding: .25rem .625rem; font-size: .75rem; }
.admin-grid {
  display: grid;
  gap: 1rem;
  padding: .875rem 0 1.25rem;
  grid-template-columns: 1fr;
}
@media (min-width: 960px) {
  .admin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-block-wide { grid-column: 1 / -1; }
}

/* 管理后台：左侧目录 + 右侧内容 */
body[data-page="admin"] main { padding: 0; }
.admin-shell {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--page-header-h));
}
@media (min-width: 768px) {
  .admin-shell {
    flex-direction: row;
    align-items: stretch;
  }
}
.admin-sidebar {
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: .5rem .75rem;
}
@media (min-width: 768px) {
  .admin-sidebar {
    width: 11.5rem;
    border-bottom: none;
    border-right: 1px solid var(--border);
    padding: .875rem 0;
    position: sticky;
    top: var(--page-header-h);
    align-self: flex-start;
    max-height: calc(100vh - var(--page-header-h));
    overflow-y: auto;
  }
}
.admin-nav {
  display: flex;
  gap: .375rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: .125rem;
}
@media (min-width: 768px) {
  .admin-nav {
    flex-direction: column;
    overflow-x: visible;
    padding: 0 .625rem;
    gap: .25rem;
  }
}
.admin-nav-item {
  flex-shrink: 0;
  display: block;
  width: 100%;
  text-align: left;
  padding: .5rem .75rem;
  border: none;
  border-radius: .5rem;
  background: transparent;
  color: var(--text-secondary);
  font-size: .8125rem;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.admin-nav-item:hover {
  background: rgba(7, 98, 66, .08);
  color: var(--primary);
}
.admin-nav-item.is-active {
  background: rgba(7, 98, 66, .12);
  color: var(--primary);
  font-weight: 600;
}
.admin-main {
  flex: 1 1 auto;
  min-width: 0;
  padding: .875rem;
}
@media (min-width: 768px) {
  .admin-main {
    padding: 1rem 1.25rem 1.25rem;
    max-height: calc(100vh - var(--page-header-h));
    overflow-y: auto;
  }
}
.admin-panel {
  display: none;
}
.admin-panel.is-active {
  display: block;
}
.admin-page-title {
  margin: 0 0 .375rem;
  color: var(--primary);
  font-size: 1.0625rem;
  font-weight: 700;
}
.admin-settings-stack {
  display: grid;
  gap: .875rem;
  max-width: 40rem;
}
.admin-block-fill {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.admin-block-fill .admin-student-table,
.admin-block-fill .admin-class-table,
.admin-block-fill .admin-backup-table,
.admin-block-fill .admin-log-table {
  flex: 1 1 auto;
  min-height: 12rem;
  max-height: calc(100vh - var(--page-header-h) - 11rem);
  overflow: auto;
}
.admin-block { padding: .875rem 1rem; }
.admin-block-wide { grid-column: 1 / -1; }
.admin-block-title { margin: 0 0 .5rem; color: var(--primary); font-size: .9375rem; }
.admin-block-desc { margin: 0 0 .625rem; font-size: .8125rem; }
.admin-field-label { font-size: .8125rem; display: block; margin-bottom: .25rem; }
.admin-inline { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.admin-actions { margin-top: .75rem; display: flex; gap: .5rem; flex-wrap: wrap; }
.admin-btn-danger { color: var(--danger); border-color: rgba(198,40,40,.35); }
.admin-sync-log { margin-top: .75rem; white-space: pre-wrap; font-size: .75rem; max-height: 8rem; overflow: auto; }
.admin-hint { font-size: .8125rem; }
.admin-textarea { width: 100%; max-width: none; margin-top: .25rem; font-family: inherit; line-height: 1.45; }
.admin-log-table { max-height: 14rem; overflow: auto; margin-top: .25rem; }
#project-start-at { max-width: 16rem; }
.input-full { max-width: none; flex: 1; min-width: 0; }
.btn-block { width: 100%; margin-top: .25rem; }
.page-footer {
  border-top: 1px solid var(--border);
  padding: .5rem 0 .75rem;
}
.page-footer p { text-align: center; margin: 0; font-size: .75rem; }

/* 登录页 */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: var(--surface);
}
.auth-card { padding: 2rem; width: 100%; max-width: 24rem; }
.auth-form { display: grid; gap: 1rem; }
.auth-label { font-size: .875rem; display: block; margin-bottom: .25rem; }
.auth-input { width: 100%; max-width: none; margin-top: 0; }
.auth-error { color: var(--danger); font-size: .875rem; margin: 0; min-height: 1.25rem; }
.auth-footer { margin: 1rem 0 0; font-size: .8125rem; text-align: center; }

/* 下载页 */
.download-main { max-width: min(72rem, calc(100vw - 1.5rem)); margin: 1.25rem auto; }
.download-panel { padding: 1.5rem; }
.download-title { margin: 0 0 .25rem; font-size: 1.125rem; color: var(--primary); }
.download-controls { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.download-controls .input { flex: 1 1 10rem; min-width: 8rem; max-width: 22rem; padding: .45rem .65rem; }
#finance-export-period { flex: 0 0 auto; max-width: 9rem; }
#finance-search-q { flex: 1 1 12rem; max-width: 16rem; }
.download-hint { margin: .75rem 0 0; font-size: .8125rem; }
.download-preview-meta { margin: .75rem 0 .5rem; font-size: .8125rem; min-height: 1.25rem; }
.download-preview-wrap { margin-top: .25rem; border: 1px solid var(--border); border-radius: .5rem; overflow: hidden; }
.download-preview-wrap .table-scroll { max-height: min(28rem, 60vh); overflow: auto; }
.download-preview-wrap.hidden { display: none; }
.download-preview-empty { text-align: center; color: var(--text-secondary); padding: 1.5rem .75rem; }
.download-preview-wrap td.num { text-align: right; font-variant-numeric: tabular-nums; }
.download-preview-wrap .badge-cell { white-space: nowrap; }
.hero {
  border-radius: 1rem;
  padding: 1.5rem;
  color: #fff;
  background: var(--primary);
  position: relative;
  overflow: hidden;
}
.hero-badge {
  display: inline-block;
  padding: .125rem .5rem;
  border-radius: .25rem;
  background: var(--lime);
  color: var(--primary);
  font-size: .75rem;
  font-weight: 600;
}
.card {
  border: 1px solid var(--border);
  border-radius: .75rem;
  background: #fff;
  overflow: hidden;
}
.card-head {
  padding: .5rem .75rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: .375rem;
  flex-wrap: wrap;
}
.card-head h3 { margin: 0; color: var(--primary); font-size: .9375rem; flex-shrink: 0; }
.card-head .tabs { flex: 1 1 auto; min-width: 0; }
.rank-meta-toggle {
  display: none;
  flex-shrink: 0;
  margin-left: auto;
  padding: .25rem .55rem;
  border: 1px solid rgba(7, 98, 66, .28);
  border-radius: 999px;
  background: rgba(7, 98, 66, .06);
  color: var(--primary);
  font-size: .6875rem;
  font-weight: 600;
  font-family: inherit;
  line-height: 1.3;
  cursor: pointer;
  white-space: nowrap;
}
.rank-meta-toggle:hover { background: rgba(7, 98, 66, .12); }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; }
@media (min-width: 768px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat {
  border: 1px solid var(--border);
  border-radius: .75rem;
  padding: 1rem;
}
.stat-label { font-size: .75rem; color: var(--text-secondary); }
.stat-value { font-size: 1.25rem; font-weight: 700; color: var(--primary); margin-top: .25rem; }

.tabs { display: flex; gap: .5rem; flex-wrap: wrap; }
.tab {
  padding: .35rem .75rem;
  border-radius: .5rem;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: .8125rem;
}
.tab.active { background: var(--primary); color: #fff; }

table { width: 100%; border-collapse: collapse; font-size: .8125rem; }
th, td { padding: .4rem .5rem; text-align: left; white-space: nowrap; }
thead tr { border-bottom: 1px solid var(--border); background: rgba(7,98,66,.04); }
th { color: var(--primary); font-weight: 600; font-size: .75rem; position: sticky; top: 0; z-index: 1; background: rgba(7,98,66,.04); }
tbody tr { border-bottom: 1px solid var(--border); }
tbody tr:hover { background: rgba(245,247,246,.8); }
.rank { font-weight: 700; color: var(--gold); display: flex; align-items: center; gap: .35rem; }
.rank .medal { font-size: 1rem; line-height: 1; }
.rank-1 { color: #c9a227; }
.rank-2 { color: #8a9199; }
.rank-3 { color: #b87333; }
tbody tr.rank-row-1 { background: linear-gradient(90deg, rgba(201,162,39,.14), transparent); }
tbody tr.rank-row-2 { background: linear-gradient(90deg, rgba(138,145,153,.12), transparent); }
tbody tr.rank-row-3 { background: linear-gradient(90deg, rgba(184,115,51,.12), transparent); }
tbody tr.rank-row-1 td:first-child,
tbody tr.rank-row-2 td:first-child,
tbody tr.rank-row-3 td:first-child { font-weight: 700; }

tbody tr.rank-row-qualified-glow {
  position: relative;
  background: linear-gradient(
    90deg,
    rgba(174, 157, 71, .07) 0%,
    rgba(255, 215, 0, .12) 45%,
    rgba(7, 98, 66, .06) 100%
  );
  box-shadow: inset 0 0 0 1px rgba(174, 157, 71, .22);
}
tbody tr.rank-row-qualified-glow::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    105deg,
    transparent 0%,
    rgba(255, 255, 255, 0) 38%,
    rgba(255, 215, 0, .42) 50%,
    rgba(174, 157, 71, .28) 56%,
    rgba(255, 255, 255, 0) 68%,
    transparent 100%
  );
  background-size: 240% 100%;
  animation: rank-qualified-stream 2.6s linear infinite;
}
tbody tr.rank-row-qualified-glow td {
  position: relative;
  z-index: 1;
}
@keyframes rank-qualified-stream {
  0% { background-position: 120% 0; }
  100% { background-position: -120% 0; }
}

.page-celebration {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
  overflow: hidden;
}
.page-celebration.hidden { display: none; }

.notice-list { margin: .5rem 0 0; padding-left: 1.25rem; font-size: .8125rem; }
.query-card .query-form { padding: 1rem; }
.query-form-row {
  display: flex;
  align-items: stretch;
  gap: .5rem;
}
.query-form-row .input {
  flex: 1;
  min-width: 0;
}
.query-form-row .btn {
  flex-shrink: 0;
  white-space: nowrap;
  padding-inline: 1rem;
}
.query-inline-error { min-height: 1.25rem; margin: .5rem 0 0; font-size: .8125rem; color: var(--danger); }
.query-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  flex-wrap: wrap; margin-bottom: .75rem; padding-bottom: .75rem; border-bottom: 1px solid var(--border);
}
.query-source { font-size: .75rem; font-weight: 500; max-width: 100%; white-space: normal; line-height: 1.35; }
.query-refresh-error { margin: 0 0 .75rem; font-size: .8125rem; color: var(--danger); }
.query-cheer {
  margin-bottom: 1rem; padding: .875rem 1rem; border-radius: .5rem;
  font-size: .875rem; line-height: 1.65; border: 1px solid transparent;
}
.query-cheer--ok { background: rgba(46, 125, 50, .08); border-color: rgba(46, 125, 50, .2); color: #1b5e20; }
.query-cheer--gold { background: rgba(174, 157, 71, .12); border-color: rgba(174, 157, 71, .35); color: #6d5a12; }
.query-cheer--warn { background: rgba(198, 40, 40, .06); border-color: rgba(198, 40, 40, .15); color: #8b1a1a; }
.query-cheer--info { background: rgba(7, 98, 66, .06); border-color: rgba(7, 98, 66, .15); color: var(--primary); }
.btn-sm { padding: .35rem .75rem; font-size: .8125rem; }

/* 弹窗 */
.modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.45); backdrop-filter: blur(2px); }
.modal-panel {
  position: relative;
  width: min(36rem, 100%);
  max-height: min(90vh, 44rem);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 1rem;
  box-shadow: 0 1.5rem 3rem rgba(0,0,0,.18);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: rgba(7,98,66,.04);
}
.modal-header h3 { margin: 0; color: var(--primary); font-size: 1.0625rem; }
.modal-close {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0 .25rem;
}
.modal-close:hover { color: var(--primary); }
.modal-body { padding: 1.25rem; overflow-y: auto; }

.query-profile { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.query-profile-main h4 { margin: 0 0 .35rem; font-size: 1.25rem; color: var(--primary); }
.query-name-wrap {
  position: relative;
  display: inline-block;
  padding: .15rem .35rem;
}
.query-name-wrap .query-student-name { margin: 0; }
.query-name-crown {
  display: none;
  pointer-events: none;
}
.query-name-wrap--crowned {
  padding: .5rem 1.1rem .45rem;
  border: 2px solid transparent;
  border-radius: .625rem;
  background:
    linear-gradient(#fffef8, #fffef8) padding-box,
    linear-gradient(135deg, #ffd700, #c9a227, #ffe566, #ae9d47) border-box;
  box-shadow: 0 2px 10px rgba(201, 162, 39, .16);
  opacity: 0;
  transform: scale(0.9);
  transition: opacity .45s ease, transform .45s cubic-bezier(.2, .85, .25, 1), box-shadow .45s ease;
}
.query-name-wrap--crowned .query-name-crown {
  display: block;
  position: absolute;
  top: -.78rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.1rem;
  line-height: 1;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .18));
}
.query-name-wrap--crowned.is-crowned {
  opacity: 1;
  transform: scale(1);
  box-shadow:
    0 0 0 1px rgba(201, 162, 39, .2),
    0 0 16px rgba(255, 215, 0, .22),
    0 4px 14px rgba(201, 162, 39, .2);
}
.query-profile-meta { font-size: .8125rem; color: var(--text-secondary); display: grid; gap: .2rem; }
.query-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin-bottom: 1rem; }
.query-stat {
  border: 1px solid var(--border);
  border-radius: .75rem;
  padding: .625rem .5rem;
  background: var(--surface);
  min-width: 0;
}
.query-stat-label { font-size: .6875rem; color: var(--text-secondary); line-height: 1.3; }
.query-stat-value { font-size: 1rem; font-weight: 700; color: var(--primary); margin-top: .25rem; line-height: 1.25; }
.query-celebration-pending .query-stat-value--seq,
.query-celebration-pending [data-seq-stat] {
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .35s ease, transform .35s ease;
}
.query-stat-value--seq.is-revealed,
[data-seq-stat].is-revealed {
  opacity: 1;
  transform: translateY(0);
}
.query-section { margin-bottom: 1.25rem; }
.query-section-title { font-size: .875rem; font-weight: 600; color: var(--primary); margin: 0 0 .75rem; }
.query-progress-item { margin-bottom: .75rem; }
.query-progress-head { display: flex; justify-content: space-between; font-size: .8125rem; margin-bottom: .35rem; }
.query-progress-head strong { color: var(--primary); }
.query-course-list { display: grid; gap: .5rem; }
.query-course-item {
  border: 1px solid var(--border);
  border-radius: .625rem;
  padding: .75rem;
  font-size: .8125rem;
}
.query-course-item strong { color: var(--primary); }
.query-footnote { font-size: .75rem; color: var(--text-secondary); margin: 0; }
.query-meta { font-size: .75rem; color: var(--text-secondary); margin-top: 1rem; padding-top: .75rem; border-top: 1px solid var(--border); }
.query-bonus-wrap { overflow-x: auto; max-height: 14rem; overflow-y: auto; border: 1px solid var(--border); border-radius: .5rem; }
.query-bonus-table { width: 100%; border-collapse: collapse; font-size: .8125rem; }
.query-bonus-table th, .query-bonus-table td { padding: .45rem .6rem; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.query-bonus-table th { background: var(--surface); color: var(--text-secondary); font-weight: 600; position: sticky; top: 0; }
.query-bonus-table tr:last-child td { border-bottom: none; }
.query-bonus-current { background: rgba(7, 98, 66, .04); }
#query-modal .modal-panel { width: min(42rem, 100%); overflow: hidden; }
#query-modal .modal-body {
  position: relative;
}
#query-modal .modal-body.query-modal-body--celebrate {
  box-shadow: inset 0 0 0 1px rgba(174, 157, 71, .28);
}
#query-modal .query-fireworks--inline {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  border-radius: 0 0 1rem 1rem;
}
#query-modal .modal-body > :not(.query-fireworks) {
  position: relative;
  z-index: 1;
}
#query-modal .modal-panel.query-modal-panel--celebrate {
  box-shadow: 0 1.5rem 3rem rgba(0,0,0,.18), 0 0 0 2px rgba(174, 157, 71, .35);
}

.query-fireworks,
.page-celebration {
  pointer-events: none;
}
.query-fireworks:not(.query-fireworks--inline) {
  position: absolute;
  inset: 0;
  z-index: 6;
  overflow: hidden;
}
.page-celebration .query-firework-burst,
.query-fireworks .query-firework-burst,
.query-cheer-fireworks .query-firework-burst {
  position: absolute;
  width: 8px;
  height: 8px;
  transform: translate(-50%, -50%);
}
.page-celebration .query-firework-particle,
.query-fireworks .query-firework-particle,
.query-cheer-fireworks .query-firework-particle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(12px * var(--fw-scale, 1));
  height: calc(12px * var(--fw-scale, 1));
  margin: calc(-6px * var(--fw-scale, 1)) 0 0 calc(-6px * var(--fw-scale, 1));
  border-radius: 50%;
  background: var(--c);
  box-shadow:
    0 0 calc(12px * var(--fw-scale, 1)) var(--c),
    0 0 calc(22px * var(--fw-scale, 1)) color-mix(in srgb, var(--c) 55%, transparent);
  opacity: 0;
  animation: query-firework-pop 1.65s cubic-bezier(.2, .65, .25, 1) forwards;
  transform: rotate(var(--a)) translateY(0) scale(1);
}
.page-celebration .query-firework-flash,
.query-fireworks .query-firework-flash,
.query-cheer-fireworks .query-firework-flash {
  position: absolute;
  width: calc(24px * var(--fw-scale, 1));
  height: calc(24px * var(--fw-scale, 1));
  margin: calc(-12px * var(--fw-scale, 1)) 0 0 calc(-12px * var(--fw-scale, 1));
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 215, 0, .98) 0%, rgba(255, 180, 0, .45) 35%, rgba(255, 215, 0, 0) 72%);
  opacity: 0;
  animation: query-firework-flash 0.75s ease-out forwards;
  transform: translate(-50%, -50%);
}
.page-celebration .query-confetti,
.query-fireworks .query-confetti {
  position: absolute;
  top: -8%;
  width: 11px;
  height: 18px;
  background: var(--c);
  opacity: 0;
  border-radius: 2px;
  animation: query-confetti-fall 2.2s ease-in forwards;
}
.query-cheer--celebrate {
  animation: query-cheer-glow 1.2s ease;
}

.query-celebration-pending .query-cheer-typewriter-host {
  border-color: rgba(46, 125, 50, .18);
  background: rgba(46, 125, 50, .05);
  min-height: 3.25rem;
}
.query-cheer-block {
  position: relative;
  margin-bottom: 1rem;
}
.query-cheer-fireworks {
  position: absolute;
  inset: -.45rem -.3rem;
  z-index: 0;
  overflow: visible;
  pointer-events: none;
}
.query-cheer-with-badge {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  gap: .625rem;
}
.query-cheer-with-badge .query-cheer-typewriter,
.query-cheer-with-badge .query-cheer-body {
  flex: 1;
  min-width: 0;
  margin: 0;
}
.query-status-badge {
  flex-shrink: 0;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .35rem .55rem;
  border-radius: .45rem;
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .06em;
  white-space: nowrap;
  line-height: 1.2;
  opacity: 0;
  transform: scale(0.88);
  transition: opacity .4s ease, transform .4s cubic-bezier(.2, .85, .25, 1);
}
.query-status-badge.is-visible {
  opacity: 1;
  transform: scale(1);
}
.query-status-badge--gold {
  color: #6d4f0a;
  background: linear-gradient(160deg, #fff8dc 0%, #ffd700 42%, #e8b923 100%);
  border: 1px solid rgba(201, 162, 39, .65);
  box-shadow: 0 2px 10px rgba(201, 162, 39, .28);
}
.query-status-badge--silver {
  color: #4a4a4a;
  background: linear-gradient(160deg, #f8f8f8 0%, #d8d8d8 45%, #c0c0c0 100%);
  border: 1px solid rgba(140, 140, 140, .45);
  box-shadow: 0 2px 8px rgba(120, 120, 120, .18);
}
.query-status-badge-bloom {
  position: absolute;
  inset: -6px;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle, rgba(255, 215, 0, .55) 0%, rgba(255, 215, 0, .12) 45%, transparent 72%);
}
.query-status-badge--gold.is-blooming .query-status-badge-bloom {
  animation: query-badge-bloom 2.8s ease-in-out infinite;
}
@keyframes query-badge-bloom {
  0%, 100% { opacity: 0.25; transform: scale(0.92); }
  50% { opacity: 0.95; transform: scale(1.22); }
}
.query-cheer-typewriter {
  margin: 0;
  line-height: 1.65;
  color: #1b5e20;
}
.query-typewriter-cursor {
  display: inline-block;
  margin-left: 1px;
  color: var(--primary);
  font-weight: 400;
  animation: query-typewriter-blink .85s step-end infinite;
}
.query-typewriter-cursor.is-done {
  opacity: 0;
  animation: none;
}
@keyframes query-typewriter-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.query-celebration-pending .query-student-name--seq {
  opacity: 1;
  transform: none;
}

@keyframes query-cheer-glow {
  0%, 100% { box-shadow: none; }
  40% { box-shadow: 0 0 0 3px rgba(174, 157, 71, .25), 0 0 18px rgba(255, 215, 0, .35); }
}
@keyframes query-firework-pop {
  0% { opacity: 1; transform: rotate(var(--a)) translateY(0) scale(1.2); }
  65% { opacity: 1; }
  100% { opacity: 0; transform: rotate(var(--a)) translateY(calc(var(--d) * -1)) scale(0.15); }
}
@keyframes query-firework-flash {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.15); }
  25% { opacity: 1; transform: translate(-50%, -50%) scale(calc(4.5 * var(--fw-scale, 1))); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(calc(6.5 * var(--fw-scale, 1))); }
}
@keyframes query-confetti-fall {
  0% { opacity: 0; transform: translateY(0) rotate(0deg); }
  12% { opacity: 1; }
  100% { opacity: 0; transform: translateY(110vh) rotate(720deg); }
}

@media (prefers-reduced-motion: reduce) {
  .query-fireworks, .query-cheer--celebrate, .page-celebration { animation: none !important; }
  .query-firework-particle, .query-firework-flash, .query-confetti { animation: none !important; }
  .query-typewriter-cursor { opacity: 0 !important; animation: none !important; }
  .query-stat-value--seq, [data-seq-stat] { opacity: 1 !important; transform: none !important; }
  .query-name-wrap--crowned { opacity: 1 !important; transform: none !important; }
  .query-status-badge { opacity: 1 !important; transform: none !important; }
  .query-status-badge-bloom { animation: none !important; opacity: 0 !important; }
  tbody tr.rank-row-qualified-glow::after { animation: none !important; }
}

.sync-banner {
  background: rgba(174,157,71,.15);
  border-bottom: 1px solid rgba(174,157,71,.35);
  color: #7a6a1a;
  text-align: center;
  padding: .625rem 1rem;
  font-size: .875rem;
}
.sync-banner.hidden { display: none; }

.sync-progress-wrap { margin-top: .75rem; }
.sync-progress-wrap.hidden { display: none; }
.sync-progress-track {
  height: .5rem;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}
.sync-progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--gold));
  transition: width .4s ease;
}
.sync-progress-text { margin: .5rem 0 0; font-size: .8125rem; }

.btn {
  padding: .5rem 1.25rem;
  border-radius: .5rem;
  border: none;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.btn.secondary { background: #fff; color: var(--primary); border: 1px solid var(--border); }
.btn-sm {
  padding: .35rem .75rem;
  font-size: .75rem;
}
.btn:disabled { opacity: .6; cursor: not-allowed; }
.input {
  padding: .5rem 1rem;
  border-radius: .5rem;
  border: 1px solid var(--border);
  max-width: 16rem;
}
.muted { color: var(--text-secondary); font-size: .875rem; }
.badge {
  display: inline-block;
  padding: .125rem .5rem;
  border-radius: 999px;
  font-size: .75rem;
}
.badge.ok { background: rgba(46,125,50,.15); color: var(--green); }
.badge.warn { background: rgba(174,157,71,.25); color: var(--gold); }
.badge.err { background: rgba(198,40,40,.12); color: var(--danger); }
.notice {
  border-left: 4px solid var(--gold);
  background: var(--surface);
  border-radius: .75rem;
  padding: 1rem;
}
.checkin-tip {
  border-left: 4px solid var(--lime);
  background: rgba(212, 225, 87, .12);
  border-radius: .75rem;
  padding: .75rem .875rem;
}
.checkin-tip-title {
  display: block;
  color: var(--primary);
  font-size: .8125rem;
  margin-bottom: .25rem;
}
.checkin-tip-text {
  margin: 0;
  font-size: .8125rem;
  line-height: 1.45;
  color: var(--text-secondary);
  white-space: pre-line;
}
.notice-list li { white-space: pre-line; }
#guide-checkin-daily { white-space: pre-line; }
.progress { height: .625rem; border-radius: 999px; background: var(--border); overflow: hidden; }
.progress > div { height: 100%; border-radius: 999px; background: var(--primary); }
.error-box {
  padding: .75rem 1rem;
  border-radius: .5rem;
  background: rgba(198,40,40,.08);
  color: var(--danger);
  font-size: .875rem;
}
.loading { text-align: center; padding: 2rem; color: var(--text-secondary); }
.table-wrap { overflow-x: auto; }

/* 学员手册弹窗 */
body.guide-blocking { overflow: hidden; }
.guide-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, .48);
  backdrop-filter: blur(3px);
}
.guide-backdrop.hidden { display: none; }
.guide-widget { position: relative; z-index: 210; }
.guide-panel {
  position: fixed;
  z-index: 220;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(56rem, calc(100vw - 1.5rem));
  max-height: min(90vh, 54rem);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 1rem;
  box-shadow: 0 1.5rem 3rem rgba(0, 0, 0, .22);
  border: 1px solid var(--border);
  overflow: hidden;
}
.guide-widget--minimized .guide-panel {
  display: none;
}
.guide-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  padding: 1rem 1.125rem .75rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(7, 98, 66, .08), transparent);
}
.guide-title {
  margin: 0;
  font-size: 1.125rem;
  color: var(--primary);
}
.guide-subtitle {
  margin: .25rem 0 0;
  font-size: .8125rem;
}
.guide-close-btn {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: .5rem;
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}
.guide-close-btn:hover { background: var(--border); color: var(--primary); }
.guide-split {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  overflow: hidden;
}
.guide-nav {
  flex: 0 0 10.75rem;
  overflow-y: auto;
  padding: .625rem .5rem;
  border-right: 1px solid var(--border);
  background: var(--surface);
  -webkit-overflow-scrolling: touch;
}
.guide-nav-group {
  margin: .625rem .375rem .25rem;
  font-size: .6875rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: .04em;
}
.guide-nav-group:first-child { margin-top: .25rem; }
.guide-nav-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: .45rem .625rem;
  margin-bottom: .125rem;
  border: none;
  border-radius: .45rem;
  background: transparent;
  color: var(--text-secondary);
  font-size: .8125rem;
  font-family: inherit;
  line-height: 1.35;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.guide-nav-item:hover {
  background: rgba(7, 98, 66, .08);
  color: var(--primary);
}
.guide-nav-item.is-active {
  background: rgba(7, 98, 66, .14);
  color: var(--primary);
  font-weight: 600;
}
.guide-content {
  flex: 1 1 auto;
  min-width: 0;
  overflow-y: auto;
  padding: .875rem 1rem 1rem;
  -webkit-overflow-scrolling: touch;
}
.guide-pane { display: none; }
.guide-pane.is-active { display: block; }
.guide-pane-title {
  margin: 0 0 .625rem;
  font-size: 1rem;
  color: var(--primary);
}
.guide-pane-body {
  font-size: .8125rem;
  line-height: 1.55;
  color: #333;
}
.guide-pane-body p { margin: 0 0 .5rem; }
.guide-flow-steps {
  margin: 0 0 .75rem;
  padding: 0;
  list-style: none;
}
.guide-flow-steps > li {
  margin-bottom: .75rem;
  padding: .625rem .75rem;
  border-left: 3px solid var(--primary);
  background: rgba(7, 98, 66, .04);
  border-radius: 0 .5rem .5rem 0;
}
.guide-flow-steps > li:last-child { margin-bottom: 0; }
.guide-flow-steps > li > strong {
  display: block;
  margin-bottom: .25rem;
  color: var(--primary);
  font-size: .8125rem;
}
.guide-flow-steps > li > p {
  margin: 0;
  font-size: .75rem;
  line-height: 1.55;
}
.guide-inline-link {
  display: inline;
  padding: 0;
  border: none;
  background: none;
  color: var(--primary);
  font-size: inherit;
  font-family: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}
.guide-inline-link:hover { color: var(--gold); }
.guide-list {
  margin: .375rem 0 0;
  padding-left: 1.125rem;
}
.guide-list li { margin-bottom: .35rem; }
.guide-list li:last-child { margin-bottom: 0; }
.guide-tech li { margin-bottom: .5rem; }
.guide-note, .guide-table-label {
  margin: .5rem 0 .35rem;
  font-size: .75rem;
  color: var(--text-secondary);
}
.guide-table-label { font-weight: 600; color: var(--primary); margin-top: .75rem; }
.guide-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .75rem;
  margin-bottom: .25rem;
}
.guide-table th,
.guide-table td {
  padding: .35rem .5rem;
  border: 1px solid var(--border);
  text-align: left;
  white-space: normal;
}
.guide-table th { background: rgba(7, 98, 66, .06); color: var(--primary); }
.guide-highlight {
  padding: .5rem .625rem;
  border-radius: .5rem;
  background: rgba(212, 225, 87, .18);
  border-left: 3px solid var(--lime);
}
.guide-footnote {
  margin: .75rem 0 0;
  font-size: .6875rem;
  line-height: 1.45;
}
.guide-links {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: .75rem;
}
.guide-link-btn {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .45rem .75rem;
  border-radius: .5rem;
  background: var(--primary);
  color: #fff !important;
  font-size: .8125rem;
  font-weight: 600;
  text-decoration: none !important;
}
.guide-link-btn:hover { opacity: .92; }
.guide-link-btn--secondary {
  background: #fff;
  color: var(--primary) !important;
  border: 1px solid var(--primary);
}
button.guide-link-btn {
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.guide-download-panel {
  margin-bottom: .875rem;
  padding: .875rem;
  border: 1px solid rgba(7, 98, 66, .25);
  border-radius: .625rem;
  background: rgba(7, 98, 66, .04);
}
.guide-download-panel.hidden { display: none; }
.guide-download-lead {
  margin: 0 0 .75rem;
  font-size: .8125rem;
  line-height: 1.5;
}
.guide-download-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}
.guide-download-card {
  padding: .75rem;
  border: 1px solid var(--border);
  border-radius: .5rem;
  background: #fff;
}
.guide-download-card-title {
  margin: 0 0 .5rem;
  font-size: .8125rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: .375rem;
  flex-wrap: wrap;
}
.guide-download-steps {
  margin: 0 0 .625rem;
  padding-left: 1.125rem;
  font-size: .75rem;
  line-height: 1.55;
  color: #444;
}
.guide-download-steps li { margin-bottom: .35rem; }
.guide-download-steps li:last-child { margin-bottom: 0; }
.guide-download-qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .375rem;
}
.guide-download-qr {
  width: 10rem;
  height: 10rem;
  border: 1px solid var(--border);
  border-radius: .375rem;
  background: #fff;
}
.guide-download-qr-hint {
  margin: 0;
  font-size: .6875rem;
  text-align: center;
}
.guide-download-card p {
  margin: 0 0 .5rem;
  font-size: .75rem;
  line-height: 1.5;
}
.guide-download-direct { margin-top: .25rem; }
.guide-download-note {
  margin: .5rem 0 0 !important;
  font-size: .6875rem !important;
  line-height: 1.45 !important;
}
@media (max-width: 640px) {
  .guide-download-grid { grid-template-columns: 1fr; }
}
.guide-video-list {
  display: grid;
  gap: .875rem;
  margin-top: .5rem;
}
.guide-video-item {
  border: 1px solid var(--border);
  border-radius: .625rem;
  padding: .625rem .75rem;
  background: #fff;
}
.guide-video-item--highlight {
  border-color: rgba(7, 98, 66, .35);
  background: rgba(7, 98, 66, .04);
}
.guide-video-label {
  margin: 0 0 .375rem;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: .375rem;
  flex-wrap: wrap;
}
.guide-video-speed {
  display: inline-flex;
  gap: .25rem;
  margin-bottom: .375rem;
  padding: .125rem;
  border-radius: .375rem;
  background: rgba(7, 98, 66, .06);
  border: 1px solid rgba(7, 98, 66, .12);
}
.guide-video-speed-btn {
  border: none;
  background: transparent;
  color: var(--primary);
  font-size: .6875rem;
  font-weight: 600;
  padding: .2rem .5rem;
  border-radius: .25rem;
  cursor: pointer;
  line-height: 1.3;
}
.guide-video-speed-btn:hover {
  background: rgba(7, 98, 66, .1);
}
.guide-video-speed-btn.is-active {
  background: var(--primary);
  color: #fff;
}
.guide-video {
  width: 100%;
  max-height: 12rem;
  border-radius: .5rem;
  background: #000;
  object-fit: contain;
}
.guide-video-desc {
  margin: .375rem 0 0;
  font-size: .75rem;
}
.guide-footer {
  padding: .75rem 1rem 1rem;
  border-top: 1px solid var(--border);
  background: #fff;
}
.guide-enter-btn { width: 100%; }
.page-float-controls {
  position: fixed;
  z-index: 220;
  top: .75rem;
  right: .75rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .45rem;
}
.page-float-btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .45rem .7rem;
  border: 1px solid rgba(7, 98, 66, .25);
  border-radius: 999px;
  background: rgba(255, 255, 255, .92);
  color: var(--primary);
  font-size: .75rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(7, 98, 66, .12);
  backdrop-filter: blur(6px);
}
.page-float-btn:hover {
  border-color: rgba(7, 98, 66, .45);
  background: #fff;
}
.bgm-toggle,
.fx-toggle {
  position: static;
}
.bgm-toggle--on,
.fx-toggle--on {
  border-color: rgba(7, 98, 66, .5);
  background: rgba(7, 98, 66, .08);
}
.bgm-toggle-icon,
.fx-toggle-icon { font-size: .875rem; line-height: 1; }
@media (max-width: 640px) {
  .page-float-controls {
    top: auto;
    bottom: max(.75rem, env(safe-area-inset-bottom));
    right: max(.625rem, env(safe-area-inset-right));
  }
  body.guide-blocking .page-float-controls {
    top: max(.5rem, env(safe-area-inset-top));
    bottom: auto;
    right: max(.625rem, env(safe-area-inset-right));
  }
  .page-float-btn {
    padding: .4rem .625rem;
    font-size: .6875rem;
  }
}
.guide-fab-stack {
  display: none;
  position: fixed;
  z-index: 215;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  flex-direction: row;
  align-items: center;
  gap: .4rem;
  pointer-events: none;
}
.guide-widget--minimized .guide-fab-stack { display: flex; }
.guide-fab-hint {
  position: relative;
  margin: 0;
  padding: .45rem .7rem;
  border-radius: .5rem;
  background: rgba(255, 255, 255, .45);
  border: 1px dashed rgba(7, 98, 66, .22);
  box-shadow: 0 2px 10px rgba(7, 98, 66, .06);
  color: rgba(7, 98, 66, .72);
  font-size: .75rem;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  animation: guide-hint-pulse 2s ease-in-out infinite;
}
.guide-fab-hint::after {
  content: "";
  position: absolute;
  right: -.45rem;
  top: 50%;
  transform: translateY(-50%);
  border: .35rem solid transparent;
  border-left-color: rgba(7, 98, 66, .18);
  animation: guide-hint-arrow-pulse 2s ease-in-out infinite;
}
.guide-fab-hint.hidden { display: none; }
@keyframes guide-hint-pulse {
  0%, 100% {
    opacity: .72;
    background: rgba(255, 255, 255, .55);
    border-color: rgba(7, 98, 66, .35);
    color: rgba(7, 98, 66, .65);
    box-shadow: 0 2px 8px rgba(7, 98, 66, .05);
    transform: translateX(0);
  }
  50% {
    opacity: 1;
    background: rgba(255, 255, 255, .98);
    border-color: rgba(7, 98, 66, .65);
    color: var(--primary);
    box-shadow: 0 2px 18px rgba(7, 98, 66, .28), 0 0 0 3px rgba(7, 98, 66, .12);
    transform: translateX(-4px);
  }
}
@keyframes guide-hint-arrow-pulse {
  0%, 100% { border-left-color: rgba(7, 98, 66, .15); }
  50% { border-left-color: rgba(7, 98, 66, .55); }
}
.guide-fab {
  display: none;
  position: relative;
  right: auto;
  top: auto;
  transform: none;
  flex-direction: column;
  align-items: center;
  gap: .2rem;
  padding: .625rem .45rem .625rem .55rem;
  border: 1px solid var(--border);
  border-right: none;
  border-radius: .625rem 0 0 .625rem;
  background: #fff;
  box-shadow: -2px 0 12px rgba(0, 0, 0, .12);
  cursor: pointer;
  color: var(--primary);
  font-family: inherit;
  font-size: .6875rem;
  font-weight: 600;
  line-height: 1.2;
  max-width: 3.25rem;
  pointer-events: auto;
  animation: guide-fab-pulse 2.2s ease-in-out infinite;
}
@keyframes guide-fab-pulse {
  0%, 100% {
    box-shadow: -2px 0 12px rgba(0, 0, 0, .12), 0 0 0 0 rgba(7, 98, 66, 0);
    border-color: var(--border);
  }
  50% {
    box-shadow: -4px 0 22px rgba(7, 98, 66, .35), 0 0 0 5px rgba(7, 98, 66, .14);
    border-color: rgba(7, 98, 66, .45);
  }
}
.guide-fab:hover {
  background: rgba(7, 98, 66, .06);
  animation: none;
  box-shadow: -3px 0 16px rgba(0, 0, 0, .16);
}
.guide-fab-icon { font-size: 1.125rem; line-height: 1; }
.guide-widget--minimized .guide-fab { display: flex; }
@media (max-width: 640px) {
  .guide-panel {
    top: 0;
    left: 0;
    transform: none;
    width: 100%;
    max-width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  .guide-title { font-size: 1rem; }
  .guide-subtitle { font-size: .75rem; line-height: 1.4; }
  .guide-split { flex-direction: column; }
  .guide-nav {
    position: relative;
    flex: 0 0 auto;
    width: 100%;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: .375rem;
    overflow-x: auto;
    overflow-y: hidden;
    padding: .5rem .625rem;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }
  .guide-nav::-webkit-scrollbar { display: none; }
  .guide-nav::after {
    content: "";
    position: sticky;
    right: 0;
    flex: 0 0 .75rem;
    align-self: stretch;
    margin-left: -.375rem;
    background: linear-gradient(90deg, transparent, rgba(245, 247, 246, .95));
    pointer-events: none;
  }
  .guide-nav-group {
    flex: 0 0 auto;
    margin: 0;
    padding: .2rem .45rem;
    font-size: .625rem;
    border-radius: .25rem;
    background: rgba(174, 157, 71, .12);
    color: var(--gold);
    white-space: nowrap;
    scroll-snap-align: start;
  }
  .guide-nav-item {
    flex: 0 0 auto;
    width: auto;
    min-width: auto;
    padding: .38rem .625rem;
    font-size: .75rem;
    white-space: nowrap;
    scroll-snap-align: start;
    border: 1px solid transparent;
  }
  .guide-nav-item.is-active {
    border-color: rgba(7, 98, 66, .25);
    box-shadow: 0 1px 4px rgba(7, 98, 66, .1);
  }
  .guide-header {
    padding: max(.625rem, env(safe-area-inset-top)) .875rem .625rem;
  }
  .guide-footer {
    padding: .625rem .875rem max(.875rem, env(safe-area-inset-bottom));
  }
  .guide-fab-text { writing-mode: horizontal-tb; letter-spacing: 0; }
  .guide-fab-stack {
    top: auto;
    bottom: max(4.75rem, calc(env(safe-area-inset-bottom) + 3.75rem));
    transform: none;
    flex-direction: column-reverse;
    align-items: flex-end;
    right: 0;
  }
  .guide-fab-hint::after {
    right: 50%;
    top: auto;
    bottom: -.45rem;
    transform: translateX(50%);
    border: .35rem solid transparent;
    border-top-color: rgba(7, 98, 66, .18);
    border-left-color: transparent;
  }
  .guide-fab {
    flex-direction: row;
    max-width: none;
    padding: .55rem .7rem .55rem .65rem;
    border-radius: .625rem 0 0 .625rem;
    font-size: .75rem;
  }
}

/* ===== 手机竖屏适配（公示页等） ===== */
@media (max-width: 640px) {
  :root {
    --page-header-h: 2.875rem;
    --rank-row-h: 1.875rem;
    --rank-head-h: 1.75rem;
  }

  body {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  .container {
    padding-left: max(.625rem, env(safe-area-inset-left));
    padding-right: max(.625rem, env(safe-area-inset-right));
  }

  header {
    padding-top: env(safe-area-inset-top);
  }

  .header-inner {
    height: auto;
    min-height: var(--page-header-h);
    padding: .375rem 0;
    gap: .5rem;
  }

  .logo { width: 1.875rem; height: 1.875rem; }
  .title { font-size: .875rem; line-height: 1.3; }
  .subtitle { font-size: .625rem; }

  main { padding: .625rem 0 .75rem; gap: .625rem; }

  .rank-panel-team { max-height: none; }
  .rank-panel-team .table-scroll {
    max-height: calc(var(--rank-row-h) * 6 + var(--rank-head-h));
  }
  .rank-panel-student .table-scroll {
    max-height: min(48vh, calc(var(--rank-row-h) * 11 + var(--rank-head-h)));
  }

  .card-head { padding: .45rem .625rem; gap: .25rem; }
  .card-head h3 { font-size: .875rem; }
  .card-head-meta { white-space: normal; font-size: .625rem; }
  .card-head-row { gap: .25rem; }
  .card-head-row .tabs,
  .card-head-row .week-tabs {
    width: 100%;
    margin-left: 0;
  }
  .week-tabs { justify-content: flex-start; }
  .tab { padding: .28rem .5rem; font-size: .71875rem; }

  table { font-size: .71875rem; }
  th, td { padding: .32rem .38rem; }
  th { font-size: .65625rem; }
  .table-scroll {
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar-column { gap: .5rem; }
  .sidebar-column .hero { padding: .75rem; }
  .sidebar-column .hero h2 { font-size: .9375rem !important; }
  .sidebar-column .stats { grid-template-columns: repeat(2, 1fr); gap: .375rem; }
  .sidebar-column .stat { padding: .375rem .45rem; }
  .sidebar-column .stat-label { font-size: .59375rem; }
  .sidebar-column .stat-value { font-size: .8125rem; }
  .sidebar-column .checkin-tip,
  .sidebar-column .notice,
  .sidebar-column .meta-block,
  .sidebar-column .query-card .query-form { padding: .625rem .75rem; }

  .hero p[style] { font-size: .71875rem !important; line-height: 1.45 !important; }

  .input,
  .input-full,
  #phone {
    font-size: 1rem;
    min-height: 2.75rem;
  }

  .btn { min-height: 2.75rem; font-size: .875rem; }

  .modal {
    padding: 0;
    align-items: flex-end;
  }
  .modal-panel {
    width: 100%;
    max-height: min(92dvh, 100%);
    border-radius: 1rem 1rem 0 0;
  }
  .modal-header { padding: .875rem 1rem; }
  .modal-header h3 { font-size: 1rem; }
  .modal-body {
    padding: 1rem max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  }

  .query-profile { flex-direction: column; gap: .5rem; }
  .query-profile-main h4 { font-size: 1.125rem; }
  .query-name-wrap { padding: .15rem .25rem; }
  .query-status-badge { padding: .3rem .45rem; font-size: .6875rem; }
  .query-cheer-with-badge { gap: .45rem; }
  .query-cheer { font-size: .8125rem; padding: .75rem .875rem; }
  .query-grid { gap: .375rem; }
  .query-stat { padding: .5rem .35rem; }
  .query-stat-label { font-size: .625rem; }
  .query-stat-value { font-size: .875rem; }

  .page-footer {
    padding-bottom: max(.75rem, env(safe-area-inset-bottom));
  }

  .sync-banner {
    font-size: .71875rem;
    padding: .45rem max(.625rem, env(safe-area-inset-right)) .45rem max(.625rem, env(safe-area-inset-left));
  }

  .guide-video { max-height: 11rem; }
  .guide-table { font-size: .6875rem; }
  .guide-table th,
  .guide-table td { padding: .3rem .4rem; }
  .guide-enter-btn { min-height: 2.875rem; font-size: .9375rem; }
}

@media (max-width: 640px) and (orientation: portrait) {
  .rankings-column { gap: .625rem; }
  .guide-content { padding: .625rem .75rem .75rem; }
  .guide-pane-title { font-size: .9375rem; }

  .rank-meta-toggle { display: inline-flex; align-items: center; }
  .card-head-row:first-child {
    flex-wrap: wrap;
    align-items: center;
  }
  .card-head-row:first-child .card-head-meta {
    order: 3;
    flex: 1 1 100%;
    margin-left: 0;
  }
  .rank-panel-student:not(.rank-meta-expanded) .rank-col-class,
  .rank-panel-student:not(.rank-meta-expanded) .rank-col-course {
    display: none;
  }
}
