:root {
  --bg: #13100e;
  --panel: #1b1714;
  --card: #211c18;
  --raised: #25201b;
  --line: #342c25;
  --text: #ebe2d3;
  --label: #cdbfac;
  --muted: #9c907f;
  --accent: #cda65c;
  --accent-ink: #1a1408;
  --accent-soft: rgba(205, 166, 92, 0.16);
  --overlay: rgba(20, 16, 13, 0.72);
  --stage: #0f0c0a;
  --switch-off: #3c332b;
  --knob: #b5a998;
  --warn: #e0a54a;
  --warn-text: #ecc98e;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  /* the name, Wand Atelier: a Renaissance chancery hand, cursive and old */
  --script: "Tangerine", "Apple Chancery", "Palatino Linotype", Palatino, cursive;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Tangerine by Toshi Omagari, SIL Open Font License 1.1 (fonts/Tangerine-OFL.txt);
   only its Latin letters, 16 KB */
@font-face {
  font-family: "Tangerine";
  src: url("/shared/fonts/tangerine-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.4 var(--sans);
}

body { display: flex; flex-direction: column; }

button, select, input { font: inherit; color: inherit; }

button {
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--raised);
  cursor: pointer;
  white-space: nowrap;
}

button:hover:not(:disabled) { border-color: var(--muted); }
button:disabled { cursor: default; }
button:focus-visible, select:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

button.primary:hover { filter: brightness(1.08); }
button.primary:disabled { opacity: 0.6; cursor: progress; }
button.ghost { background: transparent; }
button.on { border-color: var(--accent); color: var(--accent); }

select option { background: var(--panel); color: var(--text); }

/* Shared layout for every maker. An app re-themes it by overriding the
   variables in :root from its own theme.css. */

/* ---- top bar ---- */

.bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.brand { display: flex; align-items: center; gap: 10px; flex: none; }

.mark {
  width: 28px;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent) 0 34%, #7d6337 34% 100%);
  transform: rotate(-24deg);
}

h1 { margin: 0; font: 600 20px/1 var(--serif); letter-spacing: 0.02em; }
.brand h1 { font: 700 33px/0.8 var(--script); letter-spacing: 0.01em; padding-top: 3px; }

.presets {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}

/* the preset chips flow inline with "Surprise me" and "Reset" */
.chips { display: contents; }
.divider { flex: none; width: 1px; height: 18px; margin: 0 4px; background: var(--line); }

.chip {
  flex: none;
  height: 26px;
  padding: 0 10px;
  border-radius: 13px;
  font-size: 12px;
}

.chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

.actions { display: flex; align-items: center; gap: 8px; flex: none; }

.name, .actions select {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
}

.name { width: 150px; font-family: var(--serif); font-size: 14px; }
.name::placeholder { color: var(--muted); font-style: italic; }

/* ---- layout ---- */

main { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 240px;
  overflow: hidden;
  background: var(--stage);
}

#scene, #view {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

#scene { pointer-events: none; }
#view { touch-action: none; cursor: grab; }
#view:active { cursor: grabbing; }

.overlay {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.overlay > * { pointer-events: auto; }
.top-left { top: 12px; left: 12px; }
.top-right { top: 12px; right: 12px; }

.bottom {
  left: 12px;
  right: 12px;
  bottom: 10px;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.overlay button, .scene-pick {
  background: var(--overlay);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.toggle-group { display: flex; }
.toggle-group button { border-radius: 0; margin-left: -1px; }
.toggle-group button:first-child { border-radius: 6px 0 0 6px; margin-left: 0; }
.toggle-group button:last-child { border-radius: 0 6px 6px 0; }
.toggle-group button.on { position: relative; }

.scene-pick {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 32px;
  padding: 0 2px 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.scene-pick span { color: var(--muted); font-size: 12px; }

/* the buttons over the view: words on a big screen, small icons on a phone */
.icon-btn svg {
  display: none;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.scene-lock.on { border-color: var(--accent); color: var(--accent); }

.scene-pick select {
  height: 30px;
  padding: 0 6px;
  border: 0;
  background: transparent;
  font-family: var(--serif);
  font-size: 14px;
  cursor: pointer;
}

.stats, .help, .notes {
  padding: 3px 10px;
  border-radius: 6px;
  background: var(--overlay);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.stats { display: flex; flex-wrap: wrap; gap: 2px 16px; font-variant-numeric: tabular-nums; }
.stats:empty { display: none; }
.stats span { color: var(--muted); }
.stats b { margin-left: 5px; font-weight: 500; color: var(--text); }
.help { color: var(--muted); font-size: 11.5px; opacity: 0.85; }
.notes { color: var(--label); font-size: 12px; }
.notes:empty { display: none; }

.warnings { display: flex; flex-direction: column; gap: 4px; max-width: 560px; }

.warnings div {
  padding: 4px 10px;
  border-left: 2px solid var(--warn);
  border-radius: 0 4px 4px 0;
  background: var(--overlay);
  color: var(--warn-text);
  font-size: 12px;
}

.status {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 420px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  text-align: center;
}

/* the "Conjuring your wand…" spell styles itself (conjure.js), so it can never
   show unstyled, even beside an out-of-date copy of this file */

@keyframes conjure-turn { to { transform: rotate(360deg); } }

/* a small badge while a change is being carved into the wand */
.busy {
  position: absolute;
  top: 56px;
  left: 50%;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px 5px 9px;
  border: 1px solid rgba(205, 166, 92, 0.35);
  border-radius: 999px;
  background: var(--overlay);
  color: var(--label);
  font: italic 13px/1.2 var(--serif);
  transform: translateX(-50%);
  pointer-events: none;
  animation: busy-in 0.25s ease;
}
.busy[hidden] { display: none; }
.busy svg { width: 13px; height: 13px; fill: var(--accent); animation: conjure-turn 1.6s linear infinite; }
@keyframes busy-in { from { opacity: 0; transform: translate(-50%, -4px); } }

/* ---- control dock: every category visible at once ---- */

.dock {
  flex: 0 1 auto;
  max-height: 58vh;
  overflow-y: auto;
  border-top: 1px solid var(--line);
  background: var(--panel);
  scrollbar-color: var(--line) transparent;
}

.cards {
  columns: 262px;
  column-gap: 10px;
  padding: 10px 12px 0;
}

.card {
  break-inside: avoid;
  margin: 0 0 10px;
  padding: 5px 10px 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}

.card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 24px;
  margin-bottom: 1px;
}

.card h3 { margin: 0; font: 600 13.5px/1 var(--serif); letter-spacing: 0.01em; }
.card h3 label { cursor: pointer; }
.card.off h3 { color: var(--muted); }
.card.off .row { opacity: 0.42; }
.card.off .row:hover, .card.off .row:focus-within { opacity: 0.85; }

.row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) 50px;
  align-items: center;
  gap: 8px;
  min-height: 22px;
}

.row > label, .row > .lbl {
  overflow: hidden;
  color: var(--label);
  font-size: 11.5px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.row .hinted {
  text-decoration: underline dotted var(--accent);
  text-underline-offset: 3px;
  cursor: help;
}

.row output {
  color: var(--muted);
  font-size: 11px;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.row.na { opacity: 0.3; }
.card.off .row.na { opacity: 0.2; }
.row .seg, .row select, .row .swatch-row { grid-column: 2 / 4; }

.swatch-row { display: flex; flex-wrap: wrap; gap: 3px; padding: 4px 0 4px 2px; }

.swatch {
  flex: none;
  width: 14px;
  height: 14px;
  padding: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
}

.swatch.on { border-color: var(--text); box-shadow: 0 0 0 2px var(--accent); }

input[type="range"] {
  width: 100%;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
  background: transparent;
}
input[type="range"][list] { height: 22px; }  /* room for the notch marks */

.row select {
  height: 22px;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--bg);
  font-size: 11.5px;
}

.seg { display: flex; }

.seg button {
  flex: 1;
  height: 22px;
  margin-left: -1px;
  padding: 0 4px;
  border-radius: 0;
  background: var(--bg);
  font-size: 11.5px;
}

.seg button:first-child { margin-left: 0; border-radius: 5px 0 0 5px; }
.seg button:last-child { border-radius: 0 5px 5px 0; }
.seg button.on { position: relative; z-index: 1; background: var(--accent-soft); }

.text-in {
  min-width: 0;
  height: 25px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--bg);
  font: 600 14px/1 var(--serif);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.text-in::placeholder { color: var(--muted); opacity: 0.7; font-weight: 400; letter-spacing: 0.04em; text-transform: none; font-style: italic; }
.mini { height: 23px; padding: 0 6px; font-size: 11px; }

.switch {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: none;
  width: 28px;
  height: 16px;
  margin: 0;
  border-radius: 8px;
  background: var(--switch-off);
  cursor: pointer;
  transition: background 0.12s;
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--knob);
  transition: transform 0.12s, background 0.12s;
}

.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(12px); background: var(--accent-ink); }

/* ---- steps: the controls split into numbered pages ---- */

.steps {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

/* every step in one row; on a narrow screen it scrolls sideways, and its
   edges fade where more steps are hidden */
.step-list {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 2px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.step-list::-webkit-scrollbar { display: none; }
.step-list.more-right { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); }
.step-list.more-left { -webkit-mask-image: linear-gradient(90deg, transparent, #000 36px);
  mask-image: linear-gradient(90deg, transparent, #000 36px); }
.step-list.more-left.more-right {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 36px, #000 calc(100% - 36px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 36px, #000 calc(100% - 36px), transparent);
}

.step {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px 0 5px;
  border-color: transparent;
  border-radius: 15px;
  background: transparent;
  color: var(--muted);
  font: 600 13px/1 var(--serif);
}
.step:hover:not(.on) { border-color: var(--line); color: var(--label); }

.step .num {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  font: 700 10.5px/1 var(--sans);
}

.step.on { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.step.on .num { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.step.done .num { border-color: var(--accent); color: var(--accent); }

/* a step where a feature is switched on */
.step .dot {
  position: absolute;
  top: 3px;
  left: 20px;
  display: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--panel);
}
.step.lit .dot { display: block; }

.steps .go {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  background: transparent;
}
.steps .go.next { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.steps .go.next.finish { background: var(--accent); color: var(--accent-ink); }
.steps .go:disabled { opacity: 0.35; }

/* Every step stays in sight on a computer or tablet: the tabs get a little
   smaller as the screen narrows, and below 1280 px they take two even rows.
   (On a phone the row scrolls sideways instead; see the end of this file.) */
.step-break { display: none; }
@media (max-width: 1500px) {
  .step { gap: 5px; padding: 0 9px 0 4px; font-size: 12.5px; }
}
@media (min-width: 721px) and (max-width: 1440px) {
  .step { gap: 4px; padding: 0 8px 0 3px; font-size: 12px; }
  .step .num { width: 18px; height: 18px; font-size: 10px; }
  .step .dot { left: 17px; }
  .steps .go.back { width: 32px; padding: 0; justify-content: center; }
  .steps .go.back .go-label { display: none; }
  .step-list.more-left, .step-list.more-right { -webkit-mask-image: none; mask-image: none; }
}
@media (min-width: 721px) and (max-width: 1279px) {
  .step-list { flex-wrap: wrap; row-gap: 3px; }
  .step-break { display: block; flex-basis: 100%; height: 0; }
}

/* a roomy page splits the screen once, the same for every step: the controls
   keep one height, room for the tallest step on most screens (a longer one
   scrolls under the step bar), and the 3D view keeps the rest, so neither
   jumps as you move between steps or choices appear and go */
.roomy .stage { flex: 1 1 auto; min-height: 0; }
.roomy .dock { flex: none; height: clamp(230px, 36vh, 330px); max-height: none; }
/* a short step's cards stretch to the panel's foot, rather than leave a gap */
.roomy .dock, .roomy #controls, .roomy .panes { display: flex; flex-direction: column; }
.roomy #controls, .roomy .panes, .roomy .pane:not(.away) { flex: 1 0 auto; }
.roomy .pane { align-content: stretch; }

.pane.away { display: none; }

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  align-content: start;
  gap: 10px;
  padding-bottom: 10px;
  columns: auto;
}

.cards-grid .card { margin: 0; }
.card.wide { column-span: all; }
.cards-grid .card.wide { grid-column: 1 / -1; }

/* ---- full-width choices: emoji tiles, standard sizes, large swatches ---- */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.row-full { margin: 3px 0 6px; }
.row-full > .lbl { display: block; margin: 2px 0 5px; color: var(--label); font-size: 11.5px; }

.tiles { display: flex; flex-wrap: wrap; gap: 5px; }

.tile {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 27px;
  padding: 0 9px 0 6px;
  border-radius: 14px;
  background: var(--bg);
  font-size: 11.5px;
}

.tile .ico {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: 14px;
  line-height: 1;
}

.tile.on { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }

/* the second ("every other") pick: a dashed outline and a small 2 */
.tile.alt { border-style: dashed; border-color: var(--accent); }

.tile.alt::after {
  content: "2";
  position: absolute;
  top: -6px;
  right: -4px;
  display: grid;
  place-items: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font: 700 9px/1 var(--sans);
}

.picking-alt .tile.on:not(.alt) { opacity: 0.55; }
.picking-alt .tiles { outline: 1px dashed var(--accent-soft); outline-offset: 4px; border-radius: 8px; }

.tile-mode { display: flex; align-items: center; gap: 5px; margin: 0 0 7px; }
.tile-mode button { height: 24px; padding: 0 10px; border-radius: 12px; background: var(--bg); font-size: 11.5px; }
.tile-mode button.on { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }
.tile-mode .mini { height: 22px; }

.rows-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  column-gap: 22px;
  margin-top: 2px;
}

/* shape buttons: a picture of each style above its name */
.tiles.shapes { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; max-width: 680px; }

.tiles.shapes .tile {
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  height: auto;
  min-width: 0;
  padding: 6px 1px 5px;
  border-radius: 9px;
  font-size: 10.5px;
}

.tile svg.shape { width: 34px; height: 15px; fill: var(--muted); fill-rule: evenodd; }
.tile:hover svg.shape { fill: var(--text); }
.tile.on svg.shape { fill: var(--accent); }

/* hieroglyph buttons: the glyph drawn as lines, as it is carved */
.tile svg.glyph {
  width: 13px;
  height: 17px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tile:hover svg.glyph { stroke: var(--text); }
.tile.on svg.glyph { stroke: var(--accent); }

.tiles.tall { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }

.tiles.tall .tile {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 1px 9px;
  height: auto;
  padding: 8px 12px;
  border-radius: 10px;
  text-align: left;
}

.tiles.tall .ico { grid-row: span 2; font-size: 24px; }
.tiles.tall .txt { font: 600 14px/1.2 var(--serif); }
.tiles.tall .note { color: var(--muted); font-size: 11px; }

.quick { display: grid; gap: 5px; margin: 4px 0 6px; }

.quick button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  height: auto;
  padding: 6px 2px;
  border-radius: 9px;
  background: var(--bg);
  font-size: 12.5px;
}

.quick button small { color: var(--muted); font-size: 10.5px; }
.quick button.on { border-color: var(--accent); background: var(--accent-soft); }

.swatch-row.large { gap: 8px 2px; padding: 2px 0; }

.swatch-big {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 54px;
  height: auto;
  padding: 2px 0;
  border: 0;
  background: transparent;
}

.swatch-big .dot {
  width: 28px;
  height: 28px;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
}

.swatch-big .lab { color: var(--muted); font-size: 10.5px; line-height: 1.2; text-align: center; }
.swatch-big.on .dot { border-color: var(--text); box-shadow: 0 0 0 2px var(--accent); }
.swatch-big.on .lab { color: var(--text); }

/* ---- accounts: dialogs, menu, saved designs, toast ---- */

.actions .account { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.actions .account.signed-in { border-color: var(--accent); color: var(--accent); }

dialog.sheet {
  width: min(860px, calc(100vw - 32px));
  max-height: min(680px, calc(100vh - 48px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

dialog.sheet.narrow { width: min(400px, calc(100vw - 32px)); }
dialog.sheet [hidden] { display: none; }
dialog.sheet::backdrop { background: rgba(10, 6, 12, 0.6); backdrop-filter: blur(3px); }
dialog.sheet form, dialog.sheet > .design-grid { padding: 0 20px 20px; }

dialog.sheet header {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 20px 12px;
  background: var(--panel);
}

dialog.sheet h2 { flex: 1; margin: 0; font: 600 20px/1.2 var(--serif); }
dialog.sheet .close { width: 32px; padding: 0; }
dialog.sheet .lead { margin: 0 0 14px; color: var(--muted); }

.auth-tabs { display: flex; margin-bottom: 14px; border-bottom: 1px solid var(--line); }

.auth-tabs button {
  height: 34px;
  margin-bottom: -1px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
}

.auth-tabs button.on { border-bottom-color: var(--accent); color: var(--text); }
.field { display: block; margin-bottom: 12px; color: var(--label); font-size: 12.5px; }
.field .opt { color: var(--muted); font-size: 11.5px; }

.field input {
  display: block;
  width: 100%;
  height: 36px;
  margin-top: 5px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg);
  font-size: 14px;
}

.form-error { min-height: 18px; margin: 0 0 10px; color: var(--warn-text); font-size: 12.5px; }
.form-error.ok { color: var(--label); }
.field input.code-input::placeholder { color: var(--line); }

/* confirming the email address: a big code box, and small links under it */
.field input.code-input {
  height: 48px;
  font: 600 24px/1 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.4em;
  text-align: center;
}
.auth-sheet .lead b { color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
.auth-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; margin: 14px 0 0; }
button.link {
  height: auto;
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 12.5px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
button.link:disabled { color: var(--muted); text-decoration: none; cursor: default; }
button.link[hidden] { display: none; }
button.wide { width: 100%; height: 38px; }

.account-menu {
  position: fixed;
  z-index: 20;
  display: flex;
  flex-direction: column;
  min-width: 190px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.account-menu[hidden] { display: none; }
.account-menu button { justify-content: flex-start; border: 0; background: transparent; text-align: left; }
.account-menu button:hover, .account-menu button:focus-visible { background: var(--accent-soft); }
.account-menu .menu-link {
  display: flex;
  align-items: center;
  height: 32px;
  padding: 0 14px;
  border-radius: 6px;
  color: inherit;
  text-decoration: none;
}
.account-menu .menu-link:hover, .account-menu .menu-link:focus-visible { background: var(--accent-soft); }
a.home-link { color: inherit; text-decoration: none; }

.design-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
  overflow-y: auto;
}

.design-grid .empty { grid-column: 1 / -1; margin: 20px 0 30px; color: var(--muted); text-align: center; }

.design-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
}

/* the Save dialog: the picture that will be kept, the name, and the choices */
.save-pic {
  position: relative;
  aspect-ratio: 16 / 10;
  margin-bottom: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--thumb-bg, #2b2229);
}

.save-pic img { display: block; width: 100%; height: 100%; object-fit: cover; }
.save-pic img:not([src]) { visibility: hidden; }

.save-pic .pic-note {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 12px;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}

.save-pic .pic-note[hidden] { display: none; }
.save-sheet .field input { font-family: var(--serif); font-size: 15px; }
.save-sheet .field input[aria-invalid="true"] { border-color: var(--warn); }
.save-note { margin: -4px 0 6px; color: var(--muted); font-size: 12px; }
.save-actions { display: flex; justify-content: flex-end; gap: 8px; }
.save-actions button { height: 38px; }
.save-actions .primary { min-width: 120px; }

.unsaved-note {
  margin: 0 20px 14px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--warn-text);
  font-size: 12.5px;
}

.unsaved-note[hidden] { display: none; }

.design-card .pic { position: relative; aspect-ratio: 16 / 10; background: var(--thumb-bg, #2b2229); }
.design-card img { display: block; width: 100%; height: 100%; object-fit: cover; }

.design-card .badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 600;
}

.design-card h3 {
  margin: 10px 12px 2px;
  overflow: hidden;
  font: 600 14.5px/1.3 var(--serif);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.design-card .date { margin: 0 12px 10px; color: var(--muted); font-size: 11.5px; }
.card-actions { display: flex; gap: 6px; margin-top: auto; padding: 0 12px 12px; }
.card-actions button { flex: 1; height: 30px; }
.card-actions .confirm { border-color: var(--warn); color: var(--warn-text); }
.card-actions .primary.confirm { background: transparent; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 30;
  max-width: min(520px, calc(100vw - 32px));
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.2s, transform 0.2s;
}

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

@media (max-width: 1360px) {
  .bar { flex-wrap: wrap; row-gap: 8px; }
  .presets { order: 3; flex-basis: 100%; }
  .actions { margin-left: auto; }
}

/* ---- "better on a computer": the note a phone gets once per visit (handheld.js) ---- */

dialog.handheld { text-align: center; }
.handheld-body { padding: 26px 22px 20px; }
.handheld-art {
  display: block;
  width: 138px;
  height: 74px;
  margin: 0 auto 10px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.handheld-art .glow { fill: var(--accent); stroke: none; opacity: 0.9; }
dialog.handheld h2 { margin: 0 0 8px; font: 600 21px/1.2 var(--serif); }
.handheld-body p { margin: 0 0 18px; color: var(--label); font-size: 14px; line-height: 1.5; }
.handheld-body .link { margin-top: 12px; font-size: 13px; }
.handheld-body .handheld-note { min-height: 1.3em; margin: 6px 0 0; color: var(--muted); font-size: 12.5px; }

/* ---- phones (upright, or on their side: see below) ---- */

@media (max-width: 720px), (orientation: landscape) and (max-height: 500px) {
  /* the top bar: the name, the Save / Next / account buttons, and the
     ready-made designs in one row that scrolls sideways */
  .bar { gap: 8px; row-gap: 6px; padding: 6px 10px; }
  .brand { gap: 8px; }
  .brand .mark { width: 22px; }
  h1 { font-size: 17px; }
  .brand h1 { font-size: 29px; }
  .name { display: none; }
  .actions { gap: 6px; }
  .actions button { height: 30px; padding: 0 11px; }
  .actions .account { max-width: 104px; }
  .presets {
    flex-wrap: nowrap;
    margin: 0 -10px;
    padding: 0 10px 2px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 10px, #000 calc(100% - 24px), transparent);
    mask-image: linear-gradient(90deg, transparent, #000 10px, #000 calc(100% - 24px), transparent);
  }
  .presets::-webkit-scrollbar { display: none; }
  .chip { height: 28px; }

  /* the view keeps the top of the screen; the steps fill the rest and scroll */
  body.roomy { height: 100vh; height: 100dvh; }
  .stage, .roomy .stage { flex: none; height: 42vh; height: 42dvh; min-height: 220px; }
  .dock, .roomy .dock { flex: 1 1 0; height: auto; max-height: none; min-height: 0; }

  .top-left { top: 8px; left: 8px; }
  .top-right { top: 8px; right: 8px; gap: 5px; }
  .overlay button, .scene-pick { height: 30px; }
  .toggle-group button { padding: 0 10px; font-size: 12px; }
  .wide-only, .scene-pick span, .icon-btn .txt { display: none; }
  .scene-pick { padding: 0 0 0 2px; }
  .scene-pick select { max-width: 116px; font-size: 13px; }
  .icon-btn { width: 30px; padding: 0; display: inline-grid; place-items: center; }
  .icon-btn svg { display: block; }
  .bottom { left: 8px; right: 8px; bottom: 8px; gap: 4px; }
  .help { font-size: 11px; transition: opacity 0.6s; }
  .help.faded { opacity: 0; pointer-events: none; }
  .busy { top: 46px; }

  /* steps: arrows either side of the scrolling row of steps */
  .steps { gap: 4px; padding: 6px; }
  .steps .go { width: 34px; padding: 0; justify-content: center; font-size: 15px; }
  .steps .go-label { display: none; }
  .step { height: 32px; padding-right: 10px; font-size: 13px; }

  /* the controls: one card per row, and everything big enough for a finger */
  .cards { padding: 8px 8px 0; }
  .cards-grid { gap: 8px; }
  .card { padding: 6px 12px 10px; }
  .card header { height: 32px; }
  .card h3 { font-size: 15px; }
  .row { grid-template-columns: 96px minmax(0, 1fr) 56px; min-height: 36px; }
  .row > label, .row > .lbl, .row-full > .lbl { font-size: 12.5px; }
  .row output { font-size: 12px; }
  input[type="range"], input[type="range"][list] { height: 28px; }
  .row select { height: 32px; font-size: 16px; }
  .seg button { height: 30px; font-size: 12.5px; }
  .tile { height: 32px; font-size: 12.5px; }
  .tiles.shapes { grid-auto-flow: row; grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: none; }
  .tiles.shapes .tile { font-size: 11.5px; }
  .text-in { height: 36px; font-size: 16px; }
  .mini { height: 30px; }
  .switch { width: 38px; height: 22px; border-radius: 11px; }
  .switch::after { width: 18px; height: 18px; }
  .switch:checked::after { transform: translateX(16px); }
  .swatch-big { width: 58px; }

  /* dialogs: nearly the whole screen, and inputs at 16 px, which phones don't zoom into */
  dialog.sheet { width: calc(100vw - 20px); max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); }
  dialog.sheet.narrow { width: min(420px, calc(100vw - 20px)); }
  dialog.sheet form, dialog.sheet > .design-grid { padding: 0 16px 16px; }
  dialog.sheet header { padding: 14px 16px 10px; }
  .field input { height: 42px; font-size: 16px; }
  .design-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .account-menu button, .account-menu .menu-link { height: 40px; }
}

/* ---- a phone on its side: the view on the left, the controls on the right,
   both the full height under a one-row top bar ---- */

@media (orientation: landscape) and (max-height: 500px) {
  .bar { flex-wrap: nowrap; }
  .presets { order: 0; flex: 1 1 0; flex-basis: auto; margin: 0; padding: 0 0 2px; }
  .roomy main { flex-direction: row; }
  .stage, .roomy .stage { flex: 1 1 auto; height: auto; min-height: 0; }
  .dock, .roomy .dock {
    flex: none; width: min(46vw, 440px); height: auto; max-height: none;
    border-top: 0; border-left: 1px solid var(--line);
  }
  .step-list { flex-wrap: nowrap; }
  .step-break { display: none; }
  .help { display: none; }
}

