* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #12121c;
  --card: #1e1e2e;
  --text: #f0f0f5;
  --muted: #8b8ba3;
  --accent: #7c5cff;
  --green: #2ecc71;  --green-hi: #7dffb0;
  --red: #e74c3c;    --red-hi: #ff9d92;
  --yellow: #f1c40f; --yellow-hi: #ffe98a;
  --blue: #3498db;   --blue-hi: #8fd0ff;
}

html, body { height: 100%; }
body {
  background: radial-gradient(1100px 700px at 50% -15%, #221d44 0%, var(--bg) 62%) fixed var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
}

.screen { display: none; width: 100%; max-width: 520px; padding: 24px 16px; flex-direction: column; align-items: center; gap: 16px; }
.screen.active { display: flex; animation: screenin 0.3s ease; }
@keyframes screenin { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.hidden { display: none !important; }

/* -------- início -------- */
.logo { font-size: 2.3rem; text-align: center; margin-top: 7vh; text-shadow: 0 4px 30px rgba(124, 92, 255, 0.45); }
.logo span { color: var(--accent); }
.tagline { color: var(--muted); text-align: center; }

.card {
  background: var(--card);
  border: 1px solid #2c2c44;
  border-radius: 18px;
  padding: 22px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 0.85rem; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: #33334d; }

input {
  background: #12121c;
  border: 2px solid #33334d;
  border-radius: 10px;
  color: var(--text);
  font-size: 1.1rem;
  padding: 12px 14px;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
}
input:focus { border-color: var(--accent); }
#inp-code { text-transform: uppercase; letter-spacing: 0.3em; text-align: center; font-weight: 700; }

.join-row { display: flex; gap: 8px; }
.join-row input { flex: 1; }

.btn {
  background: #33334d;
  border: none;
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
  font-size: 1.05rem;
  font-weight: 600;
  padding: 12px 18px;
  transition: transform 0.06s, filter 0.15s;
  touch-action: manipulation;
}
.btn:active { transform: scale(0.96); }
.btn:hover { filter: brightness(1.15); }
.btn.primary { background: linear-gradient(135deg, var(--accent), #5a3fd6); }
.btn.big { font-size: 1.25rem; padding: 16px 28px; }
.btn.small { font-size: 0.9rem; padding: 8px 14px; }
.btn.pulse { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(124, 92, 255, 0.55); }
  50% { box-shadow: 0 0 0 14px rgba(124, 92, 255, 0); }
}

.corner-btn {
  position: fixed;
  top: 12px;
  z-index: 60;
  width: 42px;
  height: 42px;
  border: 1px solid #2c2c44;
  border-radius: 50%;
  background: var(--card);
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.06s;
}
.corner-btn:active { transform: scale(0.9); }
.corner-right { right: 12px; font-size: 1.15rem; }
.corner-left { left: 12px; }

.topwrap { width: 100%; }
.streak-line { color: gold; font-weight: 700; text-align: center; min-height: 1.2em; }
.chip.off { opacity: 0.55; }
.chip.off::after { content: " 📴"; }

.error { color: #ff8a80; min-height: 1.2em; text-align: center; }
.muted { color: var(--muted); text-align: center; min-height: 1.2em; }

/* -------- lobby -------- */
.code { color: var(--accent); letter-spacing: 0.2em; font-family: ui-monospace, monospace; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; width: 100%; }
.chip {
  background: var(--card);
  border: 1px solid #2c2c44;
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: opacity 0.3s;
  animation: chipin 0.25s ease;
}
@keyframes chipin { from { opacity: 0; transform: scale(0.7); } to { opacity: 1; transform: none; } }
.chip .prog { color: var(--muted); font-size: 0.85em; font-variant-numeric: tabular-nums; }
.chip.dead { opacity: 0.45; text-decoration: line-through; }
.chip.dead .prog { text-decoration: none; }
.chip.done { outline: 2px solid var(--green); }
.chip.me { outline: 2px solid var(--accent); }
.chip.me.done { outline: 2px solid var(--green); }
.chips.slim .chip { padding: 5px 10px; font-size: 0.85rem; }

/* -------- tabuleiro -------- */
.board-wrap { width: min(88vw, 400px, 52vh); filter: drop-shadow(0 18px 50px rgba(0, 0, 0, 0.45)); }
.board {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  grid-template: 1fr 1fr / 1fr 1fr;
  gap: 12px;
}
.board.shake { animation: shake 0.45s; }
@keyframes shake {
  0%, 100% { transform: none; }
  20% { transform: translateX(-12px) rotate(-1deg); }
  40% { transform: translateX(10px) rotate(1deg); }
  60% { transform: translateX(-7px); }
  80% { transform: translateX(4px); }
}

.pad {
  border: none;
  border-radius: 24px;
  cursor: pointer;
  transition: filter 0.08s, transform 0.08s;
  filter: brightness(0.5);
  background-image: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.3), transparent 62%);
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  user-select: none;
}
.pad-0 { background-color: var(--green);  border-top-left-radius: 46%; }
.pad-1 { background-color: var(--red);    border-top-right-radius: 46%; }
.pad-2 { background-color: var(--yellow); border-bottom-left-radius: 46%; }
.pad-3 { background-color: var(--blue);   border-bottom-right-radius: 46%; }

.sym { font-size: clamp(1.2rem, 6vw, 1.9rem); color: rgba(0, 0, 0, 0.28); pointer-events: none; }

/* sua vez: pads "armados" ficam mais visíveis */
.board.armed .pad:not(:disabled) { filter: brightness(0.8); }

.pad.lit, .board.armed .pad.lit, .pad:active:not(:disabled) { filter: brightness(1.3); transform: scale(0.96); }
.pad.lit.pad-0 { box-shadow: 0 0 44px var(--green-hi); }
.pad.lit.pad-1 { box-shadow: 0 0 44px var(--red-hi); }
.pad.lit.pad-2 { box-shadow: 0 0 44px var(--yellow-hi); }
.pad.lit.pad-3 { box-shadow: 0 0 44px var(--blue-hi); }
.pad:disabled { cursor: default; }

.hub {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 34%;
  height: 34%;
  background: var(--bg);
  border: 6px solid var(--card);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.hub-round { font-size: clamp(1.6rem, 8vw, 2.6rem); font-weight: 800; }
.hub-label { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }

.status { min-height: 1.6em; font-size: 1.15rem; font-weight: 600; text-align: center; }

.dots { display: flex; gap: 6px; min-height: 12px; flex-wrap: wrap; justify-content: center; max-width: 90%; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: #33334d; transition: background 0.1s, transform 0.1s; }
.dot.on { background: var(--green); transform: scale(1.2); }

.timebar-wrap { width: min(88vw, 400px); height: 8px; background: #33334d; border-radius: 4px; overflow: hidden; }
.timebar { height: 100%; width: 100%; background: var(--green); transform-origin: left; }
.timebar.run { animation: shrink linear forwards, heat linear forwards; }
@keyframes shrink { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes heat {
  0% { background: var(--green); }
  55% { background: var(--yellow); }
  100% { background: var(--red); }
}

.key-hint { display: none; color: var(--muted); font-size: 0.85rem; }
@media (hover: hover) and (pointer: fine) { .key-hint { display: block; } }

/* -------- flash de rodada -------- */
.round-flash {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(2.4rem, 11vw, 4rem);
  font-weight: 900;
  text-shadow: 0 6px 40px rgba(124, 92, 255, 0.8);
  pointer-events: none;
  z-index: 40;
  opacity: 0;
}
.round-flash.go { animation: roundflash 1s ease forwards; }
@keyframes roundflash {
  0% { opacity: 0; transform: scale(0.4); }
  18% { opacity: 1; transform: scale(1.12); }
  32% { transform: scale(1); }
  72% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.06); }
}

/* -------- overlays -------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 18, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  animation: fadein 0.25s;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.overlay-card {
  background: var(--card);
  border: 1px solid #2c2c44;
  border-radius: 20px;
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  text-align: center;
  max-width: 90vw;
}
.skull { font-size: 4rem; animation: drop 0.5s cubic-bezier(0.3, 1.6, 0.6, 1); }
@keyframes drop { from { transform: translateY(-60px) scale(0.3); opacity: 0; } to { transform: none; opacity: 1; } }

/* -------- ranking -------- */
.ranking { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.rank-row {
  background: var(--card);
  border: 1px solid #2c2c44;
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  animation: rankin 0.35s ease backwards;
}
@keyframes rankin { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }
.rank-row .medal { font-size: 1.4rem; width: 2rem; text-align: center; }
.rank-row.first .medal { animation: bounce 1.2s ease infinite; }
@keyframes bounce { 0%, 100% { transform: none; } 30% { transform: translateY(-6px) scale(1.15); } }
.rank-row .rname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row .rround { color: var(--muted); font-size: 0.9rem; }
.rank-row.first { outline: 2px solid gold; }
.rank-row.me { background: #2a2a44; }

/* -------- reações -------- */
.react-bar { display: flex; gap: 10px; justify-content: center; }
.react-btn {
  background: var(--card);
  border: 1px solid #2c2c44;
  border-radius: 50%;
  width: 46px;
  height: 46px;
  font-size: 1.35rem;
  cursor: pointer;
  transition: transform 0.08s;
  touch-action: manipulation;
}
.react-btn:active { transform: scale(1.3); }
.react-btn:disabled { opacity: 0.5; }

.float-emoji {
  position: fixed;
  bottom: 90px;
  z-index: 45;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: floatup 2.4s ease-out forwards;
}
.float-emoji .fe { font-size: 2.1rem; }
.float-emoji .fn { font-size: 0.7rem; color: var(--text); font-weight: 700; text-shadow: 0 1px 4px #000; }
@keyframes floatup {
  0% { opacity: 0; transform: translateY(0) scale(0.6); }
  12% { opacity: 1; transform: translateY(-14px) scale(1.15); }
  100% { opacity: 0; transform: translateY(-48vh) scale(1); }
}

/* -------- top 10 solo -------- */
.section-title { text-align: center; margin-bottom: 8px; font-size: 1.05rem; }
.solotop { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.solo-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid #2c2c44;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.95rem;
  font-weight: 600;
}
.solo-row .pos { width: 1.9rem; text-align: center; }
.solo-row .sname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.solo-row .sround { color: var(--muted); font-size: 0.85rem; }
.solo-row.me { outline: 2px solid var(--accent); }

/* -------- sala pública / morte súbita -------- */
.pub-tag {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--green);
  border: 1px solid var(--green);
  border-radius: 999px;
  padding: 3px 8px;
  vertical-align: middle;
}
.timebar.run.sudden { animation: shrink linear forwards; background: var(--red); }
.round-flash.sudden { color: #ff6b5e; text-shadow: 0 6px 40px rgba(231, 76, 60, 0.8); }

/* -------- confete -------- */
.confetti-piece {
  position: fixed;
  top: -14px;
  width: 10px;
  height: 14px;
  border-radius: 2px;
  z-index: 90;
  pointer-events: none;
  animation: confetti linear forwards;
}
@keyframes confetti { to { transform: translateY(108vh) rotate(740deg); opacity: 0.7; } }

/* -------- rodapé (conteúdo indexável) -------- */
.seo-footer { color: var(--muted); font-size: 0.88rem; line-height: 1.55; padding: 24px 4px 40px; width: 100%; }
.seo-footer h2 { color: var(--text); font-size: 1rem; margin: 18px 0 6px; }
.seo-footer ol { padding-left: 1.3em; display: flex; flex-direction: column; gap: 4px; }
.seo-footer strong { color: var(--text); }

/* -------- toast -------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  padding: 10px 20px;
  border-radius: 999px;
  font-weight: 600;
  z-index: 100;
  animation: fadein 0.2s;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

@media (prefers-reduced-motion: reduce) {
  /* barra de tempo (.timebar) fica de fora: é informação, não enfeite */
  *:not(.timebar), *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
