:root {
  --ink: #091a3a;
  --muted: #65738d;
  --line: #e6edf8;
  --blue: #2f73ff;
  --cyan: #15d4c8;
  --soft: #f6faff;
  --shadow: 0 18px 50px rgba(40, 95, 170, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background:
    radial-gradient(circle at 75% 22%, rgba(47, 115, 255, 0.12), transparent 36%),
    linear-gradient(180deg, #f7fbff 0%, #ffffff 48%, #f7fbff 100%);
}

[hidden] {
  display: none !important;
}

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

button,
input,
textarea,
select {
  font: inherit;
}

.topbar,
.admin-header {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 clamp(28px, 4vw, 64px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.topbar {
  min-height: 64px;
  padding: 0 clamp(24px, 3.4vw, 56px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0;
}

.topbar .brand {
  font-size: 24px;
}

.brand img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.topbar .brand img {
  width: 30px;
  height: 30px;
}

.account-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}

.ghost-button,
.points-chip,
.user-chip {
  height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 10px 24px rgba(20, 73, 150, 0.06);
}

.ghost-button {
  color: #16315c;
  font-weight: 700;
  cursor: pointer;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, #90b5ff, #122f6b);
  font-weight: 800;
}

.coin {
  color: var(--blue);
  font-size: 18px;
}

.points-chip strong {
  color: var(--cyan);
  font-size: 18px;
}

.buy-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 14px;
  padding: 0 22px;
  color: #fff;
  background: linear-gradient(135deg, #3678ff, #1d5cf0);
  box-shadow: 0 14px 28px rgba(47, 115, 255, 0.28);
  font-weight: 800;
  cursor: pointer;
}

.topbar .ghost-button,
.topbar .points-chip,
.topbar .user-chip {
  height: 38px;
  padding: 0 16px;
  border-radius: 12px;
}

.topbar .buy-button {
  min-height: 40px;
  padding: 0 20px;
  border-radius: 12px;
}

.hero-section {
  min-height: 312px;
  display: grid;
  grid-template-columns: minmax(660px, 1fr) minmax(460px, 0.82fr);
  align-items: center;
  gap: clamp(30px, 3vw, 56px);
  padding: 26px clamp(48px, 6.5vw, 112px) 18px;
  overflow: hidden;
  position: relative;
}

.home-main {
  min-height: calc(100svh - 64px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-section::after {
  content: "";
  position: absolute;
  left: -6vw;
  right: -6vw;
  bottom: -70px;
  height: 118px;
  background: #fff;
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}

.hero-copy {
  position: relative;
  z-index: 1;
}

.hero-copy h1 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(40px, 3.1vw, 58px);
  line-height: 1.06;
  letter-spacing: 0;
  text-wrap: balance;
}

.hero-copy h1 span {
  color: var(--blue);
}

.hero-copy p {
  margin: 14px 0 0;
  color: #53627d;
  font-size: clamp(17px, 1.1vw, 22px);
  letter-spacing: 0;
  white-space: nowrap;
}

.hero-art {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
}

.hero-art img {
  width: min(100%, 520px);
  filter: drop-shadow(0 24px 44px rgba(47, 115, 255, 0.12));
}

.tool-section {
  position: relative;
  z-index: 2;
  width: min(1920px, calc(100vw - 64px));
  margin: 0 auto;
  padding: 0 0 28px;
  transform: translateY(24px);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 0 0 14px;
}

.section-title h2 {
  margin: 0;
  font-size: clamp(28px, 1.85vw, 36px);
  letter-spacing: 0;
}

.section-title span {
  width: 88px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #b6ccff, var(--cyan));
}

.section-title span:last-child {
  transform: scaleX(-1);
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: clamp(10px, 0.85vw, 18px);
  justify-content: center;
  align-items: stretch;
}

.tool-card {
  min-height: 224px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(12px, 0.8vw, 16px) clamp(8px, 0.68vw, 13px) 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 16px 42px rgba(40, 95, 170, 0.1);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.tool-card:hover {
  transform: translateY(-6px);
  border-color: #c5d8ff;
  box-shadow: 0 24px 58px rgba(47, 115, 255, 0.18);
}

.tool-card img {
  width: clamp(56px, 3.8vw, 78px);
  height: clamp(56px, 3.8vw, 78px);
  object-fit: contain;
  margin-bottom: 8px;
}

.tool-card h3 {
  min-height: 22px;
  margin: 0;
  font-size: clamp(15px, 0.92vw, 18px);
  line-height: 1.22;
  text-align: center;
  word-break: keep-all;
  text-wrap: balance;
}

.point-badge {
  margin: 6px 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  background: #edf5ff;
  color: #2572ff;
  font-size: 13px;
  font-weight: 800;
}

.tool-card p {
  width: 100%;
  flex: 1;
  margin: 0 0 10px;
  color: var(--muted);
  line-height: 1.32;
  text-align: center;
  font-size: clamp(11px, 0.7vw, 13px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.enter-button {
  width: min(120px, 86%);
  min-height: 32px;
  border-radius: 9px;
  color: #fff;
  background: linear-gradient(135deg, #5c93ff, #2470f6);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  padding: 12px 18px;
  border-radius: 999px;
  color: #fff;
  background: rgba(9, 26, 58, 0.92);
  z-index: 20;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(9, 26, 58, 0.28);
  backdrop-filter: blur(10px);
}

.redeem-dialog {
  position: relative;
  width: min(460px, 100%);
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 28px 70px rgba(25, 70, 150, 0.22);
}

.redeem-dialog h2 {
  margin: 0 0 10px;
  font-size: 28px;
}

.redeem-dialog p {
  margin: 0 0 20px;
  color: var(--muted);
  line-height: 1.6;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: #31527f;
  background: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.redeem-form {
  display: grid;
  gap: 14px;
}

.redeem-form input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 14px;
  color: var(--ink);
  background: #fff;
  text-transform: uppercase;
}

.redeem-form .buy-button {
  width: 100%;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(440px, 100%);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.auth-brand {
  font-size: 24px;
  margin-bottom: 24px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}

.auth-tabs button {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.auth-tabs button.active {
  color: #fff;
  border-color: transparent;
  background: var(--blue);
}

.auth-form {
  display: grid;
  gap: 16px;
}

.auth-form label,
.config-card label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.auth-form input,
.config-card input,
.config-card textarea,
.config-toolbar select,
.points-input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
}

.config-card textarea {
  min-height: 84px;
  padding: 10px 12px;
  resize: vertical;
}

.auth-tip,
.form-message {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.admin-page {
  min-height: 100vh;
  background: #f7fbff;
}

.admin-header nav {
  display: flex;
  gap: 18px;
  color: #31527f;
  font-weight: 800;
}

.admin-shell {
  width: min(1180px, calc(100vw - 48px));
  margin: 34px auto 60px;
}

.admin-title h1 {
  margin: 0 0 8px;
  font-size: 36px;
}

.admin-title p {
  margin: 0 0 24px;
  color: var(--muted);
}

.admin-panel {
  margin: 18px 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow);
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 14px;
}

.ledger-list {
  display: grid;
  gap: 10px;
}

.ledger-item {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

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

.config-toolbar h2 {
  margin: 0;
}

.config-list {
  display: grid;
  gap: 16px;
}

.config-card {
  display: grid;
  grid-template-columns: 1fr 1.2fr 0.9fr;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--soft);
}

.config-card .wide {
  grid-column: 1 / -1;
}

.config-card footer {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.redeem-admin-form {
  display: grid;
  grid-template-columns: 180px 180px auto;
  align-items: end;
  gap: 14px;
  margin-bottom: 18px;
}

.redeem-admin-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.generated-codes {
  display: grid;
  gap: 10px;
  margin: 0 0 18px;
}

.generated-code {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid #cfe0ff;
  border-radius: 12px;
  color: #16315c;
  background: #f4f8ff;
  font-weight: 800;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: #edf5ff;
  color: #2572ff;
  font-weight: 800;
}

.status-pill.used {
  color: #69758b;
  background: #eef2f7;
}

@media (max-width: 1200px) {
  .hero-section {
    grid-template-columns: 1fr;
    padding-inline: 46px;
  }

  .hero-copy h1,
  .hero-copy p {
    white-space: normal;
  }

  .tool-grid {
    grid-template-columns: repeat(3, minmax(220px, 1fr));
  }
}

@media (max-width: 800px) {
  .home-main {
    min-height: auto;
    display: block;
  }

  .topbar,
  .admin-header {
    height: auto;
    padding: 18px;
    align-items: flex-start;
    gap: 16px;
    flex-direction: column;
  }

  .account-bar {
    flex-wrap: wrap;
  }

  .hero-section {
    grid-template-columns: 1fr;
    padding: 36px 24px 20px;
  }

  .hero-copy h1 {
    font-size: clamp(40px, 12vw, 56px);
  }

  .hero-copy p {
    font-size: 18px;
  }

  .tool-section {
    width: min(100% - 32px, 520px);
  }

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

  .config-card {
    grid-template-columns: 1fr;
  }

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