:root {
  color-scheme: light;
  --ink: #351039;
  --muted: #674972;
  --purple: #5c1467;
  --purple-deep: #48104f;
  --gold: #bc8128;
  --background: #f6effb;
  --line: #d5bce8;
  --paper: #fffcff;
  --stage: #eee2f6;
  --heading: Georgia, "Times New Roman", serif;
  --body: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
body { margin: 0; background: var(--background); color: var(--ink); font: 16px/1.5 var(--body); }
button, textarea, input { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
a { color: var(--purple-deep); }
:focus-visible { outline: 3px solid #9544ad; outline-offset: 3px; }
.wrap { width: min(100% - 28px, 1280px); margin-inline: auto; }
.site-header {
  min-height: 64px; display: flex; align-items: center; justify-content: center;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; font: 700 1.36rem/1.2 var(--heading); }
.brand-mark { flex: none; color: var(--gold); }
.privacy { display: none; color: var(--muted); font-size: .9rem; }
.intro { text-align: center; padding: 23px 3px 20px; }
h1, h2, p { margin: 0; }
h1, h2 { font-family: var(--heading); }
h1 { font-size: clamp(1.95rem, 7.7vw, 4.35rem); line-height: 1.04; letter-spacing: -.035em; }
h2 { font-size: 1.42rem; letter-spacing: -.025em; line-height: 1.2; }
.intro p { max-width: 41em; margin: 9px auto 0; color: var(--muted); font-size: .95rem; }
.studio { display: grid; gap: 14px; padding-bottom: 24px; }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.editor { background: var(--paper); }
.photo-picker {
  width: 100%; min-height: 62px; margin-top: 12px; padding: 10px 14px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: #f3e6fb; border: 1.5px dashed #9f61bd; border-radius: 10px;
  color: var(--purple-deep); font-weight: 700;
}
.photo-picker:hover, .photo-picker[data-dragging] { background: #ecdbf7; border-color: var(--purple); }
.photo-help, .photo-status, .export-status { color: var(--muted); font-size: .82rem; }
.photo-help { margin-top: 7px; text-align: center; }
.photo-status { margin-top: 5px; overflow-wrap: anywhere; }
.photo-status[data-error] { color: #981c43; }
.preview-link { display: inline-flex; align-items: center; min-height: 44px; font-size: .85rem; text-underline-offset: 3px; }
.template-picker { min-width: 0; margin: 18px 0 0; padding: 0; border: 0; }
.template-picker legend { padding: 0; font: 700 1.22rem/1.2 var(--heading); }
.template-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 9px; }
.template-card { overflow: hidden; border: 2px solid var(--line); border-radius: 9px; background: white; cursor: pointer; }
.template-card:has(:checked) { border-color: var(--purple); }
.template-card:focus-within { outline: 3px solid #9544ad; outline-offset: 2px; }
.template-image { display: grid; height: 112px; place-items: center; padding: 5px; }
.template-image.classic { background: #f2e3e8; }
.template-image.blue { background: #0b2848; }
.template-image canvas { display: block; max-width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.template-caption { display: flex; align-items: center; gap: 6px; min-height: 42px; padding: 5px 8px; font-size: .85rem; font-weight: 650; }
.template-caption input { flex: none; width: 16px; height: 16px; margin: 0; accent-color: var(--purple); }
.photo-tools {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 10px; max-width: 466px; margin: 12px auto 0; font-size: .84rem;
}
.photo-tools label { display: flex; flex-direction: column; }
.photo-tools input { width: 100%; height: 44px; margin: 0; accent-color: var(--purple); }
.text-button { grid-column: 1 / -1; justify-self: start; border: 0; min-height: 44px; padding: 0 3px; color: var(--purple); background: none; text-decoration: underline; }
.invitation { margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line); }
.event-title { margin-top: 7px; font-size: 1.03rem; font-weight: 700; }
.event-detail { margin-top: 4px; color: var(--muted); font-size: .89rem; line-height: 1.4; }
.event-detail + .event-detail { margin-top: 7px; }
.flyer-link { display: inline-flex; gap: 5px; align-items: center; min-height: 44px; font-size: .87rem; font-weight: 650; text-underline-offset: 3px; }
.message-label { display: block; margin-bottom: 5px; font-size: .86rem; font-weight: 700; }
.message-help { margin: 0 0 7px; color: var(--muted); font-size: .84rem; }
.countdown-option { margin-top: 10px; display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 12px; }
.countdown-option label { display: flex; align-items: center; min-height: 44px; font-size: .94rem; font-weight: 650; cursor: pointer; }
.countdown-option small { grid-column: 1 / -1; color: var(--muted); }
#countdown { appearance: none; width: 46px; height: 28px; margin: 0; border: 2px solid var(--muted); border-radius: 14px; background: var(--paper); cursor: pointer; }
#countdown::before { content: ""; display: block; width: 18px; height: 18px; margin: 3px; border-radius: 50%; background: var(--muted); }
#countdown:checked { border-color: var(--purple); background: var(--purple); }
#countdown:checked::before { transform: translateX(18px); background: white; }
#countdown:disabled { opacity: .5; cursor: default; }
@media (forced-colors: active) {
  #countdown { appearance: auto; }
  #countdown::before { display: none; }
}
textarea {
  display: block; width: 100%; min-height: 62px; resize: vertical; line-height: 1.35;
  padding: 9px 11px; border: 1px solid #b895cf; border-radius: 8px; background: #fffdff; color: var(--ink);
}
.preview { background: var(--stage); }
.preview-header { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; margin-bottom: 12px; }
.formats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; border: 1px solid #b993ce; border-radius: 10px; background: #fbf5ff; }
.formats button { min-height: 44px; border: 0; border-radius: 9px; padding: 6px 8px; background: transparent; font-size: .9rem; font-weight: 650; }
.formats button[aria-pressed="true"] { background: var(--purple); color: white; }
#artwork { display: block; width: min(100%, 466px); height: auto; margin-inline: auto; border-radius: 6px; box-shadow: 0 6px 18px #34114029; }
#artwork[data-adjustable] { cursor: grab; touch-action: pan-y; }
#artwork[data-dragging] { cursor: grabbing; }
.actions { display: grid; gap: 8px; max-width: 466px; margin: 13px auto 0; }
.action {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 8px 12px; border: 1px solid var(--purple);
  border-radius: 10px; font-weight: 700; font-size: .92rem;
}
.primary { background: var(--purple); color: white; }
.primary:hover:not(:disabled) { background: var(--purple-deep); }
.secondary { background: #f9f1ff; color: var(--purple-deep); }
.secondary:hover:not(:disabled) { background: #f3e5fa; }
.action:disabled { opacity: .61; }
.export-status { min-height: 1.4em; margin-top: 8px; text-align: center; }

@media (min-width: 420px) {
  .preview-header { flex-direction: row; align-items: center; justify-content: space-between; }
  .formats { width: auto; }
  .actions { grid-template-columns: 1.45fr 1fr; }
}
@media (min-width: 650px) {
  .wrap { width: min(100% - 60px, 1280px); }
  .site-header { justify-content: space-between; min-height: 72px; }
  .brand { font-size: 1.7rem; }
  .privacy { display: flex; gap: 7px; align-items: center; }
  .intro { padding-block: 25px 30px; }
  .intro p { font-size: 1.12rem; }
  .panel { padding: 22px; border-radius: 16px; }
  h2 { font-size: 1.65rem; }
}
@media (min-width: 850px) {
  .studio { grid-template-columns: minmax(305px, .75fr) minmax(0, 1fr); align-items: stretch; gap: 18px; }
  .photo-picker { min-height: 115px; flex-direction: column; }
  .invitation { margin-top: 20px; padding-top: 19px; }
}
