:root {
  --noite: #1b1511;
  --noite-2: #2a201a;
  --madeira: #5a3a24;
  --madeira-2: #3a2418;
  --lona: #c4492a;
  --lona-clara: #f4e3c4;
  --lampada: #ffcf70;
  --preco: #f0d089;
  --folha: #8fce78;
  --tomate: #e15b48;
  --papel: #f7f1e6;
  --tinta: #24180f;
  --creme: #f3e6d2;
  --sombra: 0 16px 32px rgba(12, 6, 2, 0.42);
  --fonte: "Outfit", "Segoe UI", sans-serif;
  --display: "Fraunces", "Palatino Linotype", Palatino, serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--noite);
  color: var(--papel);
  font-family: var(--fonte);
  font-weight: 420;
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 196, 90, 0.16), transparent 42%),
    var(--noite);
}

::selection { background: #e2a23a; color: #1a120c; }

:focus-visible {
  outline: 3px solid var(--lampada);
  outline-offset: 3px;
}

button, input { font: inherit; color: inherit; }

button { cursor: pointer; }

button:disabled {
  cursor: not-allowed;
  background: #4a3b32;
  color: #e6d3c4;
}

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-thumb { background: #6a4a30; border-radius: 99px; }

.lona {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 0.75rem 1rem;
  align-items: center;
  padding: 0.7rem 1rem 0.85rem;
  background: repeating-linear-gradient(90deg, #c4492a 0 22px, #f4e3c4 22px 36px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
}

.lampadas {
  pointer-events: none;
  position: absolute;
  left: 0;
  right: 0;
  bottom: -7px;
  display: flex;
  justify-content: space-between;
  padding: 0 1.2rem;
}

.lampadas i {
  width: 12px;
  height: 14px;
  border-radius: 50% 50% 46% 46%;
  background: var(--lampada);
  box-shadow: 0 8px 14px rgba(255, 190, 70, 0.45);
}

.marca {
  background: var(--papel);
  color: var(--tinta);
  padding: 0.28rem 0.75rem 0.35rem;
  box-shadow: 0 8px 18px rgba(40, 16, 6, 0.28);
}

.marca h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 680;
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  letter-spacing: -0.03em;
  line-height: 0.95;
}

.sob {
  margin: 0.12rem 0 0;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  color: #6b3a22;
}

.vez {
  margin: 0;
  justify-self: center;
  background: #2a1c14;
  color: var(--papel);
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-weight: 560;
  max-width: 28rem;
  text-align: center;
}

.maquininha {
  background: #1d3328;
  color: #e7ffe9;
  min-width: 8.2rem;
  padding: 0.28rem 0.7rem 0.4rem;
  border-radius: 10px 10px 16px 16px;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.35);
  text-align: center;
}

.maq-topo, #relogio-rotulo {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  color: #b7e6c4;
}

#relogio {
  display: block;
  font-family: var(--display);
  font-size: clamp(1.6rem, 3vw, 2.3rem);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1;
  color: #f3fff4;
}

.comandos {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: stretch;
}

#prof { display: flex; gap: 0.35rem; }

button {
  background: #2a1c14;
  color: var(--papel);
  border: 0;
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  font-weight: 560;
  box-shadow: 0 8px 14px rgba(20, 8, 2, 0.25);
}

button:hover { background: #3a281c; }

#som {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  background: var(--papel);
  color: var(--tinta);
}

#som svg { width: 1.1rem; height: 1.1rem; }
#som[aria-pressed="true"] { background: var(--lampada); }

.perigo { background: var(--tomate); color: #2a0d0a; }
.perigo:hover { background: #ff7a64; }

.abertura, .jogo {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(16rem, 22rem) 1fr;
  gap: 0.8rem;
  padding: 0.8rem;
}

.cartaz, .setup, .painel, .casa, .barraca {
  box-shadow: var(--sombra);
}

.cartaz {
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 207, 112, 0.2), transparent 40%),
    var(--noite-2);
  padding: 1.2rem 1.1rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  border-radius: 4px 4px 18px 18px;
}

.frase {
  margin: 0;
  font-family: var(--display);
  font-weight: 680;
  font-size: clamp(1.7rem, 3vw, 2.7rem);
  letter-spacing: -0.03em;
  line-height: 1.08;
  text-wrap: balance;
}

.meta {
  margin: 0.8rem 0 0;
  color: var(--lampada);
  font-weight: 750;
  font-size: 1.05rem;
}

.voz {
  margin: 1rem 0 0;
  font-family: var(--display);
  font-style: italic;
  font-size: 1.35rem;
  color: var(--creme);
}

.setup {
  background: #241910;
  border-radius: 16px;
  padding: 0.8rem;
  overflow: auto;
}

.modos, .setup-acoes, .opcoes, .tipos, .valores { display: flex; flex-wrap: wrap; gap: 0.45rem; }

.modo[aria-pressed="true"], .seg[aria-pressed="true"], .alvo[aria-pressed="true"], .tipos button[aria-pressed="true"], .valores button[aria-pressed="true"] {
  background: var(--lampada);
  color: var(--tinta);
}

.filas { display: grid; gap: 0.55rem; margin-top: 0.7rem; }

.fila {
  display: grid;
  gap: 0.35rem;
  padding: 0.45rem;
  background: #31241c;
  border-radius: 12px;
}

.fila label { display: grid; gap: 0.2rem; font-size: 0.82rem; color: var(--creme); }

.fila input {
  background: var(--papel);
  color: var(--tinta);
  border: 0;
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  font-size: 1rem;
}

.segmentos { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.3rem; }

.seg {
  display: grid;
  justify-items: center;
  gap: 0.1rem;
  padding: 0.3rem 0.1rem;
  border-radius: 10px;
  background: #1b140f;
  min-height: 3.4rem;
}

.seg svg { width: 1.45rem; height: 1.45rem; }
.seg span { font-size: 0.68rem; }

.abrir {
  background: var(--lampada);
  color: var(--tinta);
  font-weight: 750;
  padding: 0.6rem 1rem;
}

.erro { min-height: 1.2rem; color: #ffd0c6; margin: 0.4rem 0 0; }

.jogo {
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr;
  padding-top: 0.45rem;
}

.barracas {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 0.4rem;
}

.barraca {
  background: #2c211a;
  border-radius: 12px;
  padding: 0.35rem 0.5rem 0.45rem;
  min-width: 0;
}

.barraca.vez-agora {
  background: #3c2a16;
  box-shadow: 0 0 0 2px var(--lampada), var(--sombra);
}

.barraca header {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 750;
}

.barraca header svg { width: 1.15rem; height: 1.15rem; flex: none; }
.barraca header strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nums {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.55rem;
  margin-top: 0.15rem;
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem;
  color: var(--creme);
}

.nums b { color: var(--papel); font-weight: 750; }
.nums .ganho { color: var(--folha); }
.nums .crise { color: #ffb1a6; }

.palco {
  container-type: size;
  min-height: 0;
  height: 100%;
  display: grid;
  place-items: center;
}

.tabuleiro, .painel-ancora {
  grid-area: 1 / 1;
  width: min(100cqw, 100cqh);
  height: min(100cqw, 100cqh);
}

.tabuleiro {
  container-type: size;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(7, 1fr);
  gap: 4px;
  padding: 4px;
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 196, 90, 0.12), transparent 46%),
    #140f0c;
  position: relative;
  border-radius: 8px;
}

.casa {
  min-width: 0;
  min-height: 0;
  padding: 0.18rem;
  border-radius: 5px 5px 2px 2px;
  background:
    linear-gradient(180deg, rgba(255, 214, 150, 0.16), transparent 32%),
    repeating-linear-gradient(90deg, #614027 0 2px, #432c1b 2px 6px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.casa .nome {
  font-weight: 750;
  font-size: clamp(0.58rem, 1.35cqw, 0.78rem);
  line-height: 1.05;
  text-wrap: balance;
}

.casa .miudo {
  font-size: clamp(0.52rem, 1.15cqw, 0.68rem);
  color: var(--creme);
}

.casa .tag {
  align-self: flex-start;
  background: var(--lona-clara);
  color: var(--tinta);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  padding: 0.05rem 0.22rem;
  border-radius: 2px;
}

.casa.evento { background: #3a221c; }
.casa.canto { background: #3d2a14; }
.casa.em-alta { box-shadow: inset 0 0 0 2px var(--lampada); }
.casa .dono {
  font-size: 0.58rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.praca {
  grid-column: 2 / 7;
  grid-row: 2 / 7;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.25rem;
  padding: 0.6rem;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 207, 112, 0.2), transparent 36%),
    #1a1410;
  box-shadow: none;
}

.cena { width: min(46%, 9rem); height: auto; }
.quanto {
  margin: 0;
  font-family: var(--display);
  font-style: italic;
  font-size: clamp(0.95rem, 2.2cqw, 1.35rem);
}
.fala-centro {
  margin: 0;
  max-width: 18rem;
  color: var(--creme);
  font-size: clamp(0.75rem, 1.6cqw, 0.95rem);
}

.peoes { position: absolute; inset: 0; pointer-events: none; }

.peao {
  position: absolute;
  width: clamp(1.15rem, 3.2cqw, 1.8rem);
  height: clamp(1.15rem, 3.2cqw, 1.8rem);
  margin: 0;
  border-radius: 50% 50% 42% 42%;
  display: grid;
  place-items: center;
  transform: translate(-50%, -70%);
  box-shadow: 0 8px 12px rgba(0, 0, 0, 0.4);
  color: #1a120c;
  transition: left 0.28s cubic-bezier(0.2, 0.7, 0.2, 1), top 0.28s cubic-bezier(0.2, 0.7, 0.2, 1);
  z-index: 2;
}

.peao svg { width: 70%; height: 70%; }
.peao.snap { transition: none; }

.painel-ancora {
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 3;
}

.painel {
  pointer-events: auto;
  width: 68%;
  max-height: 70%;
  overflow: auto;
  background: var(--papel);
  color: var(--tinta);
  border-radius: 14px;
  padding: 0.75rem 0.8rem 0.85rem;
}

.painel.trato, .painel.fim { width: 78%; max-height: 82%; }

body.andando .painel { visibility: hidden; }

.painel h2 {
  margin: 0 0 0.35rem;
  font-family: var(--display);
  font-size: clamp(1.2rem, 2.4vw, 1.7rem);
  letter-spacing: -0.03em;
  line-height: 1.08;
  text-wrap: balance;
}

.painel p { margin: 0.25rem 0; }

.contador {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.contador strong {
  font-family: var(--display);
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  line-height: 0.9;
}

.aviso { color: #7a2e24; font-weight: 560; }

.ampulheta {
  height: 8px;
  background: #eadcc8;
  border-radius: 99px;
  overflow: hidden;
  margin: 0.3rem 0 0.55rem;
}

.ampulheta span {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--lampada);
  transform-origin: left center;
}

.crise-tempo .ampulheta span { background: var(--tomate); }
.nego-tempo .ampulheta span { background: var(--folha); }

.stories { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.45rem; }

.story {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  min-height: 8.5rem;
  text-align: left;
  border-radius: 12px 12px 8px 8px;
  background:
    linear-gradient(180deg, rgba(255, 207, 112, 0.35), transparent 28%),
    #2a1c14;
  color: var(--papel);
  padding: 0.55rem;
}

.story .anda {
  font-family: var(--display);
  font-size: 2rem;
  line-height: 0.9;
  color: var(--lampada);
}

.story:hover { transform: translateY(-2px); }

.opcoes button, .trata button, .abrir {
  min-height: 2.7rem;
}

.opcoes button, .trata .aceitar {
  background: var(--tinta);
  color: var(--papel);
  border-radius: 12px;
}

.trata {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 0.7rem;
}

.trata h2 { grid-column: 1 / -1; }

.alvos, .pontos-oferta { display: grid; gap: 0.3rem; }

.alvo, .tipos button, .valores button {
  background: #efe4d4;
  color: var(--tinta);
  border-radius: 12px;
  text-align: left;
}

.aceitar { background: var(--folha); color: #14210f; }
.recusar { background: var(--tomate); color: #2a0d0a; }

.poderes { display: flex; gap: 0.35rem; margin-bottom: 0.4rem; }
.poderes button { background: #efe4d4; color: var(--tinta); }
.poderes button[aria-pressed="true"] { background: var(--lampada); }

.fim ol { margin: 0.3rem 0 0; padding-left: 1.1rem; }
.fim li { margin: 0.35rem 0 0.55rem; }
.conta { display: block; color: #5c4634; font-size: 0.86rem; }
.primeiro { font-weight: 750; }

.frase-fim {
  font-family: var(--display);
  font-size: 1.25rem;
  margin: 0.4rem 0;
}

@media (max-width: 860px) {
  .abertura { grid-template-columns: 1fr; overflow: auto; }
  .lona { grid-template-columns: 1fr auto; }
  .jogo { min-height: 70dvh; }
  .segmentos { grid-template-columns: repeat(3, 1fr); }
  .trata { grid-template-columns: 1fr; }
  .painel, .painel.trato, .painel.fim { width: 92%; max-height: 78%; }
}

@media (prefers-reduced-motion: reduce) {
  .peao { transition: none; }
  .story:hover { transform: none; }
}
