/* doesitfit.lol — workspace (app.html). Tokens & components live in ds.css. */

html, body { height: 100%; }
body.app { height: 100dvh; }
body.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto auto auto minmax(0, 1fr) auto;
  grid-template-areas: "bar" "rail" "focus" "notes" "stage" "status";
  overflow: hidden;
}

/* ------------------------------------------------------------------ header bar */
.bar {
  grid-area: bar; position: relative; z-index: 30;
  display: flex; align-items: center; gap: var(--s5);
  min-height: 72px; padding: 12px var(--s5);
  background: var(--paper); border-bottom: var(--line);
}
.bar .logo { font-size: 22px; }
.bar-url { position: relative; flex: 1 1 760px; max-width: 900px; min-width: 0; display: flex; align-items: center; gap: var(--s4); }
.bar-url .field { flex: 1; }
.bar-spacer { flex: 1 1 0; }
.bar-actions { display: flex; align-items: center; gap: var(--s2); }
.menu-btn { display: none; }

/* recents dropdown */
.recents {
  position: absolute; top: calc(100% + 10px); left: 0; right: 0; z-index: 60; max-height: 380px; overflow: auto;
  background: var(--paper); border: var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 6px;
}
.recents h6 { margin: 8px 10px 4px; font: 700 11px/1 var(--font-mono); letter-spacing: 0.04em; text-transform: uppercase; color: var(--graphite); }
.recents button {
  display: flex; width: 100%; align-items: center; gap: var(--s2); min-height: 40px; padding: 0 10px; text-align: left;
  border: 2px solid transparent; border-radius: 8px; background: transparent; font: 400 14px var(--font-mono);
}
.recents button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recents button em { margin-left: auto; font: 400 13px var(--font-body); font-style: normal; color: var(--graphite); white-space: nowrap; }
.recents button:hover, .recents button.hl { border-color: var(--ink); background: var(--cream); }

/* ------------------------------------------------------------------ chip rail */
.rail {
  grid-area: rail; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
  min-height: 64px; padding: 10px var(--s5); flex-wrap: wrap;
  background: var(--cream); border-bottom: var(--line);
}
.chips { display: flex; gap: var(--s2); min-width: 0; overflow-x: auto; scrollbar-width: none; padding: 4px 2px; margin: -4px -2px; }
.chips::-webkit-scrollbar { display: none; }
.rail-tools { display: flex; align-items: center; gap: var(--s2); flex: none; margin-left: auto; }
.rail-tools .btn { min-height: 44px; font-size: 14px; padding: 0 14px; }
.select {
  appearance: none; min-height: 44px; padding: 0 34px 0 14px; cursor: pointer;
  border: var(--line); border-radius: var(--r); background: var(--paper);
  font: 600 13px/1 var(--font-mono);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%2316130F' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1.5 1.5l4.5 4.5 4.5-4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}

/* ------------------------------------------------------------------ focus bar (one screen) */
.focusbar {
  grid-area: focus; z-index: 15; position: relative; /* contains its visually-hidden labels */
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--s3);
  padding: 10px var(--s5); background: var(--paper); border-bottom: var(--line);
}
.focusbar .who { display: flex; flex-direction: column; gap: 2px; min-width: 0; margin-right: var(--s2); }
.focusbar .who b { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dims {
  display: inline-flex; align-items: center; height: 44px; padding: 0 6px;
  background: var(--cream); border: var(--line); border-radius: var(--r);
}
.dims:focus-within { background: var(--paper); outline: 3px solid var(--blue); outline-offset: 0; }
.dims input { width: 62px; height: 36px; border: 0; background: transparent; outline: 0; text-align: center; font: 600 15px var(--font-mono); }
.dims span { font: 600 12px var(--font-mono); color: var(--graphite); }
.tag {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; white-space: nowrap;
  border: var(--line); border-radius: var(--r-pill); background: var(--paper); font: 600 12px var(--font-mono);
}
.tag.tag-tape { background: var(--tape); }
.presets { display: flex; flex-wrap: wrap; gap: 6px; flex-basis: 100%; }
.presets button {
  min-height: 32px; padding: 0 10px; border: 2px dashed var(--ink); border-radius: var(--r-pill); background: transparent;
  font: 600 12px var(--font-mono);
}
.presets button[aria-pressed="true"] { background: var(--ink); color: var(--cream); border-style: solid; }

/* ------------------------------------------------------------------ notes (notices) */
.notes { grid-area: notes; z-index: 10; }
.note {
  display: flex; align-items: flex-start; gap: var(--s3); padding: 10px var(--s5);
  background: var(--paper); border-bottom: var(--line); font-size: 15px;
}
.note .label { flex: none; margin-top: 2px; padding: 3px 7px; border: var(--line); font: 700 11px/1.2 var(--font-mono); letter-spacing: 0.04em; text-transform: uppercase; }
.note.warn .label { background: var(--tape); }
.note.err .label { background: var(--tomato); }
.note.info .label { background: var(--cream); }
.note .msg { flex: 1; min-width: 0; text-wrap: pretty; }
.note .msg code { font: 400 13px var(--font-mono); background: var(--cream); border: 1.5px solid var(--ink); border-radius: 6px; padding: 0 5px; overflow-wrap: anywhere; }
.note .actions { display: flex; gap: var(--s2); flex: none; }
.note .x { flex: none; width: 36px; height: 36px; margin: -4px -8px -4px 0; display: grid; place-items: center; border: 2px solid transparent; border-radius: 8px; background: transparent; }
.note .x:hover { border-color: var(--ink); }

/* ------------------------------------------------------------------ stage + frames */
.stage { grid-area: stage; position: relative; overflow: auto; }
.canvas {
  min-height: 100%; width: max-content; min-width: 100%;
  display: flex; align-items: flex-start; gap: 36px; padding: 44px 48px 56px;
}
.canvas.focused { justify-content: center; }

.shot { margin: 0; flex: none; display: flex; flex-direction: column; gap: var(--s3); }
.shot-cap { display: flex; flex-wrap: wrap; align-content: flex-start; align-items: center; justify-content: space-between; gap: 6px var(--s3); min-height: 82px; }
.shot-why { margin: -6px 0 0; max-width: 100%; overflow-wrap: anywhere; color: var(--ink); }
.shot-name {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; padding: 2px 6px; margin: -2px -6px;
  border: 2px solid transparent; border-radius: 8px; background: transparent; text-align: left;
}
.shot-name:hover { border-color: var(--ink); }
.shot-name b { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.shot-name .t-measure { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.shot-right { display: flex; align-items: center; gap: var(--s2); flex: none; margin-left: auto; }
.shot-off {
  width: 32px; height: 32px; display: grid; place-items: center; border: 2px solid transparent; border-radius: 8px; background: transparent; color: var(--graphite);
}
.shot-off:hover { border-color: var(--ink); color: var(--ink); }
.unmeasured { font: 600 12px var(--font-mono); color: var(--graphite); white-space: nowrap; }

.shot-frame { flex: none; }
.shot-frame.phone { border-radius: 22px; }
.shot-frame.phone .frame-screen { border-radius: 19px; }
.shot-frame.laptop, .shot-frame.desktop, .shot-frame.custom { border-radius: 16px; }
.shot-frame.laptop .frame-screen, .shot-frame.desktop .frame-screen, .shot-frame.custom .frame-screen { border-radius: 13px; }
.shot-scale { position: absolute; left: 0; top: 0; transform-origin: 0 0; background: #fff; }
.viewport { position: relative; background: #fff; }
.viewport iframe { display: block; width: 100%; height: 100%; border: 0; background: #fff; }

.shot .skeleton { transition: opacity 200ms; }
.shot .skeleton p {
  margin: auto 0 0; font: 600 12px/1.4 var(--font-mono); color: var(--graphite); text-align: center; padding: 8px;
}
.shot.loaded .skeleton { opacity: 0; pointer-events: none; }
body.checking .shot .skeleton { opacity: 1; }

.blocked-cover {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: var(--paper); padding: 16px; text-align: center; font: 600 12px/1.4 var(--font-mono); color: var(--graphite);
}

/* simulated OS / browser chrome — always rendered light like the real default UI */
.chrome { position: relative; overflow: hidden; color: #111; font-family: -apple-system, "SF Pro Text", "Segoe UI", Roboto, sans-serif; user-select: none; }
.chrome svg { display: block; }
.statusbar { display: flex; align-items: center; justify-content: space-between; background: #fff; font-weight: 600; }
.statusbar .icons { display: flex; align-items: center; gap: 5px; }
.island { position: absolute; left: 50%; transform: translateX(-50%); background: #000; border-radius: 999px; }
.notch { position: absolute; left: 50%; transform: translateX(-50%); top: 0; background: #000; border-radius: 0 0 22px 22px; }
.punch { position: absolute; left: 50%; transform: translateX(-50%); background: #000; border-radius: 50%; }
.addr {
  display: flex; align-items: center; justify-content: center; gap: 6px; overflow: hidden; white-space: nowrap;
  background: rgba(118, 118, 128, 0.14); color: #111; border-radius: 12px;
}
.addr span { overflow: hidden; text-overflow: ellipsis; }
.safari-bottom { background: rgba(249, 249, 249, 0.96); border-top: 0.5px solid rgba(0,0,0,.12); display: flex; flex-direction: column; align-items: center; }
.safari-tools { display: flex; justify-content: space-between; color: #0a84ff; }
.home-ind { background: #111; border-radius: 99px; }
.chrome-android-top { display: flex; align-items: center; gap: 10px; background: #fff; }
.chrome-android-top .addr { background: #eef1f6; border-radius: 999px; justify-content: flex-start; padding: 0 14px; }
.tabcount { border: 2px solid #444; border-radius: 4px; font-weight: 700; display: grid; place-items: center; }
.navbar { background: #fff; display: grid; place-items: center; }
.navbar .pill { background: #1f1f1f; border-radius: 99px; }
.mac-menubar { display: flex; align-items: center; gap: 18px; background: rgba(236, 236, 240, 0.97); font-weight: 500; position: relative; }
.mac-menubar b { font-weight: 700; }
.mac-menubar .right { margin-left: auto; display: flex; gap: 14px; }
.mac-notch { position: absolute; left: 50%; transform: translateX(-50%); top: 0; background: #000; border-radius: 0 0 10px 10px; }
.win-taskbar { display: flex; align-items: center; justify-content: center; gap: 8px; background: rgba(238, 241, 246, 0.98); border-top: 1px solid #dde1e7; position: relative; }
.win-taskbar i { display: block; width: 26px; height: 26px; border-radius: 6px; background: #c9d3e3; }
.win-taskbar i:first-child { background: linear-gradient(135deg, #2b88ff, #1760d6); }
.win-taskbar .clock { position: absolute; right: 14px; font-size: 12px; text-align: right; line-height: 1.25; }
.tabstrip { display: flex; align-items: flex-end; background: #dfe3e8; padding: 0 8px; gap: 8px; }
.tabstrip .lights { display: flex; gap: 8px; align-self: center; margin: 0 10px 0 6px; }
.tabstrip .lights i { width: 12px; height: 12px; border-radius: 50%; display: block; }
.tabstrip .tab {
  background: #fff; border-radius: 10px 10px 0 0; display: flex; align-items: center; gap: 8px; padding: 0 12px; font-size: 12px;
  width: 240px; overflow: hidden; white-space: nowrap;
}
.tabstrip .tab span { overflow: hidden; text-overflow: ellipsis; }
.tabstrip .wbtns { margin-left: auto; display: flex; align-self: stretch; }
.tabstrip .wbtns i { width: 46px; display: grid; place-items: center; font-style: normal; font-size: 13px; color: #333; }
.toolrow { display: flex; align-items: center; gap: 12px; background: #fff; padding: 0 12px; color: #5f6368; border-bottom: 1px solid #e3e6ea; }
.toolrow .addr { flex: 1; justify-content: flex-start; padding: 0 14px; background: #eef1f4; border-radius: 999px; height: 34px; font-size: 14px; color: #1f1f1f; }
.bookmarks { background: #fff; border-bottom: 1px solid #e3e6ea; display: flex; align-items: center; gap: 16px; padding: 0 14px; font-size: 12px; color: #333; }
.bookmarks i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: #c9d3e3; margin-right: 6px; vertical-align: -2px; }

/* device mockups: real hardware at real proportions (toggle "Mockups") */
.shot-frame.mock {
  border: 0; padding: 0;
  background: linear-gradient(145deg, #5d636c 0%, #2a2e34 22%, #454a52 48%, #1d2025 74%, #50555d 100%);
  box-shadow: var(--shadow-hero), inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.mock-bezel { position: absolute; background: #07080a; }
.shot-frame.mock .frame-screen { inset: auto; }
.mock-hw, .mock-over { position: absolute; inset: 0; pointer-events: none; }
.mock-hw { z-index: 2; }
.mock-over { z-index: 4; }
.mock-btn { position: absolute; display: block; border-radius: 2px; background: linear-gradient(90deg, #3a3f46, #6b717a, #3a3f46); box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.6); }
.mock-btn-t, .mock-btn-b { background: linear-gradient(180deg, #3a3f46, #6b717a, #3a3f46); }
.mock-home { position: absolute; display: block; border-radius: 50%; border: 2px solid #3a3f46; background: #0d0e10; }
.mock-cam { position: absolute; display: block; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #3b4a66, #0b0c0f 60%); }
.mock-island, .mock-notch, .mock-punch { position: absolute; display: block; background: #000; }
.mock-island { border-radius: 999px; }
.mock-notch { border-radius: 0 0 22px 22px; }
.mock-notch-l { border-radius: 0 22px 22px 0; }
.mock-punch { border-radius: 50%; box-shadow: 0 0 0 1.5px rgba(40, 40, 40, 0.9); }
.mock-crease { position: absolute; display: block; }
.mock-hinge { position: absolute; display: block; z-index: 1; background: linear-gradient(90deg, #7d828a, #e2e5ea 45%, #9a9fa7 70%, #6d7279); box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.35); }
.mock-hinge-b { background: linear-gradient(180deg, #7d828a, #e2e5ea 45%, #9a9fa7 70%, #6d7279); }

/* iPhone Duo outer screen: the system strip websites never draw into (real device units, scaled with the frame) */
.chrome.chrome-rail { position: absolute; top: 0; bottom: 0; background: #f2f2f5; box-shadow: inset 0.5px 0 0 rgba(0, 0, 0, 0.08), inset -0.5px 0 0 rgba(0, 0, 0, 0.08); }
.chrome.chrome-rail[hidden] { display: none; }
.rail-cam { position: absolute; display: block; border-radius: 50%; background: radial-gradient(circle at 38% 36%, #2b3754, #06070a 60%); box-shadow: 0 0 0 1.5px #000; }
.rail-time { position: absolute; width: 60px; text-align: center; font-size: 15px; font-weight: 600; line-height: 20px; }
.rail-ring { position: absolute; }
.status-ring { width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; box-shadow: inset 0 0 0 2px rgba(17, 17, 17, 0.8); }
.statusbar .status-ring { width: 30px; height: 30px; margin-left: 8px; }
.rail-btn { position: absolute; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: rgba(250, 250, 252, 0.96); box-shadow: 0 2px 12px rgba(0, 0, 0, 0.14), inset 0 0 0 0.5px rgba(0, 0, 0, 0.08); font-size: 20px; color: #111; }
.mock-crease.h { left: 0; right: 0; top: calc(50% - 5px); height: 10px; background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.07) 35%, rgba(255, 255, 255, 0.16) 50%, rgba(0, 0, 0, 0.07) 65%, transparent); }
.mock-crease.v { top: 0; bottom: 0; left: calc(50% - 5px); width: 10px; background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.07) 35%, rgba(255, 255, 255, 0.16) 50%, rgba(0, 0, 0, 0.07) 65%, transparent); }

/* resize handles for custom screens (one-screen view) */
.handle { position: absolute; z-index: 5; display: grid; place-items: center; touch-action: none; }
.handle::before { content: ""; background: var(--ink); border-radius: 99px; }
.handle.r { top: 0; bottom: 0; right: -26px; width: 22px; cursor: ew-resize; }
.handle.r::before { width: 6px; height: 48px; }
.handle.b { left: 0; right: 0; bottom: -26px; height: 22px; cursor: ns-resize; }
.handle.b::before { width: 48px; height: 6px; }
.handle.rb { right: -26px; bottom: -26px; width: 22px; height: 22px; cursor: nwse-resize; }
.handle.rb::before { width: 12px; height: 12px; border-radius: 3px; }
.handle:hover::before, .handle.dragging::before { background: var(--blue); }
.drag-shield { position: fixed; inset: 0; z-index: 100; }
.size-badge {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 6; pointer-events: none;
  background: var(--ink); color: var(--cream); padding: 10px 16px; border-radius: var(--r);
  font: 700 20px var(--font-mono); white-space: nowrap; box-shadow: 4px 4px 0 var(--graphite);
}
.size-badge small { display: block; font: 600 11px var(--font-mono); text-align: center; opacity: 0.75; margin-top: 2px; }

/* breakpoint ruler above a custom screen */
.ruler { position: relative; height: 24px; margin-bottom: -4px; }
.ruler .tick { position: absolute; bottom: 0; transform: translateX(-50%); padding-bottom: 8px; font: 600 11px var(--font-mono); color: var(--graphite); white-space: nowrap; }
.ruler .tick::after { content: ""; position: absolute; left: 50%; bottom: 0; width: 2px; height: 6px; background: var(--ink); }
.ruler .tick.end { left: auto !important; right: 0; transform: none; color: var(--ink); }
.ruler .tick.end::after { left: auto; right: 0; }
.ruler::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--ink); }

/* blocked card (from the "site refuses to be framed" board) */
.blocked {
  flex: none; align-self: flex-start; width: min(760px, calc(100vw - 96px)); padding: 36px; display: flex; gap: 32px; align-items: flex-start;
}
.blocked svg.hanger { flex: none; }
.blocked .body { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.blocked h2 { font-size: 36px; }
.blocked p { margin: 0; font-size: 16px; line-height: 1.5; text-wrap: pretty; }
.blocked .code { align-self: flex-start; }
.blocked .acts { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.blocked .acts .btn { justify-content: space-between; min-height: 52px; white-space: normal; text-align: left; line-height: 1.3; }
.blocked .acts .row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.blocked .acts .row .btn { box-shadow: none; min-height: 48px; font-size: 14px; }
.blocked .acts .row .btn:active:not(:disabled) { transform: none; }

/* ------------------------------------------------------------------ status bar */
.status {
  grid-area: status; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
  min-height: 44px; padding: 8px var(--s5);
  background: var(--paper); border-top: var(--line);
  font: 600 12px/1.4 var(--font-mono);
}
.status #statusRight { color: var(--graphite); text-align: right; }
.status a { color: var(--graphite); }
.status a:hover { color: var(--blue); }
.status .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--ink); background: var(--dust); margin-right: 6px; vertical-align: 0; }
.status .dot.on { background: var(--blue); }
.mobile-cta { display: none; }

/* ------------------------------------------------------------------ drawer: the device library */
.scrim { position: fixed; inset: 0; z-index: 70; background: rgba(22, 19, 15, 0.35); }
.drawer {
  position: fixed; z-index: 80; top: 0; right: 0; bottom: 0; width: min(420px, 100vw);
  display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain;
  background: var(--paper); border-left: var(--line); box-shadow: -6px 0 0 var(--ink);
  animation: drawer-in 180ms ease-out both;
}
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: 16px 16px 12px 20px; border-bottom: var(--line); }
.drawer-head h2 { margin: 0; font: 800 24px/1.1 var(--font-display); letter-spacing: -0.02em; }
.drawer-tools { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px; border-bottom: var(--line); background: var(--cream); }
.drawer-tools .field { height: 44px; }
.cats { display: flex; flex-wrap: wrap; gap: 6px; }
.cats .chip { height: 36px; padding: 0 12px; font-size: 13px; }
.custom-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.custom-row .dims { background: var(--paper); }
.custom-row .t-caps { margin-right: auto; }
.lib { flex: 1; overflow: auto; padding: 4px 8px 16px; overscroll-behavior: contain; scroll-padding-top: 40px; }
.lib-group {
  position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between;
  padding: 12px 10px 6px; background: linear-gradient(var(--paper) 75%, transparent);
  font: 700 11px/1 var(--font-mono); letter-spacing: 0.04em; text-transform: uppercase; color: var(--graphite);
}
.lib-row {
  width: 100%; display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  min-height: 52px; padding: 6px 10px; text-align: left; border: 2px solid transparent; border-radius: 10px; background: transparent;
}
.lib-row:hover { border-color: var(--ink); }
.lib-row .box {
  width: 22px; height: 22px; display: grid; place-items: center; border: 2px dashed var(--ink); border-radius: 6px; color: transparent;
}
.lib-row[aria-pressed="true"] .box { background: var(--ink); border-style: solid; color: var(--cream); }
.lib-row .nm { display: block; font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-row .meta { display: block; font-size: 12.5px; color: var(--graphite); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-row .dim { font: 600 13px var(--font-mono); text-align: right; }
.lib-row .dim small { display: block; font-size: 11px; color: var(--graphite); }
.lib-empty { padding: 32px 16px; text-align: center; color: var(--graphite); }
.lib-foot { padding: 10px 16px; border-top: var(--line); font: 600 12px/1.4 var(--font-mono); color: var(--graphite); }

/* drawer settings (phone layout only) */
.drawer-settings { display: none; }

/* ------------------------------------------------------------------ dialog */
dialog.how {
  width: min(780px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; scroll-padding-top: 110px;
  background: var(--paper); color: var(--ink); border: var(--line-frame); border-radius: var(--r-frame); box-shadow: var(--shadow-hero);
}
dialog.how::backdrop { background: rgba(22, 19, 15, 0.45); }
.how-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 14px 24px; background: var(--paper); border-bottom: var(--line); }
.how-head h2 { font-size: 32px; }
.how-body { padding: 8px 24px 28px; font-size: 15.5px; line-height: 1.55; }
.how-body h3 { margin: 22px 0 8px; font: 700 13px/1.2 var(--font-mono); letter-spacing: 0.04em; text-transform: uppercase; }
.how-body ul { margin: 0; padding-left: 20px; }
.how-body li { margin: 6px 0; }
.how-body code { font: 400 13px var(--font-mono); background: var(--cream); border: 1.5px solid var(--ink); border-radius: 6px; padding: 0 5px; overflow-wrap: anywhere; }
.how-body table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.how-body th, .how-body td { text-align: left; padding: 6px 8px; border-bottom: 1.5px solid var(--dust); }
.how-body th { font: 700 11px var(--font-mono); letter-spacing: 0.04em; text-transform: uppercase; color: var(--graphite); }
.how-body td.num { font-family: var(--font-mono); text-align: right; }
.how-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.stamps-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin: 8px 0 4px; }
.snippet { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.snippet .code { flex: 1; min-width: 0; }
.kbd-grid { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; align-items: center; }
kbd { display: inline-block; min-width: 26px; text-align: center; padding: 2px 6px; border: var(--line); border-radius: 6px; box-shadow: 2px 2px 0 var(--ink); background: var(--paper); font: 700 12px var(--font-mono); }

/* ------------------------------------------------------------------ toast */
.toast {
  position: fixed; left: 50%; bottom: 72px; z-index: 200; transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  padding: 10px 16px; background: var(--ink); color: var(--cream); border-radius: var(--r); box-shadow: 4px 4px 0 var(--graphite);
  font-weight: 600; font-size: 14px; transition: opacity 160ms, transform 160ms; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------------------------------------------ narrower screens */
@media (max-width: 1180px) {
  .bar { gap: var(--s4); }
  .bar-actions .btn-ghost { padding: 0 10px; }
}

/* phones: follows the "App on a phone" board */
@media (max-width: 760px) {
  body.app { grid-template-rows: auto auto auto auto minmax(0, 1fr) auto auto; grid-template-areas: "bar" "rail" "focus" "notes" "stage" "status" "cta"; }
  .bar { flex-wrap: wrap; gap: 12px; padding: 12px 16px; min-height: auto; }
  .bar .logo { order: 1; }
  .menu-btn { display: inline-flex; order: 2; margin-left: auto; }
  .bar-url { order: 3; flex-basis: 100%; max-width: none; }
  .bar-url .btn-primary { display: none; }
  .bar-field-input { font-size: 16px; }
  .bar-spacer, .bar-actions { display: none; }
  .rail { padding: 12px 0; min-height: auto; background: var(--paper); }
  .rail-tools { display: none; }
  /* chips scroll edge to edge: the first lines up with the URL box, the rest fade out at the edge instead of being chopped */
  .chips {
    flex-wrap: nowrap; padding: 4px 16px; margin: -4px 0; scroll-padding-inline: 16px;
    -webkit-mask-image: linear-gradient(to right, transparent, #000 12px, #000 calc(100% - 32px), transparent);
    mask-image: linear-gradient(to right, transparent, #000 12px, #000 calc(100% - 32px), transparent);
  }
  .chips > * { flex: none; }
  .focusbar { padding: 10px 16px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .focusbar::-webkit-scrollbar { display: none; }
  .focusbar > * { flex: none; }
  .presets { flex-basis: auto; flex-wrap: nowrap; }
  .presets button { min-height: 44px; }
  .bar .logo { display: inline-flex; align-items: center; min-height: 44px; }
  .bar-url .field { height: 48px; }
  .recents button { min-height: 44px; }
  .cats .chip { height: 44px; }
  .dims { height: 48px; }
  .dims input { height: 44px; }
  .shot-cap { min-height: 44px; flex-wrap: nowrap; }
  .shot-name { min-width: 0; }
  .notes { max-height: 30vh; overflow: auto; }
  /* phones: notes are two lines until tapped, so the frame keeps the room */
  .note .msg { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
  .note.open .msg { display: block; -webkit-line-clamp: unset; }
  .note .actions { display: none; }
  .note.open .actions { display: flex; }
  .note { flex-wrap: wrap; padding: 10px 16px; font-size: 14px; }
  .note .msg { flex: 1 1 calc(100% - 110px); }
  .note .actions { order: 3; flex-basis: 100%; padding-left: 0; }
  .note .actions:empty { display: none; }
  .note { position: relative; padding-right: 60px; }
  .note .x { position: absolute; top: 2px; right: 8px; margin: 0; width: 44px; height: 44px; }
  .stage { scroll-snap-type: x mandatory; overscroll-behavior-x: contain; }
  .canvas { gap: 0; padding: 20px 0 24px; align-items: stretch; }
  .canvas .shot { width: 100vw; align-items: center; scroll-snap-align: center; padding: 0 16px; }
  .canvas .shot-cap { width: 100%; }
  .canvas.focused .shot { width: auto; }
  .stage:has(.canvas.focused) { scroll-snap-type: none; }
  .blocked { width: calc(100vw - 32px); margin: 0 16px; flex-direction: column; padding: 24px; gap: 16px; scroll-snap-align: center; }
  .blocked h2 { font-size: 28px; }
  .blocked .acts .row { grid-template-columns: 1fr; }
  .status { padding: 8px 16px; min-height: 0; }
  .status #summary { display: none; } /* stamps carry the verdicts; the footer is the swipe hint (Mobile board) */
  .status #statusRight { text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mobile-cta { grid-area: cta; display: block; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--paper); border-top: var(--line); }
  .mobile-cta .btn { width: 100%; min-height: 56px; font-size: 17px; border-radius: 14px; }
  .drawer-settings { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border-bottom: var(--line); }
  .drawer-settings .row { display: flex; flex-wrap: wrap; gap: 8px; }
  .toast { bottom: 96px; }
  .handle { display: none; }
}

/* phones, short viewports, browser zoom: the drawer scrolls as one, so the device list gets the room */
@media (max-height: 640px), (max-width: 760px) {
  .drawer { scroll-padding-top: 40px; }
  .lib { flex: none; overflow: visible; }
}

/* how it works — plain-English version */
.how-lede { font-size: 17px; margin: 10px 0 4px; }
.how-verdicts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 12px 16px; align-items: center; margin: 8px 0; }
.how-verdicts .stamp { justify-self: start; }
.how-prompt { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.55; padding: 12px 14px; background: var(--cream); border: var(--line); border-radius: var(--r); }
.how-body .snippet { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0; }
.how-safe { padding: 10px 12px; background: var(--cream); border: var(--line); border-radius: var(--r); }
.how-q { border: var(--line); border-radius: var(--r); background: var(--paper); margin: 8px 0; }
.how-q summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; padding: 8px 14px; cursor: pointer; list-style: none; font-weight: 700; }
.how-q summary::-webkit-details-marker { display: none; }
.how-q summary::after { content: "+"; flex: none; display: grid; place-items: center; width: 28px; height: 28px; border: var(--line); border-radius: 7px; font: 700 16px/1 var(--font-mono); }
.how-q[open] summary::after { content: "–"; background: var(--ink); color: var(--cream); }
.how-q > p, .how-q > ul, .how-q > div { margin: 0 14px 14px; }
.how-nerd { background: var(--cream); }
@media (max-width: 520px) { .how-verdicts { grid-template-columns: minmax(0, 1fr); gap: 6px; } }

/* ------------------------------------------------------------------ sticker popup (TIGHT / SPILLING → what it means, fix prompt, show me where) */
.stamp-btn { cursor: pointer; font-family: var(--font-mono); transition: transform 120ms, box-shadow 120ms; }
.stamp-btn:hover { box-shadow: 4px 4px 0 var(--ink); }
.stamp-btn:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.stamp-btn[aria-expanded="true"] { box-shadow: 4px 4px 0 var(--ink); }
.vpop {
  position: fixed; z-index: 60; display: flex; flex-direction: column; gap: 12px;
  padding: 16px 18px 18px; background: var(--paper); border: var(--line); border-radius: 16px; box-shadow: var(--shadow-hero, 6px 6px 0 var(--ink));
  max-height: calc(100vh - 24px); overflow: auto; overscroll-behavior: contain;
}
.vpop[hidden] { display: none; }
.vpop p { margin: 0; font-size: 15px; line-height: 1.5; }
.vpop-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.vpop-x { width: 36px; height: 36px; display: grid; place-items: center; border: 2px solid transparent; border-radius: 8px; background: transparent; color: var(--ink); cursor: pointer; }
.vpop-x:hover { border-color: var(--ink); }
.vpop-title { margin: 0; font: 800 21px/1.2 var(--font-display); letter-spacing: -0.01em; }
.vpop-culprit { display: flex; flex-direction: column; gap: 4px; }
.vpop-culprit span { font: 700 11px var(--font-mono); letter-spacing: .04em; text-transform: uppercase; color: var(--graphite); }
.vpop-culprit code { font: 600 13px/1.4 var(--font-mono); overflow-wrap: anywhere; background: var(--cream); border: 1.5px solid var(--dust); border-radius: 6px; padding: 4px 7px; }
.vpop-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.vpop-acts .btn { flex: 1 1 150px; }
.vpop-prompt summary { cursor: pointer; font-weight: 600; font-size: 14px; line-height: 1.4; padding: 6px 0; }
.vpop-prompt summary span { font-weight: 400; color: var(--graphite); }
.vpop-prompt pre {
  margin: 6px 0 0; max-height: 180px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere;
  font: 500 12px/1.5 var(--font-mono); background: var(--cream); border: 1.5px solid var(--dust); border-radius: 8px; padding: 10px 12px;
}
@media (max-width: 760px) {
  .vpop { left: 8px; right: 8px; bottom: 8px; top: auto; width: auto; max-height: 82vh; border-radius: 18px; }
}
