:root {
  --wine: #5b0b06;
  --deep: #240604;
  --gold: #f5b71b;
  --gold-light: #ffd35d;
  --paper: #fffaf2;
  --ink: #2d1712;
  --muted: #745f59;
  --line: #eadfd6;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: linear-gradient(180deg, #f7f2eb 0%, #fff 64%, #fbf6ef 100%);
  font-family: "DM Sans", system-ui, sans-serif;
  overflow-x: hidden;
  isolation: isolate;
}

body:not(.share-page)::before {
  content: "";
  position: absolute;
  z-index: -2;
  inset: 0 0 auto;
  height: 660px;
  background:
    radial-gradient(circle at 18% 10%, rgba(240, 169, 28, .2), transparent 30rem),
    radial-gradient(circle at 88% 35%, rgba(206, 67, 24, .2), transparent 27rem),
    linear-gradient(135deg, #260403 0%, #5c0b06 52%, #310503 100%);
  box-shadow: inset 0 -1px rgba(255,255,255,.08);
}

body:not(.share-page)::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 0 auto;
  height: 660px;
  opacity: .16;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cpath d='M72 0H0v72' fill='none' stroke='%23ffffff' stroke-opacity='.12'/%3E%3C/svg%3E");
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent 95%);
  mask-image: linear-gradient(to bottom, #000, transparent 95%);
}

button, input { font: inherit; }
button { cursor: pointer; }

.glow { position: fixed; z-index: -3; border-radius: 50%; filter: blur(4px); pointer-events: none; }
.glow-one { width: 24rem; height: 24rem; top: 8rem; left: -18rem; background: rgba(213, 71, 18, .13); }
.glow-two { width: 22rem; height: 22rem; top: 45rem; right: -16rem; background: rgba(245, 183, 27, .14); }

.topbar {
  width: min(1180px, calc(100% - 40px));
  height: 92px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,.12);
}

.brand { display: flex; align-items: center; gap: 12px; color: #fff; font-weight: 800; text-decoration: none; }
.brand-mark {
  display: block; width: 46px; height: 46px; object-fit: cover; border-radius: 50%;
  border: 2px solid #fff; outline: 1px solid rgba(179, 113, 14, .38); box-shadow: 0 6px 18px rgba(88, 14, 5, .18);
}
.brand-copy { display: flex; flex-direction: column; }
.brand-copy strong { font: 800 14px/1.25 "Manrope", sans-serif; letter-spacing: -.01em; }
.brand-copy small { color: rgba(255,255,255,.6); font-size: 9px; font-weight: 600; }
.text-button { color: #ffe3a0; background: rgba(255,255,255,.06); border: 1px solid rgba(255,218,130,.35); border-radius: 999px; padding: 10px 18px; font-weight: 700; transition: .2s ease; }
.text-button:hover { color: #431006; background: #ffd26a; border-color: #ffd26a; box-shadow: 0 8px 20px rgba(0,0,0,.18); transform: translateY(-1px); }

.page-shell { width: min(1180px, calc(100% - 40px)); margin: auto; }
.invite-banner { max-width: 780px; margin: 22px auto 0; display: flex; align-items: center; gap: 14px; padding: 10px 14px; border: 1px solid rgba(255,211,104,.32); border-radius: 14px; color: #fff; background: rgba(255,255,255,.09); box-shadow: 0 10px 30px rgba(0,0,0,.12); backdrop-filter: blur(12px); }
.invite-banner img { flex: none; object-fit: cover; border-radius: 6px; }
.invite-banner p { display: flex; flex: 1; flex-direction: column; margin: 0; }
.invite-banner strong { color: #fff; font-size: 13px; }
.invite-banner span { color: rgba(255,255,255,.66); font-size: 11px; }
.invite-banner a { color: #ffd472; font-size: 11px; font-weight: 800; }
.intro { text-align: center; padding: 58px 20px 54px; }
.eyebrow { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 0 0 18px; color: #f4bf51; font-size: 11px; font-weight: 800; letter-spacing: .24em; }
.eyebrow span { display: block; width: 34px; height: 1px; background: linear-gradient(90deg, transparent, #d39a3f); }
.eyebrow span:last-child { background: linear-gradient(90deg, #d39a3f, transparent); }
.intro h1 { margin: 0; color: #fff; font: 800 clamp(40px, 6vw, 70px)/1.02 "Manrope", sans-serif; letter-spacing: -.052em; text-shadow: 0 6px 30px rgba(0,0,0,.2); }
.intro h1 span { color: #f5bc44; background: linear-gradient(90deg, #ffd873, #f0a718); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.lead { max-width: 610px; margin: 23px auto 20px; color: rgba(255,255,255,.7); font-size: clamp(16px, 2vw, 18px); line-height: 1.65; }
.lead strong { color: #ffdc8c; }
.trust-row { display: flex; justify-content: center; gap: 25px; flex-wrap: wrap; color: rgba(255,255,255,.72); font-size: 13px; font-weight: 600; }
.trust-row i { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: 5px; color: #fff; background: #238751; border-radius: 50%; font-style: normal; font-size: 11px; }

.creator-card {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(330px, .86fr);
  overflow: hidden; max-width: 1040px; margin: 0 auto 34px; background: rgba(255,255,255,.94);
  border: 1px solid rgba(116, 66, 38, .14); border-radius: 26px;
  box-shadow: 0 34px 100px rgba(46, 8, 3, .24), 0 4px 12px rgba(79, 24, 8, .07);
}
.preview-panel { position: relative; padding: 32px; background: radial-gradient(circle at 85% 10%, rgba(244,177,30,.17), transparent 16rem), linear-gradient(145deg, #250503, #721207 67%, #3c0603); }
.preview-panel::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .2; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'%3E%3Cpath d='M0 60L60 0' stroke='%23fff' stroke-opacity='.055'/%3E%3C/svg%3E"); }
.preview-panel > * { position: relative; z-index: 1; }
.preview-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; color: #fff; }
.step-label { margin: 0 0 6px; color: var(--gold-light); font-size: 10px; font-weight: 800; letter-spacing: .2em; }
.preview-heading h2 { margin: 0; font: 700 19px "Manrope", sans-serif; }
.status { flex: none; padding: 7px 10px; border: 1px solid rgba(255,255,255,.18); border-radius: 999px; color: #f4dfda; font-size: 11px; }
.status span { display: inline-block; width: 7px; height: 7px; margin-right: 5px; background: #5be38e; border-radius: 50%; box-shadow: 0 0 0 3px rgba(91,227,142,.12); }
.canvas-wrap { position: relative; max-width: 380px; margin: auto; overflow: hidden; border-radius: 10px; background: #400703; box-shadow: 0 24px 55px rgba(0,0,0,.42), 0 0 0 1px rgba(255,216,122,.2); touch-action: auto; }
#flyerCanvas { display: block; width: 100%; height: auto; user-select: none; }
.canvas-loading { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; background: #4c0905; font-size: 13px; transition: opacity .25s; }
.canvas-loading.hidden { opacity: 0; pointer-events: none; }
.drag-hint { min-height: 18px; margin: 16px 0 0; color: #dbb8ac; text-align: center; font-size: 12px; }
.preview-assurance { display: flex; justify-content: center; gap: 18px; color: rgba(255,255,255,.58); font-size: 9px; font-weight: 600; }
.preview-assurance span::before { content: "✓"; margin-right: 4px; color: #ffd45e; }

.controls-panel { display: flex; flex-direction: column; padding: 34px 40px 36px; background: linear-gradient(145deg, #fff 0%, #fffcf7 100%); }
.controls-kicker { display: flex; flex-direction: column; margin-bottom: 28px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.controls-kicker span { margin-bottom: 5px; color: #b16a08; font-size: 9px; font-weight: 800; letter-spacing: .2em; }
.controls-kicker strong { color: #371914; font: 800 17px/1.35 "Manrope", sans-serif; }
.step-block { margin-bottom: 4px; }
.step-head { display: flex; gap: 13px; margin-bottom: 18px; }
.step-head > span { display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 9px; color: #fff; background: linear-gradient(145deg, #6d1008, #a52610); font-weight: 800; font-size: 12px; box-shadow: 0 5px 12px rgba(91,11,6,.18); }
.step-head h3 { margin: 2px 0 4px; color: var(--deep); font: 800 17px "Manrope", sans-serif; }
.step-head h3 em { margin-left: 5px; color: #9b8982; font: 500 11px "DM Sans"; }
.step-head p { margin: 0; color: #87716a; font-size: 12px; line-height: 1.5; }
.upload-zone { width: 100%; min-height: 96px; display: flex; align-items: center; justify-content: center; gap: 14px; padding: 16px; border: 1.5px dashed #d5b98e; border-radius: 13px; color: var(--wine); background: linear-gradient(135deg, #fffaf2, #fffdf9); text-align: left; transition: .2s ease; }
.upload-zone:hover { border-color: #c88714; background: #fff6e7; box-shadow: 0 8px 20px rgba(116,65,15,.07); transform: translateY(-1px); }
.upload-zone.dragging { border-color: var(--gold); background: #fff0cd; }
.upload-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: #f9e7c5; }
.upload-icon svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.upload-zone strong, .upload-zone small { display: block; }
.upload-zone strong { margin-bottom: 5px; font-size: 14px; }
.upload-zone small { color: #9c8780; font-size: 10px; }
.photo-tools { margin-top: 15px; }
.photo-tools label { display: flex; justify-content: space-between; color: #6b544d; font-size: 12px; font-weight: 700; }
.photo-tools input { width: 100%; accent-color: var(--wine); }
.position-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 9px 0 5px; }
.position-tools > span { color: #6b544d; font-size: 11px; font-weight: 700; }
.position-buttons { display: flex; gap: 5px; }
.position-buttons button { width: 34px; height: 34px; padding: 0; border: 1px solid #d9c8be; border-radius: 8px; color: var(--wine); background: #fff; font-size: 17px; line-height: 1; }
.position-buttons button:hover { border-color: #bd770f; background: #fff8eb; }
.mini-button { padding: 0; border: 0; color: #a34420; background: transparent; font-size: 11px; font-weight: 700; }
.field-error { min-height: 16px; margin: 7px 0 0; color: #b8271c; font-size: 11px; }
.divider { height: 1px; margin: 22px 0 25px; background: var(--line); }
.input-label { display: block; margin-bottom: 7px; color: #604b44; font-size: 11px; font-weight: 700; }
.name-input { width: 100%; height: 47px; padding: 0 14px; border: 1px solid #daccc5; border-radius: 9px; outline: none; color: var(--ink); background: #fff; }
.name-input:focus { border-color: #bd770f; box-shadow: 0 0 0 3px rgba(245,183,27,.16); }
.check-row { display: flex; align-items: center; gap: 8px; margin-top: 11px; color: #806a63; font-size: 11px; cursor: pointer; }
.check-row input { accent-color: var(--wine); }
.action-stack { display: flex; flex-direction: column; margin-top: auto; }
.primary-button, .secondary-button { width: 100%; height: 52px; display: flex; align-items: center; justify-content: center; gap: 9px; border-radius: 11px; font-weight: 800; font-size: 13px; }
.primary-button { margin-top: auto; border: 0; color: #fff; background: linear-gradient(135deg, #681008, #a82210 60%, #c23b16); box-shadow: 0 11px 24px rgba(123,18,8,.23); transition: .2s ease; }
.primary-button:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
.primary-button:disabled { cursor: not-allowed; opacity: .45; box-shadow: none; }
.secondary-button { margin-top: 10px; border: 1px solid #d5c1b8; color: var(--wine); background: #fff; transition: .2s ease; }
.secondary-button:hover { border-color: #bd770f; background: #fffaf1; }
.secondary-button:disabled { cursor: not-allowed; opacity: .45; }
.primary-button svg, .secondary-button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.share-result { margin-top: 12px; padding: 13px; border: 1px solid #dfc790; border-radius: 10px; background: #fff9e9; }
.share-result > strong { display: block; margin-bottom: 8px; color: #5b0b06; font-size: 11px; }
.share-result > div { display: flex; }
.share-result input { min-width: 0; flex: 1; height: 34px; padding: 0 9px; border: 1px solid #d9cbbd; border-radius: 7px 0 0 7px; color: #5d4b44; background: #fff; font-size: 10px; }
.share-result button { border: 0; border-radius: 0 7px 7px 0; color: #fff; background: var(--wine); padding: 0 12px; font-size: 10px; font-weight: 800; }
.share-result small { display: block; margin-top: 7px; color: #8e7b72; font-size: 9px; }
.share-result code { color: #6b2013; font-weight: 700; }

.share-page { min-height: 100vh; background: radial-gradient(circle at 12% 10%, rgba(239,168,20,.2), transparent 30rem), linear-gradient(135deg, #fffaf2, #fff 50%, #fff5e6); }
.share-shell { width: min(1040px, calc(100% - 32px)); margin: auto; padding: 28px 0 56px; }
.share-brand { display: inline-flex; align-items: center; gap: 11px; margin-bottom: 28px; color: var(--wine); text-decoration: none; font: 800 14px "Manrope", sans-serif; }
.share-brand img { border-radius: 50%; border: 2px solid #fff; box-shadow: 0 4px 14px rgba(91,11,6,.18); }
.invitation-card { display: grid; grid-template-columns: minmax(280px, .82fr) minmax(340px, 1.18fr); overflow: hidden; border: 1px solid rgba(116,66,38,.14); border-radius: 25px; background: #fff; box-shadow: 0 30px 90px rgba(79,24,8,.14); }
.shared-flyer { display: flex; justify-content: center; padding: 28px; background: radial-gradient(circle at 80% 10%, rgba(246,190,53,.18), transparent 16rem), linear-gradient(145deg, #260503, #741207); }
.shared-flyer img { display: block; width: 100%; max-width: 390px; height: auto; align-self: center; border-radius: 9px; box-shadow: 0 22px 55px rgba(0,0,0,.4); }
.invitation-copy { display: flex; flex-direction: column; justify-content: center; padding: clamp(36px, 7vw, 72px); }
.share-eyebrow { justify-content: flex-start; margin-bottom: 16px; }
.invitation-copy h1, .not-found-card h1 { margin: 0 0 18px; color: var(--wine); font: 800 clamp(31px, 4.5vw, 50px)/1.08 "Manrope", sans-serif; letter-spacing: -.04em; }
.invitation-copy > p, .not-found-card > p { margin: 0 0 28px; color: #77615a; font-size: 15px; line-height: 1.7; }
.create-own-button { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 16px 19px; border-radius: 11px; color: #fff; background: linear-gradient(135deg, #681008, #b42a11); box-shadow: 0 11px 24px rgba(104,16,8,.22); text-decoration: none; font-weight: 800; }
.create-own-button span { font-size: 20px; }
.retrieve-link { align-self: center; margin-top: 18px; color: #8b3a23; font-size: 12px; font-weight: 700; }
.share-reference { margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--line); }
.share-reference small { display: block; color: #a28c82; font-size: 9px; letter-spacing: .12em; text-transform: uppercase; }
.share-reference code { display: block; margin: 5px 0; color: #5b0b06; font-size: 14px; font-weight: 800; }
.share-reference p { margin: 0; color: #a08d85; font-size: 10px; }
.not-found-card { max-width: 600px; margin: 60px auto; padding: 60px; border: 1px solid #eadfd6; border-radius: 24px; background: #fff; box-shadow: 0 20px 60px rgba(79,24,8,.1); text-align: center; }
.not-found-card .share-eyebrow { justify-content: center; }

.event-strip { max-width: 1040px; margin: 0 auto 58px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; overflow: hidden; border: 1px solid #e4d7cb; border-radius: 16px; background: #e4d7cb; box-shadow: 0 12px 34px rgba(83,32,10,.07); }
.event-strip > div { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 88px; padding: 16px; background: rgba(255,255,255,.88); }
.event-strip p { margin: 0; }
.event-strip small, .event-strip strong { display: block; }
.event-strip small { margin-bottom: 3px; color: #a67529; font-size: 9px; font-weight: 800; letter-spacing: .14em; }
.event-strip strong { color: #4c2920; font-size: 12px; }
.event-icon { display: grid; place-items: center; flex: none; width: 42px; height: 42px; color: #9c2b14; border: 1px solid #edd7ae; border-radius: 12px; background: linear-gradient(145deg, #fff9e9, #fff3d6); }
.event-icon svg { width: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid rgba(245,183,27,.55); outline-offset: 3px; }

footer { display: flex; justify-content: space-between; gap: 20px; width: min(1040px, calc(100% - 40px)); margin: auto; padding: 28px 0 36px; border-top: 1px solid #eadfd6; color: #9b8780; font-size: 11px; }
.toast { position: fixed; z-index: 10; left: 50%; bottom: 25px; padding: 11px 18px; border-radius: 999px; color: #fff; background: #25100c; box-shadow: 0 8px 24px rgba(0,0,0,.2); font-size: 12px; transform: translate(-50%, 80px); opacity: 0; transition: .3s; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 820px) {
  body:not(.share-page)::before, body:not(.share-page)::after { height: 590px; }
  .creator-card { grid-template-columns: 1fr; max-width: 560px; }
  .controls-panel { min-height: 0; }
  .event-strip { grid-template-columns: 1fr; max-width: 540px; }
  .event-strip > div { justify-content: flex-start; padding-left: max(24px,20%); }
  .invitation-card { grid-template-columns: 1fr; }
  .shared-flyer img { max-width: 340px; }
}

@media (max-width: 520px) {
  body:not(.share-page)::before, body:not(.share-page)::after { height: 515px; }
  .topbar, .page-shell { width: min(100% - 20px, 1180px); }
  .topbar { height: 68px; }
  .brand-copy small { display: none; }
  .brand-copy strong { font-size: 11px; max-width: 145px; }
  .brand-mark { width: 38px; height: 38px; }
  .text-button { min-height: 40px; padding: 8px 13px; font-size: 11px; }
  .intro { padding: 31px 4px 32px; }
  .eyebrow { gap: 8px; margin-bottom: 12px; font-size: 9px; letter-spacing: .18em; }
  .eyebrow span { width: 20px; }
  .intro h1 { font-size: clamp(32px,10vw,40px); line-height: 1.06; }
  .lead { margin: 16px auto 14px; font-size: 14px; line-height: 1.55; }
  .trust-row { gap: 12px; font-size: 10px; }
  .trust-row i { width: 16px; height: 16px; font-size: 9px; }
  .creator-card { margin-bottom: 22px; border-radius: 18px; box-shadow: 0 24px 60px rgba(46,8,3,.23); }
  .preview-panel { padding: 19px 14px 18px; }
  .preview-heading { margin-bottom: 14px; }
  .preview-heading h2 { font-size: 16px; }
  .step-label { margin-bottom: 3px; font-size: 8px; }
  .status { padding: 6px 8px; font-size: 9px; }
  .canvas-wrap { width: min(100%,340px); border-radius: 8px; box-shadow: 0 18px 38px rgba(0,0,0,.42); }
  .drag-hint { margin-top: 12px; font-size: 10px; }
  .preview-assurance { gap: 10px; font-size: 8px; }
  .controls-panel { min-height: 0; padding: 25px 20px 24px; }
  .controls-kicker { margin-bottom: 22px; padding-bottom: 17px; }
  .controls-kicker strong { font-size: 16px; }
  .step-head { margin-bottom: 14px; }
  .step-head > span { width: 30px; height: 30px; }
  .step-head h3 { font-size: 16px; }
  .step-head p { max-width: 260px; font-size: 11px; }
  .upload-zone { min-height: 88px; justify-content: flex-start; padding: 14px; }
  .upload-icon { width: 44px; height: 44px; }
  .upload-zone strong { font-size: 13px; }
  .upload-zone small { font-size: 9px; }
  .photo-tools { margin-top: 14px; }
  .photo-tools input[type="range"] { min-height: 32px; }
  .position-tools { margin-top: 8px; }
  .position-buttons { gap: 6px; }
  .position-buttons button { width: 42px; height: 42px; font-size: 19px; }
  .mini-button { min-height: 40px; font-size: 12px; }
  .divider { margin: 18px 0 21px; }
  .input-label { font-size: 12px; }
  .name-input { height: 50px; font-size: 16px; }
  .check-row { min-height: 42px; margin-top: 6px; font-size: 12px; }
  .check-row input { width: 18px; height: 18px; }
  .action-stack { margin-top: 18px; padding-top: 20px; border-top: 1px solid var(--line); }
  .primary-button, .secondary-button { height: 54px; font-size: 13px; }
  .share-result { padding: 14px; }
  .share-result input, .share-result button { height: 42px; }
  .event-strip { margin-bottom: 34px; border-radius: 15px; }
  .event-strip > div { min-height: 78px; padding: 13px 18px; }
  .event-strip strong { font-size: 12px; }
  .event-icon { width: 40px; height: 40px; }
  .invite-banner { align-items: flex-start; }
  .invite-banner a { display: none; }
  .share-shell { width: min(100% - 20px,1040px); padding: 18px 0 34px; }
  .share-brand { margin: 0 4px 18px; font-size: 12px; }
  .share-brand img { width: 40px; height: 40px; }
  .invitation-card { border-radius: 18px; box-shadow: 0 22px 60px rgba(79,24,8,.16); }
  .invitation-copy { padding: 30px 22px 34px; }
  .invitation-copy h1 { margin-bottom: 14px; font-size: 30px; }
  .invitation-copy > p { margin-bottom: 22px; font-size: 14px; line-height: 1.6; }
  .shared-flyer { padding: 17px; }
  .shared-flyer img { width: min(100%,310px); }
  .create-own-button { min-height: 54px; padding: 14px 17px; }
  .retrieve-link { min-height: 42px; display:flex; align-items:center; }
  .share-reference { margin-top: 22px; }
  .not-found-card { padding: 38px 24px; }
  footer { width: min(100% - 24px,1040px); gap: 5px; flex-direction: column; padding: 22px 0 28px; text-align: center; font-size: 10px; }
  .toast { bottom: max(18px,env(safe-area-inset-bottom)); width: max-content; max-width: calc(100% - 28px); text-align:center; }
}

@media (max-width: 360px) {
  .brand-copy strong { max-width: 112px; }
  .intro h1 { font-size: 31px; }
  .preview-assurance span:last-child { display: none; }
  .controls-panel { padding-inline: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
