:root {
  --paper: #EDF0F4;
  --surface: #FFFFFF;
  --ink: #18202E;
  --muted: #5B6678;
  --line: #CBD2DD;
  --signal: #2E55E6;
  --signal-ink: #FFFFFF;
  --signal-soft: #DCE4FD;
  --ok: #17845C;
  --warn: #B4471C;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Instrument Sans", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #10151F;
    --surface: #182030;
    --ink: #E4E9F2;
    --muted: #95A0B3;
    --line: #2A3447;
    --signal: #7F9BFF;
    --signal-ink: #0E1424;
    --signal-soft: #1F2B4D;
    --ok: #4CC795;
    --warn: #F08A5D;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.55 var(--body);
}

a { color: var(--signal); }

button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }

[hidden] { display: none !important; }

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 16px 0;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 700 1.25rem/1 var(--display);
  color: var(--ink);
  text-decoration: none;
}

.wordmark svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: var(--signal);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.wordmark svg circle { fill: var(--signal); stroke: none; }

.receive-form { display: flex; align-items: center; gap: 8px; }

.receive-form label { color: var(--muted); font-size: .9375rem; }

.receive-form input {
  width: 7.5em;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-variant-numeric: tabular-nums;
  letter-spacing: .12em;
}

.receive-form button {
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}

main {
  flex: 1;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 48px 16px 40px;
}

main:focus { outline: none; }

h1 {
  margin: 0 0 12px;
  font: 700 clamp(2rem, 6vw, 2.75rem)/1.08 var(--display);
  letter-spacing: -.02em;
}

h2 {
  margin: 0 0 8px;
  font: 700 1.375rem/1.2 var(--display);
}

.lead { margin: 0 0 32px; color: var(--muted); font-size: 1.0625rem; max-width: 34em; }

.muted { color: var(--muted); }

.switch {
  display: inline-flex;
  padding: 4px;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.switch button {
  padding: 8px 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 500;
  cursor: pointer;
}

.switch button[aria-selected="true"] { background: var(--ink); color: var(--paper); }

.drop {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  min-height: 200px;
  padding: 28px 20px;
  border: 2px dashed var(--line);
  border-radius: 16px;
  background: var(--surface);
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background-color .15s;
}

.drop strong { font: 600 1.125rem/1.3 var(--display); }

.drop.over, .drop:hover { border-color: var(--signal); }

.drop.over { background: var(--signal-soft); }

.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.files {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.files li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.files .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.files .size { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .9375rem; }

.files .bar { grid-column: 1 / -1; }

textarea {
  display: block;
  width: 100%;
  min-height: 220px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  resize: vertical;
  line-height: 1.5;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-top: 16px;
}

select {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.options label { display: inline-flex; align-items: center; gap: 8px; }

.options input {
  width: 5.5em;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.hint { margin: 8px 0 0; font-size: .9375rem; }

.field {
  display: block;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.share-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.link-view { overflow-wrap: anywhere; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border: 0;
  border-radius: 10px;
  background: var(--signal);
  color: var(--signal-ink);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

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

.btn.quiet {
  padding: 10px 16px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-weight: 500;
}

.btn.small { padding: 6px 12px; font-size: .9375rem; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }

/* The share code is the one loud thing on the page. */
.code {
  display: flex;
  gap: clamp(6px, 2vw, 12px);
  margin: 8px 0 24px;
}

.code span {
  display: grid;
  place-items: center;
  width: clamp(44px, 13vw, 72px);
  aspect-ratio: 3 / 4;
  border-radius: 12px;
  background: var(--ink);
  color: var(--paper);
  font: 700 clamp(1.75rem, 8vw, 3rem)/1 var(--display);
  font-variant-numeric: tabular-nums;
}

/* 4-digit codes read as two pairs: 12 34. */
.code span:nth-child(2) { margin-right: clamp(6px, 2vw, 14px); }

.share-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: start;
}

.qr {
  width: 156px;
  padding: 8px;
  border-radius: 12px;
  background: #FFFFFF;
  line-height: 0;
}

.qr svg { width: 100%; height: auto; }

.link {
  display: flex;
  gap: 8px;
  margin: 8px 0 16px;
}

.link input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
}

.dot.live { background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 22%, transparent); }

.dot.off { background: var(--warn); }

.bar {
  height: 6px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--signal);
  transition: width .2s linear;
}

.bar.done i { background: var(--ok); }

.peers { margin-top: 32px; }

.peers h2 { font-size: 1.125rem; }

.peer { padding: 12px 0; border-bottom: 1px solid var(--line); }

.peer:first-of-type { border-top: 1px solid var(--line); }

.peer p { margin: 0 0 8px; display: flex; justify-content: space-between; gap: 12px; }

.notice {
  margin: 20px 0 0;
  padding: 12px 14px;
  border-left: 3px solid var(--warn);
  background: var(--surface);
  border-radius: 0 8px 8px 0;
}

.text-view {
  margin: 16px 0 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: .9375rem;
  max-height: 60vh;
  overflow: auto;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--paper);
  font-size: .9375rem;
  pointer-events: none;
}

.foot {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px 32px;
  color: var(--muted);
  font-size: .875rem;
}

.foot p { margin: 0; max-width: 46em; }

@media (max-width: 560px) {
  main { padding-top: 32px; }
  .receive-form label { display: none; }
  .share-grid { grid-template-columns: 1fr; }
  .qr { width: 180px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
