:root {
  --bg: #fff7e9;
  --bg-accent: #ffe2bf;
  --surface: rgba(255, 255, 255, 0.84);
  --surface-strong: #ffffff;
  --text: #274046;
  --muted: #5c6b73;
  --primary: #ff8a5b;
  --primary-dark: #ea6d3a;
  --secondary: #3ab7a5;
  --accent: #ffd166;
  --outline: rgba(39, 64, 70, 0.12);
  --shadow: 0 20px 45px rgba(127, 95, 61, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Nunito", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 209, 102, 0.45), transparent 26%),
    radial-gradient(circle at top right, rgba(58, 183, 165, 0.18), transparent 24%),
    linear-gradient(180deg, #fffdfa 0%, var(--bg) 100%);
}

button {
  font: inherit;
  cursor: pointer;
  border: 0;
}

.hidden {
  display: none !important;
}

.page-shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 36px;
}

.floating-avatar {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 12;
  pointer-events: none;
}

.player-picker-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(39, 64, 70, 0.28);
  backdrop-filter: blur(10px);
}

.player-picker-card {
  width: min(620px, 100%);
  padding: 26px;
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(39, 64, 70, 0.08);
  box-shadow: var(--shadow);
  text-align: center;
}

.player-picker-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.player-option {
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 22px 18px;
  border-radius: 28px;
  background: linear-gradient(180deg, #fffdf8, #eefaf7);
  border: 2px solid rgba(58, 183, 165, 0.18);
  box-shadow: 0 14px 26px rgba(58, 183, 165, 0.12);
}

.player-option.mini {
  min-width: 92px;
  padding: 10px 12px;
  border-radius: 20px;
  font-size: 0.9rem;
}

.player-emoji {
  font-size: 3.2rem;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: stretch;
  margin-bottom: 24px;
}

.hero-copy,
.hero-stats,
.panel,
.game-card,
.reward-card {
  backdrop-filter: blur(12px);
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.hero-copy {
  flex: 1.8;
  padding: 28px;
}

.hero-copy h1 {
  margin: 4px 0 8px;
  font: 800 clamp(2.2rem, 5vw, 4.5rem) "Baloo 2", cursive;
  line-height: 0.95;
  letter-spacing: -0.03em;
}

.hero-text {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.eyebrow {
  margin: 0;
  color: var(--secondary);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.74rem;
  font-weight: 800;
}

.hero-stats {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 16px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-radius: 22px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 240, 219, 0.92));
  min-height: 112px;
}

.stat-label,
.mini-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-card strong,
.progress-grid strong,
.reward-box strong {
  margin-top: 8px;
  font-size: clamp(1.1rem, 2vw, 1.5rem);
}

.layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 24px;
}

.sidebar,
.game-area {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel,
.game-card {
  padding: 22px;
}

.panel h2,
.game-card h2,
.word-health h3 {
  margin: 0 0 14px;
  font-family: "Baloo 2", cursive;
  font-size: 1.5rem;
  line-height: 1;
}

.difficulty-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill,
.ghost-button,
.secondary-button,
.primary-button {
  border-radius: 999px;
  padding: 12px 16px;
  font-weight: 800;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.pill {
  background: rgba(58, 183, 165, 0.12);
  color: var(--secondary);
}

.pill.active,
.pill:hover,
.ghost-button:hover,
.secondary-button:hover,
.primary-button:hover {
  transform: translateY(-1px);
}

.pill.active {
  background: var(--secondary);
  color: #fff;
}

.helper-text,
.instruction,
.feedback,
.word-health li {
  color: var(--muted);
}

.world-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  padding: 8px 6px 8px 42px;
}

.world-list::before {
  content: "";
  position: absolute;
  left: 26px;
  top: 12px;
  bottom: 12px;
  width: 8px;
  border-radius: 999px;
  background:
    repeating-linear-gradient(
      180deg,
      rgba(255, 209, 102, 0.9) 0 18px,
      rgba(58, 183, 165, 0.5) 18px 36px
    );
  opacity: 0.9;
}

.world-button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  text-align: left;
  border-radius: 24px;
  padding: 14px 16px 14px 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid transparent;
  position: relative;
}

.world-button.active {
  background: linear-gradient(135deg, rgba(255, 209, 102, 0.42), rgba(58, 183, 165, 0.26));
  border-color: rgba(58, 183, 165, 0.3);
}

.world-button::before {
  content: "";
  position: absolute;
  left: -31px;
  top: 50%;
  width: 22px;
  height: 22px;
  transform: translateY(-50%);
  border-radius: 999px;
  background: #fff4d9;
  border: 4px solid rgba(255, 209, 102, 0.92);
  box-shadow: 0 6px 12px rgba(255, 209, 102, 0.22);
}

.world-button.active::before {
  background: #ffffff;
  border-color: var(--secondary);
}

.world-button.completed::before {
  border-color: #ff8a5b;
}

.world-button-inner {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.world-title {
  font-weight: 800;
}

.world-subtitle {
  color: var(--muted);
  font-size: 0.86rem;
}

.world-token {
  position: absolute;
  left: -58px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  background: #ffffff;
  border: 2px solid rgba(58, 183, 165, 0.35);
  box-shadow: 0 8px 16px rgba(58, 183, 165, 0.18);
}

.world-token.girl {
  background: linear-gradient(180deg, #fff2f7, #ffd6e6);
}

.world-token.boy {
  background: linear-gradient(180deg, #eef8ff, #d2efff);
}

.world-button span:last-child {
  color: var(--muted);
  font-size: 0.9rem;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}

.ghost-button,
.secondary-button {
  background: rgba(39, 64, 70, 0.07);
  color: var(--text);
}

.primary-button {
  background: linear-gradient(135deg, var(--primary), #ffb36b);
  color: #fff;
  box-shadow: 0 12px 24px rgba(255, 138, 91, 0.28);
}

.parent-content.hidden {
  display: none;
}

.progress-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.progress-grid > div,
.reward-box,
.word-health {
  border-radius: 18px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.custom-word-form {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.form-field {
  display: grid;
  gap: 6px;
}

.form-field input,
.form-field select {
  width: 100%;
  border: 1px solid rgba(39, 64, 70, 0.14);
  border-radius: 14px;
  background: #fffdf8;
  color: var(--text);
  padding: 12px 14px;
  font: inherit;
}

.form-field input:focus,
.form-field select:focus {
  outline: 2px solid rgba(58, 183, 165, 0.25);
  border-color: rgba(58, 183, 165, 0.5);
}

#customWordFeedback {
  min-height: 20px;
  margin: 10px 0 0;
}

.word-health ul {
  margin: 10px 0 0;
  padding-left: 18px;
}

.game-card {
  padding: 26px;
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.challenge-visual {
  min-height: 140px;
  display: grid;
  place-items: center;
  font-size: clamp(4rem, 12vw, 7rem);
  border-radius: 24px;
  margin: 20px 0 12px;
  background:
    linear-gradient(135deg, rgba(255, 209, 102, 0.25), rgba(58, 183, 165, 0.14)),
    rgba(255, 255, 255, 0.6);
}

.avatar-stage {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.58);
  pointer-events: auto;
}

.avatar-stage.compact {
  width: 180px;
  gap: 8px;
  padding: 12px;
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.avatar-character {
  position: relative;
  width: 110px;
  height: 138px;
  display: grid;
  justify-items: center;
  align-content: start;
  transition: transform 180ms ease, filter 180ms ease;
  --avatar-skin: #ffd8b6;
  --avatar-clothes-top: #ff8a5b;
  --avatar-clothes-bottom: #ffb36b;
  --avatar-shoes: #f28d35;
  --avatar-hair: #5e3822;
}

.avatar-stage.compact .avatar-character {
  width: 76px;
  height: 100px;
}

.avatar-head {
  width: 62px;
  height: 62px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--avatar-skin);
  border: 3px solid rgba(39, 64, 70, 0.12);
  z-index: 2;
}

.avatar-stage.compact .avatar-head {
  width: 46px;
  height: 46px;
}

.avatar-face {
  font-size: 1.9rem;
}

.avatar-stage.compact .avatar-face {
  font-size: 1.4rem;
}

.avatar-body {
  width: 58px;
  height: 44px;
  margin-top: -4px;
  border-radius: 18px 18px 16px 16px;
  background: linear-gradient(180deg, var(--avatar-clothes-top), var(--avatar-clothes-bottom));
}

.avatar-character[data-outfit-type="bermuda"] .avatar-body {
  height: 38px;
  border-radius: 18px 18px 10px 10px;
}

.avatar-character[data-outfit-type="saia"] .avatar-body {
  width: 64px;
  height: 44px;
  clip-path: polygon(18% 0%, 82% 0%, 100% 100%, 0% 100%);
}

.avatar-character[data-outfit-type="vestido"] .avatar-body {
  width: 70px;
  height: 54px;
  clip-path: polygon(16% 0%, 84% 0%, 100% 100%, 0% 100%);
}

.avatar-stage.compact .avatar-body {
  width: 42px;
  height: 32px;
}

.avatar-stage.compact .avatar-character[data-outfit-type="saia"] .avatar-body,
.avatar-stage.compact .avatar-character[data-outfit-type="vestido"] .avatar-body {
  width: 48px;
}

.avatar-stage.compact .avatar-character[data-outfit-type="vestido"] .avatar-body {
  height: 38px;
}

.avatar-arms,
.avatar-legs {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.avatar-arms::before,
.avatar-arms::after,
.avatar-legs::before,
.avatar-legs::after {
  content: "";
  position: absolute;
  width: 12px;
  border-radius: 999px;
  background: var(--avatar-skin);
}

.avatar-hair {
  position: absolute;
  top: -2px;
  width: 66px;
  height: 30px;
  background: var(--avatar-hair);
  border-radius: 28px 28px 18px 18px;
  z-index: 3;
}

.avatar-stage.compact .avatar-hair {
  width: 48px;
  height: 22px;
}

.avatar-character[data-hair-style="trancas"] .avatar-hair::after {
  content: "";
  position: absolute;
  right: -10px;
  top: 8px;
  width: 12px;
  height: 28px;
  border-radius: 999px;
  background: var(--avatar-hair);
  box-shadow: -54px 0 0 0 var(--avatar-hair);
}

.avatar-character[data-hair-style="curto"] .avatar-hair {
  height: 20px;
  border-radius: 20px 20px 10px 10px;
}

.avatar-character[data-hair-style="medio"] .avatar-hair {
  height: 26px;
  border-radius: 26px 26px 16px 16px;
}

.avatar-character[data-hair-style="comprido"] .avatar-hair {
  height: 36px;
  border-radius: 26px 26px 20px 20px;
}

.avatar-arms {
  top: 62px;
  width: 90px;
  height: 34px;
}

.avatar-stage.compact .avatar-arms {
  top: 44px;
  width: 62px;
  height: 24px;
}

.avatar-arms::before {
  left: 8px;
  height: 36px;
  transform: rotate(38deg);
}

.avatar-arms::after {
  right: 8px;
  height: 36px;
  transform: rotate(-38deg);
}

.avatar-legs {
  top: 94px;
  width: 60px;
  height: 40px;
}

.avatar-stage.compact .avatar-legs {
  top: 67px;
  width: 42px;
  height: 28px;
}

.avatar-legs::before {
  left: 10px;
  height: 40px;
}

.avatar-legs::after {
  right: 10px;
  height: 40px;
}

.avatar-shoes {
  position: absolute;
  top: 122px;
  width: 56px;
  height: 14px;
}

.avatar-stage.compact .avatar-shoes {
  top: 86px;
  width: 40px;
  height: 10px;
}

.avatar-shoes::before,
.avatar-shoes::after {
  content: "";
  position: absolute;
  bottom: 0;
  width: 18px;
  height: 10px;
  border-radius: 10px 10px 8px 8px;
  background: var(--avatar-shoes);
}

.avatar-shoes::before {
  left: 7px;
}

.avatar-shoes::after {
  right: 7px;
}

.avatar-accessory {
  position: absolute;
  top: -12px;
  right: -10px;
  font-size: 1.2rem;
  z-index: 4;
}

.avatar-stage.compact .avatar-accessory {
  top: -10px;
  right: -8px;
  font-size: 1rem;
}

.avatar-character.girl .avatar-body {
  background: linear-gradient(180deg, #ff7ca8, #ffb3c9);
}

.avatar-character.boy .avatar-body {
  background: linear-gradient(180deg, #5bb8ff, #95ddff);
}

.avatar-character.happy {
  animation: dance 0.9s ease-in-out 2;
}

.avatar-character.sad {
  transform: translateY(8px) scale(0.97);
  filter: saturate(0.8);
}

.avatar-character.sad .avatar-head {
  background: #f5d1bd;
}

.avatar-caption {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
  font-size: 0.84rem;
}

.avatar-switcher {
  display: flex;
  gap: 8px;
}

.instruction {
  margin: 0 0 18px;
  font-size: 1.05rem;
}

.slots,
.letter-bank,
.choice-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.slots {
  margin-bottom: 18px;
}

.slot,
.letter-tile {
  width: min(76px, calc(20vw - 8px));
  aspect-ratio: 1 / 1;
  border-radius: 22px;
  display: grid;
  place-items: center;
  font: 800 clamp(1.4rem, 4vw, 2rem) "Baloo 2", cursive;
  user-select: none;
}

.slot {
  background: #fff;
  border: 2px dashed rgba(39, 64, 70, 0.15);
}

.slot.revealed {
  background: rgba(58, 183, 165, 0.12);
  border-style: solid;
}

.slot.empty {
  color: transparent;
}

.slot.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(255, 138, 91, 0.12);
}

.slot.correct {
  animation: pop 260ms ease;
}

.slot.hint {
  animation: glow 800ms ease-in-out 2;
}

.letter-bank {
  min-height: 88px;
}

.choice-bank {
  min-height: 88px;
}

.choice-bank.hidden {
  display: none;
}

.letter-tile {
  background: linear-gradient(180deg, #ffffff, #fff1d7);
  color: var(--text);
  border: 2px solid rgba(255, 209, 102, 0.4);
  box-shadow: 0 10px 18px rgba(255, 209, 102, 0.16);
}

.choice-tile {
  min-width: 180px;
  padding: 18px 20px;
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff, #eefaf7);
  color: var(--text);
  border: 2px solid rgba(58, 183, 165, 0.22);
  box-shadow: 0 10px 18px rgba(58, 183, 165, 0.12);
  font-weight: 800;
}

.choice-tile.unhealthy {
  background: linear-gradient(180deg, #ffffff, #fff0ea);
  border-color: rgba(255, 138, 91, 0.25);
  box-shadow: 0 10px 18px rgba(255, 138, 91, 0.12);
}

.letter-tile:disabled {
  opacity: 0.45;
  cursor: default;
}

.letter-tile.wrong {
  animation: wiggle 320ms ease;
}

.feedback {
  min-height: 28px;
  margin: 14px 0;
  font-weight: 800;
}

.feedback.success {
  color: #1f8b64;
}

.feedback.warning {
  color: #b56c11;
}

.card-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.rewards-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.reward-card {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 18px 20px;
}

.reward-icon {
  font-size: 2rem;
}

@keyframes wiggle {
  0%,
  100% {
    transform: translateX(0);
  }
  30% {
    transform: translateX(-5px);
  }
  70% {
    transform: translateX(5px);
  }
}

@keyframes pop {
  0% {
    transform: scale(0.9);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes glow {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 138, 91, 0);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(255, 138, 91, 0.18);
  }
}

@keyframes dance {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  20% {
    transform: translateY(-6px) rotate(-7deg);
  }
  40% {
    transform: translateY(0) rotate(6deg);
  }
  60% {
    transform: translateY(-8px) rotate(-5deg);
  }
  80% {
    transform: translateY(0) rotate(5deg);
  }
}

@media (max-width: 980px) {
  .hero,
  .layout {
    grid-template-columns: 1fr;
    display: grid;
  }

  .hero-stats,
  .progress-grid,
  .rewards-strip {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 20px, 100%);
    padding-top: 16px;
  }

  .hero-copy,
  .panel,
  .game-card,
  .reward-card {
    border-radius: 24px;
  }

  .hero-copy {
    padding: 22px;
  }

  .card-top,
  .panel-heading {
    flex-direction: column;
    align-items: stretch;
  }

  .card-actions {
    flex-direction: column;
  }

  .slot,
  .letter-tile {
    width: calc(25vw - 12px);
    min-width: 58px;
  }
}
