:root {
  --bg: #e6eaee;
  --ink: #16181c;
  --muted: #5c6570;
  --line: rgba(22, 24, 28, 0.12);
  --brass: #9a7b2f;
  --brass-ink: #6f5618;
  --surface: rgba(255, 255, 255, 0.62);
  --stage: #c8d0d8;
  --radius: 8px;
  --font-display: "Syne", sans-serif;
  --font-body: "Figtree", sans-serif;
  --space: clamp(1rem, 2.5vw, 1.75rem);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(120% 80% at 80% -10%, #f4f6f8 0%, transparent 55%),
    radial-gradient(90% 60% at -10% 40%, #cfd6dd 0%, transparent 50%),
    linear-gradient(165deg, var(--bg) 0%, #c8d0d8 100%);
  background-attachment: fixed;
  line-height: 1.45;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--brass-ink);
}

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem var(--space);
  backdrop-filter: blur(10px);
  background: rgba(230, 234, 238, 0.82);
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.03em;
  font-size: 1.15rem;
  color: var(--ink);
  text-decoration: none;
}

.top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.top .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 0.95rem;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #f3f5f7;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none;
  border-radius: 6px;
  cursor: pointer;
}

.top .btn:hover {
  background: #2a2e35;
}

.cart-badge[hidden],
[data-cart-empty-cta][hidden] {
  display: none !important;
}

.page-head {
  padding: 1.25rem var(--space) 0.35rem;
  max-width: none;
}

.page-head h1 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 3.5vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.page-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 48ch;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  flex: 1;
  min-height: 0;
}

.stage {
  padding: var(--space);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.canvas-wrap {
  flex: 1;
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    radial-gradient(circle at 50% 35%, #dfe5eb 0%, var(--stage) 60%);
  overflow: hidden;
}

#preview {
  width: 92%;
  height: 78%;
  max-height: 420px;
  filter: drop-shadow(0 12px 24px rgba(22, 24, 28, 0.18));
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.meta strong {
  color: var(--ink);
  font-weight: 600;
}

.panel {
  padding: var(--space);
  background: var(--surface);
  border-left: 1px solid var(--line);
  overflow: auto;
}

.field {
  margin-bottom: 1rem;
}

.field label,
.field .opt-label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.4rem;
  font-weight: 600;
}

input[type="text"],
input[type="email"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
  padding: 0.55rem 0.7rem;
  font: inherit;
  font-size: 0.95rem;
}

textarea {
  min-height: 4rem;
  resize: vertical;
}

.seg {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.seg button {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 0.55rem 0.45rem;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.seg button.is-on {
  border-color: var(--brass);
  background: rgba(154, 123, 47, 0.12);
  color: var(--brass-ink);
  font-weight: 600;
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.swatch {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 2px solid transparent;
  padding: 0;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.swatch.is-on {
  border-color: var(--ink);
  outline: 2px solid var(--brass);
  outline-offset: 1px;
}

.swatch[data-color="light-grey"] {
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
}

.swatch--shine {
  background: linear-gradient(
    145deg,
    #e85a72 0%,
    #a01830 38%,
    #7a0f24 62%,
    #f2a0ae 100%
  ) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2),
    inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.hint {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.font-note {
  margin: 0.4rem 0 0;
  font-size: 0.8rem;
  line-height: 1.35;
  color: #7a1f1f;
}

.font-note[hidden],
.stage-warn[hidden],
.warn[hidden] {
  display: none !important;
}

.stage-warn {
  margin: 0.65rem 0 0;
  padding: 0 0.15rem;
  font-size: 0.85rem;
  line-height: 1.4;
  color: #7a1f1f;
}

.warn {
  margin: 0.45rem 0 0;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius);
  background: rgba(198, 40, 40, 0.1);
  color: #7a1f1f;
  font-size: 0.85rem;
}

.summary {
  margin: 1.25rem 0 1rem;
  padding: 0.85rem 0 0;
  border-top: 1px solid var(--line);
}

.summary h2 {
  margin: 0 0 0.55rem;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
}

.summary dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.75rem;
  font-size: 0.88rem;
}

.summary dt {
  color: var(--muted);
}

.summary dd {
  margin: 0;
  font-weight: 600;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font: inherit;
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  cursor: pointer;
  text-decoration: none;
  background: var(--brass);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--brass-ink);
  border: 1px solid rgba(154, 123, 47, 0.45);
}

.copy-status {
  min-height: 1.2em;
  margin: 0.25rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .panel {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .canvas-wrap {
    min-height: 220px;
  }
}
