/* cover-editor.html: the cover editor (cover-editor.js draws the panels, cover-render.js the cover). 27 Nov 2026.
   Gilded Night: glass panels with a thread of gold over the site's night light; the "day desk" is Gilded Dawn.
   Computers (1180px and up): rail, panel, the cover, then Edit on the right. Tablets: the panels slide over the cover
   from the left. Phones (760px and down): the cover on top, the panels as a sheet above a row of tabs at the foot.
   Phone scale as on the rest of the site: buttons 44px, fields 48px with 16px text, labels 12px and up.
   Loaded before site-gilded.css, which stays last. */

.ce-body .grain { display: none; } /* the film grain would sit on top of your cover */
.ce-main { padding-top: 72px; }

.ce-app {
  --ce-text: #f1e8d4; --ce-muted: #c4b69a; --ce-accent: #f0d38c; --ce-accent-2: #c9a24a;
  --ce-glass: linear-gradient(158deg, rgba(255,255,255,.075), rgba(255,255,255,.02) 55%, rgba(255,255,255,.035)), rgba(15,12,18,.74);
  --ce-solid: #15111a; --ce-line: rgba(255,255,255,.1); --ce-gold-line: rgba(240,211,140,.26);
  --ce-field: rgba(255,255,255,.06); --ce-field-line: rgba(255,255,255,.16); --ce-hover: rgba(240,211,140,.1);
  --ce-on: linear-gradient(145deg, #fff0c2, #e1bb62 45%, #9b7428); --ce-on-text: #2a1a06;
  --ce-desk: radial-gradient(120% 90% at 50% 40%, rgba(36,28,40,.55), rgba(8,7,10,.78));
  --ce-dot: rgba(255,255,255,.05);
  --ce-top: 58px;
  position: relative; color: var(--ce-text);
  height: calc(100vh - 72px); height: calc(100dvh - 72px); min-height: 600px;
  display: grid;
  grid-template-columns: 92px 304px minmax(0, 1fr) 328px;
  grid-template-rows: var(--ce-top) minmax(0, 1fr);
  grid-template-areas: "top top top top" "rail panel stage props";
  border-top: 1px solid var(--ce-gold-line);
  font-family: var(--sans);
}
.ce-app[data-desk="day"] {
  --ce-text: #2a2015; --ce-muted: #5f4f37; --ce-accent: #7a2433; --ce-accent-2: #8a6a2a;
  --ce-glass: linear-gradient(158deg, rgba(255,255,255,.78), rgba(255,252,244,.66)), rgba(251,245,230,.82);
  --ce-solid: #fbf5e6; --ce-line: rgba(90,64,30,.16); --ce-gold-line: rgba(138,106,42,.32);
  --ce-field: rgba(255,255,255,.75); --ce-field-line: rgba(90,64,30,.26); --ce-hover: rgba(138,106,42,.1);
  --ce-desk: radial-gradient(120% 90% at 50% 40%, #efe7d6, #ddd2bd);
  --ce-dot: rgba(90,64,30,.09);
}

/* ---------- The bar along the top ---------- */
.ce-top {
  grid-area: top; display: flex; align-items: center; gap: 14px; padding: 0 16px 0 20px; min-width: 0;
  background: var(--ce-glass); border-bottom: 1px solid var(--ce-line);
  -webkit-backdrop-filter: blur(18px) saturate(1.3); backdrop-filter: blur(18px) saturate(1.3);
}
.ce-title { margin: 0; font-family: var(--serif); font-size: 24px; font-weight: 600; line-height: 1; white-space: nowrap; color: var(--ce-text); }
.ce-title em { font-style: italic; color: var(--ce-accent); }
.ce-tools { display: flex; align-items: center; gap: 6px; margin-left: auto; min-width: 0; }
.ce-ico {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; padding: 0;
  border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--ce-text); cursor: pointer;
  transition: background-color .2s, border-color .2s, color .2s;
}
.ce-ico svg { width: 21px; height: 21px; }
.ce-ico:hover:not(:disabled) { background: var(--ce-hover); border-color: var(--ce-line); }
.ce-ico:disabled { opacity: .35; cursor: default; }
.ce-ico[aria-pressed="true"] { color: var(--ce-accent); }
.ce-sun { display: none; }
.ce-app[data-desk="day"] .ce-sun { display: block; }
.ce-app[data-desk="day"] .ce-moon { display: none; }
.ce-seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: var(--ce-field); border: 1px solid var(--ce-line); }
.ce-seg button {
  min-height: 34px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; color: var(--ce-muted);
  font: 500 13.5px/1 var(--sans); letter-spacing: .02em; cursor: pointer; white-space: nowrap;
}
.ce-seg button:hover { color: var(--ce-text); }
.ce-seg button[aria-pressed="true"] { background: var(--ce-on); color: var(--ce-on-text); font-weight: 600; box-shadow: 0 6px 16px -8px rgba(240,190,90,.7); }
.ce-short { display: none; }
.ce-zoom { display: inline-flex; align-items: center; gap: 2px; margin: 0 4px; }
.ce-zoom-val { min-width: 58px; height: 40px; border: 1px solid var(--ce-line); border-radius: 10px; background: var(--ce-field); color: var(--ce-text); font: 500 13px/1 var(--sans); font-variant-numeric: tabular-nums; cursor: pointer; }
.ce-download {
  display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 20px; flex: none;
  border: 1px solid #e3c477; border-radius: 999px; background: var(--gs-gold-btn, linear-gradient(145deg, #fff0c2, #e1bb62 45%, #9b7428));
  color: #2a1a06; font: 600 13.5px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; cursor: pointer;
  box-shadow: 0 1px 0 rgba(255,255,255,.45) inset, 0 10px 24px -10px rgba(240,190,90,.75);
}
.ce-download svg { width: 19px; height: 19px; }
.ce-download:hover { filter: brightness(1.06); }

/* ---------- The rail of panels ---------- */
.ce-rail { grid-area: rail; min-height: 0; background: var(--ce-glass); border-right: 1px solid var(--ce-line); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); }
.ce-rail-in { display: flex; flex-direction: column; gap: 4px; padding: 10px 8px; height: 100%; overflow-y: auto; scrollbar-width: none; }
.ce-tab {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  min-height: 64px; padding: 8px 4px; border: 1px solid transparent; border-radius: 14px; background: transparent;
  color: var(--ce-muted); font: 500 11.5px/1.15 var(--sans); text-align: center; cursor: pointer; flex: none;
  transition: background-color .2s, color .2s, border-color .2s;
}
.ce-tab svg { width: 24px; height: 24px; }
.ce-tab:hover:not(:disabled) { color: var(--ce-text); background: var(--ce-hover); }
.ce-tab[aria-selected="true"] { color: var(--ce-accent); background: var(--ce-hover); border-color: var(--ce-gold-line); }
.ce-tab[aria-selected="true"]::before { content: ""; position: absolute; left: -8px; top: 14px; bottom: 14px; width: 3px; border-radius: 3px; background: var(--ce-on); }
.ce-tab:disabled { opacity: .38; cursor: default; }
.ce-tab-edit { display: none; }

/* ---------- Panels ---------- */
.ce-panel, .ce-props { min-height: 0; overflow-y: auto; overscroll-behavior: contain; background: var(--ce-glass); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); scrollbar-width: thin; scrollbar-color: var(--ce-gold-line) transparent; }
.ce-panel { grid-area: panel; border-right: 1px solid var(--ce-line); }
.ce-props { grid-area: props; border-left: 1px solid var(--ce-line); }
.ce-pane, .ce-props-body { padding: 18px 18px 28px; }
.ce-sheet-bar { display: none; }
.ce-h { margin: 22px 0 8px; font-family: var(--serif); font-size: 21px; font-weight: 600; line-height: 1.15; color: var(--ce-text); }
.ce-pane > .ce-h:first-child, .ce-props-body > .ce-h:first-child { margin-top: 2px; }
.ce-h2 { margin: 18px 0 8px; font: 600 12px/1.2 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--ce-accent-2); }
.ce-note { margin: 0 0 12px; font-size: 13.5px; line-height: 1.5; color: var(--ce-muted); }
.ce-note a, .ce-help a { color: var(--ce-accent); }
.ce-note b { color: var(--ce-text); font-weight: 600; }
.ce-stack { display: grid; gap: 8px; }
.ce-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 8px; }

.ce-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 44px; padding: 8px 14px;
  border: 1px solid var(--ce-field-line); border-radius: 12px; background: var(--ce-field); color: var(--ce-text);
  font: 500 14px/1.2 var(--sans); text-align: center; cursor: pointer; transition: border-color .2s, background-color .2s;
}
.ce-btn svg { width: 19px; height: 19px; flex: none; }
.ce-btn:hover { border-color: var(--ce-accent-2); background: var(--ce-hover); }
.ce-btn-gold { border-color: #e3c477; background: var(--ce-on); color: var(--ce-on-text); font-weight: 600; }
.ce-btn-gold:hover { background: var(--ce-on); filter: brightness(1.06); }
.ce-btn[aria-pressed="true"] { border-color: var(--ce-accent-2); color: var(--ce-accent); background: var(--ce-hover); }
.ce-btn-danger:hover { border-color: #d46a6a; color: #f29c9c; }
.ce-app[data-desk="day"] .ce-btn-danger:hover { color: #9b2b2b; }
.ce-file { overflow: hidden; }
.ce-file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.ce-file:focus-within { outline: 2px solid var(--gold-hi); outline-offset: 2px; }

/* Starting designs, title styles, shapes: picture cards */
.ce-card {
  display: flex; flex-direction: column; gap: 6px; padding: 6px 6px 8px; border: 1px solid var(--ce-line); border-radius: 12px;
  background: var(--ce-field); color: var(--ce-text); font: 500 12.5px/1.25 var(--sans); text-align: center; cursor: pointer;
  transition: border-color .2s, transform .2s var(--ease), box-shadow .2s;
}
.ce-card:hover { border-color: var(--ce-accent-2); transform: translateY(-1px); box-shadow: 0 12px 22px -16px rgba(0,0,0,.8); }
.ce-card canvas { display: block; width: 100%; height: auto; border-radius: 7px; background: #0e0b0d; }
.ce-card[aria-pressed="true"] { border-color: var(--ce-accent); box-shadow: 0 0 0 1px var(--ce-accent) inset; }
.ce-starts canvas { aspect-ratio: 2 / 3; }
.ce-styles canvas { aspect-ratio: 16 / 10; }
.ce-shapes, .ce-textures { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ce-shape { min-height: 76px; justify-content: center; align-items: center; }
.ce-shape svg { width: 38px; height: 38px; color: var(--ce-accent); }
.ce-shape span { font-size: 11.5px; color: var(--ce-muted); }

.ce-add { display: block; width: 100%; min-height: 48px; padding: 10px 14px; border: 1px solid var(--ce-line); border-radius: 12px; background: var(--ce-field); color: var(--ce-text); text-align: left; cursor: pointer; font: 500 15px/1.2 var(--sans); }
.ce-add:hover { border-color: var(--ce-accent-2); background: var(--ce-hover); }
.ce-add-title { font: 600 24px/1.1 var(--serif); }
.ce-add-sub { font: italic 500 18px/1.15 var(--serif); }
.ce-add-author { font: 500 13px/1.2 var(--sans); letter-spacing: .24em; text-transform: uppercase; }

/* Pictures */
.ce-uploads { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ce-up { position: relative; border: 1px solid var(--ce-line); border-radius: 12px; overflow: hidden; background: var(--ce-field); }
.ce-up-add { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: pointer; }
.ce-up img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.ce-up-meta { display: block; padding: 6px 8px 8px; font-size: 12px; line-height: 1.3; color: var(--ce-muted); text-align: left; }
.ce-up-del { position: absolute; top: 4px; right: 4px; width: 36px; height: 36px; border-radius: 50%; background: rgba(14,11,13,.72); color: #f1e8d4; border-color: rgba(255,255,255,.18); }
.ce-up-del svg { width: 17px; height: 17px; }

/* Forms */
.ce-form { display: grid; gap: 12px; }
.ce-field { display: grid; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; }
.ce-field > label, .ce-field > legend, .ce-row > label, .ce-lab {
  padding: 0; font: 600 12px/1.25 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--ce-muted);
}
.ce-field select, .ce-field input[type="number"], .ce-field input[type="text"], .ce-field input[type="search"], .ce-field textarea, .ce-row input[type="number"] {
  width: 100%; min-height: 42px; padding: 8px 12px; border: 1px solid var(--ce-field-line); border-radius: 10px;
  background: var(--ce-field); color: var(--ce-text); font: 400 15px/1.35 var(--sans); color-scheme: dark;
}
.ce-app[data-desk="day"] :is(.ce-field select, .ce-field input, .ce-field textarea, .ce-row input) { color-scheme: light; }
.ce-field select option, .ce-field select optgroup { background: var(--ce-solid); color: var(--ce-text); }
.ce-field textarea { resize: vertical; min-height: 84px; }
.ce-field :is(select, input, textarea):focus, .ce-row input:focus { outline: none; border-color: var(--ce-accent); box-shadow: 0 0 0 3px rgba(240,211,140,.2); }
.ce-hint { font-size: 12.5px; line-height: 1.4; color: var(--ce-muted); }
.ce-seg-wide { display: flex; width: 100%; }
.ce-seg-wide button { flex: 1 1 0; min-height: 38px; padding: 0 8px; }
.ce-seg-icons button { padding: 0 6px; }
.ce-seg-icons svg { width: 20px; height: 20px; vertical-align: middle; }

/* A slider with its number */
.ce-row { display: grid; grid-template-columns: minmax(0, 1fr) 76px; align-items: center; gap: 6px 10px; }
.ce-row > label { grid-column: 1 / -1; }
.ce-row input[type="number"] { min-height: 38px; padding: 6px 8px; text-align: right; font-variant-numeric: tabular-nums; }
.ce-range { width: 100%; height: 32px; margin: 0; background: transparent; accent-color: var(--ce-accent-2); cursor: pointer; }
.ce-colour { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ce-colour input[type="color"] { width: 44px; height: 40px; padding: 3px; border: 1px solid var(--ce-field-line); border-radius: 10px; background: var(--ce-field); cursor: pointer; flex: none; }
.ce-sw { width: 30px; height: 30px; padding: 0; border-radius: 50%; border: 1px solid rgba(255,255,255,.3); box-shadow: 0 0 0 1px rgba(0,0,0,.35); cursor: pointer; flex: none; position: relative; }
.ce-sw::after { content: ""; position: absolute; inset: -7px; } /* a 44px tap area */
.ce-sw[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--ce-solid), 0 0 0 4px var(--ce-accent); }
.ce-foils { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.ce-foil { min-height: 40px; border-radius: 10px; border: 1px solid var(--ce-line); color: #2a1a06; font: 600 11.5px/1.1 var(--sans); cursor: pointer; text-shadow: 0 1px 0 rgba(255,255,255,.35); }
.ce-foil[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--ce-solid), 0 0 0 4px var(--ce-accent); }
.ce-fx { border-top: 1px solid var(--ce-line); padding-top: 10px; display: grid; gap: 10px; }
.ce-fx-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ce-fx-head .ce-lab { margin: 0; }
.ce-switch { position: relative; width: 50px; height: 30px; flex: none; border-radius: 99px; border: 1px solid var(--ce-field-line); background: var(--ce-field); cursor: pointer; padding: 0; }
.ce-switch::after { content: ""; position: absolute; inset: -8px -2px; }
.ce-switch span { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--ce-muted); transition: transform .2s var(--ease), background-color .2s; }
.ce-switch[aria-checked="true"] { background: rgba(201,162,74,.35); border-color: var(--ce-accent-2); }
.ce-switch[aria-checked="true"] span { transform: translateX(20px); background: var(--ce-accent); }
.ce-two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ce-three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ce-three .ce-btn, .ce-two .ce-btn { padding: 6px 8px; font-size: 13px; }
.ce-sel-name { margin: 0 0 4px; font: 600 12px/1.2 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--ce-accent-2); }
.ce-empty { margin: 6px 0 0; padding: 22px 16px; border: 1px dashed var(--ce-field-line); border-radius: 14px; text-align: center; color: var(--ce-muted); font-size: 14px; line-height: 1.5; }
.ce-empty b { display: block; margin-bottom: 6px; font: 600 19px/1.2 var(--serif); color: var(--ce-text); }
.ce-dpi { font-size: 13px; line-height: 1.45; padding: 8px 10px; border-radius: 10px; background: var(--ce-field); color: var(--ce-muted); }
.ce-dpi.is-low { color: #f2b0a0; border: 1px solid rgba(214,106,90,.5); }
.ce-app[data-desk="day"] .ce-dpi.is-low { color: #8f2d1f; }

/* The font picker */
.ce-fontpick { position: relative; }
.ce-fontbtn { width: 100%; justify-content: space-between; min-height: 48px; font-size: 19px; }
.ce-fontbtn small { font: 500 11px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--ce-muted); }
.ce-fontlist { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 6px); max-height: min(380px, 60vh); display: flex; flex-direction: column; border: 1px solid var(--ce-gold-line); border-radius: 14px; background: var(--ce-solid); box-shadow: 0 24px 44px -18px rgba(0,0,0,.85); overflow: hidden; }
.ce-fontlist[hidden] { display: none; }
.ce-fontcats { display: flex; gap: 4px; padding: 8px; border-bottom: 1px solid var(--ce-line); flex: none; }
.ce-fontcats button { flex: 1; min-height: 34px; border: 1px solid var(--ce-line); border-radius: 8px; background: transparent; color: var(--ce-muted); font: 500 12px/1 var(--sans); cursor: pointer; }
.ce-fontcats button[aria-pressed="true"] { color: var(--ce-on-text); background: var(--ce-on); border-color: transparent; }
.ce-fontlist ul { list-style: none; margin: 0; padding: 4px; overflow-y: auto; overscroll-behavior: contain; }
.ce-fontlist li { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 4px 12px; border-radius: 9px; font-size: 21px; line-height: 1.1; cursor: pointer; color: var(--ce-text); }
.ce-fontlist li small { font: 500 10.5px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--ce-muted); flex: none; }
.ce-fontlist li[aria-selected="true"] { background: var(--ce-hover); color: var(--ce-accent); }
.ce-fontlist li.is-active { outline: 1px solid var(--ce-accent-2); }
.ce-fontlist li:hover { background: var(--ce-hover); }

/* Layers */
.ce-layers { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ce-layer { display: grid; grid-template-columns: 34px minmax(0, 1fr) repeat(4, 36px); align-items: center; gap: 2px; min-height: 52px; padding: 4px; border: 1px solid var(--ce-line); border-radius: 12px; background: var(--ce-field); }
.ce-layer.is-sel { border-color: var(--ce-accent-2); background: var(--ce-hover); }
.ce-layer.is-hidden .ce-layer-pick { opacity: .5; }
.ce-layer.is-drag { opacity: .6; }
.ce-layer.drop-before { box-shadow: 0 -3px 0 var(--ce-accent); }
.ce-layer.drop-after { box-shadow: 0 3px 0 var(--ce-accent); }
.ce-grip { width: 34px; height: 44px; display: grid; place-items: center; color: var(--ce-muted); cursor: grab; touch-action: none; border: 0; background: none; padding: 0; }
.ce-grip svg { width: 18px; height: 18px; }
.ce-layer-pick { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: center; gap: 8px; min-height: 44px; padding: 0 4px; border: 0; background: none; color: var(--ce-text); text-align: left; cursor: pointer; min-width: 0; }
.ce-layer-ico { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: rgba(0,0,0,.25); color: var(--ce-accent); font: 700 13px/1 var(--serif); overflow: hidden; }
.ce-app[data-desk="day"] .ce-layer-ico { background: rgba(90,64,30,.1); }
.ce-layer-ico svg { width: 18px; height: 18px; }
.ce-layer-ico img { width: 100%; height: 100%; object-fit: cover; }
.ce-layer-txt { min-width: 0; display: grid; gap: 2px; }
.ce-layer-name { font-size: 14px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ce-layer-where { font-size: 11.5px; color: var(--ce-muted); }
.ce-layer .ce-ico { width: 36px; height: 44px; border-radius: 9px; }
.ce-layer .ce-ico svg { width: 18px; height: 18px; }

.ce-dl { display: grid; margin: 16px 0 6px; }
.ce-dl div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 8px 0; border-top: 1px solid var(--ce-line); }
.ce-dl dt { font-size: 12.5px; color: var(--ce-muted); }
.ce-dl dd { margin: 0; font-size: 13.5px; text-align: right; font-variant-numeric: tabular-nums; }
.ce-checks { display: grid; gap: 4px; margin: 12px 0; }
.ce-check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; line-height: 1.3; cursor: pointer; }
.ce-check input { width: 20px; height: 20px; accent-color: var(--ce-accent-2); flex: none; }

/* ---------- The desk and the cover ---------- */
.ce-stage {
  grid-area: stage; position: relative; display: flex; min-width: 0; min-height: 0; overflow: auto; overscroll-behavior: contain;
  background: var(--ce-desk); background-image: radial-gradient(var(--ce-dot) 1px, transparent 1.2px), var(--ce-desk); background-size: 22px 22px, auto;
  outline-offset: -3px;
}
.ce-paper { position: relative; flex: none; margin: auto; touch-action: none; user-select: none; -webkit-user-select: none; box-shadow: 0 30px 60px -28px rgba(0,0,0,.85), 0 0 0 1px rgba(0,0,0,.25); }
.ce-canvas { display: block; }
.ce-over { position: absolute; inset: 0; pointer-events: none; }
.ce-drop { position: absolute; inset: 12px; z-index: 6; display: grid; place-items: center; border: 2px dashed var(--ce-accent); border-radius: 18px; background: rgba(14,11,13,.6); color: var(--ce-accent); font: 600 18px/1.2 var(--serif); pointer-events: none; }
.ce-drop[hidden] { display: none; }

/* The picked layer: a box with handles (each handle a large invisible target) */
.ce-sel { position: absolute; left: 0; top: 0; pointer-events: none; outline: 1.5px solid #f0d38c; outline-offset: 0; box-shadow: 0 0 0 1px rgba(0,0,0,.45); }
.ce-sel.is-locked { outline-style: dashed; }
.ce-h-dot { position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: #fff8e6; border: 1.5px solid #9b7428; box-shadow: 0 1px 4px rgba(0,0,0,.5); pointer-events: auto; touch-action: none; }
.ce-h-dot::after { content: ""; position: absolute; inset: -10px; }
.ce-h-dot[data-h="n"], .ce-h-dot[data-h="s"] { width: 22px; height: 8px; margin: -4px 0 0 -11px; border-radius: 4px; }
.ce-h-dot[data-h="e"], .ce-h-dot[data-h="w"] { width: 8px; height: 22px; margin: -11px 0 0 -4px; border-radius: 4px; }
.ce-h-dot[data-h="nw"], .ce-h-dot[data-h="se"] { cursor: nwse-resize; }
.ce-h-dot[data-h="ne"], .ce-h-dot[data-h="sw"] { cursor: nesw-resize; }
.ce-h-dot[data-h="n"], .ce-h-dot[data-h="s"] { cursor: ns-resize; }
.ce-h-dot[data-h="e"], .ce-h-dot[data-h="w"] { cursor: ew-resize; }
.ce-h-rot { position: absolute; left: 50%; top: -34px; width: 26px; height: 26px; margin-left: -13px; border-radius: 50%; display: grid; place-items: center; background: #fff8e6; color: #6b4e15; border: 1.5px solid #9b7428; box-shadow: 0 1px 4px rgba(0,0,0,.5); pointer-events: auto; cursor: grab; touch-action: none; }
.ce-h-rot::before { content: ""; position: absolute; left: 50%; top: 100%; width: 1.5px; height: 8px; margin-left: -.75px; background: #f0d38c; }
.ce-h-rot::after { content: ""; position: absolute; inset: -9px; }
.ce-h-rot svg { width: 15px; height: 15px; }
@media (pointer: coarse) {
  .ce-h-dot { width: 16px; height: 16px; margin: -8px 0 0 -8px; }
  .ce-h-dot::after { inset: -14px; }
  .ce-h-rot { width: 30px; height: 30px; margin-left: -15px; top: -42px; }
}
.ce-guide { position: absolute; pointer-events: none; background: #ff5fa2; box-shadow: 0 0 0 .5px rgba(0,0,0,.3); }
.ce-guide.v { top: 0; bottom: 0; width: 1px; }
.ce-guide.h { left: 0; right: 0; height: 1px; }
.ce-tip { position: absolute; padding: 4px 8px; border-radius: 6px; background: rgba(14,11,13,.88); color: #f1e8d4; font: 500 12px/1 var(--sans); font-variant-numeric: tabular-nums; white-space: nowrap; pointer-events: none; transform: translate(-50%, -100%); }

/* The little bar over the picked layer */
.ce-mini { position: absolute; z-index: 4; display: flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--ce-solid); border: 1px solid var(--ce-gold-line); box-shadow: 0 14px 30px -14px rgba(0,0,0,.85); pointer-events: auto; transform: translate(-50%, 0); }
.ce-mini .ce-ico { width: 40px; height: 40px; }
.ce-mini .ce-ico svg { width: 19px; height: 19px; }
.ce-mini .ce-mini-edit { width: auto; padding: 0 12px; gap: 6px; display: none; font: 600 13px/1 var(--sans); color: var(--ce-accent); }

/* Typing straight onto the cover */
.ce-edit { position: absolute; left: 0; top: 0; margin: 0; padding: 0; border: 0; outline: 1.5px dashed #f0d38c; background: rgba(0,0,0,.12); resize: none; overflow: hidden; pointer-events: auto; white-space: pre-wrap; overflow-wrap: break-word; caret-color: #f0d38c; }

/* The note at the foot with "Undo" */
.ce-toast { position: absolute; left: 50%; bottom: 18px; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; transform: translateX(-50%); border-radius: 14px; background: var(--ce-solid); border: 1px solid var(--ce-gold-line); box-shadow: 0 18px 36px -16px rgba(0,0,0,.85); color: var(--ce-text); font-size: 14px; max-width: calc(100% - 32px); }
.ce-toast[hidden] { display: none; }
.ce-toast button { min-height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--ce-gold-line); background: transparent; color: var(--ce-accent); font: 600 13px/1 var(--sans); cursor: pointer; }
.ce-toast button[hidden] { display: none; }

/* ---------- Download window ---------- */
.ce-dialog { width: min(640px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 1px solid rgba(240,211,140,.3); border-radius: 20px; background: #15111a; color: #f1e8d4; box-shadow: 0 40px 80px -30px rgba(0,0,0,.9); }
.ce-dialog::backdrop { background: rgba(6,5,8,.66); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.ce-dialog-in { position: relative; padding: 26px 26px 22px; background: radial-gradient(60% 40% at 100% 0%, rgba(30,120,108,.18), transparent 70%), radial-gradient(60% 40% at 0% 100%, rgba(201,162,74,.12), transparent 70%); }
.ce-dialog-h { margin: 0 44px 14px 0; font-family: var(--serif); font-size: 30px; font-weight: 600; line-height: 1.1; }
.ce-dialog-close { position: absolute; top: 14px; right: 14px; color: #f1e8d4; }
.ce-out { display: grid; gap: 14px; }
.ce-out-group { padding: 14px 16px 16px; border: 1px solid rgba(255,255,255,.1); border-radius: 14px; background: rgba(255,255,255,.04); }
.ce-out-group h3, .ce-checks-h { margin: 0 0 4px; font: 600 12px/1.2 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: #c9a24a; }
.ce-dialog .ce-note { color: #c4b69a; }
.ce-out-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.ce-dialog .ce-btn { --ce-field: rgba(255,255,255,.06); --ce-field-line: rgba(255,255,255,.16); --ce-text: #f1e8d4; --ce-hover: rgba(240,211,140,.1); --ce-accent-2: #c9a24a; --ce-on: linear-gradient(145deg, #fff0c2, #e1bb62 45%, #9b7428); --ce-on-text: #2a1a06; }
.ce-dialog .ce-btn:disabled { opacity: .5; cursor: progress; }
.ce-checks-h { margin-top: 18px; }
.ce-preflight { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.ce-preflight li { position: relative; padding: 8px 10px 8px 34px; border-radius: 10px; background: rgba(255,255,255,.04); font-size: 13.5px; line-height: 1.45; color: #e6dcc6; }
.ce-preflight li::before { content: "✓"; position: absolute; left: 12px; top: 8px; color: #7ee2aa; font-weight: 700; }
.ce-preflight li.warn::before { content: "!"; color: #f6c56a; left: 15px; }
.ce-progress { height: 6px; margin: 16px 0 0; border-radius: 6px; background: rgba(255,255,255,.08); overflow: hidden; }
.ce-progress[hidden] { display: none; }
.ce-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #9b7428, #f0d38c); transition: width .2s; }
.ce-out-status { min-height: 1.4em; margin: 10px 0 0; font-size: 14px; color: #f0d38c; }

/* ---------- Under the editor ---------- */
.ce-help { padding-top: clamp(56px, 7vw, 90px); }
.ce-help-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: clamp(28px, 4vw, 56px); align-items: start; }
.ce-help .prose ul { margin: 14px 0; padding-left: 1.2em; }
.ce-help .prose li + li { margin-top: 8px; }
.ce-keys h3 { margin: 0 0 10px; font-family: var(--serif); font-size: 24px; color: var(--burgundy); }
.ce-keys dl { margin: 0; display: grid; }
.ce-keys dl div { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.3fr); gap: 4px 14px; padding: 8px 0; border-top: 1px solid rgba(90,64,30,.18); }
.ce-keys dt { font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: #6f521c; }
.ce-keys dd { margin: 0; font-size: 14.5px; color: var(--text-dark); }

/* ---------- Tablets: the panels slide over the cover ---------- */
@media (max-width: 1179px) {
  .ce-app { grid-template-columns: 88px minmax(0, 1fr); grid-template-areas: "top top" "rail stage"; }
  .ce-tab-edit { display: flex; }
  .ce-sheet {
    position: absolute; z-index: 12; left: 88px; top: var(--ce-top); bottom: 0; width: min(380px, calc(100% - 88px));
    border-right: 1px solid var(--ce-gold-line); border-left: 0; box-shadow: 24px 0 48px -30px rgba(0,0,0,.9);
    background: var(--ce-solid); display: none;
  }
  .ce-app[data-sheet="edit"] .ce-props, .ce-app[data-sheet]:not([data-sheet=""]):not([data-sheet="edit"]) .ce-panel { display: block; }
  .ce-sheet-bar { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 8px 8px 18px; background: var(--ce-solid); border-bottom: 1px solid var(--ce-line); }
  .ce-sheet-title { font: 600 12px/1.2 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--ce-accent-2); }
  .ce-sheet-close { width: 44px; height: 44px; }
  .ce-mini .ce-mini-edit { display: inline-flex; }
}
@media (max-width: 960px) {
  .ce-zoom { display: none; }
  .ce-help-grid { grid-template-columns: 1fr; }
}

/* ---------- Phones: the cover on top, a sheet, and the tabs along the foot ---------- */
@media (max-width: 760px) {
  .ce-main { padding-top: 60px; }
  .ce-app {
    --ce-top: 56px;
    height: calc(100vh - 60px); height: calc(100dvh - 60px); min-height: 520px;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: var(--ce-top) minmax(0, 1fr) auto auto;
    grid-template-areas: "top" "stage" "sheet" "rail";
  }
  .ce-top { gap: 6px; padding: 0 8px; }
  .ce-title { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } /* the site header names the page; the tools need the room */
  .ce-tools { gap: 2px; margin-left: 0; flex: 1 1 auto; justify-content: space-between; }
  .ce-ico { width: 44px; height: 44px; }
  .ce-seg { padding: 2px; }
  .ce-seg button { min-height: 44px; padding: 0 12px; font-size: 13.5px; }
  .ce-view .ce-long { display: none; }
  .ce-view .ce-short { display: inline; }
  .ce-download { width: 44px; min-height: 44px; padding: 0; justify-content: center; border-radius: 50%; }
  .ce-download .ce-long { display: none; }
  .ce-rail { grid-area: rail; border-right: 0; border-top: 1px solid var(--ce-gold-line); }
  .ce-rail-in { flex-direction: row; gap: 2px; padding: 4px 6px calc(4px + env(safe-area-inset-bottom)); overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; }
  .ce-tab { min-width: 66px; min-height: 58px; padding: 6px 2px; font-size: 11.5px; border-radius: 12px; }
  .ce-tab svg { width: 22px; height: 22px; }
  .ce-tab[aria-selected="true"]::before { left: 16px; right: 16px; top: -5px; bottom: auto; width: auto; height: 3px; }
  .ce-sheet {
    position: relative; grid-area: sheet; left: auto; top: auto; bottom: auto; width: auto; z-index: 3;
    max-height: 46vh; max-height: 46dvh; border: 0; border-top: 1px solid var(--ce-gold-line); border-radius: 18px 18px 0 0;
    box-shadow: 0 -18px 40px -24px rgba(0,0,0,.9);
  }
  .ce-sheet-bar { padding: 6px 6px 6px 16px; border-radius: 18px 18px 0 0; }
  .ce-pane, .ce-props-body { padding: 12px 16px 22px; }
  .ce-h { font-size: 20px; margin-top: 18px; }
  .ce-note { font-size: 13px; }
  .ce-btn { min-height: 44px; font-size: 14px; }
  .ce-field select, .ce-field input[type="number"], .ce-field input[type="text"], .ce-field input[type="search"], .ce-field textarea { min-height: 48px; font-size: 16px; }
  .ce-row { grid-template-columns: minmax(0, 1fr) 84px; }
  .ce-row input[type="number"] { min-height: 44px; font-size: 16px; }
  .ce-range { height: 44px; }
  .ce-seg-wide button { min-height: 44px; }
  .ce-foil, .ce-fontcats button { min-height: 44px; }
  .ce-colour input[type="color"] { height: 44px; }
  .ce-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .ce-styles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ce-shapes, .ce-textures { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ce-shape { min-height: 72px; padding: 6px 2px; }
  .ce-shape svg { width: 30px; height: 30px; }
  .ce-shape span { font-size: 11px; }
  .ce-uploads { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ce-layer { grid-template-columns: 44px minmax(0, 1fr) repeat(4, 44px); gap: 0; }
  .ce-grip { width: 44px; }
  .ce-layer .ce-ico { width: 44px; }
  .ce-mini .ce-ico { width: 44px; height: 44px; }
  .ce-toast { bottom: 10px; font-size: 13.5px; }
  .ce-dialog-in { padding: 20px 16px 18px; }
  .ce-dialog-h { font-size: 24px; }
  .ce-out-btns .ce-btn { flex: 1 1 100%; min-height: 48px; }
  .ce-help-grid { grid-template-columns: 1fr; }
  .ce-keys dl div { grid-template-columns: 1fr; }
}
@media (max-width: 345px) {
  .ce-tools [data-ce-desk] { display: none; } /* very narrow phones: the day desk follows the phone's own setting */
  .ce-seg button { padding: 0 9px; }
}

/* Short windows (a phone held sideways): the sheet stays small */
@media (max-height: 560px) and (max-width: 1179px) {
  .ce-app { min-height: 420px; }
}

@media (prefers-reduced-motion: reduce) {
  .ce-card, .ce-switch span, .ce-tab, .ce-btn, .ce-progress span { transition: none; }
  .ce-card:hover { transform: none; }
}
html.calm .ce-card:hover { transform: none; }

/* ---------- 27 Nov 2026: groups of designs and stickers, the sticker grid, and the font search ---------- */
.ce-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; }
.ce-chips button { min-height: 34px; padding: 0 12px; border: 1px solid var(--ce-line); border-radius: 999px; background: var(--ce-field); color: var(--ce-muted); font: 500 12.5px/1 var(--sans); cursor: pointer; }
.ce-chips button:hover { color: var(--ce-text); border-color: var(--ce-accent-2); }
.ce-chips button[aria-pressed="true"] { background: var(--ce-on); color: var(--ce-on-text); border-color: transparent; font-weight: 600; }
.ce-card[hidden] { display: none; }
.ce-stickers { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ce-stickers .ce-shape img { display: block; width: 52px; height: 52px; margin: 0 auto; }
.ce-stickers .ce-shape canvas { width: 56px; height: 56px; margin: 0 auto; border-radius: 8px; }
.ce-stickers .ce-shape span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ce-fontfind { flex: none; margin: 0 8px 6px; min-height: 38px; padding: 6px 12px; border: 1px solid var(--ce-field-line); border-radius: 10px; background: var(--ce-field); color: var(--ce-text); font: 400 15px/1.3 var(--sans); }
.ce-fontlist li { content-visibility: auto; contain-intrinsic-size: auto 44px; } /* a font's file loads only when its line shows */
@media (max-width: 760px) {
  .ce-chips { flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; margin-left: -16px; margin-right: -16px; padding: 0 16px; }
  .ce-chips::-webkit-scrollbar { display: none; }
  .ce-chips button { flex: none; min-height: 44px; padding: 0 14px; font-size: 13px; }
  .ce-stickers { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ce-fontfind { min-height: 48px; font-size: 16px; }
}

