:root {
  --bg: #f3f0ea;          /* warm paper */
  --surface: #fbfaf7;     /* card */
  --surface-2: #ffffff;
  --ink: #28251f;         /* deep warm ink */
  --ink-soft: #756f64;
  --ink-faint: #a59f93;
  --line: #e4ded3;
  --line-soft: #ece7dd;
  --wall-bg: #ece8e0;
  --wall-rail: #ddd6ca;
  --frame: #ffffff;
  --shadow-card: 0 1px 2px rgba(40,37,31,.04), 0 12px 30px rgba(40,37,31,.05);
  --shadow-frame: 0 1px 1px rgba(40,37,31,.06), 0 10px 22px rgba(40,37,31,.12);
  --radius: 16px;
  --radius-sm: 11px;
  --maxw: 680px;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  padding-bottom: 104px; /* clear sticky bar */
}

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

/* Header */
.site-header { padding: 64px 0 26px; text-align: center; }
.eyebrow {
  margin: 0 0 18px; font-size: 11px; letter-spacing: .28em;
  text-transform: uppercase; color: var(--ink-faint); font-weight: 500;
}
h1 {
  margin: 0 0 18px; font-family: var(--serif);
  font-size: 40px; line-height: 1.05; font-weight: 400;
  letter-spacing: -.015em; font-optical-sizing: auto;
}
.lede {
  margin: 0 auto; max-width: 42ch; color: var(--ink-soft);
  font-size: 16px; line-height: 1.65;
}

/* Panels */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 22px;
  margin: 20px 0;
  box-shadow: var(--shadow-card);
}
.panel-head { display: flex; align-items: center; gap: 13px; margin-bottom: 20px; }
.step {
  font-family: var(--serif); font-size: 13px; letter-spacing: .04em;
  color: var(--ink-faint); font-weight: 500;
  border: 1px solid var(--line); border-radius: 50px; padding: 3px 11px;
}
h2 { margin: 0; font-family: var(--serif); font-size: 21px; font-weight: 400; letter-spacing: -.01em; }
.hint { margin: 0 0 18px; color: var(--ink-soft); font-size: 14px; }

/* Template picker */
.template-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; }
.template-card {
  border: 1px solid var(--line); background: var(--surface-2);
  border-radius: var(--radius-sm); padding: 16px 8px 12px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  font-family: inherit; color: var(--ink);
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.template-card:hover { border-color: var(--ink-faint); transform: translateY(-1px); }
.template-card[aria-selected="true"] {
  border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink);
}
.template-card .mini { width: 100%; height: 48px; display: block; }
.template-card .mini rect { fill: none; stroke: var(--ink-faint); stroke-width: 2.4; }
.template-card[aria-selected="true"] .mini rect { stroke: var(--ink); fill: rgba(40,37,31,.06); }
.template-card .tname { font-size: 12px; color: var(--ink-soft); text-align: center; line-height: 1.3; letter-spacing: .01em; }
.template-card[aria-selected="true"] .tname { color: var(--ink); }

/* Wall */
.wall-stage {
  position: relative;
  background:
    linear-gradient(180deg, #f0ece4 0%, var(--wall-bg) 100%);
  border-radius: 13px;
  padding: 34px 18px 30px;
  overflow: hidden;
}
.wall-stage::after { /* picture-rail line */
  content: ""; position: absolute; left: 0; right: 0; top: 16px;
  height: 1px; background: var(--wall-rail);
}
.wall { position: relative; width: 100%; margin: 0 auto; display: grid; gap: 13px; }
.slot {
  position: relative; background: var(--frame);
  border: 1px solid #efe9df; padding: 7px;
  border-radius: 2px;
  box-shadow: var(--shadow-frame);
  cursor: pointer; overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease;
}
.slot:hover { transform: translateY(-2px); box-shadow: 0 2px 2px rgba(40,37,31,.06), 0 16px 30px rgba(40,37,31,.16); }
.slot img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 1px; }
.slot .slot-empty {
  display: grid; place-items: center; width: 100%; height: 100%;
  color: var(--ink-faint); font-size: 12px; letter-spacing: .04em; background: #f4f0e9;
}
.slot::after {
  content: "Swap"; position: absolute; left: 50%; bottom: 9px; transform: translateX(-50%) translateY(4px);
  font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: #fff;
  background: rgba(40,37,31,.72); padding: 4px 11px; border-radius: 40px;
  opacity: 0; transition: opacity .18s ease, transform .18s ease; pointer-events: none;
}
.slot:hover::after, .slot:focus-visible::after { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Totals */
.wall-meta { margin: 22px 2px 6px; }
.totals { display: flex; align-items: baseline; justify-content: space-between; }
.totals-count { color: var(--ink-soft); font-size: 14px; letter-spacing: .01em; }
.totals-price { font-family: var(--serif); font-size: 26px; font-weight: 400; letter-spacing: -.01em; }
.discount-note { margin: 7px 0 0; font-size: 13px; color: var(--ink-soft); }

/* Buttons */
.btn {
  font-family: var(--sans); font-size: 15px; font-weight: 500; border-radius: 11px;
  padding: 14px 18px; cursor: pointer; border: 1px solid transparent;
  transition: background .18s ease, border-color .18s ease, opacity .18s ease, transform .12s ease;
}
.btn:active { transform: scale(.985); }
.btn-primary { background: var(--ink); color: #fbfaf7; border-color: var(--ink); white-space: nowrap; }
.btn-primary:hover { background: #15130f; }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; }
.btn-sm { padding: 12px 18px; }

.actions-secondary { display: flex; gap: 8px; margin-top: 20px; }
.btn-ghost {
  background: transparent; border-color: var(--line); color: var(--ink);
  flex: 1 1 0; font-size: 13.5px; font-weight: 400; padding: 12px 8px; letter-spacing: .01em;
}
.btn-ghost:hover { border-color: var(--ink-faint); background: var(--surface-2); }

.fine-print { font-size: 12px; color: var(--ink-faint); text-align: center; margin: 8px 0 8px; line-height: 1.6; }

/* Sticky CTA bar */
.cta-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: rgba(251,250,247,.86);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.cta-bar-inner { display: flex; align-items: center; gap: 14px; padding-top: 12px; padding-bottom: 12px; }
.cta-summary { display: flex; flex-direction: column; line-height: 1.2; }
.cta-count { font-size: 12px; color: var(--ink-soft); letter-spacing: .02em; }
.cta-price { font-family: var(--serif); font-size: 21px; font-weight: 400; }
.cta-bar .btn-primary { margin-left: auto; flex: 0 0 auto; }

/* Sheet / modal */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(40,37,31,.36);
  display: flex; align-items: flex-end; justify-content: center; z-index: 50;
  animation: fade .2s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  background: var(--surface); width: 100%; max-width: var(--maxw);
  border-radius: 22px 22px 0 0; padding: 10px 20px 30px;
  max-height: 84vh; overflow-y: auto; box-shadow: 0 -10px 44px rgba(40,37,31,.2);
  animation: slideup .26s cubic-bezier(.22,.61,.36,1);
}
@keyframes slideup { from { transform: translateY(14px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
.sheet--center { border-radius: 18px; margin: auto; max-height: none; padding-top: 18px; }
.sheet-handle { width: 38px; height: 4px; border-radius: 4px; background: var(--line); margin: 8px auto 4px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 16px; }
.sheet-head h3 { margin: 0; font-family: var(--serif); font-size: 19px; font-weight: 400; }
.icon-btn { background: none; border: none; font-size: 26px; line-height: 1; color: var(--ink-soft); cursor: pointer; padding: 0 4px; }

/* Poster grid */
.poster-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.poster-pick {
  border: 1px solid var(--line); background: var(--surface-2); border-radius: var(--radius-sm);
  padding: 9px; cursor: pointer; text-align: left; font-family: inherit; color: var(--ink);
  transition: border-color .18s ease, transform .18s ease;
}
.poster-pick:hover { border-color: var(--ink-faint); transform: translateY(-1px); }
.poster-pick img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 7px; display: block; }
.poster-pick .pp-title { font-size: 12.5px; line-height: 1.35; margin: 9px 2px 2px; }
.poster-pick .pp-price { font-size: 12px; color: var(--ink-soft); margin: 0 2px; }

/* Share */
.share-row { display: flex; gap: 8px; }
.share-row input {
  flex: 1; font-family: var(--sans); font-size: 13px; padding: 12px 13px;
  border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); color: var(--ink-soft);
}

/* Frame guide */
.frame-guide table { width: 100%; border-collapse: collapse; font-size: 14px; }
.frame-guide th, .frame-guide td { text-align: left; padding: 11px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.frame-guide th { color: var(--ink-soft); font-weight: 500; white-space: nowrap; padding-right: 16px; }
.frame-guide p { font-size: 13px; color: var(--ink-soft); margin: 16px 2px 0; line-height: 1.6; }

/* Footer */
.site-footer { padding: 30px 0 40px; text-align: center; }
.site-footer p { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); margin: 0; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  background: var(--ink); color: #fbfaf7; padding: 12px 20px;
  border-radius: 40px; font-size: 14px; z-index: 70; box-shadow: var(--shadow-card);
}

/* Desktop */
@media (min-width: 620px) {
  .site-header { padding: 80px 0 30px; }
  h1 { font-size: 52px; }
  .panel { padding: 32px 34px; }
  .poster-grid { grid-template-columns: 1fr 1fr 1fr; }
  .sheet-backdrop { align-items: center; }
  .sheet { border-radius: 20px; }
  .sheet-handle { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, .sheet, .sheet-backdrop { animation: none !important; transition: none !important; }
}
