/* The planeviz app's page styles (served from planeviz/static by app.py).
   Apple-like, dark: native form controls (radio, checkbox, range, select,
   number, details/summary, dialog, progress) styled with CSS only. On a
   desktop the options are an inspector beside the image; on a phone, a glass
   sheet under it. Either can be hidden entirely. */

:root {
  color-scheme: dark;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui,
          "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Surfaces */
  --bg: #000;
  --bg-window: #1c1c1e;
  --bg-canvas: #141416;
  --bg-group: #28282a;
  --bg-control: rgba(255, 255, 255, .08);
  --bg-control-hover: rgba(255, 255, 255, .12);
  --bg-pop: #323234;
  --fill-seg: rgba(118, 118, 128, .24);
  --fill-knob: #636366;
  --fill-track: rgba(120, 120, 128, .32);
  --separator: rgba(84, 84, 88, .6);
  --hairline: rgba(255, 255, 255, .1);

  /* Text */
  --label: #fff;
  --label-2: rgba(235, 235, 245, .6);
  --label-3: rgba(235, 235, 245, .38);

  /* One accent */
  --accent: #0a84ff;
  --accent-deep: #0b6fe0;
  --accent-text: #409cff;
  --accent-ring: rgba(10, 132, 255, .45);
  --red: #ff6961;

  /* Type scale (macOS density by default) */
  --text: 13px; --text-2: 12px; --text-3: 11px; --text-title: 13px;
  --lh: 1.3;

  /* Spacing (4 px grid) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px;

  /* Radii */
  --r-s: 6px; --r-m: 10px; --r-l: 14px; --r-xl: 18px; --r-pill: 999px;
  --group-r: 8px;

  /* Control metrics */
  --row-h: 36px; --row-x: 12px; --control-h: 24px; --btn-h: 32px;
  --switch-w: 38px; --switch-h: 22px; --thumb: 18px; --seg-h: 24px;

  /* Motion and depth */
  --dur: 180ms; --ease: cubic-bezier(.2, .8, .2, 1);
  --shadow-knob: 0 3px 8px rgba(0, 0, 0, .28), 0 1px 1px rgba(0, 0, 0, .2);
  --shadow-thumb: 0 1px 4px rgba(0, 0, 0, .45), 0 0 0 .5px rgba(0, 0, 0, .15);
}

/* iOS density on phones. */
@media (max-width: 760px) {
  :root {
    --text: 17px; --text-2: 15px; --text-3: 13px; --text-title: 17px;
    --row-h: 44px; --row-x: 16px; --control-h: 34px; --btn-h: 50px;
    --switch-w: 51px; --switch-h: 31px; --thumb: 27px; --seg-h: 32px;
    --group-r: 10px; --r-s: 8px;
  }
}
@media (prefers-reduced-motion: reduce) {
  :root { --dur: 0ms; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---- Base ---- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: var(--text); line-height: var(--lh); color: var(--label);
       background: var(--bg); -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: var(--text-title); font-weight: 600; margin: 0; letter-spacing: -.01em; }
svg { display: block; }

/* ---- Which fields show: each kind of image its own; hours for a single day;
   local flights with "only between" ---- */
form:has([name=make][value=world]:checked)   [data-for]:not([data-for~=world]),
form:has([name=make][value=region]:checked)  [data-for]:not([data-for~=region]),
form:has([name=make][value=airport]:checked) [data-for]:not([data-for~=airport]),
form:has([name=make][value=routes]:checked)  [data-for]:not([data-for~=routes]) { display: none; }
form:has(#day option[value=all]:checked) [data-hours] { display: none; }
form:not(:has(#between:checked:enabled)) #local-row { display: none; }

/* ---- Panel body: a scrolling column whose children keep their height ---- */
.panel-body > * { flex: none; }

/* ---- Grouped list ---- */
/* Rows are separated by a 1 px gap that reveals the group's background: a
   separator colour inset by --row-x. Hidden rows simply leave no line. */
.group { display: flex; flex-direction: column; gap: 1px; border-radius: var(--group-r); overflow: hidden;
         background: linear-gradient(90deg, var(--bg-group) var(--row-x), var(--separator) var(--row-x)); }
.group > * { background: var(--bg-group); margin: 0; }
.row { display: flex; align-items: center; gap: var(--s3); min-height: var(--row-h); padding: 0 var(--row-x); }
.row-label { flex: 1 1 auto; min-width: 0; color: var(--label); display: flex; align-items: center; gap: 6px; }
.row.sub { padding-left: calc(var(--row-x) * 2 + 4px); }
.row:has(.grow) .row-label, .row:has(.tip) .row-label { flex: 0 0 auto; }
.tip { margin-right: auto; }
.row.sub .row-label { color: var(--label); }
.value { color: var(--label-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell { display: flex; flex-direction: column; }
.cell .row { min-height: var(--row-h); }
.caption { margin: 0; padding: 0 var(--row-x) 10px; font-size: var(--text-2); color: var(--label-2);
           font-variant-numeric: tabular-nums; }
.row:has(+ .caption) { padding-bottom: 0; }
.error { color: var(--red); }
.section-title { margin: 0; padding: 0 var(--row-x); font-size: var(--text-3); font-weight: 600;
                 color: var(--label-2); }
.subgroup { display: flex; flex-direction: column; gap: 6px; }
.row.dim { opacity: .45; }

/* ---- Segmented control (radios) ---- */
.seg { display: flex; padding: 2px; margin: 0; border: 0; min-width: 0; background: var(--fill-seg);
       border-radius: calc(var(--r-s) + 3px); }
.seg label { flex: 1 1 0; position: relative; display: flex; align-items: center; justify-content: center;
             min-width: 0; height: var(--seg-h); padding: 0 8px; border-radius: calc(var(--r-s) + 1px);
             font-size: var(--text); font-weight: 500; color: var(--label); cursor: pointer; user-select: none;
             white-space: nowrap; transition: background var(--dur) var(--ease); }
.seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.seg label:has(input:checked) { background: var(--fill-knob); box-shadow: var(--shadow-knob); font-weight: 600; }
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.seg label + label::before { content: ""; position: absolute; left: -1px; top: 28%; height: 44%; width: 1px;
                             background: rgba(255, 255, 255, .14); transition: opacity var(--dur); }
.seg label:has(input:checked)::before, .seg label:has(input:checked) + label::before { opacity: 0; }
.seg.mini { flex: none; }
.seg.mini label { height: var(--control-h); padding: 0 10px; font-size: var(--text-2); font-weight: 500; }

/* ---- Switch (checkbox) ---- */
.switch { appearance: none; -webkit-appearance: none; flex: none; width: var(--switch-w); height: var(--switch-h);
          margin: 0; border-radius: var(--r-pill); background: var(--fill-track); position: relative; cursor: pointer;
          transition: background var(--dur) var(--ease); }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: calc(var(--switch-h) - 4px);
                 height: calc(var(--switch-h) - 4px); border-radius: 50%; background: #fff;
                 box-shadow: 0 2px 6px rgba(0, 0, 0, .35), 0 0 0 .5px rgba(0, 0, 0, .1);
                 transition: transform var(--dur) var(--ease); }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(calc(var(--switch-w) - var(--switch-h))); }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch:disabled { opacity: .4; cursor: default; }

/* ---- Slider (range) with a value ---- */
.slider { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "label out" "range range";
          align-items: center; row-gap: 2px; padding-top: 8px; padding-bottom: 8px; }
.slider > label, .slider > .row-label { grid-area: label; }
.slider > output { grid-area: out; }
.slider > input[type=range] { grid-area: range; }
input[type=range] { appearance: none; -webkit-appearance: none; width: 100%; height: var(--thumb); margin: 0;
                    background: transparent; --p: 50%; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px;
  background: linear-gradient(90deg, var(--accent) var(--p), var(--fill-track) var(--p)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: var(--thumb); height: var(--thumb);
  border-radius: 50%; background: #fff; box-shadow: var(--shadow-thumb); margin-top: calc((4px - var(--thumb)) / 2); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--fill-track); }
input[type=range]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
input[type=range]::-moz-range-thumb { width: var(--thumb); height: var(--thumb); border: 0; border-radius: 50%;
  background: #fff; box-shadow: var(--shadow-thumb); }
input[type=range]:focus-visible { outline: none; }
input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 2px var(--bg-group), 0 0 0 4px var(--accent); }
input[type=range]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 2px var(--bg-group), 0 0 0 4px var(--accent); }
input[type=range]:disabled { opacity: .4; }

/* ---- Popup button (select) ---- */
.popup { position: relative; display: inline-flex; align-items: center; flex: none; max-width: 62%; }
.popup select { appearance: none; -webkit-appearance: none; font: inherit; font-size: var(--text); color: var(--label);
  background: var(--bg-control); border: 0; border-radius: var(--r-s); height: var(--control-h); max-width: 100%;
  padding: 0 30px 0 10px; cursor: pointer; text-overflow: ellipsis; white-space: nowrap; overflow: hidden;
  box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .12), 0 1px 1px rgba(0, 0, 0, .2); }
.popup select:hover { background-color: var(--bg-control-hover); }
.popup::after { content: ""; position: absolute; right: 4px; top: 50%; width: 16px; height: 16px; margin-top: -8px;
  border-radius: 4px; pointer-events: none; background: var(--accent)
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 16' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 6l3-3 3 3M2 10l3 3 3-3'/%3E%3C/svg%3E")
  center / 9px 14px no-repeat; }
.popup select:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring), inset 0 0 0 1px var(--accent); }

/* ---- Text and number fields ---- */
.field { position: relative; display: inline-flex; align-items: center; height: var(--control-h); min-width: 0;
  background: var(--bg-control); border-radius: var(--r-s); padding: 0 8px; gap: 4px;
  box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .12); }
.field input { appearance: none; -webkit-appearance: none; background: none; border: 0; outline: none; padding: 0;
  margin: 0; min-width: 0; width: 100%; color: var(--label); font: inherit; font-size: var(--text); }
.field input::placeholder { color: var(--label-3); }
.field:focus-within { box-shadow: 0 0 0 3px var(--accent-ring), inset 0 0 0 1px var(--accent); }
.field .unit { color: var(--label-2); font-size: var(--text-2); }
.field.num input { text-align: right; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.field.num.wide input { width: 6.5ch; }
.field input::-webkit-inner-spin-button, .field input::-webkit-outer-spin-button { display: none; }
.field.grow { flex: 1 1 auto; }
.field.invalid { box-shadow: inset 0 0 0 1px var(--red); }
/* A combo: a field with a chevron that opens a native picker laid over it. */
.combo .chev { flex: none; width: 16px; height: 16px; color: var(--label-2); }
.combo select { position: absolute; right: 0; top: 0; height: 100%; width: 32px; opacity: 0; cursor: pointer;
  font: inherit; }
.combo select:focus-visible + .chev { color: var(--accent-text); }
.combo input::-webkit-calendar-picker-indicator { opacity: 0; width: 16px; height: 16px; margin: 0; cursor: pointer;
  position: absolute; right: 8px; }
.pair { display: inline-flex; align-items: center; gap: 6px; }
.pair .field.num input { width: 2.4em; }
.pair .dash { color: var(--label-2); }

/* ---- Theme swatches (radios) ---- */
.swatches { display: flex; justify-content: space-between; gap: 8px; margin: 0; padding: 2px var(--row-x) 12px; border: 0; min-width: 0; }
.swatches label { position: relative; flex: 1 1 0; max-width: 56px; aspect-ratio: 1.6; border-radius: 6px; cursor: pointer;
  background: var(--g); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22); transition: transform var(--dur) var(--ease); }
.swatches input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.swatches label:has(input:checked) { box-shadow: 0 0 0 2px var(--ring-gap, var(--bg-group)), 0 0 0 4px var(--accent); }
.swatches label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 5px; }
.swatches label:active { transform: scale(.96); }

/* ---- Disclosure (details/summary) for More options ---- */
.more > summary { list-style: none; display: flex; align-items: center; gap: var(--s2); min-height: var(--row-h);
  padding: 0 var(--row-x); border-radius: var(--group-r); background: var(--bg-group); cursor: pointer; user-select: none; }
.more > summary::-webkit-details-marker { display: none; }
.more > summary .row-label { flex: 0 0 auto; white-space: nowrap; }
.more > summary .sum { flex: 1 1 auto; min-width: 0; text-align: right; color: var(--label-2); font-size: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.more > summary .chev { flex: none; width: 14px; height: 14px; color: var(--label-3); transition: transform var(--dur) var(--ease); }
.more[open] > summary .chev { transform: rotate(90deg); }
.more > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.more .body { display: flex; flex-direction: column; gap: var(--s4); padding-top: var(--s4); }

/* ---- Info tip (button + dialog) ---- */
.tip { position: relative; flex: none; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%;
  background: none; color: var(--label-2); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.tip::after { content: ""; position: absolute; inset: -12px; }  /* 44 px hit area */
.tip svg { width: 16px; height: 16px; }
.tip:hover { color: var(--label); }
dialog.sheet { border: 0; padding: 0; margin: auto; width: min(300px, calc(100vw - 48px)); border-radius: var(--r-l);
  background: var(--bg-pop); color: var(--label); box-shadow: 0 24px 60px rgba(0, 0, 0, .55), 0 0 0 .5px rgba(255, 255, 255, .15);
  font-size: var(--text-2); line-height: 1.4; }
dialog.sheet::backdrop { background: rgba(0, 0, 0, .35); }
@media (min-width: 761px) { dialog.sheet.anchored { position: fixed; margin: 0; } dialog.sheet.anchored::backdrop { background: rgba(0, 0, 0, .12); } }
dialog.sheet .sheet-body { padding: 18px 20px 14px; text-align: center; }
dialog.sheet h2 { margin: 0 0 6px; font-size: var(--text); font-weight: 600; }
dialog.sheet p { margin: 0; color: var(--label-2); }
dialog.sheet form { display: flex; border-top: 1px solid var(--separator); }
dialog.sheet form button { flex: 1; height: 44px; border: 0; background: none; color: var(--accent-text); font: inherit;
  font-size: var(--text); font-weight: 600; cursor: pointer; border-radius: 0 0 var(--r-l) var(--r-l); }
dialog.sheet form button:hover { background: var(--bg-control); }

/* ---- Buttons ---- */
.btn { font: inherit; font-size: var(--text); font-weight: 600; height: var(--btn-h); padding: 0 16px; border: 0;
  border-radius: var(--r-s); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: filter var(--dur) var(--ease), background var(--dur) var(--ease); }
.btn.primary { background: var(--accent-deep); color: #fff; width: 100%; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.primary:active { filter: brightness(.9); }
.btn.secondary { background: var(--bg-control); color: var(--label); font-weight: 500;
  box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .12); }
.btn.secondary:hover { background: var(--bg-control-hover); }
.btn:disabled { opacity: .5; cursor: default; filter: none; }
.btn.small { height: 28px; padding: 0 12px; font-size: var(--text-2); border-radius: var(--r-s); }
@media (max-width: 760px) { .btn.small { height: 44px; padding: 0 18px; font-size: var(--text-2); border-radius: var(--r-m); } }

/* ---- Progress ---- */
.job { display: flex; flex-direction: column; gap: 10px; width: min(360px, 100%); padding: var(--s4) var(--s5);
  border-radius: var(--r-l); }
.job .job-message { margin: 0; font-weight: 600; }
.job .job-detail { margin: 0; font-size: var(--text-2); color: var(--label-2); font-variant-numeric: tabular-nums; min-height: 1.3em; }
.job .cancel { align-self: flex-start; margin-top: 2px; }
progress { appearance: none; -webkit-appearance: none; width: 100%; height: 4px; border: 0; border-radius: 2px;
  background: var(--fill-track); overflow: hidden; display: block; }
progress::-webkit-progress-bar { background: transparent; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 2px; transition: width 300ms linear; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 2px; }
.job.queued progress { background: linear-gradient(90deg, var(--fill-track) 0 40%, var(--accent) 50%, var(--fill-track) 60% 100%);
  background-size: 250% 100%; animation: slide 1.6s linear infinite; }
.job.queued progress::-webkit-progress-value, .job.queued progress::-moz-progress-bar { background: transparent; }
@keyframes slide { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* ---- Result ---- */
figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: var(--s3); min-width: 0; }
figure a.pic { display: contents; }
figure img { display: block; max-width: 100%; height: auto; border-radius: 3px; box-shadow: 0 0 0 1px var(--hairline); }
figcaption { font-size: var(--text-2); color: var(--label-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
figcaption a { font-weight: 500; }
figcaption .sep { margin: 0 .35em; color: var(--label-3); }

/* ---- Empty state: a quiet frame at the chosen shape ---- */
.ghost { width: min(56%, 720px); aspect-ratio: var(--aspect, 1.5); border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .07);
  background: radial-gradient(ellipse at 50% 50%, rgba(255, 255, 255, .028), rgba(255, 255, 255, 0) 70%); }
@media (max-width: 760px) {
  /* Hit areas of at least 44 px, without changing what is drawn. */
  .switch::before { content: ""; position: absolute; inset: -7px -4px; }
  .seg label::after { content: ""; position: absolute; inset: -6px 0; }
  .swatches label::after { content: ""; position: absolute; inset: -8px -4px; }
  .combo select { width: 44px; }
  input[type=range] { height: 44px; margin: -8px 0; }
  .grabber::after { inset: -20px -40px; }
  /* On a phone both directions use the iOS idiom: plain right-aligned values, no boxes,
     so a field or popup can fill the 44 px row without showing it. */
  .panel .field { background: transparent; box-shadow: none; padding: 0; height: 44px; }
  .panel .field input { text-align: right; height: 100%; }
  .panel .field:focus-within { box-shadow: none; outline: 2px solid var(--accent-ring); outline-offset: 2px; border-radius: 3px; }
  .panel .field.invalid { outline: 1px solid var(--red); outline-offset: 2px; border-radius: 3px; }
  .panel .combo input::-webkit-calendar-picker-indicator { right: 0; }
  .panel .pair .field.num { background: var(--bg-control); padding: 0 10px; }
  .panel .pair .field.num:focus-within { outline: none; box-shadow: 0 0 0 3px var(--accent-ring), inset 0 0 0 1px var(--accent); }
  .row:has(.pair) { min-height: 56px; }
  .pair .field.num { min-width: 48px; }
  .panel .popup select { background: transparent; box-shadow: none; color: var(--label-2); padding: 0 20px 0 0;
                         text-align: right; text-align-last: right; height: 44px; }
  .panel .popup select:focus-visible { box-shadow: none; outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
  .panel .popup::after { right: 0; width: 12px; height: 16px; margin-top: -8px; border-radius: 0; background: var(--label-3);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 16' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 6l3-3 3 3M2 10l3 3 3-3'/%3E%3C/svg%3E") center / 9px 14px no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 16' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 6l3-3 3 3M2 10l3 3 3-3'/%3E%3C/svg%3E") center / 9px 14px no-repeat; }
  .ghost { width: 72%; }
  .section-title { text-transform: uppercase; letter-spacing: .04em; font-weight: 400; padding-bottom: 2px; }
}

/* ---- Layout on a desktop: the image on a charcoal canvas, the options in an
   inspector at the right (like Photos' or Preview's) ---- */
body { background: var(--bg-canvas); }
.app { display: grid; grid-template-columns: minmax(0, 1fr) 320px; height: 100vh; height: 100dvh; }
.brand { display: none; }  /* the inspector's head names the app */
.panel { grid-column: 2; grid-row: 1; display: flex; flex-direction: column; min-height: 0;
         background: var(--bg-window); box-shadow: inset 1px 0 0 var(--hairline); }
.panel-head { flex: none; height: 48px; display: flex; align-items: center; padding: 0 var(--s4); }
.grabber { display: none; }
.panel-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 0 var(--s4) var(--s4); display: flex; flex-direction: column;
              gap: var(--s4); overscroll-behavior: contain; }
.panel-foot { flex: none; padding: var(--s3) var(--s4) var(--s4); box-shadow: inset 0 1px 0 var(--hairline); }
.stage { grid-column: 1; grid-row: 1; position: relative; display: flex; align-items: center; justify-content: center;
         min-width: 0; padding: var(--s6); overflow: auto; }
.stage .empty { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.stage figure img { max-height: calc(100dvh - 48px - 34px); width: auto; object-fit: contain;
                    box-shadow: 0 0 0 1px var(--hairline), 0 24px 64px rgba(0, 0, 0, .55); }
.job { background: var(--bg-window); box-shadow: 0 0 0 1px var(--hairline), 0 16px 40px rgba(0, 0, 0, .4); }

/* Hiding the options: the inspector folds away and the image takes the window. */
.panel-toggle { position: absolute; top: 10px; right: calc(320px + 10px); z-index: 4; width: 32px; height: 28px; padding: 0;
  display: flex; align-items: center; justify-content: center; border: 0; border-radius: var(--r-s); cursor: pointer;
  color: var(--label-2); background: transparent; }
.panel-toggle svg { width: 19px; height: 15px; }
.panel-toggle:hover { color: var(--label); background: var(--bg-control); }
body.panel-hidden .app { grid-template-columns: minmax(0, 1fr); }
body.panel-hidden .panel { display: none; }
body.panel-hidden .panel-toggle { right: 10px; }

/* An error, where the image would be. */
.error-card .job-message { color: var(--red); font-weight: 500; }

/* ---- Layout on a phone: the image above, the options in a glass sheet with
   Generate at its foot; the sheet grows with its grabber and hides entirely ---- */
@media (max-width: 760px) {
  :root { --sheet: 58dvh; }
  body { background: radial-gradient(ellipse at 42% 46%, #111114, #000 72%) fixed; }
  .app { display: block; position: relative; height: 100dvh; overflow: hidden; }
  .brand, .stage figcaption, .panel-toggle { -webkit-backdrop-filter: blur(24px) saturate(1.5); backdrop-filter: blur(24px) saturate(1.5);
    background: rgba(30, 30, 33, .66); box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .14); }
  .brand { display: flex; position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 2; height: 32px;
           padding: 0 14px; align-items: center; border-radius: var(--r-pill); font-weight: 600; font-size: 13px; }
  .panel-toggle, body.panel-hidden .panel-toggle { position: fixed; top: 12px; right: var(--s4); width: 44px; height: 32px;
           border-radius: var(--r-pill); color: var(--label); }
  .stage { position: fixed; inset: 0; padding: 60px var(--s4) calc(var(--sheet) + var(--s3)); overflow: hidden; }
  body.panel-hidden .stage { padding-bottom: calc(var(--s4) + env(safe-area-inset-bottom)); }
  .stage figure { flex-direction: column; justify-content: center; height: 100%; gap: 10px; max-width: 100%; }
  .stage figure img { max-height: calc(100% - 42px); max-width: 100%; box-shadow: 0 0 0 1px var(--hairline), 0 30px 80px rgba(0, 0, 0, .6); }
  .stage figcaption { height: 32px; padding: 0 14px; display: flex; align-items: center; border-radius: var(--r-pill);
                      color: var(--label); white-space: nowrap; }
  .panel { position: fixed; left: 0; right: 0; bottom: 0; height: var(--sheet); z-index: 3;
           border-radius: var(--r-xl) var(--r-xl) 0 0; transition: height 320ms var(--ease);
           background: rgba(30, 30, 33, .74); -webkit-backdrop-filter: blur(40px) saturate(1.6); backdrop-filter: blur(40px) saturate(1.6);
           box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .16), 0 24px 70px rgba(0, 0, 0, .6);
           --bg-group: rgba(255, 255, 255, .07); --separator: rgba(255, 255, 255, .1); --ring-gap: #2b2b2e; }
  .panel.tall { height: 92dvh; }
  .panel-head { display: none; }
  .grabber { display: block; flex: none; width: 36px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .28);
             margin: 8px auto 4px; border: 0; padding: 0; cursor: pointer; position: relative; }
  .grabber::after { content: ""; position: absolute; inset: -12px -40px; }
  .panel-body { padding: var(--s2) var(--s4) var(--s4); }
  .panel-foot { box-shadow: none; padding: var(--s3) var(--s4) calc(var(--s3) + env(safe-area-inset-bottom)); }
  .panel-foot .btn.primary { border-radius: var(--r-m); }
  .job { width: min(340px, 100%); background: rgba(30, 30, 33, .74); -webkit-backdrop-filter: blur(40px) saturate(1.6);
         backdrop-filter: blur(40px) saturate(1.6); box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .16), 0 24px 70px rgba(0, 0, 0, .6); }
}
