* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-blue: #39a9db;
  --dark-blue: #176b9c;
  --success-green: #2f9e44;
  --warning-red: #ff6b6b;
  --bg-light: #e8fbff;
  --bg-warm: #fff8de;
  --text-dark: #263238;
  --text-muted: #52616b;
  --white: #ffffff;
}

body {
  font-family: "Nunito", Arial, sans-serif;
  background: linear-gradient(160deg, var(--bg-light) 0%, var(--bg-warm) 100%);
  min-height: 100vh;
  color: var(--text-dark);
  overflow-x: hidden;
}

.game-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 16px;
}

/* Cabeçalho */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--white);
  padding: 16px 24px;
  border-radius: 16px;
  margin-bottom: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  font-weight: 700;
  font-size: 18px;
  color: var(--text-dark);
  flex-wrap: wrap;
  gap: 12px;
}

.game-title {
  flex: 1;
  text-align: center;
  font-size: 28px;
  min-width: 200px;
}

.header-left,
.header-right {
  font-size: 16px;
  white-space: nowrap;
}

/* Container Principal */
.game-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
}

/* Seção de Pergunta */
.question-section {
  text-align: center;
  animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.question-skill {
  display: inline-block;
  background: rgba(57, 169, 219, 0.16);
  color: var(--dark-blue);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.question-text {
  font-size: 32px;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 20px;
  line-height: 1.3;
}

.question-image {
  height: 240px;
  display: grid;
  place-items: center;
  background: var(--white);
  border: 2px solid var(--primary-blue);
  border-radius: 16px;
  font-size: clamp(42px, 8vw, 72px);
  line-height: 1.15;
  overflow: hidden;
  overflow-wrap: anywhere;
  padding: 18px;
  text-align: center;
  white-space: normal;
}

.question-image--custom {
  font-size: clamp(34px, 5vw, 58px);
}

.water-scene {
  display: inline-grid;
  justify-items: center;
  gap: 14px;
  width: min(100%, 240px);
  padding: 10px;
}

.sequence-prompt,
.sequence-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 10px;
  border-radius: 16px;
  background: rgba(57, 169, 219, 0.08);
  border: 2px solid rgba(57, 169, 219, 0.16);
  width: min(100%, 280px);
}

.sequence-prompt {
  font-size: clamp(32px, 7vw, 56px);
}

.sequence-option span {
  font-size: clamp(28px, 7vw, 48px);
}

.sequence-arrow {
  font-size: clamp(24px, 6vw, 40px);
}

.boat {
  position: relative;
  width: 120px;
  height: 80px;
}

.boat__hull {
  position: absolute;
  bottom: 0;
  left: 8px;
  width: 104px;
  height: 34px;
  background: #e63946;
  border: 4px solid #263238;
  border-radius: 0 0 16px 16px;
}

.boat__mast {
  position: absolute;
  left: 56px;
  top: 0;
  width: 8px;
  height: 62px;
  background: #263238;
}

.boat__sail {
  position: absolute;
  left: 58px;
  top: 8px;
  width: 0;
  height: 0;
  border-left: 32px solid transparent;
  border-right: 32px solid transparent;
  border-bottom: 46px solid #f4a261;
}

.wave {
  width: 100%;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(90deg, #61a5c2 0%, #dbeafe 100%);
}

.wave--one {
  transform: translateX(8px);
}

.wave--two {
  width: 80%;
  transform: translateX(-8px);
}

.btn-text:empty {
  display: none;
}

.question-equation {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 2vw, 24px);
  max-width: 100%;
  flex-wrap: wrap;
}

.kid-with-backpack {
  position: relative;
  display: inline-grid;
  justify-items: center;
  align-items: start;
  width: 72px;
  height: 104px;
  flex: 0 0 auto;
}

.kid-with-backpack__bag {
  position: absolute;
  left: 6px;
  top: 32px;
  width: 34px;
  height: 48px;
  background: #e63946;
  border: 4px solid #263238;
  border-radius: 11px 11px 8px 8px;
  box-shadow: inset 0 -10px 0 rgba(128, 0, 0, 0.12);
}

.kid-with-backpack__bag::before,
.kid-with-backpack__bag::after {
  content: "";
  position: absolute;
  top: 11px;
  width: 5px;
  height: 23px;
  background: #f4a261;
  border-radius: 999px;
}

.kid-with-backpack__bag::before {
  left: -8px;
}

.kid-with-backpack__bag::after {
  right: -8px;
}

.kid-with-backpack__head {
  position: relative;
  z-index: 2;
  width: 32px;
  height: 32px;
  margin-top: 4px;
  background: #f2b880;
  border: 4px solid #263238;
  border-radius: 50%;
}

.kid-with-backpack__head::before {
  content: "";
  position: absolute;
  left: 3px;
  top: -8px;
  width: 22px;
  height: 13px;
  background: #263238;
  border-radius: 14px 14px 5px 5px;
}

.kid-with-backpack__body {
  position: relative;
  z-index: 2;
  width: 32px;
  height: 38px;
  margin-top: -1px;
  background: #39a9db;
  border: 4px solid #263238;
  border-radius: 12px 12px 8px 8px;
}

.kid-with-backpack__body::before,
.kid-with-backpack__body::after {
  content: "";
  position: absolute;
  top: 7px;
  width: 10px;
  height: 28px;
  background: #f2b880;
  border: 3px solid #263238;
  border-radius: 999px;
}

.kid-with-backpack__body::before {
  left: -13px;
}

.kid-with-backpack__body::after {
  right: -13px;
}

.kid-with-backpack__legs {
  position: relative;
  z-index: 2;
  width: 30px;
  height: 30px;
}

.kid-with-backpack__legs::before,
.kid-with-backpack__legs::after {
  content: "";
  position: absolute;
  top: 0;
  width: 11px;
  height: 28px;
  background: #2f3e9e;
  border: 3px solid #263238;
  border-radius: 0 0 999px 999px;
}

.kid-with-backpack__legs::before {
  left: 2px;
}

.kid-with-backpack__legs::after {
  right: 2px;
}

/* Seção de Respostas */
.answers-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  justify-items: center;
}

.answer-btn {
  width: 100%;
  max-width: 240px;
  min-height: 176px;
  background: var(--white);
  border: 3px solid var(--primary-blue);
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  font-family: inherit;
  font-weight: 700;
  font-size: 18px;
  color: var(--text-dark);
}

.answer-btn:hover:not(:disabled) {
  transform: scale(1.04);
  box-shadow: 0 8px 20px rgba(57, 169, 219, 0.3);
}

.answer-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.answer-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.answer-btn.correct {
  border-color: var(--success-green);
  background: rgba(47, 158, 68, 0.1);
  color: var(--success-green);
}

.answer-btn.wrong {
  border-color: var(--warning-red);
  background: rgba(255, 107, 107, 0.1);
  animation: shake 0.4s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

.btn-image {
  font-size: clamp(34px, 5vw, 52px);
  height: 92px;
  display: grid;
  place-items: center;
  width: 100%;
  line-height: 1.1;
  overflow: hidden;
  padding: 4px;
  text-align: center;
  white-space: normal;
}

.btn-image--custom {
  font-size: 16px;
}

.tooth-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 100%;
}

.tooth-step {
  position: relative;
  width: 58px;
  height: 84px;
  flex: 0 0 auto;
}

.tooth-step__label {
  position: absolute;
  left: 50%;
  bottom: -18px;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.tooth-step__tube {
  position: absolute;
  left: 4px;
  top: 2px;
  width: 18px;
  height: 42px;
  background: #f8fafc;
  border: 3px solid #263238;
  border-radius: 6px 6px 4px 4px;
  transform: rotate(-22deg);
}

.tooth-step__tube::before {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  top: -8px;
  height: 8px;
  background: #ffd166;
  border: 3px solid #263238;
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
}

.tooth-step__tube::after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  top: 15px;
  height: 11px;
  background: #8ecae6;
  border-radius: 999px;
}

.tooth-step__brush {
  position: absolute;
  left: 18px;
  bottom: 12px;
  width: 34px;
  height: 7px;
  background: #39a9db;
  border: 3px solid #263238;
  border-radius: 999px;
  transform: rotate(-10deg);
}

.tooth-step__brush::before {
  content: "";
  position: absolute;
  right: -6px;
  top: -9px;
  width: 11px;
  height: 15px;
  background: #ffffff;
  border: 3px solid #263238;
  border-radius: 5px;
}

.tooth-step__face {
  position: absolute;
  left: 6px;
  top: 8px;
  width: 38px;
  height: 38px;
  background: #ffd166;
  border: 3px solid #263238;
  border-radius: 50%;
}

.tooth-step__face::before,
.tooth-step__face::after {
  content: "";
  position: absolute;
  top: 12px;
  width: 4px;
  height: 4px;
  background: #263238;
  border-radius: 50%;
}

.tooth-step__face::before {
  left: 10px;
}

.tooth-step__face::after {
  right: 10px;
}

.tooth-step--brush .tooth-step__face {
  background-image: linear-gradient(#263238, #263238);
  background-position: center 25px;
  background-repeat: no-repeat;
  background-size: 13px 4px;
}

.tooth-step__brush--mouth {
  left: 20px;
  bottom: 13px;
  width: 30px;
  transform: rotate(-28deg);
  z-index: 2;
}

.tooth-step__cup {
  position: absolute;
  left: 4px;
  bottom: 6px;
  width: 18px;
  height: 26px;
  background: #8ecae6;
  border: 3px solid #263238;
  border-radius: 4px 4px 8px 8px;
}

.tooth-step__drop {
  position: absolute;
  right: 5px;
  bottom: 6px;
  width: 15px;
  height: 22px;
  background: #39a9db;
  border: 3px solid #263238;
  border-radius: 50% 50% 55% 55%;
  transform: rotate(45deg);
}

.tooth-step__drop::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  background: rgba(255, 255, 255, 0.65);
  border-radius: 999px;
}

.btn-text {
  font-size: 16px;
  line-height: 1.25;
  min-height: 40px;
  text-align: center;
}

/* Mensagem de Feedback */
.feedback-message {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--white);
  padding: 32px 48px;
  border-radius: 12px;
  font-size: 28px;
  font-weight: 800;
  color: var(--text-dark);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  text-align: center;
  z-index: 100;
  animation: popIn 0.3s ease-out;
  max-width: 80%;
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.feedback-message.hidden {
  display: none;
}

/* Tela de Fim */
.game-over {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.game-over.hidden {
  display: none;
}

.game-over-card {
  background: var(--white);
  border: 4px solid var(--primary-blue);
  border-radius: 24px;
  padding: 48px 32px;
  text-align: center;
  max-width: 500px;
  animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.game-over-card h2 {
  font-size: 42px;
  margin-bottom: 24px;
  color: var(--text-dark);
}

.final-score {
  font-size: 32px;
  font-weight: 800;
  color: var(--success-green);
  margin-bottom: 12px;
}

.final-text {
  font-size: 18px;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.restart-btn {
  background: var(--success-green);
  color: var(--white);
  border: none;
  border-radius: 12px;
  padding: 16px 48px;
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.restart-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 20px rgba(47, 158, 68, 0.3);
}

.restart-btn:active {
  transform: scale(0.98);
}

/* Responsivo */
@media (max-width: 768px) {
  .game-header {
    flex-direction: column;
    gap: 8px;
  }

  .game-title {
    font-size: 24px;
  }

  .question-text {
    font-size: 24px;
  }

  .question-image {
    height: 180px;
    font-size: clamp(36px, 12vw, 58px);
  }

  .kid-with-backpack {
    transform: scale(0.78);
    margin: -10px -8px;
  }

  .answers-section {
    grid-template-columns: 1fr;
  }

  .answer-btn {
    max-width: 100%;
  }

  .game-over-card {
    padding: 32px 24px;
  }

  .game-over-card h2 {
    font-size: 32px;
  }

  .final-score {
    font-size: 24px;
  }
}

.junior-game-container {
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 18px;
  background: #7bdff2;
}

.junior-game-container canvas {
  display: block;
  max-width: 100%;
}

@media (max-width: 820px) {
  .junior-shell {
    width: min(100% - 20px, 760px);
    padding-top: 12px;
  }

  .junior-hero {
    grid-template-columns: 1fr;
  }

  .junior-hero__copy,
  .junior-summary {
    padding: 18px;
  }

  .junior-game-panel {
    padding: 8px;
  }

  .junior-game-container {
    min-height: 68vh;
  }
}

/* Layout de introdução inspirado no Missão Código */
.page-shell {
  flex: 1;
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 14px 0 12px;
}

.hero.hero--compact,
.hero.hero--compact .hero__copy {
  min-height: auto !important;
  height: auto !important;
}

.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 0;
  align-items: start;
}

.hero__copy,
.game-panel {
  background: rgba(255, 252, 246, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 28px;
  box-shadow: 0 22px 50px rgba(28, 44, 55, 0.14);
  backdrop-filter: blur(16px);
  min-width: 0;
}

.hero__copy {
  padding: 18px 18px 16px;
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle at top right, rgba(31, 158, 211, 0.2), transparent 36%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.94), rgba(240, 251, 246, 0.9));
}

.hero__copy::after {
  content: "";
  position: absolute;
  inset: auto -38px -44px auto;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(17, 121, 93, 0.18), rgba(17, 121, 93, 0));
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
  font-size: 0.83rem;
  color: #0f5d48;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.34rem 0.65rem;
  border-radius: 999px;
  background: rgba(17, 121, 93, 0.1);
  border: 1px solid rgba(17, 121, 93, 0.14);
}

.hero__text {
  max-width: 58ch;
  margin-top: 0.65rem;
  font-size: 0.96rem;
  line-height: 1.45;
  margin-bottom: 0;
  color: #4f636f;
}

.game-panel {
  padding: 22px;
}

.game-panel--intro {
  align-self: start;
  background: linear-gradient(180deg, rgba(255, 253, 249, 0.98), rgba(249, 255, 252, 0.98));
}

.quick-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.quick-steps span {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid rgba(17, 121, 93, 0.16);
  color: #1c2c37;
  font-weight: 800;
  line-height: 1.25;
  flex-wrap: wrap;
  word-break: break-word;
}

.quick-steps strong {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #11795d;
  color: #fff;
}

.intro-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.button {
  border: 0;
  border-radius: 16px;
  padding: 14px 22px;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
  font-weight: 800;
  text-decoration: none;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

.button:hover {
  transform: translateY(-2px);
}

.button--primary {
  color: #fff;
  background: linear-gradient(135deg, #11795d, #0a5844);
  box-shadow: 0 14px 26px rgba(17, 121, 93, 0.24);
}

.game-layout {
  display: block;
  margin-top: 0;
}

.game-panel--challenge {
  border: 2px solid rgba(17, 121, 93, 0.18);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(242, 252, 247, 0.96));
}

.game-panel--challenge .intro-inline {
  margin-bottom: 10px;
  padding: 16px 18px;
}

.game-panel--challenge .intro-inline h2 {
  font-size: 1rem;
  margin-bottom: 12px;
}

.game-panel--challenge .intro-compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.game-panel--intro {
  max-width: 100%;
}

@media (max-width: 860px) {
  .game-layout {
    display: block;
  }

  .quick-steps {
    grid-template-columns: 1fr;
  }

  .game-panel--challenge .intro-compact {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .game-panel--challenge .intro-inline {
    padding: 12px 14px;
  }

  .game-panel--challenge .intro-inline h2 {
    font-size: 0.9rem;
    margin-bottom: 10px;
  }
}

@media (max-width: 480px) {
  .quick-steps span,
  .game-panel--challenge .intro-compact span {
    padding: 10px 12px;
    font-size: 0.9rem;
  }

  .quick-steps strong,
  .game-panel--challenge .intro-compact strong {
    width: 24px;
    height: 24px;
    font-size: 0.85rem;
  }

  .game-panel--challenge .intro-inline {
    padding: 10px 12px;
  }

  .game-panel--challenge .intro-inline h2 {
    font-size: 0.85rem;
    margin-bottom: 8px;
  }
}

.skip-link {
  position: absolute;
  left: 14px;
  top: -48px;
  z-index: 999;
  padding: 10px 14px;
  border-radius: 10px;
  background: #fff;
  color: #1c2c37;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid rgba(24, 41, 54, 0.1);
  transition: top 140ms ease;
}

.skip-link:focus {
  top: 14px;
}
