:root {
  --fundo: #f6f6f4;
  --painel: #ffffff;
  --texto: #1d1f23;
  --suave: #6b7078;
  --linha: #e4e4e0;
  --acento: #ff5a1f;
  --acento-suave: #fff0ea;
  --vidro: rgba(255, 255, 255, 0.86);
  --raio: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--texto);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--fundo); }
button, select, input { font: inherit; color: inherit; }

#app { display: grid; grid-template-columns: 300px 1fr; height: 100vh; }

/* ---------- painel lateral */
#painel {
  background: var(--painel);
  border-right: 1px solid var(--linha);
  display: flex; flex-direction: column;
  padding: 20px 18px 14px; gap: 16px; overflow-y: auto;
}
#painel header h1 { margin: 0; font-size: 22px; letter-spacing: -0.02em; }
#painel header h1 span { color: var(--acento); }
#painel header p { margin: 4px 0 0; color: var(--suave); font-size: 13px; }
#painel section { display: flex; flex-direction: column; gap: 8px; }
#painel section.crescer { flex: 1; min-height: 170px; }
#painel label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--suave); display: flex; justify-content: space-between; align-items: center; }
#painel .opcoes label { text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 14px; color: var(--texto); justify-content: flex-start; gap: 8px; }
#painel footer { font-size: 11px; color: var(--suave); line-height: 1.45; }
#painel footer a { color: inherit; }
output { font-weight: 600; color: var(--texto); text-transform: none; }

select {
  width: 100%; padding: 9px 10px; border: 1px solid var(--linha); border-radius: 8px; background: #fff;
}
.meta { margin: 0; font-size: 13px; color: var(--suave); line-height: 1.4; }
.titulo-secao { display: flex; justify-content: space-between; align-items: center; }
.link { background: none; border: 0; color: var(--acento); font-size: 12px; cursor: pointer; padding: 0; }

#lista-jogadores { overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding-right: 4px; }
#lista-jogadores .grupo { font-size: 11px; color: var(--suave); margin: 8px 0 2px; }
#lista-jogadores button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  border: 0; background: none; padding: 6px 8px; border-radius: 7px; cursor: pointer; font-size: 14px;
}
#lista-jogadores button:hover { background: var(--fundo); }
#lista-jogadores button.ativo { background: var(--acento-suave); font-weight: 600; }
#lista-jogadores .camisa {
  width: 22px; height: 22px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-size: 10px; font-weight: 700; border: 2px solid;
}
#lista-jogadores .gol { margin-left: auto; font-size: 11px; color: var(--acento); font-weight: 600; }

input[type=range] { accent-color: var(--acento); width: 100%; }
input[type=checkbox] { accent-color: var(--acento); }

.segmentado { display: flex; background: var(--fundo); border: 1px solid var(--linha); border-radius: 9px; padding: 3px; gap: 2px; }
.segmentado button { flex: 1; border: 0; background: none; padding: 7px 10px; border-radius: 6px; cursor: pointer; font-size: 13px; white-space: nowrap; }
.segmentado button.ativo { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12); font-weight: 600; color: var(--acento); }

/* ---------- palco */
#palco { position: relative; overflow: hidden; background: #cfd8e3; }
#cena { width: 100%; height: 100%; display: block; }
.flutuante { position: absolute; background: var(--vidro); backdrop-filter: blur(8px); border: 1px solid rgba(0,0,0,.06); border-radius: var(--raio); box-shadow: 0 4px 16px rgba(0,0,0,.08); }

#vistas { top: 14px; left: 50%; transform: translateX(-50%); }
#vistas.segmentado { background: var(--vidro); }

#hud { top: 14px; left: 14px; padding: 9px 13px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; min-width: 170px; }
#hud strong { font-size: 15px; }
#hud span { color: var(--suave); font-variant-numeric: tabular-nums; }

#minimapa { position: absolute; right: 14px; bottom: 76px; border-radius: var(--raio); box-shadow: 0 4px 16px rgba(0,0,0,.15); cursor: pointer; }

#controles { left: 14px; right: 14px; bottom: 14px; padding: 8px 12px; display: flex; align-items: center; gap: 12px; }
#controles select { width: auto; padding: 6px 8px; }
.redondo { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--acento); color: #fff; cursor: pointer; font-size: 14px; flex: none; }
#tempo { font-variant-numeric: tabular-nums; font-size: 13px; width: 92px; color: var(--suave); }
#trilho { position: relative; flex: 1; display: flex; align-items: center; }
#marca-gol { position: absolute; top: -9px; width: 2px; height: 8px; background: var(--acento); border-radius: 1px; pointer-events: none; }
#btn-gravar { border: 1px solid var(--linha); background: #fff; border-radius: 8px; padding: 7px 12px; cursor: pointer; white-space: nowrap; }
#btn-gravar.gravando { background: #d92d20; color: #fff; border-color: #d92d20; }
#btn-gravar:disabled { opacity: .5; cursor: default; }

#carregando { position: absolute; inset: 0; display: grid; place-items: center; background: var(--fundo); color: var(--suave); }
#carregando[hidden] { display: none; }

/* ---------- estilos visuais */
.estilos { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.estilos button { display: flex; align-items: center; gap: 8px; border: 1px solid var(--linha); background: #fff; border-radius: 8px; padding: 6px 8px; cursor: pointer; font-size: 13px; text-align: left; }
.estilos button.ativo { border-color: var(--acento); background: var(--acento-suave); font-weight: 600; }
.amostra { width: 18px; height: 18px; border-radius: 4px; flex: none; border: 1px solid rgba(0,0,0,.12); }
.amostra.realista { background: linear-gradient(90deg, #3d8537 50%, #47953f 50%); }
.amostra.palitos-claro { background: #fff; box-shadow: inset 0 0 0 2px #fff, inset 0 0 0 3px #1d1f23; }
.amostra.palitos-escuro { background: #0b0b0c; box-shadow: inset 0 0 0 2px #0b0b0c, inset 0 0 0 3px #f2f2f2; }
.amostra.blocos { background: conic-gradient(#62ae42 25%, #56a03a 0 50%, #62ae42 0 75%, #56a03a 0) 0 0 / 9px 9px; border-radius: 0; }
.amostra.bloquinho { background: radial-gradient(circle at 40% 40%, #6fc06f 35%, #4b974b 37%) 0 0 / 9px 9px; }

.aviso { margin: 0; font-size: 12px; line-height: 1.4; color: #8a4b00; background: #fff4e0; border: 1px solid #ffd99a; border-radius: 8px; padding: 7px 9px; }
.aviso[hidden] { display: none; }
#lista-jogadores .est { margin-left: auto; font-size: 10px; color: var(--suave); border: 1px dashed var(--linha); border-radius: 4px; padding: 0 4px; }
#lista-jogadores .est + .gol { margin-left: 6px; }

/* ---------- editor */
.secundario { border: 1px solid var(--linha); background: #fff; border-radius: 8px; padding: 7px 12px; cursor: pointer; white-space: nowrap; }
.secundario.ativo { border-color: var(--acento); color: var(--acento); font-weight: 600; }
#editor { top: 64px; right: 14px; width: 290px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
#editor[hidden] { display: none; }
.ed-topo { display: flex; justify-content: space-between; align-items: center; }
.ed-dica { margin: 0; color: var(--suave); font-size: 12px; line-height: 1.4; }
.ed-dica:empty { display: none; }
.ed-linha { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ed-linha[hidden] { display: none; }
.ed-linha input[type=number] { width: 70px; padding: 4px 6px; border: 1px solid var(--linha); border-radius: 6px; }
.ed-linha input[type=range] { width: 130px; }
.mini { border: 1px solid var(--linha); background: #fff; border-radius: 6px; padding: 3px 8px; cursor: pointer; font-size: 12px; margin-left: 4px; }
.ed-botoes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ed-botoes button { border: 1px solid var(--linha); background: #fff; border-radius: 7px; padding: 6px; cursor: pointer; font-size: 12px; }
#marcas-chaves { position: absolute; left: 0; right: 0; bottom: -7px; height: 6px; pointer-events: none; }
#marcas-chaves i { position: absolute; width: 6px; height: 6px; margin-left: -3px; background: var(--texto); transform: rotate(45deg); }
body:not(.editando) #marcas-chaves { display: none; }
body.editando #vistas, body.editando #minimapa { display: none; }

@media (max-width: 820px) {
  #app { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  #painel { order: 2; max-height: 42vh; border-right: 0; border-top: 1px solid var(--linha); padding: 12px 16px; gap: 12px; }
  #painel header, #painel footer { display: none; }
  #minimapa { width: 168px; height: 112px; }
  #vistas { left: 14px; transform: none; top: 64px; }
  #vistas button { padding: 6px 7px; font-size: 12px; }
  #btn-gravar, #btn-editar { display: none; }
}
