:root {
  --bg: #070707;
  --bg-soft: #101010;
  --panel: #151515;
  --panel-2: #1c1c1c;
  --border: rgba(255,255,255,.08);
  --text: #f4f4f4;
  --muted: #9b9b9b;
  --orange: #ff7a18;
  --orange-2: #ff9f1c;
  --orange-soft: rgba(255,122,24,.14);
  --danger: #ff5f57;
  --success: #2ee59d;
  --shadow: 0 22px 70px rgba(0,0,0,.55);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 20%, rgba(255,122,24,.12), transparent 34%),
    linear-gradient(180deg, #0b0b0b, var(--bg));
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 11px 15px;
  color: var(--text);
  background: rgba(255,255,255,.03);
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
}

button:hover,
button:focus-visible,
input:focus-visible {
  outline: 2px solid rgba(255,159,28,.72);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

button.primary {
  border-color: transparent;
  color: #090909;
  background: linear-gradient(135deg, var(--orange), var(--orange-2));
  box-shadow: 0 14px 38px rgba(255,122,24,.22);
}

input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 11px 12px;
  color: var(--text);
  background: rgba(255,255,255,.04);
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 24px;
}

.app-locked {
  pointer-events: none;
  user-select: none;
}

.topbar,
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 5;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #070707;
  font-weight: 950;
  background: linear-gradient(135deg, var(--orange), var(--orange-2));
  box-shadow: 0 0 34px rgba(255,122,24,.25);
}

.brand strong {
  display: block;
  font-size: 16px;
}

.brand span,
.muted {
  color: var(--muted);
  font-size: 13px;
}

.top-controls {
  display: flex;
  align-items: end;
  gap: 12px;
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.main {
  position: relative;
  display: grid;
  place-items: center;
  isolation: isolate;
}

.network {
  position: relative;
  width: min(76vw, 720px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

.ring {
  position: absolute;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 50%;
}

.ring.one { inset: 6%; }
.ring.two { inset: 26%; }
.ring.three { inset: 44%; border-color: rgba(255,122,24,.18); }

.axis {
  position: absolute;
  width: 1px;
  height: 82%;
  background: linear-gradient(transparent, rgba(255,255,255,.07), transparent);
}

.axis.horizontal { rotate: 90deg; }

.drop-center {
  position: relative;
  z-index: 3;
  width: 220px;
  min-height: 220px;
  display: grid;
  place-items: center;
  padding: 22px;
  border: 1px solid rgba(255,122,24,.24);
  border-radius: 34px;
  background: linear-gradient(180deg, rgba(255,122,24,.09), rgba(255,255,255,.025));
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255,255,255,.03);
  text-align: center;
  cursor: pointer;
}

.drop-center.drag-active,
.peer.drag-active {
  border-color: rgba(255,159,28,.8);
  box-shadow: 0 0 0 3px rgba(255,122,24,.16), var(--shadow);
}

.avatar {
  width: 70px;
  height: 70px;
  margin: 0 auto 14px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  color: #090909;
  background: linear-gradient(135deg, var(--orange), var(--orange-2));
  font-size: 24px;
  font-weight: 950;
}

.local-name {
  display: grid;
  gap: 4px;
  margin: 0 0 12px;
}

.local-name span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.local-name strong {
  display: block;
  max-width: 172px;
  margin: 0 auto;
  overflow: hidden;
  color: var(--text);
  font-size: 16px;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drop-heading {
  display: block;
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 950;
}

.drop-copy {
  display: block;
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 14px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 8px 11px;
  border-radius: 999px;
  color: var(--orange-2);
  background: var(--orange-soft);
  font-size: 12px;
  font-weight: 800;
}

.status.connected { color: var(--success); }
.status.failed { color: var(--danger); }

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 18px rgba(255,122,24,.8);
}

.peers-layer {
  position: absolute;
  inset: 0;
}

.peer {
  position: absolute;
  z-index: 4;
  width: 130px;
  transform: translate(-50%, -50%);
  text-align: center;
  cursor: pointer;
  padding: 0;
  border: 0;
  background: transparent;
}

.peer .avatar {
  width: 62px;
  height: 62px;
  margin-bottom: 10px;
  border-radius: 20px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: 0 18px 42px rgba(0,0,0,.45);
  font-size: 20px;
}

.peer strong {
  display: inline-block;
  max-width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(21,21,21,.86);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.peer small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.peer.selected .avatar {
  border-color: rgba(255,159,28,.85);
  box-shadow: 0 0 0 3px rgba(255,122,24,.16), 0 18px 42px rgba(0,0,0,.45);
}

.side-panel {
  position: absolute;
  left: 0;
  bottom: 36px;
  width: 340px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: rgba(21,21,21,.86);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  z-index: 5;
}

.side-panel h2,
.transfer h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.side-panel p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.fingerprint {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.fingerprint code {
  display: block;
  min-height: 22px;
  white-space: normal;
}

.transfer {
  position: absolute;
  right: 0;
  bottom: 36px;
  width: 340px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: rgba(21,21,21,.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  z-index: 5;
}

.file {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
  padding: 12px;
  border-radius: 18px;
  background: var(--panel-2);
}

.file-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--orange-soft);
}

.file p {
  margin: 0;
  font-size: 13px;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.file small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.progress {
  grid-column: 1 / -1;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
}

.bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--orange), var(--orange-2));
}

.transfer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.room {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

code {
  color: var(--orange-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.link-button {
  padding: 8px 11px;
  font-size: 12px;
}

.invite-copy {
  position: relative;
  display: inline-flex;
  align-items: center;
  max-width: min(420px, 100%);
}

.invite-copy span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-hint {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  background: rgba(21,21,21,.96);
  box-shadow: var(--shadow);
  font-size: 12px;
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
}

.invite-copy:not(:disabled):hover .copy-hint,
.invite-copy:not(:disabled):focus-visible .copy-hint {
  opacity: 1;
  transform: translateY(0);
}

.hidden { display: none !important; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0,0,0,.72);
}

.modal {
  width: min(440px, 100%);
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.name-gate {
  z-index: 40;
}

.name-modal {
  width: min(460px, 100%);
}

.modal h2 {
  margin: 0 0 14px;
  font-size: 20px;
}

.modal p {
  margin: 0 0 14px;
  color: var(--muted);
}

.modal label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.modal label + label {
  margin-top: 12px;
}

.modal > code {
  display: block;
  margin: 0 0 14px;
  overflow-wrap: anywhere;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.recipient-list {
  display: grid;
  gap: 10px;
}

.recipient-list button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.offer-details {
  display: grid;
  gap: 10px;
  margin: 0;
}

.offer-details div {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 12px;
}

.offer-details dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.offer-details dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.toast-region {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 30;
  width: min(520px, calc(100vw - 32px));
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--text);
  background: rgba(21,21,21,.96);
  box-shadow: var(--shadow);
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto;
  }
}

@media (max-width: 940px) {
  body { overflow: auto; }
  .app { gap: 24px; }
  .topbar,
  .footer { align-items: flex-start; flex-direction: column; }
  .top-controls { align-items: stretch; flex-direction: column; width: 100%; }
  .name-field { width: 100%; }
  .actions { flex-wrap: wrap; }
  .main { display: block; }
  .network { width: 92vw; margin: 20px auto 34px; }
  .side-panel,
  .transfer {
    position: static;
    width: 100%;
    margin: 14px 0;
  }
  .peer { width: 112px; }
  .peer .avatar { width: 54px; height: 54px; }
  .drop-center { width: 190px; min-height: 190px; }
}
