@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("/fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("/fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --overlay: #1A2229;
  --panel: #243039;
  --ink: #D6DEE6;
  --selection: #5EC8E5;
  --slug: #E8D5A3;
  --warn: #C45C26;
  --panel-hot: color-mix(in srgb, var(--overlay) 88%, var(--selection) 12%);
  --muted: color-mix(in srgb, var(--ink) 55%, transparent);
  --line: #2E3A44;
  --ui: "Atkinson Hyperlegible", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--overlay);
  color: var(--ink);
  font: 14px/1.4 var(--ui);
  min-width: 900px;
  color-scheme: dark;
}
button, input { font: inherit; color: inherit; }
a { color: var(--selection); }
:focus-visible {
  outline: 2px solid var(--selection);
  outline-offset: 2px;
}

.bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 36px;
  padding: 0 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.brand { letter-spacing: 0.02em; }
.brand-sc { color: var(--slug); font-family: var(--mono); font-weight: 500; }
.brand-sub { color: var(--muted); }
.seg { display: flex; gap: 0; border: 1px solid var(--line); border-radius: 2px; overflow: hidden; }
.seg-btn {
  padding: 4px 12px;
  color: var(--muted);
  text-decoration: none;
  background: transparent;
}
.seg-btn.is-on { color: var(--ink); background: color-mix(in srgb, var(--panel) 70%, var(--selection) 30%); }
.docs-chrome { display: flex; align-items: center; gap: 8px; }
.docs-chrome.hidden { display: none !important; }
.lock-btn { font-size: 12px; }
.bar-right { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.led {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 25%, transparent);
  cursor: pointer;
  position: relative;
}
.led::after {
  content: "";
  position: absolute;
  inset: -12px;
}
.led.ok {
  background: var(--selection);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--selection) 25%, transparent);
}
.led.bad { background: var(--warn); }
.port {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.hidden { display: none !important; }

.dash {
  display: grid;
  grid-template-columns: minmax(0, 58fr) minmax(0, 42fr);
  gap: 8px;
  padding: 12px;
  height: calc(100vh - 36px);
  min-height: 0;
}
.dash.is-hot .zone { background: var(--panel-hot); border-color: var(--selection); }
.dash.is-hot .handle { background: var(--selection); }

.capture { display: flex; flex-direction: column; min-height: 0; padding: 8px; }
.zone {
  position: relative;
  flex: 1;
  min-height: 280px;
  background: var(--overlay);
  border: 2px solid var(--selection);
  border-radius: 0;
  cursor: pointer;
}
.handle {
  position: absolute;
  width: 6px; height: 6px;
  background: var(--overlay);
  border: 1px solid var(--selection);
  z-index: 2;
}
.handle.nw { top: -4px; left: -4px; }
.handle.ne { top: -4px; right: -4px; }
.handle.sw { bottom: -4px; left: -4px; }
.handle.se { bottom: -4px; right: -4px; }
.zone.is-hot .handle, .dash.is-hot .handle { background: var(--selection); }
.crosshair, .crosshair::before, .crosshair::after { pointer-events: none; }
.crosshair::before, .crosshair::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  background: color-mix(in srgb, var(--selection) 28%, transparent);
}
.crosshair::before { width: 24px; height: 1px; transform: translate(-50%, -50%); }
.crosshair::after { width: 1px; height: 24px; transform: translate(-50%, -50%); }
.zone-copy {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  text-align: center;
}
.zone-title { font-size: 20px; font-weight: 700; }
.zone-sub { color: var(--muted); margin-top: 4px; }
.loadbar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--selection);
  transform-origin: left center;
  animation: load 1.1s ease-in-out infinite;
}
.loadbar[hidden] { display: none; }
@keyframes load {
  0% { transform: scaleX(0.08); }
  50% { transform: scaleX(0.85); }
  100% { transform: scaleX(0.08); }
}
.formats { margin: 10px 0 0; color: var(--muted); font-size: 12px; }
.privacy { margin: 4px 0 0; color: var(--warn); opacity: 0.8; font-size: 12px; max-width: 36em; }
.actions { display: flex; gap: 8px; margin-top: 10px; }
.btn {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 6px 12px;
  cursor: pointer;
}
.btn:hover { border-color: var(--selection); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-text {
  background: none;
  border: 0;
  padding: 2px 4px;
  color: var(--muted);
  cursor: pointer;
  border-radius: 2px;
}
.btn-text:hover { color: var(--ink); }
.btn-text[aria-pressed="true"] { color: var(--selection); }
.sr-file { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

.side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel);
  border: 1px solid var(--line);
}
.result { padding: 12px; border-bottom: 1px solid var(--line); }
.kicker {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.empty-line { color: var(--muted); margin: 0; }
.slug {
  font: 500 22px/1.25 var(--mono);
  color: var(--slug);
  word-break: break-all;
  user-select: all;
  margin: 0 0 8px;
}
.slug.small { font-size: 12px; margin: 8px 0 4px; color: var(--muted); }
.slug.small .lab { font-family: var(--ui); margin-right: 6px; color: var(--muted); }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.err-msg { color: var(--warn); margin: 0 0 8px; }
.err-detail {
  margin: 0;
  max-height: 12em;
  overflow: auto;
  font: 12px/1.35 var(--mono);
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-all;
}

.hist-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px 4px;
}
.hist-head h2 { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.history { flex: 1; overflow: auto; min-height: 0; padding: 4px 0 12px; }
.hist-row {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 8px;
  align-items: center;
  height: 56px;
  padding: 0 12px;
  border-top: 1px solid var(--line);
}
.hist-row img, .thumb-ph {
  width: 48px; height: 48px;
  object-fit: cover;
  border: 2px solid color-mix(in srgb, var(--selection) 40%, var(--line));
  background: var(--overlay);
}
.thumb-ph { display: block; }
.hist-main { min-width: 0; }
.hist-slug {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--slug);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hist-meta { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-acts { display: flex; gap: 4px; }
.hist-acts .btn, .hist-acts .btn-text { font-size: 12px; padding: 4px 6px; }
.x { font-size: 14px; line-height: 1; color: var(--muted); }
.show-older { display: block; width: calc(100% - 24px); margin: 8px 12px 0; }

.docs {
  display: grid;
  grid-template-columns: 220px 1fr;
  height: calc(100vh - 36px);
  min-height: 0;
}
.docs-nav {
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow: auto;
  padding: 12px 0;
  font-size: 13px;
}
.docs-kicker {
  padding: 0 12px 8px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.docs-nav a {
  display: block;
  padding: 5px 12px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 12px;
  border-left: 2px solid transparent;
}
.docs-nav a.is-on { border-left-color: var(--selection); color: var(--selection); background: color-mix(in srgb, var(--panel) 80%, var(--selection) 20%); }
.docs-div { height: 1px; background: var(--line); margin: 8px 12px; }
.docs-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.docs-toolbar { padding: 8px 16px; border-bottom: 1px solid var(--line); }
.docs-body {
  flex: 1;
  overflow: auto;
  padding: 20px 28px 48px;
  font-size: 15px;
  max-width: 52rem;
}
.docs-body h1, .docs-body h2, .docs-body h3 { font-weight: 700; line-height: 1.25; }
.docs-body h1 { font-size: 1.6em; }
.docs-body h2 { font-size: 1.25em; margin-top: 1.4em; }
.docs-body table { border-collapse: collapse; width: 100%; font-size: 13px; }
.docs-body th, .docs-body td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.docs-body th { background: var(--panel); }
.docs-body pre, .docs-raw {
  font: 13px/1.45 var(--mono);
  background: var(--panel);
  padding: 12px;
  overflow: auto;
  border-radius: 2px;
}
.docs-body code { font-family: var(--mono); font-size: 0.9em; }
.docs-body pre code { font-size: 13px; }
.docs-raw { margin: 0; white-space: pre-wrap; word-break: break-word; }

@media (max-width: 1099px) {
  .dash { grid-template-columns: 1fr; height: auto; }
  .zone { min-height: 280px; height: 320px; }
  .side { min-height: 420px; }
}

@media (prefers-reduced-motion: reduce) {
  .loadbar { animation: none; }
}
