/* Sendy — modal-style cards on a soft color wash. No border lines: depth comes from tonal surfaces. */

:root {
  --bg: #f2f2f2;
  --surface: #ffffff;
  --surface-2: #f3f3f3;
  --surface-3: #e7e7e7;
  --stage: #f3f3f3;
  --text: #0a0a0a;
  --muted: #6b6b6b;
  --faint: #a3a3a3;
  --accent: #0a0a0a;
  --accent-hover: #2b2b2b;
  --accent-soft: rgba(0, 0, 0, 0.07);
  --accent-text: #0a0a0a;
  --on-accent: #ffffff;
  --eyebrow: #6b6b6b;
  --success: #17a16a;
  --success-soft: rgba(23, 161, 106, 0.12);
  --warn: #c47300;
  --warn-soft: rgba(196, 115, 0, 0.12);
  --danger: #dc3c4b;
  --danger-soft: rgba(220, 60, 75, 0.1);
  --wash-1: rgba(0, 0, 0, 0.07);
  --wash-2: rgba(0, 0, 0, 0.05);
  /* Chart series: monochrome by design (sent = ink, received = gray); the legend names them. */
  --series-send: #0a0a0a;
  --series-recv: #9a9a9a;
  --shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.22);
  --font: "Inter", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0a0a;
    --surface: #161616;
    --surface-2: #212121;
    --surface-3: #2c2c2c;
    --stage: #0f0f0f;
    --text: #fafafa;
    --muted: #a1a1a1;
    --faint: #5c5c5c;
    --accent: #fafafa;
    --accent-hover: #dedede;
    --accent-soft: rgba(255, 255, 255, 0.1);
    --accent-text: #fafafa;
    --on-accent: #0a0a0a;
    --eyebrow: #a1a1a1;
    --success: #3ccf8e;
    --success-soft: rgba(60, 207, 142, 0.13);
    --warn: #f2b33d;
    --warn-soft: rgba(242, 179, 61, 0.13);
    --danger: #ff6b78;
    --danger-soft: rgba(255, 107, 120, 0.13);
    --wash-1: rgba(255, 255, 255, 0.06);
    --wash-2: rgba(255, 255, 255, 0.04);
    --series-send: #fafafa;
    --series-recv: #7a7a7a;
    --shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.8);
    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(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(45% 55% at 12% 25%, var(--wash-1), transparent 70%),
    radial-gradient(45% 55% at 88% 70%, var(--wash-2), transparent 70%);
  filter: blur(30px);
}
button, input { font: inherit; color: inherit; }
b, strong, th { font-weight: 500; }
h1, h2, h3 { font-weight: 600; }
a { color: inherit; }
[hidden] { display: none !important; }
::selection { background: var(--accent); color: var(--on-accent); }

/* ── Header ── */
.top {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  font-weight: 600;
  font-size: 21px;
  letter-spacing: -0.05em;
  text-decoration: none;
  line-height: 1;
}
.brand-dot { width: 7px; height: 7px; border-radius: 2px; background: var(--eyebrow); margin-bottom: 3px; }
.nav { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface); }
.nav a {
  padding: 7px 14px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.nav a:hover { color: var(--text); }
.nav a.on { background: var(--surface-2); color: var(--text); }

/* ── Layout ── */
main {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 32px 20px 40px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.card {
  display: grid;
  gap: 16px;
  background: var(--surface);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow);
}
.card-title { margin: 0; font-size: 21px; font-weight: 600; letter-spacing: -0.03em; }
.eyebrow {
  margin: 0 0 6px;
  color: var(--eyebrow);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
}
.hint { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.hint.center { text-align: center; margin-top: -4px; }
.hint a { color: var(--accent-text); font-weight: 500; text-decoration: none; }
.hint a:hover { text-decoration: underline; }

/* ── Wizard (send flow) ── */
.wizard { padding: 14px; gap: 0; }
.wizard.over .stage { background: var(--accent-soft); }
.stage {
  border-radius: 16px;
  background: var(--stage);
  padding: 12px;
  min-height: 236px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: background 0.2s;
}
.wiz-body { text-align: center; padding: 26px 16px 14px; }
.wiz-title { margin: 0 0 10px; font-size: 26px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.3; }
.wiz-sub { margin: 0 auto; color: var(--muted); font-size: 15px; line-height: 1.75; max-width: 26em; }
.dots { display: flex; justify-content: center; gap: 10px; margin: 24px 0 26px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--surface-3); transition: background 0.2s, transform 0.2s; }
.dots i.on { background: var(--accent); transform: scale(1.1); }
.wiz-actions { display: flex; justify-content: center; gap: 14px; }
.wiz-actions .btn { flex: 1; max-width: 200px; padding: 15px 18px; font-size: 15px; }

/* ── Home (landing) ── */
main.home { max-width: 1040px; justify-content: flex-start; padding-top: 24px; }
body:has(main.home) .top { max-width: 1040px; }
.nowrap { white-space: nowrap; }
.home-page { display: grid; gap: 0; }
.hero { display: grid; grid-template-columns: 1.05fr 1fr; gap: 40px; align-items: center; padding: 32px 0 24px; }
.hero h1 { margin: 0 0 18px; font-size: clamp(36px, 5.4vw, 56px); font-weight: 600; line-height: 1.12; letter-spacing: -0.045em; }
.lead { margin: 0 0 28px; color: var(--muted); font-size: 17px; line-height: 1.8; max-width: 30em; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.btn-lg { padding: 16px 26px; font-size: 16px; border-radius: 12px; }
.facts { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 24px 0 0; padding: 0; color: var(--muted); font-size: 14px; font-weight: 500; }
.facts li { display: inline-flex; align-items: center; gap: 6px; }
.facts svg { width: 15px; height: 15px; color: var(--text); }
.hero-visual { padding: 18px; animation-delay: 0.12s; }
.flow { display: block; width: 100%; height: auto; overflow: visible; }
.flow .node rect:first-child { fill: var(--surface-3); }
.flow .screen { fill: var(--text); }
.flow .pc .ink-soft { stroke: var(--muted); }
.flow .ink-soft { stroke: var(--faint); stroke-width: 3; stroke-linecap: round; fill: none; }
.flow .ink-dot { fill: var(--muted); }
.flow .sig { fill: none; stroke: var(--faint); stroke-width: 1.5; stroke-dasharray: 3 6; }
.flow .sig-dot { fill: var(--muted); }
.flow .pipe { fill: none; stroke: var(--surface-2); stroke-width: 18; stroke-linecap: round; }
.flow .pipe-flow { fill: none; stroke: var(--faint); stroke-width: 2; stroke-dasharray: 2 12; stroke-linecap: round; animation: pipeFlow 0.8s linear infinite; }
@keyframes pipeFlow { to { stroke-dashoffset: -14; } }
.flow .packet { fill: var(--text); }
.flow .cap { fill: var(--muted); font-size: 12px; font-weight: 500; font-family: var(--font); }
.flow .cap.strong { fill: var(--text); font-size: 13px; font-weight: 600; }

.block { padding-top: 88px; }
.block-title { margin: 0 0 12px; font-size: clamp(24px, 3.4vw, 32px); font-weight: 600; letter-spacing: -0.035em; line-height: 1.3; }
.block-sub { margin: 0 0 28px; color: var(--muted); font-size: 16px; line-height: 1.8; max-width: 40em; }
.block > .eyebrow + .block-title + :not(.block-sub) { margin-top: 28px; }
.card h3 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -0.02em; display: flex; align-items: center; gap: 8px; }
.card h3 svg { width: 18px; height: 18px; }
.points { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; color: var(--muted); font-size: 14px; }
.points li { display: flex; gap: 10px; }
.points li::before { content: ""; flex: none; width: 6px; height: 6px; margin-top: 9px; border-radius: 50%; background: currentColor; opacity: 0.6; }
code { font-family: var(--mono); font-size: 0.92em; padding: 1px 6px; border-radius: 5px; background: var(--surface-2); }

.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.compare-card { padding: 26px; gap: 20px; }
.compare-card.hl { background: var(--text); color: var(--bg); }
.compare-card.hl .points { color: inherit; opacity: 0.75; }
.lane { display: flex; align-items: center; gap: 8px; padding: 18px 14px; border-radius: 14px; background: var(--stage); }
.compare-card.hl .lane { background: rgba(128, 128, 128, 0.18); }
.pill { flex: none; padding: 6px 12px; border-radius: 999px; background: var(--surface); font-size: 12px; font-weight: 500; white-space: nowrap; }
.compare-card.hl .pill { background: var(--bg); color: var(--text); }
.wire { flex: 1; min-width: 16px; height: 4px; border-radius: 999px; background: repeating-linear-gradient(90deg, currentColor 0 6px, transparent 6px 12px); background-size: 24px 4px; opacity: 0.5; }
.wire.slow { animation: wire 2.6s linear infinite; }
.wire.fast { animation: wire 0.45s linear infinite; opacity: 0.9; }
@keyframes wire { to { background-position: 24px 0; } }

.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.step { gap: 10px; padding: 22px; align-content: start; }
.step p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.75; }
.step-no { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); font-weight: 600; font-size: 15px; margin-bottom: 4px; }

.uses { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.use { padding: 22px; gap: 8px; align-content: start; }
.use p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.75; }
.privacy { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.privacy .card { padding: 26px; }

.faq { display: grid; gap: 10px; }
.faq-item { padding: 0; gap: 0; }
.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px;
  cursor: pointer;
  list-style: none;
  font-weight: 500;
  font-size: 15px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary svg { flex: none; width: 18px; height: 18px; color: var(--muted); transition: transform 0.3s var(--ease-out); }
.faq-item[open] summary svg { transform: rotate(180deg); }
.faq-item p { margin: 0; padding: 0 22px 20px; color: var(--muted); font-size: 14px; line-height: 1.85; }
.faq-item[open] p { animation: swapIn 0.35s var(--ease-out) both; }

.final { margin-top: 88px; padding: 48px 24px; text-align: center; justify-items: center; gap: 12px; }
.final h2 { margin: 0; font-size: clamp(24px, 3.4vw, 32px); font-weight: 600; letter-spacing: -0.035em; }
.final p { margin: 0 0 12px; color: var(--muted); }

/* Scroll-in reveal. */
.js .reveal-up { opacity: 0; transform: translateY(18px); transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out); }
.js .reveal-up.shown { opacity: 1; transform: none; }
.steps .step:nth-child(2) { transition-delay: 0.08s; }
.steps .step:nth-child(3) { transition-delay: 0.16s; }
.steps .step:nth-child(4) { transition-delay: 0.24s; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 28px; }
  .steps, .uses { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 620px) {
  .compare, .privacy, .steps, .uses { grid-template-columns: 1fr; }
  .block { padding-top: 64px; }
  .final { margin-top: 64px; }
  .hero-cta .btn { flex: 1; }
}

/* ── Document pages (privacy policy) ── */
main:has(.doc) { max-width: 760px; justify-content: flex-start; }
.doc { display: block; padding: 36px 40px; line-height: 1.9; }
.doc h1 { margin: 0 0 6px; font-size: clamp(26px, 4vw, 34px); letter-spacing: -0.03em; }
.doc-meta { margin: 0 0 24px; color: var(--faint); font-size: 13px; }
.doc h2 { margin: 32px 0 10px; font-size: 18px; letter-spacing: -0.02em; }
.doc p, .doc li { color: var(--muted); font-size: 15px; }
.doc p { margin: 0 0 12px; }
.doc ul { margin: 0 0 12px; padding-left: 1.3em; display: grid; gap: 6px; }
.doc b { color: var(--text); }
.doc a { color: var(--text); text-underline-offset: 3px; }
.doc h2[id] { scroll-margin-top: 24px; }
.contact-mail { padding: 14px 18px; border-radius: 12px; background: var(--surface-2); word-break: break-all; }
.contact-mail a { font-weight: 500; }
.foot-links { flex-wrap: wrap; }
@media (max-width: 520px) { .doc { padding: 24px 20px; } }

/* ── Dashboard ── */
main.wide { max-width: 920px; justify-content: flex-start; }
body:has(main.wide) .top { max-width: 920px; }
.dash { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.dash .card { grid-template-columns: minmax(0, 1fr); }
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 4px 4px 8px; }
.dash-title { margin: 0 0 4px; font-size: 32px; font-weight: 600; letter-spacing: -0.04em; line-height: 1.2; }
.card-title.sm { font-size: 16px; }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.tile { background: var(--surface); border-radius: 18px; padding: 18px 20px; box-shadow: var(--shadow); }
.tile small { display: block; color: var(--muted); font-size: 12px; font-weight: 500; }
.tile b { display: block; margin: 6px 0 2px; font-size: 26px; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tile span { color: var(--faint); font-size: 12px; }
.live-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.legend { display: flex; gap: 14px; font-size: 12px; font-weight: 500; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.sw.s-send, path.s-send { background: var(--series-send); fill: var(--series-send); }
.sw.s-recv, path.s-recv { background: var(--series-recv); fill: var(--series-recv); }
.chart { position: relative; height: 220px; min-width: 0; overflow: hidden; }
.chart svg { position: absolute; left: 0; top: 0; }
.chart svg { display: block; overflow: visible; }
.chart .grid { stroke: var(--surface-3); stroke-width: 1; }
.chart .grid.base { stroke: var(--faint); }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .col { fill: transparent; }
.chart .col.on { fill: var(--surface-2); }
.chart .tip {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  display: grid;
  gap: 2px;
  min-width: 130px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--text);
  color: var(--bg);
  font-size: 12px;
  pointer-events: none;
  box-shadow: var(--shadow);
}
.chart .tip span { display: flex; align-items: center; gap: 6px; }
.chart .tip em { margin-left: auto; font-style: normal; font-weight: 500; font-variant-numeric: tabular-nums; }
.table-view summary { cursor: pointer; color: var(--muted); font-size: 12px; font-weight: 500; width: max-content; }
.table-view table { width: 100%; margin-top: 10px; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.table-view th { text-align: left; color: var(--muted); font-weight: 500; padding: 6px 8px; }
.table-view td { padding: 6px 8px; }
.table-view tbody tr:nth-child(odd) td { background: var(--surface-2); }

.table-wrap { overflow-x: auto; margin: 0 -4px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.admin-table th { text-align: left; color: var(--muted); padding: 8px 10px; }
.admin-table td { padding: 8px 10px; }
.admin-table tbody tr:nth-child(odd) td { background: var(--surface-2); }
.admin-table .empty-cell { text-align: center; color: var(--muted); padding: 24px; }
.seg.seg-sm button { padding: 6px 12px; font-size: 12px; white-space: nowrap; }
.hist { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.hist li { display: flex; align-items: center; gap: 14px; padding: 10px 12px; border-radius: 12px; }
.hist li:hover { background: var(--surface-2); }
.hist-ic { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: #fff; }
.hist-ic svg { width: 17px; height: 17px; }
.hist-ic.send { background: var(--series-send); color: var(--on-accent); }
.hist-ic.recv { background: var(--series-recv); }
.hist-main { flex: 1; min-width: 0; display: grid; }
.hist-main b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-main small { color: var(--muted); font-size: 12px; }
.hist time { flex: none; color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.hist .hist-empty { justify-content: center; text-align: center; color: var(--muted); font-size: 14px; padding: 28px 12px; }
.hist .hist-empty:hover { background: transparent; }
.clear-hist { justify-self: end; }

/* ── Dropzone ── */
.drop {
  flex: 1;
  border-radius: 12px;
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.drop:hover { background: var(--surface-2); }
.drop-icon {
  width: 56px;
  height: 56px;
  margin-bottom: 14px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 10px 24px -8px var(--accent);
  transition: transform 0.25s cubic-bezier(0.3, 1.6, 0.6, 1);
}
.drop:hover .drop-icon, .wizard.over .drop-icon { transform: translateY(-3px); }
.drop-icon svg { width: 26px; height: 26px; }
.drop strong { display: block; font-size: 15px; font-weight: 500; margin-bottom: 2px; }
.drop span { color: var(--muted); font-size: 13px; }

/* ── File list ── */
.files {
  list-style: none;
  margin: 0;
  padding: 4px;
  max-height: 260px;
  overflow: auto;
  background: var(--surface-2);
  border-radius: 14px;
}
.stage .files { background: transparent; padding: 0; max-height: 200px; }
.files li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 14px;
}
.files li:hover { background: var(--surface-2); }
.stage .files li:hover { background: var(--surface); }
.file-ic {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-text);
}
.file-ic svg { width: 16px; height: 16px; }
.file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.file-name small { color: var(--faint); }
.file-size { flex: none; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.files .more { justify-content: center; color: var(--muted); font-size: 13px; }
.add-more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 6px;
  border: 0;
  padding: 10px;
  border-radius: 10px;
  background: transparent;
  color: var(--accent-text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.add-more:hover { background: var(--accent-soft); }
.add-more svg { width: 15px; height: 15px; }

/* ── Options ── */
.options { display: grid; gap: 14px; padding: 6px 4px; }
.field-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin: 0 0 6px 2px;
}
.field-label svg { width: 13px; height: 13px; }
.input {
  width: 100%;
  border: 0;
  outline: 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--surface-2);
  transition: background 0.15s, box-shadow 0.15s;
}
.stage .input { background: var(--surface); }
.input::placeholder { color: var(--faint); }
.input:focus { box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 1.5px var(--accent) inset; }

.seg { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-2); }
.stage .seg { background: var(--surface); }
.seg button {
  flex: 1;
  border: 0;
  padding: 8px 6px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  padding: 12px 20px;
  border-radius: 10px;
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.12s, background 0.15s, opacity 0.15s, color 0.15s;
}
.btn svg { width: 17px; height: 17px; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--stage); color: var(--text); }
.btn-secondary:hover { background: var(--surface-3); }
.btn-soft { background: var(--accent-soft); color: var(--accent-text); }
.btn-soft:hover { background: var(--surface-3); }
.btn-ghost { background: var(--surface-2); color: var(--text); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-text { background: transparent; color: var(--muted); }
.btn-text:hover { background: var(--surface-2); color: var(--text); }
.btn-block { width: 100%; padding: 15px 20px; font-size: 15px; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-icon { padding: 7px; background: transparent; color: var(--faint); }
.btn-icon:hover { background: var(--surface-3); color: var(--text); }
.btn-icon svg { width: 15px; height: 15px; }
.btn:focus-visible, .seg button:focus-visible, .drop:focus-visible, .add-more:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 1.5px var(--accent) inset;
}

/* ── Status ── */
.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  background: var(--success-soft);
  color: var(--success);
  white-space: nowrap;
}
.status.warn { background: var(--warn-soft); color: var(--warn); }
.status.off { background: var(--surface-2); color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; position: relative; }
.status.live .dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: currentColor;
  animation: ping 1.6s cubic-bezier(0, 0, 0.2, 1) infinite;
}
@keyframes ping { 75%, 100% { transform: scale(2.6); opacity: 0; } }

.head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.link-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 16px;
  border-radius: 12px;
  background: var(--stage);
}
.link-box input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-family: var(--mono);
  font-size: 13px;
  text-overflow: ellipsis;
}

.note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 13px;
}
.note svg { flex: none; width: 16px; height: 16px; margin-top: 2px; }

.section-title {
  display: flex;
  justify-content: space-between;
  margin: 6px 2px -8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}
.section-title span:last-child { font-weight: 500; }
.peers { display: grid; gap: 8px; }
.peer { padding: 14px 16px; border-radius: 14px; background: var(--stage); }
.peer-top { display: flex; justify-content: space-between; align-items: center; font-size: 14px; margin-bottom: 10px; gap: 8px; }
.peer-top small { color: var(--faint); font-weight: 500; margin-left: 6px; }
.peer-top span { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.empty { padding: 22px; border-radius: 14px; background: var(--stage); text-align: center; color: var(--muted); font-size: 14px; }

/* ── Progress ── */
.bar { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.3s ease;
  position: relative;
  overflow: hidden;
}
.bar.active > i::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(128, 128, 128, 0.45), transparent);
  animation: shimmer 1.4s infinite;
}
.bar.done > i { background: var(--accent); }
.bar.big { height: 12px; }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.big-progress { text-align: center; padding: 12px 0 4px; }
.big-progress .pct {
  font-size: 72px;
  font-weight: 600;
  letter-spacing: -0.05em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.big-progress .pct small { font-size: 30px; color: var(--accent-text); font-weight: 600; margin-left: 2px; }
.big-progress .meta { color: var(--muted); font-size: 14px; margin: 12px 0 20px; font-variant-numeric: tabular-nums; }
.big-progress .sub { margin-top: 12px; font-size: 13px; color: var(--faint); }

/* ── Centered states ── */
.state { text-align: center; padding: 16px 0 4px; }
.state-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-text);
}
.state-icon svg { width: 28px; height: 28px; }
.state-icon.ok { background: var(--accent); color: var(--on-accent); }
.state-icon.bad { background: var(--danger-soft); color: var(--danger); }
.state h2 { margin: 0 0 6px; font-size: 22px; font-weight: 600; letter-spacing: -0.03em; }
.state p { margin: 0 auto; color: var(--muted); font-size: 14px; max-width: 26em; }

.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 25%, var(--accent) 100%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.diag-box summary {
  cursor: pointer;
  color: var(--faint);
  font-size: 12px;
  text-align: center;
  list-style: none;
}
.diag-box summary::-webkit-details-marker { display: none; }
.diag {
  margin-top: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--stage);
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
  word-break: break-all;
}

.pw-form { display: grid; gap: 10px; }
.err { color: var(--danger); font-size: 13px; min-height: 1.2em; margin: 0 0 0 2px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 10;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.foot { text-align: center; color: var(--faint); font-size: 12px; padding: 24px 16px 28px; }
.foot p { margin: 0; }
.foot-links { display: flex; justify-content: center; gap: 18px; margin-bottom: 8px; }
.foot-links a { color: var(--muted); text-decoration: none; }
.foot-links a:hover { color: var(--text); }

/* ── Motion ── */
:root { --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1); --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1); }

/* Page enter (first load, and the fallback when View Transitions are unavailable). */
.fade-in { animation: fadeIn 0.45s var(--ease-out) both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(12px) scale(0.985); filter: blur(3px); } to { opacity: 1; transform: none; filter: none; } }
html.vt .fade-in { animation: none; }
#app { transition: opacity 0.17s ease, transform 0.17s ease, filter 0.17s ease; }
#app.leaving { opacity: 0; transform: translateY(-6px) scale(0.99); filter: blur(2px); }

/* Page swaps via View Transitions: only the main content animates; the header stays put. */
#app { view-transition-name: page; }
::view-transition-old(root), ::view-transition-new(root) { animation: none; }
::view-transition-group(page) { animation-duration: 0.4s; animation-timing-function: var(--ease-out); }
::view-transition-old(page) { animation: vtOut 0.18s ease both; }
::view-transition-new(page) { animation: vtIn 0.42s var(--ease-out) 0.06s both; }
@keyframes vtOut { to { opacity: 0; transform: translateY(-8px) scale(0.985); filter: blur(3px); } }
@keyframes vtIn { from { opacity: 0; transform: translateY(14px) scale(0.985); filter: blur(3px); } }

/* In-place content changes. */
.swap-in { animation: swapIn 0.38s var(--ease-out) both; }
@keyframes swapIn { from { opacity: 0; transform: translateY(8px); filter: blur(2px); } }
.pop { animation: pop 0.35s var(--ease-spring) both; }
@keyframes pop { 40% { transform: scale(1.05); } }
.shake { animation: shake 0.42s ease both; }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
.row-in { animation: rowIn 0.4s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 35ms); }
@keyframes rowIn { from { opacity: 0; transform: translateY(8px); } }
.tiles .tile { animation: rowIn 0.5s var(--ease-out) both; }
.tiles .tile:nth-child(2) { animation-delay: 60ms; }
.tiles .tile:nth-child(3) { animation-delay: 120ms; }
.tiles .tile:nth-child(4) { animation-delay: 180ms; }
.dash > .card { animation: rowIn 0.5s var(--ease-out) 0.2s both; }
.chart path { transform-box: fill-box; transform-origin: 50% 100%; animation: barGrow 0.6s var(--ease-out) both; }
@keyframes barGrow { from { transform: scaleY(0); } }
.chart .tip:not([hidden]) { animation: tipIn 0.16s ease both; }
@keyframes tipIn { from { opacity: 0; transform: translate(-50%, 4px); } }
.toast { transition: opacity 0.25s ease, transform 0.35s var(--ease-spring); }

/* Buttons: ripple, lift, and the create-link sequence. */
.btn { position: relative; overflow: hidden; isolation: isolate; }
.seg button, .nav a { position: relative; overflow: hidden; }
.btn-primary:hover:not(:disabled):not(.busy) { transform: translateY(-1px); box-shadow: 0 10px 24px -10px var(--accent); }
.ripple {
  position: absolute;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.22;
  transform: scale(0);
  pointer-events: none;
  z-index: -1;
  animation: ripple 0.6s ease-out forwards;
}
@keyframes ripple { to { transform: scale(1); opacity: 0; } }

.btn.busy { pointer-events: none; }
.btn.dim { opacity: 0.5; pointer-events: none; transition: opacity 0.3s; }
.btn-primary.is-loading { animation: press 0.3s var(--ease-spring); }
.btn-primary.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(100deg, transparent 20%, rgba(128, 128, 128, 0.45) 50%, transparent 80%);
  background-size: 200% 100%;
  animation: sheen 1s linear infinite;
}
@keyframes press { 40% { transform: scale(0.95); } }
@keyframes sheen { from { background-position: 150% 0; } to { background-position: -50% 0; } }
.btn-spin {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 30%, currentColor 100%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2px));
  animation: spin 0.7s linear infinite;
}
.btn-primary.is-done { background: #17a16a; color: #ffffff; animation: done 0.5s var(--ease-spring); }
@keyframes done { 30% { transform: scale(1.06); } }
.btn-check { display: inline-grid; animation: checkIn 0.5s var(--ease-spring) both; }
.btn-check svg { stroke-dasharray: 24; stroke-dashoffset: 24; animation: draw 0.4s ease 0.1s forwards; }
@keyframes checkIn { from { transform: scale(0) rotate(-45deg); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
.btn.copied { background: var(--accent); color: var(--on-accent); }

.burst { position: fixed; z-index: 20; width: 0; height: 0; pointer-events: none; }
.burst i {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--s);
  height: var(--s);
  margin: calc(var(--s) / -2) 0 0 calc(var(--s) / -2);
  border-radius: 2px;
  background: var(--c);
  animation: fly 0.9s var(--ease-out) forwards;
}
.burst i:nth-child(odd) { border-radius: 50%; }
@keyframes fly {
  0% { transform: translate(0, 0) scale(0.4) rotate(0); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(1) rotate(200deg); opacity: 0; }
}

/* The share link glows once when it first appears. */
.link-box.reveal { animation: reveal 1.2s var(--ease-out) both; }
@keyframes reveal {
  0% { box-shadow: 0 0 0 0 var(--accent); background: var(--accent-soft); transform: scale(0.97); }
  35% { box-shadow: 0 0 0 6px var(--accent-soft); transform: scale(1.01); }
  100% { box-shadow: 0 0 0 14px transparent; transform: none; }
}

/* Small polish on hover-able surfaces. */
.files li, .hist li, .peer, .tile { transition: background 0.15s, transform 0.2s var(--ease-out); }
.tile:hover { transform: translateY(-2px); }
.dots i { transition: background 0.3s, transform 0.3s var(--ease-spring), width 0.3s var(--ease-out); }
.dots i.on { width: 22px; border-radius: 999px; transform: none; }

@media (max-width: 520px) {
  .top { padding: 18px 16px 0; }
  main { padding: 20px 14px 28px; justify-content: flex-start; }
  .card { padding: 18px; border-radius: 22px; }
  .wizard { padding: 10px; }
  .wiz-body { padding: 22px 8px 10px; }
  .wiz-title { font-size: 23px; }
  .wiz-actions { gap: 10px; }
  .big-progress .pct { font-size: 58px; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile { padding: 14px 16px; }
  .tile b { font-size: 21px; }
  .dash-head { flex-direction: column; align-items: stretch; }
  .dash-title { font-size: 26px; }
  .hist time { display: none; }
}
