:root {
  color-scheme: light;
  --bg: #f7f7f5;
  --card: #fff;
  --ink: #141414;
  --muted: #777;
  --line: #e7e7e3;
  --good: #21864a;
  --bad: #b93838;
}

* { box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; }
html { background: var(--bg); overflow-x: hidden; }
body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.35 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, textarea, select { font: inherit; }
button { color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
.hint { color: var(--muted); font-size: 12px; }

/* Original single-page shell ------------------------------------------------ */
.app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
@media (display-mode: standalone) {
  .app { min-height: 100vh; min-height: 100svh; }
}
body.receive-mode { overflow-y: hidden; }
body.receive-mode .app { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
body.receive-mode .app-header { flex: none; }
body.receive-mode .app-main {
  flex: 1;
  min-height: 0;
  margin-block: 0;
  padding-bottom: 8px;
  display: flex;
  flex-direction: column;
}
body.receive-mode .receiver-shell.active { display: flex; flex: 1; min-height: 0; }
body.receive-mode .receiver-primary { flex: 1; min-height: 0; }
body.receive-mode .preview-zone { flex: 1 1 0; min-height: 0; align-items: stretch; }
body.receive-mode .preview { width: 100%; height: 100%; max-height: none; aspect-ratio: auto !important; }
.app-header,
.app-main {
  width: calc(100% - 32px);
  max-width: 920px;
  width: min(920px, calc(100% - 32px));
  margin-left: auto;
  margin-right: auto;
  margin-inline: auto;
}
.app-header {
  padding: 18px 0 4px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.app-main { margin-block: auto; padding: 4px 0 30px; }
.brand-lockup { display: flex; align-items: center; gap: 12px; min-width: 0; }
.header-qr-button { position: relative; display: block; flex: none; width: 48px; height: 48px; border: 0; background: transparent; padding: 0; cursor: pointer; border-radius: 5px; }
.header-qr-button:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.header-qr { display: block; width: 48px; height: 48px; image-rendering: pixelated; }
.brand-button { border: 0; background: transparent; padding: 0; text-align: left; cursor: pointer; }
.install-shell { position: relative; flex: none; }
.install-menu-button { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 8px 11px; font-size: 12px; font-weight: 650; cursor: pointer; }
.install-menu-button:hover { border-color: #ccc; }
.install-menu-button:disabled { color: var(--muted); cursor: default; }
.install-menu { position: absolute; z-index: 20; top: calc(100% + 6px); right: 0; width: 150px; padding: 5px; background: var(--card); border: 1px solid var(--line); border-radius: 11px; box-shadow: 0 12px 32px #0002; }
.install-menu button,
.install-menu a { display: block; width: 100%; padding: 8px 9px; border: 0; border-radius: 7px; color: var(--ink); background: transparent; text-align: left; text-decoration: none; font-size: 12px; cursor: pointer; }
.install-menu button:hover,
.install-menu button:focus-visible,
.install-menu a:hover,
.install-menu a:focus-visible { background: var(--bg); outline: 0; }
.install-menu button:disabled { color: var(--muted); cursor: default; }
.install-menu p { margin: 4px 7px 5px; color: var(--muted); font-size: 10px; line-height: 1.35; }
.brand { display: block; color: var(--ink); font-weight: 750; font-size: 18px; letter-spacing: -.02em; text-decoration: none; }
.app-version { margin-left: 3px; color: var(--muted); font-size: 10px; font-weight: 500; letter-spacing: 0; }
.tag { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.ghost,
.secondary-button {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 10px;
  padding: 8px 11px;
  cursor: pointer;
}
.ghost:hover,
.secondary-button:hover { background: var(--card); }
.view { display: none; }
.view.active { display: block; }
.home { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mode {
  min-height: 180px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 20px;
  cursor: pointer;
  font-weight: 700;
  font-size: 27px;
  letter-spacing: -.035em;
  transition: .16s ease;
}
.mode:hover { transform: translateY(-2px); border-color: #d3d3ce; box-shadow: 0 12px 36px #00000009; }
/* Sender ------------------------------------------------------------------- */
.send-shell,
.receiver-shell { min-width: 0; }
.send-start { display: flex; flex-direction: column; gap: 12px; }
.send-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.file-picker,
.note-composer {
  min-height: 180px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 12px;
}
.file-picker {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  position: relative;
  padding: 16px;
  transition: .14s;
}
.file-picker:hover, .file-picker.dragging { border-color: #999; background: var(--card); }
.file-picker input { display: none; }
.file-picker strong { display: block; font-size: 18px; margin-bottom: 5px; }
.file-picker .sub { display: block; color: var(--muted); font-size: 12px; }
.file-picker.has-file strong { color: var(--ink); }
.stage-bottom { width: min(100%, 920px); flex: none; padding: 0 10px 8px; }
.selection-summary { display: flex; justify-content: space-between; gap: 20px; padding: 6px 4px; color: var(--muted); font-size: 11px; }
.selection-summary span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selection-summary span:last-child { flex: none; font-variant-numeric: tabular-nums; }
.send-controls { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: start; gap: 12px; padding: 8px 4px 0; border-top: 1px solid var(--line); }
.send-controls label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.send-controls select,
.send-controls input { width: 100%; }
.send-controls input { margin-top: 2px; }
.send-controls .speed-control.has-custom { display: grid; grid-template-columns: minmax(0, 3fr) minmax(64px, 2fr); }
.speed-control span { grid-column: 1 / -1; }
.speed-control input { margin: 0; }
.note-composer { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.note-composer textarea {
  resize: none;
  flex: 1;
  min-height: 150px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.45;
}
.note-composer textarea::placeholder { color: #aaa; }
.text-send,
.note-composer > button {
  align-self: flex-end;
  border: 0;
  background: #171717;
  color: white;
  border-radius: 10px;
  padding: 8px 13px;
  cursor: pointer;
  font-weight: 650;
}
.stage {
  position: relative;
  left: 50%;
  width: min(1400px, calc(100vw - 24px));
  transform: translateX(-50%);
  margin-top: 12px;
  height: calc(100vh - 180px);
  height: calc(100dvh - 180px);
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
}
.stage[hidden] { display: none; }
.stage canvas { display: block; max-width: 100%; cursor: pointer; }
.stage-error {
  width: min(560px, calc(100% - 24px));
  padding: 24px;
  color: var(--bad);
  background: var(--card);
  border: 1px solid color-mix(in srgb, var(--bad) 25%, var(--line));
  border-radius: 14px;
  font-size: 18px;
  font-weight: 650;
  text-align: center;
}
.status-line { min-height: 18px; margin-top: 9px; text-align: center; }
.status-line.error { color: var(--bad); font-weight: 650; }
.footer-hint { text-align: center; }

body.qr-full { overflow: hidden; }
body.qr-full.qr-cursor-hidden,
body.qr-full.qr-cursor-hidden * { cursor: none !important; }
body.qr-full .app-header,
body.qr-full .app-main > :not(#sendView),
body.qr-full .send-shell > :not(#stage) { display: none !important; }
body.qr-full .app-main,
body.qr-full .send-shell,
body.qr-full #sendView { display: block; width: 100%; height: 100%; margin: 0; padding: 0; }
body.qr-full .stage-bottom { display: none; }
body.qr-full #stage {
  display: flex;
  left: 0;
  transform: none;
  width: 100vw;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
}

/* Settings and diagnostics ------------------------------------------------- */
details.settings {
  margin-top: 12px;
  width: 100%;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 14px;
  padding: 10px 12px;
}
details.settings summary { cursor: pointer; color: var(--ink); font-size: 12px; font-weight: 650; }
details.settings .row { display: flex; flex-wrap: wrap; gap: 10px 18px; padding-top: 12px; }
details.settings label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.receiver-settings { flex: none; min-width: 0; }
details.receiver-settings .row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(70px, .8fr) auto auto; gap: 10px; }
.receiver-settings label,
.receiver-settings select { min-width: 0; width: 100%; }
.receiver-settings .settings-actual { min-width: 0; overflow: hidden; color: var(--muted); font-weight: 400; text-overflow: ellipsis; opacity: .8; }
.receiver-settings .scan-capture-button { padding: 5px 9px; min-height: 34px; }
.receiver-dev-actions { grid-column: 1 / -1; grid-row: 3; display: flex; flex-wrap: wrap; gap: 6px; align-items: end; }
.receiver-dev-actions[hidden] { display: none; }
.receiver-dev-actions button { padding: 5px 9px; min-height: 34px; }
.transport-diagnostics { flex: 1 0 100%; margin: 0; padding: 8px; overflow: auto; color: var(--muted); background: var(--bg); border-radius: 8px; font: 10px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; }
#optics-auto-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
#optics-auto-actions[hidden] { display: none; }
#optics-optimize[aria-pressed="true"] { color: #fff; background: #222; border-color: #222; }
#optics-optimize-status { min-width: 0; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.focus-dev { flex: 1 0 100%; display: grid; grid-template-columns: minmax(130px, 1fr) auto minmax(180px, 2fr); align-items: end; gap: 8px; padding-top: 4px; }
.focus-dev pre { grid-column: 1 / -1; margin: 0; padding: 8px; overflow: auto; color: var(--muted); background: var(--bg); border-radius: 8px; font: 10px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; }
.focus-tuning { grid-column: 1 / -1; color: var(--muted); font-size: 10px; }
.focus-tuning summary { cursor: pointer; }
.focus-tuning > div { display: grid; grid-template-columns: repeat(3, minmax(80px, 1fr)); gap: 6px; padding-top: 6px; }
.focus-tuning input { width: 100%; }
.optics-manual { grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.optics-manual[hidden], .optics-manual .axis-control[hidden], .optics-manual [hidden] { display: none !important; }
.axis-control { position: relative; display: grid; grid-template-rows: auto 34px; gap: 3px; min-width: 0; }
.axis-heading { display: flex; align-items: center; gap: 4px; min-width: 0; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }
.axis-heading output { color: var(--ink); font-size: 10px; font-variant-numeric: tabular-nums; text-transform: none; letter-spacing: 0; }
.axis-heading button { padding: 0; color: var(--ink); background: none; border: 0; font: inherit; text-transform: uppercase; cursor: pointer; }
.axis-control.manual-focus #focus-axis-reset { pointer-events: none; }
.axis-control.manual-focus #focus-mode { position: absolute; left: 0; top: 0; z-index: 1; width: 42px; min-height: 16px; height: 16px; padding: 0; opacity: 0; cursor: pointer; }
.axis-control .setting-toggle { flex-direction: row; justify-content: flex-start; width: 100%; }
.axis-control input[type="range"] { min-width: 0; width: 100%; height: 34px; }
.axis-control input[type="checkbox"] { margin: 0; accent-color: #222; }
.setting-toggle { display: flex; align-items: center; gap: 6px; min-height: 34px; padding: 5px 8px; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; font-size: 12px; font-weight: 600; text-transform: none; letter-spacing: 0; }
.setting-toggle input { margin: 0; accent-color: #222; }
select, input[type="range"], input[type="number"] { min-height: 34px; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; }
input[type="range"] { accent-color: #222; }
.stream-specs, .metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin: 0; }
.stream-specs dt, .metric .k { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .05em; }
.stream-specs dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.metric { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; }
.live-metrics { margin-top: 0; }
.metric .v { margin-top: 2px; font-variant-numeric: tabular-nums; }
.settings-actual { margin: 10px 0 0; color: var(--muted); font-size: 11px; }
.settings-actual:empty { display: none; }
.scan-capture-button { align-self: end; }
.scan-dialog { inset: 0; width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; padding: 12px; overflow: hidden; border: 0; border-radius: 0; background: #0008; }
.scan-dialog::backdrop { background: transparent; }
.scan-dialog-card { width: min(920px, 100%); max-height: 100%; margin: auto; padding: 14px; overflow: auto; overscroll-behavior: contain; background: var(--card); border-radius: 16px; }
.scan-dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; position: sticky; top: -14px; z-index: 1; margin: -14px -14px 0; padding: 12px 14px; background: var(--card); border-bottom: 1px solid var(--line); }
.scan-dialog-status { margin: 12px 0 8px; color: var(--muted); font-size: 12px; }
.scan-capture { display: block; width: 100%; height: auto; max-height: calc(100dvh - 180px); object-fit: contain; border-radius: 8px; image-rendering: auto; }
.scan-dialog-legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 10px 0 0; font-size: 12px; }
.scan-dialog-legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 5px; border: 2px solid currentColor; vertical-align: -1px; }
.scan-track { color: #248cff; }
.scan-hit { color: #15934b; }
.scan-sighting { color: #b87500; }
.benchmark-dialog { inset: 0; width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; padding: 12px; overflow: hidden; border: 0; border-radius: 0; background: #0008; }
.benchmark-dialog::backdrop { background: transparent; }
.benchmark-card { width: min(920px, 100%); max-height: 100%; margin: auto; padding: 14px; overflow: auto; background: var(--card); border-radius: 16px; }
.benchmark-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; margin-top: 12px; }
.benchmark-controls label { display: flex; flex-direction: column; gap: 3px; color: var(--muted); font-size: 11px; text-transform: uppercase; }
.benchmark-controls button { min-height: 34px; }
#benchmark-summary { font: 12px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; }
@media (max-width: 700px) {
  .receiver-dev-actions { grid-row: auto; }
  .receiver-dev-actions > button { flex: 1; }
  .focus-dev { grid-template-columns: 1fr auto; }
}

/* Receiver ----------------------------------------------------------------- */
.receiver-primary { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.receiver-primary > * { width: 100%; }
.receiver-heading { text-align: center; }
#stats:empty { display: none; }
.enable-camera,
.receiver-primary > #start {
  width: auto;
  align-self: center;
  border: 1px solid #333;
  background: #171717;
  color: white;
  border-radius: 12px;
  padding: 11px 16px;
  cursor: pointer;
  font-weight: 700;
}
.preview-zone { position: relative; display: flex; justify-content: center; width: 100%; }
.camera-loader {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
  background: radial-gradient(circle at center, var(--card), var(--bg));
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .01em;
}
.preview-zone.camera-loading .camera-loader { display: flex; }
.camera-spinner {
  width: 38px;
  height: 38px;
  border: 3px solid var(--line);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: camera-loading .75s cubic-bezier(.55, .15, .45, .85) infinite;
}
@keyframes camera-loading { to { transform: rotate(360deg); } }
.preview {
  position: relative;
  isolation: isolate;
  width: 100%;
  min-height: 0;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: transparent;
  border: 0;
  border-radius: 0;
}
.preview video { position: relative; z-index: 0; width: 100%; height: 100%; display: block; object-fit: contain; background: transparent; }
.detect-overlay { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; transform: translateZ(0); pointer-events: none; }
/* Avoid a dedicated GPU texture over WebView video on old 32-bit renderers. */
.legacy-android-camera .detect-overlay { transform: none; }
.transfer-panel { flex: none; min-width: 0; padding: 12px 14px; overflow-x: hidden; background: var(--card); border: 1px solid var(--line); border-radius: 14px; cursor: pointer; }
.transfer-panel details.settings { display: flex; flex-direction: column-reverse; width: auto; margin: 0; padding: 0; overflow: visible; background: transparent; border: 0; border-radius: 0; }
.transfer-panel details.settings > .row { min-width: 0; max-height: min(240px, 40vh); padding: 0 0 12px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; cursor: default; }
.transfer-summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; white-space: nowrap; list-style: none; }
.transfer-summary::-webkit-details-marker { display: none; }
.settings-prompt { position: relative; display: inline-flex; align-items: baseline; gap: 5px; min-width: 0; padding-left: 11px; font-size: 12px; line-height: 1; letter-spacing: 0; }
.settings-arrow { position: absolute; left: 0; top: calc(50% + 2px); width: 0; height: 0; border-top: 4px solid transparent; border-bottom: 4px solid transparent; border-left: 6px solid currentColor; transform: translateY(-50%); transition: transform .16s ease; }
.receiver-settings[open] .settings-arrow { transform: translateY(-50%) rotate(-90deg); }
.complete-label { display: none; color: var(--good); font-size: clamp(28px, 7vw, 38px); line-height: 1; letter-spacing: -.035em; }
.progress { width: 100%; height: 7px; margin-top: 11px; overflow: hidden; background: var(--line); border-radius: 999px; }
.progress > div { height: 100%; width: 0; background: var(--ink); border-radius: inherit; transition: width .22s ease-out; animation: progress-pulse 1.4s ease-in-out infinite; }
.progress > div.error { background: var(--bad); animation: none; }
@keyframes progress-pulse { 50% { opacity: .68; } }
.speed-feedback { display: flex; align-items: center; justify-content: flex-end; gap: 9px; min-width: 0; }
.speed-feedback strong { color: var(--muted); font-size: clamp(20px, 5vw, 28px); line-height: 1; letter-spacing: -.04em; white-space: nowrap; font-variant-numeric: tabular-nums; transition: color .2s; }
.speed-low strong { color: var(--bad); }
.speed-mid strong { color: #9a6510; }
.speed-good strong { color: var(--good); }
.speed-high strong { color: #1769aa; }
@media (prefers-reduced-motion: reduce) {
  .camera-spinner { animation-duration: 1.5s; }
  .progress > div { animation: none; }
}
.transfer-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; margin-top: 9px; color: var(--muted); font-size: 11px; }
.transfer-estimate { display: flex; align-items: baseline; gap: 8px; min-width: 0; white-space: nowrap; font-variant-numeric: tabular-nums; }
.progress-amount { flex: none; color: var(--ink); font-size: 11px; line-height: 1; letter-spacing: 0; white-space: nowrap; font-variant-numeric: tabular-nums; }
#progress-label::after, #transfer-size-label:not(:empty)::after { content: "·"; margin-left: 8px; color: var(--muted); font-weight: 400; }
.pipeline-metrics { display: flex; gap: 14px; }
.pipeline-metrics strong { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
#m-limit { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
#m-limit:empty { display: none; }
#m-limit.scanner-bound { color: var(--bad); font-weight: 700; }
#result { display: flex; flex-direction: column; align-items: center; gap: 10px; }
#result:empty { display: none; }
.received-file { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.received-file img.received, .received-file video.received, .received-file audio.received { max-width: 100%; }
.received-file-download { width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; }
.received-file-download .download { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.received-file-download span { flex: none; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
img.received, video.received { display: block; width: auto; height: auto; max-width: 100%; max-height: 520px; border-radius: 14px; object-fit: contain; }
.received.inspectable { cursor: zoom-in; }
.received.inspectable:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.media-inspector { position: fixed; inset: 0; z-index: 100; overflow: hidden; background: #000; touch-action: none; user-select: none; }
.media-inspector .received { position: absolute; left: 50%; top: 50%; width: auto; height: auto; max-width: 100vw; max-height: 100vh !important; border-radius: 0; object-fit: contain; transform: translate(-50%, -50%); transform-origin: center; cursor: grab; will-change: transform; }
.media-inspector .received.dragging { cursor: grabbing; }
.media-inspector-close { position: fixed; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); z-index: 101; display: grid; place-items: center; width: 40px; height: 40px; padding: 0; color: #fff; background: #181818b8; border: 1px solid #ffffff38; border-radius: 50%; font-size: 24px; line-height: 1; cursor: pointer; backdrop-filter: blur(8px); }
body.media-inspecting { overflow: hidden; }
.received-archive { flex-direction: row; padding: 10px 12px; }
.received-archive .received-file-download { justify-content: flex-start; }
.received-file-type { flex: none; display: grid; place-items: center; width: 42px; height: 42px; color: var(--muted); background: var(--bg); border: 1px solid var(--line); border-radius: 9px; font-size: 10px; font-weight: 750; letter-spacing: .04em; }
body.receive-complete { overflow-x: hidden; overflow-y: auto; overscroll-behavior-y: auto; }
body.receive-complete .app-main { margin-block: 0; padding: 4px 0 8px; }
body.receive-complete .receiver-primary { gap: 8px; }
body.receive-complete .receiver-settings > .row,
body.receive-complete .settings-prompt,
body.receive-complete #progress-label { display: none; }
body.receive-complete .complete-label { display: block; }
body.receive-complete #result { min-height: 0; }
body.receive-complete img.received,
body.receive-complete video.received {
  /* Keep browser chrome appearing during a scroll from resizing the preview. */
  max-height: calc(100vh - 260px);
  max-height: min(520px, calc(100svh - 260px));
}
body.receive-complete .received-note { max-height: calc(100dvh - 260px); overflow: hidden; }
.done { font-size: 20px; font-weight: 700; color: var(--good); }
.failed { font-size: 20px; font-weight: 700; color: var(--bad); }
.received-note { width: 100%; margin: 0; padding: 14px; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.received-note .snippet-link { color: #145ea8; text-decoration: underline; text-underline-offset: 2px; }
.download { display: inline-block; border: 0; padding: 9px 13px; color: white; background: #171717; border-radius: 10px; font-weight: 650; text-decoration: none; overflow-wrap: anywhere; cursor: pointer; }
.note-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

/* Dialogs ------------------------------------------------------------------ */
dialog { color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 20px 80px #0002; }
dialog::backdrop { background: #0004; }
.receiver-link-dialog { width: min(340px, calc(100% - 32px)); padding: 18px; text-align: center; }
.receiver-link-qr-large { display: block; max-width: 100%; height: auto; margin: 0 auto; image-rendering: pixelated; }
.receiver-link-dialog p { margin: 12px 0 4px; color: var(--muted); font-size: 13px; }
.receiver-link-dialog a { display: block; color: var(--ink); font-size: 12px; overflow-wrap: anywhere; }

@media (max-width: 700px) {
  .app-header { padding-top: 14px; }
  .app-main { padding-top: 0; }
  .home, .send-inputs { grid-template-columns: 1fr; }
  .mode { min-height: 130px; }
  .file-picker, .note-composer { min-height: 130px; }
  .send-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stage { min-height: 0; }
  .receiver-primary { gap: 8px; }
  .preview { min-height: 0; }
  .transfer-panel { padding: 10px 12px; }
  .transfer-meta { margin-top: 7px; }
  .pipeline-metrics { gap: 10px; }
}

@media (max-width: 390px) {
  .receiver-settings .row { grid-template-columns: minmax(0, 1.5fr) minmax(62px, .7fr) auto auto; gap: 6px; }
  .receiver-settings .optics-manual { grid-column: 1 / -1; grid-row: 2; }
  .receiver-settings { padding-inline: 9px; }
}
