﻿:root {
  --bg: #f5f7fb;
  --panel: rgba(255, 255, 255, 0.94);
  --panel-strong: rgba(255, 255, 255, 0.99);
  --line: rgba(29, 41, 87, 0.11);
  --text: #1b2238;
  --muted: #7580a1;
  --accent: #3d4ce3;
  --accent-2: #8b68ff;
  --shadow: 0 20px 54px rgba(28, 36, 72, 0.12);
  --desktop-top-row: 176px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 15%, rgba(61, 76, 227, 0.08), transparent 22%),
    radial-gradient(circle at 85% 15%, rgba(139, 104, 255, 0.08), transparent 18%),
    linear-gradient(180deg, #f6f8fd 0%, #eef2f9 100%);
}

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

.app-shell {
  width: min(1600px, calc(100% - 36px));
  margin: 0 auto;
  padding: 20px 0;
  display: grid;
  grid-template-columns: 392px minmax(0, 1fr);
  gap: 20px;
  min-height: calc(100vh - 40px);
  height: calc(100vh - 40px);
  align-items: stretch;
}

.control-panel,
.preview-panel {
  display: grid;
  min-height: 0;
}

.control-panel {
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
  overflow: hidden;
}

.preview-panel {
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
}

.brand-block,
.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  border-radius: 26px;
}

.brand-block {
  padding: 20px 22px;
  min-height: var(--desktop-top-row);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.brand-block h1,
.preview-hero h2,
.marketing-copy h2 {
  margin: 0;
  letter-spacing: -0.04em;
}

.brand-block h1 {
  font-size: clamp(26px, 2.2vw, 34px);
  line-height: 1.06;
  text-wrap: balance;
  word-break: keep-all;
}

.hero-copy {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.8;
  max-width: 36ch;
}

.panel {
  padding: 18px;
  min-height: 0;
}

.control-panel > .panel {
  overflow: auto;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.panel-title h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.panel-title p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.auth-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.auth-state h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.auth-state p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.wechat-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 116px;
  padding: 12px 18px;
  border-radius: 16px;
  background: linear-gradient(135deg, #07c160, #2ad36f);
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 12px 28px rgba(7, 193, 96, 0.18);
}

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

.selection-stack {
  display: grid;
  gap: 8px;
}

.selection-title {
  font-size: 13px;
  font-weight: 700;
  color: #24304d;
}

.full-span {
  grid-column: 1 / -1;
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

label span {
  font-size: 13px;
  font-weight: 700;
  color: #24304d;
}

.upload-box {
  min-height: 82px;
  border-radius: 20px;
  border: 1.5px dashed rgba(61, 76, 227, 0.22);
  background: linear-gradient(180deg, #fff, #f9fbff);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 14px;
  cursor: pointer;
  transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
  margin-bottom: 2px;
}

.upload-box.dragging {
  border-color: rgba(61, 76, 227, 0.55);
  box-shadow: 0 0 0 4px rgba(61, 76, 227, 0.08);
  transform: translateY(-1px);
}

.upload-box.is-disabled {
  cursor: not-allowed;
  opacity: 0.62;
  border-style: solid;
}

.upload-title {
  display: block;
  font-weight: 800;
  font-size: 15px;
  margin-bottom: 4px;
}

.upload-subtitle {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.clear-image-button {
  border: 1px solid rgba(220, 38, 38, 0.18);
  background: rgba(220, 38, 38, 0.06);
  color: #b91c1c;
  border-radius: 14px;
  padding: 10px 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.upload-preview-list {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px;
}

.upload-preview-item {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(61, 76, 227, 0.14);
  background: #eef2ff;
}

.upload-preview-item img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.upload-preview-item span,
.upload-preview-item button {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
}

.upload-preview-item span {
  left: 6px;
  bottom: 6px;
  width: 22px;
  height: 22px;
  background: rgba(255, 255, 255, 0.9);
  color: #24304d;
}

.upload-preview-item button {
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border: 0;
  background: rgba(220, 38, 38, 0.88);
  color: #fff;
  cursor: pointer;
}

input,
select,
textarea {
  border: 1px solid rgba(61, 76, 227, 0.16);
  border-radius: 16px;
  padding: 12px 14px;
  background: var(--panel-strong);
  color: var(--text);
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(61, 76, 227, 0.36);
  box-shadow: 0 0 0 4px rgba(61, 76, 227, 0.08);
}

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

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

.ratio-group-expanded {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.ratio-btn,
.resolution-btn {
  border: 1px solid rgba(61, 76, 227, 0.16);
  background: #fff;
  color: #27314f;
  border-radius: 16px;
  padding: 12px 10px;
  min-height: 62px;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 5px;
  text-align: left;
}

.ratio-btn.active,
.resolution-btn.active {
  border-color: rgba(61, 76, 227, 0.55);
  box-shadow: 0 0 0 4px rgba(61, 76, 227, 0.08);
  background: rgba(61, 76, 227, 0.06);
}

.ratio-title {
  font-size: 15px;
  font-weight: 800;
}

.ratio-note {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

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

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

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

.quality-btn {
  border: 1px solid rgba(61, 76, 227, 0.16);
  background: #fff;
  color: #27314f;
  border-radius: 16px;
  padding: 14px 12px;
  min-height: 68px;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 6px;
  text-align: left;
}

.quality-btn.active {
  border-color: rgba(61, 76, 227, 0.55);
  box-shadow: 0 0 0 4px rgba(61, 76, 227, 0.08);
  background: rgba(61, 76, 227, 0.06);
}

.quality-title {
  font-size: 15px;
  font-weight: 800;
}

.quality-note {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.action-button {
  border: 0;
  border-radius: 16px;
  padding: 13px 18px;
  cursor: pointer;
  transition: transform 180ms ease, opacity 180ms ease, box-shadow 180ms ease;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  font-weight: 800;
  box-shadow: 0 12px 28px rgba(61, 76, 227, 0.22);
}

.preview-hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 20px 24px;
}

.preview-hero h2 {
  margin: 2px 0 0;
  font-size: clamp(30px, 2.8vw, 48px);
  line-height: 1.04;
}

.preview-hero-simple .eyebrow {
  margin-bottom: 6px;
}

.preview-stage {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
  padding: 18px;
}

.preview-stage-only {
  height: 100%;
}

.result-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(244, 247, 255, 0.96));
  padding: 18px 20px;
}

.history-panel {
  flex: 0 0 auto;
  border-radius: 18px;
  border: 1px solid rgba(61, 76, 227, 0.1);
  background: rgba(255, 255, 255, 0.76);
  padding: 12px;
}

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

.history-head strong {
  font-size: 14px;
  color: #24304d;
}

.history-head span {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.history-list {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.history-item {
  flex: 0 0 104px;
  height: 76px;
  border: 1px solid rgba(61, 76, 227, 0.14);
  border-radius: 14px;
  padding: 0;
  position: relative;
  overflow: hidden;
  background: #fff;
  cursor: pointer;
}

.history-item img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.history-item span {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: #24304d;
  font-size: 11px;
  font-weight: 800;
}

.history-empty {
  min-height: 58px;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.stage-frame {
  position: relative;
  flex: 0 0 auto;
  width: min(100%, 1020px);
  aspect-ratio: 16 / 9;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.stage-frame[data-ratio="portrait"] {
  width: auto;
  max-width: min(100%, 400px);
  height: 100%;
  max-height: 100%;
  aspect-ratio: 9 / 16;
}

.stage-frame[data-ratio="square"] {
  width: min(100%, 680px);
  aspect-ratio: 1 / 1;
}

.stage-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: inherit;
}

.stage-image[data-ratio="portrait"],
.stage-image[data-ratio="landscape"] {
  object-position: center center;
}

.stage-download {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 82px;
  padding: 10px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.86);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  color: var(--text);
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
  box-shadow: 0 14px 34px rgba(16, 24, 40, 0.2);
  pointer-events: auto;
}

.stale-preview-banner {
  position: absolute;
  left: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: min(560px, calc(100% - 36px));
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(220, 38, 38, 0.9);
  color: #fff;
  box-shadow: var(--shadow);
  z-index: 3;
}

.stale-preview-banner strong {
  font-size: 14px;
  line-height: 1.2;
}

.stale-preview-banner span {
  font-size: 12px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.9);
}

.result-stage.empty {
  border: 1px dashed rgba(61, 76, 227, 0.18);
}

.progress-shell {
  width: min(720px, 100%);
  padding: 28px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(245, 247, 255, 0.96));
  box-shadow: var(--shadow);
}

.progress-head,
.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.progress-badge {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.progress-title {
  margin: 18px 0 8px;
  font-size: 34px;
  letter-spacing: -0.04em;
}

.progress-copy {
  margin: 0 0 20px;
  color: var(--muted);
  line-height: 1.7;
}

.progress-track {
  position: relative;
  height: 16px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(61, 76, 227, 0.08);
}

.progress-bar {
  position: relative;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 180ms linear;
  z-index: 2;
}

.progress-glow {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(61, 76, 227, 0.12), rgba(139, 104, 255, 0.12));
  filter: blur(18px);
}

.progress-meta {
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
}

.result-placeholder {
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
    min-height: auto;
    height: auto;
  }

  .control-panel,
  .preview-panel {
    display: flex;
    flex-direction: column;
    gap: 18px;
  }

  .auth-state {
    align-items: flex-start;
    flex-direction: column;
  }

  .preview-stage {
    min-height: 420px;
  }

  .stage-frame[data-ratio="portrait"] {
    max-width: min(100%, 360px);
  }

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

}

@media (min-width: 1121px) {
  body {
    overflow: hidden;
  }

  .result-stage {
    height: 100%;
  }
}

@media (min-width: 1121px) and (max-height: 900px) {
  .app-shell {
    padding: 14px 0;
    min-height: calc(100vh - 28px);
    height: calc(100vh - 28px);
  }

  .brand-block {
    padding: 16px 20px;
    min-height: 150px;
  }

  .hero-copy {
    line-height: 1.55;
  }

  .control-panel {
    gap: 12px;
  }

  .control-panel > .panel {
    padding: 14px;
  }

  .form-grid {
    gap: 8px;
  }

  .upload-box {
    min-height: 70px;
    padding: 10px;
  }

  textarea {
    min-height: 112px;
  }

  .ratio-btn,
  .resolution-btn {
    min-height: 54px;
    padding: 9px 8px;
  }

  .action-button {
    padding: 11px 16px;
  }
}

.card-shell {
  grid-template-columns: 420px minmax(0, 1fr);
}

.brand-block-card {
  padding-bottom: 18px;
}

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

.compact-title h2 {
  margin-bottom: 8px;
}

.redeem-grid {
  gap: 10px;
}

.card-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(61, 76, 227, 0.08), rgba(61, 76, 227, 0.03));
  border: 1px solid rgba(61, 76, 227, 0.12);
}

.card-status strong {
  display: block;
  margin-bottom: 6px;
  font-size: 16px;
}

.card-status p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 13px;
}

.empty-status {
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.09), rgba(148, 163, 184, 0.03));
  border-color: rgba(148, 163, 184, 0.18);
}

.credit-pill {
  flex: 0 0 auto;
  min-width: 92px;
  text-align: center;
  padding: 12px 14px;
  border-radius: 999px;
  background: #fff;
  font-weight: 800;
  box-shadow: var(--shadow);
}

.inline-message {
  min-height: 20px;
  margin: 0;
  color: #1d4ed8;
  font-size: 13px;
}

.inline-message.error {
  color: #dc2626;
}

.preview-card-top {
  gap: 8px;
}

.preview-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.card-preview-stage {
  gap: 16px;
}

.contact-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 18px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(61, 76, 227, 0.12);
  background: linear-gradient(135deg, rgba(61, 76, 227, 0.06), rgba(255, 255, 255, 0.9));
}

.contact-copy h3 {
  margin: 0 0 10px;
  font-size: 24px;
}

.contact-copy p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.7;
}

.price-list {
  margin: 0 0 12px;
  padding-left: 18px;
  color: #24304d;
  line-height: 1.8;
}

.contact-hint {
  font-size: 13px;
}

.contact-qrcode-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 700;
  color: #24304d;
}

.contact-qrcode {
  width: 180px;
  height: 180px;
  object-fit: cover;
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.cards-page {
  width: min(1320px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 28px;
}

.cards-hero {
  margin-bottom: 18px;
}

.cards-hero-admin {
  padding: 22px 24px;
}

.cards-grid {
  display: grid;
  grid-template-columns: 420px minmax(0, 1fr);
  gap: 20px;
}

.cards-form-panel,
.cards-result-panel {
  min-height: 320px;
}

.price-summary {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(61, 76, 227, 0.08);
  font-weight: 800;
  color: #24304d;
}

.issued-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(61, 76, 227, 0.12);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(244, 247, 255, 0.95));
  min-height: 170px;
}

.empty-issued {
  place-items: center;
  display: grid;
}

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

.issued-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid rgba(61, 76, 227, 0.08);
  padding-bottom: 10px;
}

.issued-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.issued-row span {
  color: var(--muted);
}

.issued-row strong {
  font-size: 18px;
}

.issued-codes {
  margin-top: 2px;
}

.issued-actions {
  display: flex;
  justify-content: flex-start;
}

.copy-card-button {
  min-width: 160px;
}

.issued-codes-textarea {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  font-family: "Consolas", "JetBrains Mono", monospace;
  font-size: 13px;
  line-height: 1.7;
  background: #fff;
}

.cards-history-panel {
  margin-top: 20px;
}

.cards-search-panel {
  margin-top: 20px;
}

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

.card-search-form .ghost-button {
  margin-top: 0;
  white-space: nowrap;
}

.card-search-result {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.card-search-card {
  border: 1px solid rgba(61, 76, 227, 0.12);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 247, 255, 0.96));
  border-radius: 18px;
  padding: 16px;
}

.card-search-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 12px;
}

.card-search-head strong {
  display: block;
  margin-bottom: 6px;
  font-size: 17px;
}

.card-search-head span,
.card-search-meta span {
  color: var(--muted);
  font-size: 13px;
}

.card-search-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.card-history-block {
  margin-top: 18px;
  border-top: 1px solid rgba(61, 76, 227, 0.1);
  padding-top: 16px;
}

.card-history-block summary {
  cursor: pointer;
  width: fit-content;
  border: 1px solid rgba(61, 76, 227, 0.16);
  border-radius: 999px;
  background: rgba(61, 76, 227, 0.08);
  color: #24304d;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 900;
}

.card-history-block[open] summary {
  margin-bottom: 14px;
}

.card-history-block h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

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

.card-generation-item {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 16px;
  border: 1px solid rgba(61, 76, 227, 0.1);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.card-generation-images {
  display: grid;
  gap: 10px;
}

.card-generation-images a {
  display: block;
  color: inherit;
  text-decoration: none;
}

.card-generation-images img {
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  border-radius: 14px;
  background: #eef2ff;
  border: 1px solid rgba(61, 76, 227, 0.1);
}

.reference-thumb span {
  display: inline-block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.card-generation-detail {
  min-width: 0;
}

.card-generation-detail > strong {
  display: block;
  margin-bottom: 10px;
  font-size: 15px;
}

.prompt-box {
  margin: 10px 0;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.04);
  padding: 10px 12px;
}

.prompt-box span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.prompt-box p {
  margin: 0;
  color: #1f2937;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.revised-prompt-box {
  background: rgba(20, 184, 166, 0.08);
}

.card-generation-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  margin-top: 12px;
}

.card-generation-meta span {
  color: var(--muted);
  font-size: 12px;
  word-break: break-word;
}

.danger-button {
  border: 1px solid rgba(220, 38, 38, 0.24);
  background: rgba(220, 38, 38, 0.08);
  color: #b91c1c;
  border-radius: 14px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 800;
}

.danger-button:hover {
  background: rgba(220, 38, 38, 0.14);
}

.danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

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

.issue-history-card {
  border: 1px solid rgba(61, 76, 227, 0.12);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(244, 247, 255, 0.95));
  border-radius: 20px;
  padding: 18px;
}

.issue-history-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}

.issue-history-head strong {
  display: block;
  margin-bottom: 6px;
  font-size: 17px;
}

.issue-history-head span {
  color: var(--muted);
  font-size: 13px;
}

.issue-history-head b {
  font-size: 16px;
  color: #24304d;
}

.ghost-button {
  margin-top: 14px;
  border: 1px solid rgba(61, 76, 227, 0.2);
  background: #fff;
  color: #24304d;
  border-radius: 16px;
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 700;
}

.ghost-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.cards-footer-nav {
  margin-top: 18px;
}

.cards-footer-nav a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}

@media (max-width: 1120px) {
  .card-shell,
  .cards-grid,
  .contact-card {
    grid-template-columns: 1fr;
  }

  .contact-qrcode-wrap {
    align-items: flex-start;
  }

  .contact-qrcode {
    width: 160px;
    height: 160px;
  }

  .card-status {
    flex-direction: column;
    align-items: flex-start;
  }

  .issue-history-head {
    flex-direction: column;
  }

  .card-generation-item,
  .card-generation-meta,
  .card-search-meta {
    grid-template-columns: 1fr;
  }
}


.preview-panel-card-layout {
  grid-template-rows: auto minmax(0, 1fr);
}

.preview-topbar-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 540px);
  gap: 24px;
  align-items: start;
  min-height: var(--desktop-top-row);
}

.preview-topbar-main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100%;
}

.preview-title-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.history-open-button {
  width: auto;
  min-width: 104px;
  height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 247, 255, 0.92));
  box-shadow: 0 10px 24px rgba(28, 36, 72, 0.08);
}

.preview-card-entry {
  display: grid;
  gap: 10px;
  align-content: start;
}

.batch-enter-link {
  text-decoration: none;
}

.preview-card-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 98px 98px 98px;
  grid-template-areas: "input redeem cards batch";
  gap: 10px;
  align-items: center;
}

.preview-status-inline {
  min-height: 80px;
}

.card-code-field {
  min-width: 0;
  grid-area: input;
  height: 48px;
}

.compact-action,
.compact-ghost {
  width: 100%;
  margin-top: 0;
  height: 48px;
}

.preview-title-row .history-open-button {
  width: auto;
  min-width: 104px;
  height: 42px;
  margin-top: 0;
}

.compact-action { grid-area: redeem; }

#togglePurchaseButton { grid-area: cards; }

.batch-enter-link { grid-area: batch; }

.card-status {
  padding: 14px 16px;
}

.card-status strong {
  margin-bottom: 4px;
}

.card-status p {
  font-size: 12px;
}

.credit-pill {
  min-width: 84px;
  padding: 10px 12px;
}

.purchase-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
}

.hidden-modal {
  display: none;
}

.purchase-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(13, 18, 35, 0.48);
  backdrop-filter: blur(6px);
}

.purchase-dialog {
  position: relative;
  z-index: 1;
  width: min(880px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow: auto;
  border-radius: 32px;
  border: 1px solid rgba(61, 76, 227, 0.12);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 30px 80px rgba(16, 24, 40, 0.24);
  padding: 28px;
}

.purchase-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(61, 76, 227, 0.08);
  color: #24304d;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}

.purchase-dialog-copy h3 {
  margin: 0 0 10px;
  font-size: clamp(30px, 4vw, 42px);
  letter-spacing: -0.04em;
}

.purchase-dialog-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.purchase-dialog-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 22px;
  align-items: center;
  margin-top: 22px;
}

.purchase-dialog-box {
  min-height: 100%;
}

.purchase-contact-dialog {
  align-items: center;
}

.pricing-box {
  padding: 20px 22px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(61, 76, 227, 0.08), rgba(61, 76, 227, 0.03));
  border: 1px solid rgba(61, 76, 227, 0.12);
}

.pricing-box strong {
  display: block;
  margin-bottom: 12px;
  font-size: 18px;
}

.pricing-note {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.7;
}

.compact-list {
  margin-bottom: 14px;
}

.compact-list li {
  margin-bottom: 8px;
}

.contact-hint {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.purchase-contact {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: #24304d;
  text-align: center;
}

.contact-qrcode {
  width: min(100%, 280px);
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border-radius: 24px;
  box-shadow: var(--shadow);
  background: #fff;
  padding: 10px;
}

.history-dialog {
  width: min(1040px, calc(100vw - 32px));
  padding: 28px;
}

.history-dialog-list {
  display: grid;
  gap: 14px;
  margin-top: 22px;
  max-height: min(66vh, 720px);
  overflow: auto;
  padding-right: 6px;
}

.history-dialog-empty {
  min-height: 180px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(61, 76, 227, 0.2);
  border-radius: 22px;
  background: rgba(61, 76, 227, 0.04);
  text-align: center;
}

.history-record-card {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  padding: 16px;
  border-radius: 24px;
  border: 1px solid rgba(61, 76, 227, 0.11);
  background:
    radial-gradient(circle at 12% 8%, rgba(61, 76, 227, 0.08), transparent 26%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 248, 255, 0.96));
}

.history-record-images {
  display: grid;
  gap: 10px;
  align-content: start;
}

.history-record-thumb,
.history-reference-thumb {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 18px;
  background: #eef2ff;
  border: 1px solid rgba(61, 76, 227, 0.11);
  color: inherit;
  text-decoration: none;
}

.history-record-thumb {
  aspect-ratio: 4 / 3;
}

.history-reference-thumb {
  aspect-ratio: 16 / 9;
}

.history-record-thumb img,
.history-reference-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.history-record-thumb span,
.history-reference-thumb span {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #24304d;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(16, 24, 40, 0.12);
}

.history-record-detail {
  min-width: 0;
}

.history-record-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.history-record-head strong {
  display: block;
  color: #24304d;
  font-size: 16px;
  line-height: 1.5;
}

.history-record-head a {
  flex: 0 0 auto;
  border: 1px solid rgba(61, 76, 227, 0.16);
  border-radius: 999px;
  padding: 8px 12px;
  background: #fff;
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  font-weight: 900;
}

.history-prompt-box {
  margin: 10px 0;
  padding: 11px 13px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.045);
}

.history-prompt-box span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.history-prompt-box p {
  margin: 0;
  color: #1f2937;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.history-revised-box {
  background: rgba(20, 184, 166, 0.08);
}

.history-record-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  margin-top: 12px;
}

.history-record-meta span {
  color: var(--muted);
  font-size: 12px;
  word-break: break-word;
}

.modal-open {
  overflow: hidden;
}

@media (max-width: 1120px) {
  .preview-topbar-card {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .preview-card-form,
  .purchase-dialog-grid {
    grid-template-columns: 1fr;
  }

  .preview-card-form {
    grid-template-areas:
      "input"
      "redeem"
      "cards"
      "batch";
  }

  .resolution-group {
    grid-template-columns: 1fr;
  }

  .purchase-contact-dialog {
    align-items: flex-start;
  }

  .history-dialog {
    padding: 22px;
  }

  .history-record-card,
  .history-record-meta {
    grid-template-columns: 1fr;
  }

  .history-record-images {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

@media (max-width: 1320px) and (min-width: 1121px) {
  .app-shell {
    grid-template-columns: 372px minmax(0, 1fr);
  }

  .preview-topbar-card {
    grid-template-columns: minmax(0, 1fr) 420px;
    gap: 18px;
  }
}

.batch-page {
  width: min(1720px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 28px;
}

.batch-hero {
  margin-bottom: 18px;
  padding: 22px 24px;
}

.batch-hero-nav {
  display: flex;
  gap: 14px;
  margin-bottom: 12px;
}

.batch-toolbar {
  display: grid;
  gap: 18px;
  margin-bottom: 20px;
}

.batch-toolbar-copy h2 {
  margin: 0 0 8px;
  font-size: 24px;
}

.batch-toolbar-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.batch-toolbar-grid {
  display: grid;
  gap: 14px;
}

.batch-redeem-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px 140px;
  gap: 10px;
  align-items: center;
}

.batch-global-controls {
  display: grid;
  gap: 12px;
}

.batch-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.batch-action-buttons {
  display: flex;
  gap: 10px;
}

.batch-ghost-button,
.batch-run-button {
  min-width: 140px;
}

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

.batch-task-card {
  display: grid;
  gap: 12px;
  align-content: start;
}

.batch-task-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.batch-task-title {
  font-size: 18px;
  color: #24304d;
}

.batch-task-badge {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
  color: #51607f;
  font-size: 12px;
  font-weight: 800;
}

.batch-task-card[data-status="running"] .batch-task-badge {
  background: rgba(59, 130, 246, 0.14);
  color: #1d4ed8;
}

.batch-task-card[data-status="done"] .batch-task-badge {
  background: rgba(34, 197, 94, 0.14);
  color: #15803d;
}

.batch-task-card[data-status="error"] .batch-task-badge {
  background: rgba(220, 38, 38, 0.12);
  color: #b91c1c;
}

.batch-upload-box {
  min-height: 112px;
}

.batch-clear-button {
  margin-top: -4px;
}

.batch-preview-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.batch-mini-frame {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: rgba(61, 76, 227, 0.06);
  border: 1px solid rgba(61, 76, 227, 0.12);
}

.batch-mini-frame[data-ratio="portrait"] {
  aspect-ratio: 9 / 16;
}

.batch-mini-frame[data-ratio="square"] {
  aspect-ratio: 1 / 1;
}

.batch-mini-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.batch-task-error {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(220, 38, 38, 0.08);
  color: #b91c1c;
  font-size: 13px;
  line-height: 1.6;
}

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

@media (max-width: 1120px) {
  .batch-redeem-form,
  .batch-action-row {
    grid-template-columns: 1fr;
  }

  .batch-action-buttons {
    width: 100%;
    flex-direction: column;
  }

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