/* Mandante FC: tokens, layout e componentes do protótipo (mandante-fc.html) como sistema de design do produto. */
/* base (primeiro bloco de estilo do protótipo) */
:root{color-scheme:light;padding-top:env(safe-area-inset-top,0px);padding-bottom:env(safe-area-inset-bottom,0px)}
body{margin:0;font:14px system-ui,sans-serif}
img{max-width:100%}
[hidden]{display:none!important}
/* Layout: placar em faixa no topo; no desktop a pista (escudo, ações, resultado) fica à esquerda e o mapa ocupa o resto; no celular o mapa vem logo após o escudo. */
:root {
  --bg: #EAF0EB;
  --surface: #F6F9F6;
  --ink: #0F2A1F;
  --muted: #4E6558;
  --line: #B6C9BC;
  --accent: #0B6B3A;
  --accent-ink: #FFFFFF;
  --gold: #E3A800;
  --guess: #1D4ED8;
  --plate: #F6F8F3;
  --map-sea: #CFE0E6;
  --map-land: #F4F7EE;
  --map-border: #7E9A8B;
  --s4: #1E8A52;
  --s3: #C99700;
  --s2: #D9702B;
  --s1: #C23B30;
  --display: "Big Shoulders Display", "Arial Narrow", Impact, sans-serif;
  --body: "Albert Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1F16; --surface: #112A1E; --ink: #EAF2E6; --muted: #9DB5A5; --line: #264A38;
    --accent: #F2C230; --accent-ink: #1B2A0E; --gold: #F2C230; --guess: #6EA2FF;
    --plate: #F1F4EC; --map-sea: #0D2630; --map-land: #173B2C; --map-border: #437058;
    --s4: #3DBB7E; --s3: #E3B72A; --s2: #EE8A4A; --s1: #E5675B;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0B1F16; --surface: #112A1E; --ink: #EAF2E6; --muted: #9DB5A5; --line: #264A38;
  --accent: #F2C230; --accent-ink: #1B2A0E; --gold: #F2C230; --guess: #6EA2FF;
  --plate: #F1F4EC; --map-sea: #0D2630; --map-land: #173B2C; --map-border: #437058;
  --s4: #3DBB7E; --s3: #E3B72A; --s2: #EE8A4A; --s1: #E5675B;
  color-scheme: dark;
}

body { background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.45; }
* { box-sizing: border-box; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--guess); outline-offset: 2px; }

.app {
  max-width: 1180px; margin: 0 auto;
  padding-block: 14px 32px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column; gap: 14px;
}

/* topo */
.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 20px; flex-wrap: wrap; }
.brand { min-width: 0; }
.wordmark {
  margin: 0; font-family: var(--display); font-weight: 800; text-transform: uppercase;
  font-size: clamp(34px, 7vw, 52px); line-height: .9; letter-spacing: .015em;
}
.wordmark .no {
  display: inline-block; vertical-align: .18em; margin: 0 .12em;
  font-size: .42em; letter-spacing: .08em; padding: .16em .42em .1em;
  background: var(--gold); color: #1d1500;
}
.meta { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.controls { display: flex; gap: 8px; flex-wrap: wrap; }
.modes { display: flex; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; background: var(--surface); }
.seg {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  padding: 9px 14px; font-weight: 500; font-size: 14px; color: var(--muted);
}
.seg + .seg { border-left: 1px solid var(--line); }
.seg[aria-pressed="true"] { background: var(--ink); color: var(--bg); font-weight: 700; }

/* placar */
.board {
  display: flex; align-items: stretch; justify-content: space-between; gap: 16px;
  border-block: 2px solid var(--ink); padding-block: 8px;
}
.pips { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; flex: 1; min-width: 0; }
.pip {
  flex: 1; min-width: 0; padding: 4px 8px 6px; border: 1px solid var(--line); background: var(--surface);
  border-bottom: 4px solid var(--line); display: flex; flex-direction: column; gap: 0;
}
.pip .n { font-family: var(--display); font-weight: 800; font-size: 20px; line-height: 1; }
.pip .m { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pip .b { font-family: var(--display); font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; }
.pip.now { border-color: var(--ink); border-bottom-color: var(--gold); }
.pip.g4 { border-bottom-color: var(--s4); }
.pip.g3 { border-bottom-color: var(--s3); }
.pip.g2 { border-bottom-color: var(--s2); }
.pip.g1 { border-bottom-color: var(--s1); }
.total { display: flex; align-items: baseline; gap: 6px; padding-left: 8px; flex: none; }
.total .lbl { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); align-self: center; }
.total .num { font-family: var(--display); font-weight: 800; font-size: clamp(38px, 7vw, 54px); line-height: 1; font-variant-numeric: tabular-nums; }
.total .of { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }

/* palco */
.stage {
  display: grid; gap: 14px 22px;
  grid-template-columns: minmax(290px, 360px) minmax(0, 1fr);
  grid-template-rows: auto auto 1fr;
  grid-template-areas: "clue map" "actions map" "result map";
  align-items: start;
}
.clue { grid-area: clue; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.plate {
  background: var(--plate); border: 1px solid var(--line);
  aspect-ratio: 1 / 1; display: grid; place-items: center; padding: 8%;
}
.crest { width: 100%; height: 100%; display: block; object-fit: contain; }
.ask { min-width: 0; }
.chip {
  display: inline-block; margin: 0 0 8px; padding: 3px 9px 2px;
  font-family: var(--display); font-weight: 600; font-size: 15px; letter-spacing: .08em; text-transform: uppercase;
  border: 1px solid var(--ink); font-variant-numeric: tabular-nums;
}
.q { margin: 0; font-family: var(--display); font-weight: 800; text-transform: uppercase; font-size: clamp(28px, 5vw, 36px); line-height: .98; text-wrap: balance; }
.hint { margin: 8px 0 0; color: var(--muted); font-size: 14px; max-width: 46ch; }

.actions { grid-area: actions; display: flex; gap: 10px; }
.btn {
  appearance: none; cursor: pointer; border: 2px solid var(--ink); border-radius: 4px; background: transparent;
  padding: 11px 18px; font-family: var(--display); font-weight: 800; font-size: 20px; letter-spacing: .06em; text-transform: uppercase;
  line-height: 1;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); flex: 1; }
.btn:disabled { opacity: .38; cursor: not-allowed; }
.btn:not(:disabled):hover { filter: brightness(1.08); }

.result { grid-area: result; border-top: 4px solid var(--gold); background: var(--surface); padding: 12px 14px 14px; border-inline: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.sum-head .lbl { margin: 0; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.club { margin: 0; font-family: var(--display); font-weight: 800; font-size: clamp(32px, 6vw, 42px); line-height: 1; text-transform: uppercase; text-wrap: balance; }
.where { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0 0; }
.stats dt { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.stats dd { margin: 0; font-family: var(--display); font-weight: 800; font-size: 34px; line-height: 1.05; font-variant-numeric: tabular-nums; }
.stats dd.sub { font-family: var(--body); font-weight: 500; font-size: 13px; color: var(--muted); }

/* mapa */
.mapwrap {
  grid-area: map; position: relative; min-width: 0;
  height: clamp(520px, 76vh, 800px);
  border: 1px solid var(--line); background: var(--map-sea); overflow: hidden;
}
#map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; user-select: none; -webkit-user-select: none; }
.st { fill: var(--map-land); stroke: var(--map-border); stroke-width: 1; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.link { stroke: var(--ink); stroke-width: 2; stroke-dasharray: 6 5; vector-effect: non-scaling-stroke; fill: none; pointer-events: none; }
.mapctl { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; border: 1px solid var(--line); background: var(--surface); }
.mapctl button { appearance: none; border: 0; background: transparent; width: 38px; height: 38px; display: grid; place-items: center; cursor: pointer; }
.mapctl button + button { border-top: 1px solid var(--line); }
.mapctl svg { width: 18px; height: 18px; stroke: var(--ink); stroke-width: 2; fill: none; stroke-linecap: round; }
.maphint { position: absolute; left: 10px; bottom: 10px; margin: 0; padding: 6px 10px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; color: var(--muted); }

/* resumo */
.summary { display: grid; gap: 16px; max-width: 760px; }
.sum-head { display: flex; flex-direction: column; gap: 2px; }
.big { margin: 0; font-family: var(--display); font-weight: 800; font-size: clamp(72px, 16vw, 120px); line-height: .9; font-variant-numeric: tabular-nums; }
.big .of { font-size: .28em; color: var(--muted); font-weight: 600; }
.grade { margin: 4px 0 0; font-family: var(--display); font-weight: 800; font-size: 28px; text-transform: uppercase; letter-spacing: .03em; }
.rows { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.rows li { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.mini-plate { background: var(--plate); border: 1px solid var(--line); width: 52px; height: 52px; padding: 5px; }
.mini-plate img { width: 100%; height: 100%; display: block; object-fit: contain; }
.rows .who { min-width: 0; }
.rows .who b { display: block; font-family: var(--display); font-weight: 800; font-size: 22px; text-transform: uppercase; line-height: 1.05; }
.rows .who span { display: block; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.rows .num { text-align: right; font-variant-numeric: tabular-nums; line-height: 1.2; }
.rows .num b { display: block; font-family: var(--display); font-weight: 800; font-size: 26px; }
.rows .num span { color: var(--muted); font-size: 13px; }
.sum-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.sum-actions .btn { flex: 1 1 200px; }
.copied { margin: 0; min-height: 1.4em; color: var(--muted); font-size: 14px; }
.fallback { margin: 0; padding: 10px; border: 1px solid var(--line); background: var(--surface); font: 14px/1.4 var(--body); white-space: pre-wrap; user-select: all; -webkit-user-select: all; }

.about { border-top: 1px solid var(--line); padding-top: 10px; color: var(--muted); font-size: 14px; }
.about summary { cursor: pointer; font-weight: 500; color: var(--ink); }
.about p { margin: 8px 0 0; max-width: 78ch; }

@media (max-width: 860px) {
  .stage { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; grid-template-areas: "clue" "map" "actions" "result"; }
  .clue { flex-direction: row; align-items: center; }
  .plate { width: 112px; flex: none; padding: 6%; }
  .mapwrap { height: clamp(380px, 60vh, 620px); }
  .pip .m { display: none; }
  .total .lbl { display: none; }
  .rows li { grid-template-columns: 44px minmax(0, 1fr) auto; }
  .mini-plate { width: 44px; height: 44px; }
  .controls { width: 100%; }
  .controls .modes { flex: 1 1 auto; }
  .controls .seg { flex: 1; padding-inline: 8px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- acrescentado na versão de produção ---------- */
.plate { position: relative; }
.plate.loading .crest { opacity: 0; }
.plate.loading::after {
  content: ''; position: absolute; inset: 8%; border-radius: 6px;
  background: linear-gradient(90deg, var(--line) 0%, var(--surface) 50%, var(--line) 100%); background-size: 200% 100%;
  animation: sk 1.2s linear infinite;
}
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.plate.failed .crest { display: none; }
.plate .retry {
  position: absolute; inset: 0; margin: auto; width: max-content; height: max-content; min-height: 38px;
  appearance: none; cursor: pointer; padding: 8px 14px; border: 2px solid var(--ink); border-radius: 4px; background: var(--surface);
  font-family: var(--display); font-weight: 800; font-size: 16px; letter-spacing: .06em; text-transform: uppercase;
}
.serie {
  display: inline-block; margin-left: 8px; padding: 1px 8px 0; vertical-align: .08em;
  font-family: var(--display); font-weight: 600; font-size: 15px; letter-spacing: .08em; text-transform: uppercase;
  border: 1px solid var(--ink); font-variant-numeric: tabular-nums;
}
.notice { display: grid; gap: 12px; max-width: 560px; padding: 16px; border: 1px solid var(--line); background: var(--surface); border-top: 4px solid var(--gold); }
.notice p { margin: 0; }
.notice .q { font-size: clamp(24px, 4vw, 30px); }
.notice .btn { justify-self: start; }
.rows .who .city { color: var(--muted); }
/* ---------- ajuste de tamanho: escudo menor e botão de ação sempre à vista ---------- */
/* a placa é sempre um quadrado: o desenho do escudo se ajusta dentro dela e nunca a estica */
.plate { grid-template: minmax(0, 1fr) / minmax(0, 1fr); overflow: hidden; }
.crest { min-width: 0; min-height: 0; }
@media (min-width: 861px) {
  /* o escudo acompanha a altura da janela (de 112 a 200 px), para a pergunta e o botão caberem na mesma tela */
  .plate { width: clamp(112px, 24vh, 200px); padding: 7%; }
  .clue { gap: 8px; }
  .q { font-size: clamp(24px, 3vw, 32px); }
  .hint { margin-top: 4px; }
  .chip { margin-bottom: 6px; }
  /* o mapa ocupa o que sobra da altura da janela; o cabeçalho e o placar levam cerca de 215 px */
  .mapwrap { height: clamp(380px, calc(100vh - 215px), 800px); height: clamp(380px, calc(100svh - 215px), 800px); }
}
@media (max-width: 860px) {
  /* resultado logo abaixo do mapa e o botão fixo no rodapé da tela: "Confirmar palpite" e "Próximo clube" nunca saem de vista */
  .stage { grid-template-areas: "clue" "map" "result" "actions"; }
  .result { scroll-margin-bottom: 84px; } /* ao rolar até o resultado, sobra espaço para a barra do botão */
  .actions {
    position: sticky; bottom: 0; z-index: 5;
    padding: 10px 0 calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--bg); box-shadow: 0 -10px 12px -10px rgba(0, 0, 0, .25);
  }
  /* o mapa deixa espaço para o cabeçalho, a pergunta e o botão na primeira tela */
  .mapwrap { height: clamp(300px, calc(100vh - 470px), 520px); height: clamp(300px, calc(100svh - 470px), 520px); }
}
/* os botões de zoom ficam no canto inferior direito (oceano): no canto superior direito cobriam o litoral do Nordeste */
.mapctl { top: auto; bottom: 10px; }

/* ---------- ampliar o escudo (só no celular: toque no escudo ou no ícone) ---------- */
.plate .zoom { display: none; }
@media (max-width: 860px) {
  .crest { cursor: zoom-in; }
  .plate .zoom {
    position: absolute; right: 4px; bottom: 4px; width: 38px; height: 38px; display: grid; place-items: center;
    appearance: none; cursor: pointer; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); opacity: .92;
  }
  .plate .zoom svg { width: 18px; height: 18px; stroke: var(--ink); stroke-width: 2; fill: none; stroke-linecap: round; }
  .plate.loading .zoom, .plate.failed .zoom { display: none; }
}
html.modal-open, html.modal-open body { overflow: hidden; }
.lightbox {
  position: fixed; inset: 0; z-index: 40; display: grid; place-content: center; justify-items: center; gap: 14px; padding: 16px;
  background: rgba(8, 20, 14, .86);
}
.lb-plate { width: min(88vw, 70vh, 520px); aspect-ratio: 1 / 1; padding: 6%; background: var(--plate); border: 1px solid var(--line); display: grid; place-items: center; }
.lb-plate img { width: 100%; height: 100%; object-fit: contain; display: block; }
.lb-close { min-width: 160px; background: var(--surface); }
.noscript { padding: 16px; }
.msg { color: var(--s1); font-weight: 500; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.btn, .seg, .mapctl button, .retry { min-height: 38px; }