:root {
  --bg: #f6f7f9; --surface: #ffffff; --text: #16181d; --muted: #5b6270; --border: #dfe3ea;
  --accent: #e5484d; --accent-text: #ffffff; --accent-soft: #fdecec; --good: #18794e; --bad: #c62a2f;
  --radius: 12px; --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115; --surface: #181b21; --text: #eceef2; --muted: #9aa3b2; --border: #2a2f39;
    --accent: #ff6369; --accent-text: #16181d; --accent-soft: #2b1a1c; --good: #4cc38a; --bad: #ff8589;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); }
.wrap { max-width: 920px; margin: 0 auto; padding: 0 16px; }

.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.site-header .wrap { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; }
.brand { font-weight: 800; font-size: 1.15rem; color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 8px; margin-right: auto; }
.brand-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--accent-text); font-size: 1rem; }
.site-header nav { display: flex; gap: 14px; flex-wrap: wrap; }
.site-header nav a { color: var(--muted); text-decoration: none; font-size: .92rem; }
.site-header nav a:hover { color: var(--text); }

main { padding-top: 24px; padding-bottom: 48px; min-height: 60vh; }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); line-height: 1.2; margin: 8px 0 8px; letter-spacing: -.01em; }
h2 { font-size: 1.3rem; margin: 36px 0 12px; }
h3 { font-size: 1.05rem; margin: 24px 0 8px; }
.lead { color: var(--muted); font-size: 1.05rem; margin: 0 0 20px; }
.crumbs { font-size: .88rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.hero { padding: 24px 0 8px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.card { display: flex; flex-direction: column; gap: 4px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card-icon { font-size: 1.6rem; }
.card-title { font-weight: 700; }
.card-desc { color: var(--muted); font-size: .92rem; }

.tool { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin: 8px 0 8px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .label { font-size: .88rem; font-weight: 600; }
.field small { color: var(--muted); font-size: .8rem; }
input, select, button { font: inherit; color: inherit; }
input[type="text"], input[type="number"], select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg);
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-text); font-weight: 700; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.small { padding: 6px 10px; font-size: .88rem; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

.result { margin-top: 18px; padding: 16px; border-radius: 10px; background: var(--accent-soft); border: 1px solid var(--border); }
.result[hidden] { display: none; }
.result .big { font-size: 1.5rem; font-weight: 800; line-height: 1.25; }
.result p { margin: 4px 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 12px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.stat .k { font-size: .8rem; color: var(--muted); }
.stat .v { font-size: 1.15rem; font-weight: 700; }
.good { color: var(--good); } .bad { color: var(--bad); }
.muted { color: var(--muted); }

.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
th { font-size: .82rem; color: var(--muted); font-weight: 600; }
tr.hl td { background: var(--accent-soft); font-weight: 700; }

.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 8px; }
.faq summary { font-weight: 600; cursor: pointer; }
.faq details p { margin: 8px 0 0; color: var(--muted); }
.prose p, .prose li, article > p, article > ul li, article > ol li { max-width: 70ch; }
.note { font-size: .88rem; color: var(--muted); border-left: 3px solid var(--border); padding-left: 12px; margin: 16px 0; }

.aff { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin: 24px 0; }
.aff h2 { margin: 0 0 6px; font-size: 1.1rem; }
.aff p { margin: 6px 0; }
.aff ul { margin: 8px 0; padding-left: 20px; }
.aff li { margin: 6px 0; }
.aff .note { margin-bottom: 0; }

.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 20px 0; font-size: .9rem; color: var(--muted); }
.site-footer p { margin: 4px 0; }
.site-footer a { color: var(--muted); }

/* Teste de CPS */
.click-area { display: grid; place-items: center; min-height: 220px; border: 2px dashed var(--border); border-radius: var(--radius); background: var(--bg); cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: manipulation; text-align: center; padding: 16px; font-weight: 700; font-size: 1.1rem; width: 100%; }
.click-area.running { border-color: var(--accent); border-style: solid; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg); cursor: pointer; font-size: .9rem; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 700; }

/* Teste de teclado */
.kb { display: flex; flex-direction: column; gap: 6px; overflow-x: auto; padding-bottom: 6px; }
.kb-row { display: flex; gap: 6px; }
.key { flex: 1 0 38px; min-width: 38px; height: 40px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); font-size: .72rem; white-space: nowrap; padding: 0 4px; }
.key.w15 { flex-grow: 1.5; } .key.w2 { flex-grow: 2; } .key.w25 { flex-grow: 2.5; } .key.w6 { flex-grow: 7; }
.key.gap { visibility: hidden; flex: 0 0 14px; min-width: 14px; }
.key.tested { background: var(--accent-soft); border-color: var(--accent); }
.key.down { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

@media (prefers-reduced-motion: reduce) { .card { transition: none; } }
