/* Colinha do Mito — tokens do design system "Campanha 2211" (Claro / Noite) */
:root {
  --surface: #ffffff;
  --surface-alt: #f2f6f0;
  --line: #d6ddd3;
  --line-strong: #6b7285;
  --ink: #13162b;
  --ink-muted: #4a5068;
  --verde: #009f4d;
  --on-verde: #0b0e1f;
  --verde-forte: #007a3b;
  --on-verde-forte: #ffffff;
  --amarelo: #fff200;
  --on-amarelo: #0b0e1f;
  --marinho: #1c2140;
  --on-marinho: #ffffff;
  --sombra: #000000;
  --erro: #b42318;

  --shadow-numeral: 4px 4px 0 #000000;
  --shadow-hard: 4px 4px 0 #13162b;
  --shadow-float: 0 12px 32px -4px #13162b33;
  --focus-ring: 0 0 0 2px #ffffff, 0 0 0 5px #13162b;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 24px;
  --radius-full: 9999px;

  --font-display: "Archivo", "Arial Black", system-ui, sans-serif;
  --font-sans: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --surface: #10132a;
    --surface-alt: #181c38;
    --line: #2e3459;
    --line-strong: #8a90ab;
    --ink: #f5f6f8;
    --ink-muted: #b3b8cc;
    --verde-forte: #3fd17f;
    --on-verde-forte: #0b0e1f;
    --marinho: #262c58;
    --erro: #ff8a80;
    --shadow-hard: 4px 4px 0 #000000;
    --shadow-float: 0 12px 32px -4px #000000cc;
    --focus-ring: 0 0 0 2px #10132a, 0 0 0 5px #fff200;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { background: var(--marinho); }
body {
  margin: 0; min-width: 320px;
  font: 400 16px/24px var(--font-sans);
  color: var(--ink); background: var(--surface);
  -webkit-tap-highlight-color: transparent;
}
img { max-width: 100%; display: block; }
a { color: var(--verde-forte); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
:focus-visible { outline: 2px solid transparent; box-shadow: var(--focus-ring); }
.wrap { width: min(100% - 32px, 1120px); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- top bar ---------- */
.topbar { background: var(--marinho); color: var(--on-marinho); }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.topbar-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; line-height: 20px; }
.chip-num {
  font: italic 900 22px/1 var(--font-display); letter-spacing: -0.02em;
  background: var(--amarelo); color: var(--on-amarelo);
  padding: 5px 10px 3px 8px; border-radius: var(--radius-sm);
}
.topbar a { color: var(--on-marinho); font-weight: 700; font-size: 14px; text-decoration: none; border: 2px solid #ffffff66; border-radius: var(--radius-full); padding: 6px 14px; }
.topbar a:hover { border-color: #fff; }

/* ---------- hero ---------- */
.hero { background: var(--verde); color: var(--on-verde); overflow: hidden; }
.hero .wrap { display: grid; grid-template-columns: 1.05fr 1fr; gap: 32px; align-items: center; padding-block: 64px; }
.hero-copy { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.eyebrow {
  display: inline-block; font-size: 13px; line-height: 16px; font-weight: 800; letter-spacing: .12em;
  padding: 6px 12px; border-radius: var(--radius-full); background: var(--marinho); color: var(--on-marinho);
}
.hero h1 {
  margin: 0; font: italic 900 clamp(48px, 9vw, 88px)/.95 var(--font-display); letter-spacing: -0.02em;
  color: var(--on-verde); text-wrap: balance;
}
.hero h1 em {
  font-style: italic; color: var(--amarelo);
  text-shadow: var(--shadow-numeral); -webkit-text-stroke: 1px var(--sombra); padding-right: .06em;
}
.hero-intro { margin: 0; font-size: 18px; line-height: 28px; max-width: 36ch; font-weight: 500; }
.hero-intro strong { font-weight: 800; }

.hero-art { position: relative; display: grid; place-items: center; min-height: 420px; }
.disc { border-radius: var(--radius-full); overflow: hidden; border: 1px solid var(--sombra); background: var(--verde); }
.disc img { width: 100%; height: 100%; object-fit: cover; }
.disc-mito { width: min(420px, 100%); aspect-ratio: 1; box-shadow: 8px 8px 0 var(--sombra); }
.disc-mito img { object-position: 50% 20%; }
.disc-vile {
  position: absolute; left: 0; bottom: 0; width: 44%; max-width: 200px; aspect-ratio: 1;
  border: 4px solid var(--amarelo); outline: 1px solid var(--sombra); box-shadow: 6px 6px 0 var(--sombra);
}
.hero-tag {
  position: absolute; right: 0; bottom: 12px;
  background: var(--marinho); color: var(--on-marinho); border-radius: var(--radius-full);
  padding: 8px 16px; font-weight: 800; font-size: 14px; line-height: 18px; box-shadow: 4px 4px 0 var(--sombra);
}
.hero-tag b { color: var(--amarelo); font: italic 900 18px/1 var(--font-display); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 16px; line-height: 20px; font-weight: 800; min-height: 48px; padding: 0 24px;
  border-radius: var(--radius-full); border: 2px solid transparent; text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
.btn-primary { background: var(--amarelo); color: var(--on-amarelo); border-color: var(--on-amarelo); box-shadow: 4px 4px 0 var(--on-amarelo); }
.btn-primary:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--on-amarelo); }
.btn-primary:active { transform: translate(4px, 4px); box-shadow: none; }
.btn-secondary { background: var(--verde-forte); color: var(--on-verde-forte); }
.btn-secondary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface-alt); }
.btn:disabled { opacity: .45; cursor: wait; transform: none; }
.btn-full { width: 100%; }
.arrow { font-size: 18px; }

/* ---------- builder ---------- */
.builder { padding-block: 64px; }
.builder-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; margin-bottom: 24px; }
.builder h2 { margin: 0; font-size: 40px; line-height: 44px; font-weight: 800; letter-spacing: -0.01em; }
.builder-head p { margin: 0; color: var(--ink-muted); }
.builder-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 32px; align-items: start; }

.ballot {
  background: var(--surface); border: 2px solid var(--ink); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-hard); overflow: hidden;
}
.ballot-head { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 20px; background: var(--verde); color: var(--on-verde); }
.ballot-title { font: italic 900 24px/28px var(--font-display); }
.ballot-year { font-size: 13px; font-weight: 800; letter-spacing: .12em; }

.row {
  display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; column-gap: 16px; row-gap: 8px;
  align-items: center; padding: 14px 20px; border-top: 1px solid var(--line);
}
.row:nth-child(even) { background: var(--surface-alt); }
.row-photo {
  --cols: 1; --rows: 1; --tx: 0; --ty: 0;
  grid-row: 1 / span 2; width: 72px; height: 72px; border-radius: var(--radius-md); overflow: hidden;
  background: var(--surface-alt) center / cover no-repeat; border: 2px solid var(--line);
  display: grid; place-items: center; color: var(--line-strong);
}
.row:nth-child(even) .row-photo { background-color: var(--surface); }
.row-photo.sprite {
  background-size: calc(var(--cols) * 100%) calc(var(--rows) * 100%);
  background-position: calc(var(--tx) / max(var(--cols) - 1, 1) * 100%) calc(var(--ty) / max(var(--rows) - 1, 1) * 100%);
}
.row-photo.has-photo { border-color: var(--verde); }
.row-photo.has-photo svg { display: none; }
.row-info { min-width: 0; }
.row-cargo { display: block; font-size: 13px; line-height: 16px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--verde-forte); }
.row-name { display: block; font-size: 20px; line-height: 26px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-name.placeholder { color: var(--ink-muted); font-weight: 400; font-size: 16px; }
.row-meta { display: block; font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.row-meta.warn { color: var(--erro); font-weight: 700; }
.row-meta.lock { color: var(--verde-forte); font-weight: 700; }
.digits { display: flex; gap: 6px; }
.digit {
  width: 44px; height: 56px; padding: 0; text-align: center;
  font: italic 900 34px/1 var(--font-display); color: var(--ink);
  background: var(--surface); border: 2px solid var(--line-strong); border-radius: var(--radius-sm);
  caret-color: var(--verde-forte); -moz-appearance: textfield;
}
.digit:focus { outline: 2px solid transparent; border-color: var(--ink); box-shadow: var(--focus-ring); }
.row[data-invalid] .digit { border-color: var(--erro); }
.row.fixed .digit { background: var(--amarelo); color: var(--on-amarelo); border-color: var(--on-amarelo); }
.form-message { min-height: 24px; margin: 16px 0 8px; font-weight: 700; color: var(--erro); }

.aside { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 16px; }
.note { background: var(--surface-alt); border-radius: var(--radius-lg); padding: 20px; display: flex; gap: 12px; }
.note svg { flex: none; color: var(--verde-forte); margin-top: 2px; }
.note p { margin: 0; }
.note strong { display: block; font-size: 18px; line-height: 24px; }
.notice { display: flex; gap: 8px; align-items: flex-start; margin: 0; font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.notice svg { flex: none; margin-top: 1px; color: var(--verde-forte); }

/* ---------- footer ---------- */
footer { background: var(--marinho); color: var(--on-marinho); padding-block: 32px; font-size: 13px; line-height: 18px; }
footer p { margin: 0 0 8px; }
footer .legal { font-weight: 800; letter-spacing: .04em; }
footer .small { opacity: .85; }
footer a { color: var(--on-marinho); }

/* ---------- dialogs ---------- */
dialog {
  width: min(100% - 24px, 460px); max-height: calc(100dvh - 24px); padding: 20px; border: 2px solid var(--ink);
  border-radius: var(--radius-lg); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-float);
}
dialog::backdrop { background: #0b0e1fcc; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.modal-head h2 { margin: 0; font-size: 28px; line-height: 32px; font-weight: 800; }
.modal-close { width: 44px; height: 44px; flex: none; border-radius: var(--radius-full); border: 2px solid var(--line-strong); background: transparent; font-size: 24px; line-height: 1; }
.result-stage { display: grid; place-items: center; background: var(--surface-alt); border-radius: var(--radius-md); padding: 12px; margin-bottom: 12px; }
.result-stage img { max-height: 52dvh; width: auto; border-radius: 6px; box-shadow: 0 4px 16px #0003; }
.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.result-actions .btn-primary { grid-column: 1 / -1; }
.result-secondary { display: flex; gap: 8px; margin-top: 8px; }
.result-secondary .btn { flex: 1; min-height: 40px; font-size: 14px; padding: 0 12px; }
.status { min-height: 20px; margin: 8px 0 0; font-size: 13px; color: var(--ink-muted); text-align: center; }
#manual-copy input { width: 100%; margin-top: 6px; padding: 10px; border: 2px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface); }
.models { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.model {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px 6px 12px;
  border: 2px solid var(--line); border-radius: var(--radius-md); background: var(--surface);
}
.model[aria-pressed="true"] { border-color: var(--ink); box-shadow: var(--shadow-hard); }
.model-swatch { width: 100%; aspect-ratio: 5 / 9; border-radius: 6px; border: 1px solid var(--line-strong); display: grid; place-items: center; }
.model-swatch i { width: 70%; height: 60%; background: #fff; border-radius: 4px; border: 1px solid #13162b; }
.model b { font-size: 14px; }
.model small { font-size: 12px; color: var(--ink-muted); line-height: 14px; text-align: center; }

#print-art { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .builder-grid { grid-template-columns: 1fr; }
  .aside { position: static; }
}
@media (max-width: 720px) {
  .hero .wrap { grid-template-columns: 1fr; padding-block: 40px 48px; gap: 24px; }
  .hero-art { min-height: 0; max-width: 360px; width: 100%; margin-inline: auto; }
  .disc-vile { width: 42%; }
  .hero-tag { font-size: 13px; padding: 6px 12px; bottom: 4px; }
  .builder { padding-block: 48px; }
  .builder h2 { font-size: 32px; line-height: 36px; }
  .row { grid-template-columns: 64px minmax(0, 1fr); padding: 12px 16px; column-gap: 12px; }
  .row-photo { width: 64px; height: 64px; }
  .row .digits { grid-column: 2; gap: 6px; }
  .digit { width: 40px; height: 52px; font-size: 30px; }
  .row-name { font-size: 18px; line-height: 24px; }
  .topbar-brand span:last-child { font-size: 13px; }
}
@media (max-width: 360px) {
  .row .digits { gap: 4px; }
  .digit { width: 32px; height: 44px; font-size: 26px; }
  .topbar a { display: none; }
}

@media print {
  @page { size: 5cm 9cm; margin: 0; }
  body > *:not(#print-art) { display: none !important; }
  html, body { background: #fff; }
  #print-art { display: block; }
  #print-art img { width: 5cm; height: 9cm; }
}
