:root {
  --bg: #f5f7fa;
  --text: #222;
  --muted: #888;
  --accent: #1a73e8;
  --nav-h: 56px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- 顶部导航 ---------- */
#siteNav {
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar {
  position: relative;
  height: var(--nav-h);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.08);
}
.brand {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--text);
  text-decoration: none;
}
.nav-links {
  display: flex;
  gap: 8px;
}
.nav-links a {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 16px;
  color: var(--text);
  text-decoration: none;
}
.nav-links a:hover { background: #eef2f7; }
.nav-links a.active {
  color: var(--c);
  font-weight: 600;
  box-shadow: inset 0 -3px 0 var(--c);
}

.menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
}
.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
}

@media (max-width: 767px) {
  .topbar { padding: 0 8px 0 16px; }
  .menu-toggle { display: flex; }
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    padding: 4px 12px 12px;
    background: #fff;
    box-shadow: 0 10px 16px rgba(0, 0, 0, 0.08);
  }
  .nav-links.open { display: flex; }
  .nav-links a {
    padding: 14px 12px;
    border-radius: 0;
    border-bottom: 1px solid #f0f0f0;
  }
  .nav-links a.active { box-shadow: inset 4px 0 0 var(--c); }
}

/* ---------- 页面通用 ---------- */
main {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 24px;
}
.page-title {
  margin: 6vh 0 0;
  padding: 0 16px;
  font-size: 28px;
  letter-spacing: 4px;
  text-align: center;
}

footer {
  padding: 20px 10px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- 主页：项目按钮 ---------- */
.menu-grid {
  margin-top: 14vh;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 24px 40px;
  padding: 0 20px;
}
.menu-btn {
  display: block;
  min-width: 190px;
  padding: 18px 40px;
  border-radius: 12px;
  background: var(--c);
  color: #fff;
  font-size: 20px;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  transition: transform 0.15s, filter 0.2s;
}
.menu-btn:hover {
  filter: brightness(0.92);
  transform: translateY(-2px);
}
@media (max-width: 767px) {
  .menu-grid {
    width: 100%;
    max-width: 380px;
    flex-direction: column;
    margin-top: 10vh;
  }
  .menu-btn { min-width: 0; }
}

/* ---------- 查询页 ---------- */
.back-row {
  width: 100%;
  padding: 10px 16px 0;
}
.back-link {
  display: inline-block;
  padding: 10px 4px;
  font-size: 15px;
  color: var(--muted);
  text-decoration: none;
}
.back-link:hover { color: var(--text); }

.hero-img {
  display: block;
  width: 400px;
  max-width: 90%;
  aspect-ratio: 2 / 1;
  object-fit: contain;
  margin: 12px auto 0;
  border-radius: 12px;
}
.hero-img.hidden,
.hero-img.broken { display: none; }

.button-row {
  margin-top: 56px;            /* 图片与按钮的间距 ≈ 一个按钮的高度 */
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px 32px;
  padding: 0 16px;
  transition: margin-top 0.3s ease;
}
.button-row.moved { margin-top: 24px; }

.q-btn {
  padding: 16px 36px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  transition: transform 0.15s, filter 0.2s;
}
.q-btn:hover {
  filter: brightness(0.92);
  transform: translateY(-2px);
}
.q-btn.active {
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--accent);
}
@media (max-width: 480px) {
  .q-btn { padding: 14px 26px; }
}

.result-panel {
  display: none;
  position: relative;
  width: 90%;
  margin-top: 32px;
  padding: 40px 20px 20px;
  height: calc(20 * 1.7em + 60px);   /* 内容区约 20 行文字 */
  overflow-y: auto;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  font-size: 18px;
  line-height: 1.7em;
}
.result-panel.show { display: block; }
@media (min-width: 768px) {
  .result-panel { width: 50%; }
}

.close-btn {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  font-size: 20px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}
.close-btn:hover { color: var(--text); }

.task-item {
  padding: 8px 0;
  border-bottom: 1px solid #eee;
}
.task-item:last-child { border-bottom: none; }
.task-status {
  margin-left: 8px;
  font-size: 14px;
  color: var(--muted);
}
.empty-msg,
.error-msg {
  padding-top: 20px;
  text-align: center;
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
