:root {
  --bg: #080c18;
  --bg-soft: #0d1428;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-strong: rgba(255, 255, 255, 0.08);
  --surface-solid: #111a30;
  --border: rgba(148, 163, 184, 0.16);
  --border-strong: rgba(148, 163, 184, 0.3);
  --text: #e9eefb;
  --muted: #9aa8c4;
  --accent: #6d7cff;
  --accent-2: #2dd4bf;
  --accent-soft: rgba(109, 124, 255, 0.16);
  --success: #34d399;
  --danger: #fb7185;
  --warn: #fbbf24;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --shadow: 0 24px 70px rgba(2, 6, 23, 0.55);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "Noto Sans", sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #eef2fb;
    --bg-soft: #e3e9f7;
    --surface: rgba(255, 255, 255, 0.72);
    --surface-strong: #ffffff;
    --surface-solid: #ffffff;
    --border: rgba(100, 116, 139, 0.2);
    --border-strong: rgba(100, 116, 139, 0.35);
    --text: #0f172a;
    --muted: #5b6b85;
    --accent: #4f5bd5;
    --accent-2: #0d9488;
    --accent-soft: rgba(79, 91, 213, 0.12);
    --success: #059669;
    --danger: #e11d48;
    --warn: #b45309;
    --shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(109, 124, 255, 0.14), transparent 60%),
    radial-gradient(1000px 500px at 90% 0%, rgba(45, 212, 191, 0.1), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p {
  margin: 0;
}

button {
  font-family: inherit;
}

.aurora {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.aurora-blob {
  position: absolute;
  width: 560px;
  height: 560px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.4;
}

.aurora-blob-a {
  top: -260px;
  left: -140px;
  background: #4c5bff;
}

.aurora-blob-b {
  top: -180px;
  right: -180px;
  background: #0ea5a3;
}

@media (prefers-color-scheme: light) {
  .aurora-blob {
    opacity: 0.16;
  }
}

.shell {
  position: relative;
  z-index: 1;
  width: min(100%, 1040px);
  margin: 0 auto;
  padding: 28px 22px 48px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  gap: 26px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  border-radius: var(--radius-sm);
}

.brand:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 30px rgba(109, 124, 255, 0.35);
}

.brand-mark svg {
  width: 26px;
  height: 26px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-name {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-sub {
  font-size: 0.78rem;
  color: var(--muted);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.14);
}

.status[data-state="online"] .status-dot {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.16);
}

.status[data-state="offline"] .status-dot,
.status[data-state="unsupported"] .status-dot {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(251, 113, 133, 0.16);
}

.status[data-state="online"] {
  color: var(--text);
}

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.self-card {
  display: flex;
  align-items: center;
  gap: 18px;
  animation: rise 0.4s ease both;
}

.self-icon {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  flex: none;
  font-size: 2rem;
  border-radius: 20px;
  background: linear-gradient(150deg, var(--accent-soft), transparent 70%), var(--surface-strong);
  border: 1px solid var(--border);
}

.self-info {
  min-width: 0;
}

.eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.name-row h1 {
  font-size: clamp(1.3rem, 4vw, 1.7rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.name-input {
  width: min(320px, 100%);
  padding: 8px 12px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  background: var(--surface-strong);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  outline: none;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.icon-btn svg {
  width: 17px;
  height: 17px;
}

.icon-btn:hover {
  color: var(--text);
  background: var(--surface-strong);
  border-color: var(--border);
}

.icon-btn:focus-visible,
.btn:focus-visible,
.peer-card:focus-visible,
.file-download:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.hint {
  margin-top: 4px;
  font-size: 0.86rem;
  color: var(--muted);
}

.banner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(251, 113, 133, 0.35);
  background: linear-gradient(140deg, rgba(251, 113, 133, 0.14), var(--surface));
  animation: rise 0.3s ease both;
}

.banner h2 {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--danger);
  margin-bottom: 4px;
}

.banner p {
  font-size: 0.9rem;
  color: var(--text);
  opacity: 0.88;
}

.banner-tips {
  margin: 10px 0 0;
  padding-left: 18px;
  font-size: 0.84rem;
  color: var(--muted);
  display: grid;
  gap: 2px;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 14px;
}

.section-head h2 {
  font-size: 1.02rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.count {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.peers {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 14px;
}

.peer-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 20px 14px 16px;
  text-align: center;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease,
    box-shadow 0.16s ease;
  animation: rise 0.35s ease both;
}

.peer-card:hover,
.peer-card:focus-visible {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  background: var(--surface-strong);
  box-shadow: 0 16px 40px rgba(2, 6, 23, 0.28);
}

.peer-card.drop-target {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.28);
  background: var(--surface-strong);
}

.peer-icon {
  font-size: 2rem;
  line-height: 1.2;
  margin-bottom: 6px;
}

.peer-name {
  font-weight: 650;
  font-size: 0.95rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.peer-action {
  font-size: 0.78rem;
  color: var(--muted);
}

.empty {
  padding: 26px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
}

.empty-title {
  font-weight: 650;
  color: var(--text);
  margin-bottom: 4px;
}

.empty .host {
  color: var(--text);
}

.transfers {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.transfer-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  animation: rise 0.3s ease both;
}

.transfer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.transfer-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.94rem;
  font-weight: 500;
  min-width: 0;
  color: var(--text);
}

.transfer-title strong {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.transfer-arrow {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 8px;
  font-weight: 700;
  color: var(--accent-2);
  background: var(--accent-soft);
}

.transfer-status {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.transfer-status[data-state="active"] {
  color: var(--accent-2);
}

.transfer-status[data-state="completed"] {
  color: var(--success);
}

.transfer-status[data-state="failed"],
.transfer-status[data-state="declined"] {
  color: var(--danger);
}

.transfer-status[data-state="cancelled"] {
  color: var(--warn);
}

.progress-track {
  margin-top: 12px;
  height: 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.16);
  overflow: hidden;
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.2s ease;
}

.transfer-card[data-state="completed"] .progress-bar {
  background: var(--success);
}

.transfer-card[data-state="failed"] .progress-bar,
.transfer-card[data-state="declined"] .progress-bar {
  background: var(--danger);
}

.transfer-card[data-state="cancelled"] .progress-bar {
  background: var(--warn);
}

.transfer-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.file-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  font-size: 0.84rem;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.file-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size {
  flex: none;
  color: var(--muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.file-row.file-done .file-name::after {
  content: " ✓";
  color: var(--success);
}

.file-row.file-received {
  border-color: rgba(52, 211, 153, 0.3);
}

.file-download {
  flex: none;
  padding: 4px 10px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
}

.file-download:hover {
  border-color: var(--accent-2);
  color: var(--accent-2);
}

.file-more {
  justify-content: center;
  color: var(--muted);
  background: transparent;
  border-style: dashed;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text);
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s ease, background 0.15s ease;
}

.banner .btn {
  flex: none;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  box-shadow: 0 10px 28px rgba(109, 124, 255, 0.32);
}

.btn-ghost {
  background: transparent;
}

.btn-small {
  padding: 6px 14px;
  font-size: 0.8rem;
}

.incoming-dialog {
  width: min(440px, calc(100vw - 32px));
  padding: 24px;
  color: var(--text);
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.incoming-dialog::backdrop {
  background: rgba(3, 7, 18, 0.62);
  backdrop-filter: blur(4px);
}

.dialog-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.dialog-lead {
  margin-top: 6px;
  font-size: 0.92rem;
  color: var(--muted);
}

.dialog-lead strong {
  color: var(--text);
}

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

.notes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.note {
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.note h3 {
  font-size: 0.9rem;
  font-weight: 650;
  margin-bottom: 4px;
}

.note p {
  font-size: 0.82rem;
  color: var(--muted);
}

.footer {
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  padding-top: 8px;
}

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  pointer-events: none;
  background: rgba(3, 7, 18, 0.66);
  backdrop-filter: blur(3px);
}

.drop-overlay-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 40px 54px;
  border: 2px dashed var(--accent-2);
  border-radius: var(--radius-lg);
  background: var(--surface-solid);
  box-shadow: var(--shadow);
}

.drop-icon {
  font-size: 2.4rem;
  line-height: 1;
  color: var(--accent-2);
}

.drop-overlay-card p {
  font-weight: 650;
  font-size: 1.05rem;
}

.toasts {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(92vw, 460px);
  pointer-events: none;
}

.toast {
  width: 100%;
  padding: 11px 16px;
  font-size: 0.86rem;
  text-align: center;
  color: var(--text);
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.toast-error {
  border-color: rgba(251, 113, 133, 0.5);
}

.toast-hide {
  opacity: 0;
  transform: translateY(6px);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 560px) {
  .shell {
    padding: 20px 16px 40px;
    gap: 20px;
  }

  .self-card {
    padding: 18px;
    gap: 14px;
  }

  .self-icon {
    width: 56px;
    height: 56px;
    font-size: 1.6rem;
  }

  .banner {
    flex-direction: column;
  }

  .peers {
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  }

  .transfer-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .status {
    padding: 7px 11px;
    font-size: 0.8rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
