/* Jogos da plataforma — elementos globais e padrões: alvos de toque, cabeçalho, estados e feedback. O visual
   específico de cada jogo fica no CSS da pasta do jogo (importado abaixo e editável por jogo). */
@import 'memory-pairs/memory-pairs.css';
@import 'syllables/syllables.css';
@import 'mental-math/mental-math.css';
@import 'waste-sorting/waste-sorting.css';
@import 'star-tap/star-tap.css';
#dialog .activity-frame-body:has(> #platform-game-stage) {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
}
#dialog .activity-frame-body:has(> .board-sub):has(> #platform-game-stage) {
  grid-template-rows: auto minmax(0, 1fr);
}
#dialog .activity-frame-body > #platform-game-stage {
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
.platform-game {
  --module-accent: var(--app-primary);
  display: grid;
  gap: 14px;
  margin: 12px 0;
  color: var(--app-ink);
}
.platform-game .game-title {
  margin: 0;
  color: var(--app-ink);
}
.platform-game .game-status {
  margin: 0;
  font-weight: 700;
  color: var(--module-accent);
}
.platform-game .game-feedback {
  min-height: 1.5em;
  margin: 0;
  font-weight: 600;
}
.platform-game .game-feedback[data-tone='success'] {
  color: #1d6b3a;
}
.platform-game .game-feedback[data-tone='retry'] {
  color: #8a4b00;
}
.platform-game .game-tile {
  min-width: var(--touch-target, 56px);
  min-height: var(--touch-target, 56px);
  padding: 8px 14px;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--app-ink);
  background: var(--app-card);
  border: 2px solid var(--app-border);
  border-radius: 16px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  touch-action: manipulation;
  transition:
    transform 0.08s ease,
    border-color 0.12s ease,
    box-shadow 0.12s ease,
    background-color 0.12s ease;
}
.platform-game .game-tile:hover:not(:disabled) {
  border-color: var(--module-accent);
  transform: translateY(-1px);
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.12);
}
.platform-game .game-tile:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
.platform-game .game-tile:focus-visible {
  outline: 3px solid var(--module-accent);
  outline-offset: 2px;
}
.platform-game .game-tile:disabled {
  cursor: default;
}
.platform-game .game-tile.wrong {
  color: #7c2d12;
  background: #fdeee7;
  border-color: #c2410c;
  animation: game-shake 0.3s ease;
}
.platform-game .game-tile.right {
  color: #14532d;
  background: #e7f6ec;
  border-color: #15803d;
}
@keyframes game-shake {
  25% {
    transform: translateX(-4px);
  }
  75% {
    transform: translateX(4px);
  }
}
.platform-game .game-figure {
  font-size: 3.5rem;
  line-height: 1.1;
  text-align: center;
}

/* Moldura comum dos cinco módulos: conteúdo próprio, mas a mesma hierarquia clara do caça-palavras. */
.platform-game {
  --player-paper: #fffdf7;
  --player-paper-edge: #e9dfc8;
  --player-shadow: 0 14px 34px rgba(57, 48, 28, 0.1);
  height: 100%;
  width: 100%;
  height: 100%;
  min-height: 0;
  align-content: start;
  overflow: auto;
  padding: clamp(12px, 2vw, 24px);
  border: 1px solid var(--player-paper-edge);
  border-radius: 24px;
  background:
    radial-gradient(ellipse at 5% 0%, color-mix(in srgb, var(--module-accent) 10%, transparent), transparent 34%),
    linear-gradient(145deg, #fffefb, var(--player-paper));
  box-shadow: var(--player-shadow);
}
.platform-game:not([data-game='memory-pairs']) {
  display: block;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.platform-game .game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 30%);
  gap: clamp(12px, 2vw, 22px);
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}
.platform-game .game-stage,
.platform-game .game-notebook {
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--player-paper-edge);
  border-radius: 20px;
  background: var(--player-paper);
  box-shadow: var(--player-shadow);
}
.platform-game .game-stage {
  display: grid;
  place-items: center;
  align-content: center;
  overflow: auto;
  overscroll-behavior: contain;
  padding: clamp(12px, 2vw, 24px);
}
.platform-game .game-notebook {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  overflow: auto;
  overscroll-behavior: contain;
  padding: clamp(14px, 2vw, 22px);
  border-radius: 8px 18px 18px 8px;
  border-left: 5px solid color-mix(in srgb, var(--module-accent) 40%, white);
}
.platform-game .game-notebook .game-heading,
.platform-game .game-notebook .game-rule,
.platform-game .game-notebook .game-progress,
.platform-game .game-notebook .game-status,
.platform-game .game-notebook .game-feedback {
  flex: 0 0 auto;
}
.platform-game .game-rule {
  margin: 0;
  color: var(--app-muted);
  line-height: 1.45;
}
.platform-game .game-options:empty {
  display: none;
}
.platform-game .game-options {
  display: grid;
  gap: 10px;
  min-width: 0;
}
.platform-game .game-options > .syllable-pieces {
  width: 100%;
  max-width: 100%;
}
.platform-game .game-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
}
.platform-game .game-heading-copy {
  min-width: 0;
}
.platform-game .game-eyebrow {
  display: block;
  margin-bottom: 3px;
  color: var(--module-accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.platform-game .game-title {
  font-size: clamp(1.2rem, 2.4vw, 1.65rem);
  line-height: 1.2;
  text-wrap: balance;
}
.platform-game .game-status {
  flex: 0 0 auto;
  padding: 9px 13px;
  border: 1px solid color-mix(in srgb, var(--module-accent) 24%, white);
  border-radius: 999px;
  background: color-mix(in srgb, var(--module-accent) 9%, white);
  font-size: 0.88rem;
  text-align: center;
}
.platform-game .game-progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8e7df;
}
.platform-game .game-progress-value {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--module-accent), color-mix(in srgb, var(--module-accent) 55%, #f8cf67));
  transition: width 240ms ease;
}
.platform-game .game-feedback {
  min-height: 0;
  padding: 10px 14px;
  border: 1px solid #e7e2d5;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  line-height: 1.45;
}
.platform-game .game-feedback:empty {
  display: none;
}
.platform-game .game-feedback[data-tone='success'] {
  border-color: #cce8d3;
  background: #f0faf2;
}
.platform-game .game-feedback[data-tone='retry'] {
  border-color: #f0d4af;
  background: #fff8ed;
}
.platform-game :is(.memory-board, .math-board, .syllable-board, .waste-stage, .star-grid, .star-stage) {
  min-width: 0;
  padding: clamp(14px, 2.5vw, 28px);
  border: 1px solid #ebe3d2;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.95),
    0 7px 18px rgba(57, 48, 28, 0.06);
}
.platform-game .memory-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 112px), 1fr));
  align-content: center;
}
.platform-game .memory-card {
  min-height: clamp(76px, 12vh, 112px);
  border-radius: 18px;
}
.platform-game .math-board,
.platform-game .syllable-board {
  align-content: center;
  min-height: min(48vh, 440px);
}
.platform-game .math-board {
  display: grid;
  justify-items: center;
  gap: clamp(18px, 4vh, 36px);
  width: 100%;
  min-height: min(58vh, 520px);
  align-content: center;
}
.platform-game .math-question {
  min-width: min(100%, 260px);
  text-align: center;
  box-shadow: 0 8px 18px color-mix(in srgb, var(--module-accent) 13%, transparent);
}
.platform-game .math-answers {
  width: min(100%, 620px);
}
.platform-game .math-answers .game-tile {
  flex: 1 1 100px;
  min-height: 68px;
  border-radius: 18px;
}
.platform-game .syllable-slot {
  min-width: 68px;
  min-height: 64px;
  border-radius: 16px;
  background: #fffdf7;
}
.platform-game .syllable-pieces .game-tile {
  min-width: 76px;
  min-height: 64px;
  background: color-mix(in srgb, var(--module-accent) 9%, white);
  border-color: color-mix(in srgb, var(--module-accent) 32%, white);
}
.platform-game .star-grid .star-tile {
  min-height: clamp(72px, 12vh, 108px);
  border-radius: 20px;
}
.platform-game .game-tile {
  min-height: 60px;
  border-radius: 17px;
}
.platform-game .game-tile:disabled {
  opacity: 0.68;
}
.platform-game :focus-visible {
  outline: 3px solid var(--module-accent);
  outline-offset: 3px;
}
@media (max-width: 560px) {
  .platform-game {
    gap: 10px;
    padding: 12px;
    border-radius: 18px;
  }
  .platform-game .game-heading {
    align-items: flex-start;
    gap: 8px;
  }
  .platform-game .game-status {
    max-width: 45%;
    padding: 7px 9px;
    font-size: 0.76rem;
  }
}
@media (max-width: 700px) {
  .platform-game:not([data-game='memory-pairs']) .game-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(220px, 1fr) minmax(140px, 36%);
  }
  .platform-game:not([data-game='memory-pairs']) .game-notebook {
    padding: 12px;
  }
  .platform-game:not([data-game='memory-pairs']) .game-options > .syllable-pieces {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 94px), 1fr));
  }
}
