:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #1b1f24;
  --muted: #5b6470;
  --line: #d9dee5;
  --accent: #1f5fbf;
  --accent-text: #ffffff;
  --danger: #b3261e;
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14181d;
    --surface: #1c2229;
    --text: #e8ecf1;
    --muted: #9aa5b1;
    --line: #2f3944;
    --accent: #5b9bf0;
    --accent-text: #0b1118;
    --danger: #ff8a80;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

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

.top { border-bottom: 1px solid var(--line); background: var(--surface); }
.top .wrap { padding-top: 14px; padding-bottom: 14px; }
.brand { font-weight: 700; color: var(--text); text-decoration: none; letter-spacing: 0.01em; }

main.wrap { padding-top: 28px; padding-bottom: 40px; }
h1 { font-size: 1.65rem; line-height: 1.2; margin: 0 0 12px; }
.lead { font-size: 1.05rem; color: var(--muted); margin: 0 0 24px; }
a { color: var(--accent); }

.card-form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; }
.field input[type="text"],
.field input[type="email"] {
  width: 100%;
  padding: 11px 12px;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.field input:focus-visible,
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.field input[aria-invalid="true"] { border-color: var(--danger); }
.help { margin: 6px 0 0; font-size: 0.9rem; color: var(--muted); }
.help code { font-size: 0.85em; word-break: break-all; }
.error { color: var(--danger); font-size: 0.92rem; margin: 6px 0 0; }
.banner { padding: 10px 12px; border: 1px solid var(--danger); border-radius: 6px; margin-bottom: 16px; }

.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400 !important; }
.check input { margin-top: 4px; width: 18px; height: 18px; flex: none; }

.note { font-size: 0.9rem; color: var(--muted); }

.btn {
  display: inline-block;
  padding: 12px 20px;
  font: inherit;
  font-weight: 600;
  color: var(--accent-text);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  cursor: pointer;
}
.btn.secondary { color: var(--accent); background: transparent; }
.btn:hover { filter: brightness(1.08); }

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 20px 0 8px; }

/* Honeypot: off-screen, not display:none, so simple bots still fill it. */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.card-preview { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; text-align: center; }
.card-canvas { width: 100%; max-width: 420px; height: auto; background: #ffffff; border: 1px solid var(--line); }

.foot { color: var(--muted); font-size: 0.85rem; padding-bottom: 28px; }

.print-only { display: none; }

@media print {
  body { background: #ffffff; }
  .top, main.wrap > *:not(.print-only), .foot { display: none !important; }
  main.wrap { padding: 0; max-width: none; }
  .print-only { display: block !important; width: 80mm; margin: 10mm auto; }
}
