:root {
  --navy: #0d1b45;
  --navy-2: #13285f;
  --ink: #1c2540;
  --muted: #5d6883;
  --line: #e1e7f1;
  --bg: #f2f5fa;
  --card: #ffffff;
  --blue: #1557d4;
  --blue-2: #3b82f6;
  --cyan: #38bdf8;
  --blue-soft: #eaf1fd;
  --green: #0f7a46;
  --green-soft: #e7f6ed;
  --green-line: #b6e2c6;
  --red: #c42d2d;
  --red-soft: #fdeeee;
  --red-line: #f1c2c2;
  --amber: #9a5b00;
  --amber-soft: #fff5e3;
  --amber-line: #f2d59c;
  --gray-soft: #f0f3f8;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(13, 27, 69, .05), 0 4px 16px rgba(13, 27, 69, .05);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 "Segoe UI", "Nirmala UI", "Noto Sans Bengali", "Hind Siliguri", system-ui, -apple-system, Roboto, sans-serif; color: var(--ink); background: var(--bg); }
html[lang="bn"] body { line-height: 1.6; }
.lang-switch { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; flex: none; }
.lang-switch button { border: 0; background: #fff; padding: 5px 11px; font-size: 12.5px; font-weight: 700; color: var(--muted); cursor: pointer; }
.lang-switch button.active { background: var(--navy); color: #fff; }
.kind-box { margin-top: 10px; padding: 9px 12px; border-radius: 10px; background: #f4f7fd; border: 1px solid #dbe4f4; font-size: 13px; color: var(--ink); }
.kind-box .kind-q { color: var(--muted); font-weight: 600; }
.kind-box b { color: var(--navy); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); }
.hidden { display: none !important; }
.mono { font-family: Consolas, "SF Mono", Menlo, monospace; font-size: 12px; }
.justify { text-align: justify; hyphens: auto; }

/* ---------- header ---------- */
header.top { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.97); border-bottom: 1px solid var(--line); backdrop-filter: blur(6px); }
.top-inner { max-width: 1200px; margin: 0 auto; padding: 7px 18px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; padding-right: 16px; border-right: 1px solid var(--line); }
.brand svg { width: 34px; height: 34px; flex: none; }
.brand b { display: block; font-size: 20px; letter-spacing: .4px; color: var(--navy); line-height: 1; font-weight: 800; }
.brand small { display: block; font-size: 8.5px; letter-spacing: 1.5px; color: var(--muted); margin-top: 4px; font-weight: 700; }
nav.tabs { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
nav.tabs button {
  display: flex; align-items: center; gap: 7px; border: 0; background: none; padding: 7px 11px; border-radius: 8px;
  color: var(--muted); cursor: pointer; white-space: nowrap; font-weight: 600; font-size: 13.5px; position: relative;
}
nav.tabs button svg { width: 16px; height: 16px; }
nav.tabs .t-short { display: none; }
nav.tabs button:hover { color: var(--navy); background: var(--gray-soft); }
nav.tabs button.active { color: var(--blue); background: var(--blue-soft); }
nav.tabs button.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -8px; height: 2.5px; border-radius: 2px; background: var(--blue); }
.pill-status {
  display: flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: var(--green-soft); color: var(--green); border: 1px solid var(--green-line); white-space: nowrap;
}
.pill-status svg { width: 15px; height: 15px; }
.pill-status.off { background: var(--red-soft); color: var(--red); border-color: var(--red-line); }

/* ---------- hero (security look) ---------- */
.hero {
  position: relative; overflow: hidden; text-align: center; padding: 22px 20px 24px; color: #fff;
  background:
    radial-gradient(circle at 18% 30%, rgba(59,130,246,.35), transparent 40%),
    radial-gradient(circle at 85% 70%, rgba(56,189,248,.18), transparent 45%),
    linear-gradient(135deg, #0a1638 0%, #10275f 55%, #0d1f4d 100%);
}
.hero::before {   /* faint security grid */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 28px 28px; mask-image: linear-gradient(180deg, #000 30%, transparent);
}
.hero > * { position: relative; }
.hero h1 { margin: 0; font-size: clamp(24px, 3vw, 34px); font-weight: 800; letter-spacing: -.3px; }
.hero h1 span { color: var(--cyan); }
.hero p { margin: 4px auto 0; max-width: 640px; color: #c7d4f2; font-size: clamp(13px, 1.3vw, 15px); }
.trust { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.trust b { font-weight: 600; }
.trust span {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16); color: #e3ebff;
}
.trust svg { width: 14px; height: 14px; color: var(--cyan); }
.hero .deco-left { position: absolute; left: 3.5%; top: 50%; transform: translateY(-50%); width: 92px; opacity: .9; }
.hero .deco-right { position: absolute; right: 2%; top: 0; height: 100%; width: auto; pointer-events: none; opacity: .5; mix-blend-mode: luminosity; }
/* Documentation and About: English or Bangla block, following the language switch */
html[lang="bn"] .i18n-en, html:not([lang="bn"]) .i18n-bn { display: none; }
/* feedback page */
.fb-card { max-width: 760px; margin-bottom: 14px; }
.fb-label { display: block; font-weight: 600; color: var(--navy); margin: 12px 0 5px; font-size: 14px; }
.fb-count { text-align: right; font-size: 12px; color: var(--muted); margin-top: 3px; }
.fb-warn { font-size: 12.5px; color: var(--red); margin: 4px 0 0; }
.fb-card textarea { width: 100%; box-sizing: border-box; }
.fb-owner { background: #ecf8f0; border: 1px solid #b7e0c4; color: #17663a; border-radius: 9px; padding: 8px 11px; font-size: 13px; }
/* public board: like app-store reviews */
.fb-board { max-width: 760px; }
.fb-board-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 6px 0 8px; }
.fb-board-head h3 { margin: 0; }
.fb-post { margin-bottom: 10px; padding: 12px 14px; }
.fb-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 13px; }
.fb-av { width: 28px; height: 28px; border-radius: 50%; color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 700; flex: none; }
.fb-av.team { background: var(--navy); }
.fb-av.team svg { width: 16px; height: 16px; color: #fff; }
.fb-who { color: var(--navy); }
.fb-entry.team .fb-who, .fb-check { color: var(--blue); }
.fb-you, .fb-time { color: var(--muted); font-size: 12px; }
.fb-time::before { content: "·"; margin-right: 6px; }
.fb-text { white-space: pre-wrap; word-break: break-word; margin: 7px 0 4px; line-height: 1.5; }
.fb-hid { background: #eef1f7; color: var(--muted); border-radius: 5px; padding: 0 5px; font-size: .92em; white-space: nowrap; }
.fb-acts { display: flex; gap: 14px; flex-wrap: wrap; }
.fb-link { background: none; border: 0; padding: 4px 0; color: var(--blue); font-weight: 600; font-size: 13px; cursor: pointer; }
.fb-link.red-text { color: var(--red); }
.fb-replies { margin: 10px 0 0 14px; padding-left: 12px; border-left: 2px solid var(--line); }
.fb-replies .fb-entry { padding: 8px 0 2px; }
.fb-replies .fb-entry + .fb-entry { border-top: 1px dashed var(--line); }
.fb-replies .fb-entry.team { background: var(--blue-soft); border-radius: 9px; padding: 8px 10px; margin: 6px 0; border-top: 0; }
.fb-count-r { font-size: 12px; color: var(--muted); font-weight: 600; }
.fb-entry.is-hidden { opacity: .65; }
.fb-reply-box { margin-top: 10px; }
.fb-reply-box textarea { width: 100%; box-sizing: border-box; margin-bottom: 6px; }
.btn.red-text { color: var(--red); }

@media (max-width: 900px) { .hero .deco-left, .hero .deco-right { display: none; } }

/* ---------- layout ---------- */
main { max-width: 1200px; margin: 0 auto; padding: 18px 18px 26px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, .85fr); gap: 14px; margin-top: 14px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
@media (max-width: 1000px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
/* public phone app (build_pwa.py --edition public): no Research Lab, no Benchmarks, their files are not shipped */
html.public .research-only { display: none !important; }
html:not(.public) .public-only { display: none !important; }   /* text only for the public phone app */
html.public #homeGrid { grid-template-columns: 1fr; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card-head { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.card-head h2 { margin: 0; font-size: 16.5px; color: var(--navy); font-weight: 700; }
.card-head h3 { margin: 0; font-size: 15px; color: var(--navy); font-weight: 700; }
.card-head .icon { width: 22px; height: 22px; color: var(--blue); flex: none; }
.card-head .right { margin-left: auto; }
.section-title { font-size: 19px; color: var(--navy); margin: 4px 0 8px; font-weight: 700; }
.lead { color: var(--muted); margin: 0 0 14px; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge svg { width: 14px; height: 14px; }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.gray { background: var(--gray-soft); color: var(--muted); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.red { background: var(--red-soft); color: var(--red); }
.tag-exp { background: var(--navy); color: #fff; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 5px; letter-spacing: .5px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer; text-decoration: none;
  border: 1px solid #cbd7ee; background: #fff; color: var(--navy); border-radius: 9px; padding: 8px 12px; font-weight: 600; font-size: 13.5px;
  transition: background .15s, border-color .15s;
}
.btn svg { width: 16px; height: 16px; flex: none; }
.btn:hover { background: var(--blue-soft); border-color: #a9c2ef; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: #0f49b8; }
.btn.soft { background: var(--blue-soft); border-color: #c3d5f6; color: var(--blue); }
#speakBtn.on { background: var(--blue); border-color: var(--blue); color: #fff; }   /* reading aloud: the button becomes "Stop" */
.btn.big { padding: 10px 14px; font-size: 14.5px; }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.red { background: var(--red); border-color: var(--red); color: #fff; }
.btn:disabled { opacity: .45; cursor: default; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.btn-row.three { grid-template-columns: 1fr 1fr 1fr; }
.btn-row.three .btn { white-space: nowrap; padding: 7px 6px; font-size: 13px; }
.btn-row.one { grid-template-columns: 1fr; }

/* ---------- scanner ---------- */
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--gray-soft); border-radius: 10px; padding: 3px; gap: 3px; margin-bottom: 12px; }
.segmented button { border: 0; background: none; padding: 6px 4px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; justify-content: center; }
.segmented button svg { width: 15px; height: 15px; }
.segmented button.active { background: #fff; color: var(--blue); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.viewport {
  position: relative; aspect-ratio: 16 / 11; border-radius: 11px; overflow: hidden;
  background: radial-gradient(circle at 50% 40%, #1b2f66, #0b1736); display: flex; align-items: center; justify-content: center;
}
.viewport::before {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 22px 22px;
}
.viewport video { position: relative; width: 100%; height: 100%; object-fit: cover; }
.viewport .frame { position: absolute; width: 44%; aspect-ratio: 1; top: 45%; left: 50%; transform: translate(-50%, -50%); pointer-events: none; }
.viewport .frame i { position: absolute; width: 22%; height: 22%; border: 3.5px solid var(--cyan); filter: drop-shadow(0 0 6px rgba(56,189,248,.6)); }
.viewport .frame i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; border-radius: 5px 0 0 0; }
.viewport .frame i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; border-radius: 0 5px 0 0; }
.viewport .frame i:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; border-radius: 0 0 0 5px; }
.viewport .frame i:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; border-radius: 0 0 5px 0; }
/* moving scan line with a soft glowing trail (used on PC and phone) */
.scanline { position: absolute; left: 3%; right: 3%; top: 3%; height: 22%; pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(56,189,248,.28));
  border-bottom: 2.5px solid #67d4ff; box-shadow: 0 6px 14px -4px rgba(56,189,248,.9);
  animation: scanmove 1.8s ease-in-out infinite alternate; border-radius: 2px; }
@keyframes scanmove { from { top: 2%; } to { top: 76%; } }
.frame.found i { border-color: #22c55e !important; filter: drop-shadow(0 0 8px rgba(34,197,94,.8)) !important; }
.frame.found .scanline { display: none; }
.frame.found::after { content: ""; position: absolute; inset: 0; border-radius: 6px; background: rgba(34,197,94,.12); animation: foundflash .5s ease-out; }
@keyframes foundflash { from { background: rgba(34,197,94,.45); } to { background: rgba(34,197,94,.12); } }
.det-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.viewport .caption { position: absolute; bottom: 9px; left: 0; right: 0; text-align: center; color: #dbe6ff; }
.viewport .caption b { display: block; font-size: 13.5px; color: #fff; }
.viewport .caption span { font-size: 12px; }
.viewport.live .caption { text-shadow: 0 1px 3px rgba(0,0,0,.7); }
.viewport .placeholder-qr { position: relative; width: 22%; opacity: .5; margin-top: -9%; }
.viewport .placeholder-qr path { fill: #8fb4ff; }

.auto-toggle { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); margin-top: 9px; cursor: pointer; }
.auto-toggle input { width: 15px; height: 15px; accent-color: var(--blue); }

/* upload + crop */
.dropzone {
  border: 1.5px dashed #b6c8ec; border-radius: 11px; background: #f7faff; aspect-ratio: 16 / 11;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 14px; cursor: pointer;
}
.dropzone.drag { background: var(--blue-soft); border-color: var(--blue); }
.dropzone svg { width: 36px; height: 36px; color: var(--blue); }
.dropzone b { color: var(--navy); font-size: 14px; }
.dropzone span { color: var(--muted); font-size: 12.5px; }
.crop-wrap { position: relative; border-radius: 11px; overflow: hidden; background: #1a1f29; touch-action: none; user-select: none; }
.crop-wrap canvas { display: block; width: 100%; height: auto; max-height: 420px; object-fit: contain; cursor: crosshair; }
.crop-hint { font-size: 12.5px; color: var(--muted); margin: 7px 0 0; }

/* phone pairing */
.pair-box { text-align: center; }
.pair-box img { image-rendering: pixelated; border: 1px solid var(--line); border-radius: 9px; }
.pair-code-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1.2px; font-weight: 700; }
.pair-code { font-size: 34px; font-weight: 800; letter-spacing: 5px; color: var(--navy); font-variant-numeric: tabular-nums; line-height: 1.1; margin: 2px 0 10px; font-family: Consolas, "Segoe UI", monospace; }
.pair-grid { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; margin-bottom: 10px; }
.pair-grid img { width: 128px !important; height: 128px !important; }
@media (max-width: 480px) { .pair-grid { grid-template-columns: 1fr; justify-items: center; } }
.row-inline { display: flex; gap: 6px; }
.row-inline input { flex: 1; }
.steps { text-align: left; margin: 0; padding-left: 18px; color: var(--ink); font-size: 13px; }
.steps li { margin: 3px 0; }
.steps b.mono { word-break: break-all; }
.cert-tip { text-align: left; background: var(--amber-soft); border: 1px solid var(--amber-line); color: #6b4300; border-radius: 9px; padding: 8px 10px; font-size: 12.5px; margin: 10px 0 0; }

details.manual { margin-top: 10px; }
details.manual summary { cursor: pointer; color: var(--muted); font-size: 12.5px; }
textarea { width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 8px; resize: vertical; min-height: 60px; }
select, input[type=text], input[type=number] { border: 1px solid var(--line); border-radius: 9px; padding: 7px 9px; background: #fff; width: 100%; }
label.f { display: block; font-size: 12px; color: var(--muted); margin: 0 0 4px; }

/* ---------- result ---------- */
.result-empty { border: 1.5px dashed var(--line); border-radius: 12px; padding: 34px 18px; text-align: center; color: var(--muted); }
.result-empty svg { width: 46px; height: 46px; color: #b4c2dc; }
.verdict { display: flex; align-items: center; gap: 16px; border-radius: 12px; padding: 14px 18px; border: 1px solid; }
.verdict .vicon { width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: none; color: #fff; }
.verdict .vicon svg { width: 28px; height: 28px; }
.verdict h3 { margin: 0; font-size: clamp(18px, 1.8vw, 23px); font-weight: 800; line-height: 1.2; }
.verdict p { margin: 2px 0 0; font-size: 14px; color: var(--ink); }
.sync-box { border: 1px solid var(--line, #dbe4f4); border-radius: 12px; padding: 14px 16px; margin: 4px 0 14px; background: #f8fafd; }
.sync-box h4 { margin: 0 0 6px; font-size: 15px; color: var(--navy); }
.sync-box p { margin: 6px 0; font-size: 13px; }
.sync-grid { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-start; }
.sync-grid img { width: 170px; height: 170px; image-rendering: pixelated; border: 1px solid #e1e7f1; border-radius: 8px; background: #fff; }
.sync-code { font-family: Consolas, monospace; font-size: 15px; font-weight: 700; letter-spacing: 1px; background: #fff; border: 1px dashed #b8c4da; border-radius: 8px; padding: 6px 10px; display: inline-block; word-break: break-all; }
.sync-warn { color: #9a5b00; font-size: 12.5px; }
.sync-box .row-inline { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.sync-box input { flex: 1; min-width: 220px; }
.pill-status .pl-short { display: none; }
#serverPill.net-off { background: #eef1f6; color: #5d6883; border-color: #d5dbe6; }
.fig-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.fig-card { margin: 0; border: 1px solid var(--line, #dbe4f4); border-radius: 12px; overflow: hidden; background: #fff; display: flex; flex-direction: column; }
.fig-card a { display: block; background: #fff; padding: 10px; border-bottom: 1px solid var(--line, #dbe4f4); }
.fig-card img { width: 100%; height: 210px; object-fit: contain; display: block; }
.fig-card figcaption { padding: 10px 12px 12px; font-size: 12.5px; line-height: 1.45; color: var(--ink, #1c2540); }
.fig-card figcaption b { display: block; font-size: 13.5px; color: var(--navy); margin-bottom: 3px; }
.fig-card figcaption span { color: var(--muted, #5d6883); }
@media (max-width: 640px) { .fig-grid { grid-template-columns: 1fr; } .fig-card img { height: auto; max-height: 260px; } }
.fig-box { position: fixed; inset: 0; z-index: 100; background: rgba(8,15,38,.82); display: flex; align-items: center; justify-content: center; padding: 18px; }
.fig-box.hidden { display: none; }
.fig-box-inner { position: relative; background: #fff; border-radius: 14px; max-width: min(1100px, 100%); max-height: 100%; width: 100%;
                 display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.fig-box img { width: 100%; max-height: calc(100vh - 210px); object-fit: contain; background: #fff; padding: 14px 48px 6px; box-sizing: border-box; }
.fig-cap { padding: 10px 18px 14px; border-top: 1px solid var(--line, #dbe4f4); font-size: 13.5px; line-height: 1.5; color: var(--muted, #5d6883); }
.fig-cap b { display: block; color: var(--navy); font-size: 15px; margin-bottom: 2px; }
.fig-cap small { display: block; margin-top: 4px; color: #8a94a8; }
.fig-x { position: absolute; top: 8px; right: 8px; z-index: 2; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line, #dbe4f4);
         background: #fff; font-size: 18px; cursor: pointer; color: var(--navy); }
.fig-nav { position: absolute; top: 40%; z-index: 2; width: 40px; height: 56px; border: 0; border-radius: 10px; background: rgba(13,27,69,.08);
           font-size: 30px; line-height: 1; cursor: pointer; color: var(--navy); }
.fig-nav.prev { left: 6px; } .fig-nav.next { right: 6px; }
.fig-nav:hover, .fig-x:hover { background: var(--blue-soft, #e8f0fe); }
@media (max-width: 640px) {
  .fig-box { padding: 8px; align-items: center; }
  .fig-box img { padding: 46px 8px 4px; max-height: calc(100vh - 230px); }
  .fig-nav { top: auto; bottom: 10px; width: 46px; height: 40px; font-size: 26px; background: rgba(13,27,69,.06); }
  .fig-cap { padding: 10px 14px 58px; font-size: 13px; }
}
.mode-badge { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 8px 0 0; font-size: 12.5px; color: var(--muted, #5d6883); }
.mode-badge b { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-weight: 700; }
.mode-badge b::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.mode-badge.on b { background: #e7f6ed; color: #0f7a46; } .mode-badge.off b { background: #eef1f6; color: #5d6883; }
.verdict .stamp { margin-left: auto; padding: 6px 16px; border-radius: 999px; color: #fff; font-weight: 800; font-size: 14px; letter-spacing: 1px; flex: none; }
.verdict.genuine { background: var(--green-soft); border-color: var(--green-line); }
.verdict.genuine h3 { color: var(--green); } .verdict.genuine .vicon, .verdict.genuine .stamp { background: var(--green); }
.verdict.fake { background: var(--red-soft); border-color: var(--red-line); }
.verdict.fake h3 { color: var(--red); } .verdict.fake .vicon, .verdict.fake .stamp { background: var(--red); }
.verdict.unsigned { background: var(--amber-soft); border-color: var(--amber-line); }
.verdict.unsigned h3 { color: var(--amber); } .verdict.unsigned .vicon, .verdict.unsigned .stamp { background: #d48700; }
.verdict.suspicious { background: #fff1ec; border-color: #f5c3ad; }
.verdict.suspicious h3 { color: #c2410c; } .verdict.suspicious .vicon, .verdict.suspicious .stamp { background: #ea580c; }
.payee { margin-top: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; background: #fbfcfe; }
.payee-label { font-size: 10.5px; font-weight: 800; letter-spacing: 1.4px; color: var(--muted); }
.payee-name { font-size: 22px; font-weight: 800; color: var(--navy); line-height: 1.2; word-break: break-word; }
.payee-sub { font-size: 13px; color: var(--ink); margin-top: 2px; }
.payee-sub b { font-family: Consolas, monospace; font-size: 14px; }
.payee p { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); }
.payee p.bad-text { color: var(--red); font-size: 13px; }          /* Fake / blocked QR: "Do not pay" */
.payee-amount { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: var(--amber-soft); border: 1px solid var(--amber-line); color: #6b4300; font-size: 13px; }
.payee-amount b { font-size: 20px; color: #7a3d00; }
.ask-owner { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.ask-owner label { display: block; font-size: 12.5px; color: var(--ink); margin-bottom: 6px; }
.ask-owner input { max-width: 140px; font-family: Consolas, monospace; font-size: 16px; letter-spacing: 3px; }
.mem-box { margin-top: 8px; border-radius: 10px; padding: 9px 12px; font-size: 13px; border: 1px solid var(--line); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.mem-box .btn { padding: 5px 10px; font-size: 12.5px; }
.mem-box > svg { width: 18px; height: 18px; flex: none; }
.mem-box > span { flex: 1; min-width: 200px; }
.mem-box.same { background: var(--green-soft); border-color: var(--green-line); color: #0b5c35; }
.mem-box.changed { background: var(--red-soft); border-color: var(--red-line); color: #8f1d1d; }
.mem-box.new { background: var(--blue-soft); border-color: #c3d5f6; color: var(--navy); }
.mem-box.info { background: var(--gray-soft); color: var(--ink); }
.ml-box { margin-top: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; font-size: 13px; background: #fbfcfe; }
.ml-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ml-head b { color: var(--navy); }
.ml-level { font-weight: 800; }
.ml-box.low .ml-level { color: var(--green); } .ml-box.medium .ml-level { color: var(--amber); } .ml-box.high .ml-level { color: var(--red); }
.ml-bar { height: 7px; background: var(--gray-soft); border-radius: 99px; margin: 7px 0; overflow: hidden; }
.ml-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #22c55e, #f59e0b 45%, #ef4444); }
.ml-why ul { list-style: none; margin: 3px 0 0; padding: 0; }
.ml-why li { padding: 2px 0; } .ml-why li span { display: inline-block; width: 16px; font-size: 10px; }
.ml-why li.fake span { color: var(--red); } .ml-why li.genuine span { color: var(--green); }
.ml-box p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.ml-box.na .ml-level, .ml-box.none .ml-level { color: var(--muted); }
.rk-list { margin-top: 6px; } .rk-list summary { cursor: pointer; color: var(--navy); font-weight: 600; font-size: 12.5px; }
.rk-list ul { list-style: none; margin: 4px 0 0; padding: 0; }
.rk-list li { padding: 2px 0; font-size: 12.5px; } .rk-list li span { display: inline-block; width: 16px; font-size: 11px; font-weight: 800; }
.rk-list li.ok span { color: var(--green); } .rk-list li.info span { color: var(--muted, #6b7280); } .rk-list li.medium span { color: var(--amber); } .rk-list li.high span { color: var(--red); }
.checks li .mark.info { color: var(--muted); font-style: italic; }
.ml-sub { margin-top: 10px; padding-top: 9px; border-top: 1px dashed var(--line); }
.ml-sub.low .ml-level { color: var(--green); } .ml-sub.medium .ml-level { color: var(--amber); } .ml-sub.high .ml-level { color: var(--red); }
.rk-meter { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 7px 0; }
.rk-meter i { display: block; height: 7px; border-radius: 99px; background: var(--gray-soft); }
.rk-meter i.low.on { background: #22c55e; } .rk-meter i.medium.on { background: #f59e0b; } .rk-meter i.high.on { background: #ef4444; }
.rule-box { margin-top: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; font-size: 13px; background: #fbfcfe; }
.rule-box b { color: var(--navy); }
.rule-box p { margin: 4px 0 0; color: var(--muted); }
.rule-box ul { list-style: none; margin: 6px 0 0; padding: 0; }
.rule-box li { display: flex; gap: 8px; align-items: baseline; padding: 3px 0; }
.rule-box li span { font-size: 10.5px; font-weight: 800; text-transform: uppercase; padding: 1px 7px; border-radius: 5px; flex: none; }
.rule-box li.high span { background: var(--red-soft); color: var(--red); }
.rule-box li.medium span { background: var(--amber-soft); color: var(--amber); }
.verdict.not_payment { background: var(--gray-soft); border-color: var(--line); }
.verdict.not_payment h3 { color: var(--navy); } .verdict.not_payment .vicon, .verdict.not_payment .stamp { background: #74809a; }
@media (max-width: 560px) { .verdict { flex-wrap: wrap; } .verdict .stamp { margin-left: 0; } }

.info-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin-top: 12px; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; }
.info-grid > div { border-left: 1px solid var(--line); padding-left: 20px; }
.info-grid > div:first-child { border-left: 0; padding-left: 0; }
@media (max-width: 600px) { .info-grid { grid-template-columns: 1fr; } .info-grid > div { border-left: 0; padding-left: 0; } }
.kv { display: grid; grid-template-columns: 112px 1fr; gap: 3px 8px; margin: 0; font-size: 13.5px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; color: var(--navy); font-weight: 600; word-break: break-word; }
.ok-text { color: var(--green); font-weight: 600; } .bad-text { color: var(--red); font-weight: 600; } .warn-text { color: var(--amber); font-weight: 600; }
.ok-text svg, .bad-text svg, .warn-text svg { width: 15px; height: 15px; vertical-align: -3px; margin-right: 3px; }

details.tech { margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafe; }
details.tech summary { list-style: none; cursor: pointer; padding: 9px; text-align: center; font-weight: 600; color: var(--navy); font-size: 13px; }
details.tech summary::-webkit-details-marker { display: none; }
details.tech summary::before { content: "⌄"; margin-right: 8px; display: inline-block; transition: transform .15s; }
details.tech[open] summary::before { transform: rotate(180deg); }
.tech-body { padding: 0 14px 12px; }
.checks { list-style: none; margin: 0 0 10px; padding: 0; }
.checks li { display: flex; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.checks li .mark { width: 16px; flex: none; font-weight: 800; }
.checks li .mark.ok { color: var(--green); } .checks li .mark.no { color: var(--red); }
.checks li small { color: var(--muted); margin-left: auto; text-align: right; }
.raw { background: #fff; border: 1px solid var(--line); border-radius: 7px; padding: 8px; word-break: break-all; max-height: 130px; overflow: auto; }

/* ---------- stats / charts ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 600px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { border-radius: 10px; padding: 10px 6px; text-align: center; background: #f2f6fd; }
.stat svg { width: 19px; height: 19px; }
.stat small { display: block; font-size: 11.5px; margin-top: 3px; color: var(--ink); }
.stat b { display: block; font-size: 19px; color: var(--navy); line-height: 1.25; }
.stat em { font-style: normal; font-size: 11px; color: var(--muted); }
.stat.g { background: var(--green-soft); } .stat.g svg, .stat.g b { color: var(--green); }
.stat.r { background: var(--red-soft); } .stat.r svg, .stat.r b, .stat.r small { color: var(--red); }
.stat.b svg { color: var(--blue); }
.stat.y svg { color: #d99a00; }
.chart { width: 100%; }
.chart text { font-size: 10.5px; fill: var(--muted); }
.chart .lbl { fill: var(--navy); font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* quantum-safe card: dark security panel */
.qs-card { position: relative; overflow: hidden; color: #e6edff; border: 0;
  background: radial-gradient(circle at 85% 85%, rgba(56,189,248,.22), transparent 55%), linear-gradient(150deg, #0b1838, #142d6b); }
.qs-card .map { position: absolute; right: 6px; bottom: 6px; height: 88%; width: auto; opacity: .22; filter: brightness(1.6) saturate(.6); pointer-events: none; }
.qs-card > *:not(.map) { position: relative; z-index: 1; }
.qs-card .qs-head { display: flex; align-items: center; gap: 10px; }
.qs-card .qs-head svg { width: 34px; height: 34px; color: var(--cyan); filter: drop-shadow(0 0 8px rgba(56,189,248,.55)); }
.qs-card h3 { margin: 0; font-size: 15.5px; color: #fff; }
.qs-card p { margin: 10px 0 10px; font-size: 13px; color: #c9d6f5; text-align: justify; hyphens: auto; }
.qs-list { list-style: none; margin: 0; padding: 0; font-size: 12.5px; }
.qs-list li { display: flex; gap: 7px; align-items: center; padding: 3px 0; color: #e3ebff; }
.qs-list svg { width: 14px; height: 14px; color: #4ade80; flex: none; }

table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { padding: 6px 9px; border-bottom: 1px solid var(--line); text-align: left; }
table.data th { color: var(--muted); font-weight: 600; background: #f8fafd; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }
.cell-ok { color: var(--green); font-weight: 600; } .cell-mid { color: var(--amber); font-weight: 600; } .cell-bad { color: var(--red); font-weight: 600; }

/* ---------- lab ---------- */
.lab-qr { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
@media (max-width: 640px) { .lab-qr { grid-template-columns: 1fr; } }
.lab-qr figure { margin: 0; border: 1px solid var(--line); border-radius: 10px; padding: 10px; text-align: center; }
.lab-qr figure img { width: 100%; max-width: 220px; image-rendering: pixelated; }
.lab-qr figcaption { font-size: 12px; color: var(--muted); }
.mini-kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 12.5px; margin-top: 8px; text-align: left; }
.mini-kv dt { color: var(--muted); } .mini-kv dd { margin: 0; font-weight: 600; color: var(--navy); }
.mini-kv dd.bad-text { color: var(--red); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
#calBox { height: 54mm; background: repeating-linear-gradient(45deg, #e8eefb, #e8eefb 8px, #dbe5f8 8px, #dbe5f8 16px); border: 2px solid var(--blue); border-radius: 8px; margin: 8px 0; max-width: 100%; }
input[type=range] { width: 100%; }

#stOverlay { position: fixed; inset: 0; z-index: 100; background: #fff; display: flex; flex-direction: column; }
#stTop { display: flex; justify-content: space-between; align-items: center; padding: 8px 14px; border-bottom: 1px solid var(--line); }
#stStage { flex: 1; display: flex; align-items: center; justify-content: center; }
#stImg { display: block; image-rendering: pixelated; }
#stBottom { display: flex; justify-content: center; gap: 12px; padding: 12px; border-top: 1px solid var(--line); }
#stBottom .btn { min-width: 150px; }

/* ---------- docs ---------- */
.doc h3 { color: var(--navy); margin: 16px 0 5px; font-size: 15px; }
.doc p, .doc li { color: var(--ink); text-align: justify; hyphens: auto; }
.doc code { background: var(--gray-soft); padding: 1px 5px; border-radius: 5px; }
.flow { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin: 8px 0; }
.flow div { background: var(--blue-soft); border-radius: 10px; padding: 11px; font-size: 13px; text-align: justify; hyphens: auto; }
.flow b { display: block; color: var(--blue); margin-bottom: 3px; }
.fmt { display: flex; flex-wrap: wrap; gap: 3px; margin: 8px 0; font-family: Consolas, monospace; font-size: 12px; }
.fmt span { padding: 5px 8px; border-radius: 6px; }

/* ---------- footer ---------- */
footer.bottom { background: var(--navy); color: #c9d6f5; margin-top: 10px; }
.foot-inner { max-width: 1200px; margin: 0 auto; padding: 11px 18px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 13px; }
.foot-inner .fb { display: flex; align-items: center; gap: 8px; font-weight: 800; color: #fff; font-size: 15px; }
.foot-inner .fb svg { width: 24px; height: 24px; color: var(--cyan); }
.foot-inner .tagline { border-left: 1px solid rgba(255,255,255,.2); padding-left: 14px; }
.foot-inner .right { margin-left: auto; color: #fff; font-style: italic; font-weight: 600; display: flex; align-items: center; gap: 8px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 9px 16px; border-radius: 9px; z-index: 200; font-size: 13px; box-shadow: var(--shadow); }
.spinner { width: 16px; height: 16px; border: 2.5px solid #c9d7f3; border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 760px) {
  .top-inner { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  .brand { border-right: 0; padding-right: 0; }
  nav.tabs { order: 3; flex-basis: 100%; }
  nav.tabs button.active::after { display: none; }
  .pill-status { margin-left: auto; }
  main { padding: 12px 12px 20px; }
  .card { padding: 13px; }
}

/* ======================= phone layout (chosen automatically by screen width) ======================= */
@media (max-width: 640px) {
  html, body { overflow-x: clip; }                                /* nothing may push the page sideways (clip keeps the top bar pinned) */
  body { padding-bottom: 64px; }                                   /* room for the bottom tab bar */
  header.top { backdrop-filter: none; -webkit-backdrop-filter: none; }   /* a blurred header would hold the fixed tab bar */
  .top-inner { flex-wrap: nowrap; gap: 8px; padding: 7px 12px; }
  .brand svg { width: 28px; height: 28px; }
  .brand b { font-size: 17px; }
  .brand small { display: none; }
  .lang-switch { margin-left: auto; }
  .pill-status { margin-left: 0; padding: 4px 9px 4px 6px; font-size: 11.5px; }
  .pill-status .pl-long { display: none; }                        /* phones: the short word, "Online" / "Offline" */
  .pill-status .pl-short { display: inline; }
  /* tabs become an app-style bar at the bottom of the screen */
  nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; flex-basis: auto; order: 0;
             display: grid; grid-template-columns: repeat(6, 1fr); gap: 0; padding: 4px 2px calc(4px + env(safe-area-inset-bottom));
             background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -4px 14px rgba(13,27,69,.07); }  /* solid: nothing shows through */
  nav.tabs button { flex-direction: column; gap: 2px; padding: 6px 1px; font-size: 10px; letter-spacing: -.1px; border-radius: 10px; min-width: 0; }
  nav.tabs button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  html.public nav.tabs { grid-template-columns: repeat(4, 1fr); }  /* public app: 4 tabs */
  nav.tabs .t-long { display: none; }                               /* phones: the short tab name ("Docs") */
  nav.tabs .t-short { display: inline; }
  nav.tabs button svg { width: 20px; height: 20px; }
  .hero { padding: 18px 14px 16px; }
  .hero h1 { font-size: 22px; }
  .hero p { font-size: 12.5px; }
  main { padding: 10px 10px 18px; }
  .card { padding: 12px; border-radius: 14px; }
  /* card titles on their own line, buttons in an even row below */
  .card-head { flex-wrap: wrap; row-gap: 8px; }
  .card-head .right { margin-left: 0; width: 100%; display: flex; flex-wrap: wrap; gap: 6px; }
  .card-head .right .btn { flex: 1 1 auto; justify-content: center; }
  .btn { min-height: 38px; }
  /* tables turn into small cards: one card per row, each value with its column name */
  table.data.cards, table.data.cards tbody, table.data.cards tr, table.data.cards td { display: block; width: 100%; }
  table.data.cards tr:first-child { display: none; }               /* column headings */
  table.data.cards tr { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin: 0 0 8px; background: #fff; }
  table.data.cards td { border: 0; padding: 3px 0; text-align: left; display: flex; justify-content: space-between; gap: 12px; }
  table.data.cards td[data-label]::before { content: attr(data-label); color: var(--muted); font-weight: 400; flex: none;
                                            font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; }
  table.data.cards td.card-title::before { content: none; }
  table.data.cards td[data-label="#"] { display: none; }
  table.data.cards td.card-title { font-size: 15px; padding-bottom: 5px; display: block; }
  table.data.cards td.card-act { justify-content: flex-end; padding-top: 6px; }
  table.data.cards td.num { text-align: left; }
  .sync-grid { justify-content: center; }
  .sync-grid img { width: 200px; height: 200px; }
  .sync-code { font-size: 14px; }
  .toast { bottom: 84px; max-width: calc(100% - 28px); text-align: center; }
  .verdict h3 { font-size: 19px; }
  .foot-inner { flex-wrap: wrap; gap: 6px; justify-content: center; text-align: center; }
  .foot-inner .right { margin-left: 0; }
}

/* phones: the How-it-works steps one per row, so justified text has no wide gaps */
@media (max-width: 640px) { .flow { grid-template-columns: 1fr; } .flow b { text-align: left; } }

/* phone app (PWA): parts that only work with the PC server are hidden */
.pwa .pc-only { display: none !important; }
.pwa-only { display: none !important; }                 /* text only for the phone app (PWA) */
.pwa-install { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px;
  border-color: #c3d5f6; background: var(--blue-soft); }
.pwa-install p { margin: 2px 0 0; font-size: 13px; color: var(--muted, #5d6883); }
.pwa-install-btns { display: flex; gap: 8px; flex-shrink: 0; }
.pwa-install.ok { border-color: #b7e0c4; background: #ecf8f0; }          /* "Installed" card: green, calm */
.pwa-install.ok b { color: #17663a; }
.pwa-install.mini { padding: 9px 14px; flex-direction: row !important; align-items: center !important; }   /* after "Not now": one slim line */
.pwa-install.mini b { font-size: 14px; }
.pwa-install.mini .pwa-install-btns .btn { flex: none; padding: 6px 16px; }
.pwa-about-btns { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
@media (max-width: 600px) { .pwa-install { flex-direction: column; align-items: stretch; } .pwa-install-btns .btn { flex: 1; } }
.pwa .pwa-only { display: revert !important; }
.pwa .segmented#modeSeg { grid-template-columns: 1fr 1fr; }
