/* screen.cards — stylesheet. System fonts only: the page makes no third-party requests. */
:root {
  color-scheme: light dark;
  --bg: #f6f7fb;
  --fg: #16181d;
  --muted: #5b6270;
  --card: #ffffff;
  --border: #d9dde6;
  --accent: #2457f5;
  --accent-ink: #ffffff;
  --accent-soft: #e8eeff;
  --ok: #1b8f4e;
  --ok-soft: #e6f6ec;
  --warn: #b7791f;
  --warn-soft: #fff6e0;
  --bad: #c62828;
  --bad-soft: #fde8e8;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 8px 24px rgba(16, 24, 40, 0.06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1117;
    --fg: #eef0f5;
    --muted: #9aa3b2;
    --card: #181b23;
    --border: #2b303c;
    --accent: #6d8dff;
    --accent-ink: #0b1020;
    --accent-soft: #1b2340;
    --ok: #4cc77f;
    --ok-soft: #10261a;
    --warn: #e2b04a;
    --warn-soft: #2a2110;
    --bad: #ff6b6b;
    --bad-soft: #2d1414;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; letter-spacing: -0.01em; }
h2 { font-size: 1.4rem; margin-top: 0; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85em; }
pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
}
[hidden] { display: none !important; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* Header / logo */
.site-header { padding: 28px 0 8px; }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.lang { display: inline-flex; align-items: center; gap: 8px; font-size: 0.9rem; color: var(--muted); font-weight: 400; }
.lang select { width: auto; min-height: 36px; padding: 6px 10px; font-size: 0.95rem; }
.logo {
  display: inline-block;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-decoration: none;
  color: var(--fg);
  line-height: 1;
}
.logo .dot { color: var(--accent); }
.logo .cards { font-weight: 400; }
.tagline { color: var(--muted); margin: 10px 0 0; font-size: 1.05rem; }

/* Callouts */
.callout {
  border: 1px solid var(--border);
  border-inline-start: 4px solid var(--accent);
  background: var(--card);
  border-radius: 10px;
  padding: 12px 16px;
  margin: 16px 0;
}
.callout.ok { border-inline-start-color: var(--ok); background: var(--ok-soft); }
.callout.warn { border-inline-start-color: var(--warn); background: var(--warn-soft); }
.callout.bad { border-inline-start-color: var(--bad); background: var(--bad-soft); }
html[dir="rtl"] details.advanced > summary::before { content: "◂"; }
html[dir="rtl"] details.advanced[open] > summary::before { transform: rotate(-90deg); }

/* Terms of Use */
.terms-check { margin: 12px 0 4px; }
.terms-required { color: var(--warn); font-size: 0.9rem; margin: 4px 0 0; }
.terms-dialog {
  width: min(680px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--fg);
  padding: 20px;
  box-shadow: var(--shadow);
}
.terms-dialog::backdrop { background: rgba(10, 12, 20, 0.55); }
.terms-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.terms-head h2 { margin: 0; }
.btn.icon { min-height: 36px; padding: 6px 12px; }
.terms-body {
  max-height: min(55vh, 520px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px 16px;
  margin: 8px 0 14px;
  background: var(--bg);
}
.terms-body h3 { font-size: 1rem; margin: 14px 0 4px; }
.terms-body p { margin: 0 0 8px; }
.terms-foot { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.callout p:last-child { margin-bottom: 0; }

/* Layout */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 32px;
  align-items: stretch;      /* both panels share the row height */
  margin: 24px 0;
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; gap: 20px; }
}

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
/* The panel stretches with the row; its content stays in view while a tall form scrolls. */
.preview-inner { position: sticky; top: 16px; }
.card-form { display: flex; flex-direction: column; }
.card-form .form-actions { margin-top: auto; }
@media (max-width: 900px) { .preview-inner { position: static; } }

/* Form */
fieldset { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
legend { font-weight: 700; padding: 0; margin-bottom: 8px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid .full { grid-column: 1 / -1; }
@media (max-width: 520px) { .grid { grid-template-columns: 1fr; } }
label { display: block; font-size: 0.9rem; font-weight: 600; margin-bottom: 4px; }
label small { font-weight: 400; color: var(--muted); }
input, textarea, select {
  width: 100%;
  font: inherit;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  min-height: 44px;
}
textarea { resize: vertical; min-height: 72px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
details.advanced { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 4px; }
details.advanced > summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; align-items: center; gap: 8px; }
details.advanced > summary::-webkit-details-marker { display: none; }
details.advanced > summary::before { content: "▸"; color: var(--accent); transition: transform 0.15s; }
details.advanced[open] > summary::before { transform: rotate(90deg); }
.form-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-top: 16px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 0.9rem; font-weight: 400; }
.check input { width: auto; min-height: 0; margin: 0; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--fg);
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.btn-row .btn { flex: 1 1 auto; }

/* QR preview — each code is labelled with its purpose */
.code-head { margin-bottom: 10px; }
.code-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}
.code-tag.private { background: var(--warn-soft); color: var(--warn); }
.code-caption { color: var(--muted); font-size: 0.9rem; margin: 6px 0 0; }
.send-option .code-tag { margin-bottom: 8px; }
.qr-panel.transfer { border: 2px dashed var(--warn); }
.qr-panel {
  background: #ffffff;        /* always white: the code must stay high-contrast in dark mode too */
  border-radius: 12px;
  padding: 12px;
  display: flex;
  justify-content: center;
  border: 1px solid var(--border);
}
.qr-panel canvas { display: block; width: 100%; height: auto; max-width: 420px; image-rendering: pixelated; }
.stats { color: var(--muted); font-size: 0.9rem; margin: 12px 0 6px; }
.meter { height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; }
.meter > span { display: block; height: 100%; width: 0; transition: width 0.2s; background: var(--ok); }
.meter.good > span { background: var(--ok); }
.meter.dense > span { background: var(--warn); }
.meter.bad > span { background: var(--bad); }
.meter-label { font-size: 0.9rem; margin: 6px 0 0; }
.meter-label.dense { color: var(--warn); }
.meter-label.bad { color: var(--bad); }
.feedback { font-size: 0.9rem; color: var(--ok); min-height: 1.4em; margin: 0; }

/* Send to phone */
.send-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 760px) { .send-grid { grid-template-columns: 1fr; } }
.send-option .qr-panel { max-width: 320px; margin: 10px 0; }
.send-option .qr-panel canvas { max-width: 300px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stores { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
body[data-platform="other"] .mobile-only { display: none; }
body[data-platform="ios"] .desktop-only, body[data-platform="android"] .desktop-only { display: none; }
.fine-print { color: var(--muted); font-size: 0.9rem; }

/* Steps / FAQ */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding: 0; margin: 0; list-style: none; counter-reset: step; }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; } }
.steps li { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; counter-increment: step; }
.steps li { padding-inline-start: 56px; position: relative; }
.steps li::before {
  content: counter(step);
  position: absolute;
  inset-inline-start: 16px;
  top: 16px;
  display: inline-flex;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  align-items: center;
  justify-content: center;
}
.faq details { border-bottom: 1px solid var(--border); padding: 10px 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin: 8px 0 0; color: var(--muted); }

section { margin: 36px 0; }
footer { color: var(--muted); font-size: 0.85rem; padding: 24px 0 40px; border-top: 1px solid var(--border); margin-top: 40px; }

/* Viewer page */
.viewer { max-width: 520px; margin: 24px auto; }
.viewer .qr-panel canvas { max-width: 480px; }
.viewer .who { text-align: center; margin: 14px 0 4px; }
.viewer .who .name { font-size: 1.3rem; font-weight: 700; }
.viewer .who .sub { color: var(--muted); }
