:root {
  --bg: #09090b;
  --bg-2: #0f0f12;
  --panel: #111114;
  --line: #24242a;
  --line-2: #2f2f37;
  --text: #ece7de;
  --muted: #8e8a94;
  --dim: #5f5c66;
  --gold: #c9a24a;
  --gold-2: #e8c877;
  --gold-grad: linear-gradient(135deg, #f3d891 0%, #c9a24a 45%, #8a6a26 100%);
  --radius: 12px;
  --panel-w: 430px;
  --serif: 'Cinzel', 'Trajan Pro', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- top bar ---------- */
.topbar {
  height: 60px;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 9, 11, 0.85);
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand-mark { width: 22px; height: 22px; fill: var(--gold); stroke: none; filter: drop-shadow(0 0 8px rgba(201, 162, 74, 0.45)); }
.wordmark { font-family: var(--serif); font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase; font-size: 15px; }
.crumbs { color: var(--muted); font-size: 13px; display: flex; gap: 8px; align-items: center; }
.crumbs strong { color: var(--text); font-weight: 500; }
.crumbs .dot { color: var(--dim); }
.top-actions { margin-left: auto; display: flex; gap: 10px; }

.ghost {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; border: 1px solid var(--line-2); border-radius: 999px;
  padding: 8px 14px; color: var(--text); font-size: 13px;
  transition: border-color 0.2s, background 0.2s;
}
.ghost:hover { border-color: var(--gold); background: rgba(201, 162, 74, 0.06); }
.ghost svg { width: 16px; height: 16px; }
.ghost.sm { padding: 6px 12px; font-size: 12px; }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: 1fr var(--panel-w); height: calc(100vh - 60px); height: calc(100dvh - 60px); }

.stage { position: relative; overflow: hidden; background: radial-gradient(ellipse at 50% 35%, #17171c 0%, var(--bg) 70%); }
.viewer { position: absolute; inset: 0; }
.viewer canvas { width: 100% !important; height: 100% !important; display: block; outline: none; cursor: grab; }
.viewer canvas:active { cursor: grabbing; }
.vignette { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(0, 0, 0, 0.55) 100%); }

.stage-top { position: absolute; top: 18px; left: 20px; right: 20px; display: flex; justify-content: space-between; align-items: center; pointer-events: none; }
.badge {
  display: inline-flex; align-items: center; gap: 8px; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: rgba(15, 15, 18, 0.7);
}
.live { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px var(--gold); animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
.hint { font-size: 12px; color: var(--dim); }

.viewbar {
  position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 2px; padding: 5px;
  background: rgba(17, 17, 20, 0.82); border: 1px solid var(--line); border-radius: 999px; backdrop-filter: blur(10px);
}
.viewbar button {
  border: 0; background: transparent; padding: 7px 14px; border-radius: 999px; font-size: 12.5px; color: var(--muted);
  display: inline-flex; align-items: center; transition: color 0.2s, background 0.2s;
}
.viewbar button:hover { color: var(--text); }
.viewbar button.on { background: #22222a; color: var(--text); }
.viewbar #spinBtn.on { color: var(--gold-2); }
.viewbar svg { width: 16px; height: 16px; }
.viewbar .sep { width: 1px; height: 18px; background: var(--line-2); margin: 0 4px; }

.dims { position: absolute; left: 22px; top: 58px; font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: baseline; }
.dims strong { font-family: var(--serif); font-size: 18px; color: var(--text); font-weight: 600; letter-spacing: 0.04em; }

.loader {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 16px;
  background: var(--bg); color: var(--muted); font-size: 13px; letter-spacing: 0.08em; transition: opacity 0.6s;
}
.loader.done { opacity: 0; pointer-events: none; }
.ember { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--gold); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.studio {
  position: absolute; top: 96px; left: 20px; display: grid; gap: 8px; padding: 14px; width: 250px;
  background: rgba(17, 17, 20, 0.92); border: 1px dashed var(--gold); border-radius: var(--radius); font-size: 12px;
}
.studio strong { color: var(--gold-2); letter-spacing: 0.1em; text-transform: uppercase; font-size: 11px; }
.studio .file input { display: block; margin-top: 6px; font-size: 11px; color: var(--muted); max-width: 100%; }
.studio .check { display: flex; gap: 6px; align-items: center; color: var(--muted); }

/* ---------- panel ---------- */
.panel { display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--panel); min-height: 0; }
.panel-scroll { flex: 1; overflow-y: auto; padding: 26px 24px 18px; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }

.intro h1 { font-family: var(--serif); font-weight: 600; font-size: 30px; letter-spacing: 0.04em; margin: 4px 0 8px; line-height: 1.15; }
.intro p { color: var(--muted); margin: 0 0 22px; }
.eyebrow { font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold); font-weight: 600; }

.group-title { font-size: 10.5px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--dim); margin: 22px 0 8px; font-weight: 600; }

.step { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; background: var(--bg-2); transition: border-color 0.25s; }
.step.open { border-color: #3a3426; box-shadow: 0 0 0 1px rgba(201, 162, 74, 0.08), 0 10px 30px rgba(0, 0, 0, 0.3); }
.step-h {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 0; background: transparent; text-align: left;
}
.num { font-family: var(--serif); font-size: 12px; color: var(--gold); width: 20px; }
.ttl { font-weight: 500; font-size: 14px; }
.val { margin-left: auto; color: var(--muted); font-size: 12.5px; max-width: 46%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chev { width: 8px; height: 8px; border-right: 1.5px solid var(--dim); border-bottom: 1.5px solid var(--dim); transform: rotate(45deg); margin: -3px 2px 0 4px; transition: transform 0.25s; flex: none; }
.step.open .step-h .chev { transform: rotate(225deg); margin-top: 3px; }
.step-b { display: none; padding: 2px 16px 16px; }
.step.flag { border-color: #6b4a1e; }
.step.flag .num { color: #e0a24a; }
.step.flag .val::before { content: '⚠ '; color: #e0a24a; }
.step.open .step-b { display: block; animation: reveal 0.3s ease; }
@keyframes reveal { from { opacity: 0; transform: translateY(-4px); } }

.chips { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.chips.cols-5 { grid-template-columns: repeat(5, 1fr); gap: 6px; }
.chip {
  position: relative; border: 1px solid var(--line-2); background: #141418; border-radius: 10px; padding: 11px 12px;
  text-align: left; display: grid; gap: 2px; transition: border-color 0.2s, background 0.2s, transform 0.1s;
}
.chip:hover { border-color: #4a4a55; }
.chip:active { transform: scale(0.98); }
.chip.on { border-color: var(--gold); background: linear-gradient(180deg, rgba(201, 162, 74, 0.12), rgba(201, 162, 74, 0.03)); }
.chip .c-label { font-weight: 500; font-size: 13px; }
.chip .c-sub { font-size: 11.5px; color: var(--muted); }
.chips.cols-5 .chip { text-align: center; padding: 12px 4px; }
.chips.cols-5 .c-label { font-family: var(--serif); font-size: 16px; white-space: nowrap; }
.chips.cols-5 .c-sub { font-size: 10.5px; }
.swatches .chip { grid-template-columns: 30px 1fr; align-items: center; column-gap: 10px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; grid-row: span 2; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15), 0 2px 8px rgba(0, 0, 0, 0.5); }

.colors { display: flex; gap: 14px; margin-top: 12px; }
.colors label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }
.colors input[type=color] { width: 36px; height: 28px; border: 1px solid var(--line-2); border-radius: 6px; background: none; padding: 0 2px; cursor: pointer; }

.fieldwrap { position: relative; margin-bottom: 8px; }
.field {
  width: 100%; background: #0b0b0e; border: 1px solid var(--line-2); border-radius: 10px; color: var(--text);
  padding: 12px 54px 12px 14px; font: 500 14px/1.4 var(--sans); letter-spacing: 0.06em; text-transform: uppercase;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field::placeholder { color: var(--dim); }
.field:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 162, 74, 0.15); }
.field.big { font-family: var(--serif); font-size: 34px; width: 120px; text-align: center; padding: 8px; letter-spacing: 0.06em; }
.field.area { padding: 12px 14px; resize: vertical; line-height: 1.7; font-size: 13px; }
.count { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 11px; color: var(--dim); }
.count.warn { color: #e0a24a; }
.help { color: var(--muted); font-size: 12px; margin: 6px 0 0; }
.help.warn { color: #e0a24a; }

.soon { margin-top: 22px; padding: 16px; border-radius: var(--radius); border: 1px dashed var(--line-2); background: linear-gradient(135deg, rgba(201, 162, 74, 0.05), transparent); }
.soon-tag { display: inline-block; font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); border: 1px solid rgba(201, 162, 74, 0.4); border-radius: 999px; padding: 2px 8px; margin-bottom: 8px; }
.soon p { color: var(--muted); margin: 4px 0 0; font-size: 12.5px; }

/* ---------- checkout ---------- */
.checkout { border-top: 1px solid var(--line); padding: 14px 24px 18px; background: #0d0d10; }
.breakdown-toggle { border: 0; background: none; color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; padding: 0; margin-bottom: 8px; }
.breakdown-toggle .chev { transform: rotate(225deg); margin-top: 4px; }
.breakdown-toggle[aria-expanded=true] .chev { transform: rotate(45deg); margin-top: -3px; }
.breakdown { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; font-size: 12.5px; }
.breakdown li { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); }
.breakdown li span:last-child { color: var(--text); white-space: nowrap; }
.total-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.total-label { font-size: 10.5px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--dim); }
.total { font-family: var(--serif); font-size: 30px; font-weight: 600; line-height: 1.1; background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.total.bump { animation: bump 0.35s ease; }
@keyframes bump { 40% { transform: translateY(-2px); filter: brightness(1.3); } }
.ship { font-size: 11.5px; color: var(--muted); }
.cta {
  border: 0; border-radius: 999px; padding: 14px 24px; font-weight: 600; font-size: 14px; color: #1a1408; letter-spacing: 0.02em;
  background: var(--gold-grad); box-shadow: 0 8px 24px rgba(201, 162, 74, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.15s, box-shadow 0.2s, filter 0.2s;
}
.cta:hover { filter: brightness(1.08); box-shadow: 0 10px 30px rgba(201, 162, 74, 0.35); }
.cta:active { transform: translateY(1px); }

/* ---------- review dialog ---------- */
.review { border: 1px solid var(--line-2); border-radius: 18px; padding: 0; background: var(--panel); color: var(--text); width: min(980px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
.review::backdrop { background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(6px); }
.review-inner { display: grid; grid-template-columns: 1.1fr 1fr; position: relative; max-height: calc(100vh - 50px); }
.review-media { background: #060607; display: grid; place-items: center; min-height: 300px; }
.review-media img { width: 100%; height: 100%; object-fit: contain; display: block; }
.review-body { padding: 28px; overflow-y: auto; }
.review-body h2 { font-family: var(--serif); font-weight: 600; font-size: 24px; margin: 4px 0 2px; }
.order-id { font-size: 12px; color: var(--dim); margin-bottom: 16px; font-variant-numeric: tabular-nums; }
.summary { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0 0 16px; font-size: 12.5px; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; white-space: pre-line; }
.breakdown.static { border-top: 1px solid var(--line); padding-top: 12px; }
.review-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.order-form { margin-top: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid label { display: grid; gap: 5px; font-size: 12px; color: var(--muted); }
.form-grid label span { color: var(--dim); }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid input, .form-grid textarea {
  background: #0b0b0e; border: 1px solid var(--line-2); border-radius: 8px; color: var(--text); padding: 9px 11px; font: 13px var(--sans); resize: vertical;
}
.form-grid input:focus, .form-grid textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 162, 74, 0.15); }
.cta:disabled { opacity: 0.6; cursor: progress; }
.order-status { min-height: 1.2em; font-size: 12.5px; color: #e0a24a; margin: 10px 0 0; }
.placed-msg { display: none; text-align: center; padding: 26px 8px 8px; }
.review.placed .order-form { display: none; }
.review.placed .placed-msg { display: block; animation: reveal 0.4s ease; }
.placed-check { width: 54px; height: 54px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; color: #1a1408; background: var(--gold-grad); box-shadow: 0 8px 24px rgba(201, 162, 74, 0.35); }
.placed-msg h3 { font-family: var(--serif); font-weight: 600; font-size: 22px; margin: 0 0 6px; }
.placed-msg p { color: var(--muted); margin: 0; }
.placed-msg strong { color: var(--text); font-variant-numeric: tabular-nums; }
.fine { color: var(--dim); font-size: 11.5px; margin: 14px 0 0; }
.close { position: absolute; top: 12px; right: 14px; z-index: 2; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line-2); background: rgba(17, 17, 20, 0.8); font-size: 20px; line-height: 1; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #1b1b21; border: 1px solid var(--line-2); padding: 10px 18px; border-radius: 999px; font-size: 13px; transition: 0.3s; z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { :root { --panel-w: 380px; } .crumbs { display: none; } }
@media (max-width: 820px) {
  body { overflow: auto; }
  .topbar { padding: 0 16px; }
  .ghost span { display: none; }
  .layout { grid-template-columns: 1fr; height: auto; }
  .stage { height: 56vh; height: 56svh; position: sticky; top: 0; z-index: 2; }
  .panel { border-left: 0; border-top: 1px solid var(--line); }
  .panel-scroll { overflow: visible; padding: 22px 16px 12px; }
  .checkout { position: sticky; bottom: 0; padding: 12px 16px 14px; z-index: 3; }
  .hint, .dims span { display: none; }
  .viewbar { bottom: 14px; }
  .viewbar button { padding: 7px 10px; }
  .dims { bottom: auto; top: 54px; left: 16px; }
  .review-inner { grid-template-columns: 1fr; }
  .review-media { min-height: 200px; max-height: 260px; }
  .form-grid { grid-template-columns: 1fr; }
  .chips.cols-5 { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- ruler unit switch ---------- */
.dims { align-items: center; }
.unit-toggle { display: inline-flex; margin-left: 6px; padding: 2px; border: 1px solid var(--line-2); border-radius: 999px; background: rgba(17, 17, 20, 0.8); }
.unit-toggle button { border: 0; background: transparent; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0.06em; padding: 3px 10px; border-radius: 999px; transition: background 0.2s, color 0.2s; }
.unit-toggle button.on { background: var(--gold-grad); color: #1a1408; }

/* ---------- quantity + upsell ---------- */
.checkout { position: relative; }
.qty-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 999px; background: #0b0b0e; }
.qty button { width: 32px; height: 32px; border: 0; background: transparent; font-size: 18px; color: var(--text); border-radius: 50%; }
.qty button:hover { color: var(--gold-2); }
.qty input { width: 34px; border: 0; background: transparent; color: var(--text); text-align: center; font: 600 15px var(--sans); -moz-appearance: textfield; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.upsell {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; text-align: left;
  border: 1px solid rgba(201, 162, 74, 0.55); border-radius: 999px; padding: 7px 14px; font-size: 12.5px; font-weight: 500; color: var(--gold-2);
  background: linear-gradient(110deg, rgba(201, 162, 74, 0.08) 30%, rgba(255, 230, 160, 0.28) 50%, rgba(201, 162, 74, 0.08) 70%);
  background-size: 250% 100%;
  animation: shimmer 2.8s linear infinite, glow 2.8s ease-in-out infinite;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.upsell:hover { color: #fff3cf; border-color: var(--gold-2); }
.upsell .spark { display: inline-block; animation: twinkle 1.4s ease-in-out infinite; }
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -100% 0; } }
@keyframes glow { 0%, 100% { box-shadow: 0 0 0 rgba(201, 162, 74, 0); } 50% { box-shadow: 0 0 18px rgba(201, 162, 74, 0.35); } }
@keyframes twinkle { 0%, 100% { transform: scale(1) rotate(0); opacity: 0.8; } 50% { transform: scale(1.35) rotate(25deg); opacity: 1; } }
.total-label .per { text-transform: none; letter-spacing: 0; color: var(--muted); font-size: 11.5px; }
.breakdown li.save span { color: #9ad38a !important; }
.save-note { color: #9ad38a; font-size: 12.5px; margin-top: 2px; }
.tiers { border-top: 1px solid var(--line); padding-top: 10px; margin-bottom: 12px; }
.tiers-title { font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--dim); margin-bottom: 6px; }
.tiers ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; font-size: 12px; color: var(--muted); }
.tiers li { display: flex; justify-content: space-between; }
.tiers strong { color: var(--gold-2); font-weight: 600; }

/* gold spark burst when a copy is added */
.burst { position: absolute; left: 50%; top: 22px; width: 0; height: 0; pointer-events: none; }
.burst i { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: radial-gradient(circle, #fff3cf, #d6a83a 60%, transparent 70%); opacity: 0; }
.burst.go i { animation: spark 0.9s ease-out forwards; }
@keyframes spark {
  0% { transform: translate(0, 0) scale(0.4); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(1.1); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .upsell, .upsell .spark { animation: none; } .burst.go i { animation-duration: 0.01s; } }

/* legal links */
.legal-links { display: flex; gap: 14px; flex-wrap: wrap; margin: 18px 2px 4px; font-size: 12px; }
.legal-links a, .agree a { color: var(--muted); }
.legal-links a:hover, .agree a:hover { color: var(--gold-2); }
.agree { font-size: 11.5px; color: var(--dim); margin: 10px 0 0; }

.top-actions a { text-decoration: none; }
