/* ==================================================================
   Studio — the owner's workspace.

   Sized for comfort rather than density: 17px base text, 48px minimum
   button height, generous spacing. Someone should be able to use this
   on a laptop screen without leaning in.

   Uses its own --ui-* palette. The gallery's theme variables (--bg,
   --ink, …) apply only to the preview pane, so setting the website to
   a dark theme never makes these controls unreadable.
   ================================================================== */

.studio {
  --ui-bg: #f6f6f4;
  --ui-panel: #ffffff;
  --ui-sunk: #eeedea;
  --ui-ink: #1c1b19;
  --ui-soft: #55534e;
  --ui-faint: #86837e;
  --ui-line: #dcdad5;
  --ui-primary: #1c1b19;
  --ui-danger: #a8342b;
  --ui-ok: #2c7a4d;
  --ui-shadow: 0 12px 32px -18px rgb(20 18 14 / 0.4);
  --ui-radius: 12px;
  --ui-tap: 48px;

  background: var(--ui-bg);
  color: var(--ui-ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
}

@media (prefers-color-scheme: dark) {
  .studio {
    --ui-bg: #111112;
    --ui-panel: #1a1a1c;
    --ui-sunk: #232326;
    --ui-ink: #ecebe8;
    --ui-soft: #b0aea9;
    --ui-faint: #7d7a75;
    --ui-line: #313136;
    --ui-primary: #ecebe8;
    --ui-danger: #e2726a;
    --ui-ok: #6fbf8f;
    --ui-shadow: 0 14px 36px -18px rgb(0 0 0 / 0.8);
  }
  .studio .btn-primary { color: #111112; }
  .studio .pic-badge { background: rgb(0 0 0 / 0.78); }
}

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

.studio .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: var(--ui-tap);
  padding: 0.6rem 1.3rem;
  border: 1.5px solid var(--ui-line);
  border-radius: 9px;
  background: var(--ui-panel);
  color: var(--ui-ink);
  font-size: 1rem;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, opacity 0.16s ease;
}
.studio .btn:hover:not(:disabled) { background: var(--ui-sunk); }
.studio .btn:disabled { opacity: 0.45; cursor: default; }
.studio .btn-big { width: 100%; font-size: 1.05rem; min-height: 54px; }

.studio .btn-primary {
  background: var(--ui-primary);
  border-color: var(--ui-primary);
  color: #fff;
  font-weight: 500;
}
.studio .btn-primary:hover:not(:disabled) { opacity: 0.85; background: var(--ui-primary); }

.studio .btn-quiet { background: transparent; }
.studio .btn-see { background: var(--ui-panel); font-weight: 500; }
.studio .btn-danger {
  color: var(--ui-danger);
  border-color: color-mix(in srgb, var(--ui-danger) 40%, transparent);
}
.studio .btn-danger:hover:not(:disabled) { background: color-mix(in srgb, var(--ui-danger) 10%, transparent); }

.studio .icon-btn {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 0; border-radius: 9px;
  background: transparent;
  color: var(--ui-soft);
  font-size: 1.8rem; line-height: 1;
  cursor: pointer;
}
.studio .icon-btn:hover { background: var(--ui-sunk); color: var(--ui-ink); }

.studio .link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ui-ink);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.studio .link-button:hover { color: var(--ui-danger); }

/* ---- form fields --------------------------------------------------- */

.studio .field { display: grid; gap: 0.45rem; margin-bottom: 1.35rem; }
.studio .field-label { font-size: 1rem; font-weight: 500; color: var(--ui-ink); }
.studio .field-note {
  display: block;
  margin-top: 0.1rem;
  font-weight: 400;
  font-size: 0.9rem;
  color: var(--ui-faint);
}
.studio .field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.studio .control-help { margin: -0.35rem 0 0.85rem; color: var(--ui-faint); font-size: 0.94rem; }

.studio input[type="text"],
.studio input[type="password"],
.studio textarea {
  width: 100%;
  min-height: var(--ui-tap);
  padding: 0.7rem 0.85rem;
  border: 1.5px solid var(--ui-line);
  border-radius: 9px;
  background: var(--ui-panel);
  color: var(--ui-ink);
  font: inherit;
}
.studio textarea { resize: vertical; line-height: 1.6; }
.studio input:focus-visible,
.studio textarea:focus-visible,
.studio button:focus-visible,
.studio a:focus-visible {
  outline: 3px solid var(--ui-primary);
  outline-offset: 2px;
}
.studio input:focus-visible, .studio textarea:focus-visible { border-color: transparent; }

.studio .switch {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 0.75rem;
  margin-bottom: 1rem;
  cursor: pointer;
}
.studio .switch input { accent-color: var(--ui-primary); width: 22px; height: 22px; margin-top: 2px; }
.studio .switch-big {
  padding: 0.9rem 1rem;
  border: 1.5px solid var(--ui-line);
  border-radius: 10px;
  background: var(--ui-panel);
}

.studio .section-title {
  margin: 2.5rem 0 0.85rem;
  font-family: var(--sans);
  font-size: 1.12rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ui-ink);
}
.studio .section-title:first-child { margin-top: 0; }

.studio .editor-section {
  margin: 2rem 0 0.75rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.studio code {
  padding: 0.1em 0.4em;
  border-radius: 4px;
  background: var(--ui-sunk);
  font-size: 0.9em;
}

/* ---- segmented choices ---------------------------------------------- */

.studio .segmented {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.studio .segmented-wrap { flex-wrap: wrap; }
.studio .segmented button {
  flex: 1 1 auto;
  min-height: var(--ui-tap);
  padding: 0.6rem 0.9rem;
  border: 1.5px solid var(--ui-line);
  border-radius: 9px;
  background: var(--ui-panel);
  color: var(--ui-soft);
  font: inherit;
  font-size: 0.97rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.studio .segmented button:hover { background: var(--ui-sunk); color: var(--ui-ink); }
.studio .segmented button[aria-pressed="true"] {
  border-color: var(--ui-primary);
  box-shadow: inset 0 0 0 1px var(--ui-primary);
  color: var(--ui-ink);
  font-weight: 500;
}
.studio .segmented-tall button { min-height: 56px; }

/* ---- stepper --------------------------------------------------------- */

.studio .stepper {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem;
  border: 1.5px solid var(--ui-line);
  border-radius: 10px;
  background: var(--ui-panel);
}
.studio .stepper-btn {
  width: 52px; height: 52px;
  border: 0; border-radius: 8px;
  background: var(--ui-sunk);
  color: var(--ui-ink);
  font-size: 1.6rem; line-height: 1;
  cursor: pointer;
}
.studio .stepper-btn:hover { background: var(--ui-line); }
.studio .stepper-value {
  min-width: 3rem;
  text-align: center;
  font-size: 1.4rem;
  font-variant-numeric: tabular-nums;
}

/* ---- colour swatches -------------------------------------------------- */

.studio .swatch-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.studio .swatch {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: var(--ui-tap);
  padding: 0.4rem 0.85rem 0.4rem 0.5rem;
  border: 1.5px solid var(--ui-line);
  border-radius: 999px;
  background: var(--ui-panel);
  font: inherit;
  font-size: 0.94rem;
  color: var(--ui-soft);
  cursor: pointer;
}
.studio .swatch[aria-pressed="true"] {
  border-color: var(--ui-primary);
  box-shadow: inset 0 0 0 1px var(--ui-primary);
  color: var(--ui-ink);
}
.studio .swatch-dot {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--swatch);
  border: 1px solid rgb(0 0 0 / 0.12);
}

/* ---- notice screens (setup needed) ------------------------------------ */

.notice-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 2rem 1.25rem;
}
.notice-screen[hidden] { display: none; }

.notice-card {
  width: min(100%, 36rem);
  padding: clamp(1.75rem, 5vw, 3rem);
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius);
  background: var(--ui-panel);
  box-shadow: var(--ui-shadow);
}
.notice-mark { margin: 0; font-size: 2.2rem; line-height: 1; color: var(--ui-faint); }
.notice-title {
  margin: 0.5rem 0 0.6rem;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.9rem;
}
.notice-text { margin: 0 0 1.5rem; color: var(--ui-soft); }
.notice-steps { margin: 0 0 1.75rem; padding-left: 1.35rem; display: grid; gap: 0.6rem; }
.notice-steps li { padding-left: 0.25rem; }

/* ---- sign in ---------------------------------------------------------- */

.gate {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 2rem 1.25rem;
}
.gate[hidden] { display: none; }

.gate-card {
  width: min(100%, 27rem);
  padding: clamp(1.85rem, 5vw, 3rem);
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius);
  background: var(--ui-panel);
  box-shadow: var(--ui-shadow);
}
.gate-title { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 2.1rem; }
.gate-hint { margin: 0.4rem 0 1.85rem; color: var(--ui-soft); }
.gate-error {
  margin: -0.5rem 0 1rem;
  padding: 0.7rem 0.9rem;
  border-radius: 8px;
  background: color-mix(in srgb, var(--ui-danger) 12%, transparent);
  color: var(--ui-danger);
  font-size: 0.96rem;
}
.gate-back {
  display: block;
  margin-top: 1.75rem;
  text-align: center;
  color: var(--ui-faint);
  font-size: 0.95rem;
  text-decoration: none;
}
.gate-back:hover { color: var(--ui-ink); }

/* ---- app shell --------------------------------------------------------- */

.app[hidden] { display: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.75rem clamp(1rem, 3vw, 2rem);
  border-bottom: 1px solid var(--ui-line);
  background: color-mix(in srgb, var(--ui-bg) 90%, transparent);
  backdrop-filter: blur(12px);
}
.brand { font-family: var(--serif); font-size: 1.3rem; }
.topbar-right { display: flex; align-items: center; gap: 0.6rem; margin-left: auto; }

.tabs { display: flex; gap: 0.3rem; }
.tab {
  min-height: 44px;
  padding: 0.5rem 1rem;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ui-soft);
  font: inherit;
  font-size: 1rem;
  cursor: pointer;
  white-space: nowrap;
}
.tab:hover { background: var(--ui-sunk); color: var(--ui-ink); }
.tab.is-active { background: var(--ui-sunk); color: var(--ui-ink); font-weight: 600; }

.panel { display: none; padding: clamp(1.5rem, 3vw, 2.5rem); max-width: 1500px; margin: 0 auto; }
.panel.is-active { display: block; }
.panel.is-hot { outline: 3px dashed var(--ui-primary); outline-offset: -12px; border-radius: var(--ui-radius); }

.form-column { max-width: 36rem; }

@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; gap: 0.75rem; }
  .tabs { order: 3; width: 100%; overflow-x: auto; padding-bottom: 0.15rem; }
  .brand { font-size: 1.15rem; }
}

/* ---- the "Saved" flag ---------------------------------------------------- */

.saved-flag {
  position: fixed;
  top: 5.25rem;
  left: 50%;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  background: var(--ui-ok);
  color: #fff;
  font-size: 1.02rem;
  font-weight: 500;
  box-shadow: 0 10px 26px -12px rgb(0 0 0 / 0.5);
  transform: translate(-50%, -12px);
  opacity: 0;
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: none;
}
.saved-flag[hidden] { display: none; }
.saved-flag.is-on { opacity: 1; transform: translate(-50%, 0); }
.saved-flag span { font-size: 1.15rem; }

/* ---- adding pictures ------------------------------------------------------ */

.add-block { text-align: center; margin-bottom: 2rem; }

.add-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  width: min(100%, 30rem);
  min-height: 84px;
  padding: 1rem 2rem;
  border: 2px dashed var(--ui-line);
  border-radius: 14px;
  background: var(--ui-panel);
  color: var(--ui-ink);
  font: inherit;
  font-size: 1.35rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}
.add-button:hover {
  border-color: var(--ui-primary);
  background: var(--ui-sunk);
  transform: translateY(-1px);
}
.add-plus { font-size: 1.9rem; line-height: 1; font-weight: 300; }
.add-hint {
  max-width: 32rem;
  margin: 0.9rem auto 0;
  color: var(--ui-faint);
  font-size: 0.98rem;
}

.upload-queue { list-style: none; margin: 0 auto 2rem; padding: 0; max-width: 42rem; display: grid; gap: 0.5rem; }
.upload-queue[hidden] { display: none; }
.upload-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.3rem 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--ui-line);
  border-radius: 10px;
  background: var(--ui-panel);
  font-size: 0.95rem;
}
.upload-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-status { color: var(--ui-faint); }
.upload-bar { grid-column: 1 / -1; height: 3px; background: var(--ui-sunk); border-radius: 3px; }
.upload-bar i { display: block; height: 100%; width: 0; background: var(--ui-primary); border-radius: 3px; transition: width 0.3s ease; }
.upload-row.is-done .upload-status { color: var(--ui-ok); font-weight: 500; }
.upload-row.is-done .upload-bar i { background: var(--ui-ok); }
.upload-row.is-failed .upload-status { color: var(--ui-danger); }
.upload-row.is-failed .upload-bar i { background: var(--ui-danger); }

/* ---- first run guidance ----------------------------------------------------- */

.firstrun {
  list-style: none;
  max-width: 40rem;
  margin: 2.5rem auto 0;
  padding: 0;
  display: grid;
  gap: 1.15rem;
}
.firstrun[hidden] { display: none; }
.firstrun li { display: grid; grid-template-columns: auto 1fr; gap: 1rem; align-items: start; }
.firstrun-num {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--ui-sunk);
  color: var(--ui-soft);
  font-size: 1.02rem;
  font-weight: 600;
}
.firstrun-text { padding-top: 0.3rem; }
.firstrun-aside {
  margin-top: 0.5rem;
  padding-top: 1.35rem;
  border-top: 1px solid var(--ui-line);
  color: var(--ui-soft);
}

/* ---- the picture grid --------------------------------------------------------- */

.pictures-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 1.25rem;
  margin-bottom: 1.15rem;
}
.pictures-head[hidden] { display: none; }
.pictures-count { margin: 0; font-weight: 600; }
.pictures-hint { margin: 0; color: var(--ui-faint); font-size: 0.96rem; }

.pictures {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.35rem;
  touch-action: pan-y;
}

.pic {
  border: 1.5px solid var(--ui-line);
  border-radius: var(--ui-radius);
  background: var(--ui-panel);
  overflow: hidden;
  user-select: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.pic:hover { border-color: var(--ui-soft); box-shadow: var(--ui-shadow); }
.pic.is-hidden-piece .pic-thumb { opacity: 0.4; }
.pic.is-dragging { opacity: 0.25; }

.pic-ghost {
  position: fixed;
  top: 0; left: 0;
  z-index: 80;
  pointer-events: none;
  box-shadow: 0 24px 48px -20px rgb(0 0 0 / 0.5);
  rotate: -1.5deg;
  opacity: 0.95;
}

.pic-thumb { position: relative; aspect-ratio: 4 / 3; background: var(--ui-sunk); cursor: grab; }
.pic-thumb img { width: 100%; height: 100%; object-fit: cover; }

.pic-badge {
  position: absolute;
  top: 0.6rem; left: 0.6rem;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  background: rgb(20 18 14 / 0.82);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 500;
}

.pic-title {
  margin: 0;
  padding: 0.85rem 0.9rem 0.6rem;
  font-size: 1.02rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pic-actions {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.4rem;
  padding: 0 0.7rem 0.75rem;
}
.pic-move, .pic-edit {
  min-height: 44px;
  border: 1.5px solid var(--ui-line);
  border-radius: 8px;
  background: var(--ui-panel);
  color: var(--ui-ink);
  font: inherit;
  cursor: pointer;
}
.pic-move { width: 46px; font-size: 1.25rem; line-height: 1; }
.pic-edit { font-weight: 500; }
.pic-move:hover:not(:disabled), .pic-edit:hover { background: var(--ui-sunk); }
.pic-move:disabled { opacity: 0.3; cursor: default; }

/* ---- how it looks ------------------------------------------------------------- */

.looks-split {
  display: grid;
  grid-template-columns: minmax(300px, 380px) 1fr;
  gap: clamp(1.5rem, 3vw, 2.5rem);
  align-items: start;
}
@media (max-width: 1080px) { .looks-split { grid-template-columns: 1fr; } }

.controls {
  padding: 1.6rem;
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius);
  background: var(--ui-panel);
}

.preset-grid { display: grid; gap: 0.6rem; }

.preset {
  display: grid;
  grid-template-columns: 52px 1fr;
  grid-template-rows: auto auto;
  gap: 0.15rem 1rem;
  padding: 0.9rem 1rem;
  border: 1.5px solid var(--ui-line);
  border-radius: 10px;
  background: var(--ui-panel);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.preset:hover { background: var(--ui-sunk); }
.preset[aria-pressed="true"] {
  border-color: var(--ui-primary);
  box-shadow: inset 0 0 0 1px var(--ui-primary);
}
.preset-thumb { grid-row: 1 / 3; align-self: center; height: 44px; border-radius: 5px; background: var(--ui-sunk); }
.preset[aria-pressed="true"] .preset-thumb { background: var(--ui-bg); }
.preset-name { font-size: 1.05rem; font-weight: 600; }
.preset-blurb { color: var(--ui-faint); font-size: 0.9rem; line-height: 1.45; }

/* Miniature diagrams of each arrangement, drawn with gradients. */
[data-preset-art] { --c: color-mix(in srgb, var(--ui-ink) 34%, transparent); background-repeat: no-repeat; }
[data-preset-art="masonry"] {
  background-image:
    linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c)),
    linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c)),
    linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c));
  background-size: 13px 18px, 13px 9px, 13px 10px, 13px 17px, 13px 13px, 13px 13px;
  background-position: 4px 3px, 4px 24px, 19px 3px, 19px 16px, 34px 3px, 34px 19px;
}
[data-preset-art="justified"] {
  background-image:
    linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c)),
    linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c)),
    linear-gradient(var(--c), var(--c));
  background-size: 18px 12px, 11px 12px, 13px 12px, 15px 12px, 27px 12px;
  background-position: 4px 6px, 24px 6px, 37px 6px, 4px 20px, 21px 20px;
}
[data-preset-art="grid"] {
  background-image:
    linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c)),
    linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c)),
    linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c));
  background-size: 12px 12px;
  background-position: 4px 6px, 19px 6px, 34px 6px, 4px 21px, 19px 21px, 34px 21px;
}
[data-preset-art="salon"] {
  background-image:
    linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c)),
    linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c)),
    linear-gradient(var(--c), var(--c));
  background-size: 26px 16px, 13px 16px, 12px 13px, 14px 13px, 13px 13px;
  background-position: 4px 4px, 33px 4px, 4px 24px, 19px 22px, 34px 24px;
}
[data-preset-art="column"] {
  background-image:
    linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c));
  background-size: 38px 14px, 38px 14px;
  background-position: 7px 5px, 7px 23px;
}

.theme-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.theme-chip {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: var(--ui-tap);
  padding: 0.4rem 0.9rem 0.4rem 0.45rem;
  border: 1.5px solid var(--ui-line);
  border-radius: 999px;
  background: var(--ui-panel);
  font: inherit;
  font-size: 0.95rem;
  color: var(--ui-soft);
  cursor: pointer;
}
.theme-chip[aria-pressed="true"] {
  border-color: var(--ui-primary);
  box-shadow: inset 0 0 0 1px var(--ui-primary);
  color: var(--ui-ink);
}
.theme-swatch {
  display: grid; place-items: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1px solid var(--ui-line);
  background: var(--chip-bg);
  color: var(--chip-ink);
  font-family: var(--serif);
  font-size: 0.78rem;
}

/* ---- live preview --------------------------------------------------------------- */

.preview-wrap {
  position: sticky;
  top: 5.5rem;
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius);
  background: var(--ui-panel);
  overflow: hidden;
}
@media (max-width: 1080px) { .preview-wrap { position: static; } }

.preview-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--ui-line);
}
.preview-label { color: var(--ui-soft); font-size: 0.96rem; font-weight: 500; }
.preview-sizes { display: flex; gap: 0.3rem; }
.chip {
  min-height: 38px;
  padding: 0.3rem 0.9rem;
  border: 1.5px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--ui-faint);
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
}
.chip:hover { color: var(--ui-ink); }
.chip.is-active { background: var(--ui-sunk); color: var(--ui-ink); font-weight: 500; }

.preview-frame {
  display: grid;
  justify-items: center;
  padding: 1rem;
  background: var(--ui-sunk);
  max-height: 76vh;
  overflow: auto;
}
.preview-frame[data-size="phone"] .preview-page { max-width: 390px; }

.preview-page {
  width: 100%;
  padding: 1.5rem;
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  transition: max-width 0.3s ease;
}
.preview-page .piece-frame { cursor: default; }
.preview-empty { margin: 0; padding: 3rem 0; text-align: center; color: var(--ink-faint, #999); font-size: 0.95rem; }

/* ---- editing one picture --------------------------------------------------------- */

.editor { position: fixed; inset: 0; z-index: 60; }
.editor[hidden] { display: none; }

.editor-scrim {
  position: absolute;
  inset: 0;
  background: rgb(15 13 10 / 0.4);
  opacity: 0;
  transition: opacity 0.22s ease;
}
.editor.is-open .editor-scrim { opacity: 1; }

.editor-panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(100%, 30rem);
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--ui-panel);
  border-left: 1px solid var(--ui-line);
  box-shadow: -18px 0 44px -28px rgb(0 0 0 / 0.5);
  transform: translateX(100%);
  transition: transform 0.24s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.editor.is-open .editor-panel { transform: none; }

.editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 0.85rem 0.85rem 1.5rem;
  border-bottom: 1px solid var(--ui-line);
}
.editor-title { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 1.3rem; }

.editor-body { overflow-y: auto; padding: 1.5rem; }
.editor-thumb {
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  margin-bottom: 1.5rem;
  border-radius: 9px;
  background: var(--ui-sunk);
}
.editor-facts { margin: 1.5rem 0 0; color: var(--ui-faint); font-size: 0.9rem; }
[data-price-field][hidden] { display: none; }

.editor-foot {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--ui-line);
}
.editor-foot .btn-big { min-height: 50px; font-size: 1rem; }

/* ---- misc ------------------------------------------------------------------------ */

.facts { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 0.6rem 1.35rem; }
.facts dt { color: var(--ui-faint); }
.facts dd { margin: 0; }

.form-message {
  margin: 0 0 1rem;
  padding: 0.7rem 0.9rem;
  border-radius: 8px;
  font-size: 0.97rem;
}
.form-message[data-kind="ok"] { background: color-mix(in srgb, var(--ui-ok) 14%, transparent); color: var(--ui-ok); }
.form-message[data-kind="error"] { background: color-mix(in srgb, var(--ui-danger) 12%, transparent); color: var(--ui-danger); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.75rem;
  z-index: 95;
  transform: translateX(-50%);
  padding: 0.85rem 1.35rem;
  border-radius: 10px;
  background: var(--ui-primary);
  color: var(--ui-bg);
  font-size: 1rem;
  box-shadow: var(--ui-shadow);
  animation: toast-in 0.25s cubic-bezier(0.22, 0.61, 0.36, 1);
  max-width: min(92vw, 34rem);
}
.toast[hidden] { display: none; }
.toast[data-kind="error"] { background: var(--ui-danger); color: #fff; }

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .studio *, .studio *::before, .studio *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
