/*
 * pagedrop UI, Apple-style.
 * Principles (apple-design / emil-design-eng): system type with size-specific tracking, light + dark that follow
 * the system, translucent chrome that content scrolls under, feedback on press, enter/exit that grow from where
 * they came, short ease-out motion (< 300 ms), and gentler equivalents for reduced motion / transparency.
 * Every :hover lives behind (hover: hover) so taps never leave a stuck hover state.
 */

/* ---------- tokens ---------- */
:root {
  color-scheme: light dark;

  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #fbfbfd;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #86868b;
  --separator: rgba(0, 0, 0, 0.08);
  --fill: rgba(118, 118, 128, 0.12);
  --fill-strong: rgba(118, 118, 128, 0.2);
  --accent: #0071e3;
  --accent-press: #006edb;
  --accent-text: #ffffff;
  --accent-soft: rgba(0, 113, 227, 0.12);
  --ok: #248a3d;
  --ok-soft: rgba(36, 138, 61, 0.1);
  --warn: #b25000;
  --warn-soft: rgba(255, 149, 0, 0.12);
  --bad: #d70015;
  --bad-soft: rgba(255, 59, 48, 0.1);

  --glass: rgba(245, 245, 247, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.78);
  --glass-edge: rgba(255, 255, 255, 0.6);
  --scrim: rgba(0, 0, 0, 0.28);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 0 0 0.5px var(--separator);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08), 0 0 0 0.5px var(--separator);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.18), 0 0 0 0.5px var(--separator);

  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;

  /* Motion: strong ease-out for things arriving, quick for things leaving. */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --t-press: 120ms;
  --t-fast: 160ms;
  --t-med: 240ms;

  --font: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Soft graphite, never pure black: easier on the eyes and reads as a finished product. */
    --bg: #141416;
    --surface: #1f1f22;
    --surface-2: #26262a;
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --text-3: #8e8e93;
    --separator: rgba(255, 255, 255, 0.1);
    --fill: rgba(118, 118, 128, 0.24);
    --fill-strong: rgba(118, 118, 128, 0.36);
    --accent: #2997ff;
    --accent-press: #1f8cf5;
    --accent-text: #ffffff;
    --accent-soft: rgba(41, 151, 255, 0.16);
    --ok: #30d158;
    --ok-soft: rgba(48, 209, 88, 0.14);
    --warn: #ff9f0a;
    --warn-soft: rgba(255, 159, 10, 0.14);
    --bad: #ff453a;
    --bad-soft: rgba(255, 69, 58, 0.14);

    --glass: rgba(26, 26, 29, 0.74);
    --glass-strong: rgba(46, 46, 51, 0.8);
    --glass-edge: rgba(255, 255, 255, 0.08);
    --scrim: rgba(0, 0, 0, 0.5);

    --shadow-sm: 0 0 0 0.5px var(--separator);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4), 0 0 0 0.5px var(--separator);
    --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.6), 0 0 0 0.5px var(--separator);
  }
}

/* ---------- base ---------- */
* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.5 var(--font);
  letter-spacing: -0.011em; /* body text near 0 */
  -webkit-font-smoothing: antialiased;
  font-optical-sizing: auto;
  /* Ease the light <-> dark switch instead of a hard flash. */
  transition: background-color var(--t-med) ease, color var(--t-med) ease;
}

a { color: var(--accent); text-decoration: none; }
.muted { color: var(--text-2); }
.small { font-size: 0.8125rem; letter-spacing: -0.003em; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 max(20px, env(safe-area-inset-left)) 0 max(20px, env(safe-area-inset-right)); }
main.wrap { padding-top: 32px; padding-bottom: calc(80px + env(safe-area-inset-bottom)); }

::selection { background: var(--accent-soft); }

/* Hierarchy from size + weight + leading together; tracking tightens as size grows. */
h1 {
  font-size: clamp(1.75rem, 1.2rem + 2.4vw, 2.75rem);
  line-height: 1.08;
  letter-spacing: -0.028em;
  font-weight: 700;
  margin: 0 0 8px;
  text-wrap: balance;
}
h2 { font-size: 1.375rem; line-height: 1.2; letter-spacing: -0.022em; font-weight: 700; margin: 0 0 8px; }
h3 { font-size: 1.0625rem; line-height: 1.3; letter-spacing: -0.016em; font-weight: 600; margin: 0 0 8px; }
.lead {
  color: var(--text-2);
  font-size: 1.1875rem;
  line-height: 1.42;
  letter-spacing: -0.014em;
  margin: 0 0 28px;
  max-width: 60ch;
  text-wrap: pretty;
}

/* ---------- header: translucent material, content scrolls under it ---------- */
.top {
  position: sticky;
  top: 0;
  z-index: 40;
  padding-top: env(safe-area-inset-top);
  background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 0.5px 0 var(--separator); /* hairline, like a scroll edge */
}
.bar { display: flex; align-items: center; gap: 18px; height: 52px; }
.brand {
  color: var(--text);
  font-weight: 700;
  font-size: 1.1875rem;
  letter-spacing: -0.03em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.brand::before {
  content: "";
  width: 24px;
  height: 24px;
  flex: none;
  background: url("/logo.svg") center / contain no-repeat;
}
.nav { display: flex; gap: 4px; }
.nav a {
  color: var(--text-2);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 8px;
  transition: color var(--t-fast) ease, background-color var(--t-fast) ease;
}
.spacer { flex: 1; }
.who { display: flex; align-items: center; gap: 8px; font-size: 0.875rem; font-weight: 500; white-space: nowrap; }
.nav a, .who button, .bar > button { white-space: nowrap; }
.bar > button { flex: none; }
.avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--fill-strong);
  object-fit: cover;
  flex: none;
}
.slots {
  font-size: 0.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--fill);
  color: var(--text-2);
  white-space: nowrap;
}
.slots.full { background: var(--bad-soft); color: var(--bad); }

/* ---------- buttons: feedback on press, instantly ---------- */
button, .btn {
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  cursor: pointer;
  border: 0;
  border-radius: 999px;
  min-height: 36px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--fill);
  color: var(--accent);
  text-decoration: none;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  transition: transform var(--t-press) var(--ease-out), background-color var(--t-fast) ease, color var(--t-fast) ease, opacity var(--t-fast) ease, box-shadow var(--t-fast) ease;
}
button:active, .btn:active { transform: scale(0.97); }
button:focus-visible, .btn:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--accent-soft), 0 0 0 1px var(--accent);
}
button:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

button.primary { background: var(--accent); color: var(--accent-text); font-weight: 600; }
button.primary:active { background: var(--accent-press); }
button.primary.on { box-shadow: 0 0 0 4px var(--accent-soft); }
button.ghost { min-height: 30px; padding: 0 12px; font-size: 0.8125rem; }
button.danger, .danger { color: var(--bad); }
button.link {
  background: none;
  min-height: 0;
  padding: 0;
  border-radius: 4px;
  color: var(--accent);
  font-size: inherit;
}
button.link:active { transform: none; opacity: 0.6; }

/* ---------- form controls ---------- */
label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: -0.003em;
  margin: 18px 0 6px;
}
input[type=text], select, textarea {
  font: inherit;
  font-size: 1rem; /* 16px: phones don't zoom into the field */
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--fill);
  color: var(--text);
  transition: box-shadow var(--t-fast) ease, background-color var(--t-fast) ease;
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
input[type=text]:focus, select:focus, textarea:focus { background: var(--surface); }
textarea {
  resize: vertical;
  font-family: var(--mono);
  font-size: 0.875rem;
  line-height: 1.55;
  letter-spacing: 0;
  min-height: 220px;
}
@media (max-width: 640px) { textarea { font-size: 1rem; } }
select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2386868b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}
.row select, .list select { width: auto; min-width: 0; min-height: 30px; padding: 4px 30px 4px 12px; font-size: 0.875rem; border-radius: 999px; }
input[type=checkbox] { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; }
input[type=file] { font: inherit; font-size: 0.8125rem; color: var(--text-2); max-width: 100%; }
input[type=file]::file-selector-button {
  font: inherit;
  font-weight: 500;
  border: 0;
  border-radius: 999px;
  padding: 6px 14px;
  margin-right: 10px;
  background: var(--fill);
  color: var(--accent);
  cursor: pointer;
}

/* ---------- surfaces ---------- */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.card h2, .card h3 { margin: 0 0 6px; }
.card > label:first-child { margin-top: 0; }
.card.ok { box-shadow: var(--shadow-sm), inset 0 0 0 1.5px var(--ok); }
.card.ok h3 { color: var(--ok); }
.card.ok h3::before { content: "\2713\00a0"; }
.card.editor textarea { min-height: 420px; }

/* Things that arrive once (a publish result, a notice) rise in. Cards that re-render on a timer don't animate,
   or they would flicker every refresh. */
.card.ok, .banner {
  transition: opacity var(--t-med) var(--ease-out), transform var(--t-med) var(--ease-out);
  @starting-style { opacity: 0; transform: translateY(6px); }
}

.banner {
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--fill);
  margin-bottom: 18px;
  font-size: 0.9375rem;
  font-weight: 500;
}
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner.bad { background: var(--bad-soft); color: var(--bad); }

/* ---------- layout helpers ---------- */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0; }
.row .lbl { min-width: 96px; font-weight: 600; font-size: 0.8125rem; color: var(--text-2); }
.row a.url { word-break: break-all; font-weight: 500; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 18px; }
label.row { margin: 0; color: var(--text); font-weight: 500; gap: 8px; cursor: pointer; }

/* Inset-grouped list, like Settings: separators start after the leading content. */
.list { list-style: none; margin: 4px 0 0; padding: 0; }
.list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  flex-wrap: wrap;
  box-shadow: inset 0 0.5px 0 var(--separator);
}
.list li:first-child { box-shadow: none; }
.list .grow { flex: 1; min-width: 180px; overflow-wrap: anywhere; } /* long titles and slugs wrap, never overflow */
h1, h2, h3, .comment .meta strong, .who span { overflow-wrap: anywhere; }
.list .grow > a, .list .grow > strong { font-weight: 600; letter-spacing: -0.012em; }
.list .grow .small { margin-top: 2px; }
/* A link sitting among a row's controls (Edit, With comments) is a control too: same pill, same tap size. */
.list li > a {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--fill);
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  touch-action: manipulation;
  transition: transform var(--t-press) var(--ease-out), background-color var(--t-fast) ease;
}
.list li > a:active { transform: scale(0.97); }

.badge {
  font-size: 0.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--fill);
  color: var(--text-2);
  white-space: nowrap;
}
.badge.expired { background: var(--bad-soft); color: var(--bad); }
.badge.forever { background: var(--accent-soft); color: var(--accent); }
.card > input[type=text]:first-child { margin-bottom: 6px; }

.live-head { justify-content: space-between; margin: 0 0 2px; }
.live-head h3 { margin: 0; }
.quip { margin: 0 0 8px; }

/* ---------- page viewer ---------- */
.stage { position: relative; }
.frame {
  display: block;
  width: 100%;
  height: 70vh;
  min-height: 200px;
  border: 0;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-md);
}
.chip-wrap { position: sticky; top: calc(64px + env(safe-area-inset-top)); height: 0; z-index: 30; }
.chip-box { position: absolute; right: 12px; top: 12px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }

/* Comments dock: the thickest material on the page (it floats over arbitrary content). */
.dock {
  width: 272px;
  border-radius: var(--radius);
  background: var(--glass-strong);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  box-shadow: var(--shadow-lg), inset 0 0.5px 0 var(--glass-edge);
  overflow: hidden;
}
.collapsible-trigger {
  width: 100%;
  justify-content: space-between;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-weight: 600;
  min-height: 42px;
  padding: 0 14px;
}
.collapsible-trigger:active { transform: none; background: var(--fill); }
.chev { color: var(--text-3); transition: transform var(--t-med) var(--ease-out); }
.dock.open .chev { transform: rotate(180deg); }
.collapsible-content { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--t-med) var(--ease-out); }
.dock.open .collapsible-content { grid-template-rows: 1fr; }
.collapsible-inner { overflow: hidden; min-height: 0; }
.dock.open .collapsible-inner { padding: 10px; box-shadow: inset 0 0.5px 0 var(--separator); max-height: 50vh; overflow-y: auto; }
.collapsible-tools { display: flex; }
.collapsible-tools > button { width: 100%; }
.collapsible-list { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
.collapsible-list .item {
  justify-content: flex-start;
  gap: 10px;
  text-align: left;
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 400;
}
.collapsible-list .item.on { background: var(--accent-soft); }
.collapsible-list .num {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 0.6875rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.collapsible-list .txt { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pins { position: absolute; left: 0; right: 0; top: 0; pointer-events: none; }
.pins.placing { pointer-events: auto; cursor: crosshair; background: color-mix(in srgb, var(--accent) 6%, transparent); }
.pin {
  position: absolute;
  pointer-events: auto;
  transform: translate(-50%, -50%);
  width: 28px;
  height: 28px;
  min-height: 0;
  padding: 0;
  border-radius: 50% 50% 50% 4px; /* a pin, pointing at its spot */
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
  font-size: 0.75rem;
  box-shadow: 0 0 0 2px #fff, 0 4px 12px rgba(0, 0, 0, 0.28);
  z-index: 5;
  transition: transform var(--t-press) var(--ease-out), background-color var(--t-fast) ease;
}
.pin:active { transform: translate(-50%, -50%) scale(0.92); }
.pin.on { background: var(--text); color: var(--bg); }

/* Thread popover: grows out of its pin's side. */
.pop {
  position: absolute;
  width: 320px;
  z-index: 20;
  pointer-events: auto;
  margin: 0;
  padding: 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 440px;
  overflow: auto;
  transform-origin: left top;
  transition: opacity var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
  @starting-style { opacity: 0; transform: scale(0.96); }
}
.pop.from-right { transform-origin: right top; }
.comment { display: flex; gap: 10px; padding: 10px 0; box-shadow: inset 0 0.5px 0 var(--separator); }
.comment:first-child { box-shadow: none; padding-top: 0; }
.comment.reply { margin-left: 28px; }
.comment .body { white-space: pre-wrap; word-break: break-word; font-size: 0.9375rem; }
.comment .meta { font-size: 0.75rem; color: var(--text-2); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.comment .meta strong { color: var(--text); font-weight: 600; }
.pop textarea { min-height: 76px; font-family: var(--font); font-size: 0.9375rem; }

/* ---------- modals: dim to focus, the sheet materializes ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--scrim);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  transition: opacity var(--t-med) var(--ease-out);
  @starting-style { opacity: 0; }
}
.modal {
  width: min(380px, 100%);
  margin: 0;
  padding: 26px 24px 20px;
  box-shadow: var(--shadow-lg);
  transition: opacity var(--t-med) var(--ease-out), transform var(--t-med) var(--ease-out);
  @starting-style { opacity: 0; transform: scale(0.96); }
}
.modal h3 { font-size: 1.25rem; letter-spacing: -0.02em; text-align: center; margin-bottom: 6px; }
.modal > p { text-align: center; margin: 0 0 18px; }
.modal .actions { justify-content: center; margin-top: 14px; }
/* Leaving is faster than arriving: the system responds, it doesn't perform. */
.modal-backdrop.closing { opacity: 0; transition-duration: var(--t-fast); }
.modal-backdrop.closing .modal { opacity: 0; transform: scale(0.98); transition-duration: var(--t-fast); }

.btn.provider {
  display: flex;
  width: 100%;
  min-height: 44px;
  margin-top: 10px;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
}
.btn.provider + .btn.provider { background: var(--fill); color: var(--text); }
.gate { max-width: 440px; margin: 40px auto; text-align: center; }
.gate .btn.provider { max-width: 320px; margin-left: auto; margin-right: auto; }
.captcha-slot { min-height: 70px; display: grid; place-items: center; }

/* ---------- toast: a glass pill that rises from the bottom ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 70;
  max-width: min(92vw, 480px);
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  background: var(--glass-strong);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  box-shadow: var(--shadow-lg);
  transition: opacity var(--t-med) var(--ease-out), transform var(--t-med) var(--ease-out);
  @starting-style { opacity: 0; transform: translate(-50%, 12px); }
}
.toast.error { color: var(--bad); }
.toast.leaving { opacity: 0; transform: translate(-50%, 12px); transition-duration: var(--t-fast); }

/* ---------- home: hero, drop zone, how-to ---------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.hero { padding: 12px 0 8px; }
.eyebrow {
  display: inline-block;
  margin: 0 0 14px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: -0.003em;
}
.hero h1 { font-size: clamp(2rem, 1.3rem + 3.2vw, 3.5rem); line-height: 1.04; letter-spacing: -0.035em; max-width: 22ch; }
.hero .accent {
  background: linear-gradient(90deg, #2997ff, #5e5ce6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  display: block; /* "(your PapanTanda)" always gets its own line */
}
.hero .lead { margin-bottom: 18px; }
.pills { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 28px; padding: 0; }
.pills li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  font-size: 0.875rem;
  font-weight: 500;
}
.pills li::before { content: "\2713"; color: var(--ok); font-weight: 700; }

.card.upload { padding: 22px; }
.dropzone {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 34px 20px;
  border-radius: var(--radius);
  border: 1.5px dashed var(--fill-strong);
  background: var(--surface-2);
  text-align: center;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  transition: border-color var(--t-fast) ease, background-color var(--t-fast) ease, transform var(--t-press) var(--ease-out);
}
.dropzone:active { transform: scale(0.99); }
.dropzone:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--accent-soft); border-color: var(--accent); }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.has-file { border-style: solid; border-color: color-mix(in srgb, var(--ok) 55%, transparent); background: var(--ok-soft); }
.zone-icon {
  width: 44px;
  height: 44px;
  margin-bottom: 4px;
  background: url("/logo.svg") center / contain no-repeat;
  transition: transform var(--t-med) var(--ease-out);
}
.dropzone.over .zone-icon { transform: translateY(-3px) scale(1.06); }
.zone-title { font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.016em; overflow-wrap: anywhere; }

.input-group {
  display: flex;
  align-items: stretch;
  border-radius: var(--radius-sm);
  background: var(--fill);
  overflow: hidden;
  transition: box-shadow var(--t-fast) ease, background-color var(--t-fast) ease;
}
.input-group:focus-within { background: var(--surface); box-shadow: 0 0 0 4px var(--accent-soft), 0 0 0 1px var(--accent); }
.input-group .prefix {
  display: flex;
  align-items: center;
  padding: 0 0 0 12px;
  color: var(--text-3);
  font-size: 0.9375rem;
  white-space: nowrap;
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* The prefix keeps its natural width; only on a narrow screen does it give way (ellipsis), never the input. */
.input-group .prefix { flex: 0 1 auto; }
.input-group input[type=text] { flex: 1 1 140px; width: auto; background: transparent; padding-left: 2px; min-width: 120px; }
.input-group input[type=text]:focus { background: transparent; box-shadow: none; }
#pt-name-hint { margin-top: 6px; }

.paste { margin-top: 16px; }
.paste summary {
  display: inline-block;
  cursor: pointer;
  color: var(--accent);
  font-size: 0.875rem;
  font-weight: 500;
  list-style: none;
}
.paste summary::-webkit-details-marker { display: none; }
.paste summary::after { content: " \203A"; display: inline-block; transition: transform var(--t-fast) var(--ease-out); }
.paste[open] summary::after { transform: rotate(90deg); }
.paste textarea { margin-top: 10px; }

.howto { margin-top: 44px; }
.howto > h2 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem); letter-spacing: -0.028em; }
.howto > p { margin: 0 0 20px; max-width: 60ch; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.step { margin: 0; }
.step h3 { margin: 12px 0 4px; }
.step p { margin: 0; font-size: 0.9375rem; }
.step-num {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(145deg, #2997ff, #5e5ce6);
  color: #fff;
  font-weight: 700;
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
}

/* ---------- hover: only for real pointers ---------- */
@media (hover: hover) and (pointer: fine) {
  .nav a:hover { color: var(--text); background: var(--fill); }
  a:hover { text-decoration: underline; text-underline-offset: 2px; }
  .nav a:hover, .brand:hover, .btn:hover { text-decoration: none; }
  button:hover:not(:disabled), .btn:hover { background: var(--fill-strong); }
  button.primary:hover:not(:disabled) { background: var(--accent-press); }
  button.link:hover { background: none; text-decoration: underline; text-underline-offset: 2px; }
  .btn.provider:hover { background: var(--text); opacity: 0.88; }
  .btn.provider + .btn.provider:hover { background: var(--fill-strong); opacity: 1; }
  .collapsible-trigger:hover { background: var(--fill); }
  .collapsible-list .item:hover { background: var(--fill); }
  .collapsible-list .item.on:hover { background: var(--accent-soft); }
  .list li > a:hover { background: var(--fill-strong); text-decoration: none; }
  .dropzone:hover { border-color: var(--accent); }
  .paste summary:hover { text-decoration: underline; text-underline-offset: 2px; }
  .pin:hover { transform: translate(-50%, -50%) scale(1.08); }
}

/* ---------- small screens ---------- */
@media (max-width: 720px) {
  main.wrap { padding-top: 20px; }
  .card { padding: 18px; border-radius: var(--radius); }
  .bar { gap: 8px; }
  .brand { font-size: 1.0625rem; }
  .nav a { padding: 6px 8px; }
  .who span:not(.slots):not(.avatar) { display: none; }
  .who .avatar { display: none; }
  .pop { width: min(280px, 80vw); }
  .grid2 { grid-template-columns: 1fr; }
  .row .lbl { min-width: 0; width: 100%; }
  .lead { font-size: 1.0625rem; }
  .steps { grid-template-columns: 1fr; gap: 12px; }
  /* A long host doesn't fit beside the field on a phone; the hint under it shows the full address instead. */
  .input-group .prefix { display: none; }
  .input-group input[type=text] { padding-left: 12px; }
  .dropzone { padding: 26px 16px; }
}

/* ---------- accessibility preferences ---------- */
/* Reduced motion: keep fades that aid understanding, drop movement and scale. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-property: opacity, background-color, color, box-shadow !important; }
  button:active, .btn:active, .pin:active, .dropzone:active { transform: none; }
  .dropzone.over .zone-icon { transform: none; }
  .pin, .pin:active { transform: translate(-50%, -50%) !important; }
  .card.ok, .banner, .modal, .pop { @starting-style { transform: none; } }
  .toast, .toast.leaving { transform: translateX(-50%) !important; }
}
/* Reduced transparency: frosted surfaces become solid. */
@media (prefers-reduced-transparency: reduce) {
  .top, .dock, .toast { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .modal-backdrop { -webkit-backdrop-filter: none; backdrop-filter: none; }
}
/* More contrast: defined edges everywhere. */
@media (prefers-contrast: more) {
  :root { --separator: rgba(127, 127, 127, 0.6); --text-2: var(--text); }
  .card, .dock, .modal, .frame { box-shadow: 0 0 0 1px var(--text); }
  input[type=text], select, textarea { box-shadow: inset 0 0 0 1px var(--text-2); }
}
