:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f1f4;
  --text: #1a1d21;
  --muted: #6b7280;
  --border: #e3e6ea;
  --accent: #4772fa;
  --accent-contrast: #ffffff;
  --success: #17924b;
  --warn: #b7791f;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.05);
  --wrap: 1080px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1114;
    --surface: #16191d;
    --surface-2: #1d2126;
    --text: #e8eaed;
    --muted: #9aa1ab;
    --border: #262b31;
    --accent: #5b83ff;
    --shadow: 0 1px 3px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.35);
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.accent { color: var(--accent); }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 58px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { color: var(--accent); font-size: 20px; }
.header-nav { display: flex; align-items: center; }
.header-nav > a { margin-left: 20px; color: var(--muted); font-weight: 500; }
.header-nav > a:hover { color: var(--text); text-decoration: none; }
.lang-switch { display: inline-flex; margin-left: 18px; gap: 2px; padding: 2px; border: 1px solid var(--border); border-radius: 999px; }
.lang-opt { padding: 3px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.lang-opt:hover { color: var(--text); text-decoration: none; }
.lang-opt.is-active { background: var(--accent); color: var(--accent-contrast); }

/* Modal do Helper */
body.modal-open { overflow: hidden; }
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.55); backdrop-filter: blur(2px); }
.modal-card {
  position: relative; z-index: 1; width: 100%; max-width: 640px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow); padding: 26px 26px 22px;
  max-height: calc(100vh - 40px); overflow-y: auto; overflow-x: hidden;
}
.modal-x {
  position: absolute; top: 12px; right: 14px; width: 30px; height: 30px;
  border: none; background: transparent; color: var(--muted);
  font-size: 24px; line-height: 1; cursor: pointer; border-radius: 8px;
}
.modal-x:hover { background: var(--surface-2); color: var(--text); }
.modal-card h2 { margin: 0 0 8px; font-size: 20px; }
.modal-lead { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.steps { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.steps li { display: grid; grid-template-columns: 26px 1fr; gap: 12px; align-items: start; }
.step-n {
  width: 26px; height: 26px; border-radius: 999px;
  background: var(--accent); color: var(--accent-contrast);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}
.step-body { font-size: 14px; line-height: 1.5; padding-top: 2px; min-width: 0; }
.cmd-row { display: flex; gap: 8px; align-items: stretch; margin-top: 8px; }
.cmd-row code {
  flex: 1; min-width: 0; padding: 9px 11px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  font-size: 12px; line-height: 1.5;
  white-space: pre-wrap; word-break: break-all; overflow-wrap: anywhere;
}
.cmd-row .btn-sm { flex: none; }
kbd {
  font: inherit; font-size: 12px; padding: 1px 6px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.modal-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* Hero */
.hero { padding: 44px 0 28px; }
.hero h1 { font-size: 34px; line-height: 1.15; margin: 0 0 10px; letter-spacing: -.02em; }
.hero-sub { font-size: 17px; color: var(--muted); margin: 0; max-width: 620px; }

/* Toolbar (busca + filtros) */
.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  padding: 4px 0 22px;
}
.search { flex: 1 1 240px; min-width: 200px; }
.search input {
  width: 100%; font: inherit; font-size: 14.5px;
  padding: 10px 14px; border-radius: 10px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); outline: none;
}
.search input:focus { border-color: var(--accent); }
.filter-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.pill {
  font: inherit; font-size: 13px; font-weight: 500;
  padding: 7px 13px; border-radius: 999px; cursor: pointer;
  background: var(--surface); color: var(--muted);
  border: 1px solid var(--border); transition: all .12s ease;
}
.pill:hover { color: var(--text); }
.pill.is-active {
  background: var(--accent); color: var(--accent-contrast);
  border-color: var(--accent);
}

/* Grid */
.grid {
  display: grid; gap: 18px; padding-bottom: 48px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.card[hidden] { display: none; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; transition: transform .12s ease, box-shadow .12s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.card-media {
  display: flex; align-items: center; justify-content: center;
  aspect-ratio: 16/9; background: var(--surface-2); overflow: hidden;
}
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-media-fallback { font-size: 44px; color: var(--muted); }
.card-body { padding: 14px 15px 15px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-title { font-size: 16px; margin: 0; }
.card-title a { color: var(--text); }
.card-author { font-size: 12.5px; color: var(--muted); margin: 0; }
.card-desc { font-size: 13.5px; color: var(--text); margin: 0; flex: 1; }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.card-actions { display: flex; align-items: center; gap: 10px; margin-top: 4px; }

/* Chips & badges */
.chip {
  font-size: 11.5px; padding: 2px 8px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
}
.chip-device { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.chip-muted { opacity: .8; }
.badge {
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn);
}

/* Buttons */
.btn {
  font: inherit; font-weight: 600; font-size: 13.5px;
  padding: 8px 16px; border-radius: 10px; border: 1px solid transparent;
  background: var(--accent); color: var(--accent-contrast); cursor: pointer;
  transition: filter .12s ease, opacity .12s ease;
}
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-lg { padding: 11px 22px; font-size: 15px; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-installed { background: var(--success); }
.install-status { font-size: 12.5px; color: var(--muted); }

/* Detail */
.detail { padding: 32px 0 56px; }
.detail-head { display: grid; grid-template-columns: 72px 1fr auto; gap: 18px; align-items: start; }
.detail-icon { width: 72px; height: 72px; border-radius: 16px; border: 1px solid var(--border); }
.detail-head-text h1 { margin: 0 0 4px; font-size: 26px; letter-spacing: -.01em; }
.detail-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.shots { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(280px, 60%);
  gap: 14px; overflow-x: auto; padding: 26px 0 6px; scroll-snap-type: x mandatory; }
.shots img { width: 100%; border-radius: 12px; border: 1px solid var(--border); scroll-snap-align: start; }
.detail-cols { display: grid; grid-template-columns: 1fr 260px; gap: 36px; margin-top: 26px; }
.detail-main h2 { font-size: 18px; margin: 26px 0 10px; }
.detail-main h2:first-child { margin-top: 0; }
.longdesc { color: var(--text); }
.changelog {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px; font-size: 13px; line-height: 1.5; overflow-x: auto; white-space: pre-wrap;
}
.detail-side { }
.detail-side h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 10px; }
.detail-side dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 13.5px; }
.detail-side dt { color: var(--muted); }
.detail-side dd { margin: 0; text-align: right; }

/* Publicar (stepper) */
.publish { max-width: 720px; padding: 32px 0 56px; }
.publish-hero { margin-bottom: 32px; }
.publish-hero h1 { font-size: 30px; margin: 0 0 10px; letter-spacing: -.02em; }
.publish-hero p { font-size: 16px; color: var(--muted); margin: 0; }
.publish-hero code, .pub-content code {
  background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-size: .88em;
}
.pub-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.pub-step {
  display: grid; grid-template-columns: 40px 1fr; gap: 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 20px 22px;
}
.pub-num {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--accent); color: var(--accent-contrast);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700;
}
.pub-content { min-width: 0; }
.pub-content h2 { font-size: 18px; margin: 4px 0 8px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pub-opt {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--border); padding: 2px 8px; border-radius: 999px;
}
.pub-lead { margin: 0 0 12px; font-size: 14.5px; color: var(--text); }
.pub-hint { margin: 12px 0 0; font-size: 13px; color: var(--muted); }
.pub-hint code { font-size: .9em; }
pre.code {
  margin: 0; background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 16px; overflow-x: auto;
  font-size: 12.5px; line-height: 1.65;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
pre.code .code-path { color: var(--accent); font-weight: 600; }
.pub-cta { margin-top: 30px; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }

@media (max-width: 560px) {
  .pub-step { grid-template-columns: 32px 1fr; gap: 12px; padding: 16px; }
  .pub-num { width: 32px; height: 32px; font-size: 15px; border-radius: 10px; }
}

/* Prose (publish page) */
.prose { max-width: 720px; padding: 32px 0 56px; }
.prose h1 { font-size: 28px; }
.prose h2 { font-size: 19px; margin-top: 30px; }
.prose code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-size: 13px; }
.prose pre code, .prose pre { background: transparent; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 26px 0; margin-top: 30px; }
.disclaimer { font-size: 12.5px; color: var(--muted); margin: 0 0 6px; }
.empty { padding: 48px 0; font-size: 16px; color: var(--muted); }

@media (max-width: 720px) {
  .detail-head { grid-template-columns: 56px 1fr; }
  .detail-icon { width: 56px; height: 56px; }
  .detail-actions { grid-column: 1 / -1; flex-direction: row; align-items: center; flex-wrap: wrap; }
  .detail-cols { grid-template-columns: 1fr; gap: 20px; }
}
