/* Visual polish and responsive interaction refinements */
html, body { width: 100%; max-width: 100%; overflow-x: hidden; }
body { position: relative; min-width: 0; }
main { width: 100%; max-width: 100vw; min-width: 0; overflow-x: hidden; }
:root { --coral-dark: #a83b34; --action-coral: #c4473e; }
body { background: radial-gradient(circle at 84% 2%, rgba(255,220,208,.42), transparent 24%), var(--cream); }
.button, .brand-mark, .preview-buttons button:first-child, .response-badge { background: var(--action-coral); }
.button:hover { background: #a93730; }
.section-heading > span, .mini-label { color: #9d3933; }
.preview-top, .preview-footer { color: #625955; }
.guest-view[data-theme="rose"] { --guest-accent: #c4473e; --guest-soft: #f7d9d5; }
.guest-view[data-theme="violet"] { --guest-accent: #6752bd; --guest-soft: #dfdaf4; }
.guest-view[data-theme="sunset"] { --guest-accent: #ad5318; --guest-soft: #f3d8c5; }
.site-header {
  background: rgba(255,250,246,.76); backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(234,223,216,.65); position: sticky; top: 0;
  width: 100%; max-width: none; padding-inline: max(30px, calc((100vw - 1180px)/2)); height: 76px;
}
.hero { min-height: calc(100vh - 76px); }
.invite-preview { box-shadow: 0 40px 90px rgba(84,49,40,.2), 0 0 0 8px rgba(255,255,255,.48); }
.steps article {
  background: #fffdfb; border: 1px solid #f0e4dd; border-radius: 24px;
  padding: 30px 22px 24px; box-shadow: 0 15px 40px rgba(84,49,40,.055);
}
.dashboard-stats article, .invite-card, .form-card { box-shadow: 0 12px 32px rgba(77,47,40,.055); }
.builder { width: min(100%, 1180px); max-width: 100vw; margin-inline: auto; padding-inline: clamp(16px, 3vw, 36px); }
.builder-layout {
  width: 100%; max-width: 100%; direction: ltr;
  grid-template-columns: 320px minmax(0, 1fr);
  grid-template-areas: "preview form";
  gap: clamp(26px, 4vw, 52px);
}
.builder-form { grid-area: form; direction: rtl; }
.live-preview { grid-area: preview; direction: rtl; }
.builder-layout > * { min-width: 0; }
.builder-form, .live-preview, .form-card, .form-fields { min-width: 0; max-width: 100%; }
.builder-form input, .builder-form textarea { min-width: 0; }
.form-head h1, .form-head p, .form-fields h2 { overflow-wrap: anywhere; }
.guest-view { isolation: isolate; }
.guest-view::before, .guest-view::after {
  content: ""; position: fixed; z-index: -1; border-radius: 50%; filter: blur(4px); pointer-events: none;
}
.guest-view::before { width: 320px; height: 320px; right: -110px; top: -100px; background: color-mix(in srgb, var(--guest-accent) 16%, transparent); }
.guest-view::after { width: 270px; height: 270px; left: -100px; bottom: -90px; background: color-mix(in srgb, var(--guest-accent) 12%, transparent); }
.guest-steps { border-color: rgba(255,255,255,.96); box-shadow: 0 28px 75px rgba(93,53,44,.14), inset 0 0 0 1px rgba(255,255,255,.45); }

/* A roomy, deterministic arena keeps the playful “no” button smooth. */
.yes-no-zone { height: 152px; max-width: 480px; display: block; direction: ltr; position: relative; margin: 0 auto; }
.yes-no-zone .yes-button {
  position: absolute; top: 10px; right: 28px; width: 220px; z-index: 2;
  transition: transform .2s, box-shadow .2s, background .2s;
}
.yes-no-zone .yes-button:hover { transform: translateY(-2px); box-shadow: 0 13px 28px color-mix(in srgb, var(--guest-accent) 30%, transparent); }
.yes-no-zone .no-button {
  position: absolute; top: 10px; left: 52px; right: auto; min-width: 104px; height: 51px;
  z-index: 3; margin: 0; touch-action: none; user-select: none; will-change: left, top, transform;
  transition: left .16s cubic-bezier(.2,.9,.2,1), top .16s cubic-bezier(.2,.9,.2,1), transform .16s;
}
.playful-note { margin-top: -12px; }
.guest-option { min-height: 58px; box-shadow: 0 7px 18px rgba(78,48,40,.045); }
.calendar-field { position: relative; text-align: right; }
.field-label { display: block; color: #574d49; font-size: 13px; font-weight: 700; margin-bottom: 7px; }
.date-picker-toggle {
  width: 100%; min-height: 49px; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; border: 1px solid #ded2cb; border-radius: 11px; background: #fff; color: var(--ink);
  padding: 11px 14px; text-align: right; font-weight: 700;
}
.date-picker-toggle b { color: var(--guest-accent); font-size: 21px; line-height: 1; }
.date-picker-toggle[aria-expanded="true"] { border-color: var(--guest-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--guest-accent) 12%, transparent); }
.persian-calendar {
  position: absolute; z-index: 20; top: calc(100% + 8px); right: 0; width: min(330px, 88vw);
  background: #fff; border: 1px solid var(--guest-soft); border-radius: 18px; padding: 13px;
  box-shadow: 0 20px 55px rgba(53,38,35,.2); direction: rtl;
}
.calendar-head { display: grid; grid-template-columns: 38px 1fr 38px; align-items: center; gap: 6px; margin-bottom: 9px; }
.calendar-head strong { text-align: center; font-size: 14px; }
.calendar-head button {
  width: 36px; height: 36px; border: 0; border-radius: 10px; background: color-mix(in srgb, var(--guest-accent) 9%, #fff);
  color: var(--guest-accent); font-size: 25px; line-height: 1;
}
.calendar-head button:disabled { opacity: .3; cursor: default; }
.calendar-weekdays, .calendar-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.calendar-weekdays { margin-bottom: 5px; color: var(--muted); font-size: 10px; text-align: center; }
.calendar-day {
  aspect-ratio: 1; min-width: 0; border: 0; border-radius: 9px; background: transparent; color: var(--ink);
  display: grid; place-items: center; padding: 0; font-size: 12px; font-weight: 700;
}
.calendar-day:not(.unavailable):not(.empty):hover { background: color-mix(in srgb, var(--guest-accent) 10%, #fff); color: var(--guest-accent); }
.calendar-day.today { box-shadow: inset 0 0 0 1px var(--guest-accent); color: var(--guest-accent); }
.calendar-day.selected { background: var(--guest-accent)!important; color: #fff!important; box-shadow: none; }
.calendar-day.unavailable { color: #c8bfbb; cursor: default; }
.calendar-day.empty { display: block; }
.persian-date-note { display: block; color: var(--muted); margin: -8px auto 22px; font-size: 11px; }
.guest-option:focus-visible, .yes-button:focus-visible, .button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--guest-accent, var(--coral)) 32%, transparent); outline-offset: 3px;
}

@media (max-width: 900px) {
  .site-header { padding-inline: 24px; }
  .hero { min-height: auto; }
  .steps article { padding: 27px 20px; }
  .builder { width: 100%; max-width: 100%; margin: 0; }
  .builder-layout { display: block; width: 100%; max-width: 100%; direction: rtl; }
  .builder-form { display: block; width: 100%; max-width: 100%; }
}
@media (max-width: 1120px) {
  .builder { max-width: 760px; }
  .builder-layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "form" "preview"; }
  .live-preview { position: static; margin-top: 22px; }
  .preview-label { max-width: 420px; margin-inline: auto; }
}
@media (max-width: 650px) {
  .site-header { height: 62px; padding-inline: 12px; margin: 0; }
  #userNav { min-width: 0; gap: 10px; }
  .user-greeting { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hero { padding-top: 50px; }
  .hero-art { transform: scale(.96); }
  .guest-shell { width: calc(100% - 14px); max-width: 430px; padding-top: 54px; }
  .progress { margin: 4px 6px 12px; flex-wrap: wrap; }
  .guest-steps { padding: 22px 12px; min-height: calc(100dvh - 88px); border-radius: 23px; }
  .yes-no-zone { height: 155px; width: 100%; max-width: 350px; }
  .yes-no-zone .yes-button { width: min(205px, 64%); right: 4px; top: 8px; padding-inline: 10px; }
  .yes-no-zone .no-button { left: 4px; top: 8px; min-width: 92px; }
  .playful-note { margin-top: -10px; }
  .dashboard-stats { gap: 9px; }
  .dashboard-stats article { border-radius: 15px; }
  .invite-card { padding: 18px; }
  .invite-main p { max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .form-card { border-radius: 17px; }
  .builder { padding: 20px 10px 70px; }
  .back-button { margin: 0 4px 16px; }
  .form-head { padding-inline: 4px; }
  .form-head h1 { font-size: 27px; line-height: 1.45; }
  .form-card { display: block; padding: 15px 12px; margin-block: 12px; }
  .form-step { margin-bottom: 12px; }
  .builder-form input, .builder-form textarea, .date-fields input { font-size: 16px; }
  .guest-step h1 { font-size: clamp(25px, 7.5vw, 29px); line-height: 1.4; letter-spacing: -.7px; }
  .guest-step > p { line-height: 1.8; }
  .big-question { margin-top: 20px; }
  .guest-options { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 20px auto; }
  .guest-option { min-height: 52px; padding: 11px 7px; font-size: 13px; }
  .transport-options { grid-template-columns: 1fr; }
  .privacy-consent { line-height: 1.8; }
  .date-fields { gap: 10px; margin: 20px auto 16px; }
  .persian-calendar { position: fixed; top: 50%; right: 50%; width: min(350px, calc(100vw - 24px)); transform: translate(50%, -50%); padding: 14px; }
  .calendar-day { font-size: 13px; border-radius: 10px; }
  .persian-date-note { margin-top: 2px; }
  .next-button { width: 100%; min-width: 0; }
}
@media (max-width: 370px) {
  .hero h1 { font-size: 36px; }
  .guest-steps { padding-inline: 12px; }
  .yes-no-zone .yes-button { font-size: 12px; }
  .yes-no-zone .no-button { font-size: 12px; min-width: 82px; }
  .choice-grid { grid-template-columns: 1fr; }
  .guest-options:not(.transport-options) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .guest-option { font-size: 12px; }
}
