:root {
  --bg: #f6f4ee;
  --panel: #ffffff;
  --ink: #151a18;
  --muted: #616a66;
  --line: #d8ded8;
  --green: #0c6a4d;
  --blue: #275d84;
  --yellow: #f2c94c;
  --red: #b33a32;
  --shadow: 0 14px 34px rgba(21, 26, 24, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  line-height: 1.55;
}

a {
  color: var(--green);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 244, 238, 0.94);
  backdrop-filter: blur(10px);
}

.nav,
.site-footer,
.hero,
.section,
.workspace {
  max-width: 1120px;
  margin: 0 auto;
  padding-left: 20px;
  padding-right: 20px;
}

.nav {
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand,
.nav-links,
.actions,
.inline-actions,
.history-meta,
.check-row {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  color: var(--ink);
  font-weight: 850;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--yellow);
}

.nav-links {
  gap: 14px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.inline-form {
  margin: 0;
}

.inline-form button {
  border: 0;
  background: transparent;
  color: var(--green);
  cursor: pointer;
  font: inherit;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  gap: 34px;
  padding-top: 68px;
  padding-bottom: 48px;
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  width: fit-content;
  margin: 0 0 14px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff8d7;
  color: #5d4c10;
  font-size: 0.86rem;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 16px;
  font-size: clamp(2.25rem, 6vw, 4.7rem);
  line-height: 1.08;
}

h2 {
  font-size: clamp(1.55rem, 3vw, 2.15rem);
}

.lead {
  max-width: 720px;
  color: var(--muted);
  font-size: 1.1rem;
}

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

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

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

.button:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
}

.prompt-preview,
.panel,
.auth-panel,
.card,
.history-card,
.stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.prompt-preview {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.preview-chip {
  width: fit-content;
  padding: 5px 9px;
  border-radius: 999px;
  background: #e9f5ef;
  color: var(--green);
  font-weight: 800;
}

.preview-arrow {
  color: var(--muted);
  font-size: 1.5rem;
}

.output-card {
  padding: 14px;
  border-radius: 8px;
  background: #f8faf8;
  color: var(--muted);
}

.section {
  padding-top: 44px;
  padding-bottom: 44px;
}

.section-head,
.workspace-head,
.output-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  margin-bottom: 22px;
}

.section-head p {
  max-width: 560px;
  color: var(--muted);
}

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

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.card,
.panel,
.history-card,
.stat {
  padding: 20px;
}

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

.auth-page {
  display: grid;
  min-height: calc(100vh - 130px);
  place-items: center;
  padding: 28px 20px;
}

.auth-panel {
  width: min(460px, 100%);
  padding: 30px;
}

.form {
  display: grid;
  gap: 15px;
}

.input-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 750;
}

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

textarea {
  min-height: 130px;
  resize: vertical;
}

.workspace {
  padding-top: 38px;
  padding-bottom: 46px;
}

.workspace-head h1 {
  font-size: clamp(1.8rem, 4vw, 3.1rem);
}

.quota-box {
  display: grid;
  min-width: 116px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  text-align: center;
}

.quota-box span {
  color: var(--muted);
  font-size: 0.85rem;
}

.quota-box strong {
  font-size: 2rem;
}

.quota-stack {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.price-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.price-card h3 {
  margin-bottom: 6px;
  font-size: 2rem;
}

.price-card strong {
  display: block;
  margin-bottom: 10px;
  color: var(--green);
  font-size: 1.35rem;
}

.pay-panel {
  display: grid;
  gap: 14px;
}

.payment-note {
  width: fit-content;
  max-width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--red);
  border-radius: 8px;
  background: #fff1ef;
  color: var(--red);
  font-size: clamp(1.25rem, 3vw, 1.8rem);
  font-weight: 900;
}

.payment-qr {
  width: min(280px, 100%);
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

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

.pay-steps span {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf8;
  color: var(--muted);
  font-weight: 750;
}

.generator-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(340px, 1.1fr);
  gap: 18px;
  align-items: start;
}

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

.check-row {
  grid-template-columns: auto 1fr;
  gap: 9px;
}

.check-row input {
  width: auto;
  min-height: auto;
}

.output-panel {
  display: grid;
  gap: 12px;
}

.result-editor {
  min-height: 460px;
  font-family: "SFMono-Regular", Consolas, monospace;
  line-height: 1.65;
}

.status-message {
  padding: 10px 12px;
  border-radius: 8px;
  background: #f2f5f1;
  color: var(--muted);
  font-weight: 700;
}

.status-message.success,
.alert.success {
  background: #e8f5ee;
  color: var(--green);
}

.status-message.warning {
  background: #fff4d5;
  color: #7a5c00;
}

.status-message.error,
.alert.error {
  background: #faecea;
  color: var(--red);
}

.alert {
  margin-bottom: 14px;
  padding: 11px 12px;
  border-radius: 8px;
}

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

.history-meta {
  gap: 9px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.85rem;
}

.history-card pre {
  max-height: 360px;
  overflow: auto;
  padding: 14px;
  border-radius: 8px;
  background: #f8faf8;
  white-space: pre-wrap;
}

.template-form {
  display: grid;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.template-form textarea {
  min-height: 220px;
  font-family: "SFMono-Regular", Consolas, monospace;
}

.stat span {
  display: block;
  color: var(--muted);
}

.stat strong {
  font-size: 2rem;
}

.stat-link {
  display: block;
  color: var(--ink);
  text-decoration: none;
}

.stat-link:hover {
  border-color: var(--green);
  text-decoration: none;
  transform: translateY(-1px);
}

.error-list {
  display: grid;
  gap: 8px;
  padding-left: 20px;
}

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

.data-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

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

.data-table th {
  color: var(--muted);
  font-size: 0.86rem;
}

.data-table td:first-child {
  font-weight: 800;
}

.table-action {
  font-weight: 800;
  white-space: nowrap;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding-top: 24px;
  padding-bottom: 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

@media (max-width: 860px) {
  .hero,
  .generator-layout,
  .grid,
  .pricing-grid,
  .pay-steps,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .section-head,
  .workspace-head,
  .output-head,
  .site-footer {
    display: grid;
  }
}

@media (max-width: 560px) {
  .nav {
    display: grid;
  }

  .nav-links {
    justify-content: start;
  }

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

  .input-action {
    grid-template-columns: 1fr;
  }

  .result-editor {
    min-height: 340px;
  }
}
