:root {
  --bg: #f5f5f7;
  --card: #ffffff;
  --label: #1d1d1f;
  --secondary: #6e6e73;
  --tertiary: #a1a1a6;
  --separator: rgba(60, 60, 67, 0.16);
  --fill: rgba(120, 120, 128, 0.12);
  --green: #34c759;
  --green-ink: #1f8a3d;
  --green-tint: rgba(52, 199, 89, 0.14);
  --blue: #007aff;
  --red: #ff3b30;
  --nav: rgba(245, 245, 247, 0.72);
  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
  /* One type scale for the whole page */
  --text-title: 40px;
  --text-body: 17px;
  --text-secondary: 15px;
  --text-caption: 13px;
  color-scheme: only light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--label);
  font: var(--text-body)/1.47 var(--font);
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }

/* ---------- navigation bar ---------- */
.nav {
  position: sticky; top: 0; z-index: 20;
  background: var(--nav);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--separator);
}
.nav-inner {
  max-width: 680px; margin: 0 auto; height: 52px;
  padding: 0 16px; padding-top: env(safe-area-inset-top);
  display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; }
.brand img { width: 28px; height: 28px; }
.wordmark { font-weight: 700; font-size: var(--text-body); letter-spacing: -0.02em; }

/* ---------- page ---------- */
.page {
  flex: 1 0 auto;
  width: 100%; max-width: 680px; margin: 0 auto;
  padding: 40px 16px 24px;
}

.hero { text-align: center; margin-bottom: 60px; }
.hero-icon {
  position: relative; width: 112px; height: 112px; margin: 0 auto 20px;
  display: grid; place-items: center;
}
.hero-icon img {
  position: relative; width: 112px; height: 112px;
  filter: drop-shadow(0 10px 24px rgba(20, 110, 55, 0.22));
}
.pulse {
  position: absolute; inset: 0; margin: auto; width: 112px; height: 112px; border-radius: 50%;
  border: 1.5px solid var(--green); opacity: 0;
}
.hero-icon.on .pulse { animation: pulse 3s cubic-bezier(.25, .6, .3, 1) infinite; }
.hero-icon.on .p2 { animation-delay: 1s; }
.hero-icon.on .p3 { animation-delay: 2s; }
@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.55; }
  100% { transform: scale(2.4); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .hero-icon.on .pulse { animation: none; } }

.hero h1 { margin: 0; font-size: var(--text-title); line-height: 1.1; font-weight: 700; letter-spacing: -0.025em; }
.lede { margin: 8px auto 0; max-width: 420px; font-size: var(--text-body); line-height: 1.47; color: var(--secondary); }

/* ---------- two columns: names left, received right (stacked on phones) ---------- */
.col + .col { margin-top: 52px; }
@media (min-width: 900px) {
  .page { max-width: 1040px; }
  .columns { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: start; }
  .col + .col { margin-top: 0; }
}

/* ---------- grouped lists ---------- */
.group {
  background: var(--card); border-radius: 14px; overflow: hidden;
  box-shadow: 0 0.5px 0 rgba(0, 0, 0, 0.04);
}
.group + .group-title { margin-top: 52px; }
.group-title {
  margin: 0 0 14px 18px;
  font-size: var(--text-caption); font-weight: 400; text-transform: uppercase; letter-spacing: 0.02em; color: var(--secondary);
}
.row {
  display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 12px 16px;
  position: relative;
}
.row + .row::before, .list li + li::before {
  content: ""; position: absolute; top: 0; right: 0; left: 64px; height: 0.5px; background: var(--separator);
}
.row-avatar { flex: none; width: 36px; height: 36px; }
.row-avatar svg { width: 36px; height: 36px; display: block; }
.row-text { flex: 1; min-width: 0; display: grid; }
.row-title { font-weight: 500; }
.row-sub { font-size: var(--text-secondary); color: var(--secondary); font-variant-numeric: tabular-nums; }
.row-note { display: block; min-height: 0; padding: 12px 16px 14px 64px; font-size: var(--text-secondary); color: var(--secondary); }
.row-note b { color: var(--label); font-weight: 600; }

/* iOS 26/27 Liquid Glass switch: a wider track that turns blue, and a capsule thumb.
   While pressed the thumb swells into a clear glass lens you can see the track through,
   then springs back to solid white when released. */
.switch {
  flex: none; position: relative; width: 64px; height: 28px; padding: 0; border: 0; border-radius: 14px;
  background: rgba(120, 120, 128, 0.16);
  transition: background 0.35s cubic-bezier(.4, .1, .3, 1);
  -webkit-tap-highlight-color: transparent; cursor: pointer;
}
.switch[aria-checked="true"] { background: var(--blue); }
.switch span {
  position: absolute; top: 2px; left: 2px; width: 39px; height: 24px; border-radius: 12px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.14), 0 0.5px 1.5px rgba(0, 0, 0, 0.1);
  transition:
    transform 0.5s cubic-bezier(.3, 1.35, .4, 1),
    background 0.25s ease, box-shadow 0.25s ease;
}
.switch[aria-checked="true"] span { transform: translateX(21px); }

/* Pressed: the thumb becomes a glass lens. */
.switch:active span {
  transform: scale(1.32, 1.42);
  background: rgba(255, 255, 255, 0.18);
  -webkit-backdrop-filter: blur(1.5px) saturate(1.8) brightness(1.08);
  backdrop-filter: blur(1.5px) saturate(1.8) brightness(1.08);
  box-shadow:
    inset 0 0 0 0.75px rgba(255, 255, 255, 0.9),
    inset 0 1.5px 2px rgba(255, 255, 255, 0.85),
    inset 0 -1.5px 3px rgba(0, 0, 0, 0.08),
    0 4px 14px rgba(0, 0, 0, 0.16);
}
.switch[aria-checked="true"]:active span { transform: translateX(21px) scale(1.32, 1.42); }
.switch:disabled { opacity: 0.4; cursor: default; }
.switch:disabled span { transform: none; background: #fff; }
.switch:focus-visible { outline: 3px solid rgba(0, 122, 255, 0.3); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .switch, .switch span { transition: background 0.2s; } }

/* received items */
.list { list-style: none; margin: 0; padding: 0; }
.list li {
  position: relative; display: flex; align-items: center; gap: 14px; padding: 14px 18px; min-height: 68px;
}
/* Received items fade in. Names only animate when newly added (render() adds .appear). */
#inbox li, .contacts li.appear { animation: appear 0.35s cubic-bezier(.2, .8, .2, 1) both; }
.list li + li::before { left: 74px; }
.thumb {
  flex: none; width: 44px; height: 44px; border-radius: 9px; overflow: hidden; display: grid; place-items: center;
  background: var(--fill); color: var(--secondary); font-size: var(--text-caption); font-weight: 600; text-transform: uppercase;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb svg { width: 22px; height: 22px; }
.item-text { flex: 1; min-width: 0; display: grid; }
.item-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-meta { font-size: var(--text-secondary); color: var(--secondary); }
.pill {
  flex: none; border: 0; border-radius: 999px; padding: 6px 16px; text-decoration: none;
  background: var(--green-tint); color: var(--green-ink); font-size: var(--text-secondary); font-weight: 600;
}
.pill:hover { filter: brightness(0.96); }
.empty { margin: 0; padding: 22px 16px; text-align: center; color: var(--tertiary); font-size: var(--text-secondary); }
.footnote { margin: 16px 18px 0; font-size: var(--text-caption); color: var(--secondary); }
@keyframes appear { from { opacity: 0; transform: translateY(6px); } }

/* ---------- download pages (file.html / gone.html) ---------- */
.card { background: var(--card); border-radius: 18px; padding: 24px; display: grid; gap: 14px; }
.eyebrow { margin: 0; font-size: var(--text-caption); text-transform: uppercase; letter-spacing: 0.02em; color: var(--secondary); }
.muted { margin: 0; color: var(--secondary); }
.small { font-size: var(--text-secondary); }
.button {
  display: inline-flex; align-items: center; justify-content: center; height: 50px; padding: 0 22px;
  border: 0; border-radius: 12px; background: var(--green); color: #fff; font-size: var(--text-body); font-weight: 600; text-decoration: none;
}
.button.secondary { background: var(--fill); color: var(--label); }

/* ---------- toasts ---------- */
.toasts {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: grid; gap: 8px; z-index: 60; width: max-content; max-width: calc(100% - 32px);
}
.toast {
  padding: 12px 18px; border-radius: 14px; font-size: var(--text-secondary); font-weight: 500; color: var(--label);
  background: var(--nav); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15), 0 0 0 0.5px var(--separator);
  animation: appear 0.3s cubic-bezier(.2, .8, .2, 1) both;
}
.toast.out { opacity: 0; transform: translateY(6px); transition: 0.25s; }

.steps { display: inline-block; margin-top: 22px; text-align: left; font-size: var(--text-secondary); color: var(--secondary); }
.steps p { margin: 0 0 4px; }
.steps ol { margin: 0; padding-left: 20px; }
.steps li { padding-left: 2px; margin-bottom: 6px; }
.steps b { color: var(--label); font-weight: 500; }
.steps .steps-small { margin: 8px 0 0; font-size: 0.92em; opacity: 0.85; }

.footer {
  flex: none;
  width: 100%; max-width: 680px; margin: 0 auto; padding: 20px 32px max(24px, env(safe-area-inset-bottom));
  text-align: center; font-size: var(--text-caption); color: var(--secondary);
}
.footer a { color: var(--label); text-decoration: none; font-weight: 500; }
.footer a:hover { text-decoration: underline; }

/* ---------- AirDrop names (contacts) ---------- */
.contacts li { gap: 12px; }
.contacts .item-text { min-width: 0; }

/* Lead circle: shows the avatar, swaps to a delete button on hover (same 36px size). */
.row-lead { position: relative; flex: none; width: 36px; height: 36px; }
.row-lead .row-avatar { transition: opacity 0.15s; }
.row-del {
  position: absolute; inset: 0; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  background: #ff3b30; color: #fff;
  opacity: 0; transform: scale(0.82); transition: opacity 0.15s, transform 0.15s;
}
.row-del svg { width: 17px; height: 17px; }
@media (hover: hover) {
  .contacts li:hover .row-del, .row-del:focus-visible { opacity: 1; transform: scale(1); }
  .contacts li:hover .row-avatar { opacity: 0; }
}
@media (hover: none) {
  .row-del { opacity: 1; transform: scale(1); background: rgba(120, 120, 128, 0.22); color: var(--secondary); }
  .row-del:active { background: #ff3b30; color: #fff; }
  .row-lead .row-avatar { opacity: 0; }
}

.add-row {
  width: 100%; text-align: left; background: none; border: 0; cursor: pointer;
  display: flex; align-items: center; gap: 14px; min-height: 68px; padding: 14px 18px;
  position: relative; color: var(--blue); font: inherit;
}
.list + .add-row::before, .add-form::before {
  content: ""; position: absolute; top: 0; right: 0; left: 70px; height: 0.5px; background: var(--separator);
}
.row-plus {
  flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--blue); color: #fff;
}
.row-plus svg { width: 20px; height: 20px; display: block; }
.add-row .row-title { color: var(--blue); font-weight: 400; }

.add-form {
  display: flex; align-items: center; gap: 14px; min-height: 68px; padding: 14px 18px; position: relative;
}
/* The field sits where "Add an AirDrop name" was, same size, so the row doesn't jump when it opens. */
.add-form input {
  flex: 1; min-width: 0; height: 36px; padding: 0; border: 0; border-radius: 0;
  background: none; color: var(--label); font: inherit; font-size: var(--text-body); outline: none;
}
.add-form input::placeholder { color: var(--tertiary); }
.add-form .pill { padding: 5px 14px; }
.pill.solid { background: var(--blue); color: #fff; }
.pill.solid:hover { filter: brightness(0.96); }

code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.9em;
  background: var(--fill); padding: 1px 5px; border-radius: 5px;
}

/* ---------- host status / "Set up this Mac" ---------- */
.host-note { margin: 16px 18px 0; font-size: var(--text-secondary); color: var(--secondary); }
.setup {
  margin: 4px -18px 0; padding: 18px; border-radius: 14px; background: var(--card);
  display: grid; gap: 10px; color: var(--label);
}
.setup p { margin: 0; }
.setup-title { font-weight: 600; font-size: var(--text-body); }
.setup-cmd {
  display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--separator); min-width: 0;
}
.setup-cmd code {
  flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; background: none; padding: 0;
  font-size: var(--text-caption); color: var(--label);
}
.setup-small { font-size: var(--text-caption); color: var(--secondary); }

.add-row:disabled { cursor: default; opacity: 0.45; }

/* Party mode: a faint button after the footer credit, easy to miss on purpose */
.footer-sep { margin: 0 8px; color: var(--tertiary); }
.party {
  display: inline-flex; align-items: center; gap: 5px; margin: 0; padding: 2px; vertical-align: middle;
  border: 0; border-radius: 6px; background: none;
  font: inherit; font-size: var(--text-caption); color: var(--tertiary);
  opacity: 0.6; cursor: pointer; transition: opacity 0.2s, color 0.2s;
}
.party:hover, .party:focus-visible { opacity: 1; color: #ff9f0a; }
.party.on { opacity: 1; color: #ff9f0a; }
.party svg { width: 13px; height: 13px; flex: none; transition: transform 0.2s; }
.party.on svg { transform: rotate(-12deg); }

.confetti { position: fixed; z-index: 1000; pointer-events: none; will-change: transform, opacity; }

/* Reset (shown in party mode) sits at the right of the "AirDrop names" heading */
.group-head { display: flex; align-items: baseline; justify-content: space-between; }
.group-head .group-title { flex: 1; }
.reset-names {
  margin: 0 18px 14px 0; padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: var(--text-caption); font-weight: 400; line-height: inherit;
  text-transform: uppercase; letter-spacing: 0.02em; color: var(--red);
}
.reset-names:hover { opacity: 0.7; }

/* Party names pour in waterfall-style */
.contacts li.drop-in { animation: drop-in 0.45s cubic-bezier(0.34, 1.4, 0.64, 1) backwards; }
@keyframes drop-in {
  from { opacity: 0; transform: translateY(-24px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

.text-btn { padding: 0; border: 0; background: none; font: inherit; color: var(--blue); cursor: pointer; }
.text-btn:hover { text-decoration: underline; }
.host-note b { color: var(--label); font-weight: 500; }
