/* BingoLark UI */
:root {
  --ink: #1b1f24;
  --muted: #5b6470;
  --line: #e3e7ec;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --accent: #2563eb;
  --accent-ink: #ffffff;
  --accent-soft: #e8efff;
  --pro: #b45309;
  --pro-soft: #fff4e5;
  --ok: #15803d;
  --warn: #b45309;
  --err: #b91c1c;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.1);
  font-family: "Segoe UI", system-ui, -apple-system, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); line-height: 1.5; font-size: 15px; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.4em; }
h1 { font-size: 2rem; letter-spacing: -0.01em; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header */
.site-header { background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 58px; gap: 16px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 800; font-size: 1.15rem; letter-spacing: -0.01em; }
.logo svg { width: 28px; height: 28px; }
.nav { display: flex; gap: 6px; align-items: center; }
.nav a { text-decoration: none; color: var(--muted); padding: 8px 10px; border-radius: 8px; font-weight: 500; }
.nav a:hover { background: var(--bg); color: var(--ink); }
.nav a.pro-link { color: var(--pro); font-weight: 700; }
.pro-badge { display: inline-block; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.04em; color: var(--pro); background: var(--pro-soft); border: 1px solid #fcd9a8; padding: 1px 6px; border-radius: 999px; vertical-align: middle; }

/* Hero */
.hero { padding: 36px 0 10px; }
.hero h1 { font-size: clamp(1.7rem, 3.5vw, 2.5rem); max-width: 22ch; }
.hero p.lede { font-size: 1.1rem; color: var(--muted); max-width: 62ch; }
.hero .trust { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--muted); font-size: 0.9rem; margin-top: 4px; }
.hero .trust span::before { content: "\2713"; color: var(--ok); margin-right: 6px; font-weight: 700; }

/* App layout */
.app { display: grid; grid-template-columns: 400px minmax(0, 1fr); gap: 20px; align-items: start; padding: 18px 0 40px; }
.controls { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); position: sticky; top: 72px; max-height: calc(100vh - 90px); overflow: auto; }
.controls fieldset { border: 0; border-top: 1px solid var(--line); margin: 0; padding: 14px 16px 16px; min-width: 0; }
.controls fieldset:first-child { border-top: 0; }
.controls legend { font-weight: 700; font-size: 0.95rem; padding: 0; margin-bottom: 10px; float: left; width: 100%; }
.controls legend + * { clear: both; }
.field { margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }
.field label, .field .lbl { display: block; font-size: 0.86rem; font-weight: 600; color: #30363d; margin-bottom: 4px; }
.field .hint { display: block; font-size: 0.8rem; color: var(--muted); margin-top: 4px; }
input[type="text"], input[type="number"], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1px solid #cfd6de; border-radius: 8px; padding: 8px 10px;
}
input[type="text"]:focus, input[type="number"]:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
textarea { min-height: 170px; resize: vertical; font-family: ui-monospace, Consolas, "Segoe UI Mono", monospace; font-size: 0.9rem; line-height: 1.4; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.seg { display: flex; border: 1px solid #cfd6de; border-radius: 8px; overflow: hidden; }
.seg label { flex: 1; text-align: center; padding: 7px 4px; cursor: pointer; font-weight: 600; font-size: 0.9rem; color: var(--muted); margin: 0; border-left: 1px solid #cfd6de; }
.seg label:first-of-type { border-left: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg input:checked + label, .seg label:has(input:checked) { background: var(--accent-soft); color: var(--accent); }
.seg input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: -2px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; font-weight: 500; margin: 0 0 8px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 700; border-radius: 9px; padding: 10px 14px; border: 1px solid #cfd6de; background: #fff; color: var(--ink); cursor: pointer; text-decoration: none; line-height: 1.2; }
.btn:hover { background: #f3f5f8; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { background: #1d4ed8; }
.btn.pro { background: var(--pro); color: #fff; border-color: var(--pro); }
.btn.pro:hover { background: #92400e; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--accent); }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.sm { padding: 6px 10px; font-size: 0.85rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.actions { display: grid; gap: 8px; }
.actions .row { gap: 8px; }
.notice { border-radius: 8px; padding: 8px 10px; font-size: 0.86rem; margin-top: 10px; border: 1px solid; }
.notice.err { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.notice.warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.notice.ok { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.notice.pro { background: var(--pro-soft); border-color: #fcd9a8; color: #7c2d12; }
.notice a { color: inherit; font-weight: 700; }
.counter { font-size: 0.8rem; color: var(--muted); display: flex; justify-content: space-between; margin-top: 4px; }
.counter b { color: var(--ink); }
.thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.thumb { position: relative; width: 56px; height: 56px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #fff; }
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.thumb button { position: absolute; top: 0; right: 0; width: 18px; height: 18px; border: 0; border-radius: 0 0 0 6px; background: rgba(0,0,0,0.6); color: #fff; font-size: 11px; line-height: 1; cursor: pointer; padding: 0; }
.thumb input { position: absolute; bottom: 0; left: 0; right: 0; font-size: 10px; padding: 1px 3px; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: rgba(255,255,255,0.92); }

/* Preview */
.preview { min-width: 0; }
.preview-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.preview-bar .status { font-size: 0.9rem; color: var(--muted); }
.preview-bar .status b { color: var(--ink); }
.zoom { display: flex; align-items: center; gap: 6px; }
.zoom button { width: 30px; height: 30px; border-radius: 8px; border: 1px solid #cfd6de; background: #fff; cursor: pointer; font-weight: 700; }
#printRoot { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.page-wrap { position: relative; overflow: hidden; }
.page-wrap .page { transform-origin: top left; box-shadow: 0 2px 10px rgba(16, 24, 40, 0.14); }
.page-wrap .page-num { position: absolute; top: 6px; right: 6px; font-size: 0.7rem; color: var(--muted); background: rgba(255,255,255,0.85); padding: 1px 6px; border-radius: 999px; pointer-events: none; }
.more-pages { text-align: center; color: var(--muted); font-size: 0.9rem; padding: 8px; }
.empty { background: var(--panel); border: 1px dashed #cfd6de; border-radius: var(--radius); padding: 40px 20px; text-align: center; color: var(--muted); width: 100%; }

/* Sections */
section.block { padding: 48px 0; border-top: 1px solid var(--line); }
section.block.alt { background: var(--panel); }
.cols3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.step { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.step .n { display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 800; margin-bottom: 8px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.tile { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
.tile:hover { border-color: var(--accent); }
.tile b { display: block; margin-bottom: 2px; }
.tile span { color: var(--muted); font-size: 0.85rem; }
.pricing { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; max-width: 820px; }
.plan { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.plan.pro { border-color: #fcd9a8; background: linear-gradient(180deg, #fffaf3, #fff); }
.plan .price { font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; }
.plan .price small { font-size: 0.9rem; color: var(--muted); font-weight: 500; }
.plan ul { padding-left: 0; list-style: none; margin: 14px 0 18px; }
.plan li { padding: 5px 0 5px 26px; position: relative; }
.plan li::before { content: "\2713"; position: absolute; left: 4px; color: var(--ok); font-weight: 800; }
.plan li.no::before { content: "\2013"; color: #9aa4af; }
.faq details { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; margin-bottom: 8px; }
.faq summary { font-weight: 600; cursor: pointer; }
.faq details p { margin: 10px 0 0; color: #30363d; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 28px 0; color: var(--muted); font-size: 0.9rem; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-footer a { color: var(--muted); margin-right: 14px; }

/* Dialogs */
dialog { border: 0; border-radius: 14px; padding: 0; max-width: 480px; width: calc(100% - 32px); box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
dialog::backdrop { background: rgba(15, 23, 42, 0.5); }
dialog .dlg { padding: 22px; }
dialog h3 { margin-bottom: 6px; }
dialog .dlg-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.key-input { font-family: ui-monospace, Consolas, monospace; letter-spacing: 0.02em; }

/* Template pages */
.article { max-width: 760px; padding: 32px 0 48px; }
.article h1 { margin-bottom: 8px; }
.article .cta { margin: 20px 0; display: flex; gap: 10px; flex-wrap: wrap; }
.wordlist { columns: 3; column-gap: 24px; padding-left: 20px; margin: 0 0 20px; }
.wordlist li { break-inside: avoid; }
.sample { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; justify-content: center; margin: 18px 0; overflow: hidden; }
.sample .card { width: 3.6in; }
.crumbs { font-size: 0.9rem; color: var(--muted); margin-bottom: 10px; }
.crumbs a { color: var(--muted); }

@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .controls { position: static; max-height: none; }
  .cols3 { grid-template-columns: 1fr; }
  .pricing { grid-template-columns: 1fr; }
  .hero { padding-top: 24px; }
  .nav a:not(.pro-link) { display: none; }
  .wordlist { columns: 2; }
}

/* Preview: pages beyond the first few are hidden on screen but still print (print.css shows them). */
.page-wrap.preview-hidden { display: none; }
.page { overflow: hidden; }

/* Spacing between template categories; collapsed extras in the controls */
.article h2 { margin-top: 36px; }
.article h1 + .muted + h2, .article .cta + h2 { margin-top: 28px; }
details.more { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 4px; }
details.more summary { font-size: 0.86rem; color: var(--muted); cursor: pointer; font-weight: 600; }
details.more .hint { margin: 8px 0 10px; }
.empty { color: #7c2d12; background: #fffbeb; border-color: #fde68a; }
