:root {
  --bg: #FBF6EE;
  --ink: #2B1E16;
  --muted: #8A7563;
  --gold: #B88A44;
  --line: #E7DAC6;
  --radius: 14px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Tajawal, system-ui, sans-serif;
  font-size: 17px;
}
.top { text-align: center; padding: 28px 16px 8px; }
.top h1 { font-family: "Aref Ruqaa", serif; font-size: 52px; margin: 0; color: var(--gold); line-height: 1.1; }
.top h1 span { font-size: 36px; }
.top p { margin: 6px 0 0; color: var(--muted); }

.wrap {
  max-width: 1040px; margin: 0 auto; padding: 16px;
  display: grid; gap: 24px; grid-template-columns: 1fr;
}
@media (min-width: 860px) { .wrap { grid-template-columns: 1fr 1fr; align-items: start; } .preview { position: sticky; top: 16px; } }

.form { display: grid; gap: 14px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label { display: grid; gap: 6px; font-weight: 500; }
label small { color: var(--muted); font-weight: 400; }
input[type=text], input:not([type]), input[type=date], input[type=time], input[type=url] {
  font: inherit; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #FFFDF9; color: var(--ink);
  min-height: 48px; width: 100%;
}
input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
input[type=url] { direction: ltr; text-align: left; }

.chips { border: 0; padding: 0; margin: 0; display: flex; gap: 10px; flex-wrap: wrap; }
.chips legend { font-weight: 500; margin-bottom: 6px; }
.chips label { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px 6px 8px; cursor: pointer; font-weight: 400; }
.chips input { position: absolute; opacity: 0; }
.chips label:has(input:checked) { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold) inset; }
.sw { width: 24px; height: 24px; border-radius: 50%; display: inline-block; border: 1px solid rgba(0,0,0,.1); }
.sw-gold { background: linear-gradient(135deg, #FFF8EA, #D9B26A); }
.sw-rose { background: linear-gradient(135deg, #FCEDEE, #C98C93); }
.sw-night { background: linear-gradient(135deg, #0F3B33, #C9A45C); }
.sw-sky { background: linear-gradient(135deg, #F4F9FF, #7FA9CF); }
.sw-burgundy { background: linear-gradient(135deg, #5E1A2A, #D9B26A); }
.sw-lavender { background: linear-gradient(135deg, #FAF7FF, #A894CC); }
.sw-black { background: linear-gradient(135deg, #1E1E1E, #C9A45C); }
.chips label:not(:has(.sw)) { padding: 8px 16px; }
.row.one { grid-template-columns: 1fr; }
[hidden] { display: none !important; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.check input { width: 20px; height: 20px; accent-color: var(--gold); }

.preview canvas { width: 100%; height: auto; border-radius: var(--radius); box-shadow: 0 10px 30px rgba(43,30,22,.15); background: #fff; display: block; }
.actions { display: grid; gap: 10px; margin-top: 14px; }
.btn {
  font: inherit; font-weight: 700; min-height: 52px; border-radius: 12px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); cursor: pointer; display: flex; align-items: center; justify-content: center; text-decoration: none;
}
.btn.primary { background: #25D366; border-color: #25D366; color: #fff; }
.btn.ghost { background: transparent; color: var(--muted); font-weight: 500; }
.btn:disabled { opacity: .5; cursor: default; }
.msg { color: #A23B3B; text-align: center; min-height: 1.2em; margin: 8px 0 0; }
.foot { text-align: center; color: var(--muted); padding: 24px 16px 40px; font-size: 14px; }
.foot a { color: var(--muted); }
