/* Jogos pedagógicos copiados de Susan, com variáveis isoladas para a Clínica Zimmermann. */
#jogos, .game-modal {
  --soft-bg: #f7f6fb;
  --primary: #A294B8;
  --button: #A294B8;
  --white: #fff;
  --text: #354038;
  --muted: #66716b;
  --border: rgba(82,89,71,.22);
  --gold-soft: #fff3d3;
  --pink-soft: #eee7f4;
  --title: var(--display);
  --shadow-md: 0 12px 28px rgba(25,63,89,.18);
}

#jogos.games-section { background: var(--soft-bg); text-align: center; }
#jogos .games-heading { max-width: 720px; margin: 0 auto 2.5rem; }
#jogos .games-heading .label { color: var(--primary); }
#jogos .games-heading h2 { color: var(--text); margin: .7rem 0 1rem; }
#jogos .games-heading > p:last-child { color: var(--text); }
.games-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.4rem; max-width: 900px; margin: auto; }
.game-choice { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: .75rem; padding: 2rem; border: 2px solid var(--border); border-radius: 24px; background: var(--white); color: var(--text); cursor: pointer; font: inherit; box-shadow: var(--shadow-md); transition: transform .2s, box-shadow .2s, border-color .2s; }
.game-choice:hover, .game-choice:focus-visible { transform: translateY(-4px); border-color: var(--primary); box-shadow: var(--shadow-md); }
.game-choice-icon { font-size: 3rem; }
.game-choice-preview { display: block; width: 100%; aspect-ratio: 1 / 1; height: auto; object-fit: contain; border-radius: 14px; background: var(--soft-bg); }
.game-choice-preview.memory-preview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); align-items: center; justify-items: center; gap: .4rem; padding: .8rem; overflow: hidden; }
.memory-preview img { display: block; width: 100%; height: 100%; max-height: 100%; object-fit: contain; border-radius: 7px; }
.game-choice-title { font-family: var(--title); font-size: clamp(1.4rem, 3vw, 1.8rem); font-weight: 700; color: var(--text); }
.game-choice-desc { line-height: 1.5; }
.game-choice-action { margin-top: auto; padding-top: 1rem; color: var(--primary); font-weight: 700; }
body.game-open { overflow: hidden !important; }
.game-modal[hidden] { display: none; }
.game-modal { position: fixed; z-index: 10000; inset: 0; width: 100vw; height: 100vh; height: 100dvh; overflow: auto; background: var(--soft-bg); color: var(--text); }
.game-shell { min-height: 100%; max-width: 1000px; margin: auto; padding: clamp(1rem, 3vw, 2rem); display: flex; flex-direction: column; align-items: center; }
.game-header { width: 100%; display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.game-header .label { color: var(--primary); margin-bottom: .3rem; }
.game-header h2 { color: var(--text); font-family: var(--title); font-size: clamp(1.5rem, 4vw, 2.5rem); }
.game-close, .game-restart { border: 0; border-radius: 999px; padding: .8rem 1.2rem; background: var(--button); color: var(--white); font: inherit; font-weight: 700; cursor: pointer; }
.game-close { flex-shrink: 0; }
.game-close span { font-size: 1.4rem; line-height: 0; margin-left: .3rem; }
.game-instructions { text-align: center; margin: 1.3rem 0 .5rem; }
.game-status { min-height: 1.7rem; font-weight: 700; color: var(--primary); text-align: center; }
.game-board { width: min(100%, 560px); margin: 1.2rem auto; display: grid; gap: clamp(.45rem, 1.5vw, .8rem); }
.memory-board { grid-template-columns: repeat(4, 1fr); }
.memory-card { aspect-ratio: 4 / 5; border: 2px solid var(--border); border-radius: 16px; background: var(--gold-soft); color: var(--text); font: inherit; font-size: clamp(1.5rem, 5vw, 3rem); cursor: pointer; display: flex; align-items: center; justify-content: center; flex-direction: column; overflow: hidden; }
.memory-picture { display: block; width: 82%; max-height: 80%; object-fit: contain; }
.memory-card small { font-size: clamp(.55rem, 1.7vw, .85rem); font-weight: 700; }
.memory-card.revealed, .memory-card.matched { background: var(--white); }
.memory-card.matched { border-color: var(--primary); background: var(--pink-soft); }
.puzzle-board { max-width: 480px; aspect-ratio: 1; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(0, 1fr)); gap: 0; padding: 0; overflow: hidden; border-radius: 8px; background: var(--white); box-shadow: var(--shadow-md); }
.puzzle-piece { display: block; aspect-ratio: 1; width: 100%; border: 0; border-radius: 0; background-image: url('../jogo-perrito.png'); background-size: 300% 300%; background-repeat: no-repeat; cursor: pointer; }
.puzzle-piece.selected { position: relative; z-index: 2; outline: 4px solid var(--primary); outline-offset: -4px; }
.puzzle-piece:hover { filter: brightness(1.06); }
.puzzle-reference[hidden] { display: none; }
.puzzle-reference { display: flex; align-items: center; gap: .7rem; margin-bottom: 1rem; color: var(--muted); font-size: .8rem; }
.puzzle-reference img { width: 64px; height: 64px; border: 1px solid var(--border); border-radius: 5px; }
.game-hint { margin: 1rem 0 0; font-size: .85rem; color: var(--muted); }
.game-modal button:focus-visible { outline: 3px solid #693d8d; outline-offset: 3px; }
@media (max-width: 650px) { .games-choices { grid-template-columns: 1fr; } .game-choice { padding: 1.5rem; } .game-header { align-items: center; } .game-close { padding: .6rem .85rem; } }

/* Vitrine interativa dos jogos */
#jogos.games-section { position: relative; overflow: hidden; background: linear-gradient(180deg, #28b4ee 0%, #87dbf4 64%, #d9f3ea 83%, #8dc954 84%, #70b846 100%); padding-block: clamp(3rem, 6vw, 5rem); }
#jogos.games-section::after { content: ''; position: absolute; inset: auto -5% -55px; height: 135px; background: #58a83d; border-radius: 50% 50% 0 0; }
.games-content { position: relative; z-index: 2; }
.games-sky { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.games-sky span { position: absolute; font-size: clamp(1.8rem, 5vw, 3.4rem); opacity: .9; }
.games-sky span:nth-child(1) { top: 8%; left: 10%; transform: rotate(-15deg); }
.games-sky span:nth-child(2) { top: 20%; left: -2%; font-size: 5rem; }
.games-sky span:nth-child(3) { top: 22%; right: 5%; }
.games-sky span:nth-child(4) { top: 12%; right: 26%; color: #fff; }
.games-sky span:nth-child(5) { top: 48%; right: -1%; font-size: 5rem; }
.games-sky span:nth-child(6) { bottom: 12%; left: 5%; }
#jogos .games-heading { max-width: 660px; margin-bottom: 2rem; }
.games-mascot { display: inline-grid; place-items: center; width: 78px; height: 78px; margin-bottom: .8rem; border: 5px solid #fff; border-radius: 24px; background: #ffca52; box-shadow: 0 8px 0 #dc9a39, 0 14px 25px #1477a84d; font-size: 2.7rem; transform: rotate(-5deg); }
#jogos .games-heading .label { color: #115470; font-weight: 800; }
#jogos .games-heading h2 { margin: .3rem 0 .5rem; color: #fff; font-family: var(--title); font-size: clamp(2.2rem, 6vw, 4.3rem); line-height: 1.06; text-shadow: 0 4px 0 #2685b7, 0 8px 18px #146e9b66; }
#jogos .games-heading > p:last-child { color: #164f67; font-weight: 700; }
.games-carousel-wrap { display: flex; align-items: center; justify-content: center; gap: .5rem; max-width: 780px; margin: auto; }
.games-choices { display: flex; flex: 1 1 auto; min-width: 0; gap: 1.4rem; width: min(100%, 680px); max-width: none; margin: 0; padding: 1rem max(0px, calc((100% - 260px) / 2)) 1.7rem; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scroll-padding-inline: max(0px, calc((100% - 260px) / 2)); scrollbar-width: none; overscroll-behavior-inline: contain; touch-action: pan-y; }
.games-choices::-webkit-scrollbar { display: none; }
.game-choice { flex: 0 0 260px; min-height: 360px; gap: .5rem; padding: .8rem .8rem 1.1rem; border: 5px solid #fff; border-radius: 24px; scroll-snap-align: center; color: #233d55; background: linear-gradient(160deg, #ffd449, #f4a02e); box-shadow: 0 9px 0 #d78d31, 0 15px 28px #135f8855; transform: rotate(-3deg) scale(.95); transition: transform .25s, box-shadow .25s; user-select: none; }
.game-choice:nth-child(2) { background: linear-gradient(160deg, #74d8fb, #2caee9); box-shadow: 0 9px 0 #1982bd, 0 15px 28px #135f8855; transform: rotate(3deg) scale(.95); }
.game-choice.is-active, .game-choice:nth-child(2).is-active { transform: rotate(0) scale(1); }
.game-choice:hover, .game-choice:focus-visible { border-color: #fff; box-shadow: 0 9px 0 #1982bd, 0 18px 34px #135f8870; }
.game-choice-preview { width: 100%; aspect-ratio: 1 / 1; border: 3px solid #fff; border-radius: 15px; background: #fffaf0; }
.game-choice-preview.memory-preview { gap: .15rem; padding: .35rem; }
.game-choice-title { width: 100%; color: #fff; font-family: var(--sans); font-size: 1.2rem; font-weight: 800; text-align: center; text-shadow: 0 2px 3px #6f4b3270; }
.game-choice-desc { color: #203d52; font-size: .78rem; line-height: 1.35; text-align: center; }
.game-choice-action { align-self: center; margin-top: auto; padding: .4rem .85rem; border-radius: 999px; background: #fff; color: #195c7b; font-size: .83rem; }
.games-arrow { position: relative; z-index: 3; flex: 0 0 42px; width: 42px; height: 42px; border: 3px solid #fff; border-radius: 50%; background: #fff9; color: #11698f; font-size: 2rem; font-weight: 700; line-height: 1; box-shadow: 0 3px 12px #146e9b44; }
.games-arrow:hover { background: #fff; }
.games-dots { display: flex; justify-content: center; gap: .55rem; margin-top: .3rem; }
.games-dots button { width: 12px; height: 12px; border: 2px solid #fff; border-radius: 50%; background: #ffffff80; }
.games-dots button.is-active { width: 30px; border-radius: 99px; background: #fff; }
@media (max-width: 650px) { .games-carousel-wrap { gap: 0; } .games-arrow { display: none; } .games-choices { width: calc(100vw - 2rem); flex-direction: row; padding-inline: calc((100% - 230px) / 2); scroll-padding-inline: calc((100% - 230px) / 2); } .game-choice { flex-basis: 230px; min-height: 340px; padding: .65rem; } .games-sky span:nth-child(2), .games-sky span:nth-child(5) { opacity: .45; } }

/* O seletor acompanha o dedo em vez de depender do scroll interno. */
.games-choices { display: block; overflow: hidden; padding: 1rem 0 1.7rem; scroll-snap-type: none; touch-action: pan-y; }
.games-track { position: relative; display: flex; gap: 1.4rem; width: max-content; will-change: transform; }
@media (max-width: 650px) {
.games-choices { width: 100%; padding-inline: 0; }
.games-track { gap: .8rem; }
.game-choice { flex: 0 0 230px; }
}
@media (max-width: 480px) { .game-choice { flex-basis: 210px; } }

@media (max-width: 480px) {
.game-shell { padding: .8rem; }
.game-header h2 { font-size: 1.4rem; }
.game-close { padding: .55rem .7rem; font-size: .78rem; }
.memory-board { gap: .3rem; }
.memory-card { border-radius: 9px; }
}

#jogos .games-heading h2 { color: #fff !important; }
