/* Home, Figma "Fling · Home without Connect" variation C. Loaded after style.css, whose tokens, buttons, chips and radar art it reuses. */
body[data-screen="radar"] h1 { font-size: 28px; line-height: 34px; letter-spacing: -1px; }
body[data-screen="radar"] h1 span { display: inline; }
body[data-screen="radar"] .page-heading { padding-top: 40px; }
#error { margin: 16px 0 0; }

/* The map takes the spare height. home.js sizes the radar to it and places devices around its center. */
#map { position: relative; flex: 1; min-height: 140px; margin-inline: -24px; }
#radar { position: absolute; left: 50%; top: 50%; width: 0; height: 0; scale: var(--radar-scale, .7); pointer-events: none; }
/* This device sits at the radar center as its avatar. */
#self-center { position: absolute; left: 50%; top: 50%; width: 36px; height: 36px; margin: -18px 0 0 -18px; border-radius: 50%; box-shadow: 0 0 0 4px #f2f6fc24; }
#self-center:not([src]), #self-center.covered { visibility: hidden; }
body[data-screen="radar"] .self-chip { margin-top: 10px; font-size: 14px; }
body[data-screen="radar"] .self-avatar { width: 24px; height: 24px; }
/* While a batch runs, a line joins each device to the center and fills from the sender toward the receiver. */
#tethers { position: absolute; left: 50%; top: 50%; width: 1px; height: 1px; overflow: visible; pointer-events: none; }
.tether { --tether: #a4c2ff; --tether-head: #dce8ff; opacity: 0; transition: opacity .3s; stroke-width: 3; stroke-linecap: round; }
.tether[data-direction="in"] { --tether: #5fdcb0; --tether-head: #c9f5e3; }
.tether.active { opacity: 1; }
.tether-track { stroke: var(--tether); stroke-opacity: .18; }
.tether-fill { stroke: var(--tether); }
.tether-halo { fill: var(--tether); fill-opacity: .18; }
.tether-head { fill: var(--tether-head); }
#devices { list-style: none; margin: 0; padding: 0; position: absolute; left: 50%; top: 50%; width: 0; height: 0; }

/* A device is one button: its bubble sits on the radar point and its name and state hang below. */
.device { position: absolute; width: 132px; margin: -26px 0 0 -66px; min-height: 0; padding: 0; flex-direction: column; gap: 6px; background: none; border: 0; border-radius: 0; color: var(--muted); font: 500 12px/16px Inter, sans-serif; animation: device-arrive .6s cubic-bezier(.34, 1.45, .5, 1) backwards; }
.device:disabled { opacity: 1; }
.device:hover:not(:disabled) { filter: none; }
#devices .device:focus-visible { outline: none; }
.device:focus-visible .bubble { outline: 2px solid #bdd8ff; outline-offset: 5px; }
@keyframes device-arrive { from { opacity: 0; scale: .7; } }
.bubble { --accent: var(--blue); position: relative; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; border: 1.5px solid #3c536e; background: #10151b; color: var(--muted); transition: border-color .3s, color .3s, background-color .3s, opacity .3s; }
.device[data-direction="in"] .bubble { --accent: var(--green); }
.bubble .avatar { width: 45px; height: 45px; border-radius: 50%; }
.device-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: color .3s; }
.device-status { min-height: 16px; margin-top: -6px; }
.badge { position: absolute; right: -6px; top: -6px; display: none; place-items: center; width: 20px; height: 20px; border-radius: 50%; box-shadow: 0 0 0 2px #000; background: #263a50; color: #e0e9f5; }
.badge .icon { width: 12px; height: 12px; stroke-width: 3; }

/* Idle: no files chosen yet, or the search is paused. Ready: a tap asks this device. */
.device[data-state="idle"] { cursor: default; }
.device[data-state="ready"] .bubble { border-color: #a4c2ffb3; color: var(--blue); background: #141c2b; }
.device[data-state="ready"] .device-name, .device:is([data-state="asked"], [data-state="request"], [data-state="active"], [data-state="done"], [data-state="failed"]) .device-name { color: #f2f6fc; }
.device[data-state="ready"]:hover .bubble { border-color: var(--blue); background: #1a2740; }
/* Asked or connecting: a slowly turning dashed ring. The badge stops it. */
.device:is([data-state="asked"], [data-state="request"]) .bubble { border-color: transparent; color: var(--accent); }
.device:is([data-state="asked"], [data-state="request"]) .bubble::before { content: ''; position: absolute; inset: -1.5px; border-radius: 50%; border: 1.5px dashed var(--accent); opacity: .8; animation: spin 14s linear infinite; }
.device[data-state="request"] { cursor: default; }
.device[data-state="request"] .device-status { color: var(--green); }
.device[data-state="active"] .bubble { border-color: #26374a; color: #5fdcb0; }
.device[data-state="active"] .device-status { color: #5fdcb0; font-weight: 600; }
.device[data-state="active"][data-direction="out"] .device-status { color: var(--blue); }
.device:is([data-state="asked"], [data-state="active"]) .badge, .device:is([data-state="done"], [data-state="failed"]) .badge { display: grid; }
.device[data-state="done"] { cursor: default; }
.device[data-state="done"] .bubble { border-color: var(--green); color: var(--green); }
.device[data-state="done"] .badge { background: var(--green); color: #18382c; }
.device[data-state="done"] .device-status { color: var(--green); font-weight: 600; }
.device[data-state="failed"] { cursor: default; }
.device[data-state="failed"] .bubble { border-color: #836555; color: #edc795; }
.device[data-state="failed"] .badge { background: #edc795; color: #49321c; }
.device[data-state="failed"] .device-status { color: #edc795; }

.status-row { flex-shrink: 0; display: flex; justify-content: center; padding-top: 8px; }
/* Desktop connection options: a quiet button beside the status pill opens a modal card. */
.status-row { position: relative; }
/* Hushed: devices are on the radar. It keeps its space so the map does not resize, and stays readable to screen readers. */
#nearby-status { transition: opacity .35s ease, translate .35s ease, scale .35s ease, color .9s ease, border-color .9s ease; }
#nearby-status.hushed { opacity: 0; translate: 0 8px; scale: .96; pointer-events: none; }
.status-row #open-options { position: absolute; right: 0; top: 50%; translate: 0 -50%; margin-top: 4px; }
#network-options { width: min(400px, calc(100vw - 48px)); margin: auto; color: #f2f6fc; }
#network-options::backdrop { background: #000000b3; }
#network-options h2 { margin: 0; font-size: 20px; line-height: 26px; }
#network-options .actions { margin-top: 22px; }
#options-error { margin: 14px 0 0; color: #edc795; font-size: 13px; }

/* The tray holds what this device is asked, what it received, and the files it will send. */
#tray { flex-shrink: 0; display: flex; flex-direction: column; gap: 14px; margin: 16px -8px 0; padding: 16px; border: 1px solid #3c536e; border-radius: 24px; background: linear-gradient(145deg,#20334d,#152330); }
#request h2 { margin: 0 0 14px; font-size: 18px; line-height: 1.3; letter-spacing: -.3px; }
#request .actions > button { flex: 1; }
#receipts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
#receipts:empty { display: none; }
.receipt-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #b8c7da; font-size: 13px; font-weight: 600; }
.receipt-close { flex-shrink: 0; width: 32px; min-height: 32px; margin: -6px -6px -6px 0; padding: 0; border-radius: 10px; }
.receipt-files { list-style: none; margin: 6px 0 0; padding: 0; max-height: 132px; overflow-y: auto; overscroll-behavior: contain; }
.receipt-files li { display: flex; align-items: baseline; gap: 12px; padding: 5px 0; font-size: 14px; }
.receipt-files li + li { border-top: 1px solid #2c4058; }
.receipt-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #f2f6fc; }
.receipt-place { flex-shrink: 0; font-weight: 600; }
.receipt-place[data-place="photos"] { color: #f4b8d2; }
.receipt-place[data-place="files"] { color: var(--blue); }
.receipt-place[data-place="downloads"] { color: var(--green); }
.receipt-place[data-place="folder"] { color: #cbb9f6; }
.receipt-place[data-place="pending"] { color: #edc795; }
.receipt-place[data-place="shared"] { color: var(--muted); }
#saves { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
#saves:empty { display: none; }
.save { width: 100%; color: #244c3a; background: linear-gradient(135deg,#ddefe0,#b9d7c2); border-color: #eaf6ed; }
#files-row { display: flex; align-items: center; gap: 8px; }
#files-row:not(:has(> :not([hidden]))) { display: none; }
#add-more { flex-shrink: 0; width: 38px; min-height: 38px; padding: 0; border-radius: 12px; }
#tray #queued-files { flex: 1; min-width: 0; margin: 0; flex-wrap: nowrap; overflow-x: auto; overscroll-behavior: contain; scrollbar-width: none; }
#tray #queued-files::-webkit-scrollbar { display: none; }
.queued-chip { flex-shrink: 0; max-width: 220px; }

@container (max-height: 560px) {
  body[data-screen="radar"] .page-heading { padding-top: 12px; }
  #tray { margin-top: 8px; padding: 12px; }
}
/* Phones in landscape have width to spare, so the column widens and a request fits beside its buttons. */
@media (max-height: 500px) and (min-width: 600px) { main { width: min(100%, 620px); } }
/* Phones in landscape: the radar takes what is left, and a request puts its question beside its buttons. */
@container (max-height: 420px) {
  #map { min-height: 96px; }
  body[data-screen="radar"] .self-chip { margin-top: 2px; }
  #tray { margin-top: 2px; gap: 8px; }
  #request { display: flex; align-items: center; gap: 14px; }
  #request h2 { flex: 1; margin: 0; font-size: 16px; }
  #request .actions { flex: 0 0 240px; flex-wrap: nowrap; }
}
@media (prefers-reduced-motion: reduce) { .device, .bubble::before { animation: none !important; } }

/* Approved idle devices remain on the radar and accept another batch on the same channel. */
.device[data-state="connected"] .bubble { border-color: var(--green); color: var(--green); }
.device[data-state="connected"] .device-status, .device[data-approved="true"][data-state="ready"] .device-status { color: var(--green); }
.device[data-sendable="true"] { cursor: pointer; }
