:root {
  color-scheme: light;
  --bg: #eef4fb;
  --panel: #ffffff;
  --ink: #102033;
  --muted: #607086;
  --line: #d7e1ee;
  --primary: #1e3a8a;
  --primary-strong: #1d4ed8;
  --success: #167a3a;
  --warning: #92400e;
  --danger: #b42318;
  --shadow: 0 18px 48px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

button,
input {
  font: inherit;
}

.home-shell {
  min-height: 100vh;
  padding: 32px 16px;
}

.search-panel {
  width: min(980px, 100%);
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 24px;
}

.home-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.home-head span {
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
}

.home-head h1 {
  margin: 6px 0 0;
  font-size: 34px;
  letter-spacing: 0;
}

.welfare-entry {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: var(--primary);
  padding: 0 14px;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.welfare-entry:hover {
  border-color: #93c5fd;
  background: #dbeafe;
  color: var(--primary-strong);
}

.usage-panel {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  margin-bottom: 18px;
  padding: 14px;
}

.usage-panel h2 {
  margin: 0;
  color: var(--primary);
  font-size: 17px;
  letter-spacing: 0;
}

.usage-steps {
  display: grid;
  gap: 6px;
}

.usage-steps p {
  margin: 0;
  color: #334155;
  line-height: 1.65;
  overflow-wrap: break-word;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stats-grid article {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  padding: 14px;
}

.stats-grid span,
.result-head span,
.message,
.question-meta {
  color: var(--muted);
}

.stats-grid strong {
  font-size: 24px;
  overflow-wrap: break-word;
}

.token-panel {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  margin-bottom: 18px;
  padding: 12px 14px;
}

.token-panel span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.token-panel code {
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}

.search-form {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.search-form label {
  color: #24364b;
  font-weight: 800;
}

.home-captcha {
  display: grid;
  gap: 8px;
  min-width: 0;
  width: 100%;
}

.captcha-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.captcha-actions span {
  min-width: 0;
  color: var(--muted);
  line-height: 1.5;
  overflow-wrap: break-word;
}

.captcha-actions button {
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--primary);
  padding: 7px 12px;
  cursor: pointer;
  font-weight: 800;
}

.captcha-actions button:hover {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.captcha-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.geetest-captcha-box {
  min-height: 46px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  padding: 8px;
}

.home-captcha.captcha-verified .geetest-captcha-box {
  pointer-events: none;
  border-color: #86efac;
  background: #f0fdf4;
}

.home-captcha.captcha-success-state #homeCaptchaStatus {
  color: var(--success);
  font-weight: 800;
}

.home-captcha.captcha-error .geetest-captcha-box {
  border-color: #ef4444;
  background: #fef2f2;
}

.home-captcha.captcha-error #homeCaptchaStatus {
  color: var(--danger);
  font-weight: 800;
}

.home-captcha.captcha-shake {
  animation: captchaShake 360ms ease;
}

@keyframes captchaShake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-8px);
  }
  40% {
    transform: translateX(7px);
  }
  60% {
    transform: translateX(-5px);
  }
  80% {
    transform: translateX(4px);
  }
}

.captcha-success {
  display: grid;
  place-items: center;
  gap: 3px;
  min-height: 46px;
  color: #166534;
  text-align: center;
}

.captcha-success strong {
  font-size: 14px;
  font-weight: 800;
}

.captcha-success span {
  color: #15803d;
  font-size: 12px;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
}

.search-row input {
  min-width: 0;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
}

.search-row button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  padding: 0 20px;
  cursor: pointer;
  font-weight: 800;
}

.search-row button:hover {
  background: var(--primary-strong);
}

.search-row button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.message {
  min-height: 22px;
  margin: 0;
  line-height: 1.6;
}

.message.error {
  color: var(--danger);
}

.message.success {
  color: var(--success);
}

.result-section {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

.result-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.result-head h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0;
}

.result-list {
  display: grid;
  gap: 12px;
}

.question-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.question-title {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.65;
  overflow-wrap: break-word;
}

.question-options {
  display: grid;
  gap: 8px;
}

.question-option {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  border: 1px solid #e1e7ef;
  border-radius: 8px;
  padding: 9px 10px;
  color: #334155;
  line-height: 1.5;
}

.question-option.correct {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.question-option strong {
  flex-shrink: 0;
}

.question-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
}

.answer-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
  padding: 4px 9px;
  font-weight: 800;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 20px;
  text-align: center;
}

@media (max-width: 640px) {
  .home-shell {
    padding: 18px 12px;
  }

  .search-panel {
    padding: 18px;
  }

  .home-head,
  .result-head {
    flex-direction: column;
  }

  .welfare-entry {
    width: 100%;
  }

  .home-head h1 {
    font-size: 28px;
  }

  .stats-grid,
  .search-row {
    grid-template-columns: 1fr;
  }

  .captcha-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .captcha-actions button {
    width: 100%;
  }

  .search-row button {
    width: 100%;
  }
}
