/* Minijogos: escolha de jogo, tela de jogo, linha do tempo, perguntas e resultado.
   Paleta: verde da floresta, urucum e ocre. Cada jogo tem sua cor de destaque. */

.is-minigames {
  --mg-forest: #183d2b;
  --mg-forest-2: #2f6b4f;
  --mg-leaf: #dcece2;
  --mg-urucum: #b8432b;
  --mg-ochre: #d9a441;
  --mg-cream: #fbf7ec;
  --mg-paper: #ffffff;
  --mg-line: #e3dccb;
  --mg-ink: #1d2f25;
  --mg-muted: #5b6f63;
}

.mg { padding-top: 4px; padding-bottom: 64px; }

/* ---------- Tela de escolha ---------- */
.mg-hub { display: grid; grid-template-columns: 1fr; gap: 18px; }
.mg-game {
  position: relative; overflow: hidden; text-align: left; cursor: pointer;
  display: flex; flex-direction: column; gap: 10px; padding: 26px 24px 22px;
  border-radius: 28px; border: 1px solid var(--mg-line); background: var(--mg-paper);
  box-shadow: 0 22px 40px -30px oklch(20% 0.05 152 / .55); font: inherit; color: var(--mg-ink);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.mg-game::before {
  /* faixa de grafismo amazônico (zigue-zague) no topo do cartão */
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 10px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='10' viewBox='0 0 16 10'%3E%3Cpath d='M0 9 L4 1 L8 9 L12 1 L16 9' stroke='%23b8432b' stroke-width='1.6' fill='none'/%3E%3C/svg%3E") repeat-x left top / auto 10px;
  opacity: .9;
}
.mg-game:hover { transform: translateY(-4px); box-shadow: 0 30px 48px -30px oklch(20% 0.05 152 / .65); }
.mg-game:focus-visible { outline: 3px solid var(--mg-ochre); outline-offset: 3px; }
.mg-game__icon {
  width: 68px; height: 68px; border-radius: 22px; display: grid; place-items: center;
  font-size: 34px; background: var(--mg-leaf); margin-top: 6px;
}
.mg-game__title { font-size: 22px; font-weight: 800; line-height: 1.2; }
.mg-game__text { font-size: 15px; line-height: 1.5; color: var(--mg-muted); }
.mg-game__meta {
  margin-top: auto; padding-top: 8px; display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; font-weight: 800; color: var(--mg-muted); letter-spacing: .02em;
}
.mg-game__go { color: var(--mg-forest-2); }

.mg-game--timeline .mg-game__icon { background: #dcece2; }
.mg-game--origin .mg-game__icon { background: #f6dfd6; }
.mg-game--origin::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='10' viewBox='0 0 16 10'%3E%3Cpath d='M0 9 L4 1 L8 9 L12 1 L16 9' stroke='%232f6b4f' stroke-width='1.6' fill='none'/%3E%3C/svg%3E"); }
.mg-game--truefalse .mg-game__icon { background: #f7ecd2; }
.mg-game--truefalse::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='10' viewBox='0 0 16 10'%3E%3Cpath d='M0 9 L4 1 L8 9 L12 1 L16 9' stroke='%23d9a441' stroke-width='1.6' fill='none'/%3E%3C/svg%3E"); }

@media (min-width: 720px) { .mg-hub { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---------- Tela de jogo: topo, pontos e palco ---------- */
.mg-play { display: flex; flex-direction: column; gap: 16px; }
.mg-play[hidden], .mg-hub[hidden] { display: none; }
.mg-play__top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.mg-back {
  min-height: 40px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--mg-line);
  background: #fff; font: inherit; font-weight: 800; font-size: 14px; color: var(--mg-forest); cursor: pointer;
}
.mg-back:hover { border-color: var(--mg-forest-2); }
.mg-hud { display: flex; gap: 8px; flex-wrap: wrap; }
.mg-hud__pill {
  display: inline-flex; align-items: center; min-height: 40px; padding: 8px 14px; border-radius: 999px;
  background: var(--mg-leaf); color: var(--mg-forest); font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums;
}
.mg-hud__pill--score { background: var(--mg-forest); color: var(--mg-ochre); }

.mg-dots { display: flex; gap: 8px; flex-wrap: wrap; }
.mg-dot {
  width: 14px; height: 14px; border-radius: 50%; background: #e9e4d6; border: 2px solid #d9d2bd;
  transition: background .3s ease, transform .3s ease;
}
.mg-dot.is-ok { background: var(--mg-forest-2); border-color: var(--mg-forest-2); transform: scale(1.1); }
.mg-dot.is-bad { background: var(--mg-urucum); border-color: var(--mg-urucum); }

.mg-stage {
  position: relative; min-height: 360px; border-radius: 28px; padding: clamp(16px, 3vw, 28px);
  background-color: var(--mg-cream);
  background-image:
    repeating-linear-gradient(0deg, oklch(70% 0.09 78 / .16) 0 2px, transparent 2px 10px),
    repeating-linear-gradient(90deg, oklch(70% 0.09 78 / .16) 0 2px, transparent 2px 10px);
  border: 1px solid var(--mg-line);
}
.mg-enter { animation: mg-in .35s ease both; }
@keyframes mg-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Linha do tempo ---------- */
.mg-tl { display: grid; grid-template-columns: 1fr; gap: 22px; }
.mg-tl__track { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; position: relative; }
.mg-tl__track::before {
  content: ''; position: absolute; left: 22px; top: 22px; bottom: 22px; width: 4px; border-radius: 4px;
  background: transparent;
}
.mg-slot { position: relative; display: flex; gap: 14px; align-items: stretch; min-height: 60px; }
.mg-slot__num {
  position: relative; z-index: 1; flex: 0 0 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: var(--mg-paper); border: 3px solid var(--mg-forest-2); color: var(--mg-forest); font-weight: 800; font-size: 16px;
}
.mg-slot__empty {
  flex: 1; display: grid; place-items: center; border-radius: 18px; border: 2px dashed #c9bfa3;
  color: #b1a68a; font-size: 26px; font-weight: 800; background: rgba(255, 255, 255, .55);
}
.mg-slot.is-filled .mg-slot__num { background: var(--mg-forest-2); color: #fff; }
.mg-slot__box {
  flex: 1; display: flex; gap: 12px; align-items: center;
  padding: 12px 16px; border-radius: 18px; background: var(--mg-paper); border: 1px solid #cfe2d6;
  box-shadow: 0 10px 20px -16px oklch(20% 0.05 152 / .6);
  animation: mg-pop .5s cubic-bezier(.2, .9, .3, 1.3) both;
}
@keyframes mg-pop { from { opacity: 0; transform: scale(.9) translateX(-8px); } to { opacity: 1; transform: none; } }
.mg-slot__year { flex: 0 0 auto; min-width: 58px; font-size: 20px; font-weight: 800; color: var(--mg-forest); }
.mg-slot__icon { flex: 0 0 auto; font-size: 26px; line-height: 1; }
.mg-slot__text { flex: 1; font-size: 15px; line-height: 1.4; color: var(--mg-ink); }

.mg-tl__pool { display: flex; flex-direction: column; gap: 12px; }
.mg-tl__hint { margin: 0; font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--mg-muted); }
.mg-pool { display: flex; flex-direction: column; gap: 10px; }
.mg-fact {
  display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; text-align: left; cursor: pointer;
  padding: 14px 16px; border-radius: 18px; border: 2px solid var(--mg-line); background: var(--mg-paper);
  font: inherit; color: var(--mg-ink); transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.mg-fact:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--mg-forest-2); box-shadow: 0 12px 22px -16px oklch(20% 0.05 152 / .7); }
.mg-fact:focus-visible { outline: 3px solid var(--mg-ochre); outline-offset: 2px; }
.mg-fact__icon { font-size: 26px; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; background: var(--mg-leaf); }
.mg-fact__text { font-size: 15px; line-height: 1.4; }
.mg-fact.is-used { opacity: .35; pointer-events: none; }
.mg-fact.is-shake { animation: mg-shake .45s; border-color: var(--mg-urucum); }
@keyframes mg-shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }

.mg-toast { margin: 0; min-height: 1.5em; font-size: 15px; font-weight: 800; text-align: center; }
.mg-toast.is-good { color: var(--mg-forest-2); }
.mg-toast.is-bad { color: #a4372b; }

@media (min-width: 900px) {
  .mg-tl { grid-template-columns: 1fr 1fr; gap: 30px; align-items: start; }
}

/* ---------- Perguntas ---------- */
.mg-q { display: flex; flex-direction: column; gap: 18px; }
.mg-q__head { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; }
.mg-q__icon {
  width: 84px; height: 84px; border-radius: 28px; display: grid; place-items: center; font-size: 42px;
  background: var(--mg-paper); border: 2px solid var(--mg-line); box-shadow: 0 14px 24px -18px oklch(20% 0.05 152 / .7);
}
.mg-q__prompt { margin: 0; font-size: clamp(18px, 2.4vw, 22px); line-height: 1.45; font-weight: 800; color: var(--mg-ink); }
.mg-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.mg-option {
  display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 104px; padding: 16px 12px;
  border-radius: 22px; border: 2px solid var(--mg-line); background: var(--mg-paper); cursor: pointer;
  font: inherit; color: var(--mg-ink); transition: transform .15s ease, border-color .15s ease, background .2s ease;
}
.mg-option:hover:not(:disabled) { transform: translateY(-3px); border-color: var(--mg-forest-2); }
.mg-option:focus-visible { outline: 3px solid var(--mg-ochre); outline-offset: 2px; }
.mg-option:disabled { cursor: default; }
.mg-option__icon { font-size: 30px; line-height: 1; }
.mg-option__label { font-size: 16px; font-weight: 800; }
.mg-option.is-right { background: #e4f2e9; border-color: var(--mg-forest-2); color: var(--mg-forest); animation: mg-bump .4s ease; }
.mg-option.is-wrong { background: #fbe7e2; border-color: var(--mg-urucum); color: #7a261d; animation: mg-shake .45s; }
@keyframes mg-bump { 0% { transform: scale(1); } 50% { transform: scale(1.04); } 100% { transform: scale(1); } }

.mg-answer {
  display: flex; flex-direction: column; gap: 10px; padding: 18px; border-radius: 22px;
  animation: mg-in .35s ease both;
}
.mg-answer.is-good { background: #e4f2e9; border: 1px solid #b9d9c4; }
.mg-answer.is-bad { background: #fbeee9; border: 1px solid #efc5b6; }
.mg-answer__verdict { font-size: 17px; font-weight: 800; }
.mg-answer.is-good .mg-answer__verdict { color: var(--mg-forest); }
.mg-answer.is-bad .mg-answer__verdict { color: #7a261d; }
.mg-answer__text { margin: 0; font-size: 15px; line-height: 1.5; color: var(--mg-ink); }
.mg-answer .mg-btn { align-self: flex-start; }

/* ---------- Botões ---------- */
.mg-btn {
  min-height: 46px; padding: 10px 20px; border-radius: 999px; border: 0; font: inherit; font-weight: 800; font-size: 15px; cursor: pointer;
}
.mg-btn--primary { background: var(--mg-forest); color: #fff; }
.mg-btn--primary:hover { background: var(--mg-forest-2); }
.mg-btn--ghost { background: #fff; color: var(--mg-forest); border: 1px solid var(--mg-line); }
.mg-btn:focus-visible { outline: 3px solid var(--mg-ochre); outline-offset: 2px; }

/* ---------- Resultado ---------- */
.mg-result { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 14px 6px; animation: mg-in .45s ease both; }
.mg-result__icon { font-size: 64px; line-height: 1; }
.mg-result__title { margin: 6px 0 0; font-size: clamp(22px, 3vw, 30px); font-weight: 800; color: var(--mg-forest); }
.mg-stars { display: flex; gap: 8px; margin: 6px 0; }
.mg-star { font-size: 44px; line-height: 1; color: #d6cfb8; }
.mg-star.is-on { color: var(--mg-ochre);  animation: mg-star .6s cubic-bezier(.2, .9, .3, 1.4) both; }
@keyframes mg-star { from { transform: scale(.4) rotate(-20deg); opacity: 0; } to { transform: none; opacity: 1; } }
.mg-result__score { margin: 0; font-weight: 800; color: var(--mg-muted); }
.mg-result__text { margin: 0; max-width: 46ch; font-size: 16px; line-height: 1.5; color: var(--mg-ink); }
.mg-result__actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }

/* ---------- Celular ---------- */
@media (max-width: 560px) {
  .mg-game { padding: 22px 18px 18px; }
  .mg-stage { min-height: 300px; border-radius: 22px; }
  .mg-q__head { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .mg-options { grid-template-columns: 1fr 1fr; }
  .mg-option { min-height: 92px; }
  .mg-slot__num { flex-basis: 38px; height: 38px; font-size: 14px; }
  .mg-tl__track::before { left: 18px; }
  .mg-slot__year { min-width: 48px; font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Ícones SVG e história da fase ---------- */
.mg-game__icon img { width: 56px; height: 56px; display: block; }
.mg-fact__icon { width: 52px; height: 52px; padding: 6px; box-sizing: border-box; }
.mg-fact__icon, .mg-slot__icon { display: block; }
.mg-slot__icon { width: 44px; height: 44px; }
.mg-q__icon { width: 84px; height: 84px; padding: 14px; box-sizing: border-box; }
.mg-option__icon { width: 44px; height: 44px; }
.mg-empty { margin: 0; padding: 28px; text-align: center; font-weight: 800; color: var(--mg-muted); background: #fff; border: 1px dashed var(--mg-line); border-radius: 22px; }

.mg-history {
  display: flex; flex-direction: column; gap: 6px; margin-top: 14px; padding: 14px 16px;
  border-radius: 18px; background: #fffdf6; border: 1px solid var(--mg-ochre); animation: mg-in .35s ease both;
}
.mg-history__title { font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--mg-urucum); }
.mg-history__year { display: inline-block; margin-right: 6px; font-weight: 800; color: var(--mg-forest-2); }
.mg-history__text { margin: 0; font-size: 15px; line-height: 1.55; color: var(--mg-ink); }
.mg-tl__history { min-height: 0; }

/* ---------- Rodadas da linha do tempo ---------- */
.mg-round { display: flex; flex-direction: column; gap: 4px; margin-bottom: 18px; }
.mg-round__name { font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--mg-urucum); }
.mg-round__prompt { margin: 0; font-size: clamp(17px, 2.2vw, 20px); font-weight: 800; color: var(--mg-ink); }
.mg-round__done { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.mg-round__done .mg-history { width: 100%; box-sizing: border-box; }
.mg-round__done .mg-btn { align-self: flex-start; }

/* ---------- Ranking, histórico e moedas ---------- */
.mg-board { margin-top: 36px; display: flex; flex-direction: column; gap: 18px; }
.mg-board__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.mg-board__title { margin: 0; font-size: clamp(20px, 2.6vw, 26px); color: var(--mg-forest); }
.mg-coins { display: inline-flex; gap: 6px; align-items: center; padding: 8px 14px; border-radius: 999px; background: var(--mg-ochre); color: var(--mg-ink); font-weight: 700; }
.mg-board__grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 900px) { .mg-board__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.mg-rank { background: #fff; border: 1px solid var(--mg-line); border-radius: 22px; padding: 18px; }
.mg-rank__title { margin: 0 0 10px; font-size: 17px; color: var(--mg-forest); }
.mg-rank__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.mg-rank__list li { display: grid; grid-template-columns: 28px 1fr auto; gap: 2px 10px; align-items: center; padding: 8px 10px; border-radius: 12px; background: var(--mg-cream); }
.mg-rank__pos { grid-row: span 2; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--mg-leaf); color: var(--mg-forest); font-weight: 800; font-size: 13px; }
.mg-rank__list li:nth-child(1) .mg-rank__pos { background: var(--mg-ochre); }
.mg-rank__nick { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mg-rank__score { font-weight: 800; color: var(--mg-forest-2); font-variant-numeric: tabular-nums; }
.mg-rank__meta { grid-column: 2 / 4; font-size: 12px; color: var(--mg-muted); }
.mg-rank__empty { margin: 0; color: var(--mg-muted); font-size: 14px; line-height: 1.5; }
.mg-rank__empty a { color: var(--mg-forest-2); font-weight: 700; }
.mg-history-box { background: #fff; border: 1px solid var(--mg-line); border-radius: 22px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.mg-history-box__hint { margin: 0; font-size: 13px; color: var(--mg-muted); }
.mg-table-wrap { overflow-x: auto; }
.mg-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.mg-table th, .mg-table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--mg-line); white-space: nowrap; }
.mg-table th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--mg-muted); }
.mg-saved { margin: 4px 0 0; padding: 12px 14px; border-radius: 16px; background: #fff7e0; border: 1px solid var(--mg-ochre); font-size: 14px; line-height: 1.5; }
.mg-saved a { color: var(--mg-forest-2); font-weight: 700; }
.mg-coins__dot { width: 16px; height: 16px; border-radius: 50%; background: #fff6c9; border: 2px solid #8a5a2b; display: inline-block; }
#ranking { scroll-margin-top: 90px; }

/* ---------- Dicas da loja nos minijogos ---------- */
.mg-hint-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.mg-hint {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--mg-ochre); background: #fff7e0; color: var(--mg-ink); font: inherit; font-weight: 800; font-size: 14px; cursor: pointer;
}
.mg-hint:disabled { opacity: .5; cursor: not-allowed; }
.mg-hint:not(:disabled):hover { background: #fdeebd; }
.mg-hint:focus-visible { outline: 3px solid var(--mg-urucum); outline-offset: 2px; }
.mg-hint__dot { width: 14px; height: 14px; border-radius: 50%; background: #fff6c9; }
.mg-hint__msg { font-size: 13px; font-weight: 700; color: var(--mg-muted); }
.mg-option.is-hidden { opacity: .3; text-decoration: line-through; pointer-events: none; }
.mg-fact.is-hint { border-color: var(--mg-ochre); box-shadow: 0 0 0 2px #d9a441; }
.mg-game--memoria .mg-game__icon img { border-radius: 14px; object-fit: cover; }

/* ---------- Modo jogo: só a tela do jogo, sem título nem apresentação da página ---------- */
body.is-playing .page-head { display: none; }
body.is-playing .mg { padding-top: 12px; }
body.is-playing .mg-memory { margin-top: 0; }
body.is-playing .mg-play { margin-top: 0; }
/* O atributo hidden precisa vencer as classes de display desta página (ex.: .mg-board é flex). */
.is-minigames [hidden] { display: none !important; }
body.is-playing .footer { display: none; }

/* ---------- Comunidade e desafios ---------- */
.mg-community { margin-top: 36px; display: flex; flex-direction: column; gap: 14px; }
.mg-com-box { background: #fff; border: 1px solid var(--mg-line); border-radius: 22px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.mg-search { display: flex; gap: 8px; flex-wrap: wrap; }
.mg-search input { flex: 1; min-width: 180px; min-height: 44px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--mg-line); font: inherit; }
.mg-people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.mg-people li { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-radius: 14px; background: var(--mg-cream); }
.mg-people__nick { font-weight: 700; }
.mg-people__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.mg-people__actions form { margin: 0; }
.mg-people a.mg-btn { text-decoration: none; display: inline-flex; align-items: center; }

/* ---------- Sala 1v1 ---------- */

/* ---------- Efeitos: confete e feedback ---------- */
.fx-confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 90; }
.fx-piece { position: absolute; top: -12px; width: 10px; height: 14px; border-radius: 3px; opacity: .95; animation: fx-fall linear forwards; }
@keyframes fx-fall {
  0% { transform: translate3d(0, 0, 0) rotate(0deg); opacity: 1; }
  100% { transform: translate3d(calc((var(--fx-drift, 0) * 1px)), 105vh, 0) rotate(720deg); opacity: .6; }
}
.fx-piece:nth-child(3n) { --fx-drift: -40; }
.fx-piece:nth-child(3n+1) { --fx-drift: 40; }
.mg-option.is-right, .mg-answer.is-good { animation: mg-bump .45s ease; }
.mg-result__icon { animation: mg-bump .8s ease .1s both; }
@media (prefers-reduced-motion: reduce) { .fx-piece { animation: none; display: none; } }

.mg-duel-summary { display: flex; gap: 8px; flex-wrap: wrap; }
.mg-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 800; white-space: nowrap; }
.mg-chip b { font-variant-numeric: tabular-nums; }
.mg-chip--win { background: #dcefe2; color: #1f5a3c; }
.mg-chip--loss { background: #fbe4df; color: #8a2e1f; }
.mg-chip--draw { background: #f3ecd2; color: #6b5a1e; }
.mg-rank__sub { margin: 6px 0 0; font-size: 14px; color: var(--mg-muted); text-transform: uppercase; letter-spacing: .06em; }

/* ---------- Rodadas, cargas e poderes do duelo ---------- */
.mg-daily { margin: 0; }

/* ---------- Feedback da sala: card de vez, card de evento e poderes com estilo próprio ---------- */

/* Cada poder com a sua aparência */

/* ---------- Sala: barra de status, cargas, poderes e avisos (só quando algo acontece) ---------- */

/* Aviso: aparece só quando algo acontece e some sozinho */
.duel__notice { position: fixed; left: 50%; top: 96px; transform: translateX(-50%); z-index: 80; width: min(420px, calc(100vw - 28px)); pointer-events: none; }
.duel__notice[hidden] { display: none !important; }
.duel__notice-card { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; border-radius: 22px; background: #fff; border: 1px solid var(--mg-line); box-shadow: 0 24px 40px -18px oklch(14% 0.05 152 / .75); border-left: 8px solid var(--mg-forest-2); }
.duel__notice-card.is-in { animation: notice-pop .45s cubic-bezier(.2, .9, .3, 1.2) both; }
.duel__notice-tag { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--mg-muted); }
.duel__notice-title { font-size: 18px; color: var(--mg-forest); }
.duel__notice-sub { font-size: 14px; color: var(--mg-ink); line-height: 1.4; }
.duel__notice-card.is-start { background: #183d2b; border-left-color: var(--mg-ochre); }
.duel__notice-card.is-start .duel__notice-title, .duel__notice-card.is-start .duel__notice-sub, .duel__notice-card.is-start .duel__notice-tag { color: #fff; }
.duel__notice-card.is-turn { border-left-color: var(--mg-urucum); }
.duel__notice-card.is-combo { border-left-color: var(--mg-ochre); background: #fff7df; }
.duel__notice-card.is-trava { border-left-color: var(--mg-urucum); background: #fdeeea; }
.duel__notice-card.is-dobro { border-left-color: #d9a441; background: #fff8e0; }
.duel__notice-card.is-veu { border-left-color: #4b5bb0; background: #eef0fb; }
.duel__notice-card.is-par, .duel__notice-card.is-rodada, .duel__notice-card.is-info { border-left-color: var(--mg-forest-2); }
.duel__notice-card.is-end { border-left-color: var(--mg-ochre); }
@keyframes notice-pop { from { opacity: 0; transform: translateY(-14px) scale(.96); } to { opacity: 1; transform: none; } }

/* ---------- Modal da sala: sua vez na rodada e poder usado pelo adversário ---------- */
.duel-modal { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 20px; }
.duel-modal[hidden] { display: none !important; }
.duel-modal__backdrop { position: absolute; inset: 0; background: rgba(20, 30, 24, .55); backdrop-filter: blur(3px); animation: mg-fade .25s ease both; }
.duel-modal__card {
  position: relative; width: min(380px, 100%); display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px;
  padding: 28px 24px 22px; border-radius: 28px; background: #fff; border: 2px solid var(--mg-line);
  box-shadow: 0 0 0 2px #d9a441; animation: duel-modal-in .42s cubic-bezier(.2, .9, .3, 1.25) both;
}
.duel-modal__icon { width: 84px; height: 84px; border-radius: 26px; display: block; margin-bottom: 4px; }
.duel-modal__tag { font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--mg-muted); }
.duel-modal__title { margin: 0; font-size: 22px; line-height: 1.2; color: var(--mg-forest); }
.duel-modal__text { margin: 0; font-size: 15px; line-height: 1.5; color: var(--mg-ink); }
.duel-modal__btn { margin-top: 10px; min-height: 48px; padding: 10px 28px; border-radius: 999px; border: 0; font: inherit; font-weight: 800; font-size: 16px; color: #fff; background: var(--mg-forest); cursor: pointer; box-shadow: 0 0 0 2px #d9a441; }
.duel-modal__btn:focus-visible { outline: 3px solid var(--mg-ochre); outline-offset: 3px; }

/* Turn: verde da floresta com brilho */
.duel-modal__card.is-turn { border-color: var(--mg-forest-2); background: #ffffff; }
.duel-modal__icon.is-turn { background: #7bbf95; box-shadow: 0 0 0 2px #d9a441; }

/* Trava: vermelho-urucum com corrente */
.duel-modal__card.is-trava { border-color: var(--mg-urucum); background: #ffffff; }
.duel-modal__card.is-trava .duel-modal__title { color: #7a261d; }
.duel-modal__icon.is-trava { background: #8a2e1f; }

/* Dobro: dourado com moeda */
.duel-modal__card.is-dobro { border-color: #d9a441; background: #ffffff; }
.duel-modal__icon.is-dobro { border-radius: 50%; background: #fff6c9; }
.duel-modal__card.is-dobro .duel-modal__btn { background: #8a5a10; }

/* Véu: índigo com listras */
.duel-modal__card.is-veu { border-color: #4b5bb0; background: #ffffff; }
.duel-modal__card.is-veu .duel-modal__title { color: #2d3a80; }
.duel-modal__icon.is-veu { border-radius: 50% 50% 22px 22px; background: #4b5bb0; }
.duel-modal__card.is-veu .duel-modal__btn { background: #3a4a94; }

@keyframes duel-modal-in { from { opacity: 0; transform: translateY(18px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes mg-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .duel-modal__card, .duel-modal__backdrop { animation: none; } }

/* =====================================================================
   SALA DO DUELO: um único conjunto de regras, em uma coluna central.
   Desktop: placar lado a lado, poderes em três colunas.
   Celular: tudo em uma coluna, poderes empilhados.
   ===================================================================== */
.duel { box-sizing: border-box; width: 100%; max-width: 720px; margin: 0 auto; padding: 14px 16px 40px; display: flex; flex-direction: column; gap: 16px; }
.duel * { box-sizing: border-box; }
.duel__top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.duel__vs { font-weight: 700; color: var(--mg-ink); font-size: 15px; }
.duel .mg-back { min-height: 40px; }
.duel .mg-saved { margin: 0; }

/* Barra de vez */
.duel__bar { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; border-radius: 22px; background: #fff; border: 1px solid var(--mg-line); transition: background .3s ease, color .3s ease; }
.duel__bar.is-mine { background: #183d2b; color: #fff; border-color: transparent; }
.duel__bar-avatar { flex: 0 0 44px; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--mg-ochre); color: var(--mg-ink); font-weight: 800; font-size: 18px; }
.duel__bar.is-mine .duel__bar-avatar { background: #fff; color: var(--mg-forest); }
.duel__bar-main { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 2px; }
.duel__bar-main b { font-size: 17px; line-height: 1.2; }
.duel__bar-main small { font-size: 13px; color: var(--mg-muted); }
.duel__bar.is-mine .duel__bar-main small { color: #d9ece0; }
.duel__bar-round { padding: 6px 12px; border-radius: 999px; background: var(--mg-leaf); color: var(--mg-forest); font-size: 12px; font-weight: 800; white-space: nowrap; }
.duel__bar.is-mine .duel__bar-round { background: rgba(255,255,255,.18); color: #fff; }

/* Cargas */
.duel__charges { display: flex; align-items: center; justify-content: center; gap: 12px; align-self: center; padding: 8px 16px; border-radius: 999px; background: #fff; border: 1px solid var(--mg-line); }
.duel__charges-label { font-size: 13px; font-weight: 800; color: var(--mg-muted); }
.duel__pips { display: inline-flex; gap: 6px; }
.duel__pip { width: 16px; height: 16px; border-radius: 50%; background: #ece7d7; border: 2px solid #d6cfb6; }
.duel__pip.is-on { background: #fff6c9; border-color: #8a5a2b; }

/* Poderes: três cartões iguais, cada um com a sua cor */
.duel__powers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; width: 100%; }
.duel__power { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; min-height: 152px; border-radius: 22px; border: 2px solid var(--mg-line); background: #fff; font: inherit; color: var(--mg-ink); text-align: left; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.duel__power:disabled { cursor: default; opacity: .7; }
.duel__power:not(:disabled):hover { transform: translateY(-2px); }
.duel__power-icon { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 14px; }
.duel__power-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.duel__power-text b { font-size: 16px; line-height: 1.2; }
.duel__power-text small { font-size: 12px; color: var(--mg-muted); line-height: 1.35; }
.duel__power-state { margin-top: auto; align-self: flex-start; padding: 4px 10px; border-radius: 999px; background: #f0ece0; color: var(--mg-muted); font-size: 11px; font-weight: 800; white-space: nowrap; }
.duel__power.is-ready { border-color: var(--mg-forest-2); box-shadow: 0 12px 22px -18px oklch(20% 0.05 152 / .8); }
.duel__power.is-ready .duel__power-state { background: var(--mg-forest-2); color: #fff; }
.duel__power.is-trava .duel__power-icon { background: var(--mg-urucum); }
.duel__power.is-trava.is-ready { border-color: var(--mg-urucum); }
.duel__power.is-trava.is-active { background: #fdeeea; border-color: var(--mg-urucum); }
.duel__power.is-trava.is-active .duel__power-state { background: var(--mg-urucum); color: #fff; }
.duel__power.is-dobro .duel__power-icon { background: #fff6c9; border-radius: 50%; }
.duel__power.is-dobro.is-ready { border-color: #d9a441; }
.duel__power.is-dobro.is-active { background: #fff8e0; border-color: #d9a441; }
.duel__power.is-dobro.is-active .duel__power-state { background: #d9a441; color: var(--mg-ink); }
.duel__power.is-veu .duel__power-icon { background: #4b5bb0; border-radius: 50% 50% 14px 14px; }
.duel__power.is-veu.is-ready { border-color: #4b5bb0; }
.duel__power.is-veu.is-active { background: #eef0fb; border-color: #4b5bb0; }
.duel__power.is-veu.is-active .duel__power-state { background: #4b5bb0; color: #fff; }

/* Placar */
.duel__score { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; }
.duel__side { background: #fff; border: 1px solid var(--mg-line); border-radius: 22px; padding: 14px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; }
.duel__side[data-side="me"] { background: var(--mg-forest); color: #fff; border-color: transparent; }
.duel__side[data-side="me"] small { color: #cfe3d7; }
.duel__who { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; opacity: .85; }
.duel__side b { font-size: 36px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.duel__side small { font-size: 13px; color: var(--mg-muted); }
.duel.is-win .duel__side[data-side="me"], .duel.is-loss .duel__side[data-side="opponent"] { box-shadow: 0 0 0 4px var(--mg-ochre); }

/* Ações, avisos e textos de apoio */
.duel__actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.duel__actions form { margin: 0; }
.duel__toast { margin: 0; text-align: center; font-weight: 700; color: #a4372b; min-height: 1.4em; }
.duel__hint { margin: 0; text-align: center; font-size: 13px; color: var(--mg-muted); }
.duel__veil { margin: 0 auto; text-align: center; font-size: 13px; font-weight: 700; color: #3a4a94; background: #eef0fb; border-radius: 999px; padding: 6px 14px; }
.duel__veil[hidden] { display: none !important; }

/* Tabuleiro */
.duel__board { display: grid; grid-template-columns: repeat(var(--duel-cols, 3), minmax(0, 1fr)); gap: 10px; width: 100%; max-width: 560px; margin: 0 auto; padding: clamp(12px, 3vw, 20px); background-color: var(--mg-cream); border-radius: 26px; border: 1px solid var(--mg-line); }
.duel__board[hidden] { display: none !important; }
.duel__board .mcard { width: 100%; aspect-ratio: 3 / 4; height: auto; }
.duel__board .mcard[disabled] { cursor: default; }

/* História da carta */
.duel__story { width: 100%; max-width: 560px; margin: 0 auto; background: #fffdf6; border: 1px solid var(--mg-ochre); border-radius: 22px; padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; box-shadow: 0 14px 26px -22px oklch(20% 0.05 152 / .7); }
.duel__story[hidden] { display: none !important; }
.duel__story.is-new { animation: mg-in .35s ease both; }
.duel__story-tag { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--mg-urucum); }
.duel__story b { font-size: 18px; color: var(--mg-forest); }
.duel__story p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--mg-ink); }

/* Celular: tudo em uma coluna */
@media (max-width: 640px) {
  .duel { padding: 12px 14px 32px; gap: 14px; }
  .duel__powers { grid-template-columns: 1fr; gap: 10px; }
  .duel__power { flex-direction: row; align-items: center; min-height: 0; padding: 12px; gap: 12px; }
  .duel__power-text { flex: 1; }
  .duel__power-state { margin-top: 0; }
  .duel__board { gap: 8px; }
}

/* Modal de acerto: par encontrado (verde, com selo) e combo (dourado, com estrela) */
.duel-modal__card.is-par { border-color: var(--mg-forest-2); background: #ffffff; }
.duel-modal__card.is-par .duel-modal__title { color: var(--mg-forest); }
.duel-modal__icon.is-par { border-radius: 50%; background: #9fd4b1; box-shadow: 0 0 0 2px #d9a441; }
.duel-modal__icon.is-par::after { content: ''; display: block; width: 26px; height: 14px; margin: 35px auto 0; border-left: 7px solid #fff; border-bottom: 7px solid #fff; transform: rotate(-45deg); }
.duel-modal__card.is-par .duel-modal__btn { background: var(--mg-forest-2); }

.duel-modal__card.is-combo { border-color: var(--mg-ochre); background: #ffffff; animation-duration: .5s; }
.duel-modal__card.is-combo .duel-modal__title { color: #8a5a10; font-size: 26px; }
.duel-modal__icon.is-combo { border-radius: 26px; background: #fff6c9; box-shadow: 0 0 0 2px #d9a441; }
.duel-modal__card.is-combo .duel-modal__btn { background: #8a5a10; }

/* Barra de tempo da jogada */
.duel__timer { position: relative; width: 100%; height: 34px; border-radius: 999px; background: #ece7d7; overflow: hidden; border: 1px solid var(--mg-line); }
.duel__timer[hidden] { display: none !important; }
.duel__timer-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; background: #2f6b4f; transition: width .1s linear, background .3s ease; }
.duel__timer.is-mine .duel__timer-fill { background: #d9a441; }
.duel__timer.is-low .duel__timer-fill { background: #b8432b; animation: duel-timer-pulse .5s ease-in-out infinite alternate; }
.duel__timer-text { position: relative; display: block; text-align: center; line-height: 32px; font-size: 13px; font-weight: 800; color: var(--mg-ink); font-variant-numeric: tabular-nums; }
@keyframes duel-timer-pulse { from { opacity: 1; } to { opacity: .6; } }

/* Modal de tempo esgotado: alerta em vermelho-urucum com relógio de areia */
.duel-modal__card.is-tempo { border-color: var(--mg-urucum); background: #ffffff; }
.duel-modal__card.is-tempo .duel-modal__title { color: #8a2e1f; }
.duel-modal__icon.is-tempo { border-radius: 50%; background: #f3a38c; box-shadow: 0 0 0 2px #d9a441; position: relative; }
.duel-modal__icon.is-tempo::after { content: ''; position: absolute; left: 50%; top: 50%; width: 30px; height: 36px; transform: translate(-50%, -50%); background: transparent; clip-path: polygon(0 0, 100% 0, 55% 50%, 100% 100%, 0 100%, 45% 50%); opacity: .95; }
.duel-modal__card.is-tempo .duel-modal__btn { background: #8a2e1f; }

/* Ampulheta regressiva */
.duel__timer-row { display: flex; align-items: center; gap: 12px; width: 100%; }
.duel__timer-row .duel__timer { flex: 1; }
.duel__hourglass { flex: 0 0 34px; width: 34px; height: 44px; display: block; }
.duel__hourglass svg { width: 100%; height: 100%; display: block; overflow: visible; }
.duel__hourglass-frame { fill: none; stroke: var(--mg-forest); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.duel__hourglass-sand { fill: var(--mg-ochre); transform-box: fill-box; }
.duel__hourglass-sand--top { transform-origin: 50% 0; transform: scaleY(1); }
.duel__hourglass-sand--bottom { transform-origin: 50% 100%; transform: scaleY(0); fill: #d9a441; }
.duel__hourglass-drip { fill: var(--mg-ochre); }
.duel__timer-row.is-low .duel__hourglass { animation: duel-hourglass-shake .5s ease-in-out infinite alternate; }
.duel__timer-row.is-mine .duel__hourglass-sand { fill: #e8b923; }
@keyframes duel-hourglass-shake { from { transform: rotate(-6deg); } to { transform: rotate(6deg); } }

/* Modal de erro: "Não é um par" */
.duel-modal__card.is-erro { border-color: #c0593f; background: #ffffff; }
.duel-modal__card.is-erro .duel-modal__title { color: #8a2e1f; }
.duel-modal__icon.is-erro { border-radius: 22px; background: #e0745c; box-shadow: 0 0 0 6px #f6d2c6; }
.duel-modal__card.is-erro .duel-modal__btn { background: #8a2e1f; }

/* Barra do topo do jogo da memória: o botão de voltar fica alinhado à mesma largura do tabuleiro */
.mg-memory__bar { box-sizing: border-box; width: 100%; max-width: 1200px; margin: 0 auto; padding: 14px 16px 6px; display: flex; justify-content: flex-start; }
.mg-memory__bar .mg-back { margin: 0; }

/* Fim da partida: resultado final da sala */
.duel__end { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; max-width: 520px; width: 100%; margin: 0 auto; padding: 28px 22px; border-radius: 28px; background: #fff; border: 2px solid var(--mg-line); box-shadow: 0 24px 44px -26px oklch(14% 0.05 152 / .75); }
.duel__end[hidden] { display: none !important; }
.duel__end.is-win { border-color: var(--mg-ochre); background: #ffffff; }
.duel__end.is-loss { border-color: #c0593f; background: #ffffff; }
.duel__end.is-draw { border-color: var(--mg-forest-2); background: #ffffff; }
.duel__end-icon { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; font-size: 34px; font-weight: 800; color: #fff; background: var(--mg-forest); }
.duel__end.is-win .duel__end-icon { background: #fff6c9; color: var(--mg-ink); }
.duel__end.is-loss .duel__end-icon { background: #8a2e1f; }
.duel__end-tag { font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--mg-muted); }
.duel__end-title { font-size: 26px; color: var(--mg-forest); }
.duel__end-score { margin: 0; font-weight: 800; font-size: 17px; color: var(--mg-ink); }
.duel__end-text { margin: 0; font-size: 14px; color: var(--mg-muted); }
.duel__end-btn { margin-top: 8px; }
a.mg-people__nick { color: var(--mg-ink); text-decoration: none; }
a.mg-people__nick:hover { text-decoration: underline; }

/* ---------- Jogo da memória: tela de entrada e partida só com o tabuleiro ---------- */
.mg-memory.is-intro .game { display: none; }
.mg-memory:not(.is-intro) [data-memory-intro] { display: none; }
.mg-memory:not(.is-intro) .hud,
.mg-memory:not(.is-intro) .game__progress,
.mg-memory:not(.is-intro) .game__tools { display: none !important; }

.mg-memory-intro { box-sizing: border-box; max-width: 1200px; margin: 0 auto; padding: 8px 16px 40px; display: flex; flex-direction: column; gap: 22px; }
.mg-memory-intro__hero { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.mg-memory-intro__logo { width: 96px; height: 96px; border-radius: 22px; object-fit: cover; box-shadow: 0 0 0 4px #fff, 0 0 0 6px var(--mg-ochre); }
.mg-memory-intro__title { margin: 4px 0 6px; font-size: clamp(26px, 4vw, 38px); color: var(--mg-forest); }
.mg-memory-intro__text { margin: 0; max-width: 60ch; color: var(--mg-ink); line-height: 1.55; }
.mg-memory-intro__stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.mg-memory-intro__stats div { background: #fff; border: 1px solid var(--mg-line); border-radius: 20px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.mg-memory-intro__stats b { font-size: 24px; color: var(--mg-forest); font-variant-numeric: tabular-nums; }
.mg-memory-intro__stats span { font-size: 13px; color: var(--mg-muted); }
.mg-memory-intro__guest { margin: 0; color: var(--mg-muted); }
.mg-memory-intro__guest a { color: var(--mg-forest-2); font-weight: 700; }
.mg-memory-intro__actions { display: flex; gap: 12px; flex-wrap: wrap; }
.mg-memory-intro__play { min-width: 180px; min-height: 54px; font-size: 18px; }

/* ---------- Telas separadas: partida do jogo da memória só com o tabuleiro ---------- */

body.is-memory-play .game { padding-top: 6px; }
.mg-back-row { margin: 14px 0 6px; }
.mg-game__icon--community { background: #dcece2; position: relative; }
.mg-game__icon--community::before { content: '👥'; font-size: 30px; line-height: 1; }
.mg-game--community .mg-game__go { color: #ffffff; }

/* =====================================================================
   JOGO DA MEMÓRIA NO DESIGN DO DUELO 1v1
   Mesma paleta, barra de status, painel do tabuleiro, cartão de história e modais.
   ===================================================================== */

/* Tela de informações (entrada) */
.mg-memory-intro { max-width: 720px; padding: 6px 16px 48px; gap: 16px; }
.mg-memory-intro__hero { background: #183d2b; color: #fff; border-radius: 28px; padding: 22px; box-shadow: 0 0 0 2px #d9a441; flex-wrap: nowrap; }
.mg-memory-intro__logo { width: 84px; height: 84px; flex: 0 0 84px; box-shadow: 0 0 0 4px #fff, 0 0 0 6px var(--mg-ochre); }
.mg-memory-intro__title { color: #fff; }
.mg-memory-intro__text { color: #d9ece0; font-size: 15px; }
.mg-memory-intro .eyebrow { color: #cfe6d7; }
.mg-memory-intro__stats { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.mg-memory-intro__stats div { border-radius: 22px; box-shadow: 0 0 0 2px #d9a441; }
.mg-memory-intro__stats div:first-child { background: var(--mg-forest); border-color: transparent; }
.mg-memory-intro__stats div:first-child b, .mg-memory-intro__stats div:first-child span { color: #fff; }
.mg-memory-intro__stats div:first-child span { color: #cfe3d7; }
.mg-memory-intro__actions { gap: 10px; }
.mg-memory-intro__play { border-radius: 999px; box-shadow: 0 0 0 2px #d9a441; }
.mg-memory-intro__play:hover { transform: translateY(-1px); }
.mg-memory-intro .mg-btn--ghost { border-radius: 999px; }

/* Tela de partida: barra de status, tabuleiro e cartão de história */
body.is-memory-play .game { max-width: 1000px; padding-top: 4px; gap: 14px; }
body.is-memory-play .game__phase { background: #fff; border: 1px solid var(--mg-line); border-radius: 22px; padding: 14px 18px; flex-direction: row; align-items: center; justify-content: space-between; box-shadow: 0 0 0 2px #d9a441; }
body.is-memory-play .game__phase .eyebrow { color: var(--mg-urucum); font-size: 12px; letter-spacing: .1em; }
body.is-memory-play .game__title { color: var(--mg-forest); font-size: clamp(18px, 2.4vw, 22px); }
body.is-memory-play .game__progress { height: 10px; background: #ece7d7; border: 0; border-radius: 999px; }
body.is-memory-play .game__progress > div { background: #2f6b4f; }
body.is-memory-play .game__table { border-radius: 26px; padding: 14px; }
body.is-memory-play .game__board { border-radius: 26px; border: 1px solid var(--mg-line); }
body.is-memory-play .info-panel { border-radius: 22px; background: #fffdf6; border: 1px solid var(--mg-ochre); box-shadow: 0 0 0 2px #d9a441; }
body.is-memory-play .info-panel__title { color: var(--mg-forest); }
body.is-memory-play .game__status { color: var(--mg-muted); }
body.is-memory-play .mg-back-row { margin-bottom: 0; }

/* Modais da partida com o estilo dos modais do duelo */
body.is-memory-play .modal__box,
body.is-memory-play .modal__quiz,
body.is-memory-play .modal__final {
  border-radius: 28px; border: 2px solid var(--mg-line); background: #fff;
  box-shadow: 0 0 0 2px #d9a441; animation: duel-modal-in .42s cubic-bezier(.2, .9, .3, 1.25) both;
}
body.is-memory-play .modal__quiz { border-color: var(--mg-forest-2); }
body.is-memory-play .modal__final { background: #183d2b; color: #fff; border-color: var(--mg-ochre); }
body.is-memory-play .modal__final .h1, body.is-memory-play .modal__final .eyebrow, body.is-memory-play .modal__final .modal__score, body.is-memory-play .modal__final .final-saved, body.is-memory-play .modal__final .final-stats { color: #fff; }
body.is-memory-play .modal .btn--primary, body.is-memory-play .modal .btn--white { border-radius: 999px; }
@media (min-width: 640px) { .mg-memory-intro__stats { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

/* ---------- Partida: cabeçalho com informações e power-ups no estilo dos perfis ---------- */
body.is-memory-play .game { max-width: 1040px; }
body.is-memory-play .hud { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(4, minmax(0, 1fr)); gap: 10px; }
body.is-memory-play .hud-card--player { background: #ffffff; border: 1px solid var(--mg-line); border-radius: 22px; box-shadow: none; }
body.is-memory-play .hud-card--guest { background: #2f6b4f; border-radius: 22px; }
body.is-memory-play .hud-tile { background: #ffffff; border: 1px solid var(--mg-line); border-radius: 22px; box-shadow: none; }
body.is-memory-play .hud-tile--points { background: #183d2b; border-color: #183d2b; }
body.is-memory-play .hud-tile--points b { color: #d9a441; }
body.is-memory-play .hud-tile b { color: #183d2b; }
body.is-memory-play .game__phase { border-radius: 22px; }
body.is-memory-play .game__tools { gap: 8px; }
body.is-memory-play .power { background: #ffffff; border: 1px solid var(--mg-line); border-radius: 999px; }
body.is-memory-play .power em { background: #e4f2e9; color: #2f6b4f; }
body.is-memory-play .power:disabled em { background: #efe9d8; color: var(--mg-muted); }
body.is-memory-play .chip { background: #ffffff; border: 1px solid var(--mg-line); border-radius: 999px; color: #183d2b; }
body.is-memory-play .game__table { background: #ffffff; border: 1px solid var(--mg-line); border-radius: 26px; box-shadow: none; }
body.is-memory-play .game__board { border: 1px solid var(--mg-line); }
@media (max-width: 760px) {
  body.is-memory-play .hud { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.is-memory-play .hud-card--player { grid-column: 1 / -1; }
}

/* ---------- Telas de jogos no padrão dos perfis: cartões alinhados, cores sólidas ---------- */
.mg { padding-top: 28px; padding-bottom: 60px; }
.mg-hub { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; align-items: stretch; }
.mg-game { min-height: 300px; border-radius: 26px; background: #ffffff; border: 1px solid var(--mg-line); box-shadow: none; padding: 26px 22px 20px; }
.mg-game:hover { transform: translateY(-3px); border-color: #2f6b4f; box-shadow: none; }
.mg-game__icon { width: 64px; height: 64px; border-radius: 20px; background: #e4f2e9; }
.mg-game--memoria .mg-game__icon { background: #fbf0d2; }
.mg-game--timeline .mg-game__icon { background: #e4f2e9; }
.mg-game--choice .mg-game__icon, .mg-game--origin .mg-game__icon { background: #fbe7e1; }
.mg-game--truefalse .mg-game__icon { background: #fbf0d2; }
.mg-game--community .mg-game__icon { background: #e4f2e9; }
.mg-game__title { font-size: 21px; color: #183d2b; }
.mg-game__text { color: #5b6f63; }
.mg-game__meta { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--mg-line); }
.mg-game::before { display: none; }
.mg-game__go { display: inline-flex; align-items: center; padding: 6px 12px; border-radius: 999px; background: #183d2b; color: #ffffff; font-weight: 800; }
.mg-board, .mg-community { display: flex; flex-direction: column; gap: 18px; }
.mg-board__title { font-size: 22px; color: #183d2b; margin: 0; }
.mg-community > h2.mg-board__title { margin-bottom: 4px; }
.mg-board__grid { gap: 16px; }
.mg-rank, .mg-com-box, .mg-history-box { background: #ffffff; border: 1px solid var(--mg-line); border-radius: 26px; padding: 22px; box-shadow: none; }
.mg-rank__title { font-size: 18px; color: #183d2b; }
.mg-rank__list li, .mg-people li { background: #fbf7ec; border-radius: 18px; border: 1px solid var(--mg-line); }
.mg-rank__pos { background: #e4f2e9; color: #183d2b; }
.mg-rank__list li:nth-child(1) .mg-rank__pos { background: #d9a441; color: #1d2f25; }
.mg-search input { border: 2px solid var(--mg-line); border-radius: 999px; }
.mg-search input:focus { border-color: #2f6b4f; outline: none; }
.mg-btn--primary { background: #183d2b; color: #ffffff; border: 0; }
.mg-btn--primary:hover { background: #2f6b4f; }
.mg-btn--ghost { background: #ffffff; color: #183d2b; border: 2px solid var(--mg-line); }
.mg-table th { color: #5b6f63; }
.mg-table td, .mg-table th { border-bottom: 1px solid var(--mg-line); }
.mg-coins { background: #fbf0d2; color: #1d2f25; border: 1px solid #d9a441; }
.mg-coins__dot { background: #d9a441; border: 0; }
body.is-memory-play .hud { grid-template-columns: minmax(280px, 1.6fr) repeat(4, minmax(0, 1fr)); }
body.is-memory-play .game__phase { border: 1px solid #e3dccb; }
body.is-memory-play .hud-card--player .hud-card__top b { white-space: normal; }
body.is-memory-play .hud-card__meta { gap: 6px; }

/* Partida: a carta encontrada aparece com a proporção de carta e o texto abaixo dela */
body.is-memory-play .info-panel { align-self: start; width: 100%; max-width: 380px; justify-self: center; }
body.is-memory-play .info-panel__content { flex: 0 0 auto; }
body.is-memory-play .info-panel__media { flex: 0 0 auto; aspect-ratio: auto; height: 250px; max-height: none; min-height: 0; width: 100%; border-bottom: 1px solid #e3dccb; }
body.is-memory-play .info-panel__media img { object-position: center 30%; }
body.is-memory-play .info-panel__body { padding: 18px 20px 22px; }
body.is-memory-play .info-panel__desc { font-size: 15px; line-height: 1.6; }

/* Partida: todos os blocos (voltar, cabeçalho, fase, progresso e tabuleiro) na mesma largura e margem */
body.is-memory-play .mg-memory-play.container { max-width: 1040px !important; width: 100%; box-sizing: border-box; padding: 8px 16px 0 !important; margin: 0 auto; }
body.is-memory-play .mg-memory-play .mg-back-row { margin: 0 0 12px; }
body.is-memory-play .mg-memory-play .mg-back-row .mg-back { margin: 0; }
body.is-memory-play .game { max-width: none; width: 100%; padding: 0; margin: 0; box-sizing: border-box; }
body.is-memory-play .hud { width: 100%; box-sizing: border-box; justify-content: stretch; }
body.is-memory-play .game__phase, body.is-memory-play .game__progress { width: 100%; box-sizing: border-box; }

/* Partida: cartão do jogador + quatro indicadores ocupando toda a linha, em colunas iguais */
body.is-memory-play .hud { grid-template-columns: minmax(260px, 1fr) minmax(0, 2.6fr); align-items: stretch; }
body.is-memory-play .hud-stats { grid-column: 2; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; min-width: 0; }
body.is-memory-play .hud-tile { min-width: 0; min-height: 100%; }
@media (max-width: 760px) {
  body.is-memory-play .hud { grid-template-columns: 1fr; }
  body.is-memory-play .hud-stats { grid-column: auto; }
}

/* Cartão de pontos: texto claro sobre o fundo verde escuro (vence a regra geral dos indicadores) */
body.is-memory-play .hud-tile.hud-tile--points b { color: #d9a441; }
body.is-memory-play .hud-tile.hud-tile--points span { color: #cfe3d7; }

/* ---------- Cartas acertadas na partida: destaque claro e sólido ---------- */
body.is-memory-play .mcard.is-matched .mcard__inner { opacity: 1; }
body.is-memory-play .mcard.is-matched .mcard__back { opacity: .3; filter: grayscale(.7); }
body.is-memory-play .mcard.is-matched .mcard__front {
  background: #e4f2e9; border: 3px solid #2f6b4f; box-shadow: none;
}
body.is-memory-play .mcard.is-matched .mcard__front .mcard__label { background: #2f6b4f; color: #ffffff; border-top: 0; }
body.is-memory-play .mcard.is-matched .mcard__front::after {
  background: #d9a441; color: #1d2f25; border: 2px solid #ffffff; box-shadow: 0 0 0 2px #2f6b4f;
}
body.is-memory-play .mcard.is-matched { animation: mc-hit .45s ease-out; }
@keyframes mc-hit { 0% { transform: scale(1); } 45% { transform: scale(1.06); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { body.is-memory-play .mcard.is-matched { animation: none; } }

/* Partida: a carta encontrada aparece inteira, no tamanho de retrato padrão do jogo (3:4), com o texto abaixo */
body.is-memory-play .info-panel__media { height: auto; aspect-ratio: 3 / 4; width: min(100%, 300px); margin: 22px auto 0; border: 0; border-radius: 18px; overflow: hidden; background: #f3efe2; box-shadow: 0 14px 24px -18px rgba(0,0,0,.55); flex: 0 0 auto; }
body.is-memory-play .info-panel__media img { object-fit: contain; object-position: center; background: #f3efe2; }
body.is-memory-play .info-panel__body { padding: 16px 22px 24px; text-align: left; }

/* Partida: o painel da história cresce com o texto (antes ficava com altura fixa e cortava a descrição) */
body.is-memory-play .info-panel { height: auto !important; min-height: 0; overflow: visible; }
body.is-memory-play .game__stage { align-items: start; }

/* Partida: sem rodapé do site (o painel da história não se sobrepõe a ele) e com espaço no fim da página */
body.is-memory-play .footer, body.is-memory-play .footer * { display: none !important; }
body.is-memory-play .mg-memory-play.container { padding-bottom: 48px !important; }

/* Partida: tabuleiro e painel da história com a mesma altura (o painel não sobra embaixo do tabuleiro) */
body.is-memory-play .game__stage { align-items: stretch; }
body.is-memory-play .game__table { display: flex; flex-direction: column; }
body.is-memory-play .game__board { flex: 1 1 auto; align-content: center; }
body.is-memory-play .game__stage { grid-template-rows: auto; height: auto; }
body.is-memory-play .game__table { height: auto; align-self: stretch; }
body.is-memory-play .game__stage { grid-template-rows: auto !important; height: auto !important; }
body.is-memory-play .game__table { height: auto !important; min-height: 0 !important; }

/* Partida: margem inferior entre os blocos */
body.is-memory-play .mg-back-row { margin-bottom: 16px !important; }
body.is-memory-play .hud { margin-bottom: 20px !important; }
body.is-memory-play .game__phase { margin-bottom: 20px !important; }
body.is-memory-play .game__progress { margin-bottom: 24px !important; }
body.is-memory-play .game__stage { margin-bottom: 24px !important; }
body.is-memory-play .game__table { margin-bottom: 0 !important; }
body.is-memory-play .info-panel { margin-bottom: 24px !important; }

/* Partida: respiro no fim da página, para o painel da história não encostar na borda da tela */
body.is-memory-play .mg-memory-play.container { padding-bottom: 110px !important; }
body.is-memory-play .game { padding-bottom: 24px; }
body.is-memory-play .info-panel { margin-bottom: 40px !important; }

/* Partida (desktop): tabuleiro e painel lado a lado, ambos com a altura do item mais alto */
@media (min-width: 900px) {
  body.is-memory-play .game__stage { display: flex !important; flex-direction: row !important; align-items: stretch !important; gap: 20px !important; grid-template-rows: none !important; height: auto !important; }
  body.is-memory-play .game__table { flex: 1 1 auto; min-width: 0; height: auto !important; display: flex; flex-direction: column; }
  body.is-memory-play .game__board { flex: 1 1 auto; align-content: center; }
  body.is-memory-play .info-panel { flex: 0 0 340px; width: 340px; max-width: 340px; }
}

/* Partida (desktop): área fixa para o conjunto tabuleiro + história, com espaço reservado para o maior painel */
@media (min-width: 900px) {
  body.is-memory-play .game__stage { height: 700px !important; min-height: 700px !important; max-height: 700px !important; overflow: visible; }
  body.is-memory-play .game__table { height: 100% !important; }
  body.is-memory-play .info-panel { height: 100% !important; margin-bottom: 0 !important; }
  body.is-memory-play .info-panel__content { height: 100%; }
  body.is-memory-play .info-panel__body { flex: 1 1 auto; }
}

/* Partida: respiro em volta do jogo (topo, laterais e base) e rolagem parando abaixo do menu fixo */
body.is-memory-play { scroll-padding-top: 110px; }
body.is-memory-play .mg-memory-play.container { padding: 28px 24px 120px !important; }
body.is-memory-play .mg-back-row { margin-top: 0; }
body.is-memory-play .game { padding-left: 0; padding-right: 0; }

/* Partida (desktop): a grade do jogo cresce com o conjunto de altura fixa, então o espaço de baixo fica dentro da página */
@media (min-width: 900px) {
  body.is-memory-play .game { grid-template-rows: auto auto auto auto auto !important; padding-bottom: 40px; }
}

/* Partida (desktop): o jogo em fluxo normal, para o palco de altura fixa fazer parte da altura da página */
@media (min-width: 900px) {
  body.is-memory-play .game { display: block !important; padding-bottom: 40px; }
  body.is-memory-play .game > * { margin-bottom: 20px; }
  body.is-memory-play .game__stage { margin-bottom: 120px !important; }
}
body.is-memory-play .game { height: auto !important; min-height: 0 !important; max-height: none !important; }

/* Painel da história: textos longos sem espaço quebram dentro do painel, sem vazar */
body.is-game .info-panel, body.is-game .info-panel * { min-width: 0; }
body.is-game .info-panel__body, body.is-game .info-panel__desc, body.is-game .info-panel__title { overflow-wrap: anywhere; word-break: break-word; max-width: 100%; }
body.is-game .info-panel { overflow: hidden; }
