:root {
  --bg: #f6f1ea;
  --surface: #fffdf8;
  --ink: #2b1a1d;
  --muted: #7a6a66;
  --line: #e8dfd4;
  --brand: #6b1d2a;
  --brand-soft: #f3e3c3;
  --checker: repeating-conic-gradient(#efe8de 0 25%, #f8f4ee 0 50%) 0 0 / 18px 18px;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 Montserrat, system-ui, sans-serif;
}

h1,
h2 {
  margin: 0;
  font-family: 'Playfair Display', serif;
  font-weight: 600;
  line-height: 1.15;
}

h1 {
  font-size: clamp(26px, 4vw, 36px);
}

h2 {
  font-size: 20px;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.hint {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- landing ---------- */

.landing {
  max-width: 620px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 48px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
}

.landing h1 {
  font-size: clamp(32px, 6vw, 48px);
}

.lead {
  margin: 0 0 8px;
  font-size: 17px;
  color: var(--muted);
}

.landing .button {
  align-self: flex-start;
}

.error {
  color: #b3261e;
}

/* ---------- page ---------- */

.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 16px 80px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.save-status {
  font-size: 13px;
  color: var(--muted);
}

.notice {
  margin: 0;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--brand-soft);
}

.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.steps li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  font-size: 14px;
}

.steps span {
  display: grid;
  place-items: center;
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(43, 26, 29, 0.04);
}

.card.open {
  border-color: var(--brand);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
}

.field input,
.field select,
.input {
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 400;
}

.field input[type='color'],
.background input[type='color'] {
  padding: 4px;
  cursor: pointer;
}

.field input:focus-visible,
.field select:focus-visible,
.input:focus-visible,
.button:focus-visible,
.swatch:focus-visible,
.format:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ---------- buttons ---------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 18px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}

.button:disabled {
  opacity: 0.5;
  cursor: default;
}

.button.primary {
  background: var(--ink);
  color: #fff;
}

.button.soft {
  background: var(--brand-soft);
  color: var(--ink);
}

.button.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand);
  font: inherit;
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
}

/* ---------- widget cards ---------- */

.widget-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.widget-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.widget-body {
  display: grid;
  gap: 24px;
  margin-top: 18px;
}

.open .widget-body {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  align-items: start;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.controls[hidden] {
  display: none;
}

.controls .grid {
  margin-top: 0;
}

.control {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-label {
  font-size: 13px;
  font-weight: 500;
}

.control-label em {
  font-style: normal;
  font-weight: 400;
  color: var(--muted);
}

.preview {
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.preview iframe {
  width: 100%;
  aspect-ratio: 640 / 300;
  border: 0;
  border-radius: 14px;
  background: var(--checker);
}

[data-widget='countdown'] .preview iframe {
  aspect-ratio: 640 / 240;
}

[data-widget='locket'] .preview iframe {
  aspect-ratio: 640 / 420;
}

[data-widget='music'] .preview iframe {
  max-width: 320px;
  aspect-ratio: 1;
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.swatch {
  position: relative;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--line);
  cursor: pointer;
}

.swatch[aria-pressed='true'] {
  box-shadow: 0 0 0 2px var(--brand);
}

.swatch.custom {
  overflow: hidden;
  background: conic-gradient(#e2a7ae, #f1d377, #98ad8b, #8fabd6, #b09ed6, #e2a7ae);
}

.swatch.custom input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.formats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.format {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.format strong {
  font-weight: 500;
}

.format small {
  font-size: 11px;
  color: var(--muted);
}

.format[aria-pressed='true'] {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
}

.toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.background {
  display: flex;
  align-items: center;
  gap: 12px;
}

.background input[type='color'] {
  width: 48px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.background input[type='color']:disabled {
  opacity: 0.4;
}

.segmented {
  display: inline-flex;
  align-self: flex-start;
  padding: 4px;
  border-radius: 999px;
  background: var(--bg);
}

.segmented label {
  position: relative;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 14px;
  cursor: pointer;
}

.segmented input {
  position: absolute;
  opacity: 0;
}

.segmented label:has(input:checked) {
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  font-weight: 600;
}

.segmented label:has(input:focus-visible) {
  outline: 2px solid var(--brand);
}

.upload {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.upload-name {
  font-size: 13px;
  color: var(--muted);
}

.howto {
  margin: 12px 0 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 760px) {
  .open .widget-body {
    grid-template-columns: 1fr;
  }

  .preview {
    position: static;
    order: -1;
  }

  .card {
    padding: 18px;
  }
}

.photo-tabs {
  display: flex;
  gap: 8px;
}

.photo-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.photo-tab[aria-pressed='true'] {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.photo-tab:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.photo-thumb {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--checker) center / cover;
}

.field input[type='range'] {
  min-height: 0;
  padding: 0;
  border: 0;
  accent-color: var(--brand);
}

/* ---------- docs ---------- */

.docs-examples {
  display: grid;
  gap: 24px;
  margin-top: 16px;
}

.docs-examples figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.docs-examples iframe {
  width: 100%;
  max-width: 640px;
  border: 0;
  border-radius: 14px;
  background: var(--checker);
}

.docs-examples figcaption {
  font-size: 13px;
  color: var(--muted);
}

.code {
  margin: 8px 0 0;
  padding: 12px 14px;
  overflow-x: auto;
  border-radius: 10px;
  background: var(--bg);
  font-size: 13px;
}

code {
  font-size: 0.92em;
}
