:root {
  color-scheme: light;
  --ink: #203239;
  --muted: #506168;
  --paper: #fffaf0;
  --line: #d8e1df;
  --action: #246456;
  --soft: #eff7f2;
  --red: #a1251c;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  line-height: 1.5;
}

.page-shell,
.transfer-nav { width: min(1080px, calc(100% - 48px)); margin-inline: auto; }
.transfer-nav nav { display: flex; align-items: center; gap: 18px; }
.page-shell { margin-block: 28px 64px; }

h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.85rem, 4vw, 2.75rem); line-height: 1.12; letter-spacing: -.035em; }
h2 { font-size: 1.35rem; line-height: 1.25; letter-spacing: -.02em; }
.intro { margin-bottom: 20px; }
.intro > p:first-of-type { margin-top: 8px; color: var(--muted); font-size: 1.0625rem; }
.privacy {
  margin-top: 14px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--action);
  border-radius: 8px;
  background: var(--soft);
  font-size: .875rem;
}
.transfer-update { display: block; margin-top: 4px; color: var(--muted); font-size: .8125rem; }

.transfer-panel {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 6px 24px #243e3810;
}

.panel-heading, .queue-heading, .button-row, .progress-label {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.panel-heading, .queue-heading, .progress-label { justify-content: space-between; }
.pairing-card {
  display: grid;
  grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
  align-items: center;
  gap: clamp(20px, 4vw, 44px);
  margin-top: 14px;
  padding: 16px clamp(16px, 3.5vw, 32px);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
}

.page-qr {
  display: grid;
  place-items: center;
  width: 100%;
  max-width: 320px;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  text-align: center;
}

.page-qr canvas { display: block; max-width: 100%; max-height: 100%; image-rendering: pixelated; }
.pairing-instructions > p + p { margin-top: 6px; color: var(--muted); }
.pairing-instructions .button-row { align-items: stretch; margin-top: 14px; }

button, .file-picker, .download-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border: 1px solid #bdcac6;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: .9375rem;
  font-weight: 650;
  cursor: pointer;
}

.primary-button { border-color: var(--action); background: var(--action); color: #fff; }
.compact-button, .file-list :is(button, .download-link) { flex-shrink: 0; padding-inline: 10px; font-size: .875rem; }
button:disabled { opacity: .56; cursor: not-allowed; }
button:not(:disabled):hover, .file-picker:hover, .download-link:hover { border-color: var(--action); filter: brightness(.96); }
a { color: var(--action); font-weight: 650; text-underline-offset: 3px; }
.download-link { text-decoration: none; }
:is(button, a, summary):focus-visible,
.drop-zone:focus-within { outline: 3px solid #3469bb; outline-offset: 3px; }

summary { width: fit-content; padding-block: 8px; font-weight: 650; cursor: pointer; }

.status-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbf9;
}

.status-line p { color: var(--muted); font-size: .875rem; }
.status-dot {
  flex: 0 0 10px;
  width: 10px;
  height: 10px;
  margin-top: 7px;
  border-radius: 50%;
  background: #8d6506;
}

.status-line:has([data-state="connected"]) { border-color: #b6d6c5; background: var(--soft); }
.status-line:has([data-state="connected"]) .status-dot { background: var(--action); }
.status-line:has([data-state="failed"], [data-state="disconnected"]) .status-dot { background: var(--red); }
.transfer-workspace { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 16px; margin-top: 16px; }
.drop-zone, .received-empty {
  margin-top: 12px;
  padding: 16px 12px;
  border: 1px dashed #8fa59c;
  border-radius: 10px;
  background: var(--soft);
  text-align: center;
}

.drop-zone.is-dragging { border-color: var(--action); background: #dfefe6; outline: 2px solid var(--action); }
.drop-title { margin-bottom: 8px; font-weight: 650; }
#file-input { position: absolute; width: 1px; height: 1px; opacity: 0; }
#file-input:disabled ~ .file-picker { opacity: .56; cursor: not-allowed; }
.queue-heading { margin-top: 12px; }
#file-summary { font-weight: 650; overflow-wrap: anywhere; }
.file-list { display: grid; gap: 0; margin: 12px 0 0; padding: 0; list-style: none; }
.file-list:empty { display: none; }
.file-list > li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.file-list > li:last-child { border-bottom: 1px solid var(--line); }
.file-list > li > :first-child { min-width: 0; }
.file-name { display: block; font-weight: 650; }
.file-size { display: block; color: var(--muted); font-size: .875rem; }
.send-button { width: 100%; margin-top: 12px; }
.progress-block { margin-top: 16px; }
.progress-label { margin-bottom: 4px; font-size: .875rem; overflow-wrap: anywhere; }
.progress-label > span, #transfer-detail, #received-detail { color: var(--muted); font-size: .875rem; }
progress { display: block; width: 100%; height: 14px; accent-color: var(--action); }
#transfer-detail, #received-detail:not(:empty) { margin-top: 7px; overflow-wrap: anywhere; }
.received-empty { display: grid; min-height: 101px; place-items: center; color: var(--muted); }
.error {
  margin-top: 12px;
  padding: 10px 12px;
  border-left: 3px solid var(--red);
  border-radius: 4px;
  background: #fff1ef;
  color: var(--red);
  overflow-wrap: anywhere;
}

.product-copy { margin-top: 34px; padding-top: 24px; border-top: 1px solid var(--line); }
.product-copy h2 { margin-bottom: 8px; }
.product-copy details p { max-width: 66ch; margin: 0 0 8px; color: var(--muted); }
.product-copy > p { margin-top: 9px; }

@media (max-width: 720px) {
  .page-shell, .transfer-nav { width: calc(100% - 28px); }
  .page-shell { margin-block: 22px 44px; }
  .transfer-workspace { grid-template-columns: minmax(0, 1fr); }
  .pairing-card { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .page-qr { margin-inline: auto; }
}

@media (max-width: 450px) {
  .transfer-nav nav > a:not(.nav-pill) { display: none; }
  .transfer-panel { padding: 14px; }
  .pairing-card { padding: 12px; }
  .button-row > button { flex: 1 1 130px; }
}
