:root {
  --ink: #21192b;
  --muted: #6e6575;
  --paper: #fffdf9;
  --panel: rgba(255,255,255,.88);
  --line: #e9e1ea;
  --accent: #7b4ce2;
  --accent-dark: #5632b9;
  --soft: #f5efff;
  --success: #1d7b57;
  --danger: #a93b55;
  --shadow: 0 24px 70px rgba(44, 25, 59, .11);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 12% 4%, rgba(255, 221, 238, .75), transparent 28rem),
    radial-gradient(circle at 90% 18%, rgba(221, 213, 255, .7), transparent 30rem),
    linear-gradient(180deg, #fffaf8 0%, #f8f5ff 56%, #fffdf9 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.site-header {
  width: min(1480px, calc(100% - 40px));
  margin: 0 auto;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(80, 55, 100, .08);
}
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; font-weight: 780; letter-spacing: -.02em; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 12px; color: white; background: linear-gradient(135deg, #f075a3, #744de1); box-shadow: 0 10px 30px rgba(116, 77, 225, .25); }
.header-badge, .format-pill, .status-badge { border: 1px solid var(--line); background: rgba(255,255,255,.7); border-radius: 999px; padding: 8px 12px; font-size: 12px; font-weight: 750; }
.status-live { color: var(--success); border-color: rgba(29,123,87,.25); background: rgba(232,250,243,.9); }
.status-off { color: #7f5c1f; border-color: rgba(127,92,31,.22); background: #fff9e8; }
.status-checking { color: var(--muted); }

.page-shell { width: min(1480px, calc(100% - 40px)); margin: 0 auto; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 50px; align-items: end; padding: 58px 0 42px; }
.hero h1 { max-width: 900px; margin: 8px 0 18px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(42px, 5.4vw, 80px); line-height: .98; letter-spacing: -.045em; font-weight: 600; }
.hero-copy { max-width: 780px; margin: 0; color: var(--muted); font-size: 18px; line-height: 1.65; }
.eyebrow { margin: 0; color: var(--accent); font-size: 12px; font-weight: 850; letter-spacing: .15em; text-transform: uppercase; }
.privacy-note { padding: 24px; border: 1px solid rgba(100,70,120,.12); border-radius: 24px; background: rgba(255,255,255,.68); box-shadow: 0 18px 40px rgba(70,45,80,.06); }
.privacy-note strong, .privacy-note span { display: block; }
.privacy-note span { margin-top: 7px; color: var(--muted); font-size: 13px; line-height: 1.55; }

.builder { display: grid; grid-template-columns: minmax(0, 1.03fr) minmax(420px, .8fr); gap: 28px; align-items: start; }
.controls-panel, .preview-panel { border: 1px solid rgba(88, 58, 109, .12); border-radius: 30px; background: var(--panel); box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.controls-panel { padding: 28px; }
.preview-panel { position: sticky; top: 22px; padding: 26px; }
.panel-heading, .preview-topline { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.panel-heading h2, .preview-topline h2 { margin: 5px 0 0; font-size: 25px; letter-spacing: -.025em; }

.step-block { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--line); }
.step-title { display: flex; gap: 12px; align-items: center; margin-bottom: 17px; }
.step-title > span, .summary-icon { width: 31px; height: 31px; display: inline-grid; place-items: center; border-radius: 10px; background: var(--soft); color: var(--accent); font-weight: 850; font-size: 13px; }
.step-title h3 { margin: 0; font-size: 16px; }
.form-grid { display: grid; gap: 15px; }
.form-grid.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.full-width { grid-column: 1 / -1; }
label { display: grid; gap: 7px; color: var(--ink); font-size: 13px; font-weight: 720; }
label > span small, summary small { color: var(--muted); font-weight: 500; }
input:not([type="range"]):not([type="color"]):not([type="checkbox"]), select, textarea {
  width: 100%; border: 1px solid #ded4e2; border-radius: 13px; background: rgba(255,255,255,.92); color: var(--ink); padding: 12px 13px; outline: none; transition: border .15s, box-shadow .15s; }
textarea { resize: vertical; line-height: 1.48; }
input:focus, select:focus, textarea:focus { border-color: rgba(123,76,226,.55); box-shadow: 0 0 0 4px rgba(123,76,226,.1); }
input[type="range"] { width: 100%; accent-color: var(--accent); }
input[type="color"] { width: 100%; height: 42px; padding: 3px; border: 1px solid #ded4e2; border-radius: 10px; background: white; }

.primary-button, .secondary-button, .text-button { border: 0; border-radius: 13px; min-height: 45px; font-weight: 800; transition: transform .15s, box-shadow .15s, opacity .15s; }
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; width: 100%; margin-top: 15px; padding: 0 18px; color: white; background: linear-gradient(135deg, #8755eb, #6538ca); box-shadow: 0 13px 30px rgba(103,57,204,.24); }
.secondary-button { padding: 0 17px; color: var(--accent-dark); background: var(--soft); border: 1px solid #e4d8fa; }
.text-button { min-height: 34px; padding: 0; background: transparent; color: var(--danger); text-align: left; }
.primary-button:hover, .secondary-button:hover { transform: translateY(-1px); }
button:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.button-icon { font-size: 18px; }
.helper-text, .download-note { margin: 9px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.inline-actions { display: grid; grid-template-columns: 180px 1fr; gap: 12px; align-items: end; }
.compact-label select { min-height: 45px; }

summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
summary::-webkit-details-marker { display: none; }
.photo-inner, .design-controls { padding: 17px 0 2px 43px; }
.checkbox-row { display: flex; align-items: flex-start; grid-template-columns: auto 1fr; gap: 8px; margin: 11px 0; font-weight: 580; }
.checkbox-row input { margin-top: 2px; accent-color: var(--accent); }
.photo-inner input[type="file"] { width: 100%; padding: 10px; border: 1px dashed #d9cce3; border-radius: 12px; background: white; }
.design-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }

.canvas-frame { position: relative; margin-top: 18px; border-radius: 22px; overflow: hidden; background: #ece6f0; box-shadow: 0 22px 55px rgba(36, 20, 48, .18); }
#cardCanvas { display: block; width: 100%; height: auto; aspect-ratio: 2 / 3; background: #efe7f3; }
.loading-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px; text-align: center; color: white; background: rgba(28,18,38,.74); backdrop-filter: blur(6px); }
.loading-overlay[hidden] { display: none; }
.loading-overlay span { max-width: 290px; margin-top: 6px; color: rgba(255,255,255,.75); font-size: 12px; }
.spinner { width: 38px; height: 38px; margin-bottom: 14px; border: 3px solid rgba(255,255,255,.25); border-top-color: white; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.notice { min-height: 18px; margin-top: 12px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.notice.error { color: var(--danger); }
.notice.success { color: var(--success); }
.download-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin-top: 10px; }
.download-actions .primary-button { margin-top: 0; }

.how-it-works { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 30px 0 48px; }
.how-it-works > div { padding: 22px; border: 1px solid rgba(88,58,109,.1); border-radius: 20px; background: rgba(255,255,255,.62); }
.how-it-works span { color: var(--accent); font-size: 12px; font-weight: 850; }
.how-it-works strong { display: block; margin-top: 10px; font-size: 16px; }
.how-it-works p { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.site-footer { width: min(1480px, calc(100% - 40px)); margin: 0 auto; padding: 22px 0 34px; border-top: 1px solid rgba(80,55,100,.1); display: flex; justify-content: space-between; gap: 20px; color: var(--muted); font-size: 12px; }

@media (max-width: 1050px) {
  .hero { grid-template-columns: 1fr; gap: 22px; }
  .privacy-note { max-width: 520px; }
  .builder { grid-template-columns: 1fr; }
  .preview-panel { position: static; max-width: 720px; width: 100%; margin: 0 auto; }
  .how-it-works { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .site-header, .page-shell, .site-footer { width: min(100% - 24px, 1480px); }
  .header-badge { display: none; }
  .hero { padding: 38px 0 28px; }
  .hero h1 { font-size: clamp(40px, 13vw, 58px); }
  .hero-copy { font-size: 16px; }
  .controls-panel, .preview-panel { padding: 18px; border-radius: 22px; }
  .panel-heading { display: grid; }
  .form-grid.two-col, .design-controls, .inline-actions, .download-actions, .how-it-works { grid-template-columns: 1fr; }
  .full-width { grid-column: auto; }
  .photo-inner, .design-controls { padding-left: 0; }
  .site-footer { flex-direction: column; }
}

.privacy-hero { grid-template-columns: 1fr; max-width: 900px; }
.privacy-card { max-width: 900px; margin-bottom: 60px; }

.payment-card {
  margin-top: 16px;
  padding: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  border: 1px solid #e1d5f4;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(248,244,255,.96), rgba(255,250,245,.96));
}
.payment-copy { display: grid; gap: 4px; }
.payment-kicker { color: var(--accent); font-size: 10px; letter-spacing: .12em; font-weight: 900; }
.payment-copy strong { font-size: 13px; line-height: 1.45; }
.payment-copy small { color: var(--muted); font-size: 11px; line-height: 1.45; }
.payment-actions { min-width: 152px; display: grid; gap: 8px; justify-items: stretch; }
.credit-badge { display: inline-flex; justify-content: center; align-items: center; min-height: 31px; padding: 0 10px; border-radius: 999px; background: white; border: 1px solid var(--line); color: var(--muted); font-size: 11px; font-weight: 800; }
.credit-badge.has-credit { color: var(--success); border-color: rgba(29,123,87,.25); background: rgba(232,250,243,.9); }
.purchase-button { min-height: 40px; padding: 0 13px; border: 1px solid #decff9; border-radius: 12px; background: white; color: var(--accent-dark); font-weight: 850; box-shadow: 0 8px 20px rgba(86,50,185,.08); }
.purchase-button:hover:not(:disabled) { transform: translateY(-1px); }

@media (max-width: 640px) {
  .payment-card { grid-template-columns: 1fr; }
  .payment-actions { min-width: 0; }
}
