:root {
  color-scheme: light;
  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --surface: #ffffff;
  --background: #eff6ff;
  --text: #0f172a;
  --muted: #475569;
  --border: #cbd5e1;
  --danger: #b91c1c;
  --success: #166534;
  --focus: #f59e0b;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #eff6ff 0, #f8fafc 22rem);
  color: var(--text);
  line-height: 1.6;
}
a { color: var(--primary); }
button, input, select, textarea { font: inherit; }
button, .button {
  min-height: 48px;
  border: 0;
  border-radius: 10px;
  padding: .7rem 1.1rem;
  background: var(--primary);
  color: white;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 180ms ease, opacity 180ms ease;
}
button:hover { background: var(--primary-hover); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.secondary { background: #e2e8f0; color: var(--text); }
button.danger { background: var(--danger); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
input, select, textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .7rem .8rem;
  background: white;
  color: var(--text);
}
textarea { min-height: 96px; resize: vertical; }
label, legend { display: block; font-weight: 700; margin-bottom: .35rem; }
fieldset { border: 0; padding: 0; margin: 0; }
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 1rem; top: 1rem; z-index: 100; background: white; padding: .6rem; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1120px;
  margin: auto;
  padding: 1rem;
}
.brand { font-size: 1.1rem; font-weight: 800; text-decoration: none; color: var(--text); }
.container { width: min(1120px, calc(100% - 2rem)); margin: 1rem auto 4rem; }
.narrow { width: min(560px, calc(100% - 2rem)); margin: 8vh auto 4rem; }
.card {
  background: var(--surface);
  border: 1px solid #dbeafe;
  border-radius: 16px;
  padding: clamp(1rem, 3vw, 1.6rem);
  box-shadow: 0 12px 30px rgb(30 64 175 / .08);
}
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.stack { display: grid; gap: 1rem; }
.form-row { display: grid; gap: .4rem; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.muted, .help { color: var(--muted); }
.help { font-size: .9rem; margin: .25rem 0 0; }
.status { min-height: 1.6rem; padding-top: .4rem; }
.status.error { color: var(--danger); }
.status.success { color: var(--success); }
.choice {
  display: flex;
  gap: .6rem;
  align-items: flex-start;
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .7rem;
  font-weight: 400;
  cursor: pointer;
}
.choice input { width: 1.2rem; min-height: 1.2rem; margin-top: .2rem; }
.choice:has(input:checked) { border-color: var(--primary); background: #eff6ff; }
.card-list { display: grid; gap: .7rem; max-height: 28rem; overflow-y: auto; padding-right: .25rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .7rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { white-space: nowrap; }
.badge { display: inline-block; border-radius: 999px; padding: .15rem .55rem; background: #dbeafe; font-size: .85rem; }
.result { border-left: 4px solid var(--primary); padding-left: 1rem; }
.hidden { display: none !important; }
.link-box { word-break: break-all; background: #f8fafc; border: 1px dashed var(--border); padding: .8rem; border-radius: 10px; }
.question { border-top: 1px solid var(--border); padding-top: 1rem; }
h1 { font-size: clamp(1.65rem, 5vw, 2.4rem); line-height: 1.25; margin-top: 0; }
h2 { font-size: 1.3rem; margin-top: 0; }
h3 { font-size: 1.05rem; }

@media (max-width: 640px) {
  .topbar { align-items: flex-start; }
  .topbar .actions { justify-content: flex-end; }
  .container { width: min(100% - 1rem, 1120px); }
  .narrow { width: min(100% - 1rem, 560px); margin-top: 1rem; }
  .card { border-radius: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
