:root {
  --bg: #ffffff;
  --surface: #f5f6f8;
  --ink: #111827;
  --ink-2: #5b6472;
  --line: #e3e6ea;
  --line-strong: #cfd4da;
  --accent: #2563eb;
  --accent-ink: #ffffff;
  --ok: #15803d;
  --danger: #b91c1c;
  --focus: 0 0 0 3px rgb(37 99 235 / 0.3);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #181b21;
    --ink: #f3f4f6;
    --ink-2: #9aa3af;
    --line: #262b33;
    --line-strong: #353b45;
    --accent: #3b82f6;
    --ok: #4ade80;
    --danger: #f87171;
    --focus: 0 0 0 3px rgb(59 130 246 / 0.4);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-underline-offset: 2px; }
[hidden] { display: none !important; }

.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 20px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); text-decoration: none; }
.who { color: var(--ink-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
main { max-width: 36rem; margin: 0 auto; padding: 24px 20px 32px; }

h1 { font-size: 20px; line-height: 1.3; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 15px; margin: 32px 0 6px; }
.dest { font-weight: 400; color: var(--ink-2); }
.muted { color: var(--ink-2); }
.hint { color: var(--ink-2); font-size: 13px; margin: 6px 0 0; }

.field { display: block; border: 0; padding: 0; margin: 20px 0 0; min-width: 0; }
.label { display: block; font-weight: 600; font-size: 13px; margin: 0 0 6px; padding: 0; }
input:not([type=radio]), textarea { width: 100%; font: inherit; color: inherit; background: var(--bg); border: 1px solid var(--line-strong); border-radius: 7px; padding: 8px 11px; }
input::placeholder, textarea::placeholder { color: var(--ink-2); opacity: 0.75; }
textarea { resize: vertical; min-height: 8.5rem; display: block; }
input:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, .segmented label:has(input:focus-visible) { outline: none; box-shadow: var(--focus); border-color: var(--accent); }

.segmented { display: inline-flex; padding: 3px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); }
.segmented label { min-width: 5.5rem; text-align: center; padding: 4px 14px; border-radius: 6px; font-size: 14px; cursor: pointer; color: var(--ink-2); }
.segmented label:has(input:checked) { background: var(--bg); color: var(--ink); font-weight: 500; box-shadow: 0 1px 2px rgb(0 0 0 / 0.12), 0 0 0 1px var(--line); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }

/* what was picked: screenshot beside what and where */
.picked { display: flex; gap: 14px; align-items: flex-start; margin: 18px 0 0; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.thumb { flex: none; width: 128px; height: 84px; border-radius: 6px; overflow: hidden; background: var(--bg); border: 1px solid var(--line); }
.thumb a, .thumb img { display: block; width: 100%; height: 100%; }
.thumb img { object-fit: contain; object-position: center; }
.thumb.empty { display: grid; place-items: center; font-size: 12px; color: var(--ink-2); text-align: center; padding: 6px; }
.picked-text { min-width: 0; flex: 1; font-size: 13px; }
.picked-what { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.picked-where { color: var(--ink-2); margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

button { font: inherit; font-size: 14px; font-weight: 500; color: var(--ink); background: var(--bg); border: 1px solid var(--line-strong); border-radius: 7px; padding: 7px 14px; cursor: pointer; }
button:hover { background: var(--surface); }
button:disabled { opacity: 0.6; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover { filter: brightness(1.08); background: var(--accent); }
button.link { border: 0; background: none; padding: 0; margin-top: 6px; font-size: 13px; font-weight: 400; color: var(--ink-2); text-decoration: underline; text-underline-offset: 2px; }
button.link:hover { color: var(--ink); background: none; }
.button { display: inline-block; font-size: 14px; font-weight: 500; border-radius: 7px; padding: 7px 14px; text-decoration: none; background: var(--accent); color: var(--accent-ink); }

.actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 28px; }
.keys { margin-right: auto; font-size: 12px; color: var(--ink-2); }
.error { color: var(--danger); font-size: 14px; margin: 16px 0 0; }

.waiting { color: var(--ink-2); padding: 48px 0; text-align: center; }
.filed { text-align: center; padding-top: 24px; }
.filed .check { width: 44px; height: 44px; margin: 0 auto 12px; display: grid; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); font-size: 22px; font-weight: 700; }
.filed .actions { justify-content: center; }
.filed pre { text-align: left; }

pre, code, kbd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
pre { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
kbd { border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; background: var(--surface); white-space: nowrap; }
.steps { padding-left: 1.2em; }
.steps li { margin: 4px 0; }
@media (max-width: 420px) {
  .picked { flex-direction: column; }
  .thumb { width: 100%; height: 150px; }
}

/* the drawer (/drawer in the page's iframe, /new on its own): header and footer stay, the form scrolls between */
body.drawer { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 12px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h1 { font-size: 17px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-body { flex: 1; overflow-y: auto; max-width: none; margin: 0; padding: 4px 20px 24px; overscroll-behavior: contain; }
.drawer-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--bg); }
.drawer-foot .keys { margin-right: auto; }
button.icon { border: 0; background: none; width: 32px; height: 32px; padding: 0; border-radius: 6px; color: var(--ink-2); font-size: 15px; flex: none; }
button.icon:hover { background: var(--surface); color: var(--ink); }
.center { text-align: center; padding: 40px 8px 16px; }
.center h2 { margin: 12px 0 6px; font-size: 17px; }
.center .primary { margin-top: 14px; min-width: 9rem; }
.picked-actions { display: flex; gap: 14px; margin-top: 6px; }
.picked-actions .link { margin-top: 0; }
.add-pick { margin-top: 18px; }
/* /new on its own: a page, not a panel */
@media (min-width: 641px) {
  body.drawer.standalone { height: auto; overflow: visible; display: block; }
  body.drawer.standalone .drawer-head, body.drawer.standalone .drawer-body, body.drawer.standalone .drawer-foot { max-width: 36rem; margin: 0 auto; }
  body.drawer.standalone .drawer-head { border-bottom: 0; padding-top: 28px; }
  body.drawer.standalone .drawer-foot { border-top: 0; justify-content: flex-end; }
}
/* no keyboard shortcut to point out on a touch screen */
@media (pointer: coarse) { .keys { display: none; } }
