:root {
  --bg: #fbf7f1; --card: #ffffff; --ink: #1f1b2e; --muted: #6b6578; --line: #ebe4da; --soft: #f4eee5;
  --brand: #6a3df0; --brand2: #ff3d8b; --ok: #2f9e5b; --warn: #c2410c;
  --radius: 18px; --font: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14121b; --card: #1d1a27; --ink: #f1eef8; --muted: #a39db3; --line: #2e2a3b; --soft: #26222f; --warn: #fb923c; color-scheme: dark;
  }
}
:root[data-theme="dark"] { --bg: #14121b; --card: #1d1a27; --ink: #f1eef8; --muted: #a39db3; --line: #2e2a3b; --soft: #26222f; --warn: #fb923c; color-scheme: dark; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 var(--font); }
button, input, select, textarea { font: inherit; color: inherit; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
em { font-style: normal; color: var(--muted); font-weight: 400; }

.hero { background: linear-gradient(120deg, var(--brand), var(--brand2)); color: #fff; padding: 22px 0 64px; }
.hero-in { display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 24px; letter-spacing: -0.01em; }
.brand img { border-radius: 8px; background: rgba(255,255,255,.18); padding: 3px; }
.tagline { margin: 0; opacity: .92; font-weight: 600; max-width: 60ch; }

.grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 20px; margin-top: -44px; align-items: start; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 6px 24px rgba(31, 27, 46, .06); }
.preview-col { position: sticky; top: 16px; }
.preview { overflow: hidden; }
.viewer { height: min(56vh, 520px); background: radial-gradient(ellipse at 50% 35%, var(--card) 0%, var(--soft) 80%); touch-action: none; }
.viewer canvas { display: block; width: 100% !important; height: 100% !important; }
.preview-col, .controls, .card { min-width: 0; }
html, body { overflow-x: clip; } /* clip, not hidden: hidden would break the sticky preview */
.preview-bar { display: flex; justify-content: space-between; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line); font-weight: 700; font-size: 14px; }
.drag-hint { margin: 0; padding: 0 16px 12px; color: var(--muted); font-size: 12px; }

.controls { display: flex; flex-direction: column; gap: 14px; padding-bottom: 30px; }
.step { padding: 18px; }
.step h2 { margin: 0 0 12px; font-size: 18px; font-weight: 900; display: flex; align-items: center; gap: 10px; }
.num { width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; display: inline-grid; place-items: center; font-size: 14px; flex: none; }
.big-input { width: 100%; font-size: 28px; font-weight: 900; padding: 12px 16px; border: 2px solid var(--line); border-radius: 14px; background: var(--soft); letter-spacing: .02em; }
.big-input:focus, .input:focus { outline: none; border-color: var(--brand); }
.input { width: 100%; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--soft); }
.link-btn { background: none; border: 0; color: var(--brand); font-weight: 700; padding: 8px 0 0; cursor: pointer; }
#sub { margin-top: 8px; }

.styles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.style { border: 2px solid var(--line); border-radius: 14px; background: var(--soft); padding: 8px; cursor: pointer; text-align: center; font-weight: 700; font-size: 13px; }
.style .thumb { width: 100%; height: 64px; object-fit: contain; display: block; margin-bottom: 4px; pointer-events: none; -webkit-user-drag: none; }
.style.on { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }

.colour-row { margin-bottom: 12px; }
.colour-row > span { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.swatches { display: flex; flex-wrap: wrap; gap: 7px; }
.sw { width: 34px; height: 34px; border-radius: 50%; border: 2px solid rgba(0,0,0,.12); cursor: pointer; padding: 0; position: relative; }
.sw.on { outline: 3px solid var(--brand); outline-offset: 2px; }
.sw[aria-disabled="true"] { opacity: .25; cursor: not-allowed; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 2px solid var(--line); background: var(--soft); border-radius: 999px; padding: 7px 14px; cursor: pointer; font-weight: 700; font-size: 14px; }
.chip.on { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, var(--card)); }
.chip small { display: block; font-weight: 600; color: var(--muted); font-size: 11px; }
.fonts .chip { font-size: 20px; padding: 6px 14px; border-radius: 12px; font-weight: 400; }
.icons .chip { width: 46px; height: 46px; padding: 8px; border-radius: 12px; display: grid; place-items: center; }
.icons svg { width: 100%; height: 100%; color: var(--ink); }
.field { margin-bottom: 12px; }
.field > label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.more-names { margin-bottom: 12px; }
.more-names summary { cursor: pointer; color: var(--brand); font-weight: 700; padding: 4px 0 8px; }
.total { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 12px; background: var(--soft); margin: 6px 0 12px; }
.total span:first-child { font-size: 20px; font-weight: 900; }
.warn { color: var(--warn); font-weight: 700; font-size: 14px; margin: 8px 0 0; }
.cta { width: 100%; padding: 15px; border: 0; border-radius: 14px; background: linear-gradient(120deg, var(--brand), var(--brand2)); color: #fff; font-weight: 900; font-size: 18px; cursor: pointer; }
.cta:disabled { opacity: .5; cursor: not-allowed; }
.foot { padding: 10px 16px 40px; }

.done { position: fixed; inset: 0; background: rgba(20, 18, 27, .55); display: grid; place-items: center; padding: 16px; z-index: 20; }
.done[hidden] { display: none; }
.done-card { max-width: 420px; width: 100%; padding: 22px; text-align: center; }
.done-card img { width: 100%; border-radius: 12px; background: var(--soft); }
.done-card h2 { margin: 14px 0 6px; font-weight: 900; }

@media (max-width: 860px) {
  .grid { grid-template-columns: 1fr; }
  .preview-col { position: sticky; top: 0; z-index: 5; }
  .viewer { height: 36vh; }
  .drag-hint { display: none; }
  .row2 { grid-template-columns: 1fr; }
}

.view-switch { display: flex; gap: 6px; padding: 10px 12px 0; }
.view-switch button { flex: 1; border: 2px solid var(--line); background: var(--soft); border-radius: 10px; padding: 7px 10px; font-weight: 800; cursor: pointer; }
.view-switch button.on { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, var(--card)); }
.viewer[hidden] { display: none; }
.arrange { position: relative; background-color: var(--soft); background-image: radial-gradient(var(--line) 1px, transparent 1px); background-size: 16px 16px; }
.arrange canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.arr-hint { position: absolute; left: 0; right: 0; bottom: 8px; margin: 0; text-align: center; font-size: 12px; color: var(--muted); pointer-events: none; }
.arr-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 12px; border-top: 1px solid var(--line); }
.arr-bar b { margin-right: auto; }
.arr-bar button { min-width: 40px; height: 36px; border: 2px solid var(--line); background: var(--soft); border-radius: 10px; font-weight: 900; font-size: 16px; cursor: pointer; }
.arr-bar .del { color: var(--warn); font-size: 14px; padding: 0 12px; }
.size-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-weight: 700; }
.size-row input[type=range] { flex: 1; accent-color: var(--brand); }
.size-row .num { width: 90px; flex: none; }
.chip[draggable="true"] { cursor: grab; }
.arr-bar[hidden] { display: none; }
.size-row .num { color: var(--ink); font-weight: 800; text-align: center; background: var(--card); }
.themes { margin-bottom: 12px; }
.themes .chip { padding: 5px 12px; font-size: 13px; }
.mini-btn { display: none; border: 0; background: none; color: var(--brand); font-weight: 800; font-size: 13px; cursor: pointer; padding: 0; }
@media (max-width: 860px) {
  .mini-btn { display: inline; }
  .preview-bar { align-items: center; }
  .preview-col.mini .viewer, .preview-col.mini .view-switch, .preview-col.mini .arr-bar, .preview-col.mini .drag-hint { display: none !important; }
  .preview-col.mini .preview-bar { border-top: 0; }
}

.track-link { color: #fff; font-weight: 800; font-size: 14px; opacity: .9; margin-top: 6px; align-self: flex-start; }
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.product { display: flex; gap: 10px; align-items: flex-start; text-align: left; border: 2px solid var(--line); background: var(--soft); border-radius: 14px; padding: 10px; cursor: pointer; }
.product.on { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.product .pi { width: 34px; height: 34px; flex: none; color: var(--brand); }
.product .pi svg { width: 100%; height: 100%; }
.product .pt { display: flex; flex-direction: column; gap: 2px; }
.product small { color: var(--muted); font-size: 12px; }
.product .from { color: var(--ink); font-weight: 800; }
.season { margin: -4px 0 10px; padding: 8px 12px; border-radius: 10px; background: color-mix(in srgb, var(--brand2) 14%, var(--card)); font-weight: 800; }
.share-row { display: flex; gap: 8px; }
.share-row .input { flex: 1; }
.promo-msg { display: block; margin-top: 4px; font-weight: 700; font-size: 13px; }
.promo-msg.good { color: var(--ok); }
.promo-msg.bad { color: var(--warn); }
.share-btn { display: block; width: calc(100% - 24px); margin: 4px 12px 10px; padding: 9px; border: 2px dashed var(--brand); background: none; color: var(--brand); border-radius: 12px; font-weight: 800; cursor: pointer; }
.reward { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--ok) 14%, var(--card)); }
.reward code { font-size: 18px; font-weight: 900; letter-spacing: .06em; }
.track-img { width: 100%; border-radius: 12px; background: var(--soft); }
.steps { list-style: none; padding: 0; margin: 10px 0 0; }
.steps li { position: relative; padding: 0 0 12px 26px; color: var(--muted); }
.steps li::before { content: ""; position: absolute; left: 6px; top: 5px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--line); background: var(--card); }
.steps li.past, .steps li.now { color: var(--ink); }
.steps li.past::before { background: var(--ok); border-color: var(--ok); }
.steps li.now::before { background: var(--brand); border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 25%, transparent); }
.steps li small { display: block; font-size: 12px; color: var(--muted); }
.overlay .done-card { max-height: 90vh; overflow-y: auto; }
.share-img { aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--soft); margin: 10px 0; position: relative; }
.share-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.share-img.loading::after { content: "Making your picture…"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-weight: 700; }
.cta.alt { background: var(--card); color: var(--brand); border: 2px solid var(--brand); }
.share-row .cta { flex: 1; }
.photo-pick { display: block; border: 2px dashed var(--brand); border-radius: 12px; padding: 14px; text-align: center; color: var(--brand); font-weight: 800; cursor: pointer; }
.photo-pick input { display: block; width: 100%; margin-top: 6px; font-size: 13px; color: var(--muted); }
.photo-prev { display: block; width: 100%; max-height: 320px; object-fit: contain; border-radius: 12px; margin-top: 10px; background: var(--soft); }
.photo-prev[hidden] { display: none; }
.consent { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; font-size: 13px; color: var(--muted); text-align: left; }
.chip.ring { display: inline-flex; align-items: center; gap: 8px; padding: 5px 14px 5px 6px; border-radius: 14px; text-align: left; }
.chip.ring .ring-pic { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: #fff; }
#ringField[hidden] { display: none; }
.addr { display: grid; gap: 8px; margin: -4px 0 12px; }
.addr[hidden] { display: none; }
.row3 { display: grid; grid-template-columns: minmax(0, 1fr) 104px 104px; gap: 8px; }
.pay { margin: 12px 0; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--brand); background: color-mix(in srgb, var(--brand) 7%, var(--card)); text-align: left; display: grid; gap: 6px; }
.pay-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pay-row span { width: 78px; color: var(--muted); font-size: 13px; }
.pay-row code { font-size: 16px; font-weight: 900; }
.chip.tiny { padding: 3px 10px; font-size: 12px; }
.nudge { display: flex; align-items: center; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.nudge .chip.tiny { min-width: 40px; padding: 6px 10px; font-size: 15px; }
#backOpts[hidden], #backMsg[hidden], #backColours[hidden] { display: none; }

/* "Good to know" above the order button */
.policy { margin: 14px 0 10px; padding: 12px 14px; border-radius: 14px; background: var(--soft); font-size: 13px; line-height: 1.45; }
.policy b { display: block; margin-bottom: 4px; }
.policy ul, .rc-policy ul { margin: 0 0 6px; padding-left: 18px; }
.policy li + li, .rc-policy li + li { margin-top: 3px; }
/* the receipt */
.receipt { text-align: left; }
.receipt h2 { text-align: center; margin: 6px 0 10px; }
.rc-head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); }
.rc-shop { font-weight: 900; color: var(--brand); font-size: 15px; letter-spacing: .02em; }
.rc-num { text-align: center; margin: 0 0 12px; padding: 10px; border-radius: 14px; border: 2px dashed var(--brand); }
.rc-num small { display: block; color: var(--muted); font-size: 12px; }
.rc-num b { font-size: 26px; font-weight: 900; letter-spacing: .04em; }
.receipt img { display: block; max-height: 150px; object-fit: contain; }
.rc-lines { margin: 12px 0 4px; font-size: 14px; }
.rc-what { font-weight: 800; margin-bottom: 4px; }
.rc-row { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.rc-row span { min-width: 0; overflow-wrap: anywhere; }
.rc-row.sub, .rc-row.sub b { color: var(--muted); font-weight: 600; }
.rc-row.off b { color: #1a9a52; }
.rc-total { display: flex; justify-content: space-between; margin: 6px 0 0; padding-top: 8px; border-top: 2px solid var(--line, #e6e0d6); font-weight: 800; font-size: 17px; }
.rc-total b { font-size: 20px; }
.rc-next { margin: 4px 0 10px; padding-left: 20px; font-size: 14px; }
.rc-next li + li { margin-top: 3px; }
.rc-shot { margin: 0 0 10px; padding: 10px 12px; border-radius: 12px; background: var(--soft); font-size: 13px; text-align: center; }
.rc-policy { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.rc-policy[hidden] { display: none; }
.receipt > .chip, .receipt > .cta { display: block; width: 100%; }
.receipt > .rc-pdf { margin-bottom: 10px; border: 2px solid var(--brand); color: var(--brand); font-weight: 800; }
/* card payments */
.pay-both { display: flex; flex-direction: column; gap: 6px; }
.pay-both > small { text-align: center; }
.card-pay { width: 100%; }
