:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --line: #d8e0eb;
  --ink: #13233c;
  --subtle: #66768f;
  --accent: #1d4ed8;
  --accent-soft: #dbeafe;
  --danger: #c2410c;
  --danger-soft: #ffedd5;
  --success: #0f766e;
  --success-soft: #ccfbf1;
  --shadow: 0 20px 60px rgba(19, 35, 60, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  background: linear-gradient(180deg, #f7f9fc 0%, #eef4f8 100%);
  color: var(--ink);
  min-height: 100vh;
  position: relative;
}

body.has-theme-background::before,
body.has-theme-background::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body.has-theme-background::before {
  background-image: var(--page-bg-image);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  transform: scale(1.02);
}

body.has-theme-background::after {
  background: linear-gradient(180deg, rgba(247, 249, 252, 0.64) 0%, rgba(238, 244, 248, 0.86) 100%);
}

body.theme-zodiac::after {
  background: linear-gradient(180deg, rgba(246, 251, 255, 0.58) 0%, rgba(233, 240, 252, 0.82) 100%);
}

body.theme-fu::after {
  background: linear-gradient(180deg, rgba(255, 248, 245, 0.62) 0%, rgba(255, 239, 229, 0.86) 100%);
}

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

button,
input,
textarea {
  font: inherit;
}

.public-shell,
.admin-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
  position: relative;
  z-index: 1;
}

.public-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.single-card {
  width: min(520px, 100%);
  padding: 36px 28px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(19, 35, 60, 0.06);
  border-radius: 28px;
  box-shadow: var(--shadow);
  text-align: center;
  backdrop-filter: blur(10px);
}

.single-card h1 {
  margin: 0 0 28px;
  font-size: clamp(30px, 4vw, 40px);
  line-height: 1.2;
}

.single-qr-card {
  padding: 20px;
  border-radius: 24px;
  background: #fbfdff;
  border: 1px solid #ebf0f5;
}

.single-wechat-id {
  margin-top: 28px;
  font-size: clamp(28px, 4vw, 36px);
  font-weight: 800;
  letter-spacing: 0.03em;
}

.single-action {
  width: 100%;
  margin-top: 18px;
}

.hero-card,
.panel-card,
.login-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(19, 35, 60, 0.06);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.hero-card {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 28px;
  padding: 32px;
}

.hero-card.slim {
  grid-template-columns: 1fr 360px;
}

.hero-card.simple {
  align-items: center;
}

.hero-card.blocked {
  border-color: rgba(194, 65, 12, 0.14);
}

.hero-copy.compact {
  max-width: 520px;
}

.hero-copy h1,
.login-card h1,
.admin-topbar h1 {
  margin: 0;
  font-size: clamp(32px, 4vw, 42px);
  line-height: 1.12;
}

.kicker {
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}

.kicker.muted {
  color: var(--danger);
}

.lead {
  margin: 18px 0 0;
  color: var(--subtle);
  font-size: 16px;
  line-height: 1.8;
}

.lead.small {
  font-size: 14px;
}

.info-list {
  margin-top: 24px;
  display: grid;
  gap: 12px;
}

.info-list div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-radius: 18px;
  background: #f8fafc;
  border: 1px solid #eef2f7;
}

.info-list span {
  color: var(--subtle);
}

.info-list strong {
  text-align: right;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 24px;
}

.primary-btn,
.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 22px;
  border-radius: 999px;
  cursor: pointer;
  transition: 0.2s ease;
}

.primary-btn {
  border: 0;
  background: var(--accent);
  color: white;
}

.primary-btn:hover {
  opacity: 0.92;
}

.primary-btn.full {
  width: 100%;
}

.ghost-btn {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
}

.ghost-btn:hover {
  border-color: #b6c2d3;
}

.tip {
  margin-top: 14px;
  color: var(--subtle);
  font-size: 13px;
}

.tip.centered {
  text-align: center;
}

.qr-save-tip {
  margin-top: 12px;
}

.wechat-box {
  margin-top: 24px;
  padding: 22px;
  border-radius: 24px;
  background: #f8fbff;
  border: 1px solid #e7eef9;
  display: grid;
  gap: 12px;
}

.wechat-label {
  font-size: 13px;
  color: var(--subtle);
}

.wechat-id {
  font-size: clamp(28px, 4vw, 36px);
  font-weight: 800;
  letter-spacing: 0.03em;
  text-align: center;
}

.info-inline {
  margin-top: 18px;
  display: grid;
  gap: 8px;
  color: var(--subtle);
  font-size: 14px;
}

.centered-card {
  display: grid;
  align-content: center;
}

.soft-blocked {
  min-height: 240px;
}

.qr-stack {
  display: grid;
  gap: 18px;
}

.qr-card,
.notice-card {
  padding: 22px;
  border-radius: 24px;
  background: #fbfdff;
  border: 1px solid #ebf0f5;
}

.qr-title,
.notice-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 14px;
}

.qr-image {
  display: block;
  width: min(100%, 240px);
  margin: 0 auto;
  border-radius: 20px;
}

.qr-image.large {
  width: min(100%, 320px);
}

.qr-placeholder {
  min-height: 240px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: repeating-linear-gradient(
    45deg,
    #f8fafc,
    #f8fafc 10px,
    #eef3f8 10px,
    #eef3f8 20px
  );
  color: var(--subtle);
  text-align: center;
  padding: 20px;
}

.notice-card p {
  margin: 0;
  color: var(--subtle);
  line-height: 1.8;
}

.admin-shell.wide {
  width: min(1320px, calc(100% - 32px));
}

.admin-topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-end;
  margin-bottom: 20px;
}

.top-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.login-card {
  width: min(480px, 100%);
  margin: 8vh auto 0;
  padding: 32px;
}

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

label {
  display: grid;
  gap: 8px;
  color: var(--subtle);
  font-size: 14px;
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 10px;
}

.inline-check input[type='checkbox'] {
  width: 16px;
  height: 16px;
  margin: 0;
}

.inline-check span {
  color: var(--ink);
}

.group-label {
  display: block;
  margin-bottom: 10px;
  color: var(--subtle);
  font-size: 14px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  border-radius: 16px;
  padding: 12px 14px;
  color: var(--ink);
  outline: none;
}

input:focus,
textarea:focus {
  border-color: #95b4ff;
  box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.08);
}

.check-item input[type='checkbox'] {
  width: 16px;
  height: 16px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.alert {
  padding: 14px 16px;
  border-radius: 16px;
  margin-bottom: 18px;
  font-size: 14px;
}

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

.alert.success {
  background: var(--success-soft);
  color: var(--success);
}

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

.stat-card {
  background: var(--panel);
  border-radius: 22px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.stat-card span {
  display: block;
  color: var(--subtle);
  font-size: 13px;
}

.stat-card strong {
  display: block;
  margin-top: 10px;
  font-size: 32px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.panel-card {
  padding: 24px;
}

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

.panel-head h2 {
  margin: 0;
  font-size: 22px;
}

.province-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

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

.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
  color: var(--ink);
}

.check-item input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.check-item span {
  font-size: 14px;
}

.theme-item {
  align-items: flex-start;
}

.theme-item span {
  display: grid;
  gap: 6px;
}

.theme-item strong {
  font-size: 14px;
}

.theme-item small {
  line-height: 1.5;
}

.action-item {
  align-items: center;
}

.compact-btn {
  min-height: 36px;
  padding: 0 14px;
  font-size: 13px;
}

.qr-inline {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 20px;
  align-items: center;
}

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

.rank-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #f8fafc;
}

.form-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-columns .full {
  grid-column: 1 / -1;
}

small {
  color: var(--subtle);
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid #edf2f7;
  text-align: left;
  font-size: 14px;
}

th {
  color: var(--subtle);
  font-weight: 600;
  white-space: nowrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status-pill.allowed {
  background: var(--success-soft);
  color: var(--success);
}

.status-pill.blocked {
  background: var(--danger-soft);
  color: var(--danger);
}

.empty-hint {
  color: var(--subtle);
  text-align: center;
  padding: 24px;
}

.break-all {
  word-break: break-all;
}

@media (max-width: 980px) {
  .hero-card,
  .hero-card.slim,
  .dashboard-grid,
  .qr-inline,
  .stats-grid,
  .form-columns {
    grid-template-columns: 1fr;
  }

  .public-shell,
  .admin-shell,
  .admin-shell.wide {
    width: min(100%, calc(100% - 24px));
  }

  .province-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (max-width: 640px) {
  .province-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
