/* Jameel Noori Nastaleeq, subset to the glyphs this site uses (see tools/subset-font.py).
   unicode-range keeps Latin letters and digits on Instrument Sans. */
@font-face {
  font-family: "Jameel Noori";
  src: url("fonts/jameel-noori.woff2?v=6") format("woff2");
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F;
}

/* Colours taken from the Nusuk app icon: amber #D7911B → sand #EBC78B → cream #FAF2E4, black line work. */
:root {
  color-scheme: light;
  --primary: #D7911B; --primary-hover: #C88412; --on-primary: #17130C;
  --primary-ink: #8A5A0B; --primary-soft: #FBF3E3; --primary-line: #F0D7AC;
  --sand: #EBC78B; --cream: #FAF2E4;
  --canvas: #FDFBF7; --card: #ffffff; --line: #F0EAE0; --soft: #FAF6EF; --soft-2: #F3EDE2;
  --ink: #17130C; --text: #5E574B; --mute: #776E60;
  --ok: #007a51; --ok-bg: #e9f7f1; --bad: #c42525; --bad-bg: #fff0f0; --warn: #8f5a00; --warn-bg: #fdf3e1; --info: #6a0ad8; --info-bg: #f3ecfe;
  --radius: 14px;
  --font: "Jameel Noori", "Instrument Sans", ui-sans-serif, system-ui, sans-serif;
  --latin: "Instrument Sans", ui-sans-serif, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--canvas); color: var(--text);
  font-family: var(--font); font-size: 18px; line-height: 1.85;
  -webkit-font-smoothing: antialiased;
}
/* Hide until the language is applied (fails open after 1.2s if the script never runs). */
html:not(.ready) body { opacity: 0; animation: reveal 0s 1.2s forwards; }
@keyframes reveal { to { opacity: 1; } }

h1, h2, h3, p, ul { margin: 0; }
h1, h2, h3 { color: var(--ink); font-weight: 400; }
small { font-size: 15px; color: var(--mute); }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--primary-ink); outline-offset: 2px; border-radius: 8px; }
.sprite { position: absolute; }
[hidden] { display: none !important; }
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.num { font-family: var(--latin); font-variant-numeric: tabular-nums; }
.code { font-family: var(--mono); font-weight: 600; letter-spacing: .01em; }
.ur-t { font-family: var(--font); }

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

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(253, 251, 247, .92);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-in { height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.brand img { border-radius: 10px; }
.brand-t { display: flex; flex-direction: column; line-height: 1.5; }
.brand-t b { color: var(--ink); font-size: 21px; font-weight: 400; }
.brand-t small { font-size: 13.5px; }
.top-r { display: flex; align-items: center; gap: 8px; }
.lang-switch, .top-btn {
  display: inline-flex; text-decoration: none; align-items: center; gap: 6px; height: 38px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
  font-family: var(--latin); font-size: 14.5px; font-weight: 500; line-height: 1;
}
.lang-switch:hover, .top-btn:hover { background: var(--soft); }
.lang-switch svg.i, .top-btn svg.i { width: 16px; height: 16px; color: var(--primary-ink); }
.top-btn span { font-family: var(--font); font-size: 17px; font-weight: 400; }
.top-btn[aria-current="page"] { background: var(--primary-soft); border-color: var(--primary-line); }
.lang-switch[lang="ur"] span { font-family: var(--font); font-size: 17px; font-weight: 400; }

/* ---------- Pills / icons ---------- */
.pill { display: inline-block; font-size: 14px; border-radius: 999px; padding: 0 11px; white-space: nowrap; line-height: 1.9; }
.pill.pri { background: var(--primary-soft); color: var(--primary-ink); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.mute { background: var(--soft-2); color: var(--text); }
.ico { display: grid; place-items: center; border-radius: 50%; flex: none; width: 46px; height: 46px; }
.ico.sm { width: 38px; height: 38px; }
.ico.sq { width: 42px; height: 42px; border-radius: 12px; }
.ico.pri { background: var(--primary-soft); color: var(--primary-ink); }
.ico.ok { background: var(--ok-bg); color: var(--ok); }
.ico.warn { background: var(--warn-bg); color: var(--warn); }
.ico.info { background: var(--info-bg); color: var(--info); }

/* ---------- Layout ---------- */
.content { padding-top: 18px; padding-bottom: 28px; display: flex; flex-direction: column; gap: 16px; }
.grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 16px; align-items: stretch; }
.side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-h.start { justify-content: flex-start; }
.card-h h2 { font-size: 22px; line-height: 1.7; }
.card-h small { display: block; line-height: 1.6; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 16px; border-radius: 11px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  font-size: 18px; line-height: 1.6; text-decoration: none; white-space: nowrap;
  transition: background-color .15s, border-color .15s, transform .1s;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.btn:hover { background: var(--soft); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.dark:hover { background: #2a241a; }
.btn.block { width: 100%; }
.btn.copied { background: var(--ok); border-color: var(--ok); color: #fff; }

/* ---------- Hero (download first) ---------- */
.hero {
  background: linear-gradient(150deg, var(--primary) 0%, #E4B460 45%, var(--sand) 72%, var(--cream) 100%);
  border: 0; color: var(--ink); position: relative; overflow: hidden; padding: 22px 20px;
}
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .16); }
.hero::before { width: 280px; height: 280px; inset-inline-end: -100px; top: -120px; }
.hero::after { width: 190px; height: 190px; inset-inline-start: -60px; bottom: -90px; }
/* Illustration (made with Codex image generation), faded into the gradient; desktop only. */
.hero-art {
  position: absolute; inset-inline-end: 10px; top: 50%; width: 330px; height: 330px; transform: translateY(-50%);
  border-radius: 50%; pointer-events: none; user-select: none;
  -webkit-mask-image: radial-gradient(closest-side, #000 62%, transparent 100%);
  mask-image: radial-gradient(closest-side, #000 62%, transparent 100%);
}
@media (max-width: 860px) { .hero-art { display: none; } }
.hero .stack { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; max-width: 640px; }
.hero-top { display: flex; align-items: center; gap: 10px; }
.ico.glass { background: rgba(255, 255, 255, .45); color: var(--ink); }
.hero-tag { font-size: 16px; color: rgba(23, 19, 12, .78); }
.hero h1 { color: var(--ink); font-size: clamp(25px, 6.6vw, 38px); line-height: 1.6; }
.hero-p { color: rgba(23, 19, 12, .8); font-size: 17.5px; }
.btn.xl { min-height: 58px; padding: 0 22px 0 22px; font-size: 21px; border-radius: 14px; gap: 12px; box-shadow: 0 14px 30px -14px rgba(23, 19, 12, .55); }
.app-ic { width: 32px; height: 32px; border-radius: 8px; flex: none; box-shadow: 0 0 0 1px rgba(255, 255, 255, .25); }
.hero-code { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; font-size: 15.5px; color: rgba(23, 19, 12, .78); }
.code-chip {
  display: inline-flex; align-items: center; gap: 8px; border-radius: 10px;
  background: rgba(255, 255, 255, .5); border: 1px dashed rgba(23, 19, 12, .3);
  color: var(--ink); padding: 4px 10px; line-height: 1.5;
}
.code-chip:hover { background: rgba(255, 255, 255, .75); }
.code-chip .code { font-size: 16px; }
.code-chip svg.i { width: 16px; height: 16px; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.kpi { flex-direction: row; align-items: center; gap: 14px; }
.kpi small { display: block; line-height: 1.6; }
.big { font-size: 26px; font-weight: 600; color: var(--ink); line-height: 1.2; }

/* ---------- Deck ---------- */
/* The deck grows to match the height of the column beside it (desktop), within limits. */
.deck-area { flex: 1; display: flex; flex-direction: column; justify-content: center; background: var(--soft); border-radius: 12px; padding: 14px 14px 26px; }
.deck { position: relative; flex: 1; min-height: 288px; max-height: 460px; touch-action: pan-y; }
.deck-empty {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  border: 1px dashed var(--primary-line); border-radius: 12px; background: #fff; color: var(--text); padding: 20px;
}
.deck-empty .btn { margin-top: 10px; }
.kcard {
  position: absolute; inset: 0; background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px; display: flex; flex-direction: column; gap: 10px;
  box-shadow: 0 10px 24px -18px rgba(23, 19, 12, .35);
  transform-origin: 50% 100%;
  transition: transform .3s cubic-bezier(.2, .75, .25, 1), opacity .28s ease;
  will-change: transform; user-select: none; -webkit-user-select: none;
}
.kcard.featured { border-color: var(--primary-line); background: linear-gradient(180deg, var(--primary-soft), #fff 45%); }
.kcard.dragging { transition: none; cursor: grabbing; }
.kcard[data-depth="1"] { transform: translateY(10px) scale(.96); }
.kcard[data-depth="2"] { transform: translateY(20px) scale(.92); }
.kcard[data-depth="1"] > *, .kcard[data-depth="2"] > * { visibility: hidden; }
.k-top { display: flex; align-items: center; gap: 10px; }
.k-top .t { flex: 1; min-width: 0; line-height: 1.5; }
.k-top b { color: var(--ink); font-weight: 400; font-size: 17px; display: block; }
.k-top small { font-size: 14px; }
.k-code {
  margin: auto 0; text-align: center; color: var(--ink);
  font-size: clamp(28px, 8.4vw, 36px); line-height: 1.3; word-break: break-all;
  user-select: all; -webkit-user-select: all;
}
.k-btns { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.k-link { padding: 0 12px; }
.k-link img { width: 26px; height: 26px; border-radius: 7px; }
.k-foot { display: flex; justify-content: center; min-height: 28px; }
.k-report { border: 0; background: none; color: var(--mute); font-size: 15px; display: inline-flex; align-items: center; gap: 6px; line-height: 1.8; padding: 0 6px; border-radius: 8px; }
.k-report:hover { color: var(--bad); background: var(--bad-bg); }
.k-report svg.i { width: 15px; height: 15px; }
.k-note { font-size: 14.5px; color: var(--mute); text-align: center; }
.stamp {
  position: absolute; top: 58px; pointer-events: none; opacity: 0;
  font-size: 20px; line-height: 1.6; padding: 2px 14px; border-radius: 10px; border: 2px solid currentColor; background: #fff;
}
.stamp-yes { left: 16px; color: var(--ok); transform: rotate(-10deg); }
.stamp-no { right: 16px; color: var(--mute); transform: rotate(10deg); }

.deck-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }
.hint { text-align: center; font-size: 14.5px; color: var(--mute); }

/* ---------- Submit ---------- */
.give { display: flex; flex-direction: column; gap: 8px; }
.give label { color: var(--ink); font-size: 16.5px; }
.field { position: relative; display: flex; align-items: center; }
.field input {
  width: 100%; height: 52px; border: 1px solid var(--line); border-radius: 11px; background: #fff;
  padding: 0 14px; color: var(--ink); font-family: var(--mono); font-size: 17px; text-align: left;
}
[dir="rtl"] .field input { padding-left: 100px; }
[dir="ltr"] .field input { padding-right: 100px; }
.field input::placeholder { color: #b9b1a3; }
.field input:focus { outline: none; border-color: var(--primary-line); box-shadow: 0 0 0 4px var(--primary-soft); }
.field input.valid { border-color: #a9dcc7; }
.paste {
  position: absolute; height: 38px; display: inline-flex; align-items: center; gap: 6px;
  border: 0; border-radius: 9px; background: var(--primary-soft); color: var(--primary-ink); padding: 0 12px; font-size: 16px; line-height: 1;
}
[dir="rtl"] .paste { left: 7px; }
[dir="ltr"] .paste { right: 7px; }
.paste:hover { background: var(--primary-line); }
.paste svg.i { width: 16px; height: 16px; }
.form-msg { font-size: 15.5px; line-height: 1.7; }
.form-msg:empty { display: none; }
.form-msg.ok { color: var(--ok); }
.form-msg.err { color: var(--bad); }
.fine { font-size: 14.5px; color: var(--mute); line-height: 1.8; }
.mine { border: 1px solid #cfeadf; background: var(--ok-bg); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.mine-h { display: flex; align-items: center; gap: 10px; }
.mine-h b { color: var(--ink); font-weight: 400; display: block; line-height: 1.5; }
.mine-h .code { color: var(--ok); font-size: 15px; }
.mine p { font-size: 15.5px; }
.share-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.share-row .btn { padding: 0 8px; font-size: 16px; min-height: 44px; }

/* ---------- Lists / callout ---------- */
.list { display: grid; }
.row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row-app { width: 38px; height: 38px; border-radius: 10px; flex: none; }

/* How it works: three steps in one strip */
.how h2 { font-size: 22px; line-height: 1.7; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.steps li { --pad: 18px; position: relative; display: flex; align-items: center; gap: 12px; padding: 2px var(--pad); border-inline-start: 1px solid var(--line); }
.steps li:first-child { --pad: 0px; border-inline-start: 0; }
.steps .t { flex: 1; min-width: 0; line-height: 1.6; }
.steps .t b { color: var(--ink); font-weight: 400; display: block; font-size: 17px; }
.steps .t small { display: block; }
.step-n {
  position: absolute; top: -4px; inset-inline-start: calc(var(--pad) + 26px); z-index: 1;
  width: 19px; height: 19px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ink); color: #fff; font-size: 11px; font-weight: 600; line-height: 1; box-shadow: 0 0 0 2px #fff;
}
.row .t { flex: 1; min-width: 0; line-height: 1.6; }
.row .t b { color: var(--ink); font-weight: 400; display: block; font-size: 17px; }
.row .t small { display: block; }
.callout { display: flex; gap: 12px; align-items: flex-start; background: var(--soft); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; font-size: 16px; }
.callout > svg.i { color: var(--primary-ink); margin-top: 6px; }
.callout b { color: var(--ink); font-weight: 400; font-size: 17.5px; }
.callout ul { padding-inline-start: 18px; padding-inline-end: 0; line-height: 1.85; }
.callout.wide { padding: 14px 20px; }
.callout.wide > div { flex: 1; min-width: 0; }
.callout.wide ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; }

/* ---------- Live activity ---------- */
.live { gap: 8px; }
.live-pill { display: inline-flex; align-items: center; gap: 7px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); position: relative; flex: none; }
.live-dot::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--ok);
  opacity: 0; animation: ping 1.8s ease-out infinite;
}
@keyframes ping { 0% { transform: scale(.5); opacity: .7; } 100% { transform: scale(1.4); opacity: 0; } }
.feed { list-style: none; margin: 0; padding: 0; display: grid; }
.feed-row { display: flex; align-items: center; gap: 10px; padding: 7px 8px; margin: 0 -8px; border-radius: 10px; border-bottom: 1px solid var(--line); }
.feed-row:last-child { border-bottom-color: transparent; }
.feed-row.fresh { animation: arrive 2.4s ease-out; }
@keyframes arrive {
  0% { background: var(--ok-bg); transform: translateY(-6px); opacity: 0; }
  12% { transform: none; opacity: 1; }
  60% { background: var(--ok-bg); }
  100% { background: transparent; }
}
.feed-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none; background: var(--soft-2); color: var(--text); }
.feed-ic svg.i { width: 16px; height: 16px; }
.feed-row:first-child .feed-ic { background: var(--ok-bg); color: var(--ok); }
.feed-row .t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.feed-row .t b { color: var(--ink); font-size: 15.5px; line-height: 1.5; text-align: start; }
[dir="rtl"] .feed-row .t b { text-align: right; }
.feed-row .t small { font-size: 13.5px; line-height: 1.6; display: flex; gap: 6px; flex-wrap: wrap; }
.feed-clock { font-size: 12.5px; color: #9c9384; }
.feed-clock::before { content: "·"; margin-inline-end: 6px; }
.feed-tag { font-size: 12.5px; }
.feed-copy {
  width: 36px; height: 36px; flex: none; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
}
.feed-copy:hover { background: var(--primary-soft); border-color: var(--primary-line); }
.feed-copy svg.i { width: 16px; height: 16px; }
.feed-copy.copied { background: var(--ok); border-color: var(--ok); color: #fff; }
.feed-copy.was-copied { background: var(--ok-bg); border-color: #cfeadf; color: var(--ok); }
.feed-row.done .t b { color: var(--mute); }
.feed-empty { font-size: 15.5px; color: var(--mute); text-align: center; padding: 18px 8px; border: 1px dashed var(--line); border-radius: 12px; }

/* ---------- Contact page ---------- */
.page-head { display: flex; align-items: center; gap: 14px; }
.page-head h1 { font-size: clamp(25px, 6vw, 32px); line-height: 1.6; }
.page-head p { color: var(--text); }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--primary-ink); text-decoration: none; font-size: 16px; align-self: flex-start; }
.back-link:hover { text-decoration: underline; }
.back-link svg.i { width: 16px; height: 16px; }
[dir="rtl"] .back-link svg.i { transform: scaleX(-1); }
.cform { display: flex; flex-direction: column; gap: 14px; }
.cform .lbl { color: var(--ink); font-size: 16.5px; display: block; margin-bottom: 6px; }
.cform .lbl small { font-size: 14px; }
.kinds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; border: 0; margin: 0; padding: 0; }
.kinds legend { padding: 0; }
.kind { position: relative; }
.kind input { position: absolute; opacity: 0; pointer-events: none; }
.kind > span {
  display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 46px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--text); cursor: pointer; text-align: center; line-height: 1.5;
}
.kind > span:hover { background: var(--soft); }
.kind input:checked + span { background: var(--primary-soft); border-color: var(--primary); color: var(--ink); }
.kind input:focus-visible + span { outline: 2px solid var(--primary-ink); outline-offset: 2px; }
.kind svg.i { width: 16px; height: 16px; }
.cform textarea, .cform .inp {
  width: 100%; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--ink);
  font: inherit; padding: 10px 14px;
}
.cform textarea { min-height: 150px; resize: vertical; line-height: 1.9; }
.cform .inp { height: 50px; }
.cform textarea:focus, .cform .inp:focus { outline: none; border-color: var(--primary-line); box-shadow: 0 0 0 4px var(--primary-soft); }
.cform textarea::placeholder, .cform .inp::placeholder { color: #b9b1a3; }
.cform .two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.counter { font-size: 13px; color: var(--mute); text-align: end; margin-top: 4px; }
.counter.over { color: var(--bad); }
.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); opacity: 0; pointer-events: none; }
.sent { align-items: center; text-align: center; padding: 34px 20px; gap: 10px; }
.sent .ico { width: 58px; height: 58px; }
.sent .ico svg.i { width: 26px; height: 26px; }
.sent h2 { font-size: 24px; line-height: 1.7; }
.sent p { max-width: 420px; }
.sent .row-btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.tips { display: grid; gap: 2px; }
.tips li { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.tips .ico { width: 34px; height: 34px; }
.tips .ico svg.i { width: 16px; height: 16px; }
.tips { list-style: none; margin: 0; padding: 0; }
.tips li span:last-child { color: var(--ink); line-height: 1.6; }
.side-h { font-size: 20px; line-height: 1.7; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Footer / toast ---------- */
.foot { padding-bottom: 36px; font-size: 14.5px; color: var(--mute); text-align: center; line-height: 1.9; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.foot-cta {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--primary-line); background: var(--primary-soft); color: var(--primary-ink);
  text-decoration: none; font-size: 16px;
}
.foot-cta:hover { background: var(--primary-line); }
.foot-cta svg.i { width: 16px; height: 16px; }
.toast {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 60;
  transform: translate(-50%, 24px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; padding: 6px 18px; border-radius: 11px; font-size: 16px; line-height: 1.8;
  max-width: calc(100% - 32px); text-align: center; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Language chooser ---------- */
.lang-modal {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: rgba(23, 19, 12, .42); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.lang-box {
  width: 100%; max-width: 380px; background: #fff; border-radius: 18px; padding: 24px 20px 20px;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px;
  box-shadow: 0 30px 60px -20px rgba(23, 19, 12, .45);
}
.lang-box img { border-radius: 14px; margin-bottom: 8px; }
.lang-box h2 { font-family: var(--latin); font-weight: 600; font-size: 20px; line-height: 1.3; }
.lang-box p { font-size: 19px; color: var(--text); line-height: 1.9; }
.lang-btns { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.lang-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px 8px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--soft);
  transition: border-color .15s, background-color .15s;
}
.lang-btn:hover { border-color: var(--primary); background: var(--primary-soft); }
.lang-btn b { color: var(--ink); font-size: 22px; line-height: 1.6; font-weight: 400; }
.lang-btn[data-lang="en"] b { font-family: var(--latin); font-weight: 600; font-size: 19px; line-height: 1.9; }
.lang-btn small { font-family: var(--latin); font-size: 13px; line-height: 1.6; }
.lang-btn small.ur-t { font-family: var(--font); font-size: 15px; }

/* ---------- English (LTR) ---------- */
html[lang="en"] body { font-family: var(--latin); font-size: 16px; line-height: 1.55; }
html[lang="en"] small { font-size: 13.5px; }
html[lang="en"] h1, html[lang="en"] h2 { font-weight: 600; letter-spacing: -.01em; }
html[lang="en"] .steps .t b { font-weight: 600; font-size: 15px; }
html[lang="en"] .how h2 { font-size: 18px; line-height: 1.4; }
html[lang="en"] .brand-t b, html[lang="en"] .k-top b, html[lang="en"] .row .t b,
html[lang="en"] .mine-h b, html[lang="en"] .callout b { font-weight: 600; }
html[lang="en"] .brand-t b { font-size: 17px; }
html[lang="en"] .brand-t small { font-size: 12.5px; }
html[lang="en"] .card-h h2 { font-size: 18px; line-height: 1.4; }
html[lang="en"] .hero h1 { font-size: clamp(25px, 6.4vw, 36px); line-height: 1.2; }
html[lang="en"] .hero-p { font-size: 16px; }
html[lang="en"] .hero-tag, html[lang="en"] .hero-code { font-size: 14.5px; }
html[lang="en"] .btn { font-size: 15.5px; font-weight: 600; }
html[lang="en"] .btn.xl { font-size: 17px; }
html[lang="en"] .share-row .btn { font-size: 14px; }
html[lang="en"] .give label, html[lang="en"] .k-top b, html[lang="en"] .row .t b { font-size: 15px; }
html[lang="en"] .k-top small, html[lang="en"] .k-note, html[lang="en"] .k-report,
html[lang="en"] .hint, html[lang="en"] .fine, html[lang="en"] .form-msg, html[lang="en"] .mine p { font-size: 13.5px; }
html[lang="en"] .callout { font-size: 14.5px; }
html[lang="en"] .callout b { font-size: 15.5px; }
html[lang="en"] .callout ul { line-height: 1.6; margin-top: 2px; }
html[lang="en"] .pill { font-size: 12.5px; line-height: 2; }
html[lang="en"] .paste { font-size: 14px; font-weight: 600; }
html[lang="en"] .stamp { font-size: 16px; font-weight: 700; }
html[lang="en"] .foot { font-size: 13px; line-height: 1.6; }
html[lang="en"] .top-btn span { font-family: var(--latin); font-size: 14.5px; font-weight: 500; }
html[lang="en"] .feed-row .t small { font-size: 12.5px; }
html[lang="en"] .feed-empty, html[lang="en"] .foot-cta, html[lang="en"] .back-link { font-size: 14px; }
html[lang="en"] .page-head h1 { font-size: clamp(24px, 5.6vw, 30px); line-height: 1.25; }
html[lang="en"] .cform .lbl { font-size: 14.5px; font-weight: 600; }
html[lang="en"] .cform .lbl small { font-size: 13px; font-weight: 400; }
html[lang="en"] .kind span { font-size: 14.5px; font-weight: 500; }
html[lang="en"] .cform textarea { line-height: 1.55; }
html[lang="en"] .sent h2 { font-size: 21px; font-weight: 600; line-height: 1.35; }
html[lang="en"] .tips li span:last-child { font-size: 14.5px; }
html[lang="en"] .side-h { font-size: 17px; font-weight: 600; line-height: 1.4; }
html[lang="en"] .toast { font-size: 14.5px; line-height: 1.6; padding: 9px 18px; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 16px; }
  .steps { grid-template-columns: minmax(0, 1fr); }
  .steps li, .steps li:first-child { --pad: 0px; padding: 10px 0; border-inline-start: 0; border-top: 1px solid var(--line); }
  .steps li:first-child { border-top: 0; padding-top: 4px; }
  .steps li .step-n { top: 6px; }
  .steps li:first-child .step-n { top: 0; }
  .kpis { gap: 8px; }
  .kpi { flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px; }
  .kpi .ico { width: 36px; height: 36px; }
  .kpi small { font-size: 13.5px; }
  .big { font-size: 22px; }
  .callout.wide ul { grid-template-columns: minmax(0, 1fr); }
  .cform .two { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  .hide-md { display: none; }
}
@media (max-width: 420px) {
  .hide-sm { display: none; }
  .btn.xl { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .kcard, .btn, .toast { transition: none; }
  .live-dot::after, .feed-row.fresh { animation: none; }
}

/* ---------- Admin panel ---------- */
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.admin .login { max-width: 400px; width: 100%; margin: 40px auto; align-items: stretch; }
.admin .login h1 { font-size: 22px; font-weight: 600; }
.kpis-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.admin-grid { grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); align-items: start; }
.tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.tabs { display: inline-flex; background: var(--soft-2); border-radius: 10px; padding: 3px; gap: 2px; }
.tab { border: 0; background: none; border-radius: 8px; padding: 6px 12px; font-size: 13.5px; font-weight: 500; color: var(--text); }
.tab.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(23, 19, 12, .12); }
.cform .inp.search, .inp.search { height: 38px; max-width: 220px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; font: inherit; font-size: 14px; }
.alist, .msgs { list-style: none; margin: 0; padding: 0; display: grid; }
.arow { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.arow:last-child { border-bottom: 0; }
.arow.is-hidden .a-code b { color: var(--mute); text-decoration: line-through; }
.arow.is-owner { background: var(--primary-soft); margin: 0 -10px; padding: 10px; border-radius: 10px; border-bottom: 0; }
.a-main { flex: 1; min-width: 0; }
.a-code { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.a-code b { color: var(--ink); font-size: 16px; }
.a-main small { font-size: 12.5px; }
.pos { font-size: 12px; font-weight: 700; color: var(--primary-ink); background: var(--primary-soft); border: 1px solid var(--primary-line); border-radius: 6px; padding: 0 6px; line-height: 1.6; }
.a-act { display: flex; gap: 4px; flex: none; }
.abtn { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); }
.abtn:hover:not(:disabled) { background: var(--soft); color: var(--ink); }
.abtn:disabled { opacity: .35; cursor: default; }
.abtn svg.i { width: 15px; height: 15px; }
.abtn.on { background: var(--primary-soft); border-color: var(--primary-line); color: var(--primary-ink); }
.abtn.danger:hover { background: var(--bad-bg); color: var(--bad); border-color: #f3c9c9; }
.a-empty { color: var(--mute); text-align: center; padding: 20px 0; font-size: 14px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.admin .cform textarea { min-height: 120px; font-family: var(--mono); font-size: 14px; }
.msg { padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.msg:last-child { border-bottom: 0; }
.msg-h { display: flex; align-items: center; gap: 8px; }
.msg-h small { flex: 1; font-size: 12px; }
.msg p { color: var(--ink); font-size: 14.5px; white-space: pre-wrap; word-break: break-word; font-family: "Jameel Noori", var(--latin); }
.msg-from { font-size: 12.5px; }
@media (max-width: 860px) {
  .kpis-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .admin-grid { grid-template-columns: minmax(0, 1fr); }
  .arow { flex-wrap: wrap; }
  .a-act { width: 100%; justify-content: flex-end; }
  .inp.search { max-width: none; flex: 1; }
}
#app { display: flex; flex-direction: column; gap: 16px; }
