:root {
  --ink: #07080c;
  --surface-1: #11131c;
  --surface-2: #191c27;
  --outline: #272b39;
  --send: #5b8cff;
  --mint: #43e5a0;
  --amber: #ffc46b;
  --rose: #ff6b81;
  --text-hi: #f2f4fa;
  --text-mid: #9aa3bc;
  --text-low: #5f6880;
  --radius: 20px;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--ink);
  color: var(--text-hi);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

body {
  background-image:
    radial-gradient(70rem 40rem at 15% -10%, rgba(91, 140, 255, .10), transparent 60%),
    radial-gradient(60rem 36rem at 95% 8%, rgba(67, 229, 160, .07), transparent 60%);
  background-attachment: fixed;
}

#app { min-height: 100%; }

.screen { display: none; max-width: 1120px; margin: 0 auto; padding: 0 28px 56px; }
.screen.active { display: block; }

/* The landing screen is short, so centre it rather than leaving a void below. */
#screen-home.active {
  display: flex; flex-direction: column; justify-content: center;
  min-height: 100vh; padding-bottom: 28px;
}

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- home ---------- */
.masthead { padding: 0 0 40px; }
.wordmark { display: flex; align-items: center; gap: 14px; }
.wordmark svg { width: 40px; height: 40px; color: var(--text-hi); }
.wordmark .accent { fill: var(--send); }
.wordmark .accent .mint { fill: var(--mint); }
.wordmark span { font-size: 34px; font-weight: 800; letter-spacing: -.9px; }
.tagline { margin: 14px 0 0; color: var(--text-mid); font-size: 17px; max-width: 46ch; line-height: 1.5; }

.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 780px) { .cards { grid-template-columns: 1fr; } }

.card {
  position: relative;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  text-align: left;
  min-height: 190px; padding: 26px;
  border-radius: 24px;
  border: 1px solid var(--outline);
  background: linear-gradient(150deg, rgba(255,255,255,.045), var(--surface-1) 65%);
  color: inherit; font: inherit; cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
  overflow: hidden;
}
.card:hover { transform: translateY(-3px); }
.card:focus-visible { outline: 2px solid var(--send); outline-offset: 3px; }
.card h2 { margin: 0 0 8px; font-size: 24px; letter-spacing: -.4px; }
.card p { margin: 0; color: var(--text-mid); font-size: 14.5px; line-height: 1.5; max-width: 30ch; }
.card-art { flex: 0 0 auto; width: 108px; height: 108px; opacity: .95; }
.card-art svg { width: 100%; height: 100%; }

.card-send { border-color: rgba(91,140,255,.3); }
.card-send:hover { border-color: rgba(91,140,255,.65); box-shadow: 0 16px 44px -20px rgba(91,140,255,.8); }
.card-send .glyph { fill: var(--send); }
.card-send .waves { stroke: var(--send); }
.card-send .waves path { opacity: .25; animation: pulse 1.9s linear infinite; }
.card-send .waves path:nth-child(2) { animation-delay: .35s; }
.card-send .waves path:nth-child(3) { animation-delay: .7s; }
@keyframes pulse { 0% { opacity: .85; } 70%,100% { opacity: .12; } }

.card-recv { border-color: rgba(67,229,160,.3); }
.card-recv:hover { border-color: rgba(67,229,160,.65); box-shadow: 0 16px 44px -20px rgba(67,229,160,.7); }
.card-recv .brackets { stroke: var(--mint); }
.card-recv .target { fill: rgba(67,229,160,.22); }
.card-recv .sweep { fill: var(--mint); animation: sweep 2.4s ease-in-out infinite; }
@keyframes sweep { 0%,100% { transform: translateY(-22px); opacity:.35 } 50% { transform: translateY(22px); opacity:1 } }

.footnote { margin-top: 34px; color: var(--text-low); font-size: 13px; }
.footnote a { color: var(--text-mid); text-decoration: underline; text-underline-offset: 3px; margin-left: 8px; }
.footnote a:hover { color: var(--text-hi); }

/* ---------- chrome ---------- */
.topbar { display: flex; align-items: center; gap: 12px; padding: 26px 0 22px; }
.topbar-title { font-size: 17px; font-weight: 600; }
.spacer { flex: 1; }
.back {
  width: 38px; height: 38px; border-radius: 12px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--outline); color: var(--text-mid);
  font-size: 24px; line-height: 1; padding: 0 0 3px;
}
.back:hover { color: var(--text-hi); border-color: #394054; }

/* ---------- send ---------- */
.picker { max-width: 620px; margin: 24px auto 0; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 62px 28px; cursor: pointer;
  border: 1.5px dashed #333a4d; border-radius: var(--radius);
  background: var(--surface-1);
  transition: border-color .18s, background .18s;
}
.dropzone:hover, .dropzone.over { border-color: var(--send); background: rgba(91,140,255,.07); }
.dropzone svg { width: 46px; height: 46px; stroke: var(--send); }
.dropzone strong { font-size: 17px; }
.dropzone span { color: var(--text-mid); font-size: 14px; }
.hint { color: var(--text-low); font-size: 13px; line-height: 1.6; margin: 14px 2px 0; }

.stage { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 26px 34px; align-items: start; }
@media (max-width: 900px) { .stage { grid-template-columns: 1fr; } }

.sidepanel { display: flex; flex-direction: column; gap: 26px; }

.filebar { grid-column: 1 / -1; display: flex; align-items: center; gap: 16px; }
.filemeta { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.filemeta strong { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filemeta span { color: var(--text-mid); font-size: 12.5px; }

.qrwrap {
  background: #fff; border-radius: var(--radius); padding: 14px;
  display: flex; align-items: center; justify-content: center;
  aspect-ratio: 1; width: 100%; max-width: min(64vh, 100%); margin: 0 auto;
  box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 30px 80px -40px rgba(91,140,255,.7);
}
#qr-canvas { width: 100%; height: 100%; image-rendering: pixelated; display: block; }

.sendbar { display: flex; flex-direction: column; gap: 9px; }
.readout.dim { color: var(--text-low); font-size: 12px; }
.progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--send); border-radius: 3px; transition: width .25s ease; }
.progress-fill.mint { background: var(--mint); }
.readout { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--text-mid); }

.controls { display: flex; flex-direction: column; gap: 16px; }
.control label { display: block; font-size: 11px; letter-spacing: .7px; text-transform: uppercase; color: var(--text-low); margin-bottom: 7px; }
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.segmented button {
  padding: 9px 4px; font: inherit; font-size: 12.5px; cursor: pointer;
  border-radius: 11px; border: 1px solid transparent;
  background: var(--surface-2); color: var(--text-mid);
}
.segmented button:hover { color: var(--text-hi); }
.segmented button.on { background: rgba(91,140,255,.18); border-color: rgba(91,140,255,.55); color: var(--text-hi); }

.ghost {
  padding: 9px 16px; border-radius: 12px; cursor: pointer; font: inherit; font-size: 13px;
  background: var(--surface-2); border: 1px solid var(--outline); color: var(--text-hi);
}
.ghost:hover { border-color: #394054; }

/* ---------- receive ---------- */
.recvgrid { display: grid; grid-template-columns: minmax(0,1fr) 320px; gap: 26px; align-items: start; }
@media (max-width: 900px) { .recvgrid { grid-template-columns: 1fr; } }

.videowrap {
  position: relative; border-radius: var(--radius); overflow: hidden;
  background: #000; aspect-ratio: 4/3; border: 1px solid var(--outline);
}
#video { width: 100%; height: 100%; object-fit: cover; display: block; }
.viewfinder { position: absolute; inset: 9%; pointer-events: none; }
.viewfinder i {
  position: absolute; width: 44px; height: 44px;
  border: 3px solid rgba(255,255,255,.85); border-radius: 4px;
}
.viewfinder i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.viewfinder i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.viewfinder i:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.viewfinder i:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; }
.camera-error {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 34px; color: var(--text-mid); font-size: 14px; line-height: 1.6;
  background: var(--surface-1);
}

.recvpanel { background: var(--surface-1); border: 1px solid var(--outline); border-radius: var(--radius); padding: 22px; }
.recvpanel h3 { margin: 0 0 8px; font-size: 17px; }
.recvpanel p { margin: 0; color: var(--text-mid); font-size: 14px; line-height: 1.55; }
.bignum { display: flex; align-items: baseline; gap: 3px; margin-bottom: 14px; }
.bignum span { font-size: 46px; font-weight: 800; letter-spacing: -1.5px; font-variant-numeric: tabular-nums; }
.bignum small { font-size: 17px; color: var(--text-mid); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; margin: 20px 0 0; }
.stats dt { font-size: 11px; letter-spacing: .6px; text-transform: uppercase; color: var(--text-low); }
.stats dd { margin: 3px 0 0; font-size: 14px; }

.tick {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(67,229,160,.16); color: var(--mint); font-size: 24px; margin-bottom: 14px;
}
.tick.warn { background: rgba(255,196,107,.16); color: var(--amber); }
.filename { color: var(--text-hi) !important; font-size: 15px !important; word-break: break-all; margin-top: 6px !important; }
.donebtns { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.primary {
  padding: 11px 22px; border-radius: 13px; cursor: pointer; font: inherit; font-size: 14px; font-weight: 600;
  background: var(--mint); color: #00301d; border: 0; text-decoration: none; display: inline-block;
}
.primary:hover { filter: brightness(1.08); }
.camsel {
  margin-top: 20px; width: 100%; padding: 9px 11px; font: inherit; font-size: 13px;
  background: var(--surface-2); color: var(--text-mid);
  border: 1px solid var(--outline); border-radius: 11px;
}

/* ---------- photosensitivity warning ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: rgba(3, 4, 8, .82);
  backdrop-filter: blur(3px);
}
.modal-backdrop[hidden] { display: none; }
.modal {
  width: min(520px, 100%);
  background: var(--surface-1);
  border: 1px solid var(--outline);
  border-radius: 22px;
  padding: 30px;
  box-shadow: 0 40px 90px -30px rgba(0,0,0,.9);
}
.warn-icon {
  width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center;
  background: rgba(255, 196, 107, .16); color: var(--amber); font-size: 23px; margin-bottom: 16px;
}
.modal h2 { margin: 0 0 12px; font-size: 21px; letter-spacing: -.3px; }
.modal p { margin: 0 0 12px; color: var(--text-mid); font-size: 14.5px; line-height: 1.6; }
.modal p strong { color: var(--text-hi); }
.modal .warn-soft { color: var(--text-low); font-size: 13px; }
.checkline {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  margin: 18px 0 22px; color: var(--text-mid); font-size: 14px; user-select: none;
}
.checkline input { width: 17px; height: 17px; accent-color: var(--send); cursor: pointer; }
.checkline:hover { color: var(--text-hi); }
.modal-btns { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.primary.blue { background: var(--send); color: #06183f; }

/* ---------- about ---------- */
.prose { max-width: 62ch; color: var(--text-mid); font-size: 15px; line-height: 1.7; }
.prose h4 { color: var(--text-hi); font-size: 15px; margin: 28px 0 8px; }
.prose strong, .prose em { color: var(--text-hi); }
.prose p { margin: 0 0 14px; }
