/* =========================================================================
   MIMICA ONLINE  -  estilo colorido e divertido, responsivo (mobile-first)
   ========================================================================= */
:root {
  --bg: #1a1530;
  --bg2: #251c45;
  --card: #2e2452;
  --card2: #3a2e66;
  --text: #f5f2ff;
  --muted: #b3a9d6;
  --primary: #ffce33;
  --primary-d: #e6b520;
  --danger: #ff5470;
  --ok: #43e97b;
  --azul: #2196f3;
  --amarelo: #fbc02d;
  --vermelho: #e53935;
  --verde: #43a047;
  --radius: 18px;
  --shadow: 0 8px 24px rgba(0,0,0,.35);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, var(--bg2), var(--bg));
  color: var(--text);
  min-height: 100vh;
  overscroll-behavior: none;
}

/* ---------- telas ---------- */
.screen { display: none; min-height: 100vh; padding: 18px; max-width: 760px; margin: 0 auto; }
.screen.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px);} to {opacity:1; transform:none;} }

.hidden { display: none !important; }
.center { text-align: center; }
.muted { color: var(--muted); font-size: .9rem; }
.error { color: var(--danger); font-weight: 600; min-height: 1.2em; text-align: center; }

/* ---------- home ---------- */
.home-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 26px 22px; margin-top: 6vh;
}
.logo { font-size: 2.3rem; margin: 0 0 4px; text-align: center; font-weight: 800; letter-spacing: -1px; }
.logo span { color: var(--primary); display: block; font-size: 1.4rem; }
.tagline { text-align: center; color: var(--muted); margin: 0 0 22px; }

.field { display: block; margin: 14px 0; }
.field > span { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
input[type=text], input[type=number] {
  width: 100%; padding: 14px 16px; border-radius: 12px; border: 2px solid var(--card2);
  background: var(--bg2); color: var(--text); font-size: 1.05rem; outline: none;
}
input:focus { border-color: var(--primary); }
.code-input { text-transform: uppercase; letter-spacing: 8px; text-align: center; font-weight: 700; font-size: 1.5rem; }

.divider { text-align: center; color: var(--muted); margin: 20px 0; position: relative; font-size: .8rem; }
.divider::before, .divider::after {
  content:""; position:absolute; top:50%; width:30%; height:1px; background: var(--card2);
}
.divider::before { left: 0; } .divider::after { right: 0; }

/* ---------- botoes ---------- */
.btn {
  width: 100%; padding: 15px; border: none; border-radius: 14px; font-size: 1.05rem;
  font-weight: 700; cursor: pointer; background: var(--card2); color: var(--text);
  transition: transform .08s, filter .15s; margin: 8px 0; box-shadow: var(--shadow);
}
.btn:active { transform: scale(.97); }
.btn-big { padding: 17px; font-size: 1.15rem; }
.btn-primary { background: var(--primary); color: #2a1d00; }
.btn-primary:disabled { filter: grayscale(.6) opacity(.6); cursor: default; }
.btn-ok { background: var(--ok); color: #043017; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; border: 2px solid var(--card2); box-shadow: none; }

/* ---------- topbar / lobby ---------- */
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.room-code { font-size: 1.1rem; }
.room-code strong { color: var(--primary); letter-spacing: 4px; font-size: 1.4rem; }
.hint { color: var(--muted); font-size: .82rem; }
.section-title { font-size: 1.05rem; margin: 18px 0 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }

.team-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.team-btn {
  padding: 18px; border-radius: 14px; border: 3px solid transparent; font-weight: 800;
  font-size: 1.1rem; cursor: pointer; color: #fff; opacity: .85; position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.team-btn small { font-weight: 600; font-size: .8rem; opacity: .9; }
.team-btn[data-team=azul]     { background: var(--azul); }
.team-btn[data-team=amarelo]  { background: var(--amarelo); color: #3a2c00; }
.team-btn[data-team=vermelho] { background: var(--vermelho); }
.team-btn[data-team=verde]    { background: var(--verde); }
.team-btn.selected { border-color: #fff; opacity: 1; transform: scale(1.03); box-shadow: var(--shadow); }

.players-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.player-chip {
  background: var(--card2); padding: 8px 12px; border-radius: 20px; font-weight: 600; font-size: .92rem;
  display: flex; align-items: center; gap: 7px;
}
.player-chip .dot { width: 11px; height: 11px; border-radius: 50%; background: #888; }
.player-chip.ready { outline: 2px solid var(--ok); }
.player-chip .host-tag { font-size: .68rem; background: var(--primary); color:#2a1d00; padding: 1px 6px; border-radius: 8px; font-weight: 800; }

.config-box { background: var(--card); border-radius: var(--radius); padding: 16px; margin: 18px 0; }
.config-box h3 { margin: 0 0 12px; font-size: 1rem; }
.config-box small { color: var(--muted); font-weight: 400; }
.cfg { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 10px 0; font-size: .92rem; }
.cfg input { width: 90px; padding: 9px; }

.lobby-actions { margin-top: 10px; }

/* ---------- barra do jogador (sempre visivel) ---------- */
.me-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 16px; border-radius: 14px; margin-bottom: 12px; box-shadow: var(--shadow);
  font-weight: 800;
}
.me-bar .me-name { font-size: 1.05rem; }
.me-bar .me-team { font-size: .82rem; font-weight: 700; opacity: .92;
  background: rgba(0,0,0,.18); padding: 4px 10px; border-radius: 20px; }

/* ---------- placar ---------- */
.scoreboard { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.score-chip { padding: 6px 12px; border-radius: 20px; font-weight: 700; font-size: .88rem; color:#fff;
  box-shadow: var(--shadow); }
.score-chip b { font-size: 1.05rem; }

/* ---------- tabuleiro ---------- */
.board {
  display: flex; flex-wrap: wrap; gap: 6px;
  background: linear-gradient(160deg, #2b2150, #1d1640);
  border: 2px solid #3a2e66; border-radius: var(--radius);
  padding: 14px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.cell {
  flex: 1 1 auto; min-width: 32px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  position: relative; box-shadow: inset 0 -3px 0 rgba(0,0,0,.18), 0 1px 2px rgba(0,0,0,.3);
}
.cell .cell-num {
  font-size: .68rem; font-weight: 800; color: rgba(0,0,0,.5);
}
.cell.milestone { outline: 2px dashed rgba(255,255,255,.7); outline-offset: -3px; }
.cell.start, .cell.finish {
  min-width: 44px; background: #fff; box-shadow: 0 0 0 3px var(--primary), 0 2px 5px rgba(0,0,0,.4);
}
.cell.start .cell-num, .cell.finish .cell-num { font-size: 1.2rem; color: #1a1530; }

.pawn {
  position: absolute; width: 17px; height: 17px; border-radius: 50%; border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center;
  font-size: .6rem; font-weight: 900; color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,.5);
}
.pawn.azul { background: var(--azul); } .pawn.amarelo { background: var(--amarelo); color:#3a2c00; text-shadow:none;}
.pawn.vermelho { background: var(--vermelho); } .pawn.verde { background: var(--verde); }

/* posiciona ate 4 peoes dentro da casa */
.pawn.p0 { top: 2px; left: 2px; } .pawn.p1 { top: 2px; right: 2px; }
.pawn.p2 { bottom: 2px; left: 2px; } .pawn.p3 { bottom: 2px; right: 2px; }

/* ---------- controles do anfitriao ---------- */
.host-controls { margin-top: 18px; }
.btn-ghost-light {
  background: transparent; border: 2px solid var(--danger); color: var(--danger);
  box-shadow: none; font-weight: 700;
}
.btn-ghost-light:active { background: rgba(255,84,112,.12); }

/* ---------- banner do turno ---------- */
.turn-banner {
  text-align: center; padding: 14px; border-radius: var(--radius); font-weight: 800;
  font-size: 1.15rem; margin-bottom: 12px; box-shadow: var(--shadow); line-height: 1.4;
}
.turn-banner small { display:block; font-weight: 600; font-size: .82rem; opacity: .9; margin-top: 3px; }

/* ---------- area do turno ---------- */
.turn-area { display: flex; flex-direction: column; gap: 10px; }
.big-info { text-align: center; padding: 26px 16px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.big-info .emoji { font-size: 3rem; display: block; margin-bottom: 8px; }
.big-info p { margin: 6px 0; }

.timer-display { font-size: 3.4rem; font-weight: 800; text-align: center; letter-spacing: 2px; }
.timer-display.low { color: var(--danger); animation: pulse .5s infinite alternate; }
@keyframes pulse { from { transform: scale(1);} to { transform: scale(1.08);} }

.counter-badge { text-align:center; font-size: 1rem; color: var(--muted); }
.counter-badge b { color: var(--primary); font-size: 1.5rem; }

/* ---------- carta (mimico) ---------- */
.card-zone { margin-top: 8px; }
.mimic-card {
  background: #fffefb; color: #1a1530; border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow); border: 4px solid var(--primary);
}
.card-progress { text-align: center; color: #6a5d8a; font-size: .82rem; margin-bottom: 12px; font-weight: 700; }
.word-row {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 12px; margin: 7px 0;
  background: #f1ecff; opacity: .45; font-size: 1.05rem;
}
.word-row.done { opacity: .35; text-decoration: line-through; }
.word-row.current { opacity: 1; background: #fff6d6; outline: 3px solid var(--primary); transform: scale(1.02); }
.word-row .wletter {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 8px; color: #fff;
  font-weight: 900; font-size: 1.1rem; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.word-row .wtxt { font-weight: 800; flex: 1; }
.word-row .wlabel { font-size: .7rem; color: #7a6da0; display:block; font-weight: 600; }

.mimic-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.mimic-actions .btn { margin: 0; }
.mimic-actions .full { grid-column: 1 / -1; }
/* botoes secundarios sobre o fundo branco da carta: texto escuro e borda visivel */
.mimic-actions .btn-ghost {
  background: #efeaff; color: #2e2452; border: 2px solid #c9bdf0; box-shadow: none; font-weight: 700;
}
.mimic-actions .btn-ghost:active { background: #e2d9ff; }

/* ---------- toast resultado ---------- */
.result-toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  background: var(--card); padding: 14px 22px; border-radius: 16px; box-shadow: var(--shadow);
  font-weight: 700; z-index: 50; border: 2px solid var(--primary); text-align: center;
}

/* ---------- fim ---------- */
.final-board { margin: 18px 0; display: flex; flex-direction: column; gap: 8px; }
.final-row { display: flex; justify-content: space-between; padding: 12px 16px; border-radius: 12px; color:#fff; font-weight: 700; }

@media (min-width: 620px) {
  .team-picker { grid-template-columns: repeat(4, 1fr); }
}
