:root {
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  color: #1c1a2a;
  background: #faf9fc;
  font-synthesis: none;
  --line: #e9e5ef;
  --soft: #f3f0fa;
  --muted: #615a70;
  --purple: #513acb;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 300px; }
[hidden] { display: none !important; }
button, input, textarea { font: inherit; }
button, .upload { cursor: pointer; }
button:disabled { cursor: default; opacity: .6; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid #7860e9; outline-offset: 3px; }
a { color: var(--purple); }
h1, h2, p { margin: 0; }
.app-header { min-height: 72px; display: flex; align-items: center; justify-content: space-between; padding: .8rem clamp(1rem, 5vw, 4rem); background: white; border-bottom: 1px solid var(--line); gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .65rem; color: #201a32; font-weight: 760; font-size: 1.1rem; text-decoration: none; white-space: nowrap; }
.brand span { background: #221943; color: #fff; border-radius: .65rem; display: grid; place-items: center; width: 2.25rem; height: 2.25rem; }
.save-actions { display: flex; align-items: center; gap: 1rem; justify-content: end; }
#save-state { font-size: .85rem; color: var(--muted); overflow-wrap: anywhere; }
.primary, .subtle, .upload { border-radius: .62rem; border: 0; display: inline-flex; padding: .65rem .9rem; font-weight: 650; line-height: 1.25; text-align: center; align-items: center; justify-content: center; }
.primary { background: var(--purple); color: white; min-height: 42px; }
.subtle, .upload { background: var(--soft); color: #382b83; }
.text-button { border: 0; color: var(--purple); background: none; min-height: 36px; padding: .35rem .45rem; }
.workspace { display: grid; grid-template-columns: minmax(290px, 420px) minmax(0, 1fr); gap: clamp(1.25rem, 4vw, 4rem); max-width: 1330px; margin: 0 auto; padding: clamp(1rem, 5vw, 4rem); align-items: start; }
.controls-head h1 { font-size: clamp(1.7rem, 3vw, 2.35rem); line-height: 1.08; letter-spacing: -.055em; }
.controls-head p { margin-top: .65rem; color: var(--muted); line-height: 1.5; }
.tabs, .sizes { display: flex; gap: .2rem; padding: .25rem; background: #eeeaf5; border: 1px solid #e9e3f2; border-radius: .75rem; }
.tabs { margin: 1.5rem 0 1rem; }
.tabs button, .sizes button { background: transparent; border: 0; border-radius: .52rem; color: var(--muted); padding: .55rem .65rem; font-weight: 620; font-size: .88rem; }
.tabs button { flex: 1; }
.tabs button[aria-pressed=true], .sizes button[aria-pressed=true] { background: white; color: #302365; box-shadow: 0 1px 3px #33245020; }
.fields { display: grid; gap: 1rem; padding: 1.25rem; background: white; border: 1px solid var(--line); border-radius: 1rem; }
.fields h2 { font-size: 1rem; }
.fields label, legend { display: grid; gap: .4rem; font-weight: 625; font-size: .88rem; }
.fields input:not([type=radio], [type=file], [type=color]), textarea { width: 100%; border: 1px solid #ded8e8; border-radius: .58rem; padding: .7rem .75rem; background: #fff; color: #211b31; min-width: 0; font-size: 1rem; }
textarea { resize: vertical; }
.slug { display: flex; align-items: center; color: var(--muted); padding-left: .75rem; background: #f7f5fb; border: 1px solid var(--line); border-radius: .6rem; gap: .5rem; }
.slug > input { margin: -1px; }
.photo-control { display: flex; align-items: center; gap: .75rem; }
.photo-control div { display: flex; flex-wrap: wrap; gap: .3rem; }
.editor-avatar { width: 58px; height: 58px; border-radius: 50%; background: #e9e2fb; color: #46328f; display: grid; place-items: center; font-weight: 750; overflow: hidden; flex-shrink: 0; }
.editor-avatar img, img.card-avatar { width: 100%; height: 100%; object-fit: cover; }
.section-title, .stage-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.link-list, .link-row, .widget-fields { display: grid; gap: .75rem; }
fieldset { min-width: 0; margin: 0; border: 0; padding: 0; }
.link-row { border: 1px solid var(--line); border-radius: .75rem; padding: .75rem; }
.link-row legend { padding: 0 .3rem; }
.row-actions { display: flex; gap: .45rem; flex-wrap: wrap; }
.widget-fields { border-top: 1px solid var(--line); padding-top: 1rem; }
.widget-fields p, .empty { color: var(--muted); font-size: .875rem; line-height: 1.45; }
.themes, .alignment { display: flex; flex-wrap: wrap; gap: .6rem; padding-top: .65rem; }
.themes label, .alignment label { display: flex; align-items: center; gap: .35rem; }
.sample { width: 1rem; height: 1rem; border-radius: 50%; border: 1px solid #8b829e; }
.paper { background: #fff; }
.night { background: #262237; }
.mint { background: #ccebdc; }
.fields .color-field { display: flex; align-items: center; justify-content: space-between; }
.color-field input { padding: 0; width: 2.6rem; height: 2.2rem; border: 1px solid var(--line); border-radius: .35rem; background: white; cursor: pointer; }
.error { color: #8b2230; background: #ffeef0; padding: .75rem; margin-top: .75rem; border-radius: .6rem; }
.published { border: 1px solid var(--line); border-radius: .7rem; margin-top: .85rem; padding: .75rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem; background: white; }
.stage { min-width: 0; border: 1px solid #e5e0ee; border-radius: 1.25rem; background: #efecf6; padding: clamp(.65rem, 2.6vw, 1.5rem); }
.stage-head h2 { font-size: 1rem; }
.stage-head { margin-bottom: 1.25rem; }
.preview { margin: auto; max-width: 100%; border-radius: 1rem; outline: 1px solid #ddd5e9; overflow: hidden; box-shadow: 0 18px 52px #331c5c13; }
.preview.phone { width: 350px; }
.preview.wide { width: 100%; }
.card { background: #fffdf9; color: #211b31; --on-accent: white; min-height: 440px; padding: clamp(1.25rem, 4vw, 3rem); overflow-wrap: anywhere; }
.card[data-theme=night] { background: #221d2f; color: #faf7ff; }
.card[data-theme=mint] { background: #edfbf3; color: #122f24; }
.card[data-layout=center] { text-align: center; }
.card-body { max-width: 35rem; margin: 0 auto; }
.card-avatar { width: 5rem; height: 5rem; border: 2px solid #9b7ce957; border-radius: 50%; background: #e9e2fb; color: #483091; display: inline-grid; place-items: center; font-size: 1.5rem; font-weight: 750; vertical-align: middle; }
img.card-avatar { width: 5rem; height: 5rem; }
.card h1 { font-size: clamp(1.65rem, 5vw, 3.25rem); letter-spacing: -.063em; line-height: 1.05; margin-top: 1rem; }
.card-role { font-weight: 680; margin: .55rem 0; }
.card-bio { opacity: .8; line-height: 1.5; white-space: pre-wrap; margin-top: .85rem; }
.card-links { display: grid; gap: .6rem; margin-top: 1.35rem; }
.card-link, .store-widget { display: block; text-decoration: none; font-weight: 650; border-radius: .65rem; padding: .75rem .9rem; }
.card-link { color: var(--on-accent); background: var(--accent, #5238d6); }
.store-widget { display: flex; align-items: center; gap: .65rem; text-align: left; border: 1px solid #9285ab65; color: inherit; margin-top: 1rem; }
.store-widget small { display: block; opacity: .76; margin-top: .15rem; }
.store-icon { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: .5rem; background: #e9e2fb; color: #483091; flex-shrink: 0; }
#public .card { min-height: 100dvh; padding-top: clamp(3rem, 10vh, 7rem); }
.public-status { padding: 3rem 1rem; text-align: center; }
@media (max-width: 760px) {
  .workspace { grid-template-columns: 1fr; }
  .stage { max-width: 100%; }
  .save-actions { flex-wrap: wrap; gap: .4rem; }
  #save-state { order: 2; width: 100%; text-align: end; }
}

.store-catalog { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.55rem; margin-top:.6rem; }
.store-product { display:flex; flex-direction:column; gap:.25rem; padding:.65rem; border:1px solid currentColor; border-radius:.7rem; text-align:left; color:inherit; text-decoration:none; overflow-wrap:anywhere; }
.store-product img { width:100%; aspect-ratio:4/3; object-fit:cover; border-radius:.4rem; }

#account-dialog { box-sizing: border-box; width: min(92vw, 440px); max-height: min(90vh, 790px); color: #1c1a2a; background: #fff; border: 1px solid var(--line); border-radius: 1.15rem; padding: 1.25rem; box-shadow: 0 22px 75px #1b123a3b; }
#account-dialog::backdrop { background: #18112e70; }
.account-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .9rem; }
.account-head h2 { font-size: 1.25rem; }
.account-panel { display: grid; gap: .8rem; }
.account-panel .tabs { margin: 0 0 .75rem; }
.account-panel label, .card-picker { display: grid; gap: .4rem; font-size: .9rem; font-weight: 650; }
.account-panel input, .card-picker select { min-width: 0; width: 100%; color: #211b31; background: white; border: 1px solid #ded8e8; border-radius: .58rem; padding: .7rem .75rem; font: inherit; font-weight: 480; }
.account-providers { display: grid; gap: .55rem; }
.account-hint { color: var(--muted); font-size: .87rem; line-height: 1.45; margin-top: .15rem; }
#auth-feedback { margin-top: .75rem; }
.pairing-code { color: #32226f; padding: .7rem .9rem; border-radius: .6rem; background: var(--soft); font: 680 1.65rem ui-monospace, monospace; letter-spacing: .15em; text-align: center; }
#max-open { text-decoration: none; }
.card-picker { margin-top: .85rem; }

.store-pairing { display: grid; gap: .55rem; padding: .75rem; background: #faf8ff; border: 1px solid var(--line); border-radius: .75rem; }
.store-code-row, .store-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.store-code-row .pairing-code { font-size: 1.35rem; padding: .52rem .7rem; }
#store-approve { text-decoration: none; justify-self: start; }
.store-manual { padding-top: .55rem; border-top: 1px solid var(--line); }
.store-manual summary { cursor: pointer; color: var(--purple); font-size: .875rem; }
.store-manual label { margin-top: .6rem; }

.card-section { border-top: 1px solid color-mix(in srgb, currentColor 18%, transparent); padding-top: 1rem; margin-top: 1.1rem; text-align: start; }
.card-section h2 { margin: 0 0 .4rem; font-size: 1.1rem; overflow-wrap: anywhere; }
.card-section p { margin: 0; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
#tabs { flex-wrap: wrap; }

.consent-fields { border: 0; padding: 0; display: grid; gap: .7rem; }
.consent-fields legend { font-weight: 700; margin-bottom: .5rem; }
.consent-fields label, .account-panel .account-marketing { display: flex; align-items: start; gap: .55rem; font-weight: 500; }
.account-panel input[type=checkbox] { width: 1.1rem; height: 1.1rem; margin: .12rem 0 0; padding: 0; flex: none; accent-color: #5238d6; }
.consent-fields a { color: #5238d6; }
.legal-page { max-width: 48rem; margin: 3rem auto; padding: 0 1.25rem 3rem; line-height: 1.65; }
.legal-page h1 { line-height: 1.15; }
