:root {
  --color-primary: #1890ff;
  --color-primary-hover: #1478d9;
  --color-text: #333333;
  --color-text-secondary: #666666;
  --color-text-muted: #999999;
  --color-border-dashed: #d9d9d9;
  --color-card: #ffffff;
  --color-page-bg-start: #e8f4ff;
  --color-page-bg-end: #f0f7ff;
  --color-footer-bar: #f5f5f5;
  --shadow-card: 0 8px 24px rgba(24, 144, 255, 0.12);
  --radius-card: 10px;
  --radius-btn: 6px;
  /* 左右对称：为「查看已填答卷」预留与左侧等宽边距，主内容视觉仍居中 */
  --page-edge-gutter: calc(16px + 2.5rem);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--color-text);
  line-height: 1.5;
}

/* 避免侧栏 fixed 与 100vw 等导致的横向可滚动条（本页无刻意横向滚动内容） */
html {
  overflow-x: hidden;
}

#app-main {
  min-height: 100vh;
}

/* 首屏/答题区切换：避免 .welcome 等 display 规则盖掉 [hidden] 导致两屏同显 */
#view-welcome[hidden],
#view-survey[hidden] {
  display: none !important;
}

.page-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: url("../static/bg.jpg") center / cover no-repeat;
}

.welcome {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px var(--page-edge-gutter);
}

.card {
  width: 100%;
  max-width: 680px;
  background: var(--color-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.card__banner {
  margin: 0;
  background: #b8d9f5;
  line-height: 0;
}

.card__banner img {
  display: block;
  width: 100%;
  height: 150px;
  object-fit: cover;
  object-position: center;
}

.card__body {
  position: relative;
  padding: 20px 28px 28px;
}

#view-welcome .card__body {
  padding-top: 48px;
}

.qr-entry {
  position: absolute;
  right: 10px;
  top: 10px;
  z-index: 555;
}

.qr-icon {
  display: block !important;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: none;
  cursor: pointer;
  background-color: transparent;
  background-image: url("../static/qrIcon.png");
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
}

.qr-icon:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

.qr-popover {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 557;
  min-width: 160px;
  padding: 16px 16px 14px;
  background: #f0f0f0;
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
  text-align: center;
}

.qr-popover__code {
  display: inline-block;
  padding: 8px;
  background: #fff;
  border-radius: 4px;
  line-height: 0;
}

.qr-popover__code img {
  display: block;
  width: 128px;
  height: 128px;
}

.qr-popover__hint {
  margin: 12px 0 0;
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  line-height: 1.45;
}

.qr-entry:hover .qr-popover,
.qr-entry:focus-within .qr-popover {
  display: block;
}

.card__title {
  margin: 0 0 12px;
  font-size: clamp(1.25rem, 4vw, 1.75rem);
  font-weight: 700;
  color: var(--color-primary);
}

.card__desc {
  margin: 0;
  font-size: 0.95rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

.card__rule {
  margin: 20px 0 24px;
  border: 0;
  border-top: 1px dashed var(--color-border-dashed);
}

.card__actions {
  display: flex;
  justify-content: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 14px 24px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.btn--primary {
  width: min(100%, 320px);
  color: #fff;
  background-color: var(--color-primary);
}

.btn--primary:hover {
  background-color: var(--color-primary-hover);
}

.btn--primary:focus-visible {
  outline: 3px solid rgba(24, 144, 255, 0.45);
  outline-offset: 2px;
}

.btn--ghost {
  color: var(--color-text-secondary);
  background: #fafafa;
  border: 1px solid var(--color-border-dashed);
}

.btn--ghost:hover {
  background: #f0f0f0;
}

.btn--ghost:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.card__footer {
  padding: 0;
  background: var(--color-footer-bar);
  border-top: 1px solid #eee;
}

.card__footer-nav {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 10px 20px;
  font-size: 0.875rem;
}

.card__footer-nav a {
  color: var(--color-text-muted);
  text-decoration: none;
}

.card__footer-nav a:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

.card__footer-nav a:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 2px;
}

.card__footer-nav a:first-of-type {
  flex: 1;
  text-align: left;
}

.card__footer-brand {
  flex: 0 0 auto;
  text-align: center;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.card__footer-nav a:last-of-type {
  flex: 1;
  text-align: right;
}

@media (max-width: 480px) {
  .card__footer-nav {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }

  .card__footer-nav a:first-of-type,
  .card__footer-nav a:last-of-type {
    flex: 0 0 auto;
    text-align: center;
  }

  .card__footer-brand {
    width: 100%;
    order: -1;
  }
}

/* 「查看已填答卷」：仅当接口 isNew === false 时由 app.js 移除 hidden 后显示（见 syncFilledAnswersTabVisibility） */
.filled-answers-tab[hidden] {
  display: none !important;
}

.filled-answers-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  right: 0px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 50;
  width: 2.125rem;
  min-width: 0;
  min-height: 7.5rem;
  padding: 10px 6px;
  box-sizing: border-box;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 0.75rem;
  line-height: 1.35;
  letter-spacing: 0.12em;
  color: #595959;
  background: #f5f5f5;
  border: 1px solid #d9d9d9;
  border-right: none;
  border-radius: 8px 0 0 8px;
  text-decoration: none;
  box-shadow: -2px 2px 10px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.filled-answers-tab:active {
  background: #ebebeb;
}

.filled-answers-tab:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
}

/* -------------------------------------------------------------------------- */
/* 移动端适配（≤767px）；≥768px 保持原有 PC 布局 */
/* -------------------------------------------------------------------------- */

@media (max-width: 767px) {
  #view-welcome .qr-entry {
    display: none !important;
  }

  .page-bg {
    background: #fff;
  }

  body.page-survey .page-bg {
    background: #fafafa;
  }

  .welcome {
    align-items: flex-start;
    padding: 24px 20px;
  }

  #view-welcome .card__banner {
    display: none;
  }

  #view-welcome .card {
    max-width: none;
    border-radius: 0;
    box-shadow: none;
    border: none;
  }

  #view-welcome .card__body {
    padding: 28px 0 32px;
  }

  #view-welcome .card__title {
    text-align: center;
    font-size: 1.35rem;
    margin-bottom: 16px;
  }

  #view-welcome .card__desc {
    text-align: center;
    color: var(--color-text);
    font-size: 0.9375rem;
  }

  #view-welcome .card__rule {
    margin: 22px 0 28px;
  }

  #view-welcome .btn--primary {
    width: 100%;
    max-width: none;
  }

  #view-welcome .card__footer {
    border-top: 1px solid #eee;
  }
}
