:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #eef1f8;
  --text: #141a2a;
  --muted: #5a6478;
  --line: #dfe3ee;
  --accent: #1d5bd8;
  --accent-ink: #ffffff;
  --accent-soft: #e6eefc;
  --ok: #157a4a;
  --hero-a: #dfe9ff;
  --hero-b: #e9f7f2;
  --shadow: 0 1px 2px rgba(20, 26, 42, .06), 0 8px 24px rgba(20, 26, 42, .06);
  --radius: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e121b;
    --surface: #161b27;
    --surface-2: #1c2332;
    --text: #e8ecf5;
    --muted: #9aa4b8;
    --line: #283041;
    --accent: #6f9cff;
    --accent-ink: #0b1020;
    --accent-soft: #1b2741;
    --ok: #4fd18f;
    --hero-a: #16223d;
    --hero-b: #10261f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

/* One language at a time: index.html carries both, <html lang> picks one. */
html:not([lang="et"]) [data-l="et"],
html:not([lang="en"]) [data-l="en"] { display: none; }

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-underline-offset: 2px; }
code {
  font: .92em/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .1em .35em;
  overflow-wrap: anywhere;
}
h1, h2, h3 { line-height: 1.2; margin: 0; }
h2 { font-size: clamp(1.4rem, 1.1rem + 1vw, 1.8rem); margin-bottom: 1.25rem; letter-spacing: -.01em; }
h3 { font-size: 1.08rem; margin-bottom: .5rem; }
p { margin: 0 0 .75rem; }

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

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* Header */
.top { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-row { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: flex; align-items: center; gap: .6rem; color: var(--text); text-decoration: none; font-weight: 700; }
.brand-sub { color: var(--muted); font-weight: 500; margin-left: .25rem; }
.brand-mark { width: 28px; height: 28px; fill: none; stroke: var(--accent); stroke-width: 2.2; }
.brand-mark rect:last-child { fill: var(--accent-soft); }
.lang { display: flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--surface); }
.lang button { border: 0; background: none; color: var(--muted); font: inherit; font-size: .85rem; font-weight: 600; padding: .25rem .7rem; border-radius: 999px; cursor: pointer; }
.lang button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

/* Hero */
.hero {
  background:
    radial-gradient(60rem 30rem at 10% -10%, var(--hero-a), transparent 60%),
    radial-gradient(50rem 30rem at 100% 0%, var(--hero-b), transparent 60%);
  padding: clamp(3rem, 8vw, 6rem) 0 clamp(2.5rem, 6vw, 4.5rem);
  text-align: center;
}
.hero h1 { font-size: clamp(2.2rem, 1.5rem + 3vw, 3.6rem); letter-spacing: -.02em; }
.lead { max-width: 40rem; margin: 1rem auto 2rem; font-size: clamp(1.05rem, 1rem + .3vw, 1.2rem); color: var(--muted); }
.cta { display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem; }
.release { margin-top: 1.25rem; font-size: .92rem; color: var(--muted); min-height: 1.6em; }
.release .when-ok, .release .when-error { display: none; }
body.release-ok .release .when-loading, body.release-error .release .when-loading { display: none; }
body.release-ok .release .when-ok, body.release-error .release .when-error { display: inline; }

/* Primary button: names the visitor's system when it is known. */
.primary-os { display: none; }
body.os-known .primary-os { display: inline; }
body.os-known .primary-any { display: none; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 44px; padding: .65rem 1.3rem;
  border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-ghost { background: transparent; }
.btn-small { min-height: 40px; padding: .45rem .95rem; font-size: .93rem; border-radius: 10px; }
.btn-quiet { background: var(--surface-2); }
.btn small { font-weight: 500; color: var(--muted); }
.btn-primary small { color: inherit; opacity: .8; }
.btn[disabled] { opacity: .55; cursor: default; transform: none; box-shadow: none; }
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } .btn:hover { transform: none; } }

/* Sections and cards */
.section { padding: clamp(2.5rem, 6vw, 4rem) 0; }
.section.alt { background: var(--surface-2); border-block: 1px solid var(--line); }
.section-lead { color: var(--muted); max-width: 46rem; margin-top: -.5rem; margin-bottom: 1.5rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; box-shadow: var(--shadow); }
.card p:last-child { margin-bottom: 0; }

.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); counter-reset: step; }
.step { position: relative; padding-top: 3.6rem; }
.step::before {
  counter-increment: step; content: counter(step);
  position: absolute; top: 1.2rem; left: 1.4rem;
  width: 2rem; height: 2rem; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 700;
}
.step p { color: var(--muted); }
.tip { margin-top: 1rem; padding: .85rem 1.1rem; border-radius: 12px; background: var(--accent-soft); color: var(--text); }

.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.device { display: flex; flex-direction: column; }
.device h3 { display: flex; align-items: center; gap: .55rem; font-size: 1.15rem; margin-bottom: .75rem; }
.device h3 svg { width: 26px; height: 26px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; }
.device > p { color: var(--muted); }
.device .dl { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: auto; padding-top: .75rem; }
.device .note { font-size: .88rem; color: var(--muted); margin: .85rem 0 0; }
.mini { margin: 0 0 .5rem; padding-left: 1.2rem; color: var(--muted); }
.mini li { margin-bottom: .35rem; }

/* Server settings */
.server { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
@media (max-width: 760px) { .server { grid-template-columns: minmax(0, 1fr); } }
.server p { color: var(--muted); }
.sub { margin-top: 1.6rem; }
.config { display: block; margin-top: .75rem; font-size: .75rem; color: var(--muted); max-height: 4.5em; overflow: auto; }
.fields { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .6rem 1rem; align-items: center; margin: .75rem 0 0; }
.fields dt { font-weight: 600; font-size: .92rem; }
.fields dd { margin: 0; display: flex; align-items: center; gap: .4rem; min-width: 0; }
.fields code { flex: 1; min-width: 0; padding: .45rem .6rem; }
@media (max-width: 420px) { .fields { grid-template-columns: minmax(0, 1fr); } .fields dd { margin-bottom: .4rem; } }
.icon-btn { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); cursor: pointer; }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
.copy .copy-done { display: none; }
.copy.copied .copy-done { display: inline; color: var(--ok); font-weight: 700; }
.copy.copied .copy-label, .copy.copied svg { display: none; }
.btn-primary.copy.copied .copy-done { color: inherit; }

.qr-card { display: flex; flex-direction: column; }
.qr { margin: .5rem auto 0; width: min(100%, 240px); aspect-ratio: 1; background: #fff; border-radius: 12px; padding: 16px; border: 1px solid var(--line); }
.qr svg { display: block; width: 100%; height: 100%; }

.notes { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.notes p { color: var(--muted); }

.foot { padding: 2rem 0 3rem; color: var(--muted); font-size: .88rem; text-align: center; }
