/* ---------------------------------------------------------------------------
   Drop: one instrument faceplate on a dark bench.
   The whole tool is a single surface cut into cells by hairlines: no cards
   inside cards, no shadows, no gradients. Colour only reports state: orange is
   data in motion or something waiting for an answer, green is verified or
   direct, amber is degraded or held, red has failed. Everything measured (room
   code, sizes, rates, hashes, times) is set in tabular monospace.
   ------------------------------------------------------------------------- */
:root {
  --bg: #09090a;            /* bench behind the faceplate */
  --s1: #111112;            /* faceplate */
  --s2: #18181a;            /* raised: buttons, hover */
  --s3: #212124;            /* pressed */
  --inset: #0b0b0c;         /* fields, readouts, bays */
  --line: #222225;          /* hairline between cells */
  --line-2: #2f2f33;        /* control outline */
  --line-3: #47474c;        /* hover outline, tick marks */
  --text: #ecebe7;
  --text-2: #a9a8a3;
  --text-3: #7f7e79;
  --ink: #111112;           /* text on a light control */
  --accent: #ff6f35;
  --accent-line: rgba(255, 111, 53, 0.5);
  --bay-over: #1d1310;      /* the drop bay while files hover over the page */
  --ok: #4fc48c;
  --warn: #e3b341;
  --bad: #f0605d;
  --sans: Inter, "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --pad: 20px;              /* horizontal padding of every cell */
  --col0: 172px;            /* first column: the brand cell and the link-state cell share an edge */
  --edge: max(20px, calc((100vh - 960px) / 2));   /* bench above and below the faceplate */
  color-scheme: dark;
}
@supports (height: 100dvh) {
  :root { --edge: max(20px, calc((100dvh - 960px) / 2)); }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
/* The body is the faceplate. Its children stay direct children so the QR modal can make each one inert. */
body {
  display: flex;
  flex-direction: column;
  width: min(1440px, calc(100% - 40px));
  height: min(960px, calc(100vh - 40px));
  height: min(960px, calc(100dvh - 40px));
  margin: var(--edge) auto;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--s1);
  color: var(--text);
  font: 13px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
code, kbd { font-family: var(--mono); }
kbd {
  display: inline-block;
  min-width: 18px;
  padding: 0 4px;
  border: 1px solid var(--line-2);
  border-radius: 3px;
  background: var(--s2);
  color: var(--text-2);
  font-size: 10.5px;
  line-height: 15px;
  text-align: center;
}
svg { width: 16px; height: 16px; flex: none; }
/* Sprite icons inherit their stroke from the <use> that draws them. */
use { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: miter; }
a { color: var(--text); text-decoration-color: var(--text-3); text-underline-offset: 2px; }
a:hover { text-decoration-color: var(--accent); }
::selection { background: rgba(255, 111, 53, 0.32); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Small capital labels: cell names, list names, kinds. */
.eyebrow, .list-head h3, .clip-head .kind {
  color: var(--text-3);
  font: 600 10.5px/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- controls ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line-2);
  border-radius: 5px;
  background: var(--s2);
  color: var(--text);
  font: 500 12.5px/1 var(--sans);
  white-space: nowrap;
  cursor: pointer;
}
.btn svg { width: 14px; height: 14px; color: var(--text-2); }
.btn:hover { background: var(--s3); border-color: var(--line-3); }
.btn:hover svg { color: var(--text); }
.btn:active { background: var(--s2); }
.btn:focus-visible, .check input:focus-visible, .dropzone:focus-visible, .chip-btn:focus-visible, .link-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.btn:disabled { opacity: 0.4; cursor: default; }
.btn:disabled:hover { background: var(--s2); border-color: var(--line-2); }
.btn.primary { background: var(--text); border-color: var(--text); color: var(--ink); font-weight: 600; }
.btn.primary svg, .btn.primary:hover svg { color: var(--ink); }
.btn.primary:hover { background: #fff; border-color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--s2); color: var(--text); }
.btn.ghost:disabled:hover { background: transparent; color: var(--text-2); }
.btn.small { height: 24px; padding: 0 8px; border-radius: 4px; font-size: 12px; gap: 5px; }
.btn.small svg { width: 13px; height: 13px; }
.btn.icon { width: 28px; padding: 0; }
.btn.small.icon { width: 24px; }
.btn.danger:hover, .btn.danger:hover svg { color: var(--bad); }

/* ---------- header: brand, room, access, share, join ---------- */
.topbar {
  display: grid;
  grid-template-columns: var(--col0) minmax(0, 1fr);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 var(--pad); border-right: 1px solid var(--line); }
.brand-mark { width: 20px; height: 20px; }
.brand-block { fill: var(--accent); }
.brand h1 { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }

.room { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; min-width: 0; }
.cell {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  min-width: 0;
  padding: 12px var(--pad) 13px;
  border-right: 1px solid var(--line);
}
.cell:last-child { border-right: 0; }
.cell-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.topbar .btn { height: 30px; }

/* The room code is the instrument's readout. Click it to copy the link. */
.room-code {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 calc(10px - 0.12em) 0 10px;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  background: var(--inset);
  color: var(--text);
  font-size: 19px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.12em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  cursor: pointer;
}
.room-code:hover { border-color: var(--line-3); }

/* Access mode: a state mark, the mode, and a swap glyph. */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 9px 0 10px;
  border: 1px solid var(--line-2);
  border-radius: 5px;
  background: transparent;
  color: var(--text);
  font: 500 12.5px/1 var(--sans);
  white-space: nowrap;
}
.chip-btn { cursor: pointer; }
.chip-btn:hover { background: var(--s2); border-color: var(--line-3); }
.chip svg { width: 13px; height: 13px; color: var(--text-3); }
.chip-btn:hover svg { color: var(--text); }
.mark { flex: none; width: 7px; height: 7px; border-radius: 1.5px; background: var(--text-3); }
.chip[data-kind="secret"] .mark { background: var(--ok); }
.chip[data-kind="code"] .mark { background: var(--warn); }

.join input {
  width: 184px;
  min-width: 0;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line-2);
  border-radius: 5px;
  background: var(--inset);
  color: var(--text);
  font: 500 12.5px var(--mono);
  letter-spacing: 0.03em;
}
.join input:hover { border-color: var(--line-3); }
.join input:focus { outline: 0; border-color: var(--text-2); }
.join input::placeholder { color: var(--text-3); font-family: var(--sans); letter-spacing: 0; }
.join input[aria-invalid="true"], .join input[aria-invalid="true"]:focus { border-color: var(--bad); }

/* ---------- status strip: link state, verification, peers, network, lock ---------- */
.statusbar {
  display: flex;
  align-items: stretch;
  min-height: 42px;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}
.statusbar > * { display: flex; align-items: center; padding: 0 var(--pad); border-right: 1px solid var(--line); }
.badge { gap: 9px; min-width: var(--col0); font-weight: 600; white-space: nowrap; }
/* Link lamp: hollow while nothing is connected, filled once a peer is. */
.badge .dot { flex: none; width: 8px; height: 8px; border: 1.5px solid var(--text-3); border-radius: 2px; }
.badge[data-mode="bc"] .dot { border-color: var(--text-2); background: var(--text-2); }
.badge[data-mode="lan"] .dot, .badge[data-mode="p2p"] .dot { border-color: var(--ok); background: var(--ok); }
.badge[data-mode="relay"] .dot { border-color: var(--warn); background: var(--warn); }
.badge[data-mode="none"] { color: var(--text-2); }

/* Sentence with inline buttons, so it stays a block: flex would eat the spaces around them. */
.statusbar > .wait-hint { display: block; align-self: center; min-width: 0; padding-block: 6px; border-right: 0; color: var(--text-2); }
.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: 500 12.5px var(--sans);
  text-decoration: underline;
  text-decoration-color: var(--text-3);
  text-underline-offset: 3px;
  cursor: pointer;
}
.link-btn:hover { text-decoration-color: var(--accent); }
.link-btn:focus-visible { border-radius: 2px; }

.sas { gap: 10px; }
.sas-label { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); white-space: nowrap; }
.sas-label svg { width: 14px; height: 14px; color: var(--ok); }
.sas-emoji {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 calc(8px - 0.1em) 0 8px;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  background: var(--inset);
  font-size: 16px;
  line-height: 1;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.peers { gap: 6px 16px; min-width: 0; margin: 0; overflow: hidden; list-style: none; }
.peers:empty { display: none; }
.peer { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.avatar {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background: hsl(var(--hue, 0) 26% 64%);   /* a quiet identity tint, well below the accent's chroma */
  color: var(--ink);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}
.peer-sas { font-size: 13px; letter-spacing: 0.04em; }

.statusbar > .status-right { flex: none; margin-left: auto; padding: 0; border-right: 0; border-left: 1px solid var(--line); }
.net-info { padding: 0 var(--pad); color: var(--text-3); font: 11.5px var(--mono); white-space: nowrap; }
.net-info b { color: var(--text-2); font-weight: 500; }

/* Lock: a slide switch. The label sits left of the track. */
.switch {
  position: relative;
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 var(--pad);
  border-left: 1px solid var(--line);
  color: var(--text-2);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.switch:hover { color: var(--text); }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-label { order: 1; display: inline-flex; align-items: center; gap: 6px; }
.switch-label svg { width: 13px; height: 13px; }
.switch-track {
  order: 2;
  position: relative;
  width: 30px;
  height: 16px;
  border: 1px solid var(--line-3);
  border-radius: 4px;
  background: var(--inset);
}
.switch-thumb { position: absolute; top: 2px; left: 2px; width: 12px; height: 10px; border-radius: 2px; background: var(--text-3); }
.switch input:checked + .switch-track { border-color: var(--warn); }
.switch input:checked + .switch-track .switch-thumb { left: 14px; background: var(--warn); }
.switch input:checked ~ .switch-label { color: var(--warn); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- two panes, split by a hairline (the grid gap shows the line colour) ---------- */
.layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 1px;
  background: var(--line);
}
.panel { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--s1); }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 62px;
  padding: 12px var(--pad);
}
.panel-title { min-width: 0; }
.panel-head h2 { font-size: 14px; font-weight: 650; letter-spacing: -0.005em; }
.panel-sub { margin-top: 2px; color: var(--text-3); font-size: 12px; }
.panel-actions { display: flex; flex: none; gap: 6px; margin-right: -8px; }
.panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-3) transparent;
}

/* ---------- drop bay: an inset field with corner ticks ---------- */
.dropzone {
  --tick: #56565c;
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  min-height: 100px;
  margin: 2px var(--pad) 16px;
  padding: 16px 20px;
  background: var(--inset);
  cursor: pointer;
}
/* A full outline masked down to its four corners, so the ticks snap to the pixel grid like every other hairline. */
.dropzone::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid var(--tick);
  pointer-events: none;
  --corner: linear-gradient(#000, #000);
  -webkit-mask: var(--corner) 0 0 / 14px 14px no-repeat, var(--corner) 100% 0 / 14px 14px no-repeat, var(--corner) 0 100% / 14px 14px no-repeat, var(--corner) 100% 100% / 14px 14px no-repeat;
  mask: var(--corner) 0 0 / 14px 14px no-repeat, var(--corner) 100% 0 / 14px 14px no-repeat, var(--corner) 0 100% / 14px 14px no-repeat, var(--corner) 100% 100% / 14px 14px no-repeat;
}
.dropzone:hover { --tick: var(--text-2); }
.dropzone.over { --tick: var(--accent); background: var(--bay-over); }
.dz-icon { display: grid; place-items: center; color: var(--text-3); }
.dz-icon svg { width: 20px; height: 20px; }
.dropzone.over .dz-icon { color: var(--accent); }
.dz-text { flex: 1 1 220px; min-width: 0; }
.dz-title { font-size: 13.5px; font-weight: 600; }
.dz-sub { margin-top: 2px; color: var(--text-3); font-size: 12px; }
.dz-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.staged {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 var(--pad) 16px;
  padding: 7px 7px 7px 12px;
  border: 1px solid var(--line-2);
  border-radius: 5px;
  color: var(--text-2);
  font-size: 12.5px;
}

/* ---------- incoming offers: the one thing that waits for an answer ---------- */
.offers { display: flex; flex-direction: column; gap: 8px; padding: 0 var(--pad) 16px; }
.offers:empty { display: none; }
.offer { padding: 12px 12px 12px 14px; border: 1px solid var(--accent-line); border-radius: 5px; background: var(--s2); }
.offer-head { display: flex; align-items: center; gap: 9px; }
.offer-head svg { width: 14px; height: 14px; color: var(--accent); }
.offer-head b { font-weight: 600; }
.offer-files {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 10px 0 12px;
  padding: 9px 0 0;
  border-top: 1px solid var(--line-2);
  list-style: none;
}
.offer-files li { display: flex; justify-content: space-between; gap: 12px; color: var(--text-2); font-size: 12.5px; }
.offer-files .name { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.offer-files .size { flex: none; font: 12px var(--mono); font-variant-numeric: tabular-nums; }
.offer-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }

/* ---------- transfer queue ---------- */
.list-head {
  display: flex;
  align-items: center;
  gap: 6px 14px;
  min-height: 38px;
  padding: 0 12px 0 var(--pad);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.list-head h3 { margin-right: auto; }
.check { display: inline-flex; align-items: center; gap: 7px; color: var(--text-2); font-size: 12.5px; cursor: pointer; user-select: none; }
.check:hover { color: var(--text); }
.check input {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 14px;
  height: 14px;
  margin: 0;
  border: 1px solid var(--line-3);
  border-radius: 3px;
  background: var(--inset) center / 10px 10px no-repeat;
  cursor: pointer;
}
.check input:checked {
  border-color: var(--text);
  background-color: var(--text);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M1.5 5.2 4 7.7l4.5-5.4' fill='none' stroke='%23111112' stroke-width='1.6'/%3E%3C/svg%3E");
}
.transfers, .feed { margin: 0; padding: 0; list-style: none; }
.transfers:empty, .feed:empty { display: none; }
.empty { padding: 14px var(--pad); color: var(--text-3); font-size: 12.5px; }

/* A row is two lines; its bottom hairline doubles as the progress track. */
.xfer {
  position: relative;
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 12px;
  padding: 10px 12px 11px var(--pad);
  border-bottom: 1px solid var(--line);
}
.xfer:hover { background: #141415; }
.xfer-icon { align-self: start; display: grid; place-items: center; height: 19px; color: var(--text-3); }
.xfer-icon svg { width: 14px; height: 14px; }
.xfer[data-state="sending"] .xfer-icon, .xfer[data-state="receiving"] .xfer-icon { color: var(--accent); }
.xfer[data-state="paused"] .xfer-icon { color: var(--warn); }
.xfer[data-state="failed"] .xfer-icon { color: var(--bad); }
.xfer-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.xfer-top { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.xfer-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; font-weight: 550; }
.xfer-size { flex: none; color: var(--text-2); font: 12px var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; pointer-events: none; }
.bar-fill { height: 100%; width: 0; background: var(--accent); }
/* The line shows only where a file stands partway: moving (orange) or held (amber). */
.xfer[data-state="paused"] .bar-fill { background: var(--warn); }
.xfer[data-state="done"] .bar-fill, .xfer[data-state="failed"] .bar-fill, .xfer[data-state="cancelled"] .bar-fill, .xfer[data-state="declined"] .bar-fill { background: transparent; }
.xfer-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 14px; color: var(--text-3); font-size: 12px; }
/* Figures (percent, rate, time left, average) read as telemetry in mono; sentences stay in the text face. */
.xfer-status { color: var(--text-2); font-variant-numeric: tabular-nums; }
.xfer[data-state="sending"] .xfer-status, .xfer[data-state="receiving"] .xfer-status, .xfer[data-state="done"] .xfer-status { font: 11.5px var(--mono); }
.xfer[data-state="failed"] .xfer-status, .xfer[data-state="cancelled"] .xfer-status, .xfer[data-state="declined"] .xfer-status { color: var(--bad); }
.xfer[data-state="paused"] .xfer-status { color: var(--warn); }
.verified { display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); font: 11.5px var(--mono); white-space: nowrap; }
.verified svg { width: 12px; height: 12px; color: var(--ok); }
.verified code { color: var(--text-3); }
/* A fixed-width action column keeps every size on one right edge. */
.xfer-actions { display: flex; align-items: center; justify-content: flex-end; gap: 2px; min-width: 90px; }

/* ---------- clipboard ---------- */
.compose { margin: 0 var(--pad) 16px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--inset); }
.compose:hover { border-color: var(--line-3); }
.compose:focus-within { border-color: var(--text-2); }
.compose textarea {
  display: block;
  width: 100%;
  min-height: 72px;
  max-height: 320px;
  padding: 10px 12px;
  border: 0;
  border-radius: 6px 6px 0 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: 13.5px/1.5 var(--sans);
  resize: vertical;
}
.compose textarea::placeholder { color: var(--text-3); }
.compose-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 6px 6px 12px; border-top: 1px solid var(--line); }
.hint { color: var(--text-3); font-size: 12px; }

.feed { border-top: 1px solid var(--line); }
.clip-panel .empty { border-top: 1px solid var(--line); }
/* Who, when and what on the first line with the actions at its right; the content below. */
.clip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "head act" "body body";
  align-items: center;
  gap: 6px 12px;
  padding: 9px var(--pad) 14px;
  border-bottom: 1px solid var(--line);
}
.clip-head { grid-area: head; display: flex; align-items: baseline; gap: 10px; min-width: 0; color: var(--text-3); white-space: nowrap; }
.clip-head .who { overflow: hidden; text-overflow: ellipsis; color: var(--text); font-size: 12.5px; font-weight: 600; }
.clip-head > span:not(.who):not(.kind) { font: 11.5px var(--mono); font-variant-numeric: tabular-nums; }
.clip-head .kind { padding: 3px 5px 2px; border: 1px solid var(--line-2); border-radius: 3px; font-size: 9.5px; }
.clip-actions { grid-area: act; display: flex; align-items: center; gap: 2px; margin-right: -8px; }
.clip-actions .btn { background: transparent; border-color: transparent; color: var(--text-2); }
.clip-actions .btn:hover { background: var(--s2); color: var(--text); }
.clip-meta { margin-right: 8px; color: var(--text-3); font: 11.5px var(--mono); font-variant-numeric: tabular-nums; }
.clip-text, .clip-code, .clip-img-wrap { grid-area: body; min-width: 0; }
.clip-text { max-height: 260px; overflow: auto; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; scrollbar-width: thin; scrollbar-color: var(--line-3) transparent; }
.clip-code {
  margin: 0;
  max-height: 300px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--inset);
  color: var(--text);
  font: 12px/1.55 var(--mono);
  white-space: pre;
  overflow: auto;
  tab-size: 4;
  scrollbar-width: thin;
  scrollbar-color: var(--line-3) transparent;
}
.clip-img-wrap { justify-self: start; border: 1px solid var(--line-2); border-radius: 4px; background: var(--inset); overflow: hidden; }
.clip-img { display: block; max-width: 100%; max-height: 240px; object-fit: contain; }

/* ---------- footer ---------- */
.foot { padding: 9px var(--pad) 10px; border-top: 1px solid var(--line); color: var(--text-3); font-size: 11.5px; }
.foot code { color: var(--text-2); }

/* ---------- QR modal (the catch layer takes the dismissing click) ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; }
.catch-layer { position: absolute; inset: 0; background: rgba(4, 4, 5, 0.72); }
.modal-card {
  position: relative;
  width: min(340px, 100%);
  /* Short landscape screens scroll the card so Copy link stays reachable. */
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line-3) transparent;
  border: 1px solid var(--line-3);
  border-radius: 8px;
  background: var(--s1);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 44px;
  padding: 0 10px 0 16px;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 { font-size: 13.5px; font-weight: 600; }
.qr-box { margin: 16px 16px 14px; padding: 10px; border-radius: 4px; background: #fff; }
.qr-box svg { display: block; width: 100%; height: auto; }
.qr-code-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 16px; }
.qr-code-line code { color: var(--text); font-size: 17px; font-weight: 600; letter-spacing: 0.12em; margin-right: -0.12em; white-space: nowrap; }
/* The link is built from unbreakable parts joined by <wbr> after "/", "#" and ".". */
.qr-link { margin-top: 8px; padding: 0 16px; color: var(--text-3); font: 11.5px/1.5 var(--mono); }
.qr-link span { white-space: nowrap; }
.modal-actions { display: flex; margin-top: 14px; padding: 12px 16px; border-top: 1px solid var(--line); }
.modal-actions .btn { flex: 1; }

/* ---------- toasts ---------- */
.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(var(--edge) + 48px);
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transform: translateX(-50%);
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 32px);
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 12px 8px 11px;
  border: 1px solid var(--line-3);
  border-radius: 6px;
  background: var(--s3);
  color: var(--text);
  font-size: 12.5px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
}
.toast::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 1.5px; background: var(--text-3); }
.toast[data-tone="ok"]::before { background: var(--ok); }
.toast[data-tone="warn"]::before { background: var(--warn); }
.toast[data-tone="bad"]::before { background: var(--bad); }

/* ---------- responsive ---------- */
/* The join cell moves to its own row before the header runs out of width. */
@media (max-width: 1200px) {
  .room { grid-template-columns: auto auto minmax(0, 1fr); }
  .room-actions { border-right: 0; }
  .join { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 14px; padding-block: 9px; border-top: 1px solid var(--line); }
  .join .cell-row { flex: 1; }
  .join input { flex: 1; max-width: 360px; }
  /* The status strip stops being cells and wraps as a plain row. */
  .statusbar { flex-wrap: wrap; align-items: center; gap: 8px var(--pad); padding: 8px var(--pad); }
  .statusbar > *, .statusbar > .status-right { min-height: 26px; padding: 0; border: 0; }
  .statusbar > .wait-hint { padding-block: 0; }
  .badge { min-width: 0; }
  .statusbar > .status-right { gap: var(--pad); }
  .net-info, .switch { padding: 0; border: 0; }
}
/* Too narrow or too short for a fixed faceplate: the page flows and scrolls as a whole. */
@media (max-width: 980px), (max-height: 600px) {
  :root { --edge: 0px; }
  body { width: auto; height: auto; min-height: 100vh; min-height: 100dvh; border: 0; border-radius: 0; }
  .panel-body { overflow: visible; }
}
@media (max-width: 980px) {
  :root { --pad: 16px; }
  .topbar { grid-template-columns: minmax(0, 1fr); }
  .brand { padding-block: 11px; border-right: 0; border-bottom: 1px solid var(--line); }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .toasts { bottom: 20px; }
  .list-head { flex-wrap: wrap; padding-block: 7px; }
}
@media (max-width: 720px) {
  .room { grid-template-columns: auto minmax(0, 1fr); }
  .room-access { border-right: 0; }
  .room-actions { grid-column: 1 / -1; border-top: 1px solid var(--line); }
  .room-actions .btn { flex: 1; }
  .join input { max-width: none; }
  .statusbar > .status-right { flex: 1 1 100%; flex-wrap: wrap; gap: 8px var(--pad); justify-content: space-between; margin-left: 0; }
  .net-info { white-space: normal; }
  .verified code { display: none; }
}
@media (max-width: 480px) {
  .room { grid-template-columns: minmax(0, 1fr); }
  .room-id { border-right: 0; }
  .room-access { border-top: 1px solid var(--line); }
  .room-access .chip { width: 100%; justify-content: flex-start; }
  .room-access .chip svg { margin-left: auto; }
  .room-id .cell-row > * { flex: 1; justify-content: center; }
  .join { flex-direction: column; align-items: stretch; gap: 7px; }
  .dz-icon { display: none; }
  .dz-actions .btn { flex: 1; }
  .xfer-actions { flex-direction: column; min-width: 0; }
}
