/* ===== Royal Market - parchment theme ===== */
:root {
  --wood-1: #1c140e;
  --wood-2: #2a1d13;
  --parch-1: #f3e6c4;
  --parch-2: #e6d2a3;
  --parch-edge: #c9ad74;
  --ink: #3a2414;
  --ink-soft: #6b4d33;
  --brown: #5c2e00;
  --gold: #c19a4b;
  --gold-hi: #e8c77a;
  --wax: #8e2a1f;
  --wax-hi: #b23a2c;
  --green: #4f6b2f;
  --radius: 6px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: "EB Garamond", Georgia, serif;
  font-size: 18px;
  color: var(--parch-1);
  background:
    radial-gradient(ellipse at top, rgba(193, 154, 75, .12), transparent 60%),
    repeating-linear-gradient(90deg, rgba(0,0,0,.08) 0 2px, transparent 2px 120px),
    linear-gradient(180deg, var(--wood-2), var(--wood-1));
  background-attachment: fixed;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
h1, h2, h3 { font-family: "Cinzel", serif; letter-spacing: .03em; margin: 0; }
a { color: inherit; }
button { font: inherit; cursor: pointer; }
.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }
.small { font-size: .85rem; opacity: .8; }
code { font-family: Consolas, monospace; font-size: .9em; }

/* ---- background slideshow ---- */
.bg-slides { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-slide {
  position: absolute; inset: -3%; background-size: cover; background-position: center;
  opacity: 0; transition: opacity 1.8s ease-in-out; will-change: opacity, transform;
}
/* "leaving" keeps the outgoing slide drifting while it fades out (removing the animation would snap it back = visible zoom-out). */
.bg-slide.active, .bg-slide.leaving { animation: drift-a var(--slide-dur, 11s) ease-out forwards; }
.bg-slide:nth-child(even).active, .bg-slide:nth-child(even).leaving { animation-name: drift-b; }
.bg-slide.active { opacity: 1; }
.bg-slide.leaving { opacity: 0; }
.bg-slides.no-motion .bg-slide.active, .bg-slides.no-motion .bg-slide.leaving { animation: none; }
@keyframes drift-a { from { transform: scale(1.03) translate(0, 0); } to { transform: scale(1.12) translate(-1.5%, -1%); } }
@keyframes drift-b { from { transform: scale(1.12) translate(1%, -1%); } to { transform: scale(1.03) translate(0, 0); } }
/* darkening so text and parchment stay readable over any picture */
.bg-slides::after {
  content: ""; position: absolute; inset: 0;
  /* --dim comes from backgroundDarkness in config.js (0 = none, 1 = black) */
  background:
    radial-gradient(ellipse at center, transparent 40%, rgba(20,14,9,.45) 100%),
    rgba(20,14,9,var(--dim, .45));
}
body.has-bg { background: var(--wood-1); }

/* ---- parchment surface ---- */
.scroll, .card, .modal, .drawer {
  color: var(--ink);
  background:
    radial-gradient(ellipse at 20% 10%, rgba(255,255,255,.45), transparent 55%),
    radial-gradient(ellipse at 85% 90%, rgba(120, 80, 30, .18), transparent 60%),
    linear-gradient(135deg, var(--parch-1), var(--parch-2));
  box-shadow: inset 0 0 40px rgba(110, 70, 25, .35), var(--shadow);
}

/* ---- top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(180deg, rgba(20,14,9,.97), rgba(28,20,14,.93));
  border-bottom: 2px solid var(--gold);
  box-shadow: 0 4px 18px rgba(0,0,0,.5);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.crest { width: 46px; height: 46px; display: grid; place-items: center; flex: none; }
.crest img { width: 100%; height: 100%; object-fit: contain; }
/* Real logo (dark artwork) on a round parchment badge with a gold rim, so it stands out on the dark bar. */
.crest.has-logo {
  width: 54px; height: 54px; padding: 5px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, var(--parch-1), var(--parch-2) 70%, var(--parch-edge));
  border: 2px solid var(--gold); box-shadow: 0 2px 8px rgba(0,0,0,.5), inset 0 0 6px rgba(92,46,0,.35);
}
.brand-name { display: block; font-family: "Cinzel", serif; font-weight: 700; font-size: 1.35rem; color: var(--gold-hi); }
.brand-tag { display: block; font-style: italic; font-size: .9rem; color: var(--parch-2); opacity: .8; }
.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 18px; border-radius: var(--radius);
  font-family: "Cinzel", serif; font-weight: 700; font-size: .9rem; letter-spacing: .04em;
  text-decoration: none; border: 1px solid transparent; transition: transform .12s, filter .12s, background .12s;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; filter: grayscale(.4); }
.btn:focus-visible, .tab:focus-visible, .icon-btn:focus-visible, .ip-chip:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 2px; }
.btn.ghost { color: var(--parch-1); border-color: rgba(193,154,75,.6); background: rgba(193,154,75,.08); }
.btn.seal {
  color: #fff4e0; border-color: #5e1a12;
  background: radial-gradient(circle at 30% 25%, var(--wax-hi), var(--wax) 60%, #6a1d15);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 3px 8px rgba(0,0,0,.35);
}
.btn.wide { width: 100%; padding: 12px; font-size: 1rem; }
.count { background: var(--gold-hi); color: var(--ink); border-radius: 999px; min-width: 22px; padding: 0 6px; font-size: .8rem; line-height: 22px; text-align: center; }
.account-avatar { width: 22px; height: 22px; border-radius: 3px; image-rendering: pixelated; }

.ip-chip {
  background: rgba(0,0,0,.35); color: var(--parch-1); border: 1px dashed rgba(193,154,75,.6);
  border-radius: var(--radius); padding: 7px 12px; font-family: Consolas, monospace; font-size: .85rem;
}
.ip-label { font-family: "Cinzel", serif; color: var(--gold-hi); margin-right: 4px; }

/* ---- banners ---- */
.banner, .demo-note { margin: 18px 0 0; padding: 12px 16px; border-radius: var(--radius); }
.banner.ok { background: rgba(79,107,47,.25); border: 1px solid var(--green); }
.banner.warn { background: rgba(142,42,31,.25); border: 1px solid var(--wax-hi); }
.demo-note { background: rgba(193,154,75,.15); border: 1px dashed var(--gold); }

/* ---- hero ---- */
.hero {
  margin: 28px 0 22px; padding: 34px 32px; text-align: center; border-radius: 4px;
  border-top: 10px solid var(--parch-edge); border-bottom: 10px solid var(--parch-edge);
  position: relative;
}
.hero::before, .hero::after {
  content: ""; position: absolute; left: -6px; right: -6px; height: 14px;
  background: linear-gradient(180deg, #8a6236, #5a3c1e); border-radius: 7px;
}
.hero::before { top: -16px; } .hero::after { bottom: -16px; }
.hero h1 { color: var(--brown); font-size: clamp(1.8rem, 4vw, 2.8rem); }
.hero-sub { margin: 0 auto; max-width: 60ch; color: var(--ink-soft); font-style: italic; font-size: 1.15rem; }
.hero-sub:empty { display: none; }
.hero-sub { max-width: 110ch; line-height: 1.55; }
.hero-sub p { margin: 0 0 .75em; }
.hero-sub p:last-child { margin-bottom: 0; }
.hero-actions { margin-top: 18px; display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.hero-actions .btn { padding-left: 28px; padding-right: 28px; }

/* Supporter amount quick-picks (on parchment) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.chip {
  padding: 7px 16px; border-radius: 999px; border: 1px solid var(--parch-edge);
  background: rgba(255,255,255,.45); color: var(--ink);
  font-family: "Cinzel", serif; font-weight: 700; font-size: .9rem;
}
.chip:hover { background: rgba(193,154,75,.25); }
.chip[aria-pressed="true"] { background: var(--wax); color: #fff4e0; border-color: var(--wax-hi); }
#supButtons { margin-top: 6px; }
.rich p { margin: 0 0 .6em; }
.rich ul { margin: 0 0 .8em; padding-left: 1.4em; }
.rich li { margin: .15em 0; }
.rich li::marker { color: var(--wax); }
.notice {
  display: inline-flex; gap: 8px; align-items: center; margin: 18px 0 0;
  padding: 8px 16px; border: 1px solid rgba(92,46,0,.35); border-radius: 999px;
  background: rgba(255,255,255,.3); color: var(--brown); font-weight: 600; font-size: .95rem;
}
.notice-mark { color: var(--wax); }

/* ---- server goal ---- */
.goal { max-width: 560px; margin: 22px auto 0; text-align: left; }
.goal-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.goal-title { font-family: "Cinzel", serif; font-weight: 700; color: var(--brown); }
.goal-amount { font-weight: 600; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.goal-track {
  height: 18px; border-radius: 999px; overflow: hidden;
  background: rgba(92,46,0,.15); border: 1px solid rgba(92,46,0,.45);
  box-shadow: inset 0 2px 4px rgba(60,30,0,.3);
}
.goal-fill {
  height: 100%; width: 0; border-radius: 999px; transition: width 1.2s ease-out;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold) 60%, #9a7535);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5);
}
.goal.reached .goal-fill { background: linear-gradient(180deg, #8fae5d, var(--green)); }
.goal-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.goal-note { font-style: italic; color: var(--ink-soft); font-size: .95rem; }

/* ---- tabs ---- */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 8px 0 22px; }
.tabs:empty { display: none; }
.tab {
  padding: 8px 18px; border-radius: 999px; border: 1px solid rgba(193,154,75,.5);
  background: rgba(0,0,0,.25); color: var(--parch-2);
  font-family: "Cinzel", serif; font-weight: 700; font-size: .85rem; letter-spacing: .05em;
}
.tab:hover { background: rgba(193,154,75,.15); }
.tab[aria-pressed="true"] { background: var(--gold); color: var(--ink); border-color: var(--gold-hi); }

/* ---- grid & cards ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 22px; padding-bottom: 50px; }
.loading, .empty { grid-column: 1 / -1; text-align: center; font-style: italic; opacity: .8; padding: 40px 0; }
.card {
  border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column;
  border: 1px solid var(--parch-edge); transition: transform .15s, box-shadow .15s;
}
.card:hover { transform: translateY(-3px); box-shadow: inset 0 0 40px rgba(110,70,25,.35), 0 16px 34px rgba(0,0,0,.55); }
.card-media {
  aspect-ratio: 1 / 1; display: grid; /* square, like the product pictures */ place-items: center; position: relative; cursor: pointer;
  background: radial-gradient(circle at 50% 40%, rgba(255,255,255,.55), rgba(193,154,75,.25) 70%);
  border-bottom: 1px solid rgba(92,46,0,.25); border-width: 0 0 1px; padding: 0; width: 100%;
}
.card-media img { width: 100%; height: 100%; object-fit: contain; }
.monogram {
  width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center;
  font-family: "Cinzel", serif; font-size: 2.4rem; font-weight: 700; color: #fff4e0;
  background: radial-gradient(circle at 30% 25%, var(--wax-hi), var(--wax) 60%, #6a1d15);
  box-shadow: 0 4px 10px rgba(0,0,0,.35), inset 0 0 0 4px rgba(0,0,0,.12);
}
.ribbon {
  position: absolute; top: 12px; left: -4px; padding: 3px 12px 3px 10px;
  background: var(--wax); color: #fff4e0; font-family: "Cinzel", serif; font-size: .75rem; font-weight: 700;
  clip-path: polygon(0 0, 100% 0, 92% 50%, 100% 100%, 0 100%);
}
.ribbon.gold { background: var(--gold); color: var(--ink); }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-title { font-size: 1.05rem; color: var(--brown); }
.card-tags { font-size: .85rem; color: var(--ink-soft); font-style: italic; }
.card-foot { margin-top: auto; padding-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.price { font-family: "Cinzel", serif; font-weight: 700; font-size: 1.15rem; color: var(--ink); }
.price s { font-size: .85rem; color: var(--ink-soft); margin-right: 6px; font-weight: 500; }
.card .btn.seal { padding: 8px 14px; }

/* ---- section headings (on the dark background) ---- */
.section-title {
  display: flex; align-items: center; gap: 16px; margin: 0 0 6px;
  font-family: "Cinzel", serif; font-size: clamp(1.3rem, 3vw, 1.7rem); color: var(--gold-hi);
  text-shadow: 0 2px 6px rgba(0,0,0,.6);
}
.section-title::before, .section-title::after {
  content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.section-desc { text-align: center; margin: 0 0 18px; font-style: italic; color: var(--parch-2); text-shadow: 0 1px 4px rgba(0,0,0,.7); }
.shop-section { margin: 0 0 34px; }
.shop-section .grid { padding-bottom: 0; }
.shop-section .section-title { margin-bottom: 4px; }
.shop-section .section-title + .grid { margin-top: 18px; }

/* ---- featured row ---- */
.featured-section { margin: 6px 0 30px; }
.featured-section .section-title { margin-bottom: 18px; }
.featured-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(330px, 100%), 1fr)); gap: 22px; }
.card.feature { flex-direction: row; min-height: 190px; }
.card.feature .card-media { width: 42%; flex: none; aspect-ratio: auto; border-width: 0 1px 0 0; cursor: default; }
.card.feature .card-media img { width: 70%; height: auto; max-height: 150px; }
.card.feature .card-title { font-size: 1.2rem; }
.feature-text { margin: 0; color: var(--ink-soft); font-size: .98rem; line-height: 1.45; }
.card.feature .card-foot { flex-wrap: wrap; justify-content: flex-start; gap: 10px; }
.card.feature .card-foot .price { margin-right: auto; }
.btn.ghost-dark { color: var(--brown); border: 1px solid var(--parch-edge); background: rgba(255,255,255,.35); padding: 8px 14px; }
@media (max-width: 520px) {
  .card.feature { flex-direction: column; }
  .card.feature .card-media { width: 100%; aspect-ratio: 16 / 9; border-width: 0 0 1px 0; }
}

/* colour cycle: frames stacked on top of each other, the current one fades in */
/* (the rendered pictures already have their own margins, shadow and watermark, so they fill the whole area) */
.card-media .cycle { position: absolute; inset: 0; }
/* The fade is drawn by app.js on this canvas (true per-pixel blend, no flicker); smooth scaling. */
.card-media .cycle canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }

/* product window picture gallery */
.gallery { display: flex; flex-direction: column; gap: 10px; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumb {
  width: 64px; height: 64px; padding: 4px; border-radius: var(--radius); cursor: pointer;
  border: 1px solid var(--parch-edge); background: rgba(255,255,255,.4);
}
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.thumb[aria-pressed="true"] { border: 2px solid var(--wax); background: rgba(255,255,255,.7); }
.product-layout .card-media img { width: 100%; height: 100%; }

/* commission label on cards and in the product window */
.commission-tag { color: var(--wax); font-style: normal; font-weight: 600; }
p.commission-tag { margin: 4px 0 0; font-family: "Cinzel", serif; font-size: .95rem; }

/* ---- "coming soon" banner for empty categories ---- */
.soon-strip {
  display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap;
  margin: 14px auto 0; max-width: 760px; padding: 14px 20px; border-radius: var(--radius);
  border: 1px dashed rgba(193,154,75,.6); background: rgba(20,14,9,.55);
  color: var(--parch-2); font-style: italic; text-align: center;
}
.soon-tag {
  font-family: "Cinzel", serif; font-style: normal; font-weight: 700; font-size: .78rem; letter-spacing: .06em;
  padding: 3px 10px; border-radius: 999px; background: var(--gold); color: var(--ink);
}

/* ---- modals ---- */
.modal { border: 1px solid var(--parch-edge); border-radius: var(--radius); padding: 0; width: min(720px, 100% - 32px); max-height: 90vh; }
.modal::backdrop { background: rgba(10,6,3,.7); }
.small-modal { width: min(420px, 100% - 32px); }
.modal-body { padding: 28px; }
.modal-close { position: absolute; top: 8px; right: 10px; }
.icon-btn { background: none; border: 0; font-size: 1.8rem; line-height: 1; color: var(--ink-soft); padding: 4px 8px; }
.icon-btn:hover { color: var(--wax); }
.product-layout { display: grid; grid-template-columns: 240px 1fr; gap: 24px; }
.product-layout .card-media { border-radius: var(--radius); border: 1px solid rgba(92,46,0,.25); cursor: default; }
.product-layout h2 { color: var(--brown); font-size: 1.5rem; padding-right: 30px; }
.desc { color: var(--ink); margin: 12px 0 18px; line-height: 1.5; }
.desc.plain { white-space: pre-line; }
.desc:empty { display: none; }
.desc > :first-child { margin-top: 0; }
.desc ul, .desc ol { padding-left: 1.3em; }
.desc a { color: var(--wax); }
.deliver-to { margin: 10px 0 0; font-size: .95rem; color: var(--ink); }
.link-btn { background: none; border: 0; padding: 0 0 0 6px; color: var(--wax); text-decoration: underline; font-size: .9rem; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 16px 0; font-weight: 600; color: var(--ink-soft); }
.field input {
  font: inherit; padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--parch-edge);
  background: rgba(255,255,255,.6); color: var(--ink);
}
.field input:focus { outline: 2px solid var(--gold); }
.form-error { color: var(--wax); font-weight: 600; margin: 0 0 12px; }
.modal h2 { color: var(--brown); }

/* ---- drawer ---- */
.backdrop { position: fixed; inset: 0; background: rgba(10,6,3,.6); z-index: 30; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: min(400px, 100%); z-index: 31;
  display: flex; flex-direction: column; transform: translateX(105%); transition: transform .25s ease;
  border-left: 3px solid var(--gold);
}
.drawer.open { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid rgba(92,46,0,.25); }
.drawer-head h2 { color: var(--brown); font-size: 1.3rem; }
.drawer-body { flex: 1; overflow-y: auto; padding: 10px 20px; }
.drawer-foot { padding: 16px 20px 22px; border-top: 1px solid rgba(92,46,0,.25); }
.total-row { display: flex; justify-content: space-between; font-family: "Cinzel", serif; font-size: 1.15rem; }
.line { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 12px 0; border-bottom: 1px dashed rgba(92,46,0,.25); }
.line-name { font-weight: 600; color: var(--brown); }
.line-price { font-family: "Cinzel", serif; font-weight: 700; text-align: right; }
.qty { justify-self: start; display: inline-flex; align-items: center; border: 1px solid var(--parch-edge); border-radius: var(--radius); overflow: hidden; }
.qty button { background: rgba(255,255,255,.4); border: 0; width: 30px; height: 28px; color: var(--ink); font-weight: 700; }
.qty span { min-width: 30px; text-align: center; }
.remove { background: none; border: 0; color: var(--wax); text-decoration: underline; font-size: .9rem; justify-self: end; }

/* ---- terms page ---- */
.terms { margin: 32px auto 50px; max-width: 860px; padding: 40px clamp(20px, 5vw, 56px); border-radius: var(--radius); line-height: 1.6; }
.terms h1 { color: var(--brown); text-align: center; font-size: clamp(1.7rem, 4vw, 2.4rem); margin-bottom: 18px; }
.terms h2 { color: var(--brown); font-size: 1.3rem; margin: 28px 0 8px; padding-top: 18px; border-top: 1px solid rgba(92,46,0,.25); }
.terms-list { padding-left: 1.6em; }
.terms-list > li { margin: 12px 0; padding-left: 4px; }
.terms-list > li::marker { font-family: "Cinzel", serif; font-weight: 700; color: var(--wax); }
.terms-list ul { margin: 8px 0; }
.terms a:not(.btn) { color: var(--wax); }
.terms-notice { margin-top: 24px; padding: 12px 16px; border-left: 4px solid var(--wax); background: rgba(255,255,255,.3); }

/* ---- checkout agreement ---- */
.agree { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0 12px; font-size: .95rem; color: var(--ink); cursor: pointer; }
.agree input { margin-top: 5px; width: 17px; height: 17px; accent-color: var(--wax); flex: none; }
.agree a { color: var(--wax); }

/* ---- PayPal checkout ---- */
.drawer-foot { max-height: 72vh; overflow-y: auto; }
.field.compact { margin: 12px 0 0; gap: 4px; }
.field.compact input { padding: 8px 10px; }
.field small { font-weight: 400; font-style: italic; }
.checkout-hint { margin: 4px 0 10px; font-size: .92rem; font-style: italic; color: var(--ink-soft); }
#paypalButtons { margin-top: 6px; }
.commission-note { margin: 8px 0 12px; padding: 10px 14px; border-left: 4px solid var(--gold); background: rgba(193,154,75,.15); font-size: .95rem; }
.terms-placeholder { background: rgba(193,154,75,.35); padding: 0 4px; border-radius: 3px; }

/* ---- heraldry designer (product window) ---- */
.modal.wide { width: min(960px, 100% - 32px); }
.product-layout > .designer, .product-layout > .card-foot.full { grid-column: 1 / -1; }
.product-layout > .designer { margin: 0; }
.designer .design-controls .swatches { max-width: 640px; }
.designer { margin: 4px 0 18px; padding: 16px 18px; border: 1px solid var(--parch-edge); border-radius: var(--radius); background: rgba(255,255,255,.28); color: var(--ink); }
.designer h3 { color: var(--brown); font-size: 1.15rem; margin-bottom: 4px; }
.design-intro { margin: 0 0 10px; font-size: .95rem; font-style: italic; color: var(--ink-soft); }
.designer-grid { display: grid; grid-template-columns: 170px 1fr; gap: 24px; align-items: start; }
.design-preview-box { position: sticky; top: 0; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.design-metal { margin: 0; }
.design-metal figcaption { font-family: "Cinzel", serif; font-size: .78rem; font-weight: 700; color: var(--brown); margin-top: 2px; }
.design-preview { width: 102px; height: auto; image-rendering: pixelated; filter: drop-shadow(0 4px 6px rgba(0,0,0,.35)); }
.design-preview.livery { width: 64px; }    /* 16x16 chestplate icon: 4x, whole pixels */
.designer-grid:has(.with-stand) { grid-template-columns: 300px 1fr; }
.with-stand .design-metals { gap: 2px; flex-wrap: nowrap; }
.design-stand-box { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.design-stand { width: 255px; height: auto; filter: drop-shadow(0 6px 8px rgba(0,0,0,.3)); }
.view-btns { display: flex; gap: 6px; }
.view-btn { font: inherit; font-size: .8rem; font-weight: 700; padding: 3px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--parch-edge); background: rgba(255,255,255,.5); color: var(--ink); }
.view-btn[aria-pressed="true"] { background: var(--wax); border-color: var(--wax); color: #fff4e0; }
.design-metals { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.with-stand .design-metal figcaption { font-size: .66rem; }
.design-metal.pickable { cursor: pointer; padding: 4px 4px 2px; border-radius: 8px; border: 2px solid transparent; }
.design-metal.pickable[aria-pressed="true"] { border-color: var(--gold-hi); background: rgba(255,255,255,.35); }
.design-row.design-check { flex-direction: row; justify-content: flex-start; align-items: center; gap: 8px; font-weight: 600; font-size: .92rem; color: var(--ink-soft); cursor: pointer; }
.design-row.design-check input { margin: 0; flex: none; width: 18px; height: 18px; accent-color: var(--wax); }
.design-symbol-note { margin: 8px 0 0; font-size: .85rem; font-style: italic; color: var(--ink-soft); }
.design-controls { display: flex; flex-direction: column; gap: 10px; }
.design-row { display: flex; flex-direction: column; gap: 4px; }
.design-label { font-weight: 600; font-size: .92rem; color: var(--ink-soft); }
.designer input#heraldryName { max-width: 260px; font-family: "Cinzel", serif; font-weight: 700; letter-spacing: .03em; }
.name-hint { font-size: .8rem; font-style: italic; color: var(--ink-soft); }
.name-hint.bad { color: var(--wax); font-weight: 600; }
.designer select, .designer textarea, .designer input#heraldryName {
  font: inherit; font-size: .95rem; padding: 6px 10px; border-radius: var(--radius);
  border: 1px solid var(--parch-edge); background: rgba(255,255,255,.6); color: var(--ink);
}
.designer textarea { resize: vertical; }
.designer select:focus, .designer textarea:focus, .designer input#heraldryName:focus { outline: 2px solid var(--gold); }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch {
  width: 28px; height: 28px; padding: 0; border-radius: 4px; background-color: var(--sw);
  border: 2px solid rgba(58,36,20,.35); box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);
}
.swatch:hover { transform: translateY(-1px); }
.swatch[aria-checked="true"] { border-color: var(--wax); outline: 2px solid var(--gold-hi); outline-offset: 1px; }
.swatch.custom {
  font-family: "Cinzel", serif; font-weight: 700; font-size: .9rem; line-height: 1; color: #fff4e0; text-shadow: 0 1px 2px rgba(0,0,0,.7);
  background: conic-gradient(#953935, #CFA940, #506323, #1F787C, #425890, #795294, #953935);
}
.swatch.custom.set { background: var(--sw); }
.custom-color { margin-top: 8px; padding: 8px 10px; border: 1px dashed var(--parch-edge); border-radius: var(--radius); background: rgba(255,255,255,.3); }
.custom-inputs { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0 6px; }
.shade-box { display: block; width: 100%; max-width: 320px; height: 120px; border-radius: 4px; border: 1px solid var(--parch-edge); cursor: crosshair; touch-action: none; }
.hue-slider { display: block; width: 100%; max-width: 320px; margin: 8px 0 0; height: 14px; border-radius: 7px; -webkit-appearance: none; appearance: none; border: 1px solid var(--parch-edge); }
.hue-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #fff4e0; border: 2px solid var(--ink); cursor: pointer; }
.hue-slider::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff4e0; border: 2px solid var(--ink); cursor: pointer; }
.custom-became { font-size: .8rem; font-style: italic; color: var(--wax); }
.custom-inputs input[type="text"] {
  font: inherit; font-size: .95rem; width: 110px; padding: 5px 8px; border-radius: var(--radius); text-transform: uppercase;
  border: 1px solid var(--parch-edge); background: rgba(255,255,255,.6); color: var(--ink);
}
.custom-inputs input.bad { border-color: var(--wax); outline: 1px solid var(--wax); }
.custom-color small { display: block; font-size: .82rem; font-style: italic; color: var(--ink-soft); line-height: 1.35; }
.sigil-count { align-self: flex-end; font-size: .78rem; color: var(--ink-soft); }
.line-design { grid-column: 1 / -1; font-size: .85rem; font-style: italic; color: var(--ink-soft); }
.banner-designs { margin: 6px 0 0; text-align: left; }
@media (max-width: 640px) { .designer-grid { grid-template-columns: 1fr; } .design-preview-box { position: static; flex-direction: row; flex-wrap: wrap; justify-content: center; } .design-preview { width: 84px; } }

/* ---- footer & toast ---- */
.footer { border-top: 2px solid var(--gold); background: rgba(0,0,0,.4); padding: 22px 0; text-align: center; color: var(--parch-2); }
.footer p { margin: 6px 0; }
.legal a { color: var(--gold-hi); }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 50;
  background: var(--wood-1); color: var(--parch-1); border: 1px solid var(--gold);
  padding: 10px 18px; border-radius: var(--radius); box-shadow: var(--shadow);
}

@media (max-width: 640px) {
  body { font-size: 17px; }
  .product-layout { grid-template-columns: 1fr; }
  .hero { padding: 26px 18px; }
  .brand-tag { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
