:root {
  color-scheme: light;
  --page-bg: #f3f7ff;
  --card-bg: rgba(255, 255, 255, 0.88);
  --surface: #ffffff;
  --surface-soft: #f8fbff;
  --text: #111827;
  --muted: #64748b;
  --line: #d8e0ec;
  --line-strong: #c8d2e3;
  --primary: #3b82f6;
  --primary-2: #8b5cf6;
  --accent: #06b6d4;
  --success: #16a34a;
  --danger: #ef4444;
  --shadow: 0 22px 70px rgba(59, 92, 138, 0.16);
  --soft-shadow: 0 10px 30px rgba(100, 116, 139, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, sans-serif;
  background:
    linear-gradient(130deg, rgba(219, 234, 254, 0.95) 0%, rgba(248, 250, 252, 0.95) 45%, rgba(237, 233, 254, 0.92) 100%),
    linear-gradient(210deg, rgba(252, 231, 243, 0.42), transparent 46%);
  color: var(--text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 16%, rgba(147, 197, 253, 0.32), transparent 32%),
    radial-gradient(circle at 86% 10%, rgba(196, 181, 253, 0.32), transparent 28%),
    radial-gradient(circle at 14% 88%, rgba(251, 207, 232, 0.34), transparent 34%);
}

a {
  color: inherit;
  text-decoration: none;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 48px 0;
}

.draw-layout {
  min-height: calc(100vh - 96px);
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(380px, 1.08fr);
  gap: 28px;
  align-items: center;
}

.draw-layout-stacked {
  width: min(860px, 100%);
  margin: 0 auto;
  grid-template-columns: 1fr;
  align-content: center;
  gap: 18px;
}

.login-layout {
  min-height: calc(100vh - 96px);
  display: grid;
  place-items: center;
}

.admin-layout {
  display: grid;
  gap: 22px;
}

.panel {
  position: relative;
  border: 1px solid rgba(216, 224, 236, 0.86);
  background: var(--card-bg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  border-radius: 18px;
}

.hero-panel,
.form-panel,
.login-panel {
  padding: clamp(26px, 4vw, 46px);
}

.hero-panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 251, 255, 0.86));
}

.hero-image-panel {
  overflow: hidden;
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.hero-image-panel img {
  display: block;
  width: 100%;
  height: auto;
}

.hero-panel-wide {
  text-align: center;
}

.hero-panel-wide .hero-copy {
  margin-right: auto;
  margin-left: auto;
}

.hero-panel-wide .metric-grid {
  max-width: 520px;
  margin-right: auto;
  margin-left: auto;
}

.form-panel,
.login-panel {
  background: rgba(255, 255, 255, 0.92);
}

.form-panel-wide {
  padding: clamp(24px, 4vw, 38px);
}

.lookup-panel {
  padding: clamp(22px, 4vw, 34px);
}

.lookup-panel h2 {
  margin: 0 0 16px;
  color: #111827;
  font-size: 24px;
  letter-spacing: 0;
}

.lookup-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  gap: 12px;
  align-items: end;
}

.status-line {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.12);
}

h1 {
  margin: 18px 0 12px;
  color: #111827;
  font-size: clamp(34px, 5.4vw, 64px);
  line-height: 1.05;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 540px;
  color: #475569;
  font-size: 18px;
  line-height: 1.8;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 36px;
}

.metric-grid div {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--soft-shadow);
}

.metric-grid strong {
  display: block;
  font-size: 30px;
  color: var(--primary);
}

.metric-grid span {
  color: var(--muted);
  font-size: 13px;
}

.draw-form {
  display: grid;
  gap: 18px;
}

.region-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.captcha-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px;
  gap: 12px;
  align-items: center;
}

.captcha-image-button {
  min-height: 52px;
  padding: 0;
  border: 1px solid var(--line-strong);
  background: #ffffff;
  overflow: hidden;
}

.captcha-image-button img {
  display: block;
  width: 100%;
  height: 52px;
  object-fit: cover;
}

.field-hint {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

label {
  display: grid;
  gap: 8px;
  color: #334155;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #ffffff;
  color: var(--text);
  padding: 0 14px;
  font: inherit;
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

input::placeholder {
  color: #94a3b8;
}

input:disabled,
select:disabled {
  background: #f1f5f9;
  color: #94a3b8;
}

input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.14);
}

button,
.ghost-button {
  min-height: 48px;
  border: 0;
  border-radius: 10px;
  padding: 0 18px;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, opacity 180ms ease, box-shadow 180ms ease;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.primary-button {
  color: #ffffff;
  background: linear-gradient(135deg, #60a5fa, #8b5cf6);
  box-shadow: 0 12px 28px rgba(99, 102, 241, 0.28);
}

.primary-button:hover:not(:disabled),
.ghost-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: #ffffff;
  color: #334155;
  box-shadow: var(--soft-shadow);
}

.result-card {
  margin-top: 22px;
  border: 1px solid rgba(59, 130, 246, 0.22);
  border-radius: 14px;
  padding: 20px;
  background: linear-gradient(180deg, #eff6ff, #ffffff);
  box-shadow: var(--soft-shadow);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(10px);
}

.modal-panel {
  width: min(520px, 100%);
  border: 1px solid rgba(216, 224, 236, 0.9);
  border-radius: 18px;
  padding: 30px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  text-align: center;
}

.modal-panel h2 {
  margin: 10px 0;
  color: #172554;
  font-size: clamp(28px, 5vw, 42px);
  line-height: 1.25;
  letter-spacing: 0;
}

.modal-panel .primary-button {
  width: 100%;
  margin-top: 18px;
}

.draw-code-line {
  margin: 12px 0 8px;
  border-radius: 12px;
  padding: 12px;
  color: #1d4ed8;
  background: #eff6ff;
  font-size: 18px;
  font-weight: 900;
}

.notice-box {
  margin-top: 14px;
  border: 1px solid rgba(245, 158, 11, 0.28);
  border-radius: 14px;
  padding: 14px 16px;
  background: #fffbeb;
  text-align: left;
}

.notice-box strong {
  display: block;
  margin-bottom: 8px;
  color: #92400e;
  font-size: 15px;
}

.notice-box ol {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 20px;
  color: #78350f;
  font-weight: 800;
  line-height: 1.55;
}

.lookup-result {
  margin-top: 18px;
  border: 1px solid rgba(59, 130, 246, 0.18);
  border-radius: 14px;
  padding: 18px;
  background: linear-gradient(180deg, #eff6ff, #ffffff);
}

.lookup-result strong {
  display: block;
  margin-bottom: 12px;
  color: #172554;
  font-size: 24px;
  line-height: 1.35;
}

.lookup-result dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

.lookup-result dl div {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 12px;
}

.lookup-result dt {
  color: var(--muted);
  font-weight: 800;
}

.lookup-result dd {
  margin: 0;
  color: #334155;
  font-weight: 800;
}

.result-card strong {
  display: block;
  margin-top: 8px;
  color: #172554;
  font-size: clamp(24px, 4vw, 36px);
  line-height: 1.35;
}

.result-label,
.result-card p,
.message {
  color: var(--muted);
}

.saved-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  margin-top: 8px;
  border: 1px solid rgba(22, 163, 74, 0.22);
  border-radius: 10px;
  padding: 0 12px;
  color: var(--success);
  background: rgba(220, 252, 231, 0.82);
  font-weight: 900;
}

.message {
  min-height: 24px;
  margin: 16px 0 0;
}

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

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

.hidden {
  display: none;
}

.login-panel {
  width: min(520px, 100%);
}

.admin-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid rgba(216, 224, 236, 0.78);
  border-radius: 18px;
  padding: 22px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--soft-shadow);
}

.admin-header h1 {
  margin-bottom: 0;
  font-size: clamp(30px, 4.5vw, 48px);
}

.admin-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.admin-actions form {
  margin: 0;
}

.table-panel {
  overflow: hidden;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
  background: #ffffff;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, #f8fbff, #eef4ff);
  color: #334155;
  font-size: 13px;
}

tbody tr:hover {
  background: #f8fbff;
}

.empty-cell {
  text-align: center;
  color: var(--muted);
}

@media (max-width: 820px) {
  .shell {
    width: min(100vw - 24px, 680px);
    padding: 20px 0;
  }

  .draw-layout {
    min-height: auto;
    grid-template-columns: 1fr;
  }

  .draw-layout-stacked {
    width: 100%;
  }

  .region-picker {
    grid-template-columns: 1fr;
  }

  .captcha-row {
    grid-template-columns: 1fr;
  }

  .lookup-form {
    grid-template-columns: 1fr;
  }

  .lookup-result dl div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .admin-header {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-actions {
    flex-wrap: wrap;
  }
}

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