:root {
  --bg: #000;
  --surface: #141416;
  --raised: #1d1d21;
  --border: #26262b;
  --border-strong: #3a3a41;
  --text: #f5f5f7;
  --text-2: #a1a1aa;
  --muted: #6b6b74;
  --primary: #e01d23;
  --primary-press: #b8161c;
  --ok: #22c55e;
  --error: #f04438;
  --radius: 12px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  padding-top: max(14px, env(safe-area-inset-top));
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.01em; min-width: 0; }
.brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo { width: 26px; height: 26px; border-radius: 7px; background: var(--primary); position: relative; flex: none; }
.logo::after { content: ""; position: absolute; inset: 8px 7px 8px 10px; background: #fff; clip-path: polygon(0 0, 100% 50%, 0 100%); }
.lang select {
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 8px; font: inherit; font-size: 14px;
}

main { width: 100%; max-width: 560px; margin: 0 auto; padding: 20px 16px 8px; flex: 1; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 20px 18px; margin-bottom: 16px; }
h1 { font-size: 24px; line-height: 1.25; margin: 0 0 8px; letter-spacing: -0.02em; }
h2 { font-size: 18px; margin: 0 0 4px; }
.lead, .hint { color: var(--text-2); margin: 0 0 16px; }
.hint { font-size: 14px; }

label { display: block; font-size: 14px; color: var(--text-2); margin: 14px 0 6px; font-weight: 500; }
input[type="url"], input[type="password"], input:not([type]), input[type="text"] {
  width: 100%; height: 50px; padding: 0 14px; border-radius: var(--radius);
  background: var(--bg); color: var(--text); border: 1px solid var(--border-strong);
  font: inherit; font-size: 16px; /* 16px stops iOS from zooming */
  outline: none;
}
input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(224, 29, 35, 0.25); }
.code-input { font-variant-numeric: tabular-nums; letter-spacing: 0.18em; font-weight: 700; text-align: center; font-size: 26px !important; height: 60px !important; }
.check { display: flex; align-items: center; gap: 10px; color: var(--text-2); margin-top: 14px; }
.check input { width: 20px; height: 20px; accent-color: var(--primary); margin: 0; }

.btn {
  display: flex; align-items: center; justify-content: center; width: 100%; height: 52px; margin-top: 20px;
  border-radius: var(--radius); border: 0; font: inherit; font-weight: 600; font-size: 16px; cursor: pointer;
}
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:active { background: var(--primary-press); }
.btn:disabled { opacity: 0.55; cursor: default; }
.link { background: none; border: 0; color: var(--text); text-decoration: underline; text-underline-offset: 3px; font: inherit; font-size: 14px; cursor: pointer; padding: 6px 2px; }
.link.small { font-size: 13px; color: var(--text-2); }
.with-btn { position: relative; }
.with-btn input { padding-inline-end: 72px; }
.with-btn .link { position: absolute; inset-inline-end: 10px; top: 50%; transform: translateY(-50%); }

.seg { display: flex; gap: 4px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 4px; margin: 12px 0 4px; }
.seg button { flex: 1; height: 42px; border: 0; border-radius: 9px; background: transparent; color: var(--text-2); font: inherit; font-weight: 600; font-size: 15px; cursor: pointer; }
.seg button[aria-selected="true"] { background: var(--text); color: #000; }

.msg { min-height: 1.5em; margin: 12px 0 0; font-size: 15px; }
.msg.error { color: var(--error); }
.msg.ok { color: var(--ok); }

.tvbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin: 0 2px 12px; font-size: 14px; color: var(--text-2); }
.tv-state { display: inline-flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text); }

.saved { list-style: none; margin: 8px 0 0; padding: 0; }
.saved li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.saved li:first-child { border-top: 0; }
.saved .info { flex: 1; min-width: 0; }
.saved .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.saved .sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.saved .del { flex: none; background: var(--raised); color: var(--text); border: 1px solid var(--border); border-radius: 9px; padding: 8px 12px; font: inherit; font-size: 14px; cursor: pointer; }
.saved .del.confirm { background: var(--error); border-color: var(--error); color: #fff; }
.empty { color: var(--muted); margin: 8px 0 0; }

.secure { display: flex; gap: 10px; align-items: flex-start; color: var(--text-2); font-size: 14px; margin: 4px 4px 16px; }
.lock { flex: none; width: 14px; height: 11px; margin-top: 6px; border-radius: 2px; background: var(--ok); position: relative; }
.lock::before { content: ""; position: absolute; left: 3px; right: 3px; top: -6px; height: 8px; border: 2px solid var(--ok); border-bottom: 0; border-radius: 5px 5px 0 0; }

footer { border-top: 1px solid var(--border); padding: 16px; padding-bottom: max(16px, env(safe-area-inset-bottom)); text-align: center; color: var(--muted); font-size: 13px; }
footer p { max-width: 560px; margin: 4px auto; }
footer a { color: var(--text-2); }

/* privacy page */
.doc { max-width: 720px; }
.doc h1 { font-size: 28px; }
.doc h2 { margin-top: 28px; font-size: 19px; }
.doc p, .doc li { color: var(--text-2); }
.doc a { color: var(--text); }
.doc .updated { color: var(--muted); font-size: 14px; }
