/* =========================================================
   FilesAround – styles (shared by every page)
   ---------------------------------------------------------
   • Mobile-first: base styles are for phones; the @media
     (min-width: …) blocks at the bottom adjust bigger screens.
   • Colours are "tokens" (CSS variables). Light mode is the
     default; dark mode is applied when:
       - the system is dark AND the user didn't pick light, or
       - the user picked dark with the toggle (data-theme="dark").
   ========================================================= */

/* ---------- LIGHT theme tokens (default) ---------- */
:root {
  --bg: #f4f7fb;              /* page background */
  --bg-glow: rgba(8, 145, 178, 0.14);
  --surface: #ffffff;         /* cards */
  --surface-2: #eef3f8;       /* inputs, list rows, status pill */
  --border: #dbe3ec;
  --text: #0f1b2d;
  --muted: #5b6b80;

  /* Primary = teal/blue (trust + speed) */
  --primary: #0e7490;         /* text-safe teal for links/wordmark */
  --primary-soft: rgba(8, 145, 178, 0.12);
  --grad-primary: linear-gradient(135deg, #0891b2, #2563eb);

  /* Accent = bright coral, used for the MAIN action buttons */
  --accent: #f04e23;
  --grad-accent: linear-gradient(135deg, #f04e23, #ff7a3d);
  --on-color: #ffffff;        /* text on coloured buttons */

  --success: #0f8f6c;
  --warn: #a8670f;
  --warn-bg: rgba(245, 158, 11, 0.14);
  --error: #d1293d;
  --error-bg: rgba(209, 41, 61, 0.1);

  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 6px 24px rgba(15, 27, 45, 0.08);
  --shadow-btn: 0 8px 20px rgba(15, 27, 45, 0.16);

  color-scheme: light;
}

/* ---------- DARK theme tokens ---------- */
/* 1) Follow the system… unless the user chose light. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a1220;
    --bg-glow: rgba(34, 195, 221, 0.12);
    --surface: #111c2e;
    --surface-2: #0c1626;
    --border: #1f2d44;
    --text: #e6eef8;
    --muted: #93a4bb;
    --primary: #3cc8e0;
    --primary-soft: rgba(60, 200, 224, 0.14);
    --accent: #ff6a45;
    --success: #2dd4a7;
    --warn: #f5b942;
    --warn-bg: rgba(245, 185, 66, 0.12);
    --error: #ff6b7a;
    --error-bg: rgba(255, 107, 122, 0.12);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    --shadow-btn: 0 10px 24px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}
/* 2) …or the user explicitly chose dark with the toggle. */
:root[data-theme="dark"] {
  --bg: #0a1220;
  --bg-glow: rgba(34, 195, 221, 0.12);
  --surface: #111c2e;
  --surface-2: #0c1626;
  --border: #1f2d44;
  --text: #e6eef8;
  --muted: #93a4bb;
  --primary: #3cc8e0;
  --primary-soft: rgba(60, 200, 224, 0.14);
  --accent: #ff6a45;
  --success: #2dd4a7;
  --warn: #f5b942;
  --warn-bg: rgba(245, 185, 66, 0.12);
  --error: #ff6b7a;
  --error-bg: rgba(255, 107, 122, 0.12);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-btn: 0 10px 24px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 16px; }

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(900px 480px at 50% -160px, var(--bg-glow), transparent 70%), var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

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

:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 6px; }

/* ---------- Header ---------- */
.site-header { width: 100%; }
.header-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 16px 4px;
  display: grid;
  grid-template-columns: 1fr auto;   /* phone: [logo | tools] then nav on its own row */
  grid-template-areas:
    "brand tools"
    "nav   nav";
  align-items: center;
  row-gap: 6px;
}
.brand {
  grid-area: brand;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  justify-self: start;
}
.brand-mark { width: 32px; height: 32px; color: var(--primary); flex: none; }
.brand-name span { color: var(--primary); }

.site-nav {
  grid-area: nav;
  display: flex;
  gap: 4px;
  overflow-x: auto;
}
.site-nav a {
  flex: none;
  padding: 10px 14px;           /* comfy 44px-ish touch target */
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}
.site-nav a:hover { color: var(--text); background: var(--primary-soft); }
.site-nav a[aria-current="page"] { color: var(--primary); background: var(--primary-soft); }

.header-tools { grid-area: tools; display: flex; align-items: center; gap: 8px; }
.theme-toggle {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.theme-toggle:hover { background: var(--primary-soft); }

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px 32px;
  flex: 1;
}
.screen { animation: fade-in 0.25s ease; }
@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Hero ---------- */
.hero { padding: 20px 0 8px; }
.hero-title {
  font-size: 2.1rem;
  line-height: 1.12;
  letter-spacing: -0.03em;
  margin: 18px 0 12px;
  text-wrap: balance;   /* avoids a lonely last word on wide screens */
}
.hero-sub { color: var(--muted); margin: 0 0 24px; font-size: 1.05rem; }
.hero-sub strong { color: var(--text); }

/* Animated radar ripples */
.hero-mark { position: relative; width: 72px; height: 72px; }
.hero-mark .ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--primary);
  opacity: 0;
  animation: ripple 2.4s ease-out infinite;
}
.hero-mark .ring:nth-child(2) { animation-delay: 0.8s; }
.hero-mark .ring:nth-child(3) { animation-delay: 1.6s; }
.hero-mark .dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border-radius: 50%;
  background: var(--grad-primary);
  box-shadow: 0 0 0 6px var(--primary-soft);
}
@keyframes ripple {
  from { transform: scale(0.25); opacity: 0.9; }
  to   { transform: scale(1);    opacity: 0; }
}
/* Respect users who turned off animations in their OS */
@media (prefers-reduced-motion: reduce) {
  .hero-mark .ring { animation: none; opacity: 0.35; }
  .hero-mark .ring:nth-child(1) { transform: scale(0.55); }
  .hero-mark .ring:nth-child(2) { transform: scale(0.8); }
  .screen { animation: none; }
  html { scroll-behavior: auto; }
}

/* ---------- Big home buttons ---------- */
.home-buttons { display: grid; gap: 14px; }

.big-btn {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 16px;
  align-items: center;
  text-align: left;
  width: 100%;
  min-height: 92px;
  padding: 20px;
  border: 0;
  border-radius: var(--radius);
  color: var(--on-color);
  font: inherit;
  cursor: pointer;
  box-shadow: var(--shadow-btn);
  transition: transform 0.15s ease, filter 0.15s ease;
}
.big-btn:hover { filter: brightness(1.06); }
.big-btn:active { transform: scale(0.98); }
.big-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.big-btn-send    { background: var(--grad-accent); }   /* main action = bright accent */
.big-btn-receive { background: var(--grad-primary); }
.big-btn-icon {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.2);
}
.big-btn-label { font-size: 1.45rem; font-weight: 800; line-height: 1.2; }
.big-btn-hint  { font-size: 0.92rem; opacity: 0.92; }

.trust-row {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.trust-row li {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---------- Content sections (How it works, FAQ) ---------- */
.content-section { margin-top: 48px; }
.section-title {
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
}

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}
.step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.step h3 { margin: 10px 0 4px; font-size: 1.05rem; }
.step p  { margin: 0; color: var(--muted); }
.step-num {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 800;
}

.faq { display: grid; gap: 10px; }
.faq details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 16px;
}
.faq summary {
  cursor: pointer;
  list-style: none;
  padding: 16px 28px 16px 0;    /* big touch area */
  font-weight: 700;
  position: relative;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {            /* the + / – sign on the right */
  content: "+";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary);
  font-size: 1.4rem;
  font-weight: 600;
}
.faq details[open] summary::after { content: "–"; }
.faq details p { margin: 0 0 16px; color: var(--muted); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  margin: 14px 0;
  box-shadow: var(--shadow);
}
.label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 18px 0 8px;
}
.hint { color: var(--muted); font-size: 0.85rem; margin: 8px 0 0; }

/* ---------- Status pill ---------- */
.status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-weight: 600;
  font-size: 0.95rem;
}
.status::before {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
}
.status[data-state="waiting"]::before   { background: var(--warn); animation: pulse 1.2s infinite; }
.status[data-state="connected"]::before { background: var(--success); }
.status[data-state="done"]::before      { background: var(--success); }
.status[data-state="error"]             { color: var(--error); background: var(--error-bg); }
.status[data-state="error"]::before     { background: var(--error); }
@keyframes pulse { 50% { opacity: 0.3; } }

/* ---------- Room code ---------- */
.room-code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  /* Grows with the screen but always fits codes like "PENGUIN-42" on small phones */
  font-size: clamp(1.7rem, 9vw, 3.2rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  white-space: nowrap;
  text-align: center;
  padding: 12px 0;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--primary);
  user-select: all;
}

/* ---------- Inputs & buttons ---------- */
.input {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 16px; /* 16px stops iPhones from zooming in on focus */
}
.input:focus { outline: 2px solid var(--primary); outline-offset: 1px; }

.code-form { display: flex; gap: 8px; margin-top: 14px; }
.link-input { font-size: 0.9rem; color: var(--muted); }
.code-input {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
}
.code-input::placeholder { color: var(--muted); opacity: 0.5; }

/* Copy link + Share side by side */
.share-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.share-buttons .btn,
.btn-block {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}
.hint-center { text-align: center; }
.code-example {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}

/* "—— or ——" line between typing a code and scanning */
.or-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--muted);
  font-size: 0.85rem;
}
.or-divider::before, .or-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Camera QR scanner */
.scan-box { display: grid; gap: 10px; }
.qr-reader {
  width: 100%;
  min-height: 240px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #000;
}
.qr-reader video { width: 100% !important; height: auto !important; display: block; }

.btn {
  flex: none;
  min-height: 48px;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.1s ease;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary   { background: var(--grad-accent); color: var(--on-color); }
.btn-secondary { background: var(--primary-soft); color: var(--primary); }
.btn-ghost     { background: transparent; color: var(--muted); border-color: var(--border); }
.btn:hover:not(:disabled) { filter: brightness(1.06); }
.btn-ghost:hover:not(:disabled) { color: var(--text); }
.btn-small { min-height: 38px; padding: 6px 12px; font-size: 0.85rem; }

.actions { display: grid; gap: 10px; margin: 6px 0 14px; }
.actions .btn { width: 100%; }

/* ---------- QR ---------- */
.qr-wrap { text-align: center; margin-top: 18px; }
.qr {
  display: inline-block;
  padding: 12px;
  background: #fff;          /* QR codes need a light background to scan – even in dark mode */
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  line-height: 0;
  min-width: 206px;
  min-height: 206px;
}
.qr img, .qr canvas { display: block; }

/* ---------- Drop zone ---------- */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 28px 16px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone:hover, .dropzone.drag-over {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.dropzone-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 1.6rem;
  margin-bottom: 6px;
}
.dropzone-title { font-weight: 700; font-size: 1.05rem; }
.dropzone-hint  { color: var(--muted); font-size: 0.9rem; }

/* ---------- File lists ---------- */
.file-list { list-style: none; margin: 0; padding: 0; }
.file-list:not(:empty) { margin-top: 14px; }
.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  margin-bottom: 8px;
}
.file-item-main { flex: 1; min-width: 0; }
.file-item-name {
  display: block;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-item-meta { color: var(--muted); font-size: 0.85rem; }
.file-item.is-sent .file-item-meta { color: var(--success); }
.remove-btn {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.3rem;
  cursor: pointer;
}
.remove-btn:hover { color: var(--error); background: var(--error-bg); }

/* ---------- Progress ---------- */
.file-count { color: var(--muted); font-size: 0.85rem; margin-bottom: 4px; }
.file-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.file-name {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.file-size { flex: none; color: var(--muted); }
.bar {
  height: 12px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--grad-primary);
  transition: width 0.2s linear;  /* makes the bar move smoothly */
}
.stats {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}
.stats span:first-child { color: var(--text); font-weight: 700; }

/* ==========================================================================
   PHASE 4 – More ways to share
   ========================================================================== */

/* "Need files from someone? Request files with a link" on the home screen */
.request-row { text-align: center; color: var(--muted); font-size: 0.92rem; margin: 14px 0 0; }
.link-btn {
  background: none;
  border: 0;
  padding: 4px 2px;
  color: var(--primary);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* Files | Text tabs */
.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.tab {
  min-height: 42px;
  border: 0;
  border-radius: calc(var(--radius-sm) - 3px);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.tab[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* Folder button + "Compress photos" switch */
.picker-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
}
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 0.92rem; font-weight: 600; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  position: relative;
  width: 42px;
  height: 24px;
  flex: none;
  border-radius: 999px;
  background: var(--border);
  transition: background 0.2s;
}
.switch-track::after {             /* the round knob */
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.3);
  transition: transform 0.2s;
}
.switch input:checked + .switch-track { background: var(--primary); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Text tab */
.text-input { min-height: 130px; resize: vertical; line-height: 1.45; }
.text-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.text-actions .hint { flex: 1; margin: 0; }

/* "Zipping… / Compressing…" line */
.prep-status {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
  font-size: 0.9rem;
}
.file-item-icon { flex: none; font-size: 1.2rem; }

/* Password (sender) */
.password-box {
  margin-top: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 14px;
}
.password-box summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 48px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.password-box summary::-webkit-details-marker { display: none; }
.password-state { color: var(--muted); font-weight: 600; font-size: 0.85rem; }
.password-form { display: flex; gap: 8px; }
.password-box .hint { margin-bottom: 14px; }

/* Receivers list (sender): one row + progress bar per receiver */
.receiver-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.receiver-row { padding: 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.receiver-top { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.receiver-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.receiver-state { flex: none; color: var(--muted); font-size: 0.85rem; }
.receiver-stats { color: var(--muted); font-size: 0.82rem; margin-top: 6px; min-height: 1em; }
.receiver-row[data-status="done"] .receiver-state { color: var(--success); font-weight: 700; }
.receiver-row[data-status="left"] { opacity: 0.6; }
.receiver-row[data-status="left"] .bar-fill { background: var(--muted); }

/* Received text message */
.text-item {
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  margin-bottom: 8px;
}
.text-body {
  white-space: pre-wrap;        /* keep the sender's line breaks */
  overflow-wrap: anywhere;      /* long links wrap instead of overflowing */
  max-height: 260px;
  overflow: auto;
  padding: 10px 12px;
  border-radius: calc(var(--radius-sm) - 4px);
  background: var(--surface);
  border: 1px solid var(--border);
  user-select: text;
}
.text-body a { color: var(--primary); font-weight: 600; }
.text-item-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; }

/* ==========================================================================
   PHASE 5 – Big files: overall progress + "screen stays on" note
   ========================================================================== */
.overall { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.overall-text { color: var(--muted); font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; }
.bar-thin { height: 6px; }
.wake-indicator { text-align: center; color: var(--muted); font-size: 0.85rem; margin: 0 0 8px; }
.receiver-row[data-status="reconnecting"] .receiver-state { color: var(--warn); font-weight: 700; }

/* ---------- Alerts & note ---------- */
.alert {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}
.alert-warn  { background: var(--warn-bg); color: var(--warn); }
.alert-error { background: var(--error-bg); color: var(--error); margin: 12px 0; }

.note {
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  margin: 32px auto 0;
  max-width: 460px;
}

/* ---------- Text pages (About, Privacy, Terms, Contact) ---------- */
.prose { padding-top: 16px; }
.prose h1 { font-size: 2rem; letter-spacing: -0.03em; line-height: 1.15; margin: 16px 0 8px; }
.prose h2 { font-size: 1.2rem; margin: 28px 0 8px; }
.prose p, .prose li { color: var(--text); }
.prose .lead { color: var(--muted); font-size: 1.05rem; }
.prose ul { padding-left: 20px; }
.prose li { margin-bottom: 6px; }
.prose .updated { color: var(--muted); font-size: 0.9rem; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 20px 16px 28px;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}
.footer-nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-bottom: 8px;
}
.footer-nav a {
  padding: 8px 10px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}
.footer-nav a:hover { color: var(--primary); }
.site-footer p { margin: 0; }

/* ---------- Nearby devices (radar) ---------- */
.nearby-card { margin-top: 18px; text-align: center; }
.nearby-title { font-size: 1.15rem; margin: 0 0 12px; }

.radar {
  position: relative;
  width: min(100%, 340px);
  aspect-ratio: 1 / 1;          /* always a perfect circle area */
  margin: 0 auto;
}
.radar-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 50%;
  border: 1px solid var(--border);
  transform: translate(-50%, -50%);
}
.radar-ring.r1 { width: 34%; height: 34%; }
.radar-ring.r2 { width: 64%; height: 64%; }
.radar-ring.r3 { width: 94%; height: 94%; background: radial-gradient(circle, var(--primary-soft), transparent 70%); }

/* The rotating "sweep" like a real radar screen */
.radar-sweep {
  position: absolute;
  inset: 3%;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0deg, transparent 300deg, var(--primary-soft) 350deg, transparent 360deg);
  animation: radar-spin 4s linear infinite;
  pointer-events: none;
}
@keyframes radar-spin { to { transform: rotate(360deg); } }

/* "You" in the middle */
.radar-me {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: grid;
  justify-items: center;
  gap: 2px;
}
.radar-me-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--grad-primary);
  color: #fff;
  box-shadow: 0 0 0 6px var(--primary-soft);
}
.radar-me-label { font-size: 0.75rem; font-weight: 700; color: var(--muted); }

/* Other devices */
.radar-devices { list-style: none; margin: 0; padding: 0; }
.radar-device {
  position: absolute;
  transform: translate(-50%, -50%);
  transition: left 0.4s ease, top 0.4s ease;  /* bubbles glide when the list changes */
  animation: bubble-in 0.35s ease-out;
}
@keyframes bubble-in {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.device-bubble {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 4px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  border-radius: 16px;
}
.device-avatar {
  --hue: 190;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: hsl(var(--hue) 65% 45%);   /* each device gets its own colour */
  color: #fff;
  box-shadow: var(--shadow-btn);
  transition: transform 0.15s ease;
}
.device-bubble:hover .device-avatar,
.radar-device.drag-over .device-avatar { transform: scale(1.1); }
.device-bubble:active .device-avatar { transform: scale(0.95); }
.radar-device.drag-over .device-avatar { outline: 3px solid var(--accent); outline-offset: 3px; }
.device-name {
  max-width: 96px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.radar-empty { color: var(--muted); font-size: 0.9rem; margin: 6px 0 0; min-height: 1.4em; }

/* "You appear as [Blue Fox ✎]" */
.me-row {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.95rem;
}
.name-edit {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--primary);
}
.name-input {
  width: 12ch;
  min-height: 40px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  font-size: 16px; /* stops iPhone zoom */
  text-align: center;
}
.name-input:focus { outline: none; }
.name-edit:focus-within { outline: 2px solid var(--primary); outline-offset: 1px; }
.nearby-hint { max-width: 420px; margin: 10px auto 0; }

/* ---------- Accept / Decline prompt ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  align-items: end;              /* phones: slides up from the bottom */
  justify-items: center;
  padding: 16px;
  background: rgba(5, 10, 20, 0.55);
  animation: fade-in 0.2s ease;
}
.modal-card {
  width: 100%;
  max-width: 440px;
  max-height: 85vh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 18px 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
.offer-head { text-align: center; }
.offer-avatar { margin: 0 auto 10px; width: 64px; height: 64px; }
.offer-title { font-size: 1.2rem; margin: 0; line-height: 1.3; }
.offer-title span { color: var(--primary); }
.offer-summary { color: var(--muted); margin: 4px 0 0; }
.offer-files { margin-top: 14px; }
.offer-more { color: var(--muted); font-size: 0.9rem; text-align: center; padding: 4px 0 8px; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.modal-actions .btn { width: 100%; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 60;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  font-size: 0.92rem;
  box-shadow: var(--shadow-btn);
  animation: fade-in 0.2s ease;
}

@media (prefers-reduced-motion: reduce) {
  .radar-sweep, .radar-device { animation: none; }
  .radar-device { transition: none; }
}

/* ---------- Bigger screens (tablets / desktops) ---------- */
@media (min-width: 640px) {
  .header-inner { padding-top: 16px; }

  .hero { text-align: center; padding-top: 32px; }
  .hero-mark { margin: 0 auto; }
  .hero-title { font-size: 2.8rem; }
  .hero-sub { max-width: 520px; margin-left: auto; margin-right: auto; }
  .trust-row { justify-content: center; }

  .home-buttons { grid-template-columns: 1fr 1fr; }
  .big-btn {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    justify-items: center;
    text-align: center;
    row-gap: 6px;
    padding: 30px 20px;
  }
  .big-btn-icon { grid-row: auto; width: 64px; height: 64px; margin-bottom: 6px; }

  .steps { grid-template-columns: repeat(3, 1fr); }
  .modal { align-items: center; }  /* centred dialog on bigger screens */
  .radar { width: min(100%, 380px); }
  .section-title { text-align: center; }

  .card { padding: 24px; }
  .actions { grid-template-columns: 1fr 1fr; }
  .actions-secondary { grid-template-columns: 1fr; }
}

/* ==========================================================================
   PHASE 6 – Header tools, content pages, guides, ads
   ========================================================================== */

/* Wide screens: [logo | nav | tools] on one row */
@media (min-width: 900px) {
  .header-inner {
    max-width: 1040px;
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "brand nav tools";
    column-gap: 16px;
  }
  .site-nav { justify-content: flex-end; }
}

/* Language menu */
.lang-select {
  min-height: 44px;
  max-width: 7.5rem;
  padding: 0 28px 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23889'/%3E%3C/svg%3E") no-repeat right 12px center;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
.lang-select:empty { display: none; } /* until i18n.js fills it */

/* "Install app" button (only shown when the browser allows installing) */
.btn-install {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 0;
  background: var(--grad-primary);
  color: var(--on-color);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
@media (max-width: 420px) {
  .brand { font-size: 1.15rem; gap: 8px; }
  .brand-mark { width: 28px; height: 28px; }
  .header-tools { gap: 6px; }
  .lang-select { max-width: 6.2rem; padding-left: 10px; }
}

/* Links under "How it works" on the home page */
.more-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; margin: 24px 0 0; font-weight: 600; }
.more-links a { text-decoration: none; }
.more-links a:hover { text-decoration: underline; }

/* ---------- Ad slots ----------
   Empty until you paste an AdSense unit inside, so visitors never see a
   blank box. Add ?adslots to the URL to preview where they are. */
.ad-slot { margin: 16px auto; text-align: center; overflow: hidden; }
.ad-slot:empty { display: none; }
#recv-progress-card[hidden] + .ad-slot { display: none; } /* only during/after a transfer */
.show-ad-slots .ad-slot,
.show-ad-slots .ad-slot:empty {
  display: grid !important;
  place-items: center;
  min-height: 120px;
  border: 2px dashed var(--accent);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-weight: 700;
}
.show-ad-slots .ad-slot::before { content: "Ad slot: " attr(data-ad-slot); }
.ad-slot-sidebar { min-width: 0; }

/* ---------- Content pages ---------- */
.prose a { text-underline-offset: 3px; }
.prose code { font-size: 0.9em; padding: 1px 5px; border-radius: 5px; background: var(--surface-2); }
.prose ol { padding-left: 22px; }
.prose .faq { margin-top: 20px; }
.cta-line { margin-top: 28px; }
.prose .btn { text-decoration: none; }
.small-print { color: var(--muted); font-size: 0.85rem; margin-top: 24px; }

/* How-it-works diagram (colours follow light/dark mode) */
.diagram { margin: 24px 0; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.diagram svg { display: block; width: 100%; height: auto; }
.diagram figcaption { color: var(--muted); font-size: 0.9rem; text-align: center; margin-top: 10px; }
.dg-box { fill: var(--surface-2); stroke: var(--border); stroke-width: 2; }
.dg-device { fill: var(--surface-2); stroke: var(--text); stroke-width: 3; stroke-linejoin: round; }
.dg-screen { fill: var(--primary-soft); }
.dg-dot { fill: var(--text); }
.dg-label { fill: var(--text); font: 700 15px system-ui, sans-serif; }
.dg-small { fill: var(--muted); font: 13px system-ui, sans-serif; }
.dg-accent { fill: var(--accent); }
.dg-accent-fill { fill: var(--accent); }
.dg-arrow { stroke: var(--accent); stroke-width: 4; fill: none; stroke-linecap: round; }
.dg-dashed { stroke: var(--muted); stroke-width: 2; stroke-dasharray: 6 6; fill: none; }
.dg-file { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.dg-file-text { fill: var(--text); font: 600 13px system-ui, sans-serif; }
.dg-cloud { fill: none; stroke: var(--muted); stroke-width: 3; }
.dg-cross { stroke: var(--error); stroke-width: 5; stroke-linecap: round; }

/* ---------- Guides ---------- */
.container-wide { max-width: 1040px; }
.guide-layout { display: grid; gap: 24px; padding-top: 16px; }
.guide { padding-top: 0; min-width: 0; }
.breadcrumbs { font-size: 0.88rem; color: var(--muted); margin-bottom: 4px; }
.breadcrumbs a { color: var(--muted); }
.cta-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  margin: 20px 0;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--primary-soft);
}
.cta-box p { margin: 0; flex: 1 1 260px; }
.guide-sidebar { display: grid; gap: 16px; align-content: start; }
.sidebar-card { margin: 0; }
.sidebar-title { font-size: 1rem; margin: 0 0 8px; }
.sidebar-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-size: 0.95rem; }
@media (min-width: 900px) {
  .guide-layout { grid-template-columns: minmax(0, 1fr) 300px; gap: 40px; }
  .guide-sidebar { position: sticky; top: 16px; }
}
.guide-list { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 12px; }
.guide-card a {
  display: grid;
  gap: 4px;
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
}
.guide-card a:hover { border-color: var(--primary); }
.guide-card-title { font-weight: 700; font-size: 1.05rem; color: var(--primary); }
.guide-card-desc { color: var(--muted); font-size: 0.92rem; }
