:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --ink: #1d2433;
  --muted: #667085;
  --line: #d9dee8;
  --panel: #ffffff;
  --accent: #ffcf33;
  --accent-dark: #176b57;
  --accent-soft: #fff4bf;
  --blue: #2e6eea;
  --shadow: 0 12px 32px rgba(27, 36, 51, .08);
}

* {
  box-sizing: border-box;
}

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

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 clamp(18px, 4vw, 56px);
  background: rgba(255, 255, 255, .88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  font-size: 19px;
}

.logo-mark {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: #10201c;
  background: linear-gradient(135deg, #ffcf33 0%, #84e4c7 100%);
  font-size: 13px;
  box-shadow: 0 8px 20px rgba(31, 111, 91, .16);
}

nav {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--muted);
  font-size: 14px;
}

.credits {
  color: var(--accent-dark);
  font-weight: 800;
}

.primary-link {
  color: var(--accent-dark);
  font-weight: 800;
}

.home,
.auth,
.workspace,
.history {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  min-height: calc(100vh - 122px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 70px 0 58px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-dark);
  font-weight: 900;
  letter-spacing: 0;
}

h1,
h2 {
  margin: 0;
  line-height: 1.05;
}

.hero h1 {
  font-size: clamp(56px, 9vw, 112px);
}

.subhead {
  max-width: 720px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 20px;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 30px;
}

.button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  padding: 0 20px;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.button.primary {
  color: #101828;
  background: var(--accent);
}

.button.secondary {
  color: var(--ink);
  background: #e9edf5;
}

.auth {
  min-height: calc(100vh - 64px);
  display: grid;
  place-items: center;
  padding: 36px 0;
}

.panel,
.creator,
.result-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel {
  width: min(420px, 100%);
  padding: 28px;
}

.panel h1 {
  margin-bottom: 24px;
  font-size: 30px;
}

label {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  color: #344054;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

textarea {
  resize: vertical;
}

.switch,
.error,
.notice,
.empty,
.status {
  color: var(--muted);
  line-height: 1.6;
}

.code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 128px;
  gap: 10px;
  align-items: end;
}

.code-row label {
  margin-bottom: 0;
}

.code-row .button {
  min-height: 47px;
  padding: 0 12px;
}

.error {
  color: #c0362c;
  font-weight: 800;
}

.notice {
  color: #087443;
  font-weight: 800;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 440px);
  gap: 18px;
  padding: 28px 0 50px;
}

.creator,
.result-panel {
  padding: 22px;
  box-shadow: none;
}

.section-head {
  margin-bottom: 22px;
}

.section-head h1 {
  font-size: clamp(30px, 4.4vw, 48px);
}

.section-head h2 {
  font-size: 26px;
}

.compact {
  margin-bottom: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.creator-form .button {
  width: 100%;
}

.reference-strip {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

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

.reference-card {
  overflow: hidden;
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.reference-card:hover {
  border-color: #9fcfbd;
  background: #fbfefd;
}

.reference-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
}

.reference-card span {
  min-height: 34px;
  display: flex;
  align-items: center;
  font-size: 13px;
  line-height: 1.35;
}

.status {
  min-height: 52px;
  display: flex;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fafc;
}

.result-grid {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.result-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.result-card img {
  display: block;
  width: 100%;
}

.download {
  width: 100%;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: #f8fbfa;
  color: var(--accent-dark);
}

.history {
  padding: 36px 0 60px;
}

.history-list {
  display: grid;
  gap: 14px;
}

.history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 18px;
  align-items: center;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.history-item p {
  color: var(--muted);
  line-height: 1.6;
}

.history-item span {
  color: var(--accent-dark);
  font-weight: 800;
}

.history-item img {
  width: 180px;
  max-height: 180px;
  object-fit: cover;
  border-radius: 8px;
}

.footer {
  padding: 22px 16px 28px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.wechat-float {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
}

.wechat-thumb {
  width: 68px;
  min-height: 82px;
  display: grid;
  place-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 10px 30px rgba(27, 36, 51, .14);
}

.wechat-thumb img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 4px;
}

.wechat-thumb span {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 900;
}

.wechat-pop {
  position: absolute;
  right: 0;
  bottom: 92px;
  width: 190px;
  display: grid;
  gap: 8px;
  justify-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  box-shadow: 0 18px 46px rgba(27, 36, 51, .18);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity .18s ease, transform .18s ease;
}

.wechat-pop img {
  width: 150px;
  height: 150px;
  object-fit: cover;
  border-radius: 6px;
}

.wechat-pop strong {
  font-size: 15px;
}

.wechat-pop span {
  color: var(--muted);
  font-size: 12px;
}

.wechat-float:hover .wechat-pop {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.admin {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.notice {
  padding: 12px 14px;
  border: 1px solid #b8ddca;
  border-radius: 8px;
  color: var(--accent-dark);
  background: #eefbf4;
  font-weight: 800;
}

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

.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.admin-stats div,
.admin-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.admin-stats div {
  padding: 18px;
}

.admin-stats strong {
  display: block;
  font-size: 30px;
}

.admin-stats span {
  color: var(--muted);
}

.admin-panel {
  margin-top: 18px;
  padding: 18px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
  font-size: 14px;
}

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

th {
  color: #344054;
  background: #f6f8fc;
}

.inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.inline-form input {
  width: 90px;
  margin: 0;
}

.inline-form .button {
  min-height: 38px;
}

@media (max-width: 860px) {
  .topbar {
    height: auto;
    min-height: 64px;
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  nav {
    flex-wrap: wrap;
  }

  .hero,
  .workspace,
  .history-item,
  .admin-stats {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
    padding-top: 32px;
  }

  .history-item img {
    width: 100%;
    max-height: none;
  }

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

@media (max-width: 520px) {
  .home,
  .auth,
  .workspace,
  .history {
    width: min(100% - 20px, 1180px);
  }

  .hero h1 {
    font-size: 44px;
  }

  .subhead {
    font-size: 17px;
  }

  .hero-actions,
  .form-grid,
  .code-row {
    display: grid;
    grid-template-columns: 1fr;
  }

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

  .wechat-float {
    right: 12px;
    bottom: 12px;
  }

  .wechat-thumb {
    width: 58px;
    min-height: 70px;
  }

  .wechat-thumb img {
    width: 40px;
    height: 40px;
  }
}
