:root {
  --accent: #ff5d56;
  --ink: #17326c;
  --background: #ffd851;
  --card: #fffdf8;
  --accent-soft: color-mix(in srgb, var(--accent) 15%, white);
  --ink-soft: color-mix(in srgb, var(--ink) 72%, white);
  --line: color-mix(in srgb, var(--ink) 18%, white);
  --editor: #14204a;
  --studio-surface: #f4f1eb;
  --body: "DM Sans", system-ui, sans-serif;
  --display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  color: #18213a;
  background: var(--studio-surface);
  font-family: var(--body);
}

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

.studio-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 72px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: white;
  background: var(--editor);
  border-bottom: 1px solid rgba(255,255,255,.12);
}

.brand-lockup, .bar-actions { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font: 600 1.35rem var(--display);
  color: var(--editor);
  background: var(--background);
}
.brand-lockup p, .brand-lockup span { margin: 0; }
.brand-lockup p { font-weight: 700; letter-spacing: -.02em; }
.brand-lockup div > span { display: block; margin-top: 2px; color: #aeb8dc; font-size: .75rem; text-transform: uppercase; letter-spacing: .12em; }

.primary-button, .secondary-button {
  min-height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 700;
}
.primary-button { background: var(--background); color: #17214a; box-shadow: 0 9px 22px rgba(0,0,0,.14); }
.primary-button:hover { filter: brightness(.96); transform: translateY(-1px); }
.secondary-button { background: transparent; color: white; border-color: rgba(255,255,255,.28); }

.studio {
  min-height: calc(100vh - 72px);
  display: grid;
  grid-template-columns: minmax(330px, 430px) minmax(520px, 1fr);
}

.editor {
  padding: 34px 28px 48px;
  color: white;
  background: var(--editor);
  overflow: auto;
}

.editor-intro { margin-bottom: 28px; }
.step-label { margin: 0 0 8px; color: #f2ca4c; font-size: .75rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.editor-intro h1 { margin: 0; font: 500 2.35rem/1.05 var(--display); letter-spacing: -.035em; }
.editor-intro > p:last-child { max-width: 36ch; margin: 12px 0 0; color: #b8c2e3; line-height: 1.55; }

details { border-top: 1px solid rgba(255,255,255,.14); }
details:last-of-type { border-bottom: 1px solid rgba(255,255,255,.14); }
summary { padding: 19px 0; font-weight: 700; cursor: pointer; list-style-position: outside; }
summary::marker { color: #f2ca4c; }

.field-grid { padding: 2px 0 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
label { display: flex; flex-direction: column; gap: 7px; color: #c6cee9; font-size: .78rem; font-weight: 600; }
label.wide { grid-column: 1 / -1; }
label span { color: #8794bf; font-weight: 400; }
input, textarea, select {
  width: 100%;
  min-height: 43px;
  padding: 10px 12px;
  color: white;
  background: #1c2a59;
  border: 1px solid #354478;
  border-radius: 8px;
  outline: none;
}
textarea { resize: vertical; line-height: 1.4; }
input:focus, textarea:focus, select:focus { border-color: #f2ca4c; box-shadow: 0 0 0 3px rgba(242,202,76,.13); }
input[type="color"] { padding: 5px; min-height: 46px; }
input[type="file"] { padding: 8px; }
input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 8px 11px;
  color: #17214a;
  background: #f2ca4c;
  border: 0;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
}
.switch-field { flex-direction: row; align-items: center; gap: 11px; padding: 12px; background: #1c2a59; border: 1px solid #354478; border-radius: 8px; }
.switch-field input { appearance: none; width: 42px; min-width: 42px; height: 24px; min-height: 24px; margin: 0; padding: 0; position: relative; border: 0; border-radius: 999px; background: #67739c; }
.switch-field input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: white; transition: transform .18s ease; }
.switch-field input:checked { background: #f2ca4c; }
.switch-field input:checked::after { transform: translateX(18px); }
.switch-field span { display: grid; gap: 2px; color: #dbe1f5; }
.switch-field small { color: #8f9bc4; font-weight: 400; line-height: 1.35; }
.upload-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.upload-actions p { margin: 0; color: #8794bf; font-size: .73rem; }
.text-button { padding: 0; color: #f2ca4c; background: transparent; border: 0; font-size: .75rem; font-weight: 700; }

.palette-fieldset { margin: 0; padding: 2px 0 18px; border: 0; }
.palette-fieldset legend { margin-bottom: 10px; color: #c6cee9; font-size: .78rem; font-weight: 600; }
.palette-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.palette {
  padding: 9px 10px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: #dbe1f5;
  background: #1c2a59;
  border: 1px solid #354478;
  border-radius: 8px;
  font-size: .76rem;
}
.palette.active { border-color: #f2ca4c; box-shadow: inset 0 0 0 1px #f2ca4c; }
.palette i { width: 44px; height: 20px; border-radius: 999px; background: linear-gradient(90deg, var(--a) 0 34%, var(--b) 34% 67%, var(--c) 67%); }
.colour-grid { padding-top: 2px; }
.editor-footer { padding-top: 24px; }
.full-button { width: 100%; }
.editor-footer p { margin: 12px 0 0; color: #8794bf; font-size: .75rem; line-height: 1.45; }

.preview-shell { min-width: 0; padding: 24px; display: flex; flex-direction: column; }
.preview-label { margin: 0 auto 10px; width: min(100%, 690px); display: flex; justify-content: space-between; color: #6b7285; font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.preview-label span:last-child { color: #16804b; }

.invite-stage {
  --stage-pad: clamp(18px, 4vw, 54px);
  flex: 1;
  min-height: 760px;
  padding: var(--stage-pad);
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  background-color: var(--background);
  background-image: radial-gradient(color-mix(in srgb, var(--ink) 18%, transparent) 1.2px, transparent 1.2px);
  background-size: 18px 18px;
  border-radius: 22px;
  box-shadow: 0 22px 60px rgba(26,35,63,.14);
}

.invite-card {
  position: relative;
  width: min(100%, 590px);
  padding: clamp(38px, 6vw, 64px) clamp(26px, 6vw, 60px) 36px;
  color: var(--ink);
  background: var(--card);
  border: 1px solid color-mix(in srgb, var(--ink) 11%, transparent);
  border-radius: 2px;
  text-align: center;
  box-shadow: 14px 16px 0 color-mix(in srgb, var(--accent) 80%, transparent), 0 28px 65px rgba(20,25,48,.2);
}

.ticket-notch { position: absolute; top: 49%; width: 26px; height: 26px; border-radius: 50%; background: var(--background); }
.notch-left { left: -14px; }
.notch-right { right: -14px; }

.invite-art { width: 190px; height: 95px; margin: 0 auto 16px; object-fit: contain; display: block; }
.invite-art.is-hidden { display: none; }
.recipient-line { margin: 0 0 14px; color: var(--accent); font-size: .75rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.recipient-line:empty { display: none; }
.eyebrow { margin: 0 0 18px; color: var(--accent); font-size: .72rem; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; }
.invite-card h2 { max-width: 500px; margin: 0 auto 8px; font: 500 clamp(2.4rem, 5vw, 3.85rem)/1.02 var(--display); letter-spacing: -.045em; }
.invite-card h2 em { color: var(--accent); font-weight: 500; }
.date-line { margin: 19px 0 28px; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; }
.intro { max-width: 430px; margin: 0 auto 34px; color: var(--ink-soft); font: 400 1.22rem/1.55 var(--display); }

.details-grid { margin: 0 0 32px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; text-align: left; }
.detail { padding-top: 13px; border-top: 2px solid var(--line); }
.detail-wide { grid-column: 1 / -1; }
.detail span { color: var(--accent); font-size: .68rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.detail p { margin: 7px 0 0; font: 500 1.08rem/1.35 var(--display); }

.answer-buttons { min-height: 82px; display: flex; align-items: center; justify-content: center; gap: 12px; }
.yes-button, .no-button { min-height: 48px; padding: 0 25px; border-radius: 999px; font-size: .75rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.yes-button { color: white; background: var(--accent); border: 1px solid var(--accent); box-shadow: 0 10px 23px color-mix(in srgb, var(--accent) 32%, transparent); }
.yes-button:hover { transform: translateY(-2px); }
.no-button { position: relative; z-index: 5; color: var(--ink); background: transparent; border: 1px solid var(--line); }
.no-button.escaped { position: fixed; }
.studio .no-button.escaped { position: absolute; }
.answer-view { display: none; padding: 18px 0 12px; }
.answer-view.show { display: block; animation: pop .45s cubic-bezier(.2,1.4,.4,1) both; }
.answer-view h3 { margin: 0 0 12px; color: var(--accent); font: 500 2.2rem var(--display); }
.answer-view p { max-width: 430px; margin: 0 auto 18px; color: var(--ink-soft); font: 400 1.15rem/1.55 var(--display); }
.answer-view .signature { color: var(--accent); font-style: italic; font-weight: 600; }

.detail.is-hidden { display: none; }

.confetti-piece { position: fixed; top: -24px; z-index: 100; pointer-events: none; animation: fall linear forwards; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 120; transform: translate(-50%, 20px); padding: 12px 18px; color: white; background: #111b3f; border-radius: 999px; box-shadow: 0 14px 35px rgba(0,0,0,.22); opacity: 0; pointer-events: none; transition: .2s ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

body.guest-mode { background: var(--background); }
.guest-mode .studio-bar, .guest-mode .editor, .guest-mode .preview-label { display: none; }
.guest-mode .studio { display: block; min-height: 100vh; }
.guest-mode .preview-shell { min-height: 100vh; padding: 0; }
.guest-mode .invite-stage { min-height: 100vh; border-radius: 0; }
.guest-mode .invite-card { width: min(100%, 600px); }

@keyframes pop { from { transform: scale(.88); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fall { to { transform: translateY(112vh) rotate(420deg); opacity: .85; } }

@media (max-width: 960px) {
  .studio { grid-template-columns: 1fr; }
  .editor { max-height: none; }
  .preview-shell { padding: 18px; }
  .invite-stage { min-height: 720px; }
}

@media (max-width: 560px) {
  .studio-bar { height: auto; padding: 12px 14px; gap: 12px; }
  .brand-lockup div { display: none; }
  .bar-actions { margin-left: auto; gap: 8px; }
  .primary-button, .secondary-button { min-height: 40px; padding: 0 13px; font-size: .78rem; }
  .editor { padding: 28px 20px 40px; }
  .field-grid { grid-template-columns: 1fr; }
  label.wide { grid-column: auto; }
  .preview-shell { padding: 10px; }
  .invite-stage { min-height: 680px; border-radius: 14px; }
  .invite-card { padding: 40px 25px 30px; box-shadow: 8px 9px 0 color-mix(in srgb, var(--accent) 80%, transparent), 0 20px 44px rgba(20,25,48,.2); }
  .invite-art { width: 155px; height: 78px; }
  .details-grid { grid-template-columns: 1fr; }
  .detail-wide { grid-column: auto; }
  .answer-buttons { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .confetti-piece { display: none; }
}
