@font-face { font-family: 'Caveat'; font-weight: 700; font-style: normal; font-display: swap; src: url('/story/fonts/caveat.woff2') format('woff2'); }
@font-face { font-family: 'Pacifico'; font-weight: 400; font-style: normal; font-display: swap; src: url('/story/fonts/pacifico.woff2') format('woff2'); }
@font-face { font-family: 'Dancing Script'; font-weight: 700; font-style: normal; font-display: swap; src: url('/story/fonts/dancing-script.woff2') format('woff2'); }
@font-face { font-family: 'Permanent Marker'; font-weight: 400; font-style: normal; font-display: swap; src: url('/story/fonts/permanent-marker.woff2') format('woff2'); }
@font-face { font-family: 'Playfair Display'; font-weight: 700; font-style: normal; font-display: swap; src: url('/story/fonts/playfair-display.woff2') format('woff2'); }
@font-face { font-family: 'Bebas Neue'; font-weight: 400; font-style: normal; font-display: swap; src: url('/story/fonts/bebas-neue.woff2') format('woff2'); }
@font-face { font-family: 'Archivo Black'; font-weight: 400; font-style: normal; font-display: swap; src: url('/story/fonts/archivo-black.woff2') format('woff2'); }
@font-face { font-family: 'Lobster'; font-weight: 400; font-style: normal; font-display: swap; src: url('/story/fonts/lobster.woff2') format('woff2'); }

:root {
  --ink: #1b1b1f;
  --muted: #62626a;
  --lime: #d7f000;
  --lav: #7f6e9e;
  --lav-l: #b9a6cf;
  --card: #ffffff;
  --card-2: #ecebe7;
  --teal: #0b5e63;
  --radius: 24px;
}

* { box-sizing: border-box; }
html { background: #f4f3f1; }
body {
  margin: 0;
  font-family: ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  line-height: 1.5;
  background: #f4f3f1 linear-gradient(180deg, #f0ebf7 0%, #f4f3f1 520px) no-repeat;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: 96px;
}

a { color: var(--teal); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--lav); outline-offset: 2px; }

h1, h2, h3 {
  margin: 0;
  letter-spacing: -0.02em;
  line-height: 1.15;
  font-weight: 600;
}
p { margin: 0; }

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Header */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 8px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  text-decoration: none;
  color: var(--ink);
  min-height: 44px;
}
.brand img {
  height: 28px;
  width: auto;
  display: block;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.toplinks {
  display: flex;
  gap: 6px;
}
.toplinks a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.toplinks a.active {
  background: var(--ink);
  color: #fff;
}
@media (max-width: 600px) {
  .toplinks { display: none; }
}

/* Hamburger menu */
.hamb {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid #e3e1dc;
  background: var(--card);
  color: #5b5b63;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.hamb:hover {
  background: var(--card-2);
  border-color: #dcd9d2;
}
.ni {
  width: 20px;
  height: 20px;
  flex: none;
}
.ni.sm {
  width: 16px;
  height: 16px;
}
#nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 25, 0.35);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 60;
}
#nav-menu {
  overflow-y: auto;
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: min(84vw, 320px);
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  z-index: 70;
  transform: translateX(100%);
  transition: transform 0.28s ease;
  display: flex;
  flex-direction: column;
  padding: 20px;
  box-shadow: -12px 0 40px rgba(0,0,0,0.12);
  border-left: 1px solid #ecebe7;
  visibility: hidden;
}
#nav-menu.open {
  transform: none;
  visibility: visible;
}
.nav-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 20px;
}
.nav-head button {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 0;
  background: var(--card-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  display: grid;
  gap: 4px;
  align-content: start;
}
.nav-list a, .nav-list button {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 16px;
  border: 0;
  background: none;
  color: var(--ink);
  text-decoration: none;
  font-size: 16px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.nav-list a:hover, .nav-list button:hover {
  background: var(--card-2);
}
.nav-list .ni {
  color: #8a8a92;
}
.nav-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card-2);
  border-radius: 18px;
  padding: 14px 16px;
  margin-top: 24px;
}
.nav-foot small {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

/* Hero */
.hero {
  padding: 20px 0 16px;
  text-align: center;
}
.hero h1 {
  font-size: clamp(30px, 7vw, 44px);
  font-weight: 600;
}
.hero h1 b {
  font-weight: 800;
  color: var(--ink);
}
.hero p {
  margin: 8px auto 0;
  color: var(--muted);
  font-size: 16px;
  max-width: 48ch;
}

/* Controls Bar above Canvas */
.mode-switch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 14px 0;
  padding: 10px 16px;
  background: var(--card);
  border-radius: 999px;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
  box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}
.mode-lbl {
  font-size: 14px;
  font-weight: 600;
}
.toggle {
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: var(--card-2);
  border: none;
  cursor: pointer;
  position: relative;
  transition: background 0.2s;
  padding: 2px;
}
.toggle[aria-checked="true"] {
  background: var(--lav);
}
.toggle .knob {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle[aria-checked="true"] .knob {
  transform: translateX(20px);
}

/* Story Canvas Stage */
.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 10px auto 20px;
}
.phone-frame {
  position: relative;
  width: min(100%, 360px);
  aspect-ratio: 9 / 16;
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 16px 40px -8px rgba(27,27,31,0.18), 0 0 0 1px rgba(27,27,31,0.08);
  background: #000;
  cursor: pointer;
}
.phone-frame canvas {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}
.stage-hint {
  margin-top: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Frame Selector (if multi-frame) */
.frame-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
.frame-btn {
  border: none;
  background: var(--card);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  color: var(--muted);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.frame-btn.active {
  background: var(--ink);
  color: #fff;
}
.frame-add {
  border: 1px dashed var(--lav-l);
  background: transparent;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 18px;
  font-weight: 600;
  color: var(--lav);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Cards Section */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 16px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.03);
}
.card h2 {
  font-size: 18px;
  margin-bottom: 12px;
}

/* Template Selector Carousel */
.tpl-carousel {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 4px 2px 14px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.tpl-item {
  flex: 0 0 120px;
  scroll-snap-align: start;
  border: 2px solid transparent;
  border-radius: 18px;
  background: var(--card-2);
  padding: 6px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}
.tpl-item.active {
  border-color: var(--lav);
  background: #f0ebf7;
}
.tpl-thumb {
  width: 100%;
  aspect-ratio: 9 / 16;
  border-radius: 12px;
  overflow: hidden;
  background: #eee;
}
.tpl-thumb canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.tpl-name {
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-top: 6px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Photo Tray */
.tray {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  padding: 6px 0;
}
.tray-add {
  flex: 0 0 72px;
  height: 72px;
  border-radius: 16px;
  border: 2px dashed var(--lav-l);
  background: #f7f5fa;
  color: var(--lav);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  gap: 2px;
}
.tray-add svg { width: 22px; height: 22px; }
.tray-list {
  display: flex;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.tray-item {
  position: relative;
  flex: 0 0 72px;
  height: 72px;
  border-radius: 16px;
  overflow: hidden;
  background: var(--card-2);
}
.tray-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.tray-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.65);
  color: #fff;
  border: none;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Text Fields */
.field-grid {
  display: grid;
  gap: 12px;
}
.field {
  display: grid;
  gap: 4px;
}
.field span {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.field input, .field textarea {
  width: 100%;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid #dcd9d2;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  background: #faf9f7;
}
.field input:focus, .field textarea:focus {
  border-color: var(--lav);
  background: #fff;
}

/* Fixed Bottom Action Bar */
.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(0,0,0,0.06);
  padding: 12px 16px;
  z-index: 50;
}
.bottom-inner {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.status-msg {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}
.btn-dl {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 24px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  border: none;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
}
.btn-dl:hover {
  background: var(--lav);
  transform: translateY(-1px);
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lime);
}

/* Modals / Dialogs */
dialog {
  border: none;
  border-radius: 28px;
  padding: 24px;
  max-width: 440px;
  width: 90%;
  background: #fff;
  box-shadow: 0 24px 60px rgba(0,0,0,0.25);
}
dialog::backdrop {
  background: rgba(0,0,0,0.4);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.dlg-top {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}
.dlg-x {
  border: none;
  background: var(--card-2);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dlg-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
}
.dlg-sub {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 18px;
}
.sheet-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
  margin-bottom: 16px;
}
.sheet-tile {
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
}
.sheet-tile.active {
  border-color: var(--lav);
}
.sheet-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.btn-primary {
  width: 100%;
  min-height: 46px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  border: none;
  cursor: pointer;
  font-size: 15px;
}
.btn-primary:hover {
  background: var(--lav);
}
.btn-ghost {
  width: 100%;
  min-height: 40px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  margin-top: 8px;
}

/* Progress bar in Done modal */
.progress {
  height: 8px;
  border-radius: 999px;
  background: var(--card-2);
  overflow: hidden;
  margin: 16px 0;
}
.progress-fill {
  height: 100%;
  background: var(--lav);
  width: 0%;
  transition: width 0.2s;
}
.done-check {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--lime);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin: 0 auto 12px;
}
.copy-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f7f5fa;
  border-radius: 12px;
  padding: 10px 14px;
  margin: 16px 0;
  font-size: 13px;
  color: var(--ink);
}
.copy-pill button {
  border: none;
  background: var(--lav);
  color: #fff;
  padding: 4px 12px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  font-size: 12px;
}

/* Customization Card & Accordion */
.card-head-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  text-align: left;
  color: var(--ink);
}
.chevron-ico {
  width: 22px;
  height: 22px;
  color: var(--muted);
  transition: transform 0.25s ease;
}
.card-head-toggle[aria-expanded="false"] .chevron-ico {
  transform: rotate(-90deg);
}
.custom-body {
  display: grid;
  gap: 16px;
  margin-top: 16px;
  transition: all 0.25s ease;
}
.custom-body[hidden] {
  display: none;
}
.custom-section {
  display: grid;
  gap: 8px;
}
.custom-sec-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.color-swatches {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  position: relative;
  outline: none;
}
.swatch:hover {
  transform: scale(1.1);
}
.swatch.active {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--lav);
}
.swatch-picker {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card-2);
  border: 1px dashed var(--muted);
  cursor: pointer;
  overflow: hidden;
}
.swatch-picker input[type=color] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.swatch-picker .plus-icon {
  font-size: 18px;
  font-weight: 700;
  color: var(--muted);
  line-height: 1;
}
.badge-pill {
  font-size: 12px;
  font-weight: 700;
  background: #f0ebf7;
  color: var(--lav);
  padding: 4px 10px;
  border-radius: 999px;
}

/* Box Size / Layout Card */
.preset-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.preset-btn {
  border: 1px solid var(--card-2);
  background: var(--card-2);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink);
  white-space: nowrap;
  transition: all 0.15s ease;
}
.preset-btn.active, .preset-btn:hover {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.slider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.slider-field {
  display: grid;
  gap: 8px;
  padding: 4px 0;
}
.slider-lbl {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.slider-lbl span:last-child {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  color: var(--ink);
  background: var(--card-2);
  padding: 2px 8px;
  border-radius: 6px;
}
.slider-field input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #e8e4f0;
  outline: none;
  cursor: pointer;
  touch-action: pan-x;
  margin: 6px 0;
  accent-color: var(--lav);
}
.slider-field input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ffffff;
  border: 2.5px solid var(--lav);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.slider-field input[type=range]::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ffffff;
  border: 2.5px solid var(--lav);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.slider-field input[type=range]:active::-webkit-slider-thumb {
  transform: scale(1.15);
  box-shadow: 0 0 0 6px rgba(138, 43, 226, 0.18), 0 3px 8px rgba(0, 0, 0, 0.28);
}
.slider-field input[type=range]:active::-moz-range-thumb {
  transform: scale(1.15);
  box-shadow: 0 0 0 6px rgba(138, 43, 226, 0.18), 0 3px 8px rgba(0, 0, 0, 0.28);
}

/* Site Footer */
.site-foot {
  margin-top: 48px;
  border-top: 1px solid #e3e1dc;
  padding: 32px 0 28px;
  color: var(--muted);
  font-size: 14px;
  display: grid;
  gap: 24px;
}
.foot-top {
  display: grid;
  gap: 10px;
}
.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}
.foot-links a {
  color: var(--muted);
  text-decoration: none;
}
.foot-links a:hover {
  color: var(--ink);
}
.foot-base {
  border-top: 1px solid #e3e1dc;
  padding-top: 20px;
  text-align: center;
  font-size: 13px;
}
