:root {
  --bg: #0c0c0e;
  --panel: #141417;
  --raise: #1c1c21;
  --line: #2a2a31;
  --line-hi: #3a3a44;
  --text: #f1f1f3;
  --muted: #9a9aa6;
  --accent: #ff5a1f;
  --accent-ink: #160800;
  --ok: #3ecf8e;
  --warn: #ffb020;
  --bad: #ff5d5d;
  --radius: 10px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 Barlow, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100svh;
}
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 6px 12px; border-radius: 6px; z-index: 10; }
.skip:focus { left: 8px; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 24px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5; background: rgb(12 12 14 / 0.92); backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 10px; font: 800 20px/1 "Saira Condensed", sans-serif; letter-spacing: 0.04em; text-transform: uppercase; }
.brand b { color: var(--accent); font-weight: 900; }
.brand-mark { width: 34px; height: 22px; }
.brand-mark rect { fill: var(--accent); }
.brand-mark path { fill: var(--bg); }
.spec { margin: 0 auto 0 0; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: minmax(340px, 400px) 1fr; min-height: calc(100svh - 61px); }
.panel { border-right: 1px solid var(--line); padding: 8px 20px 40px; overflow-y: auto; max-height: calc(100svh - 61px); position: sticky; top: 61px; }
.stage { padding: 20px 28px 32px; display: flex; flex-direction: column; gap: 18px; min-width: 0; }

/* ---------- controls ---------- */
.group { padding: 18px 0 20px; border-bottom: 1px solid var(--line); display: grid; gap: 12px; }
.group:last-child { border-bottom: 0; }
.group h2 { margin: 0 0 2px; display: flex; align-items: center; gap: 10px; font: 800 17px/1 "Saira Condensed", sans-serif; letter-spacing: 0.06em; text-transform: uppercase; }
.step { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--raise); border: 1px solid var(--line-hi); font: 700 12px/1 Barlow, sans-serif; color: var(--accent); }
label { display: grid; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted); }
.hint, em { font-weight: 400; font-style: normal; color: #6f6f7b; }
input:not([type=checkbox]):not([type=color]):not([type=file]), select, textarea {
  width: 100%; background: var(--raise); border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 11px; font-size: 15px; font-weight: 500; color: var(--text);
  transition: border-color .15s;
}
input::placeholder, textarea::placeholder { color: #5d5d68; }
input:hover, select:hover, textarea:hover { border-color: var(--line-hi); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; }
textarea { resize: vertical; min-height: 44px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 10px; align-items: end; }
.row .narrow { max-width: 84px; }
.row:has(.narrow) { grid-template-columns: 84px 1fr; }
.check { display: flex; align-items: center; gap: 9px; font-weight: 500; color: var(--text); font-size: 14px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); margin: 0; flex: none; }
.check.small { font-size: 13px; color: var(--muted); }

.colors { grid-template-columns: 1fr 1fr auto; }
.color { grid-template-columns: 1fr; }
.color input { width: 100%; height: 40px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: var(--raise); cursor: pointer; }

/* drop zones */
.drop {
  border: 1.5px dashed var(--line-hi); border-radius: var(--radius); padding: 12px 14px;
  background: var(--panel); cursor: pointer; transition: border-color .15s, background .15s;
  display: grid; gap: 10px;
}
.drop:hover, .drop.over { border-color: var(--accent); background: #1a1310; }
.drop-body { display: grid; gap: 2px; }
.drop-body strong { font-size: 14px; }
.drop-body span { font-size: 13px; color: var(--muted); }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumbs:empty { display: none; }
.thumb { position: relative; width: 62px; height: 46px; border-radius: 6px; overflow: hidden; background: repeating-conic-gradient(#26262c 0 25%, #1d1d22 0 50%) 0 0 / 12px 12px; border: 1px solid var(--line-hi); }
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.thumb button {
  position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; border: 0;
  background: rgb(0 0 0 / .75); color: #fff; font-size: 13px; line-height: 20px; padding: 0; cursor: pointer;
}
.thumb button:hover { background: var(--bad); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line-hi); background: var(--raise); color: var(--text);
  border-radius: 8px; padding: 10px 16px; font-weight: 700; font-size: 14px; cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
  white-space: nowrap;
}
.btn:hover { border-color: #55555f; background: #24242a; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #ff7440; }
.btn.ghost { background: transparent; }
.btn.small { padding: 9px 12px; height: 40px; }

/* AI */
.ai .note { margin: 0; font-size: 13px; color: var(--muted); }
.badge { margin-left: auto; font: 600 11px/1 Barlow, sans-serif; letter-spacing: .04em; text-transform: none; padding: 4px 8px; border-radius: 99px; background: var(--raise); color: var(--muted); border: 1px solid var(--line-hi); }
.badge.ok { color: var(--ok); border-color: rgb(62 207 142 / .35); }
.badge.off { color: var(--warn); border-color: rgb(255 176 32 / .35); }
.status { margin: 0; font-size: 13px; min-height: 1.45em; color: var(--muted); }
.status.err { color: var(--bad); }
.status.busy::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 8px; vertical-align: -1px; border-radius: 50%; border: 2px solid var(--line-hi); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .status.busy::before { animation-duration: 3s; } }
.versions h3 { margin: 4px 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.version-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.version { position: relative; border: 2px solid transparent; border-radius: 7px; overflow: hidden; padding: 0; background: #000; cursor: pointer; aspect-ratio: 3 / 2; }
.version img { width: 100%; height: 100%; object-fit: cover; display: block; }
.version span { position: absolute; left: 4px; bottom: 4px; font-size: 10px; font-weight: 700; text-transform: uppercase; background: rgb(0 0 0 / .7); padding: 2px 5px; border-radius: 4px; }
.version.on { border-color: var(--accent); }

/* ---------- stage ---------- */
.stage-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 6px; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--raise); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-hi); }

.cards { display: grid; gap: 22px; grid-template-columns: 1fr 1fr; align-content: start; }
.cards[data-view=front] .card[data-side=back],
.cards[data-view=back] .card[data-side=front] { display: none; }
.cards[data-view=front], .cards[data-view=back] { grid-template-columns: minmax(0, 1100px); justify-content: center; }
.card { margin: 0; display: grid; gap: 8px; min-width: 0; }
.card canvas { width: 100%; height: auto; display: block; border-radius: 6px; box-shadow: 0 24px 50px -18px rgb(0 0 0 / .9), 0 0 0 1px rgb(255 255 255 / .06); background: #111; }
.card figcaption { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }

.export { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding-top: 16px; border-top: 1px solid var(--line); }
.export-btns { display: flex; gap: 10px; flex-wrap: wrap; }

#printArea { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1280px) {
  .cards { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .panel { position: static; max-height: none; border-right: 0; border-bottom: 1px solid var(--line); padding: 4px 16px 20px; order: 2; }
  .stage { order: 1; padding: 16px; }
  .topbar { padding: 12px 16px; }
  .spec { display: none; }
  .brand { margin-right: auto; }
  .export-btns { width: 100%; }
  .export-btns .btn { flex: 1 1 100%; }
}

/* ---------- print: one card side per 8.5 x 5.5 page ---------- */
@media print {
  @page { size: 8.5in 5.5in; margin: 0; }
  body { background: #fff; }
  body > *:not(#printArea) { display: none !important; }
  #printArea { display: block; }
  #printArea img { display: block; width: 8.5in; height: 5.5in; page-break-after: always; break-after: page; }
  #printArea img:last-child { page-break-after: auto; break-after: auto; }
}

/* ================= HeroCards.net additions ================= */
.brand { text-decoration: none; display: flex; align-items: center; }
.brand img { height: 38px; width: auto; display: block; }
.export-copy { display: grid; gap: 2px; font-size: 14px; }
.export-copy span { color: var(--muted); font-size: 13px; }
.pro-cta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; justify-content: center;
  padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel);
  font-size: 14px; color: var(--muted);
}
.pro-cta span { color: var(--text); font-weight: 600; }
.pro-cta a, .link { color: var(--accent); font-weight: 700; text-decoration: none; background: none; border: 0; padding: 0; cursor: pointer; font-size: 14px; }
.pro-cta a:hover, .link:hover { text-decoration: underline; }
.pro-side .pro-q { margin: 0; font: 800 16px/1.2 "Saira Condensed", sans-serif; letter-spacing: .04em; text-transform: uppercase; }
.pro-side .note { margin: 0; font-size: 13px; color: var(--muted); }
.pro-side .btn { justify-self: start; text-decoration: none; }
.foot { display: flex; justify-content: center; gap: 18px; padding: 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.foot a { color: var(--muted); }
.hp { position: absolute; left: -5000px; width: 1px; height: 1px; opacity: 0; }
.wide { width: 100%; padding: 13px 16px; font-size: 15px; }

/* policy page */
.doc { max-width: 760px; margin: 0 auto; padding: 28px 20px 48px; line-height: 1.6; }
.doc h1 { font: 900 38px/1.1 "Saira Condensed", sans-serif; text-transform: uppercase; margin: 0; }
.doc h2 { font: 900 26px/1.15 "Saira Condensed", sans-serif; text-transform: uppercase; margin: 40px 0 6px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--accent); }
.doc h3 { font-size: 16px; margin: 20px 0 4px; }
.doc p, .doc li { color: #cfcfd6; font-size: 15px; }
.doc ul { padding-left: 20px; }
.doc a { color: var(--accent); }
.doc section { scroll-margin-top: 80px; }
.doc-meta { color: var(--muted); font-size: 13px; margin: 6px 0 14px; }
.doc-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.doc-nav a { border: 1px solid var(--line-hi); border-radius: 99px; padding: 6px 12px; font-size: 13px; font-weight: 600; text-decoration: none; color: var(--text); }
.doc-plain { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.topbar a.btn { text-decoration: none; }

/* buy dialog */
dialog#buy {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100svh - 24px); overflow: auto;
  background: var(--panel); color: var(--text); border: 1px solid var(--line-hi); border-radius: 14px;
  padding: 26px 24px 22px; box-shadow: 0 40px 90px -20px rgb(0 0 0 / .9);
}
dialog#buy { position: fixed; inset: 0; margin: auto; height: fit-content; z-index: 1000; }
dialog#buy:focus { outline: none; }
.dlg-backdrop { position: fixed; inset: 0; z-index: 999; background: rgb(0 0 0 / .7); backdrop-filter: blur(3px); }
html.dlg-on { overflow: hidden; }
dialog#buy h2 { margin: 0 0 14px; font: 900 26px/1.1 "Saira Condensed", sans-serif; text-transform: uppercase; letter-spacing: .02em; }
dialog#buy .x { position: absolute; top: 10px; right: 12px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--raise); color: var(--text); font-size: 20px; cursor: pointer; }
.buy-step { display: grid; gap: 14px; }
.options { display: grid; gap: 10px; }
.opt { display: grid; gap: 4px; border: 1.5px solid var(--line-hi); border-radius: 11px; padding: 13px 14px; cursor: pointer; background: var(--raise); color: var(--text); font-weight: 500; }
.opt:has(> input[name=kind]:checked) { border-color: var(--accent); background: #1d1510; }
.opt { position: relative; }
.opt input[type=radio] { position: absolute; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.opt-head { display: flex; justify-content: space-between; gap: 10px; font-size: 16px; }
.opt-head b { color: var(--accent); }
.opt-body { font-size: 13px; color: var(--muted); }
.opt-more { display: none; gap: 10px; margin-top: 8px; }
.opt:has(> input[name=kind]:checked) .opt-more { display: grid; }
.deliv { display: grid; gap: 6px; }
.deliv label { display: flex; align-items: center; gap: 9px; font-weight: 500; color: var(--text); font-size: 13px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; cursor: pointer; }
.deliv label:has(input:checked) { border-color: var(--accent); }
.deliv input { accent-color: var(--accent); margin: 0; }
.deliv .d-price { margin-left: auto; font-weight: 700; }
.deliv .d-when { color: var(--muted); }
.credit { margin: 0; font-size: 13px; color: var(--ok); }
.total { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--line); padding-top: 12px; font-size: 15px; }
.total strong { font-size: 22px; font-family: "Saira Condensed", sans-serif; }
.fine { margin: 0; font-size: 12px; color: var(--muted); }
.upsell { display: grid; gap: 6px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--raise); font-size: 14px; }
.upsell span { color: var(--muted); font-size: 13px; }
.upsell .btn { justify-self: start; text-decoration: none; }
#payMount { min-height: 420px; background: #fff; border-radius: 10px; overflow: hidden; }
@media (max-width: 860px) {
  .brand img { height: 30px; }
  .export-copy { width: 100%; }
}
@media print { dialog { display: none !important; } }
.fine a { color: var(--accent); }
