/* SkyDesign Studio — designer stylesheet
   A light, warm print-studio chrome: paper panels, gold accents,
   the artwork sitting like a proof on the press table. */

:root {
  --st-bg: #E6E0D4;
  --st-bg-raise: rgba(252, 250, 245, 0.56);
  --st-bg-panel: rgba(252, 250, 245, 0.72);
  --st-border: rgba(255,255,255,0.44);
  --st-border-lite: rgba(255,255,255,0.58);
  --st-text: #1C1912;
  --st-text-dim: #6B6459;
  --st-text-faint: #9C948A;
  --st-gold: var(--color-gold, #C4993A);
  --st-gold-soft: rgba(196, 153, 58, 0.16);
  --st-danger: #b8402f;
  --st-ok: #2F7D5F;
  --st-radius: 14px;
  --st-radius-lg: 22px;
  --st-shadow-pop: 0 22px 70px rgba(10, 9, 8, 0.2);
  --st-glass: rgba(252,250,245,0.54);
  --st-glass-strong: rgba(252,250,245,0.76);
  --st-glass-shadow: 0 18px 54px rgba(10,9,8,0.12), inset 0 1px 0 rgba(255,255,255,0.58);
  --st-font: "Outfit", "Segoe UI", sans-serif;
  --st-font-display: "Fraunces", Georgia, serif;
}

/* The hidden attribute must always win over component display rules. */
.studio [hidden] { display: none !important; }

.studio-body {
  margin: 0;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.72), rgba(227,221,207,0.7) 46%, rgba(201,194,176,0.84)),
    var(--st-bg);
  color: var(--st-text);
  font-family: var(--st-font);
  overflow: hidden;
}
.studio-body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.58), rgba(255,255,255,0) 34%),
    linear-gradient(115deg, rgba(196,153,58,0.12), rgba(255,255,255,0) 45%, rgba(47,125,95,0.08));
}
.studio-body ::selection { background: var(--st-gold-soft); }

.studio {
  display: grid;
  grid-template-rows: 64px 54px minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  padding: 10px;
  gap: 8px;
}

/* ============================ TOP BAR ============================ */
.studio-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 0.75rem;
  border: 1px solid var(--st-border-lite);
  border-radius: 999px;
  background: var(--st-glass);
  box-shadow: var(--st-glass-shadow);
  backdrop-filter: blur(24px) saturate(1.35);
  -webkit-backdrop-filter: blur(24px) saturate(1.35);
}
.topbar-left, .topbar-center, .topbar-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}
.studio-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--st-text);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.studio-brand svg { color: var(--st-text-dim); }
.studio-brand:hover svg { color: var(--st-gold); }
.studio-brand em {
  font-family: var(--st-font-display);
  font-style: italic;
  font-weight: 600;
  color: var(--st-gold);
}
.topbar-doc {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-left: 0.9rem;
  border-left: 1px solid var(--st-border);
  line-height: 1.25;
}
.topbar-doc strong {
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-doc span { font-size: 0.72rem; color: var(--st-text-dim); white-space: nowrap; }

.tb-icon {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: rgba(255,255,255,0.16);
  color: var(--st-text);
  cursor: pointer;
}
.tb-icon svg {
  width: 17px; height: 17px;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.tb-icon:hover:not(:disabled) { background: rgba(255,255,255,0.62); border-color: var(--st-border-lite); }
.tb-icon:disabled { color: var(--st-text-faint); cursor: default; }
.tb-sep { width: 1px; height: 22px; background: var(--st-border-lite); }
.tb-note { font-size: 0.72rem; color: var(--st-text-faint); white-space: nowrap; }

.tb-price {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--st-gold);
  white-space: nowrap;
}
.tb-btn {
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  border: 1px solid var(--st-border-lite);
  background: rgba(255,255,255,0.34);
  color: var(--st-text);
  font: 600 0.85rem var(--st-font);
  cursor: pointer;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.58);
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease;
}
.tb-btn:hover { transform: translateY(-1px); border-color: rgba(196,153,58,0.52); background: rgba(255,255,255,0.62); }
.tb-btn.primary {
  background: linear-gradient(180deg, rgba(232,199,113,0.98), rgba(196,153,58,0.88));
  border-color: rgba(255,255,255,0.62);
  color: #14120e;
  box-shadow: 0 14px 32px rgba(196,153,58,0.24), inset 0 1px 0 rgba(255,255,255,0.72);
}
.tb-btn.primary:hover { filter: brightness(1.08); }

.tb-menu-wrap { position: relative; }
.tb-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  min-width: 230px;
  padding: 0.4rem;
  border: 1px solid var(--st-border-lite);
  border-radius: var(--st-radius-lg);
  background: var(--st-glass-strong);
  box-shadow: var(--st-shadow-pop);
  backdrop-filter: blur(26px) saturate(1.35);
  -webkit-backdrop-filter: blur(26px) saturate(1.35);
}
.tb-menu button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 0;
  border-radius: var(--st-radius);
  background: transparent;
  color: var(--st-text);
  font: 600 0.85rem var(--st-font);
  text-align: left;
  cursor: pointer;
}
.tb-menu button:hover { background: var(--st-gold-soft); }
.tb-menu small { color: var(--st-text-dim); font-weight: 400; font-size: 0.72rem; }

/* ========================= CONTEXT BAR ========================= */
.context-bar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0 0.75rem;
  border: 1px solid var(--st-border-lite);
  border-radius: 999px;
  background: var(--st-glass);
  box-shadow: var(--st-glass-shadow);
  backdrop-filter: blur(24px) saturate(1.35);
  -webkit-backdrop-filter: blur(24px) saturate(1.35);
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: thin;
}
.ctx-group { display: flex; align-items: center; gap: 0.35rem; flex-shrink: 0; }
.ctx-hint { font-size: 0.8rem; color: var(--st-text-faint); }

.ctx-icon, .ctx-chip, .ctx-select {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: rgba(255,255,255,0.16);
  color: var(--st-text);
  font: 600 0.82rem var(--st-font);
  cursor: pointer;
  white-space: nowrap;
}
.ctx-icon { width: 34px; }
.ctx-chip, .ctx-select { padding: 0 0.65rem; }
.ctx-icon svg, .ctx-chip svg, .ctx-select svg {
  width: 16px; height: 16px;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}
.ctx-icon:hover, .ctx-chip:hover, .ctx-select:hover { background: rgba(255,255,255,0.62); border-color: var(--st-border-lite); }
.ctx-icon.is-on, .ctx-chip.is-on {
  background: rgba(196,153,58,0.2);
  border-color: var(--st-gold);
  color: var(--st-gold);
}
.ctx-icon.danger:hover { background: rgba(216, 96, 79, 0.15); color: var(--st-danger); }

.chip-swatch {
  width: 16px; height: 16px;
  border-radius: 4px;
  background: var(--st-gold);
  box-shadow: inset 0 0 0 1px rgba(10,9,8,0.2);
}
.chip-swatch.ring { background: transparent; box-shadow: inset 0 0 0 3px var(--st-text); border-radius: 50%; }

.ctx-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  color: var(--st-text-dim);
  font: 600 0.78rem var(--st-font);
}
.ctx-inline input[type="color"] { width: 30px; height: 30px; margin: 0; padding: 2px; border-radius: 6px; border: 1px solid var(--st-border-lite); background: transparent; }
.ctx-inline input[type="range"] { width: 110px; margin: 0; }

/* Steppers */
.stepper {
  display: inline-flex;
  align-items: center;
  height: 34px;
  border: 1px solid var(--st-border-lite);
  border-radius: 999px;
  background: rgba(255,255,255,0.28);
  overflow: hidden;
}
.stepper button {
  width: 28px; height: 100%;
  border: 0; background: transparent;
  color: var(--st-text);
  font-size: 1rem;
  cursor: pointer;
}
.stepper button:hover { background: rgba(255,255,255,0.62); }
.stepper input {
  width: 46px; height: 100%;
  margin: 0; padding: 0;
  border: 0;
  background: transparent;
  color: var(--st-text);
  font: 600 0.85rem var(--st-font);
  text-align: center;
  -moz-appearance: textfield;
  appearance: textfield;
}
.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.stepper input:focus { outline: none; }

/* Popovers */
.ctx-pop-wrap, .font-picker-wrap { position: relative; }
.ctx-pop {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 70;
  min-width: 230px;
  padding: 0.8rem;
  border: 1px solid var(--st-border-lite);
  border-radius: var(--st-radius-lg);
  background: var(--st-glass-strong);
  box-shadow: var(--st-shadow-pop);
  backdrop-filter: blur(26px) saturate(1.35);
  -webkit-backdrop-filter: blur(26px) saturate(1.35);
}
.ctx-pop label {
  display: block;
  margin: 0 0 0.55rem;
  color: var(--st-text-dim);
  font: 600 0.75rem var(--st-font);
}
.ctx-pop label output { float: right; color: var(--st-text); }
.ctx-pop input[type="range"] { width: 100%; margin: 0.3rem 0 0; }
.ctx-pop select {
  width: 100%;
  margin: 0.25rem 0 0;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--st-border-lite);
  border-radius: 6px;
  background: var(--st-bg-raise);
  color: var(--st-text);
  font: inherit;
}
.check-row { display: flex; align-items: center; gap: 0.5rem; }
.check-row input { width: auto; margin: 0; }
.pop-title {
  margin: 0.6rem 0 0.4rem;
  color: var(--st-text-faint);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.pop-title:first-child { margin-top: 0; }
.custom-color {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}
.custom-color input[type="color"] {
  width: 40px; height: 28px;
  margin: 0; padding: 2px;
  border: 1px solid var(--st-border-lite);
  border-radius: 6px;
  background: transparent;
}
.custom-color.block { margin-top: 0.8rem; }

.swatch-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}
.swatch-grid button {
  aspect-ratio: 1;
  border: 1px solid rgba(10,9,8,0.15);
  border-radius: 6px;
  background: var(--swatch, #fff);
  cursor: pointer;
  padding: 0;
}
.swatch-grid button:hover { transform: scale(1.12); border-color: var(--st-gold); }
.swatch-grid.big { grid-template-columns: repeat(6, 1fr); }
.swatch-grid.big button { border-radius: 8px; }

.pos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}
.pos-grid button {
  padding: 0.45rem 0.3rem;
  border: 1px solid var(--st-border-lite);
  border-radius: 6px;
  background: transparent;
  color: var(--st-text);
  font: 600 0.75rem var(--st-font);
  cursor: pointer;
}
.pos-grid button:hover { border-color: var(--st-gold); color: var(--st-gold); }
.pop-position { min-width: 260px; }

/* Font picker */
.font-current { border: 1px solid var(--st-border-lite); min-width: 150px; justify-content: space-between; }
.font-picker {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 80;
  width: 280px;
  max-height: 420px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--st-border-lite);
  border-radius: var(--st-radius-lg);
  background: var(--st-glass-strong);
  box-shadow: var(--st-shadow-pop);
  backdrop-filter: blur(26px) saturate(1.35);
  -webkit-backdrop-filter: blur(26px) saturate(1.35);
  overflow: hidden;
}
.font-picker input[type="search"] {
  margin: 0.6rem;
  padding: 0.5rem 0.7rem;
  width: calc(100% - 1.2rem);
  border: 1px solid var(--st-border-lite);
  border-radius: var(--st-radius);
  background: var(--st-bg-raise);
  color: var(--st-text);
  font: inherit;
}
.font-cats {
  display: flex;
  gap: 4px;
  padding: 0 0.6rem 0.55rem;
  flex-wrap: wrap;
}
.font-cats button {
  padding: 0.22rem 0.55rem;
  border: 1px solid var(--st-border-lite);
  border-radius: 999px;
  background: transparent;
  color: var(--st-text-dim);
  font: 600 0.7rem var(--st-font);
  cursor: pointer;
}
.font-cats button.is-active { background: var(--st-gold); border-color: var(--st-gold); color: #14120e; }
.font-list { overflow-y: auto; padding: 0 0.4rem 0.5rem; }
.font-list button {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 0;
  border-radius: var(--st-radius);
  background: transparent;
  color: var(--st-text);
  font-size: 1.05rem;
  text-align: left;
  cursor: pointer;
}
.font-list button small { color: var(--st-text-faint); font-family: var(--st-font); font-size: 0.65rem; }
.font-list button:hover { background: var(--st-gold-soft); }
.font-list button.is-active { color: var(--st-gold); }

/* Filters */
.pop-filters { min-width: 260px; }
.filter-presets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  margin-bottom: 0.7rem;
}
.filter-presets button {
  padding: 0.45rem 0.3rem;
  border: 1px solid var(--st-border-lite);
  border-radius: 6px;
  background: transparent;
  color: var(--st-text);
  font: 600 0.72rem var(--st-font);
  cursor: pointer;
}
.filter-presets button:hover, .filter-presets button.is-active { border-color: var(--st-gold); color: var(--st-gold); }

/* =========================== WORKSPACE =========================== */
.studio-main {
  display: grid;
  grid-template-columns: 72px auto minmax(0, 1fr) 264px;
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.38);
  border-radius: 28px;
  box-shadow: 0 28px 80px rgba(10,9,8,0.16);
}

/* Left rail */
.rail {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0.65rem 0.45rem;
  background: rgba(252,250,245,0.48);
  border-right: 1px solid rgba(255,255,255,0.42);
  backdrop-filter: blur(22px) saturate(1.2);
  -webkit-backdrop-filter: blur(22px) saturate(1.2);
  overflow-y: auto;
}
.rail button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0.6rem 0.2rem;
  border: 0;
  min-height: 56px;
  border-radius: 18px;
  background: transparent;
  color: var(--st-text-dim);
  font: 600 0.64rem var(--st-font);
  letter-spacing: 0.02em;
  cursor: pointer;
}
.rail button svg {
  width: 20px; height: 20px;
  fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.rail button:hover { color: var(--st-text); background: rgba(255,255,255,0.62); }
.rail button.is-active { color: var(--st-gold); background: rgba(196,153,58,0.18); box-shadow: inset 0 1px 0 rgba(255,255,255,0.52); }

/* Flyout */
.flyout {
  position: relative;
  width: 316px;
  background: rgba(252,250,245,0.62);
  border-right: 1px solid rgba(255,255,255,0.42);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  overflow-y: auto;
  overscroll-behavior: contain;
  transition: width 160ms ease, padding 160ms ease;
}
.flyout.is-collapsed { width: 0; border-right: 0; overflow: hidden; }
.panel { padding: 1rem 0.9rem 4rem; }
.panel h2 {
  margin: 0 0 0.3rem;
  font-family: var(--st-font-display);
  font-style: italic;
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--st-text);
}
.panel h3 {
  margin: 1.1rem 0 0.5rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--st-text-faint);
}
.panel-sub, .panel-note { margin: 0 0 0.8rem; font-size: 0.76rem; color: var(--st-text-dim); line-height: 1.45; }
.panel-note { margin-top: 0.8rem; }
.panel-search {
  width: 100%;
  margin: 0 0 0.4rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--st-border-lite);
  border-radius: 999px;
  background: rgba(255,255,255,0.5);
  color: var(--st-text);
  font: inherit;
}
.panel-search::placeholder { color: var(--st-text-faint); }
.panel-btn {
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--st-border-lite);
  border-radius: 999px;
  background: rgba(255,255,255,0.32);
  color: var(--st-text);
  font: 600 0.82rem var(--st-font);
  cursor: pointer;
}
.panel-btn:hover { border-color: rgba(196,153,58,0.56); color: var(--st-gold); background: rgba(255,255,255,0.62); }

.flyout-collapse {
  position: sticky;
  bottom: 0.8rem;
  left: 100%;
  margin-right: 0.5rem;
  display: grid;
  place-items: center;
  width: 28px; height: 28px;
  border: 1px solid var(--st-border-lite);
  border-radius: 50%;
  background: var(--st-bg-raise);
  color: var(--st-text-dim);
  cursor: pointer;
}
.flyout-collapse svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.4; }
.flyout-collapse:hover { color: var(--st-gold); border-color: var(--st-gold); }

/* Templates */
.template-list { display: grid; gap: 0.7rem; }
.template-card {
  border: 1px solid var(--st-border-lite);
  border-radius: var(--st-radius-lg);
  background: rgba(255,255,255,0.42);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  padding: 0;
  box-shadow: 0 12px 30px rgba(10,9,8,0.08), inset 0 1px 0 rgba(255,255,255,0.48);
  transition: transform 130ms ease, border-color 130ms ease, box-shadow 130ms ease;
}
.template-card:hover { transform: translateY(-2px); border-color: var(--st-gold); box-shadow: 0 18px 42px rgba(10,9,8,0.12); }
.template-card.is-selected { border-color: var(--st-gold); box-shadow: 0 0 0 3px color-mix(in srgb, var(--st-gold) 16%, transparent); }
.template-preview {
  height: 92px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
}
.template-preview i {
  width: 22px; height: 22px;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.template-preview.remote-template {
  background:
    linear-gradient(135deg, rgba(255,255,255,0.72), rgba(196,153,58,0.16)),
    linear-gradient(90deg, rgba(10,9,8,0.06) 1px, transparent 1px),
    linear-gradient(180deg, rgba(10,9,8,0.06) 1px, transparent 1px);
  background-size: cover, 18px 18px, 18px 18px;
  background-position: center;
}
.template-preview.remote-template strong {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 1px solid rgba(255,255,255,0.66);
  border-radius: 18px;
  background: rgba(255,255,255,0.58);
  color: var(--st-text-dim);
  letter-spacing: 0.08em;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.72);
}
.template-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.7rem;
  border-top: 1px solid var(--st-border);
}
.template-meta strong { font-size: 0.82rem; color: var(--st-text); font-weight: 600; }
.template-meta span { font-size: 0.66rem; color: var(--st-text-faint); text-transform: uppercase; letter-spacing: 0.08em; }

/* Elements */
.line-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.line-grid button, .shape-grid button, .icon-grid button {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  padding: 15%;
  border: 1px solid transparent;
  border-radius: 18px;
  background: rgba(255,255,255,0.42);
  color: #4A443A;
  cursor: pointer;
  transition: transform 110ms ease;
}
.line-grid button:hover, .shape-grid button:hover, .icon-grid button:hover {
  transform: scale(1.08);
  border-color: var(--st-gold);
  color: var(--st-gold);
}
.line-grid svg { width: 100%; height: 100%; }
.shape-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.shape-grid button svg { width: 100%; height: 100%; }
.icon-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.icon-grid button { padding: 22%; }
.icon-grid button svg { width: 100%; height: 100%; }
.smart-row { display: grid; gap: 0.5rem; }
.qr-field { margin: 0; color: var(--st-text-dim); font: 600 0.75rem var(--st-font); }
.qr-field input {
  width: 100%;
  margin: 0.3rem 0 0;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--st-border-lite);
  border-radius: 14px;
  background: rgba(255,255,255,0.5);
  color: var(--st-text);
  font: 400 0.82rem var(--st-font);
}

/* Text panel */
.text-quick { display: grid; gap: 0.5rem; }
.text-quick button {
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--st-border-lite);
  border-radius: 18px;
  background: rgba(255,255,255,0.42);
  color: var(--st-text);
  text-align: left;
  cursor: pointer;
}
.text-quick button:hover { border-color: var(--st-gold); }
.tq-heading { font-size: 1.3rem; font-weight: 700; }
.tq-sub { font-size: 1rem; font-weight: 600; }
.tq-body { font-size: 0.8rem; }
.text-style-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.text-style-list button {
  min-height: 64px;
  display: grid;
  place-items: center;
  padding: 0.5rem;
  border: 1px solid var(--st-border-lite);
  border-radius: 18px;
  background: rgba(255,255,255,0.42);
  color: var(--st-text);
  font-size: 1.05rem;
  line-height: 1.1;
  text-align: center;
  cursor: pointer;
  overflow: hidden;
}
.text-style-list button:hover { border-color: var(--st-gold); transform: translateY(-1px); }

/* Photos & uploads */
.chip-row { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 0.7rem; }
.chip-row button {
  padding: 0.28rem 0.65rem;
  border: 1px solid var(--st-border-lite);
  border-radius: 999px;
  background: rgba(255,255,255,0.28);
  color: var(--st-text-dim);
  font: 600 0.72rem var(--st-font);
  cursor: pointer;
}
.chip-row button.is-active { background: rgba(196,153,58,0.9); border-color: rgba(255,255,255,0.58); color: #14120e; }
.photo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.photo-grid button {
  aspect-ratio: 4 / 3;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 18px;
  overflow: hidden;
  cursor: pointer;
  background: var(--st-bg-raise);
}
.photo-grid button:hover { border-color: var(--st-gold); }
.photo-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }

.upload-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  margin: 0 0 0.9rem;
  padding: 1.4rem 1rem;
  border: 1.5px dashed var(--st-border-lite);
  border-radius: var(--st-radius-lg);
  background: rgba(255,255,255,0.26);
  color: var(--st-text-dim);
  text-align: center;
  cursor: pointer;
  transition: border-color 130ms ease, background 130ms ease;
}
.upload-drop:hover, .upload-drop.is-over { border-color: var(--st-gold); background: var(--st-gold-soft); }
.upload-drop svg { width: 26px; height: 26px; fill: none; stroke: var(--st-gold); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.upload-drop strong { color: var(--st-text); font-size: 0.88rem; }
.upload-drop span { font-size: 0.7rem; }
.upload-drop input { display: none; }
.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.upload-grid .up-item { position: relative; }
.upload-grid .up-item.is-cloud::after {
  content: "Account";
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: 0.16rem 0.36rem;
  border-radius: 999px;
  background: rgba(10,9,8,0.62);
  color: #fff;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  pointer-events: none;
}
.upload-grid .up-item > button {
  width: 100%;
  aspect-ratio: 4 / 3;
  padding: 0;
  border: 1px solid var(--st-border-lite);
  border-radius: var(--st-radius);
  overflow: hidden;
  cursor: pointer;
  background:
    linear-gradient(45deg, rgba(10,9,8,0.05) 25%, transparent 25%, transparent 75%, rgba(10,9,8,0.05) 75%),
    linear-gradient(45deg, rgba(10,9,8,0.05) 25%, transparent 25%, transparent 75%, rgba(10,9,8,0.05) 75%);
  background-size: 14px 14px;
  background-position: 0 0, 7px 7px;
}
.upload-grid .up-item > button:hover { border-color: var(--st-gold); }
.upload-grid img { width: 100%; height: 100%; object-fit: contain; display: block; }
.up-remove {
  position: absolute;
  top: 4px; right: 4px;
  width: 20px; height: 20px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-size: 0.7rem;
  cursor: pointer;
  opacity: 0;
}
.up-item:hover .up-remove { opacity: 1; }

/* ============================= STAGE ============================= */
.stage {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.36), rgba(227,221,207,0.7)),
    var(--st-bg);
}
.page-tabs {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 0.7rem 0;
  overflow: hidden;
}
.page-tab-strip {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  scrollbar-width: thin;
  scroll-behavior: smooth;
  flex: 0 1 auto;
  min-width: 0;
}
.page-tabs .page-step {
  min-width: 32px;
  padding: 0;
  font-size: 1rem;
  flex: none;
}
.page-tabs .page-step:disabled { opacity: 0.35; cursor: default; }
.page-tabs .page-count {
  font: 700 0.72rem var(--st-font);
  color: var(--st-text-dim);
  padding: 0 0.3rem;
  white-space: nowrap;
  flex: none;
}
.page-tabs button {
  min-height: 32px;
  padding: 0 0.8rem;
  border: 1px solid var(--st-border-lite);
  border-radius: 999px;
  background: rgba(255,255,255,0.34);
  color: var(--st-text-dim);
  font: 700 0.78rem var(--st-font);
  cursor: pointer;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.46);
}
.page-tabs button:hover {
  border-color: rgba(196,153,58,0.55);
  color: var(--st-text);
}
.page-tabs button.is-active {
  background: linear-gradient(180deg, rgba(232,199,113,0.98), rgba(196,153,58,0.86));
  border-color: rgba(255,255,255,0.62);
  color: #14120e;
}
.stage-scroll {
  overflow: auto;
  display: flex;
  padding: 44px;
  position: relative;
}
/* Sizer occupies the scaled canvas size in layout, so the scroll area is
   always exactly right; margin:auto centres it when it fits. */
.canvas-sizer {
  flex: 0 0 auto;
  margin: auto;
  position: relative;
}
.canvas-frame {
  /* Absolute + top/left 0: shrink-to-fit the canvas so the scaled frame
     always matches the sizer exactly instead of stretching to fill it. */
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  background: #fff;
  box-shadow:
    0 0 0 1px rgba(10, 9, 8, 0.08),
    0 22px 60px rgba(10, 9, 8, 0.25),
    0 4px 14px rgba(10, 9, 8, 0.14);
}
.stage-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.4rem 0.9rem;
  background: rgba(252,250,245,0.58);
  border-top: 1px solid rgba(255,255,255,0.42);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
}
.stage-status {
  margin: 0;
  font-size: 0.75rem;
  color: var(--st-text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.zoom-controls { display: flex; align-items: center; gap: 0.45rem; flex-shrink: 0; }
.zoom-controls button {
  width: 26px; height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid var(--st-border-lite);
  border-radius: 999px;
  background: rgba(255,255,255,0.34);
  color: var(--st-text);
  font-size: 0.95rem;
  cursor: pointer;
}
.zoom-controls button:hover { border-color: var(--st-gold); }
.zoom-controls button.zoom-fit { width: auto; padding: 0 0.5rem; font: 600 0.72rem var(--st-font); }
.zoom-controls input[type="range"] { width: 120px; margin: 0; accent-color: var(--st-gold); }
.zoom-label { min-width: 40px; font-size: 0.75rem; color: var(--st-text-dim); text-align: right; }
.guide-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  color: var(--st-text-dim);
  font: 600 0.72rem var(--st-font);
  cursor: pointer;
}
.guide-toggle input { width: auto; margin: 0; accent-color: var(--st-gold); }

/* ============================= DOCK ============================= */
.dock {
  display: flex;
  flex-direction: column;
  background: rgba(252,250,245,0.62);
  border-left: 1px solid rgba(255,255,255,0.42);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  min-height: 0;
}
.dock-tabs { display: flex; gap: 0.25rem; padding: 0.45rem; border-bottom: 1px solid rgba(255,255,255,0.42); }
.dock-tabs button {
  flex: 1;
  padding: 0.52rem 0.4rem;
  border: 0;
  border-radius: 999px;
  background: rgba(255,255,255,0.22);
  color: var(--st-text-dim);
  font: 600 0.78rem var(--st-font);
  cursor: pointer;
}
.dock-tabs button.is-active { color: #14120e; background: rgba(196,153,58,0.8); }
.dock-body { flex: 1; overflow-y: auto; padding: 0.7rem; }
.dock-hint { margin: 0 0 0.6rem; font-size: 0.7rem; color: var(--st-text-faint); }

.layers-list { display: grid; gap: 4px; }
.layer-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0.42rem 0.5rem;
  border: 1px solid transparent;
  border-radius: 16px;
  background: rgba(255,255,255,0.38);
  color: var(--st-text);
  cursor: grab;
  user-select: none;
}
.layer-item:hover { border-color: var(--st-border-lite); }
.layer-item.is-active { border-color: var(--st-gold); background: var(--st-gold-soft); }
.layer-item.is-dragging { opacity: 0.4; }
.layer-item.is-dropover { border-top: 2px solid var(--st-gold); }
.layer-thumb {
  display: grid;
  place-items: center;
  width: 26px; height: 26px;
  border-radius: 6px;
  background: var(--st-bg);
  color: var(--st-text-dim);
  font-size: 0.6rem;
  overflow: hidden;
}
.layer-thumb svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.layer-name {
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.layer-name input {
  width: 100%;
  margin: 0;
  padding: 0.1rem 0.25rem;
  border: 1px solid var(--st-gold);
  border-radius: 4px;
  background: var(--st-bg);
  color: var(--st-text);
  font: inherit;
}
.layer-btn {
  display: grid;
  place-items: center;
  width: 22px; height: 22px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--st-text-faint);
  cursor: pointer;
}
.layer-btn:hover { color: var(--st-gold); background: var(--st-bg); }
.layer-btn.is-on { color: var(--st-gold); }
.layer-btn svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dock .empty-state { color: var(--st-text-faint); font-size: 0.78rem; text-align: center; padding: 1.4rem 0.5rem; }

.print-size-card {
  padding: 0.7rem 0.8rem;
  margin-bottom: 0.7rem;
  border: 1px solid var(--st-border-lite);
  border-radius: var(--st-radius);
  background: var(--st-bg-raise);
}
.print-size-card span { display: block; font-weight: 700; font-size: 0.85rem; color: var(--st-text); }
.print-size-card small { display: block; margin-top: 0.25rem; color: var(--st-text-faint); font-size: 0.68rem; line-height: 1.5; }
.dock .checklist { display: grid; gap: 0.55rem; margin: 0; padding: 0; list-style: none; }
.dock .checklist li {
  display: grid;
  grid-template-columns: 0.8rem 1fr;
  gap: 0.5rem;
  align-items: start;
  color: var(--st-text-dim);
  font-size: 0.78rem;
  line-height: 1.4;
}
.dock .checklist li span {
  width: 0.55rem; height: 0.55rem;
  margin-top: 0.28rem;
  border-radius: 999px;
  background: var(--st-border-lite);
}
.dock .checklist .is-ok span { background: var(--st-ok); }
.dock .checklist .is-warn span { background: var(--st-gold); box-shadow: 0 0 8px rgba(196,153,58,0.7); }

/* ======================== CONTEXT MENU ======================== */
.canvas-menu {
  position: fixed;
  z-index: 120;
  min-width: 200px;
  padding: 0.3rem;
  border: 1px solid var(--st-border-lite);
  border-radius: var(--st-radius-lg);
  background: var(--st-glass-strong);
  box-shadow: var(--st-shadow-pop);
  backdrop-filter: blur(24px) saturate(1.3);
  -webkit-backdrop-filter: blur(24px) saturate(1.3);
}
.canvas-menu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
  width: 100%;
  padding: 0.45rem 0.65rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--st-text);
  font: 500 0.82rem var(--st-font);
  cursor: pointer;
}
.canvas-menu button:hover { background: var(--st-gold-soft); }
.canvas-menu button.danger:hover { background: rgba(216,96,79,0.15); color: var(--st-danger); }
.canvas-menu kbd {
  color: var(--st-text-faint);
  font: 500 0.68rem var(--st-font);
}
.canvas-menu hr { margin: 0.3rem 0.4rem; border: 0; border-top: 1px solid var(--st-border); }

/* ========================= SCROLLBARS ========================= */
.studio ::-webkit-scrollbar { width: 10px; height: 10px; }
.studio ::-webkit-scrollbar-track { background: transparent; }
.studio ::-webkit-scrollbar-thumb {
  background: var(--st-border-lite);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: content-box;
}
.studio ::-webkit-scrollbar-thumb:hover { background-color: var(--st-text-faint); }

/* ========================= RESPONSIVE ========================= */
@media (max-width: 1100px) {
  .studio-main { grid-template-columns: 64px auto minmax(0, 1fr); }
  .dock { display: none; }
  .tb-note { display: none; }
}
@media (max-width: 800px) {
  .studio-body { overflow: auto; }
  .studio { height: auto; grid-template-rows: auto auto auto; padding: 8px; gap: 8px; }
  .studio-topbar,
  .context-bar { border-radius: 24px; }
  .studio-topbar { min-height: 58px; flex-wrap: wrap; padding: 0.5rem; }
  .topbar-left, .topbar-right { width: 100%; justify-content: space-between; }
  .topbar-right { gap: 0.35rem; }
  .tb-btn { flex: 1; padding-inline: 0.6rem; }
  .studio-main {
    display: flex;
    flex-direction: column;
    border-radius: 24px;
  }
  .rail { flex-direction: row; order: 3; border-right: 0; border-top: 1px solid rgba(255,255,255,0.42); overflow-x: auto; }
  .rail button { flex: 1 0 72px; }
  .flyout { width: 100%; order: 4; max-height: 44vh; }
  .flyout.is-collapsed { width: 100%; height: 0; }
  .stage { order: 1; min-height: 58vh; }
  .stage-scroll { padding: 18px; }
  .topbar-doc { display: none; }
  .topbar-center { display: none; }
}

/* ===================== PRO CONTROLS (x100 pack) ===================== */
.pop-effects { min-width: 250px; }
.effects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.effects-grid button {
  min-height: 52px;
  display: grid;
  place-items: center;
  padding: 0.3rem;
  border: 1px solid var(--st-border-lite);
  border-radius: var(--st-radius);
  background: rgba(255,255,255,0.4);
  color: var(--st-text);
  font: 700 0.9rem var(--st-font);
  cursor: pointer;
}
.effects-grid button:hover { border-color: var(--st-gold); }
.effects-grid button.is-active { border-color: var(--st-gold); background: var(--st-gold-soft); }
.effects-grid button small { display: block; font: 600 0.58rem var(--st-font); color: var(--st-text-faint); letter-spacing: 0.06em; text-transform: uppercase; }
.pop-note { margin: 0.4rem 0 0; font-size: 0.7rem; color: var(--st-text-faint); line-height: 1.4; }

.fill-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.6rem;
}
.fill-tools .panel-btn { padding: 0.35rem 0.6rem; font-size: 0.72rem; }
.gradient-builder {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 0.45rem;
}
.gradient-builder input[type="color"] {
  width: 34px; height: 28px;
  margin: 0; padding: 2px;
  border: 1px solid var(--st-border-lite);
  border-radius: 6px;
  background: transparent;
}
.gradient-builder input[type="range"] { width: 100%; margin: 0; }
.gradient-builder .panel-btn { padding: 0.35rem 0.6rem; font-size: 0.72rem; }

.pos-grid.two { grid-template-columns: 1fr 1fr; margin-top: 5px; }
.exact-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}
.exact-grid label {
  margin: 0;
  color: var(--st-text-faint);
  font: 700 0.62rem var(--st-font);
  text-transform: uppercase;
}
.exact-grid input {
  width: 100%;
  margin: 2px 0 0;
  padding: 0.3rem 0.3rem;
  border: 1px solid var(--st-border-lite);
  border-radius: 6px;
  background: rgba(255,255,255,0.5);
  color: var(--st-text);
  font: 600 0.78rem var(--st-font);
  -moz-appearance: textfield;
  appearance: textfield;
}
.exact-grid input::-webkit-outer-spin-button,
.exact-grid input::-webkit-inner-spin-button { -webkit-appearance: none; }

.ctx-icon.painter-armed {
  background: var(--st-gold);
  color: #14120e;
  border-color: var(--st-gold);
  animation: painterPulse 1.2s ease-in-out infinite;
}
@keyframes painterPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(196,153,58,0.5); }
  50% { box-shadow: 0 0 0 6px rgba(196,153,58,0); }
}

/* Photo frame buttons: dashed look to signal they're frames */
.shape-grid .frame-btn svg { opacity: 0.5; }
.shape-grid .frame-btn { border: 1.5px dashed var(--st-border-lite); }
.shape-grid .frame-btn:hover { border-color: var(--st-gold); }

/* ===================== MOBILE LANDSCAPE GUARD ===================== */
.rotate-device-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  place-items: center;
  padding: 1.2rem;
  background:
    linear-gradient(135deg, rgba(240,228,208,0.88), rgba(191,234,216,0.72)),
    repeating-linear-gradient(90deg, rgba(7,94,74,0.06) 0 1px, transparent 1px 34px),
    repeating-linear-gradient(180deg, rgba(7,94,74,0.04) 0 1px, transparent 1px 34px);
  color: var(--color-emerald, #075E4A);
}

.rotate-device-card {
  width: min(420px, 100%);
  padding: 1.35rem;
  border: 1px solid rgba(255,255,255,0.64);
  border-radius: 28px;
  background: rgba(252,250,245,0.72);
  box-shadow: 0 28px 80px rgba(7,94,74,0.18), inset 0 1px 0 rgba(255,255,255,0.62);
  text-align: center;
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
}

.rotate-device-icon {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin: 0 auto 0.85rem;
  border: 1px solid color-mix(in srgb, var(--color-mint, #BFEAD8) 70%, transparent);
  border-radius: 24px;
  background: color-mix(in srgb, var(--color-mint, #BFEAD8) 38%, transparent);
  color: var(--color-emerald, #075E4A);
}

.rotate-device-icon svg {
  width: 42px;
  height: 42px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rotate-device-card .eyebrow {
  margin-bottom: 0.45rem;
  color: var(--color-emerald, #075E4A);
}

.rotate-device-card h1 {
  margin-bottom: 0.55rem;
  color: var(--color-emerald, #075E4A);
  font-family: var(--st-font-display);
  font-size: clamp(2rem, 11vw, 3.3rem);
  font-style: italic;
}

.rotate-device-card p:not(.eyebrow) {
  margin: 0 auto 1rem;
  max-width: 320px;
  color: color-mix(in srgb, var(--color-emerald, #075E4A) 72%, var(--color-beige, #F0E4D0));
}

@media (max-width: 820px) and (orientation: portrait) {
  .studio-body {
    overflow: hidden;
  }

  .studio {
    height: 100vh;
    height: 100svh;
    filter: blur(9px);
    pointer-events: none;
    user-select: none;
  }

  .rotate-device-overlay {
    display: grid;
  }
}

@media (max-width: 900px) and (orientation: landscape), (max-height: 560px) and (orientation: landscape) {
  .studio-body {
    overflow: hidden;
  }

  .studio {
    height: 100vh;
    height: 100svh;
    grid-template-rows: 52px 44px minmax(0, 1fr);
    padding: 6px;
    gap: 6px;
  }

  .studio-topbar,
  .context-bar {
    border-radius: 22px;
  }

  .studio-topbar {
    flex-wrap: nowrap;
    gap: 0.45rem;
    padding: 0 0.45rem;
  }

  .topbar-left,
  .topbar-right {
    width: auto;
    min-width: 0;
    justify-content: flex-start;
  }

  .topbar-left {
    flex: 1 1 auto;
  }

  .topbar-right {
    flex: 0 0 auto;
    gap: 0.32rem;
  }

  .topbar-center,
  .topbar-doc,
  .tb-note,
  .tb-btn.ghost {
    display: none;
  }

  .studio-brand {
    max-width: 138px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .tb-price {
    font-size: 0.8rem;
  }

  .tb-btn {
    padding: 0.38rem 0.64rem;
    font-size: 0.74rem;
  }

  .ctx-icon,
  .ctx-chip,
  .ctx-select {
    height: 30px;
    font-size: 0.74rem;
  }

  .ctx-icon {
    width: 30px;
  }

  .studio-main {
    display: grid;
    grid-template-columns: 56px minmax(220px, 35vw) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    border-radius: 22px;
  }

  .rail {
    order: initial;
    flex-direction: column;
    padding: 0.4rem 0.32rem;
    border-top: 0;
    border-right: 1px solid rgba(255,255,255,0.42);
    overflow-y: auto;
    overflow-x: hidden;
  }

  .rail button {
    flex: initial;
    min-height: 46px;
    border-radius: 14px;
    font-size: 0.55rem;
  }

  .rail button svg {
    width: 18px;
    height: 18px;
  }

  .flyout {
    order: initial;
    width: auto;
    max-height: none;
  }

  .flyout.is-collapsed {
    width: 0;
    height: auto;
  }

  .panel {
    padding: 0.72rem 0.65rem 3rem;
  }

  .panel h2 {
    font-size: 1rem;
  }

  .stage {
    order: initial;
    min-height: 0;
  }

  .stage-scroll {
    padding: 14px;
  }

  .stage-bottom {
    padding: 0.28rem 0.55rem;
  }

  .stage-status {
    max-width: 38vw;
    font-size: 0.68rem;
  }

  .guide-toggle {
    display: none;
  }

  .zoom-controls {
    gap: 0.3rem;
  }

  .zoom-controls input[type="range"] {
    width: 82px;
  }
}
