:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #1a202c;
  --muted: #5b6a80;
  --line: #e5e8ec;
  --accent: #00bfff;
  --accent-ink: #061018;
  --accent-text: #0072a3;
  --accent-line: #0087b3;
  --accent-soft: #e0f7ff;
  --field: #eff1f5;
  --stage: #e9ecf1;
  --danger: #cf3a3a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 8px 24px rgba(0, 0, 0, .08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101216;
    --panel: #191c22;
    --ink: #e8edf4;
    --muted: #acb6c5;
    --line: #303641;
    --accent: #38c9f4;
    --accent-ink: #061018;
    --accent-text: #5cd3ff;
    --accent-line: #38c9f4;
    --accent-soft: #12303c;
    --field: #22262e;
    --stage: #0c0e11;
    --danger: #ff7b7b;
    --shadow: 0 8px 24px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #101216;
  --panel: #191c22;
  --ink: #e8edf4;
  --muted: #acb6c5;
  --line: #303641;
  --accent: #38c9f4;
  --accent-ink: #061018;
  --accent-text: #5cd3ff;
    --accent-line: #38c9f4;
  --accent-soft: #12303c;
  --field: #22262e;
  --stage: #0c0e11;
  --danger: #ff7b7b;
  --shadow: 0 8px 24px rgba(0, 0, 0, .4);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 13.5px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
svg { width: 20px; height: 20px; flex: none; }
[hidden] { display: none !important; }

/* ---------- Top bar ---------- */
.bar {
  display: flex; align-items: center; gap: 12px;
  height: 54px; padding: 0 12px 0 8px; border-bottom: 1px solid var(--line); background: var(--panel);
}
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; border: 0; background: transparent; color: var(--ink); cursor: pointer; text-decoration: none; }
.icon-btn:hover { background: var(--field); }
.title { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.tool-pick { position: relative; display: inline-flex; align-items: center; color: var(--muted); font-size: 12px; }
.tool-pick select {
  appearance: none; -webkit-appearance: none; border: 0; background: transparent; color: inherit; font: inherit; font-weight: 600;
  padding: 0 18px 0 0; width: auto; cursor: pointer;
}
.tool-pick svg { position: absolute; right: 0; width: 14px; height: 14px; pointer-events: none; }
.name-row { display: flex; align-items: baseline; gap: 10px; }
.name { border: 0; background: transparent; font: inherit; font-size: 16px; font-weight: 650; color: var(--ink); padding: 0; min-width: 120px; width: 260px; max-width: 40vw; }
.name:focus { outline: none; box-shadow: 0 2px 0 var(--accent-line); }
.saved { color: var(--muted); font-size: 12px; }
.bar-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.bar-right .btn.ghost { padding: 8px 10px; white-space: nowrap; }
.tool-pick.single svg { display: none; }
.tool-pick.single select { padding-right: 0; opacity: 1; cursor: default; }
/* The secondary buttons keep their words only where the bar has room for them. */
@media (max-width: 1280px) {
  .bar-right .btn.ghost span { display: none; }
}

/* ---------- Buttons and fields ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; border-radius: 8px; padding: 8px 14px; cursor: pointer; border: 1px solid var(--line); background: var(--panel); color: var(--ink); }
.btn:hover { background: var(--field); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.05); background: var(--accent); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: default; filter: none; }
.btn.link { border: 0; background: none; color: var(--accent-text); padding: 2px 4px; }
.btn.link:hover { text-decoration: underline; background: none; }
.btn svg { width: 18px; height: 18px; }
.row { display: grid; grid-template-columns: 1fr 130px; align-items: center; gap: 4px 8px; margin: 10px 0; }
.row.wide { grid-template-columns: 1fr; }
.row > label { color: var(--ink); }
.pair { display: flex; align-items: center; gap: 6px; }
.pair input[type=number] { width: 72px; }
.unit { color: var(--muted); font-size: 12px; }
input[type=range] { width: 100%; accent-color: var(--accent); grid-column: 1 / -1; margin: 0 0 2px; }
input[type=number], input[type=text], select, textarea {
  font: inherit; color: var(--ink); background: var(--field); border: 1px solid var(--line);
  border-radius: 7px; padding: 6px 8px; width: 100%;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, button:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 1px; }
textarea { resize: vertical; min-height: 64px; }
.field-hint { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 12px; }
.seg { display: flex; background: var(--field); border: 1px solid var(--line); border-radius: 9px; padding: 3px; grid-column: 1 / -1; }
.seg button { flex: 1; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 550; padding: 5px 6px; border-radius: 7px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.check { display: flex; align-items: center; gap: 8px; margin: 10px 0; cursor: pointer; }
.check input { accent-color: var(--accent); }
.hint { color: var(--muted); font-size: 12px; margin: 8px 0 0; }
.hint .btn.link { font-size: 12px; padding: 0; }
.more { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 4px; }
.more summary { cursor: pointer; color: var(--muted); font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; padding: 6px 0; list-style: none; display: flex; align-items: center; gap: 6px; }
.more summary::before { content: ''; width: 6px; height: 6px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; }
.more[open] summary::before { transform: rotate(45deg); }
.more summary::-webkit-details-marker { display: none; }

/* ---------- Layout ---------- */
main { display: grid; grid-template-columns: 64px 1fr 324px; height: calc(100% - 54px); min-height: 480px; }
.strip { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 5px; border-right: 1px solid var(--line); background: var(--panel); overflow: hidden auto; }
.strip hr { width: 32px; border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.tool-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 50px; padding: 7px 0 5px; border: 0; border-radius: 9px; background: transparent; color: var(--ink); font: inherit; font-size: 10.5px; cursor: pointer; }
.tool-btn:hover { background: var(--field); }
.tool-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-text); }
.tool-btn svg { width: 22px; height: 22px; }

.stage { position: relative; min-width: 0; background: var(--stage); background-image: radial-gradient(var(--line) 1px, transparent 1px); background-size: 20px 20px; overflow: hidden; }
.slot.main { position: absolute; inset: 0; }
.slot.pip { position: absolute; right: 16px; bottom: 16px; width: 200px; height: 150px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; z-index: 2; }
.slot.pip .cover { position: absolute; inset: 0; border: 0; background: transparent; color: var(--ink); cursor: pointer; display: grid; place-items: end; padding: 8px; }
.slot.pip .cover svg { width: 18px; height: 18px; opacity: .7; }
.slot.pip .cover:hover svg { opacity: 1; }
.view3d { position: absolute; inset: 0; }
.view3d canvas { display: block; width: 100%; height: 100%; }
.view2d { position: absolute; inset: 0; display: grid; place-items: center; }
#views-parked { display: none; }
.viewlayout { position: absolute; inset: 0; }
.viewlayout canvas { display: block; width: 100%; height: 100%; touch-action: none; outline: none; }
.viewlayout canvas:focus-visible { box-shadow: inset 0 0 0 2px var(--accent-line); }
.stage.layout-cramped .stats, .stage.layout-cramped .slot.pip { display: none; }
/* Changes not yet built (moving the logo on the Layout view builds when 3D is shown). */
.model-stale .view3d canvas, .model-stale .stats, .model-stale #notes { opacity: .5; transition: opacity .15s; }
.model-stale .view3d::after { content: attr(data-stale); position: absolute; left: 8px; top: 8px; padding: 2px 8px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); color: var(--muted); font-size: 11px; pointer-events: none; }
.view2d canvas { max-width: 100%; max-height: 100%; cursor: crosshair; background: repeating-conic-gradient(rgba(127, 127, 127, .12) 0 25%, transparent 0 50%) 0 0 / 16px 16px; }
.slot.pip .view2d canvas { cursor: pointer; }
/* A tool's own design view (the terrain tool's map): dragged, not clicked. */
.view2d canvas.own-design { cursor: grab; touch-action: none; background: var(--field); border-radius: 10px; box-shadow: 0 2px 14px rgba(0, 0, 0, .18); }
.view2d canvas.own-design:active { cursor: grabbing; }
.slot.pip .view2d canvas.own-design { cursor: pointer; border-radius: 0; box-shadow: none; }
/* The terrain tool's trail box. */
.trail-box { display: grid; gap: 8px; padding: 12px; margin-bottom: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--field); }
.trail-box .hint { margin: 0; }
.trail-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: baseline; font-size: 13px; }
.trail-row .trail-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trail-row .trail-stats { grid-column: 1; color: var(--muted); font-size: 12px; }
.trail-row .btn.link { grid-column: 2; grid-row: 1 / span 2; font-size: 12px; padding: 0; }
.trail-actions { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.trail-actions label.btn { cursor: pointer; }
.trail-error { margin: 0; color: var(--danger, #c0392b); font-size: 12px; }
.place-row { display: grid; grid-template-columns: auto 1.6em 1fr auto; gap: 8px; align-items: center; font-size: 13px; }
.place-row .place-num { font-weight: 700; text-align: center; }
.place-row input[type="text"] { min-width: 0; padding: 4px 8px; font: inherit; color: inherit; background: var(--bg, transparent); border: 1px solid var(--line); border-radius: 6px; }
.place-row .place-what { color: var(--muted); font-size: 12px; white-space: nowrap; }
.status {
  position: absolute; left: 50%; top: 14px; transform: translateX(-50%);
  background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 14px; font-size: 13px; box-shadow: var(--shadow); pointer-events: none; max-width: 90%; text-align: center; z-index: 3;
}
.status:empty { display: none; }
.status.error { color: var(--danger); }
.stats { position: absolute; left: 14px; bottom: 14px; max-width: calc(100% - 250px); display: flex; flex-direction: column; gap: 1px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: 12px; color: var(--muted); box-shadow: var(--shadow); pointer-events: none; z-index: 2; }
.stats strong { color: var(--ink); font-weight: 600; font-size: 13px; }
.upload-card { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; z-index: 3; }
.upload-box { width: min(440px, 100%); background: var(--panel); border: 2px dashed var(--line); border-radius: 16px; padding: 32px 28px; text-align: center; box-shadow: var(--shadow); }
.upload-icon { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); margin-bottom: 12px; }
.upload-icon svg { width: 26px; height: 26px; }
.upload-box p { margin: 0 0 14px; font-size: 15px; font-weight: 600; }
.upload-box .hint { margin: 14px 0 0; }
.upload-actions { display: flex; gap: 10px; justify-content: center; align-items: center; }
.no-3d { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; padding: 24px 24px 90px; text-align: center; color: var(--muted); }
.fatal { max-width: 460px; margin: 15vh auto 0; padding: 24px; text-align: center; font-size: 15px; }
.fatal a { color: var(--accent-text); }

/* ---------- Right panel ---------- */
.panel { display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--line); background: var(--panel); }
.tabs { display: flex; border-bottom: 1px solid var(--line); padding: 0 8px; flex: none; }
.tabs button { flex: 1; border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 600; padding: 12px 8px 10px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--accent-text); border-bottom-color: var(--accent-line); }
.tab-body { overflow-y: auto; padding: 6px 16px 16px; flex: 1; }
.tab-body h3, .dialog h3, .prep-side h3 { margin: 16px 0 6px; font-size: 13px; font-weight: 650; display: flex; align-items: center; justify-content: space-between; }
.tab-body h3 .btn.link { font-size: 12px; font-weight: 600; }
.tab-foot { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 8px; }
.notes { border-top: 1px solid var(--line); padding: 10px 16px 12px; max-height: 32%; overflow-y: auto; flex: none; }
.notes h3 { margin: 0 0 4px; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.notes ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12px; }
.notes li { margin: 3px 0; }
.image-row { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--field); }
.image-row canvas { width: 48px; height: 48px; border-radius: 6px; background: repeating-conic-gradient(rgba(127, 127, 127, .15) 0 25%, transparent 0 50%) 0 0 / 12px 12px; flex: none; }
.image-row .name { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 600; word-break: break-word; }
.image-row .name.muted { font-weight: 500; color: var(--muted); }
.image-row .actions { display: flex; flex-direction: column; align-items: flex-end; gap: 0; }
.image-row .actions .btn.link { font-size: 12px; padding: 1px 2px; }
.matching { display: flex; flex-direction: column; gap: 6px; }
.match { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.match .hex { color: var(--muted); font-family: ui-monospace, Menlo, Consolas, monospace; min-width: 60px; }
.match .arrow { color: var(--muted); }
.chip { display: inline-block; width: 20px; height: 20px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .15); flex: none; }
.slotchip { --c: #ccc; display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px 2px 3px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); font-weight: 600; }
.slotchip::before { content: ''; width: 14px; height: 14px; border-radius: 50%; background: var(--c); border: 1px solid rgba(0, 0, 0, .15); }
.slots { display: flex; flex-direction: column; gap: 4px; }
.slot-row { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.slot-row:hover { background: var(--field); border-color: var(--line); }
.slot-row .badge { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .15); font-size: 12px; font-weight: 700; color: #1f2328; }
.slot-row .badge.dark { color: #fff; }
.slot-row .label { font-weight: 550; }
.slot-row .hex { color: var(--muted); font-size: 12px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.picker { position: fixed; z-index: 30; width: 248px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 12px; }
.picker h4 { margin: 0 0 8px; font-size: 12px; font-weight: 650; }
.picker-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--panel); outline: 1px solid rgba(127, 127, 127, .5); cursor: pointer; padding: 0; }
.dot[aria-pressed="true"] { outline: 2px solid var(--accent-line); }
.picker .custom { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; font-size: 12px; color: var(--muted); }
.picker .custom input { width: 40px; height: 26px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: none; cursor: pointer; }
.pop { position: absolute; display: flex; align-items: center; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow); padding: 5px 8px; font-size: 12px; color: var(--muted); z-index: 4; white-space: nowrap; }
.pop .dot { width: 24px; height: 24px; }
.pop .btn.link { padding: 2px 4px; font-size: 12px; }

/* ---------- Help ---------- */
.help { position: absolute; top: 14px; right: 14px; bottom: 14px; width: min(380px, calc(100% - 28px)); padding: 0; overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; z-index: 5; }
.help-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 10px 16px; border-bottom: 1px solid var(--line); }
.help-head h2 { margin: 0; font-size: 15px; }
.help-body { overflow-y: auto; padding: 6px 18px 18px; font-size: 13.5px; }
.help-body h3 { margin: 18px 0 6px; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.help-body ol, .help-body ul { margin: 8px 0; padding-left: 22px; }
.help-body li { margin: 6px 0; }
.help-body ol li::marker { color: var(--accent-text); font-weight: 700; }
.help-body p { color: var(--muted); font-size: 12px; margin: 16px 0 0; }
.help-body a { color: var(--accent-text); }

/* With the tutorial open the upload card moves left, out from under it. */
@media (min-width: 1180px) {
  .stage.help-open .upload-card { padding-right: 418px; }
}

/* ---------- Dialogs ---------- */
.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; background: rgba(15, 17, 19, .45); }
.dialog { width: min(100%, 560px); max-height: 100%; display: flex; flex-direction: column; background: var(--panel); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.prep-dialog { width: min(100%, 860px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 12px 20px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 0; font-size: 16px; }
.dialog-body { padding: 4px 20px 16px; overflow-y: auto; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--line); }
.small-dialog { width: min(100%, 440px); }
.small-dialog .dialog-body { padding-top: 10px; }
#share-link { width: 100%; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
.design-save { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.design-save .btn { flex: none; }
.design-save .hint { margin: 0; }
.design-list { display: flex; flex-direction: column; }
.design { display: grid; grid-template-columns: 56px 1fr auto auto; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.design:last-child { border-bottom: 0; }
.design img, .design-blank { width: 56px; height: 56px; border-radius: 8px; background: var(--field); object-fit: cover; }
.design-text { display: flex; flex-direction: column; min-width: 0; }
.design-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.design-text span { color: var(--muted); font-size: 12px; }
.prep-grid { display: grid; grid-template-columns: 1fr 260px; gap: 20px; padding: 16px 20px; overflow-y: auto; }
.prep-frame { display: grid; place-items: center; aspect-ratio: 1; background: repeating-conic-gradient(rgba(127, 127, 127, .14) 0 25%, transparent 0 50%) 0 0 / 16px 16px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.prep-frame canvas { max-width: 100%; max-height: 100%; cursor: grab; touch-action: none; }
.prep-frame canvas:active { cursor: grabbing; }
.prep-zoom { display: grid; grid-template-columns: auto 1fr 48px; align-items: center; gap: 10px; margin-top: 12px; font-size: 12.5px; }
.prep-zoom input[type=range] { grid-column: auto; margin: 0; }
.prep-side .row { grid-template-columns: 1fr auto; }
.prep-side h3:first-child { margin-top: 0; }
.ratio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ratio button { font: inherit; font-size: 12.5px; font-weight: 600; padding: 7px 4px; border-radius: 8px; border: 1px solid var(--line); background: var(--field); color: var(--ink); cursor: pointer; }
.ratio button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 14px 0 0; cursor: pointer; font-weight: 550; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch i { position: relative; width: 38px; height: 22px; border-radius: 999px; background: var(--line); transition: background .15s; flex: none; }
.switch i::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--panel); box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: left .15s; }
.switch input:checked + i { background: var(--accent-line); }
.switch input:checked + i::after { left: 18px; }
.switch input:focus-visible + i { outline: 2px solid var(--accent-line); outline-offset: 1px; }

/* ---------- Drop overlay ---------- */
.drop-overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 12%, var(--bg) 70%); pointer-events: none; }
.drop-overlay div { border: 3px dashed var(--accent); border-radius: 18px; padding: 28px 40px; font-size: 20px; font-weight: 650; color: var(--ink); background: var(--panel); }

/* ---------- Phones and narrow windows ---------- */
@media (max-width: 900px) {
  /* Phones: a fixed-height app layout, so the model stays in view while the panel scrolls. */
  main { display: flex; flex-direction: column; min-height: 0; }
  .stage { flex: none; height: 44vh; border-bottom: 1px solid var(--line); }
  .strip { flex: none; flex-direction: row; justify-content: center; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); padding: 4px 6px; overflow: visible; }
  .strip hr { width: 1px; height: 28px; border-top: 0; border-left: 1px solid var(--line); margin: 0 4px; }
  .tool-btn { padding: 4px 0 3px; }
  .panel { flex: 1; min-height: 0; border-left: 0; overflow-y: auto; display: block; }
  .tabs { position: sticky; top: 0; background: var(--panel); z-index: 1; }
  .tab-body { overflow: visible; }
  .notes { max-height: none; }
  .slot.pip { width: 140px; height: 105px; right: 10px; bottom: 10px; }
  .stats { left: 10px; bottom: 10px; max-width: calc(100% - 170px); }
  .stats span { white-space: normal; }
  .help { position: fixed; inset: 8px; width: auto; z-index: 20; }
  .title { flex: 1; }
  .name { width: 100%; min-width: 0; max-width: none; }
  .name-row .saved { flex: none; }
  /* Print it keeps its words; the other buttons are icons (each has a label for screen readers). */
  .bar { gap: 6px; }
  .bar-right { gap: 2px; }
  .bar .btn { padding: 8px 10px; }
  .bar-right .btn.ghost { padding: 8px 6px; border-color: transparent; }
  .saved { display: none; }
  .design { grid-template-columns: 44px 1fr auto; }
  .design img, .design-blank { width: 44px; height: 44px; }
  .design .btn.link { grid-column: 2 / -1; justify-self: end; }
  .design-save { flex-direction: column; align-items: stretch; }
  .prep-grid { grid-template-columns: 1fr; }
  /* iOS zooms the page when a focused field's text is under 16px. */
  input[type=number], input[type=text], select, textarea, .name { font-size: 16px; }
  .tool-pick select { font-size: 13px; }
  /* Finger-sized picture actions, side by side so Remove isn't hit by mistake. */
  .image-row { flex-wrap: wrap; }
  .image-row .actions { flex-direction: row; flex-basis: 100%; justify-content: flex-end; gap: 6px; }
  .image-row .actions .btn.link { padding: 8px 10px; font-size: 13px; }
}

/* A long tool name on a narrow bar is cut short and never runs under the buttons. */
.tool-pick { max-width: 100%; }
.tool-pick select { min-width: 0; max-width: 100%; text-overflow: ellipsis; }
