/* Baldy Tools — shared styles. No external fonts or assets, on purpose. */
:root {
  --bg: #f5f0e6;
  --panel: #fffdf8;
  --ink: #1d1b18;
  --muted: #6a645a;
  --line: #ddd4c3;
  --accent: #6d3fc4;
  --accent-ink: #ffffff;
  --accent-soft: #ebe3fb;
  --warn: #8a4b00;
  --warn-soft: #fbecd3;
  --bad: #a3271f;
  --radius: 14px;
  --font: ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171613;
    --panel: #211f1b;
    --ink: #f1ece2;
    --muted: #a59d8f;
    --line: #3a362f;
    --accent: #b79cff;
    --accent-ink: #1b0f33;
    --accent-soft: #2f2250;
    --warn: #f0b860;
    --warn-soft: #3a2c14;
    --bad: #ff8d84;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.55 var(--font);
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 18px; }

/* Header */
.top { border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 800; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.brand svg { width: 30px; height: 30px; }
.top nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.top nav a { padding: 6px 11px; border-radius: 999px; text-decoration: none; color: var(--ink); font-size: .95rem; }
.top nav a:hover { background: var(--accent-soft); }
.top nav a[aria-current="page"] { background: var(--ink); color: var(--bg); }

/* Page intro */
.intro { padding: 34px 0 8px; }
.intro p { color: var(--muted); max-width: 60ch; font-size: 1.05rem; }
.badge { display: inline-flex; align-items: center; gap: 7px; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .85rem; padding: 5px 12px; border-radius: 999px; margin-bottom: 14px; }
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

/* Panels */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 18px 0; }
.panel > :last-child { margin-bottom: 0; }
.hidden { display: none !important; }

/* Tabs */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 18px 0 0; }
.tabs button { font: inherit; font-weight: 700; padding: 9px 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* Drop zone */
.drop { display: block; border: 2px dashed var(--line); border-radius: var(--radius); padding: 30px 16px; text-align: center; cursor: pointer; color: var(--muted); transition: border-color .15s, background .15s; }
.drop strong { display: block; color: var(--ink); font-size: 1.1rem; margin-bottom: 2px; }
.drop:hover, .drop.over, .drop:focus-within { border-color: var(--accent); background: var(--accent-soft); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }

/* Controls */
.row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; margin: 16px 0; }
.field { display: flex; flex-direction: column; gap: 5px; flex: 1 1 170px; min-width: 0; }
.field.narrow { flex: 0 1 130px; }
.field > span, .label { font-size: .85rem; font-weight: 700; color: var(--muted); }
input[type=text], input[type=number], input[type=password], input[type=email], input[type=tel], select, textarea {
  font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; width: 100%; min-width: 0;
}
textarea { min-height: 90px; resize: vertical; }
input[type=range] { width: 100%; accent-color: var(--accent); }
input[type=color] { width: 100%; height: 42px; padding: 2px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.check { display: inline-flex; align-items: center; gap: 8px; margin: 4px 16px 4px 0; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.checks { margin: 12px 0; }

button.btn, a.btn { font: inherit; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 20px; border-radius: 999px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); cursor: pointer; text-decoration: none; }
button.btn.ghost, a.btn.ghost { background: transparent; color: var(--accent); }
button.btn.small { padding: 6px 12px; font-size: .88rem; }
button.btn:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 16px; }

/* File lists */
.files { list-style: none; margin: 14px 0 0; padding: 0; }
.files li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.files li:first-child { border-top: 0; }
.files .name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.files .meta { color: var(--muted); font-size: .88rem; white-space: nowrap; }
.files .saved { color: var(--accent); font-weight: 700; }
.files img { width: 46px; height: 46px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); flex: none; }
.files .info { flex: 1 1 auto; min-width: 0; }
.files .info .name { display: block; }
.icon-btn { font: inherit; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer; flex: none; line-height: 1; }
.icon-btn:disabled { opacity: .35; cursor: default; }

/* Messages */
.status { margin-top: 14px; font-weight: 600; min-height: 1.5em; }
.status.error { color: var(--bad); }
.note { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 10px 14px; font-size: .93rem; margin: 14px 0; }
.small { font-size: .9rem; color: var(--muted); }
progress { width: 100%; height: 10px; margin-top: 12px; accent-color: var(--accent); }

/* Password output */
.output { font-family: var(--mono); font-size: clamp(1.05rem, 3.6vw, 1.5rem); background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 18px; word-break: break-all; min-height: 3.4em; user-select: all; }
.meter { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; margin: 12px 0 6px; }
.meter i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.meter i.weak { background: var(--bad); }
.meter i.ok { background: var(--warn); }

/* QR */
.qr-grid { display: grid; grid-template-columns: 1fr 280px; gap: 22px; align-items: start; }
.qr-preview { text-align: center; position: sticky; top: 12px; }
.qr-preview canvas { width: 100%; max-width: 280px; height: auto; border-radius: 10px; border: 1px solid var(--line); image-rendering: pixelated; }
@media (max-width: 700px) { .qr-grid { grid-template-columns: 1fr; } .qr-preview { position: static; } }

/* Home cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; margin: 22px 0; }
.card { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; text-decoration: none; color: var(--ink); transition: transform .12s, border-color .12s; }
.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.card h2 { margin-bottom: .3em; }
.card p { color: var(--muted); margin: 0; font-size: .95rem; }
.card .go { display: inline-block; margin-top: 12px; color: var(--accent); font-weight: 700; }

/* Explainers */
.explain h2 { margin-top: 1.4em; }
.explain h2:first-child { margin-top: 0; }
.explain ul { padding-left: 1.2em; margin: 0 0 1em; }
.explain li { margin-bottom: .35em; }

/* Also by */
.also { margin: 34px auto 18px; }
.also h2 { font-size: 1rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.also-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.also-list a { display: block; background: var(--ink); color: var(--bg); border-radius: var(--radius); padding: 18px 20px; text-decoration: none; }
.also-list a strong { display: block; font-size: 1.1rem; }
.also-list a span { opacity: .8; font-size: .93rem; }
.also-list a em { display: inline-block; margin-top: 8px; font-style: normal; font-weight: 700; color: var(--accent-soft); }
@media (prefers-color-scheme: dark) { .also-list a em { color: var(--accent-soft); } .also-list a { background: var(--accent); color: var(--accent-ink); } }

footer.foot { border-top: 1px solid var(--line); margin-top: 20px; padding: 18px 0 40px; color: var(--muted); font-size: .88rem; }
footer.foot a { color: var(--muted); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Extension popups */
body.popup { width: 380px; font-size: 15px; }
body.popup .wrap { padding: 0 14px; }
body.popup .top .wrap { padding-top: 9px; padding-bottom: 9px; }
body.popup .brand { font-size: 1rem; }
body.popup .brand svg { width: 24px; height: 24px; }
body.popup .top a.open-tab { margin-left: auto; font-size: .85rem; }
body.popup .panel { padding: 14px; margin: 12px 0; }
body.popup .tabs { margin-top: 12px; }
body.popup .tabs button { padding: 6px 14px; }
body.popup .output { font-size: 1.05rem; padding: 12px; }
body.popup .also { margin: 4px auto 12px; }
body.popup .also h2 { font-size: .75rem; margin-bottom: .4em; }
body.popup .also-list a { padding: 10px 14px; }
body.popup .also-list a strong { font-size: 1rem; }
body.popup .also-list a em { margin-top: 2px; }
body.popup .qr-preview { position: static; }
body.popup .qr-preview canvas { max-width: 220px; }
body.popup textarea { min-height: 60px; }
body.popup .choices { display: grid; gap: 8px; }
body.popup .choices .btn { justify-content: flex-start; }
.actions.center { justify-content: center; }
body.popup .also-list a em { display: none; }
body.popup .also-list a span { font-size: .85rem; }
body.popup .qr-preview canvas { max-width: 170px; }
body.popup textarea { min-height: 48px; }
body.popup .output { min-height: 0; }
body.popup button.btn { padding: 8px 16px; }
body.popup .actions { margin-top: 10px; }
body.popup .status { min-height: 0; margin-top: 8px; }
body.popup .row { margin: 10px 0; }
body.popup .checks { margin: 8px 0 0; }
body.popup p { margin-bottom: .5em; }
body.popup .meter { margin: 8px 0 4px; }
body.popup .field { flex-basis: 120px; }
body.popup .check { margin: 2px 12px 2px 0; }
body.popup .tabs { margin-top: 10px; }
body.popup .panel { margin: 10px 0; }
body.popup { font-size: 14px; }
body.popup .panel { padding: 12px; }
body.popup .output { padding: 10px 12px; }
body.popup .qr-preview canvas { max-width: 150px; }
body.popup .also-list { gap: 6px; }
body.popup .also-list a { padding: 8px 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.popup .also-list a strong { display: inline; font-size: .95rem; margin-right: 6px; }
body.popup .also-list a br { display: none; }
