/* Gabinete de fliperama: a tela do jogo é o centro; o resto é a moldura. */
:root {
  --fundo: #17123a;
  --painel: #251c58;
  --painel-2: #32277a;
  --texto: #f6f0ff;
  --apagado: #b9afe3;
  --ficha: #ffc83d;
  --coral: #ff5d73;
  --titulo: "Bungee", "Arial Black", system-ui, sans-serif;
  --corpo: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--fundo); color: var(--texto); font-family: var(--corpo); font-size: 16px; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--ficha); outline-offset: 2px; }

/* Menu */
.menu { max-width: 1120px; margin: 0 auto; padding: 32px 16px 48px; display: flex; flex-direction: column; gap: 28px; }
.marquise h1 { margin: 0; font-family: var(--titulo); font-weight: 400; font-size: clamp(2.5rem, 11vw, 5.5rem); line-height: 1; color: var(--ficha); text-shadow: 0 4px 0 #b3432f; }
.marquise p { margin: 14px 0 0; color: var(--apagado); font-size: 1.1rem; }
.inicio { display: flex; flex-direction: column; gap: 28px; }
.portas { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.porta { display: flex; flex-direction: column; justify-content: center; gap: 8px; min-height: clamp(140px, 30vh, 280px); padding: 24px; border-radius: 10px; text-decoration: none; color: #1c0f33; box-shadow: 0 6px 0 rgba(0, 0, 0, .35); transition: transform .12s; }
.porta:hover, .porta:focus-visible { transform: translateY(-3px); }
.porta b { font-family: var(--titulo); font-weight: 400; font-size: clamp(2.2rem, 8vw, 3.6rem); line-height: 1; }
.porta span { font-size: 1.1rem; font-weight: 700; }
.porta-online { background: var(--coral); }
.porta-solo { background: var(--ficha); }
.categoria { display: flex; flex-direction: column; gap: 20px; }
.cat-topo { display: flex; align-items: center; gap: 14px; }
.cat-topo h1 { margin: 0; font-family: var(--titulo); font-weight: 400; font-size: clamp(1.8rem, 7vw, 2.8rem); line-height: 1; color: var(--ficha); }
.cat-topo p { margin: 6px 0 0; color: var(--apagado); }
.grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.cartao { display: flex; flex-direction: column; color: inherit; text-decoration: none; background: var(--painel); border-radius: 10px; overflow: hidden; border: 2px solid var(--painel-2); transition: transform .12s, border-color .12s; }
.cartao:hover, .cartao:focus-visible { transform: translateY(-3px); border-color: var(--ficha); }
.cartao canvas { display: block; width: 100%; aspect-ratio: 16 / 10; background: #0e0a28; }
.cartao-txt { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.cartao h3 { margin: 0; font-family: var(--titulo); font-weight: 400; font-size: 1.25rem; }
.cartao p { margin: 0; color: var(--apagado); line-height: 1.4; flex: 1; }
.cartao small { color: var(--ficha); font-size: .95rem; font-variant-numeric: tabular-nums; }

/* Jogo */
.jogo { position: fixed; inset: 0; display: grid; grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "b" "p"; background: var(--fundo); padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.barra { grid-area: b; display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: var(--painel); }
.j-nome { font-family: var(--titulo); font-weight: 400; font-size: 1.05rem; margin-right: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.placar { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; padding: 0 6px; font-variant-numeric: tabular-nums; }
.placar span { font-size: .68rem; color: var(--apagado); text-transform: uppercase; letter-spacing: .06em; }
.placar b { font-size: 1.05rem; color: var(--ficha); }
.bt-barra { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 8px; background: var(--painel-2); color: var(--texto); cursor: pointer; padding: 0; }
.bt-barra svg, .bt svg { width: 60%; height: 60%; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.palco { grid-area: p; position: relative; display: grid; place-items: center; min-height: 0; min-width: 0; padding: 8px; overflow: hidden; }
#tela { display: block; border-radius: 6px; background: #0e0a28; box-shadow: 0 0 0 3px var(--painel-2); }
.aviso { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 20px; text-align: center; background: rgba(14, 10, 40, .84); overflow: auto; }
.aviso h2 { margin: 0; font-family: var(--titulo); font-weight: 400; font-size: clamp(1.7rem, 7vw, 2.6rem); color: var(--ficha); }
.aviso p { margin: 0; max-width: 38ch; line-height: 1.45; color: var(--texto); }
.aviso .forte { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.aviso .acoes { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 6px; }
.b-aviso { min-height: 48px; padding: 0 22px; display: inline-flex; align-items: center; border: 0; border-radius: 8px; font: 700 1.05rem var(--corpo); text-decoration: none; cursor: pointer; background: var(--painel-2); color: var(--texto); }
.b-aviso.principal { background: var(--ficha); color: #2a1a00; }

/* Controles na tela: aparecem só em aparelho com toque */
.ctl { display: none; }
.bt { width: clamp(58px, 17vw, 84px); height: clamp(58px, 17vw, 84px); border: 0; border-radius: 50%; display: grid; place-items: center; padding: 0; background: var(--painel-2); color: var(--texto); box-shadow: 0 4px 0 #120d30; touch-action: none; cursor: pointer; }
.bt.apertado { background: var(--ficha); color: #2a1a00; box-shadow: 0 1px 0 #120d30; transform: translateY(3px); }
.bt.acao { background: var(--coral); color: #2a0610; }
.ctl-cruz { display: none; }

@media (any-pointer: coarse) {
  .jogo { grid-template-columns: 1fr 1fr; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-areas: "b b" "p p" "e d"; }
  .jogo.um-grupo { grid-template-areas: "b b" "p p" "e e"; }
  .ctl { display: flex; align-items: center; gap: 10px; padding: 8px 12px 14px; }
  .ctl-esq { grid-area: e; justify-content: flex-start; }
  .ctl-dir { grid-area: d; justify-content: flex-end; }
  .jogo.um-grupo .ctl-esq { justify-content: center; }
  .jogo.um-grupo .ctl-dir { display: none; }
  .ctl.cruz { display: grid; grid-template-columns: repeat(3, auto); gap: 4px; }
  .cruz .b-cima { grid-area: 1 / 2; } .cruz .b-esquerda { grid-area: 2 / 1; }
  .cruz .b-direita { grid-area: 2 / 3; } .cruz .b-baixo { grid-area: 3 / 2; }
}
@media (any-pointer: coarse) and (orientation: landscape) and (max-height: 620px) {
  .jogo, .jogo.um-grupo { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "b b b" "e p d"; }
  .ctl { flex-direction: column; justify-content: center; padding: 8px; }
  .ctl-esq, .ctl-dir, .jogo.um-grupo .ctl-esq { justify-content: center; }
  .jogo.um-grupo .ctl-dir { display: block; width: 0; padding: 0; }
  .ctl.cruz { display: grid; align-content: center; }
  .bt { width: clamp(50px, 13vh, 72px); height: clamp(50px, 13vh, 72px); }
}
@media (max-width: 460px) {
  .placar span { font-size: .6rem; }
  .placar { padding: 0 2px; }
  .j-nome { font-size: .9rem; }
  .bt-barra { width: 36px; height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  .cartao, .porta { transition: none; }
  .cartao:hover, .cartao:focus-visible, .porta:hover, .porta:focus-visible { transform: none; }
}
