/* hopzup — calm, professional, readable. System fonts only (no third parties). */
:root {
  --bg: #f4f7f8;
  --surface: #ffffff;
  --surface-2: #eef3f4;
  --ink: #0b1f2a;
  --ink-2: #3c4f59;
  --muted: #5d6f78;
  --line: #d9e2e5;
  --brand: #0e7c86;
  --brand-ink: #ffffff;
  --brand-soft: #e1f3f4;
  --brand-strong: #095e66;
  --ok: #1d7a46;
  --ok-soft: #e3f4ea;
  --warn: #9a5b00;
  --warn-soft: #fff3dc;
  --danger: #b3261e;
  --danger-soft: #fdecea;
  --focus: #1b6ef3;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(11, 31, 42, .06), 0 4px 16px rgba(11, 31, 42, .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  --tap: 48px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1a20;
    --surface: #10242c;
    --surface-2: #163039;
    --ink: #e8f1f3;
    --ink-2: #c3d3d8;
    --muted: #93a9b1;
    --line: #234049;
    --brand: #3fb6bf;
    --brand-ink: #062226;
    --brand-soft: #123b42;
    --brand-strong: #6fd0d7;
    --ok: #5fcf8d;
    --ok-soft: #12352a;
    --warn: #f2b45a;
    --warn-soft: #3a2b12;
    --danger: #ff8a80;
    --danger-soft: #3b1715;
    --focus: #8ab4ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 18px rgba(0, 0, 0, .25);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}
[hidden] { display: none !important; }
img { max-width: 100%; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h1 { font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2rem); line-height: 1.2; margin: .25rem 0 .5rem; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; line-height: 1.3; margin: 0; }
.h3 { font-size: 1.05rem; font-weight: 650; margin: 0; }
.h4 { font-size: .95rem; font-weight: 650; margin: 0; color: var(--ink-2); }
p { margin: 0; }
a { color: var(--brand-strong); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; border-radius: 8px; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center-text { text-align: center; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.noscript { padding: 2rem; text-align: center; }

/* Layout --------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand-name { font-weight: 750; font-size: 1.2rem; letter-spacing: -.02em; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.lang select {
  height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 0 28px 0 10px; font: inherit; font-size: .9rem; cursor: pointer;
}

main { max-width: 760px; margin: 0 auto; padding: 16px max(16px, env(safe-area-inset-left)) 48px; outline: none; }
.view { display: flex; flex-direction: column; gap: 16px; animation: fade-in .2s var(--ease); }
.view.narrow { max-width: 520px; margin: 0 auto; }
.view.center { align-items: center; justify-content: center; text-align: center; min-height: 50vh; }
.lead { font-size: 1.075rem; color: var(--ink-2); }
.note { background: var(--brand-soft); color: var(--ink); padding: 12px 14px; border-radius: var(--radius-sm); }
.hint { font-size: .875rem; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}

/* Controls ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 18px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: background-color .15s, border-color .15s, transform .08s;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.big { min-height: 54px; font-size: 1.05rem; }
.btn.sm { min-height: 40px; padding: 0 12px; font-size: .9rem; border-radius: 10px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
  border: 0; background: transparent; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 22px; height: 22px; }

.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
.field small { font-weight: 400; color: var(--muted); }
input, textarea, select { font: inherit; color: inherit; }
input:not([type=radio]):not([type=checkbox]), textarea {
  width: 100%; min-height: var(--tap); padding: 10px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-weight: 400;
}
input:focus, textarea:focus { border-color: var(--brand); outline: 3px solid color-mix(in srgb, var(--brand) 25%, transparent); outline-offset: 0; }
.form-error { color: var(--danger); background: var(--danger-soft); padding: 10px 12px; border-radius: 10px; font-size: .925rem; }

.choice { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.choice legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
.radio-card {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); cursor: pointer; background: var(--surface);
}
.radio-card:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.radio-card input { margin-top: 4px; width: 20px; height: 20px; accent-color: var(--brand); flex: none; }
.radio-card span { display: flex; flex-direction: column; gap: 2px; }
.radio-card small { color: var(--muted); }
.switch-row { display: flex; align-items: center; gap: 10px; min-height: var(--tap); cursor: pointer; }
.switch-row input { width: 22px; height: 22px; accent-color: var(--brand); }

.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; min-width: 0; }

/* Banner / toast ------------------------------------------------------- */
.banner {
  margin: 0; padding: 10px 16px; text-align: center; font-size: .925rem;
  background: var(--warn-soft); color: var(--ink); border-bottom: 1px solid var(--line);
}
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 60;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: min(92vw, 480px); padding: 12px 18px; border-radius: 12px;
  background: var(--ink); color: var(--bg); font-weight: 550; box-shadow: var(--shadow);
  transition: opacity .2s var(--ease), transform .2s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); color: #fff; }

/* Connect -------------------------------------------------------------- */
.steps { margin: 0; padding-left: 1.4em; display: flex; flex-direction: column; gap: 4px; color: var(--ink-2); }
.qr-box {
  position: relative; align-self: center; width: 264px; height: 264px; padding: 12px;
  background: #fff; border-radius: 16px; border: 1px solid var(--line);
}
.qr-box img { display: block; width: 240px; height: 240px; image-rendering: pixelated; }
.qr-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: color-mix(in srgb, var(--surface) 94%, transparent); border-radius: 16px; padding: 16px; text-align: center; color: var(--ink);
}
#qr-timer { text-align: center; }
.link-fallback summary { cursor: pointer; font-weight: 600; min-height: 32px; color: var(--brand-strong); }
.link-fallback[open] { display: flex; flex-direction: column; gap: 8px; }
.link-fallback input { font-family: var(--mono); font-size: .8rem; }
.site-url { font-size: 1.6rem; font-weight: 750; letter-spacing: -.01em; color: var(--brand-strong); }

/* Destination ---------------------------------------------------------- */
.dest { padding: 12px 16px; border-left: 4px solid var(--brand); }
.dest-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; }
.dest-row { display: flex; align-items: center; gap: 10px; min-height: 36px; flex-wrap: wrap; }
.dest-row strong { font-size: 1.15rem; }
.dest-select select {
  min-height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2);
  color: var(--ink); padding: 0 10px; font-weight: 600;
}
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.online { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }

/* Composer ------------------------------------------------------------- */
.composer { display: flex; flex-direction: column; gap: 10px; }
.composer textarea {
  resize: vertical; min-height: 96px; max-height: 50vh; font-size: 1rem; line-height: 1.45;
  border: 1px solid var(--line); background: var(--surface-2);
}
.composer-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.composer-actions #btn-send { margin-left: auto; min-width: 120px; }
.file-review-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.file-review-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--surface-2); border-radius: 10px; }
.file-review-list .fname { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.file-review-list .thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; background: var(--line); flex: none; }

/* Items ---------------------------------------------------------------- */
.items-section { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.items-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.item {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow);
}
.item.appear { animation: item-in .25s var(--ease); }
.item.in { border-left: 4px solid var(--brand); }
.item.ended { opacity: .72; box-shadow: none; }
.item-head { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--muted); flex-wrap: wrap; }
.item-head .dir { font-weight: 650; color: var(--ink-2); }
.item-head .spacer { flex: 1; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px;
  font-size: .8rem; font-weight: 650; background: var(--surface-2); color: var(--ink-2); white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.brand { background: var(--brand-soft); color: var(--brand-strong); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.timer { font-variant-numeric: tabular-nums; white-space: nowrap; }
.timer.urgent { color: var(--warn); font-weight: 700; }
.item-text {
  margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word;
  font: inherit; max-height: 14.5em; overflow: auto; padding: 10px 12px; border-radius: 10px; background: var(--surface-2);
}
.item-text a { color: var(--brand-strong); }
.item-file { display: flex; align-items: center; gap: 12px; }
.item-file .ficon {
  width: 48px; height: 48px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-strong);
  display: grid; place-items: center; font-size: .7rem; font-weight: 800; text-transform: uppercase; flex: none; overflow: hidden;
}
.item-file .ficon img { width: 100%; height: 100%; object-fit: cover; }
.item-file .fmeta { min-width: 0; display: flex; flex-direction: column; }
.item-file .fname { font-weight: 600; overflow-wrap: anywhere; }
.item-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.item-actions .grow { margin-left: auto; }
.progress { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand); width: 0; transition: width .2s linear; }
.manual-copy { display: flex; flex-direction: column; gap: 6px; }
.manual-copy textarea { font-size: .9rem; min-height: 80px; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }

/* Settings ------------------------------------------------------------- */
.peer-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.peer-list li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; flex-wrap: wrap; }
.peer-list .pname { flex: 1; min-width: 120px; display: flex; flex-direction: column; }
.peer-list .pname small { color: var(--muted); }
.facts { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 6px; color: var(--ink-2); font-size: .925rem; }
.danger-zone { border-top: 1px solid var(--line); padding-top: 16px; }

/* Dialogs -------------------------------------------------------------- */
dialog {
  border: 0; padding: 0; color: var(--ink); background: var(--surface);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
dialog::backdrop { background: rgba(5, 15, 20, .5); }
dialog[open] { animation: pop .18s var(--ease); }
.modal { width: min(92vw, 440px); border-radius: 18px; }
.modal.wide { width: min(96vw, 900px); }
.modal-inner { padding: 22px; }
.sheet { width: min(100vw, 560px); max-height: 92dvh; border-radius: 18px; }
.sheet-inner { padding: 18px 20px 24px; display: flex; flex-direction: column; gap: 22px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.code-box { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.code { font-family: var(--mono); font-size: 2.2rem; letter-spacing: .3em; padding-left: .3em; font-weight: 700; }
#pv-img { max-height: 75vh; object-fit: contain; border-radius: 10px; background: var(--surface-2); align-self: center; }

@media (max-width: 600px) {
  .sheet { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: 18px 18px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .composer-actions .btn { flex: 1; }
  .composer-actions #btn-send { flex-basis: 100%; margin-left: 0; order: -1; }
  main { padding-top: 12px; }
}

.drop-overlay {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: color-mix(in srgb, var(--brand) 18%, transparent); border: 4px dashed var(--brand);
  font-size: 1.4rem; font-weight: 700; color: var(--brand-strong); pointer-events: none;
}

.spinner { width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: spin .8s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes item-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .spinner { animation: none; border-top-color: var(--line); }
}
@media (forced-colors: active) {
  .btn, .card, .item, .badge { border: 1px solid CanvasText; }
  .dot.online { background: Highlight; }
}

/* Landing / info -------------------------------------------------------- */
.consent { text-align: center; }
.landing { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
.landing h2 { font-size: 1.15rem; margin-top: 8px; }
.how { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.how li { display: flex; gap: 14px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.how li p { color: var(--ink-2); margin-top: 2px; }
.how-n {
  flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-strong); font-weight: 800;
}
.facts-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.facts-grid li { padding: 10px 12px 10px 34px; position: relative; color: var(--ink-2); background: var(--surface-2); border-radius: 10px; font-size: .95rem; }
.facts-grid li::before {
  content: ""; position: absolute; left: 12px; top: 15px; width: 12px; height: 7px;
  border-left: 2.5px solid var(--ok); border-bottom: 2.5px solid var(--ok); transform: rotate(-45deg);
}

/* Footer ------------------------------------------------------------------ */
.site-footer {
  max-width: 760px; margin: 0 auto; padding: 8px 16px calc(28px + env(safe-area-inset-bottom));
  text-align: center; font-size: .875rem; color: var(--muted); display: flex; flex-direction: column; gap: 8px;
}
.site-footer a, .linklike { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.linklike { background: none; border: 0; padding: 4px 2px; font: inherit; cursor: pointer; }
.site-footer a:hover, .linklike:hover { color: var(--ink); }
.lang-links { display: flex; flex-wrap: wrap; gap: 4px 12px; justify-content: center; }
.lang-links a[aria-current] { color: var(--ink); font-weight: 650; text-decoration: none; }

/* TTL + selects ----------------------------------------------------------- */
.ttl-select { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--ink-2); }
.ttl-select select, select.select {
  min-height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); padding: 0 10px; font: inherit; font-weight: 500;
}
code { font-family: var(--mono); font-size: .85em; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; user-select: all; overflow-wrap: anywhere; }

/* Document pages (legal, 404) --------------------------------------------- */
.doc-page .topbar a.brand { color: inherit; text-decoration: none; }
.doc { max-width: 720px; }
.doc h1 { margin-bottom: .25rem; }
.doc h2 { font-size: 1.1rem; margin: 1.6rem 0 .5rem; }
.doc p, .doc li { color: var(--ink-2); margin: 0 0 .6rem; }
.doc ul { padding-left: 1.3em; margin: 0 0 .6rem; }
.imprint { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 1.2rem 0; }
.imprint dt { font-weight: 650; }
.imprint dd { margin: 0; color: var(--ink-2); overflow-wrap: anywhere; }
@media (max-width: 520px) { .imprint { grid-template-columns: 1fr; } .imprint dd { margin-bottom: 8px; } }
