/* Layout: a photo studio. The figure stands on a turntable against a full-bleed sheet of coloured paper;
   the catalog is a drawer docked beside it (below it on a phone); controls sit on the paper as ink blocks. */
:root {
  --paper: #b7c3ff;       /* the backdrop sheet; the paper picker swaps it */
  --paper-deep: #a0aff8;  /* the same sheet where it falls away from the light */
  --on-paper: #13174a;    /* type set directly on the paper */
  --ink: #171830;         /* text, solid controls, the selected state */
  --ink-soft: #565a7c;    /* secondary text */
  --panel: #f6f6fb;       /* the catalog drawer */
  --well: #e6e7f3;        /* thumbnail wells, inputs, quiet buttons */
  --line: #cfd1e4;        /* hairlines and scrollbars */
  --accent: #3b46e8;      /* primary action and focus; follows the paper */
  --on-accent: #ffffff;
  --scrim: rgba(14, 15, 38, 0.6);
  --press: rgba(0, 0, 0, 0.26); /* the lower lip that makes a button read as a block */

  --font-display: "Pixelify Sans", "Silkscreen", ui-monospace, "Cascadia Mono", monospace;
  --font-ui: "Figtree", ui-sans-serif, system-ui, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #262a66;
    --paper-deep: #15173e;
    --on-paper: #e2e5ff;
    --ink: #ececfa;
    --ink-soft: #a2a6c9;
    --panel: #121326;
    --well: #1d1f3b;
    --line: #2c2f57;
    --accent: #8f9aff;
    --on-accent: #14152a;
    --scrim: rgba(3, 3, 12, 0.7);
    --press: rgba(0, 0, 0, 0.3);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper: #262a66;
  --paper-deep: #15173e;
  --on-paper: #e2e5ff;
  --ink: #ececfa;
  --ink-soft: #a2a6c9;
  --panel: #121326;
  --well: #1d1f3b;
  --line: #2c2f57;
  --accent: #8f9aff;
  --on-accent: #14152a;
  --scrim: rgba(3, 3, 12, 0.7);
  --press: rgba(0, 0, 0, 0.3);
  color-scheme: dark;
}

/* --- base ----------------------------------------------------------------- */

html, body { height: 100%; }
body {
  background: var(--panel);
  color: var(--ink);
  font: 14px/1.4 var(--font-ui);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
*, *::before, *::after { box-sizing: border-box; }
button, input, textarea { font: inherit; color: inherit; }
button { border: 0; padding: 0; background: none; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; opacity: 0.35; }
h2, h3, p, ol { margin: 0; }
.icon { display: block; flex: none; }

/* The pixel notch: a one-step corner, used instead of rounding everywhere. */
.btn, .tool, .chip, .tab, .thumb, .swatch, .well, .well-chip, .rail-item, .build, .look, .toolbtn, .paper,
.dialog, .popover, .picker, .picker-chip, .toast, .tip, .file-frame, .input, .code, .notice {
  --n: 4px;
  clip-path: polygon(
    0 var(--n), var(--n) var(--n), var(--n) 0,
    calc(100% - var(--n)) 0, calc(100% - var(--n)) var(--n), 100% var(--n),
    100% calc(100% - var(--n)), calc(100% - var(--n)) calc(100% - var(--n)), calc(100% - var(--n)) 100%,
    var(--n) 100%, var(--n) calc(100% - var(--n)), 0 calc(100% - var(--n))
  );
}

/* Outlines would be clipped by the notch, so focus is drawn inside the shape. */
:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--panel), inset 0 0 0 4px var(--accent); }
.view:focus-visible { box-shadow: inset 0 0 0 3px var(--accent); }
.plate-name:focus-visible { box-shadow: none; border-bottom-color: var(--on-paper); }

.label {
  font: 600 11px/1.2 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.hint { font-size: 12.5px; line-height: 1.45; color: var(--ink-soft); max-width: 52ch; }

/* --- controls ------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px 2px;
  background: var(--ink);
  color: var(--panel);
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  box-shadow: inset 0 -3px 0 var(--press);
}
.btn:active:not(:disabled) { transform: translateY(1px); box-shadow: inset 0 -1px 0 var(--press); }
.btn.is-accent { background: var(--accent); color: var(--on-accent); }
.btn:focus-visible { box-shadow: inset 0 0 0 2px var(--panel), inset 0 0 0 4px var(--accent); }
.btn.is-accent:focus-visible { box-shadow: inset 0 0 0 2px var(--on-accent), inset 0 0 0 4px var(--accent); }

.tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 40px;
  height: 40px;
  flex: none;
  background: var(--well);
  color: var(--ink);
  font-weight: 700;
  font-size: 13px;
}
.tool.has-text { width: auto; padding: 0 12px 0 8px; }
.tool.is-small { width: 28px; height: 28px; --n: 3px; }
.tool[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.tool:active:not(:disabled) { transform: translateY(1px); }

.chip, .tab {
  --n: 3px;
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 11px;
  background: var(--well);
  color: var(--ink);
  font-weight: 600;
  font-size: 12.5px;
  white-space: nowrap;
}
.chip.is-on, .tab.is-on { background: var(--ink); color: var(--panel); }
.chip.is-quiet { background: none; color: var(--ink-soft); text-decoration: underline; text-underline-offset: 3px; padding: 0 6px; }
.chips, .tabs, .row, .wells, .swatches { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.row { gap: 8px; }

.swatch {
  --n: 3px;
  position: relative;
  width: 28px;
  height: 28px;
  flex: none;
  background: var(--c, var(--well));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 16%, transparent);
}
.swatch.is-on::after {
  content: "";
  position: absolute;
  inset: 9px;
  background: var(--ink);
}
.swatch.is-custom {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #14152a;
  background: conic-gradient(#ff5a5a, #ffd23f, #6ccf3f, #2ec4b6, #4b5dff, #c85aff, #ff5a5a);
}
.swatch:active { transform: scale(0.9); }

.well {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px 0 6px;
  background: var(--well);
  color: var(--ink);
  font-weight: 600;
  font-size: 12.5px;
}
.well.is-on { background: var(--ink); color: var(--panel); }
.well-chip { --n: 2px; width: 24px; height: 24px; flex: none; }

.input, .code {
  width: 100%;
  min-width: 0;
  border: 0;
  background: var(--well);
  color: var(--ink);
  font: 12.5px/1.5 var(--font-mono);
}
.input { height: 40px; padding: 0 12px; flex: 1 1 140px; }
.code { display: block; padding: 10px 12px; resize: none; word-break: break-all; }
.input:focus-visible, .code:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }

.slider-row { display: flex; align-items: center; gap: 12px; }
.slider-value { width: 44px; text-align: right; font: 600 12px var(--font-mono); font-variant-numeric: tabular-nums; }
.slider { flex: 1; min-width: 0; height: 28px; margin: 0; background: none; -webkit-appearance: none; appearance: none; cursor: pointer; }
.slider::-webkit-slider-runnable-track { height: 6px; background: var(--line); }
.slider::-moz-range-track { height: 6px; background: var(--line); }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 22px; margin-top: -8px; background: var(--ink); border: 0; border-radius: 0; }
.slider::-moz-range-thumb { width: 16px; height: 22px; background: var(--ink); border: 0; border-radius: 0; }
.slider:focus-visible { box-shadow: none; }
.slider:focus-visible::-webkit-slider-thumb { background: var(--accent); }
.slider:focus-visible::-moz-range-thumb { background: var(--accent); }

/* --- app frame ------------------------------------------------------------ */

.app {
  position: relative;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(390px, 35vw, 500px);
}

.stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  color: var(--on-paper);
  background: radial-gradient(ellipse 80% 66% at 50% 60%, var(--paper) 0 30%, var(--paper-deep) 100%);
}
.view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.view:active { cursor: grabbing; }

/* Chrome on the paper: solid ink blocks, so they hold up on any backdrop. */
.stage .tool { background: var(--on-paper); color: var(--paper); }
.stage .tool[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.stage .tool:focus-visible { box-shadow: inset 0 0 0 2px var(--paper), inset 0 0 0 4px var(--accent); }
.stage .chip { background: color-mix(in srgb, var(--on-paper) 14%, var(--paper)); color: var(--on-paper); }
.stage .chip.is-on { background: var(--on-paper); color: var(--paper); }
.stage .btn:not(.is-accent) { background: var(--on-paper); color: var(--paper); }

.bar {
  position: absolute;
  inset: 0 0 auto 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px var(--gutter-r) 0 var(--gutter-l);
  pointer-events: none;
}
.bar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; pointer-events: none; }
.brand-name { font: 700 24px/1 var(--font-display); letter-spacing: 0.02em; text-transform: uppercase; }
.brand-tag { font: 600 11px/1 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.7; padding-top: 4px; }
.actions { display: flex; align-items: center; gap: 6px; }
.sep { width: 6px; }

.plate {
  position: absolute;
  left: var(--gutter-l);
  bottom: 74px;
  display: flex;
  align-items: flex-end;
  gap: 14px;
  max-width: min(520px, calc(100% - 32px));
}
.plate-text { min-width: 0; display: grid; gap: 4px; }
.plate-name {
  width: 100%;
  min-width: 0;
  max-width: 340px;
  padding: 0 0 2px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--on-paper);
  font: 700 34px/1.05 var(--font-display);
  text-overflow: ellipsis;
}
.plate-name:hover { border-bottom-color: color-mix(in srgb, var(--on-paper) 35%, transparent); }
.plate-name::placeholder { color: color-mix(in srgb, var(--on-paper) 45%, transparent); }
.plate-meta { font: 600 11px/1.2 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.75; }

.dock {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 0 var(--gutter-r) 18px var(--gutter-l);
  pointer-events: none;
}
.dock > * { pointer-events: auto; }
.poses { display: flex; gap: 6px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.poses::-webkit-scrollbar { display: none; }
.poses .chip { flex: none; height: 36px; padding: 0 13px; }
.views { display: flex; gap: 6px; }

.coach {
  position: absolute;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 32px);
  font: 600 11px/1.3 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  opacity: 0.75;
  pointer-events: none;
}

.tip {
  --n: 3px;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3;
  padding: 5px 9px;
  background: var(--on-paper);
  color: var(--paper);
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
}

.fatal {
  position: absolute;
  inset: 34% 0 auto 0;
  margin: 0 auto;
  width: min(440px, calc(100% - 32px));
  text-align: center;
  font-size: 16px;
  font-weight: 600;
}

/* --- catalog drawer ------------------------------------------------------- */

.panel {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  background: var(--panel);
}
.rail {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 6px;
  overflow: auto;
  background: var(--well);
  scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.rail-item {
  display: grid;
  justify-items: center;
  gap: 5px;
  padding: 10px 0 8px;
  flex: none;
  color: var(--ink-soft);
  font: 600 10.5px/1.1 var(--font-ui);
}
.rail-item:hover { color: var(--ink); }
.rail-item.is-on { background: var(--ink); color: var(--panel); }
.rail[inert] { opacity: 0.4; }

.shelf {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px var(--gutter-r) 28px 18px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.shelf-head, .group-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.group-head { align-items: center; }
.shelf-heading { min-width: 0; display: grid; gap: 6px; }
.shelf-title { font: 700 30px/1 var(--font-display); letter-spacing: 0.01em; text-wrap: balance; }
.shelf-sub { font: 600 11px/1.2 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.notice { --n: 4px; padding: 10px 12px; background: var(--well); font-size: 12.5px; font-weight: 500; }

.colors, .field, .group { display: grid; gap: 10px; }
.group { gap: 12px; }
.colors[hidden] { display: none; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 8px; }
.thumb {
  --n: 5px;
  position: relative;
  display: grid;
  gap: 2px;
  padding: 0 0 8px;
  background: var(--well);
  color: var(--ink);
  text-align: center;
}
.thumb-pic { display: block; width: 100%; height: auto; aspect-ratio: 1; }
.thumb-name { padding: 0 4px; font-weight: 600; font-size: 11.5px; line-height: 1.2; overflow-wrap: anywhere; }
.thumb:hover { background: color-mix(in srgb, var(--well) 70%, var(--line)); }
.thumb.is-on, .build.is-on { background: var(--ink); color: var(--panel); }
.thumb.is-on::after, .build.is-on::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 20px;
  height: 20px;
  background: var(--accent);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 75% 100%, 75% 75%, 50% 75%, 50% 50%, 25% 50%, 25% 25%, 0 25%);
}
.thumb:active, .build:active, .look:active { transform: scale(0.97); }

.builds { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.build { --n: 5px; position: relative; display: grid; justify-items: center; gap: 2px; padding: 0 6px 12px; background: var(--well); color: var(--ink); }
.build-pic { display: block; width: 100%; max-width: 180px; height: auto; aspect-ratio: 1; }
.build-name { font-weight: 700; font-size: 14px; }
.build-note { font-size: 11.5px; opacity: 0.75; }

.toolset { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.toolbtn { display: grid; justify-items: center; gap: 5px; padding: 9px 2px 7px; background: var(--well); color: var(--ink); font-weight: 600; font-size: 11px; }
.toolbtn.is-on { background: var(--ink); color: var(--panel); }

/* --- layer: dialogs, popovers, picker, toast ------------------------------ */

#layer { position: absolute; inset: 0; pointer-events: none; z-index: 20; }
#layer > * { pointer-events: auto; }

.scrim {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: max(12px, env(safe-area-inset-top, 0px)) var(--gutter-r) max(12px, env(safe-area-inset-bottom, 0px)) var(--gutter-l);
  background: var(--scrim);
}
.dialog {
  --n: 8px;
  width: min(560px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  color: var(--ink);
}
.dialog.is-wide { width: min(900px, 100%); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 20px 0; }
.dialog-title { font: 700 30px/1 var(--font-display); }
.dialog-sub { margin-top: 6px; font-size: 13px; color: var(--ink-soft); }
.dialog-body { min-height: 0; overflow-y: auto; padding: 18px 20px 24px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }

.export { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: 28px; align-items: start; }
.export-file, .export-side, .wardrobe { display: grid; gap: 22px; }
.export-file { gap: 12px; }
.file-frame { --n: 6px; background: repeating-conic-gradient(var(--well) 0 25%, var(--panel) 0 50%) 0 0 / 20px 20px; }
.file-pic { display: block; width: 100%; height: auto; aspect-ratio: 1; image-rendering: pixelated; }
.fact { font-size: 13.5px; }
.steps { padding-left: 18px; display: grid; gap: 6px; font-size: 13px; line-height: 1.45; }

.looks { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 8px; }
.look-wrap { position: relative; display: grid; }
.look { --n: 5px; display: grid; gap: 2px; padding: 0 4px 9px; background: var(--well); color: var(--ink); text-align: center; }
.look:hover { background: color-mix(in srgb, var(--well) 70%, var(--line)); }
.look-pic { display: block; width: 100%; height: auto; aspect-ratio: 220 / 300; }
.look-name { font-weight: 600; font-size: 12px; line-height: 1.2; overflow-wrap: anywhere; }
.look-delete { position: absolute; top: 5px; right: 5px; background: var(--panel); }

.popover, .picker { position: fixed; z-index: 30; background: var(--panel); color: var(--ink); --n: 6px; }
.popover { padding: 14px; }
.papers { display: grid; gap: 10px; }
.paper-row { display: flex; flex-wrap: wrap; gap: 6px; max-width: 232px; }
.paper { --n: 4px; position: relative; width: 34px; height: 44px; }
.paper.is-on::after { content: ""; position: absolute; inset: auto 11px 8px 11px; height: 12px; background: var(--ink); }

.picker { width: 264px; padding: 12px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.picker.is-docked { left: var(--gutter-l); right: var(--gutter-r); bottom: max(12px, env(safe-area-inset-bottom, 0px)); width: auto; }
.picker-field {
  position: relative;
  height: 150px;
  background: linear-gradient(to top, #000, rgba(0, 0, 0, 0)), linear-gradient(to right, #fff, var(--h, #f00));
  cursor: crosshair;
  touch-action: none;
}
.picker-dot { position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border: 2px solid #fff; outline: 2px solid #14152a; pointer-events: none; }
.picker-hue {
  position: relative;
  height: 20px;
  background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
  cursor: ew-resize;
  touch-action: none;
}
.picker-knob { position: absolute; top: -3px; bottom: -3px; width: 8px; margin-left: -4px; background: #fff; outline: 2px solid #14152a; pointer-events: none; }
.picker-row { display: flex; align-items: center; gap: 8px; }
.picker-chip { width: 40px; height: 40px; flex: none; }
.picker-hex { flex: 1; min-width: 0; height: 40px; padding: 0 10px; border: 0; background: var(--well); color: var(--ink); font: 600 13px var(--font-mono); }
.picker-hex:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.picker-recent { display: flex; flex-wrap: wrap; gap: 6px; }
.picker-field:focus-visible, .picker-hue:focus-visible { box-shadow: 0 0 0 3px var(--accent); }

.toast {
  position: fixed;
  z-index: 40;
  left: 50%;
  top: calc(env(safe-area-inset-top, 0px) + 70px);
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 11px 16px;
  background: var(--ink);
  color: var(--panel);
  font-weight: 600;
  font-size: 13px;
  text-align: center;
  transform: translate(-50%, -12px);
  opacity: 0;
  transition: transform 0.18s ease, opacity 0.18s ease;
  pointer-events: none;
}
.toast.is-in { transform: translate(-50%, 0); opacity: 1; }

/* --- phone ---------------------------------------------------------------- */

@media (max-width: 899px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(300px, 46%) minmax(0, 1fr); }

  .bar { padding-top: 10px; }
  .brand-name, .brand-tag { display: none; }
  .actions { position: absolute; top: 60px; right: var(--gutter-r); flex-direction: column; }
  .actions .sep { display: none; }
  .tool.has-text { width: 40px; padding: 0; }
  .tool.has-text span { display: none; }
  .bar > .btn { margin-left: auto; }

  .plate { top: 10px; bottom: auto; left: calc(var(--gutter-l) + 34px); right: calc(var(--gutter-r) + 104px); align-items: center; max-width: none; }
  .plate-text { flex: 1; }
  .plate-name { font-size: 22px; max-width: none; height: 40px; }
  .plate-meta { display: none; }

  .dock { padding-bottom: 10px; }
  .views { position: absolute; left: var(--gutter-l); bottom: 58px; flex-direction: column; }
  .coach { display: none; }
  /* One swipeable row each for options and swatches keeps the thumbnails in view. */
  .colors .chips, .colors .swatches, .colors .wells, .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: calc(var(--gutter-r) * -1); padding-right: var(--gutter-r); }
  .colors .chips > *, .colors .swatches > *, .colors .wells > *, .tabs > * { flex: none; }

  .panel { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .rail { flex-direction: row; padding: 6px var(--gutter-r) 6px var(--gutter-l); }
  .rail-item { width: 62px; padding: 8px 0 6px; }
  .shelf { padding: 16px var(--gutter-r) 24px var(--gutter-l); gap: 14px; }
  .shelf-title { font-size: 26px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); }

  .export { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .export-file { justify-items: center; }
  .file-frame { width: min(240px, 100%); }
  .dialog-head { padding: 16px 16px 0; }
  .dialog-body { padding: 14px 16px 20px; }
  .dialog-title { font-size: 26px; }
}

@media (max-height: 560px) and (min-width: 900px) {
  .plate-name { font-size: 26px; }
  .rail-item { padding: 7px 0 5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* The Insta Games registration. This file comes after the editor's own stylesheet
   (mc-skin-maker/src/css/app.css) and does two things: re-tokens the editor's parts into the site's look, and lays
   out the form around them. Everything of the site's own is prefixed tg- so it never collides with the editor's
   class names.

   Look: a state's paperwork for its Games. Graphite ground, cold white ink, one ember accent. Titles and buttons
   are Mona Sans at its widest in capitals, like lettering cut into a building; what the player reads and writes is
   the same face at its ordinary width; small labels are Geist Mono. Corners are nearly square. The seal opens the
   site on the gate and then stands large and faint behind every page that has no figure.

   Sizes are written in --u, which is 1px on a phone and grows with the window to 1.5px on a large desktop, so the
   form fills a big screen instead of sitting small in the middle of it. */

:root[data-theme="dark"] {
  color-scheme: dark;
  --u: clamp(1px, min(100vw / 1000, 100vh / 620), 1.5px);
  /* the editor's tokens */
  --paper: #111213; --paper-deep: #0c0d0e; --on-paper: #eff0f1;
  --ink: #eff0f1; --ink-soft: #9c9ea3;
  --panel: #18191b; --well: #222427; --line: #3a3c40;
  --accent: #ff4a1f; --on-accent: #18191b;
  --scrim: rgba(8, 8, 9, .76); --press: rgba(0, 0, 0, .3);
  --font-display: "Mona Sans", system-ui, "Segoe UI", sans-serif;
  --font-ui: "Mona Sans", system-ui, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --gutter-l: max(20px, env(safe-area-inset-left, 0px));
  --gutter-r: max(20px, env(safe-area-inset-right, 0px));
  /* the site's own */
  --tg-bg: #18191b; --tg-surface: #222427; --tg-raise: #2b2d31; --tg-stage: #101112;
  --tg-muted: #9c9ea3; --tg-faint: #74767b;
  --tg-rule: rgba(239, 240, 241, .13); --tg-rule-strong: rgba(239, 240, 241, .34);
  --tg-accent: #ff4a1f; --tg-accent-hi: #ff6a45; --tg-accent-ink: #18191b; --tg-err: #ff8f73;
  --tg-ease: cubic-bezier(.22, 1, .36, 1);
  --tg-r-sm: calc(2 * var(--u)); --tg-r-md: calc(3 * var(--u)); --tg-r-lg: calc(4 * var(--u));
}

html, body { height: 100%; margin: 0; }
body { background: var(--tg-bg); color: var(--ink); font: 400 16px/1.5 var(--font-ui); font-stretch: 100%; -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
::selection { background: var(--tg-accent); color: var(--tg-accent-ink); }

/* ---- the editor's parts, in this look ---------------------------------------------------------------- */

/* The editor's stepped pixel corner belongs to its own studio; here corners are small and round. */
.btn, .tool, .chip, .tab, .thumb, .swatch, .well, .well-chip, .build, .dialog, .popover, .picker, .picker-chip, .toast, .tip, .input, .notice { clip-path: none; }
:focus-visible { outline: 2px solid var(--tg-accent); outline-offset: 2px; box-shadow: none; }
.view:focus-visible { outline-offset: -4px; box-shadow: none; }

.shelf { flex: 1; min-height: 0; padding: calc(18 * var(--u)) var(--gutter-r) calc(24 * var(--u)) var(--gutter-l); gap: calc(18 * var(--u)); scrollbar-color: var(--line) transparent; }
.shelf > * { flex: none; }                 /* the shelf scrolls; its rows must not be squeezed to fit */
.shelf-title { font: 600 calc(29 * var(--u))/1.04 var(--font-display); font-stretch: 125%; letter-spacing: .01em; text-transform: uppercase; }
.shelf-sub, .build-note { display: none; }   /* the studio's small print; the form does without */
.label { font: 500 calc(12.5 * var(--u))/1.2 var(--font-mono); letter-spacing: 0; text-transform: none; color: var(--tg-muted); }
.group { gap: calc(12 * var(--u)); }
.shelf-head .tool { width: calc(40 * var(--u)); height: calc(40 * var(--u)); background: transparent; border: 1px solid var(--tg-rule-strong); border-radius: var(--tg-r-sm); transition: border-color .15s, background-color .15s; }
.shelf-head .tool:hover { border-color: var(--ink); background: var(--tg-surface); }
.shelf-head .tool[aria-pressed="true"] { background: var(--ink); color: var(--tg-bg); border-color: var(--ink); }
:is(.chips, .tabs, .wells, .swatches) { gap: calc(7 * var(--u)); }
.tab, .chip, .well { font: 500 calc(14 * var(--u))/1 var(--font-ui); letter-spacing: 0; text-transform: none; background: transparent; border: 1px solid var(--tg-rule-strong); border-radius: var(--tg-r-sm); height: calc(36 * var(--u)); padding-inline: calc(14 * var(--u)); transition: border-color .15s, background-color .15s, color .15s; }
.well { height: calc(40 * var(--u)); padding-left: calc(8 * var(--u)); gap: calc(9 * var(--u)); }
.well-chip { width: calc(24 * var(--u)); height: calc(24 * var(--u)); border-radius: 1px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22); }
:is(.tab, .chip, .well):hover { border-color: var(--ink); }
.tab.is-on, .chip.is-on, .well.is-on { background: var(--ink); color: var(--tg-bg); border-color: var(--ink); }
.chip.is-quiet { border: 0; height: auto; padding: calc(6 * var(--u)) calc(4 * var(--u)); font: 500 calc(13 * var(--u))/1 var(--font-mono); color: var(--tg-muted); text-decoration: underline; text-underline-offset: 4px; }
.swatch { width: calc(34 * var(--u)); height: calc(34 * var(--u)); border-radius: var(--tg-r-sm); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2); transition: transform .12s; }
.swatch.is-on { outline: 2px solid var(--ink); outline-offset: 3px; }
.swatch.is-on::after { content: none; }
.grid { grid-template-columns: repeat(auto-fill, minmax(calc(92 * var(--u)), 1fr)); gap: calc(8 * var(--u)); }
.thumb, .build { background: var(--tg-surface); border: 1px solid transparent; border-radius: var(--tg-r-md); color: var(--tg-muted); overflow: hidden; transition: background-color .15s, border-color .15s, color .15s, transform .12s; }
.thumb { padding-bottom: calc(10 * var(--u)); }
.thumb:hover, .build:hover { background: var(--tg-raise); color: var(--ink); }
.thumb-name, .build-name { font: 500 calc(12.5 * var(--u))/1.2 var(--font-ui); letter-spacing: 0; text-transform: none; }
.build-name { font-size: calc(15 * var(--u)); }
.thumb.is-on, .build.is-on { background: var(--tg-raise); color: var(--ink); border-color: var(--tg-accent); box-shadow: inset 0 0 0 1px var(--tg-accent); }
.thumb.is-on::after, .build.is-on::after { top: calc(7 * var(--u)); right: calc(7 * var(--u)); width: calc(8 * var(--u)); height: calc(8 * var(--u)); border-radius: 0; background: var(--tg-accent); clip-path: none; }
.builds { max-width: calc(620 * var(--u)); gap: calc(10 * var(--u)); }
.build-pic { max-width: calc(210 * var(--u)); }
.notice { background: var(--tg-surface); border-left: 3px solid var(--tg-accent); border-radius: var(--tg-r-sm); font-size: calc(14 * var(--u)); }
.tip { background: var(--ink); color: var(--tg-bg); font: 500 calc(12.5 * var(--u))/1 var(--font-mono); letter-spacing: 0; text-transform: none; padding: calc(7 * var(--u)) calc(10 * var(--u)); border-radius: var(--tg-r-sm); }
.picker, .popover { background: var(--tg-surface); border: 1px solid var(--tg-rule-strong); border-radius: var(--tg-r-lg); }
.picker-hex { background: var(--tg-bg); border-radius: var(--tg-r-sm); }
.slider::-webkit-slider-thumb { border-radius: 2px; }

/* Left out of the registration: skin tones no person has, the free skin colour, and the shading sliders. */
#app[data-cat="body"] .shelf .group:nth-of-type(1) > .label:nth-of-type(2),
#app[data-cat="body"] .shelf .group:nth-of-type(1) > .swatches:nth-of-type(2),
#app[data-cat="body"] .shelf .group:nth-of-type(3) { display: none; }

/* ---- the site ---------------------------------------------------------------------------------------- */

.tg-app { position: relative; height: 100%; display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); overflow: hidden; }
.tg-label { font: 500 calc(13 * var(--u))/1.2 var(--font-mono); color: var(--tg-muted); }
.tg-link { background: none; border: 0; padding: calc(8 * var(--u)) 0; font: 500 calc(13 * var(--u))/1 var(--font-mono); color: var(--tg-muted); text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--tg-rule-strong); transition: color .15s, text-decoration-color .15s; }
.tg-link:hover:not(:disabled) { color: var(--ink); text-decoration-color: var(--ink); }

/* One button pair: a filled ember slab and an outlined one. */
.tg-btn { border: 1px solid var(--tg-rule-strong); border-radius: var(--tg-r-sm); background: transparent; color: var(--ink); padding: 0 calc(22 * var(--u)); min-height: calc(50 * var(--u)); font: 600 calc(13.5 * var(--u))/1 var(--font-ui); font-stretch: 118%; letter-spacing: .09em; text-transform: uppercase; display: inline-flex; align-items: center; justify-content: center; gap: calc(10 * var(--u)); transition: background-color .15s, border-color .15s, color .15s, transform .12s var(--tg-ease); }
.tg-btn:hover:not(:disabled) { border-color: var(--ink); transform: translateY(-1px); }
.tg-btn:active:not(:disabled) { transform: translateY(0) scale(.98); }
.tg-btn.is-primary, .tg-btn.is-red { background: var(--tg-accent); color: var(--tg-accent-ink); border-color: var(--tg-accent); }
.tg-btn.is-primary:hover:not(:disabled), .tg-btn.is-red:hover:not(:disabled) { background: var(--tg-accent-hi); border-color: var(--tg-accent-hi); }
.tg-btn:disabled { opacity: .4; }

/* waiting, and the registration that could not be read */
.tg-center { flex: 1; display: grid; place-content: center; justify-items: center; gap: calc(18 * var(--u)); padding: 24px; text-align: center; }
.tg-wait { width: calc(56 * var(--u)); height: auto; opacity: .9; }
.tg-stuck { margin: 0; max-width: 24ch; font: 500 calc(26 * var(--u))/1.15 var(--font-display); font-stretch: 104%; letter-spacing: -.02em; text-wrap: balance; }
.tg-err { color: var(--tg-err); font-size: calc(15 * var(--u)); }
.tg-err:empty { display: none; }

/* the gate: the seal, the name, the sign-in, and nothing else */
.tg-gate { flex: 1; min-height: 0; overflow-y: auto; display: grid; place-items: center; padding: calc(28 * var(--u)) var(--gutter-r) calc(calc(28 * var(--u)) + env(safe-area-inset-bottom, 0px)) var(--gutter-l); }
.tg-gate-in { width: min(100%, calc(440 * var(--u))); display: flex; flex-direction: column; align-items: center; text-align: center; gap: calc(26 * var(--u)); }
.tg-seal { width: min(74vw, 46vh, calc(310 * var(--u))); height: auto; }
.tg-title { margin: 0; font: 600 min(15.4vw, calc(64 * var(--u)))/.98 var(--font-display); font-stretch: 125%; letter-spacing: .015em; text-transform: uppercase; }
.tg-title small { display: block; margin-bottom: .7em; font: 500 .22em/1 var(--font-mono); letter-spacing: .5em; text-indent: .5em; color: var(--tg-muted); }
.tg-gate .tg-btn { width: min(100%, calc(340 * var(--u))); margin-top: calc(14 * var(--u)); min-height: calc(54 * var(--u)); }
.tg-gate .tg-btn svg { flex: none; width: calc(18 * var(--u)); height: calc(18 * var(--u)); padding: calc(3 * var(--u)); box-sizing: content-box; border-radius: 50%; background: #fff; }
.tg-gate .tg-notice { width: min(100%, calc(340 * var(--u))); }
.tg-notice { width: 100%; text-align: left; border: 1px solid var(--tg-rule-strong); border-left: 3px solid var(--tg-accent); border-radius: var(--tg-r-sm); background: var(--tg-surface); padding: calc(14 * var(--u)) calc(16 * var(--u)); font-size: calc(15 * var(--u)); line-height: 1.45; display: flex; flex-direction: column; gap: calc(10 * var(--u)); align-items: flex-start; }
.tg-notice b { font: 600 calc(13 * var(--u))/1.25 var(--font-ui); font-stretch: 118%; letter-spacing: .08em; text-transform: uppercase; }
.tg-notice .tg-btn { width: 100%; margin-top: calc(2 * var(--u)); min-height: calc(46 * var(--u)); }
@media (prefers-reduced-motion: no-preference) {
  .tg-gate-in > * { animation: tg-in .7s var(--tg-ease) both; }
  .tg-gate-in > :nth-child(2) { animation-delay: .1s; }
  .tg-gate-in > :nth-child(n + 3) { animation-delay: .2s; }
}

/* stage and form: on a phone the figure above the options; side by side from 900px */
.tg-work { position: relative; flex: 1; min-height: 0; display: grid; grid-template-rows: minmax(200px, 36%) minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); }
.tg-stage { position: relative; min-height: 0; overflow: hidden; background: radial-gradient(ellipse 46% 78% at 50% 0%, rgba(239, 240, 241, .1), transparent 70%), var(--tg-stage); border-bottom: 1px solid var(--tg-rule); }
.tg-tick { position: absolute; width: calc(12 * var(--u)); height: calc(12 * var(--u)); border: 1px solid var(--tg-rule-strong); pointer-events: none; z-index: 2; }
.tg-tick.a { top: 12px; left: 12px; border-right: 0; border-bottom: 0; } .tg-tick.b { top: 12px; right: 12px; border-left: 0; border-bottom: 0; }
.tg-tick.c { bottom: 12px; left: 12px; border-right: 0; border-top: 0; } .tg-tick.d { bottom: 12px; right: 12px; border-left: 0; border-top: 0; }
.tg-tools { position: absolute; top: calc(14 * var(--u)); right: calc(32 * var(--u)); z-index: 3; display: flex; gap: calc(20 * var(--u)); }
.tg-tools .tg-link:disabled { opacity: .35; text-decoration: none; }
.tg-fatal { position: absolute; inset: 30% 24px auto; margin: 0; text-align: center; color: var(--tg-muted); }

.tg-sheet { position: relative; z-index: 1; min-height: 0; display: flex; flex-direction: column; background: var(--tg-bg); }
.tg-head { flex: none; display: flex; align-items: center; gap: calc(16 * var(--u)); padding: calc(12 * var(--u)) var(--gutter-r) calc(12 * var(--u)) var(--gutter-l); border-bottom: 1px solid var(--tg-rule); }
.tg-mark { flex: none; width: calc(30 * var(--u)); height: calc(30 * var(--u)); }
.tg-steps { flex: 1; display: flex; gap: calc(6 * var(--u)); }
.tg-steps button { flex: 1; height: calc(20 * var(--u)); padding: 0; border: 0; background: none; position: relative; }
.tg-steps button::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 3px; margin-top: -1.5px; border-radius: 2px; background: var(--tg-rule); transition: background-color .15s; }
.tg-steps button:hover::after { background: var(--tg-rule-strong); }
.tg-steps button i { position: absolute; left: 0; top: 50%; height: 3px; margin-top: -1.5px; border-radius: 2px; background: var(--ink); z-index: 1; transition: width .35s var(--tg-ease); }
.tg-steps button.is-now i { background: var(--tg-accent); }

.tg-fields { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: calc(20 * var(--u)) var(--gutter-r) calc(24 * var(--u)) var(--gutter-l); display: flex; flex-direction: column; gap: calc(22 * var(--u)); }
.tg-fields h2 { margin: 0; font: 600 calc(29 * var(--u))/1.06 var(--font-display); font-stretch: 125%; letter-spacing: .01em; text-transform: uppercase; text-wrap: balance; }
.tg-field { display: flex; flex-direction: column; gap: calc(9 * var(--u)); }
.tg-field input, .tg-field textarea { display: block; width: 100%; background: var(--tg-surface); border: 1px solid var(--tg-rule-strong); border-radius: var(--tg-r-md); padding: calc(15 * var(--u)) calc(16 * var(--u)); font: 400 calc(18 * var(--u))/1.35 var(--font-ui); color: var(--ink); caret-color: var(--tg-accent); transition: border-color .15s, background-color .15s; }
.tg-field textarea { resize: none; }
.tg-field input:hover, .tg-field textarea:hover { border-color: rgba(239, 240, 241, .55); }
.tg-field input:focus, .tg-field textarea:focus { border-color: var(--ink); background: var(--tg-raise); outline: 2px solid var(--tg-accent); outline-offset: 2px; }
/* the questions: the line asked is the heading, then a place to write */
.tg-fields h2.tg-q { font: 500 calc(31 * var(--u))/1.1 var(--font-display); font-stretch: 104%; letter-spacing: -.03em; text-transform: none; }
.tg-q-hint { margin: calc(-8 * var(--u)) 0 0; font: 400 calc(17 * var(--u))/1.45 var(--font-ui); color: var(--tg-muted); }
/* a notice between sections: a sentence or two set large */
.tg-say { display: flex; flex-direction: column; gap: calc(16 * var(--u)); }
.tg-say p { margin: 0; font: 400 calc(20 * var(--u))/1.4 var(--font-ui); color: var(--tg-muted); text-wrap: pretty; max-width: 34ch; }
.tg-say p:first-child { font: 500 calc(30 * var(--u))/1.1 var(--font-display); font-stretch: 104%; letter-spacing: -.03em; color: var(--ink); text-wrap: balance; max-width: 22ch; }
/* a page that only marks a turn in the form */
.tg-divider { padding: calc(8 * var(--u)) 0; }
.tg-fields .tg-divider h2 { font-size: calc(36 * var(--u)); }
.tg-divider p { max-width: 30ch; margin: calc(16 * var(--u)) 0 0; font: 400 calc(19 * var(--u))/1.4 var(--font-ui); color: var(--tg-muted); text-wrap: balance; }
/* the optional voice recording under an interview answer */
.tg-voice { display: flex; flex-wrap: wrap; align-items: center; gap: calc(4 * var(--u)) calc(22 * var(--u)); min-height: calc(30 * var(--u)); margin-top: calc(-8 * var(--u)); }
.tg-voice .tg-dot { width: calc(10 * var(--u)); height: calc(10 * var(--u)); border-radius: 50%; background: var(--tg-accent); animation: tg-pulse 1.1s ease-in-out infinite; }
.tg-voice .tg-time { font: 500 calc(13 * var(--u))/1 var(--font-mono); color: var(--ink); min-width: 3.4em; font-variant-numeric: tabular-nums; }
.tg-voice-note { flex-basis: 100%; font-size: calc(14 * var(--u)); color: var(--tg-err); }
@keyframes tg-pulse { 50% { opacity: .25; } }
/* the declaration */
.tg-record { border: 1px solid var(--tg-rule); border-radius: var(--tg-r-md); margin: 0; background: var(--tg-surface); }
.tg-record div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: calc(14 * var(--u)) calc(16 * var(--u)); border-bottom: 1px solid var(--tg-rule); }
.tg-record div:last-child { border-bottom: 0; }
.tg-record dd, .tg-record dt { margin: 0; }
.tg-record dd { text-align: right; overflow-wrap: anywhere; font-size: calc(18 * var(--u)); font-weight: 500; }
.tg-oath { font: 500 calc(24 * var(--u))/1.2 var(--font-display); font-stretch: 104%; letter-spacing: -.02em; margin: 0; text-wrap: balance; }

.tg-foot { flex: none; display: flex; align-items: center; gap: calc(10 * var(--u)); padding: calc(12 * var(--u)) var(--gutter-r) calc(calc(12 * var(--u)) + env(safe-area-inset-bottom, 0px)) var(--gutter-l); border-top: 1px solid var(--tg-rule); background: var(--tg-bg); }
.tg-grow { flex: 1; min-width: 0; font: 500 calc(13 * var(--u))/1.2 var(--font-mono); color: var(--tg-err); text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-foot .tg-btn { min-width: calc(112 * var(--u)); }

/* the seal behind the pages that have no figure */
.tg-seal-bg { position: absolute; z-index: 0; right: -22vw; bottom: calc(40 * var(--u)); width: 96vw; max-width: none; height: auto; opacity: .05; pointer-events: none; user-select: none; }
.tg-work:not(.is-plain) .tg-seal-bg { display: none; }

/* without the figure (identification, the questions, the declaration, the closing page): one column on the ground */
.tg-work.is-plain { grid-template-rows: minmax(0, 1fr); }
.tg-work.is-plain .tg-stage { display: none; }
.tg-work.is-plain .tg-sheet { background: transparent; }
.tg-work.is-plain .tg-head, .tg-work.is-plain .tg-foot { border: 0; background: transparent; }
.tg-work.is-plain .tg-head { padding-top: calc(18 * var(--u)); }
.tg-work.is-plain .tg-fields { padding-top: calc(30 * var(--u)); gap: calc(24 * var(--u)); }

/* the closing page: one line */
.tg-done { flex: 1; min-height: 0; overflow-y: auto; padding: calc(24 * var(--u)) var(--gutter-r) calc(28 * var(--u)) var(--gutter-l); display: flex; flex-direction: column; justify-content: center; }
.tg-done p { margin: 0; }
.tg-done { text-align: center; }
.tg-done .tg-last { font: 600 calc(23 * var(--u))/1.3 var(--font-display); font-stretch: 125%; letter-spacing: .02em; text-transform: uppercase; text-wrap: balance; }

/* the page that opens the appearance part: everything on it large and in the middle */
.tg-work.is-skin-intro .tg-fields { flex: 1; }
.tg-skin-intro { display: grid; justify-items: center; text-align: center; flex: none; width: 100%; margin-block: auto; padding-block: calc(12 * var(--u)); gap: calc(22 * var(--u)); }
.tg-fields .tg-skin-intro h2 { font-size: min(11.4vw, calc(46 * var(--u))); }
.tg-skin-intro h2:focus { outline: none; }
.tg-skin-intro img { display: block; width: min(100%, calc(520 * var(--u))); height: auto; margin: calc(6 * var(--u)) 0; }
.tg-skin-intro p { margin: 0; color: var(--ink); font: 400 calc(22 * var(--u))/1.4 var(--font-ui); text-wrap: balance; }
.tg-work.is-skin-intro .tg-foot .tg-btn { min-height: calc(58 * var(--u)); min-width: calc(132 * var(--u)); font-size: calc(15 * var(--u)); }

/* each page arrives once, quietly */
@media (prefers-reduced-motion: no-preference) {
  .tg-fields > * { animation: tg-in .42s var(--tg-ease) both; }
  .tg-fields > :nth-child(2) { animation-delay: .05s; }
  .tg-fields > :nth-child(3) { animation-delay: .1s; }
  .tg-fields > :nth-child(n + 4) { animation-delay: .14s; }
  .tg-done .tg-last { animation: tg-in .9s var(--tg-ease) both; }
}
@keyframes tg-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .tg-voice .tg-dot { animation: none; }
  .tg-btn, .thumb, .build, .swatch, .tg-steps button i { transition: none; }
}

@media (min-width: 900px) {
  :root[data-theme="dark"] { --gutter-l: calc(28 * var(--u)); --gutter-r: calc(28 * var(--u)); }
  /* The options take the larger share of the window; the figure has the rest. */
  .tg-work { grid-template-columns: minmax(0, 2fr) minmax(520px, 3fr); grid-template-rows: minmax(0, 1fr); }
  .tg-stage { border-bottom: 0; border-right: 1px solid var(--tg-rule); background: radial-gradient(ellipse 40% 74% at 50% 0%, rgba(239, 240, 241, .1), transparent 70%), var(--tg-stage); }
  .shelf-title { font-size: calc(32 * var(--u)); }
  .shelf { padding-top: calc(24 * var(--u)); gap: calc(20 * var(--u)); }
  .grid { grid-template-columns: repeat(auto-fill, minmax(calc(106 * var(--u)), 1fr)); }
  .tg-foot { padding-top: calc(14 * var(--u)); padding-bottom: calc(14 * var(--u)); }

  /* The plain pages: one column in the middle of the window, the bars above it, the seal behind it. */
  .tg-work.is-plain { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .tg-work.is-plain .tg-sheet { width: min(100%, calc(700 * var(--u))); }
  .tg-work.is-plain .tg-head { padding-top: calc(22 * var(--u)); margin-bottom: auto; }
  .tg-work.is-plain .tg-fields { flex: 0 1 auto; padding-top: calc(28 * var(--u)); padding-bottom: calc(28 * var(--u)); }
  .tg-work.is-plain .tg-foot { padding-top: 0; margin-bottom: auto; }
  .tg-work.is-plain .tg-foot .tg-btn { min-width: calc(128 * var(--u)); }
  .tg-fields h2 { font-size: calc(34 * var(--u)); }
  .tg-fields h2.tg-q { font-size: calc(34 * var(--u)); }
  .tg-fields .tg-divider h2 { font-size: calc(44 * var(--u)); }
  .tg-seal-bg { right: auto; left: 50%; top: 50%; bottom: auto; width: min(92vh, 60vw); transform: translate(-50%, -50%); opacity: .045; }
  .tg-done { align-items: center; text-align: center; }
  .tg-done .tg-last { font-size: calc(36 * var(--u)); }

  /* the opening page for the skin: wider than the column, since everything on it is larger */
  .tg-work.is-skin-intro .tg-sheet { width: min(100%, calc(960 * var(--u))); }
  .tg-work.is-skin-intro .tg-fields { flex: 0 1 auto; overflow: visible; }
  .tg-skin-intro { margin-block: 0; gap: calc(26 * var(--u)); }
  .tg-fields .tg-skin-intro h2 { font-size: calc(58 * var(--u)); }
  .tg-skin-intro img { width: min(100%, calc(560 * var(--u))); }
  .tg-skin-intro p { font-size: calc(24 * var(--u)); }
  .tg-work.is-skin-intro .tg-foot { justify-content: center; gap: calc(14 * var(--u)); }
  .tg-work.is-skin-intro .tg-grow { display: none; }
  .tg-work.is-skin-intro .tg-foot .tg-btn { min-height: calc(62 * var(--u)); min-width: calc(170 * var(--u)); font-size: calc(16 * var(--u)); }
}
@media (max-width: 899.98px) {
  .colors .chips, .colors .swatches, .colors .wells, .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: calc(var(--gutter-r) * -1); padding-right: var(--gutter-r); padding-block: 5px; margin-block: -5px; }
  .colors .chips > *, .colors .swatches > *, .colors .wells > *, .tabs > * { flex: none; }
  /* four across on a phone, growing to about six on a tablet */
  .grid { grid-template-columns: repeat(auto-fill, minmax(clamp(78px, 14vw, 132px), 1fr)); }
}
