:root {
  --bg: #f5f5f7;
  --card: rgba(255, 255, 255, 0.82);
  --card-edge: rgba(255, 255, 255, 0.9);
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(0, 0, 0, 0.08);
  --field: rgba(118, 118, 128, 0.12);
  --accent: #0a66ff;
  --accent-press: #0052d6;
  --danger: #d70015;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 12px 40px rgba(0, 0, 0, 0.08);
  --spring: cubic-bezier(0.2, 0.9, 0.25, 1);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000;
    --card: rgba(28, 28, 30, 0.82);
    --card-edge: rgba(255, 255, 255, 0.08);
    --text: #f5f5f7;
    --muted: #98989d;
    --line: rgba(255, 255, 255, 0.1);
    --field: rgba(118, 118, 128, 0.24);
    --accent: #3d8bff;
    --accent-press: #2a72e6;
    --danger: #ff453a;
    --shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  }
}
:root[data-theme="dark"] {
  --bg: #000; --card: rgba(28, 28, 30, 0.82); --card-edge: rgba(255, 255, 255, 0.08);
  --text: #f5f5f7; --muted: #98989d; --line: rgba(255, 255, 255, 0.1);
  --field: rgba(118, 118, 128, 0.24); --accent: #3d8bff; --accent-press: #2a72e6; --danger: #ff453a;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  background-image:
    radial-gradient(60rem 40rem at 10% -10%, rgba(94, 155, 255, 0.18), transparent 60%),
    radial-gradient(50rem 40rem at 110% 10%, rgba(122, 77, 255, 0.14), transparent 60%);
  background-attachment: fixed;
  color: var(--text);
  font: 100%/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.shell {
  max-width: 36rem;
  margin: 0 auto;
  padding: max(1.5rem, env(safe-area-inset-top)) 1rem 3rem;
}

.brand {
  display: flex; align-items: center; gap: 0.625rem;
  font-weight: 600; font-size: 1.125rem; letter-spacing: -0.01em;
  margin: 0.5rem 0 1.5rem;
}
.brand img { border-radius: 10px; }

.card {
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-radius: 1.5rem;
  padding: 1.75rem 1.5rem;
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  animation: arrive 0.5s var(--spring) both;
}
@keyframes arrive { from { opacity: 0; transform: translateY(8px) scale(0.99); } }

h1 {
  font-size: 1.875rem; line-height: 1.1; letter-spacing: -0.025em;
  font-weight: 700; margin: 0 0 0.5rem;
}
h2 {
  font-size: 1.125rem; letter-spacing: -0.01em; font-weight: 600;
  margin: 2rem 0 0.875rem;
}
.lede { color: var(--muted); margin: 0 0 1.5rem; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.9375rem; letter-spacing: 0.02em; margin-bottom: 0; }

.field { display: block; margin-bottom: 1rem; }
.field > span {
  display: block; font-size: 0.8125rem; font-weight: 500; color: var(--muted);
  margin: 0 0 0.375rem 0.25rem; letter-spacing: 0.005em;
}
.field em { font-style: normal; opacity: 0.7; }
input {
  width: 100%;
  font: inherit; font-size: 1.0625rem; color: var(--text);
  background: var(--field);
  border: 1px solid transparent;
  border-radius: 0.75rem;
  padding: 0.8125rem 0.9375rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
input::placeholder { color: var(--muted); opacity: 0.6; }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
#mac, #key { font-family: ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 0.06em; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
@media (max-width: 26rem) { .grid-2 { grid-template-columns: 1fr; gap: 0; } }

.btn {
  font: inherit; font-weight: 600; font-size: 1.0625rem;
  border: 0; border-radius: 0.875rem;
  padding: 0.875rem 1.25rem;
  cursor: pointer;
  transition: transform 0.1s ease-out, background 0.15s ease, opacity 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { width: 100%; background: var(--accent); color: #fff; margin-top: 0.5rem; }
.btn.primary:active { background: var(--accent-press); }
.btn.ghost { background: var(--field); color: var(--text); font-size: 0.9375rem; padding: 0.5rem 0.875rem; white-space: nowrap; }
.btn.danger { background: transparent; color: var(--danger); font-size: 0.9375rem; padding: 0.5rem 0.75rem; }

.row-between { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem; }
@media (max-width: 30rem) {
  .row-between { flex-direction: column; gap: 0.75rem; }
}

.error {
  color: var(--danger); font-size: 0.9375rem; margin: 0 0 0.75rem 0.25rem;
}

.list { list-style: none; margin: 0; padding: 0; border-radius: 1rem; overflow: hidden; background: var(--field); }
.list:empty { display: none; }
.list li {
  display: flex; align-items: center; gap: 0.875rem;
  padding: 0.875rem 0.75rem 0.875rem 1rem;
  animation: arrive 0.4s var(--spring) both;
}
.list li + li { border-top: 1px solid var(--line); }
.list .badge {
  flex: none; font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent);
  border-radius: 0.5rem; padding: 0.25rem 0.5rem;
}
.list .meta { flex: 1; min-width: 0; }
.list .meta strong { display: block; font-weight: 600; letter-spacing: -0.005em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .meta small { display: block; color: var(--muted); font-size: 0.8125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { color: var(--muted); background: var(--field); border-radius: 1rem; padding: 1rem; margin: 0; }

/* Segmented control with a sliding thumb */
.segmented {
  position: relative; display: grid; grid-template-columns: 1fr 1fr;
  background: var(--field); border-radius: 0.75rem; padding: 0.1875rem; margin-bottom: 1.25rem;
}
.segmented button {
  position: relative; z-index: 1;
  font: inherit; font-size: 0.9375rem; font-weight: 500; color: var(--text);
  background: none; border: 0; padding: 0.5rem; border-radius: 0.5625rem; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.segmented button[aria-selected="true"] { font-weight: 600; }
.segmented-thumb {
  position: absolute; top: 0.1875rem; bottom: 0.1875rem; left: 0.1875rem;
  width: calc(50% - 0.1875rem);
  background: var(--card); border-radius: 0.5625rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 3px 8px rgba(0, 0, 0, 0.06);
  transition: transform 0.4s var(--spring);
}
.segmented[data-active="xtream"] .segmented-thumb { transform: translateX(100%); }
@media (prefers-color-scheme: dark) { .segmented-thumb { background: #636366; } }

.fineprint { color: var(--muted); font-size: 0.8125rem; text-align: center; margin: 2rem 1rem 0; line-height: 1.45; }

.toast {
  position: fixed; left: 50%; bottom: max(1.5rem, env(safe-area-inset-bottom));
  transform: translate(-50%, 1rem); opacity: 0; pointer-events: none;
  background: rgba(30, 30, 32, 0.92); color: #fff;
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  padding: 0.75rem 1.125rem; border-radius: 999px; font-weight: 500; font-size: 0.9375rem;
  transition: transform 0.4s var(--spring), opacity 0.25s ease;
  max-width: calc(100% - 2rem); text-align: center;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.15s !important; }
  .segmented-thumb, .toast { transition: opacity 0.2s ease !important; }
}
@media (prefers-reduced-transparency: reduce) {
  .card { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--bg); }
}

/* ---- Languages: elements carry data-l="en" or data-l="bs" (English shows until lang.js runs) ---- */
html:not([data-lang="bs"]) [data-l="bs"],
html[data-lang="bs"] [data-l="en"] { display: none !important; }

/* ---- Site header and footer ---- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 0.5rem 0 1.5rem; }
.topbar .brand { margin: 0; color: inherit; text-decoration: none; }
.lang-switch {
  font: inherit; font-size: 0.875rem; font-weight: 500; color: var(--text);
  background: var(--field); border: 0; border-radius: 999px; padding: 0.375rem 0.875rem; cursor: pointer;
}
.sitefoot { margin: 2.5rem 0 0; text-align: center; color: var(--muted); font-size: 0.8125rem; line-height: 1.5; }
.sitefoot nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.25rem 1.25rem; margin-bottom: 0.75rem; }
.sitefoot a { color: var(--muted); text-decoration: none; }
.sitefoot a:hover { color: var(--text); }
.sitefoot p { margin: 0.25rem 1rem; }

/* ---- How it works (home) ---- */
.steps { list-style: none; counter-reset: s; margin: 0; padding: 0; }
.steps li { counter-increment: s; display: flex; gap: 0.875rem; align-items: flex-start; padding: 0.625rem 0; }
.steps li::before {
  content: counter(s); flex: none; width: 1.75rem; height: 1.75rem; border-radius: 50%;
  display: grid; place-items: center; font-weight: 600; font-size: 0.875rem;
  background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent);
}
.info { margin-top: 1.25rem; }
.info h2 { margin-top: 0; }
.info p { margin: 0.5rem 0 0; color: var(--muted); }
.platforms { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.75rem 0 0; padding: 0; list-style: none; }
.platforms li { background: var(--field); border-radius: 999px; padding: 0.3125rem 0.75rem; font-size: 0.875rem; font-weight: 500; }

/* ---- Legal pages ---- */
.doc h1 { margin-bottom: 0.25rem; }
.doc .updated { color: var(--muted); font-size: 0.875rem; margin: 0 0 1.5rem; }
.doc h2 { margin: 1.75rem 0 0.5rem; }
.doc p, .doc li { line-height: 1.6; }
.doc ul { padding-left: 1.25rem; margin: 0.5rem 0; }
.doc li + li { margin-top: 0.375rem; }
.doc a { color: var(--accent); }
.doc .note { background: var(--field); border-radius: 1rem; padding: 1rem 1.125rem; margin: 1rem 0; }
.shell.wide { max-width: 44rem; }
