:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #fff7ed;
  color: #292524;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  display: grid;
  place-items: center;
  padding: 5.5rem 2rem 2rem;
  background:
    radial-gradient(circle at 15% 20%, #fde68a 0 8rem, transparent 8.1rem),
    radial-gradient(circle at 85% 80%, #bfdbfe 0 10rem, transparent 10.1rem),
    #fff7ed;
}

main {
  width: min(100%, 42rem);
  padding: clamp(2.5rem, 8vw, 5rem);
  text-align: center;
  background: rgb(255 255 255 / 88%);
  border: 3px solid #fb7185;
  border-radius: 2rem;
  box-shadow: 0 1.5rem 4rem rgb(120 53 15 / 15%);
}

h1 {
  margin: 0;
  font-size: clamp(2.5rem, 10vw, 5rem);
  line-height: 1.05;
  color: #e11d48;
}

h2 {
  margin: 2.5rem 0 1.25rem;
  font-size: clamp(1.35rem, 5vw, 2rem);
}

.player-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.player-button {
  min-height: 5rem;
  padding: 1rem;
  border: 0;
  border-radius: 1.25rem;
  color: white;
  font: inherit;
  font-size: clamp(1.05rem, 4vw, 1.35rem);
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 0.5rem 0 rgb(41 37 36 / 18%);
  text-shadow: 0 2px 4px rgb(41 37 36 / 65%);
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.player-animal {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 2.5rem;
}

.player-button[data-player="Julia"] {
  background: linear-gradient(
    135deg,
    #ef4444 0%,
    #f97316 20%,
    #eab308 38%,
    #22c55e 56%,
    #3b82f6 76%,
    #a855f7 100%
  );
}

.player-button[data-player="Andrea"] {
  background: linear-gradient(135deg, #e94498, #d6297d 55%, #b81761);
}

.player-button:hover {
  transform: translateY(-0.15rem);
  box-shadow: 0 0.65rem 0 rgb(41 37 36 / 18%);
}

.player-button:focus-visible {
  outline: 4px solid #fbbf24;
  outline-offset: 4px;
}

.player-button[aria-pressed="true"] {
  outline: 5px solid #fbbf24;
  transform: translateY(0.2rem);
  box-shadow: 0 0.2rem 0 rgb(41 37 36 / 18%);
}

.games-title {
  margin-top: 0;
  color: #e11d48;
}

.games-intro {
  margin-bottom: 2rem;
  font-size: clamp(1.1rem, 4vw, 1.4rem);
  color: #57534e;
}

.game-card {
  width: 100%;
  padding: 1.5rem;
  border: 3px solid #8b5cf6;
  border-radius: 1.5rem;
  background: #f5f3ff;
  color: #292524;
  font: inherit;
  cursor: pointer;
  box-shadow: 0 0.5rem 0 #ddd6fe;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.games-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.game-card:hover {
  transform: translateY(-0.15rem);
  box-shadow: 0 0.65rem 0 #ddd6fe;
}

.game-card:focus-visible,
.back-button:focus-visible {
  outline: 4px solid #fbbf24;
  outline-offset: 4px;
}

.game-icon {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 3.5rem;
}

.game-name {
  display: block;
  font-size: clamp(1.6rem, 6vw, 2.4rem);
  font-weight: 900;
  color: #6d28d9;
}

.game-description {
  display: block;
  margin-top: 0.4rem;
  font-size: 1rem;
  font-weight: 600;
  color: #57534e;
}

.back-button {
  margin-top: 2rem;
  padding: 0.8rem 1.2rem;
  border: 2px solid #78716c;
  border-radius: 999px;
  background: white;
  color: #44403c;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

#game-status {
  min-height: 1.5em;
  margin-top: 1.25rem;
  font-size: 1rem;
  color: #57534e;
}

main.memory-active {
  width: min(100%, 72rem);
  padding: clamp(1.25rem, 5vw, 3rem);
}

.memory-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.memory-title {
  margin: 0;
  color: #6d28d9;
}

.level-badge {
  flex: 0 0 auto;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  font-size: 1.05rem;
  font-weight: 900;
}

.memory-stats {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  color: #57534e;
  font-weight: 800;
}

.memory-board {
  display: grid;
  grid-template-columns: repeat(var(--columns, 4), minmax(0, 1fr));
  gap: clamp(0.4rem, 1.5vw, 0.8rem);
  width: 100%;
  max-width: var(--board-max-width, 52rem);
  margin: 0 auto;
}

.memory-card {
  aspect-ratio: 1;
  min-width: 0;
  padding: 0;
  border: 3px solid #7c3aed;
  border-radius: clamp(0.6rem, 2vw, 1rem);
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  color: white;
  font: inherit;
  font-size: clamp(1.5rem, 7vw, 3rem);
  font-weight: 900;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 0.3rem 0 #4c1d95;
  transition: transform 160ms ease, background 160ms ease;
}

.memory-card:hover:not(.revealed):not(.matched) {
  transform: translateY(-0.12rem);
}

.memory-card:focus-visible {
  outline: 4px solid #fbbf24;
  outline-offset: 2px;
}

.memory-card.revealed,
.memory-card.matched {
  transform: rotateY(180deg);
  background: white;
  color: #292524;
}

.memory-card.matched {
  border-color: #22c55e;
  background: #dcfce7;
  box-shadow: 0 0.3rem 0 #86efac;
}

.memory-card span {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
}

.memory-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.memory-card.revealed span,
.memory-card.matched span {
  transform: rotateY(180deg);
}

#memory-message {
  min-height: 1.6em;
  margin: 1.25rem 0 0;
  color: #166534;
  font-size: 1.1rem;
  font-weight: 800;
}

.source-note {
  margin: 1.5rem 0 0;
  color: #78716c;
  font-size: 0.78rem;
  line-height: 1.4;
}

.memory-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1rem;
}

.action-button {
  padding: 0.8rem 1.2rem;
  border: 0;
  border-radius: 999px;
  background: #16a34a;
  color: white;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.home-button {
  position: absolute;
  z-index: 120;
  top: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.75rem 1.25rem;
  border: 2px solid #57534e;
  border-radius: 999px;
  background: white;
  color: #292524;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
  box-shadow: 0 0.3rem 1rem rgb(41 37 36 / 18%);
}

.settings-button {
  position: absolute;
  z-index: 120;
  top: 0.75rem;
  right: 0.75rem;
  padding: 0.75rem 1.15rem;
  border: 2px solid #57534e;
  border-radius: 999px;
  background: white;
  color: #292524;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
  box-shadow: 0 0.3rem 1rem rgb(41 37 36 / 18%);
}

.home-button:focus-visible,
.settings-button:focus-visible {
  outline: 4px solid #fbbf24;
  outline-offset: 3px;
}

body.home-view {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: clamp(4.25rem, 10dvh, 5.5rem) 1rem clamp(0.75rem, 3dvh, 2rem);
}

body.home-view .home-button {
  display: none;
}

body.home-view main {
  max-height: 100%;
  padding: clamp(1rem, 4dvh, 3rem);
}

body.home-view h1 {
  font-size: clamp(2rem, min(10vw, 8dvh), 5rem);
}

body.home-view h2 {
  margin: clamp(1rem, 3dvh, 2rem) 0 clamp(0.75rem, 2.5dvh, 1.25rem);
}

body.home-view .player-button {
  min-height: clamp(4rem, 12dvh, 5rem);
  padding: clamp(0.55rem, 2dvh, 1rem);
}

body.home-view .player-animal {
  margin-bottom: 0.15rem;
  font-size: clamp(1.8rem, 6dvh, 2.5rem);
}

.home-confirm-dialog {
  width: min(calc(100% - 2rem), 28rem);
  padding: 0;
  border: 3px solid #8b5cf6;
  border-radius: 1.5rem;
  background: white;
  color: #292524;
  box-shadow: 0 1.5rem 4rem rgb(41 37 36 / 35%);
}

.home-confirm-dialog::backdrop {
  background: rgb(41 37 36 / 55%);
  backdrop-filter: blur(3px);
}

.home-confirm-content {
  padding: clamp(1.5rem, 6vw, 2.25rem);
  text-align: center;
}

.home-confirm-icon {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 3rem;
}

.home-confirm-title {
  margin: 0 0 0.75rem;
  color: #6d28d9;
  font-size: clamp(1.45rem, 6vw, 2rem);
}

.home-confirm-text {
  margin: 0;
  color: #57534e;
  font-size: 1.05rem;
  line-height: 1.5;
}

.home-confirm-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.settings-panel {
  width: min(100%, 34rem);
  margin: 0 auto;
}

.theme-options {
  display: grid;
  gap: 1rem;
  margin: 2rem 0;
}

.theme-option {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
  width: 100%;
  padding: 1rem 1.25rem;
  border: 3px solid #8b5cf6;
  border-radius: 1.25rem;
  background: #f5f3ff;
  color: #292524;
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 0.3rem 0 #ddd6fe;
}

.theme-option[aria-pressed="true"] {
  border-color: #16a34a;
  background: #dcfce7;
  box-shadow: 0 0 0 4px #bbf7d0;
}

.theme-option:focus-visible {
  outline: 4px solid #fbbf24;
  outline-offset: 3px;
}

.theme-icon {
  font-size: 2.5rem;
  line-height: 1;
}

.theme-name {
  display: block;
  font-size: 1.2rem;
  font-weight: 900;
}

.theme-description {
  display: block;
  margin-top: 0.2rem;
  color: #57534e;
  font-size: 0.9rem;
  font-weight: 650;
}

.theme-check {
  color: #15803d;
  font-size: 1.5rem;
  font-weight: 1000;
}

#theme-status {
  min-height: 1.5em;
  color: #166534;
  font-weight: 800;
}

.action-button.secondary {
  border: 2px solid #78716c;
  background: white;
  color: #44403c;
}

.action-button.next-level-button {
  margin-left: auto;
  background: #16a34a;
  color: white;
  box-shadow: 0 0.25rem 0 #166534;
}

.gameplay-actions {
  display: grid;
  grid-template-columns: auto auto minmax(0.75rem, 1fr) auto;
  min-height: 3.2rem;
  width: 100%;
  align-items: center;
  column-gap: 0.45rem;
  margin-top: 1.4rem;
}

.gameplay-actions .next-level-button {
  grid-column: 4;
  grid-row: 1;
  justify-self: end;
  min-width: 12rem;
  margin-left: 0;
  padding: 0.9rem 1.4rem;
  font-size: 1.05rem;
}

.gameplay-actions .next-level-button[hidden] {
  display: block !important;
  visibility: hidden;
  pointer-events: none;
}

.gameplay-actions .finish-home-button {
  grid-column: 4;
  grid-row: 1;
  justify-self: end;
  min-width: 12rem;
  margin-top: 0;
  padding: 0.9rem 1.35rem;
  background: #2563eb;
  color: white;
  font-size: 1.05rem;
  box-shadow: 0 0.25rem 0 #1e40af;
}

.gameplay-actions .secondary {
  grid-row: 1;
  display: grid;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border-width: 1px;
  border-color: #a8a29e;
  background: transparent;
  color: #78716c;
  font-size: 1.15rem;
  line-height: 1;
  font-weight: 700;
  opacity: 0.76;
  box-shadow: none;
}

.gameplay-actions .secondary:hover,
.gameplay-actions .secondary:focus-visible {
  opacity: 1;
}

.action-button:focus-visible {
  outline: 4px solid #fbbf24;
  outline-offset: 3px;
}

.grandpa-message {
  position: relative;
  margin: 1.5rem 0 11rem;
  padding: 1.25rem 1.4rem;
  border: 4px solid #292524;
  border-radius: 1.25rem;
  background: white;
  box-shadow: 0.5rem 0.55rem 0 #fbbf24;
  text-align: left;
}

.grandpa-message::before {
  position: absolute;
  z-index: 1;
  bottom: -0.78rem;
  left: 2rem;
  width: 1.35rem;
  height: 1.35rem;
  border-right: 4px solid #292524;
  border-bottom: 4px solid #292524;
  background: white;
  content: "";
  transform: rotate(45deg);
}

.grandpa-icon {
  position: absolute;
  z-index: 2;
  bottom: -10.4rem;
  left: 0;
  display: block;
  width: 7rem;
  height: auto;
  filter: drop-shadow(0.2rem 0.3rem 0 rgb(41 37 36 / 18%));
}

.grandpa-name {
  justify-self: start;
  padding: 0.25rem 0.7rem;
  border: 2px solid #292524;
  border-radius: 999px;
  background: #fbbf24;
  color: #422006;
  font-size: 0.9rem;
  font-weight: 950;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.grandpa-message p {
  margin: 0.75rem 0 0;
  color: #292524;
  font-size: clamp(1rem, 3vw, 1.2rem);
  font-family: ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.55;
}

.intro-start-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.intro-start-actions .next-level-button {
  margin-left: 0;
}

.intro-back-button {
  display: block;
  margin-top: 1.1rem;
  padding: 0.45rem 0;
  border: 0;
  background: transparent;
  color: #57534e;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
}

.intro-back-button:hover {
  color: #292524;
  text-decoration: underline;
}

.intro-back-button:focus-visible {
  outline: 4px solid #fbbf24;
  outline-offset: 3px;
}

.animal-progress {
  margin: 0 0 1rem;
  color: #57534e;
  font-size: 1.05rem;
  font-weight: 800;
}

.animal-picture {
  display: grid;
  place-items: center;
  min-height: 10rem;
  margin: 0 auto 1.5rem;
  font-size: clamp(6rem, 22vw, 10rem);
  line-height: 1;
}

.word-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.word-button {
  padding: 1rem 0.5rem;
  border: 3px solid #2563eb;
  border-radius: 1rem;
  background: #eff6ff;
  color: #1e40af;
  font: inherit;
  font-size: clamp(1rem, 4vw, 1.3rem);
  font-weight: 900;
  cursor: pointer;
}

.word-button:hover {
  background: #dbeafe;
}

.word-button.correct {
  border-color: #16a34a;
  background: #dcfce7;
  color: #166534;
}

.word-button.incorrect {
  border-color: #ef4444;
  background: #fee2e2;
  color: #991b1b;
}

.word-button:focus-visible {
  outline: 4px solid #fbbf24;
  outline-offset: 3px;
}

#animal-message,
#numbers-message {
  min-height: 1.6em;
  margin: 1.25rem 0 0;
  color: #166534;
  font-size: 1.1rem;
  font-weight: 850;
}

.counting-items {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: center;
  gap: clamp(0.4rem, 2vw, 0.8rem);
  min-height: 12rem;
  margin: 1rem auto 1.5rem;
  padding: 1.25rem;
  border: 3px dashed #f59e0b;
  border-radius: 1.5rem;
  background: #fffbeb;
}

.counting-item {
  font-size: clamp(2rem, 8vw, 3.6rem);
  line-height: 1;
}

.counting-item.reward-item {
  font-size: clamp(6rem, 24vw, 10rem);
}

.number-options {
  display: grid;
  grid-template-columns: repeat(var(--number-columns, 3), minmax(0, 1fr));
  gap: 0.75rem;
}

.number-button {
  min-height: 4.5rem;
  padding: 0.75rem;
  border: 3px solid #2563eb;
  border-radius: 1rem;
  background: #eff6ff;
  color: #1e40af;
  font: inherit;
  font-size: clamp(1.6rem, 7vw, 2.5rem);
  font-weight: 950;
  cursor: pointer;
}

.number-button:hover {
  background: #dbeafe;
}

.number-button.correct {
  border-color: #16a34a;
  background: #dcfce7;
  color: #166534;
}

.number-button.incorrect {
  border-color: #ef4444;
  background: #fee2e2;
  color: #991b1b;
}

.number-button:focus-visible {
  outline: 4px solid #fbbf24;
  outline-offset: 3px;
}

.relations-board {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(3rem, 13vw, 8rem) minmax(0, 1fr);
  gap: 0;
  width: min(100%, 58rem);
  margin: 1rem auto 0;
  padding: 0.5rem;
  border: 3px dashed #a78bfa;
  border-radius: 1.5rem;
  background: #faf5ff;
}

.relations-column {
  position: relative;
  z-index: 2;
  display: grid;
  align-content: start;
  gap: clamp(0.55rem, 1.5vw, 0.85rem);
}

.relations-column.left {
  grid-column: 1;
}

.relations-column.right {
  grid-column: 3;
}

.relation-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: clamp(0.35rem, 1vw, 0.65rem);
  align-items: center;
  min-width: 0;
  min-height: clamp(4.5rem, 9vw, 5.75rem);
  padding: clamp(0.45rem, 1.5vw, 0.75rem);
  border: 3px solid #7c3aed;
  border-radius: 1rem;
  background: white;
  color: #4c1d95;
  font: inherit;
  font-weight: 900;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 0.25rem 0 #ddd6fe;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
  touch-action: none;
  user-select: none;
}

.relation-item.right {
  border-color: #2563eb;
  color: #1e40af;
  box-shadow: 0 0.25rem 0 #bfdbfe;
}

.relation-item:hover:not(:disabled) {
  transform: translateY(-0.1rem);
}

.relation-item.selected {
  border-color: #f59e0b;
  background: #fffbeb;
  box-shadow: 0 0 0 4px #fde68a;
}

.relation-item.matched {
  border-color: #16a34a;
  background: #dcfce7;
  color: #166534;
  box-shadow: 0 0.25rem 0 #86efac;
  opacity: 1;
}

.relation-item:focus-visible {
  outline: 4px solid #fbbf24;
  outline-offset: 3px;
}

.relation-emoji {
  font-size: clamp(2rem, 6vw, 3.25rem);
  line-height: 1;
}

.relation-label {
  overflow-wrap: anywhere;
  font-size: clamp(0.72rem, 2.1vw, 1rem);
  line-height: 1.15;
}

.relations-lines {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.relations-lines line {
  stroke: #16a34a;
  stroke-width: 7;
  stroke-linecap: round;
  filter: drop-shadow(0 2px 1px rgb(22 101 52 / 25%));
}

.relations-lines line.active {
  stroke: #f59e0b;
  stroke-dasharray: 10 8;
}

.relations-lines line.incorrect {
  stroke: #ef4444;
}

#relations-message {
  min-height: 1.6em;
  margin: 1rem 0 0;
  color: #166534;
  font-size: 1.1rem;
  font-weight: 850;
}

.relations-reward {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 25rem;
  font-size: clamp(8rem, 28vw, 14rem);
}

.memory-reward {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: min(55vh, 25rem);
  font-size: clamp(8rem, 28vw, 14rem);
}

.differences-scenes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(0.75rem, 2vw, 1.25rem);
  width: min(100%, 68rem);
  margin: 1rem auto 0;
}

.difference-picture {
  min-width: 0;
}

.difference-picture-title {
  display: block;
  margin-bottom: 0.45rem;
  color: #6d28d9;
  font-size: 1rem;
  font-weight: 900;
}

.difference-panel {
  position: relative;
  width: 100%;
  aspect-ratio: 10 / 7;
  overflow: hidden;
  border: 4px solid #8b5cf6;
  border-radius: 1.25rem;
  background: #dbeafe;
  box-shadow: 0 0.35rem 0 #ddd6fe;
}

.difference-panel.wrong {
  animation: difference-shake 260ms ease-in-out;
}

.difference-scene-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.difference-hotspot {
  position: absolute;
  z-index: 3;
  transform: translate(-50%, -50%);
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: white;
  font: inherit;
  font-size: clamp(1rem, 4vw, 1.75rem);
  font-weight: 1000;
  cursor: crosshair;
  touch-action: manipulation;
}

.difference-hotspot.found {
  border: 5px solid #ef4444;
  background: rgb(239 68 68 / 28%);
  box-shadow: 0 0 0 3px white, 0 0 0 6px #ef4444;
}

.difference-hotspot:focus-visible {
  outline: 4px solid #fbbf24;
  outline-offset: 3px;
}

#differences-message {
  min-height: 1.6em;
  margin: 1rem 0 0;
  color: #166534;
  font-size: 1.1rem;
  font-weight: 850;
}

.differences-reward {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 28rem;
  border: 4px solid #8b5cf6;
  border-radius: 1.5rem;
  background: #faf5ff;
  font-size: clamp(8rem, 28vw, 14rem);
}

@keyframes difference-shake {
  25% {
    transform: translateX(-0.3rem);
  }

  75% {
    transform: translateX(0.3rem);
  }
}

.confetti-layer {
  position: fixed;
  z-index: 100;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.confetti-piece {
  position: absolute;
  top: -2rem;
  width: 0.7rem;
  height: 1.1rem;
  border-radius: 0.2rem;
  animation: confetti-fall var(--fall-time) ease-in forwards;
}

@keyframes confetti-fall {
  to {
    transform: translate3d(var(--drift), 110vh, 0) rotate(var(--spin));
  }
}

@media (prefers-reduced-motion: reduce) {
  .confetti-piece {
    animation-duration: 1ms;
  }

  .difference-panel.wrong {
    animation: none;
  }
}

html[data-theme="dark"] {
  color-scheme: dark;
  background: #0f172a;
  color: #f8fafc;
}

html[data-theme="dark"] body {
  background:
    radial-gradient(circle at 15% 20%, #713f12 0 8rem, transparent 8.1rem),
    radial-gradient(circle at 85% 80%, #1e3a8a 0 10rem, transparent 10.1rem),
    #0f172a;
}

html[data-theme="dark"] main {
  background: rgb(15 23 42 / 94%);
  border-color: #fb7185;
  box-shadow: 0 1.5rem 4rem rgb(0 0 0 / 40%);
}

html[data-theme="dark"] .games-intro,
html[data-theme="dark"] #game-status,
html[data-theme="dark"] .memory-stats,
html[data-theme="dark"] .animal-progress,
html[data-theme="dark"] .home-confirm-text,
html[data-theme="dark"] .theme-description,
html[data-theme="dark"] .source-note {
  color: #cbd5e1;
}

html[data-theme="dark"] .game-card,
html[data-theme="dark"] .theme-option {
  border-color: #a78bfa;
  background: #1e1b4b;
  color: #f8fafc;
  box-shadow: 0 0.5rem 0 #312e81;
}

html[data-theme="dark"] .game-description {
  color: #d6d3d1;
}

html[data-theme="dark"] .games-title {
  color: #fda4af;
}

html[data-theme="dark"] .game-name,
html[data-theme="dark"] .memory-title,
html[data-theme="dark"] .home-confirm-title {
  color: #c4b5fd;
}

html[data-theme="dark"] .back-button,
html[data-theme="dark"] .action-button.secondary,
html[data-theme="dark"] .home-button,
html[data-theme="dark"] .settings-button,
html[data-theme="dark"] .home-confirm-dialog {
  border-color: #94a3b8;
  background: #1e293b;
  color: #f8fafc;
}

html[data-theme="dark"] .gameplay-actions .secondary {
  border-color: #64748b;
  background: transparent;
  color: #94a3b8;
}

html[data-theme="dark"] .theme-option[aria-pressed="true"] {
  border-color: #4ade80;
  background: #14532d;
  box-shadow: 0 0 0 4px #166534;
}

html[data-theme="dark"] .grandpa-message,
html[data-theme="dark"] .counting-items {
  background: #1e293b;
}

html[data-theme="dark"] .grandpa-message {
  border-color: #e2e8f0;
  box-shadow: 0.5rem 0.55rem 0 #7c3aed;
}

html[data-theme="dark"] .counting-items {
  background: #422006;
}

html[data-theme="dark"] .grandpa-message::before {
  border-right-color: #e2e8f0;
  border-bottom-color: #e2e8f0;
  background: #1e293b;
}

html[data-theme="dark"] .grandpa-message p {
  color: #f8fafc;
}

html[data-theme="dark"] .grandpa-name {
  border-color: #e2e8f0;
  background: #7c3aed;
  color: white;
}

html[data-theme="dark"] .intro-back-button {
  color: #94a3b8;
}

html[data-theme="dark"] .intro-back-button:hover {
  color: #f8fafc;
}

html[data-theme="dark"] .memory-card.revealed,
html[data-theme="dark"] .relation-item {
  background: #1e293b;
  color: #ede9fe;
}

html[data-theme="dark"] .memory-card.matched,
html[data-theme="dark"] .relation-item.matched {
  border-color: #4ade80;
  background: #14532d;
  color: #dcfce7;
}

html[data-theme="dark"] .relations-board {
  border-color: #8b5cf6;
  background: #1e1b4b;
}

html[data-theme="dark"] .relation-item.right {
  color: #bfdbfe;
}

html[data-theme="dark"] .difference-picture-title {
  color: #c4b5fd;
}

html[data-theme="dark"] .difference-panel,
html[data-theme="dark"] .differences-reward {
  border-color: #a78bfa;
  background: #1e1b4b;
  box-shadow: 0 0.35rem 0 #312e81;
}

html[data-theme="dark"] .word-button,
html[data-theme="dark"] .number-button {
  background: #172554;
  color: #dbeafe;
}

html[data-theme="dark"] .word-button.correct,
html[data-theme="dark"] .number-button.correct {
  border-color: #4ade80;
  background: #14532d;
  color: #dcfce7;
}

html[data-theme="dark"] .word-button.incorrect,
html[data-theme="dark"] .number-button.incorrect {
  border-color: #f87171;
  background: #7f1d1d;
  color: #fee2e2;
}

html[data-theme="dark"] #memory-message,
html[data-theme="dark"] #animal-message,
html[data-theme="dark"] #numbers-message,
html[data-theme="dark"] #relations-message,
html[data-theme="dark"] #differences-message,
html[data-theme="dark"] #theme-status {
  color: #86efac;
}

@media (max-width: 34rem) {
  body {
    padding: 5rem 0.75rem 0.75rem;
  }

  main {
    padding: 1.5rem;
    border-radius: 1.4rem;
  }

  .home-button {
    left: 0.75rem;
    transform: none;
  }

  .home-button,
  .settings-button {
    padding: 0.7rem 0.85rem;
    font-size: 0.9rem;
  }

  .player-buttons {
    grid-template-columns: 1fr;
  }

  body.home-view {
    padding: 4.15rem 0.65rem 0.65rem;
  }

  body.home-view main {
    padding: clamp(0.85rem, 3dvh, 1.35rem);
  }

  body.home-view .player-buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
  }

  body.home-view .player-button {
    min-height: clamp(4.25rem, 14dvh, 5rem);
    padding-inline: 0.35rem;
    font-size: clamp(0.9rem, 3.8vw, 1.1rem);
  }

  .grandpa-message {
    margin-bottom: 8.75rem;
  }

  .grandpa-icon {
    bottom: -8.15rem;
    width: 5.5rem;
  }

  .games-list,
  .word-options {
    grid-template-columns: 1fr;
  }

  .relations-board {
    grid-template-columns: minmax(0, 1fr) 2.75rem minmax(0, 1fr);
    padding: 0.4rem;
  }

  .differences-scenes {
    grid-template-columns: 1fr;
  }

  .relation-item {
    grid-template-columns: 1fr;
    justify-items: center;
    padding: 0.4rem 0.2rem;
    text-align: center;
  }

  .memory-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .memory-actions:not(.gameplay-actions) .action-button.next-level-button {
    width: auto;
    margin-left: auto;
    order: 2;
  }

  .gameplay-actions {
    grid-template-columns: auto auto minmax(0.5rem, 1fr) auto;
  }

  .gameplay-actions .next-level-button {
    width: auto;
    max-width: 100%;
    min-width: 11rem;
  }

  .gameplay-actions .secondary {
    width: 2.2rem;
    height: 2.2rem;
    font-size: 1.05rem;
  }
}

/* Rediseño 2026: mobile-first, táctil y pensado para niñas de 4 a 6 años. */
:root {
  --app-bg: #f5f6ff;
  --app-surface: rgb(255 255 255 / 92%);
  --app-surface-solid: #ffffff;
  --app-surface-soft: #f7f7ff;
  --app-ink: #18213d;
  --app-muted: #68708b;
  --app-line: #e5e7f3;
  --app-primary: #6252f5;
  --app-primary-strong: #4f3ee8;
  --app-pink: #f052a4;
  --app-blue: #3b82f6;
  --app-green: #0f7f4c;
  --app-green-strong: #075d37;
  --app-yellow: #ffc83d;
  --app-coral: #ff6b6b;
  --app-mint: #42d3ad;
  --app-radius-xl: 2rem;
  --app-radius-lg: 1.35rem;
  --app-radius-md: 1rem;
  --app-shadow: 0 1.6rem 4.5rem rgb(75 61 155 / 14%);
  --app-shadow-card: 0 0.75rem 1.8rem rgb(47 43 89 / 10%);
  color: var(--app-ink);
  background: var(--app-bg);
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", "Arial Rounded MT Bold",
    system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  position: relative;
  isolation: isolate;
  grid-template-columns: minmax(0, 1fr);
  min-height: 100dvh;
  padding: 5.75rem clamp(0.75rem, 3vw, 2rem) 2rem;
  overflow-x: hidden;
  color: var(--app-ink);
  background:
    radial-gradient(circle at 8% 8%, rgb(255 200 61 / 32%) 0 9rem, transparent 9.1rem),
    radial-gradient(circle at 96% 12%, rgb(240 82 164 / 20%) 0 10rem, transparent 10.1rem),
    radial-gradient(circle at 90% 92%, rgb(66 211 173 / 22%) 0 12rem, transparent 12.1rem),
    linear-gradient(145deg, #fff9f3 0%, var(--app-bg) 42%, #f1f8ff 100%);
}

body::before {
  position: fixed;
  z-index: 0;
  inset: 0;
  opacity: 0.34;
  background-image: radial-gradient(circle, rgb(98 82 245 / 28%) 1.3px, transparent 1.4px);
  background-size: 1.5rem 1.5rem;
  content: "";
  pointer-events: none;
  mask-image: linear-gradient(to bottom, black, transparent 42%, black);
}

body::after {
  position: fixed;
  z-index: 0;
  right: -4rem;
  bottom: 10%;
  width: 11rem;
  height: 11rem;
  border: 2rem solid rgb(98 82 245 / 7%);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

main {
  position: relative;
  z-index: 1;
  min-width: 0;
  width: min(100%, 46rem);
  padding: clamp(1.35rem, 5vw, 3rem);
  border: 1px solid rgb(255 255 255 / 78%);
  border-radius: var(--app-radius-xl);
  background: var(--app-surface);
  box-shadow: var(--app-shadow), inset 0 1px 0 white;
  backdrop-filter: blur(1.25rem) saturate(1.12);
  text-align: center;
  animation: app-surface-in 360ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

main::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgb(98 82 245 / 4%);
  content: "";
  pointer-events: none;
}

main.memory-active {
  width: min(100%, 76rem);
  padding: clamp(1rem, 3.5vw, 2.5rem);
}

section {
  min-width: 0;
}

h1,
h2,
p {
  text-wrap: balance;
}

h1 {
  margin: 0;
  color: var(--app-ink);
  font-size: clamp(2.35rem, 9vw, 4.6rem);
  font-weight: 950;
  letter-spacing: -0.055em;
  line-height: 0.98;
}

h2 {
  margin: 1.65rem 0 1rem;
  color: var(--app-ink);
  font-size: clamp(1.45rem, 5vw, 2rem);
  font-weight: 900;
  letter-spacing: -0.025em;
}

#player-screen::before {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  margin-bottom: 1.15rem;
  padding: 0.35rem 0.8rem;
  border: 1px solid rgb(98 82 245 / 14%);
  border-radius: 999px;
  background: #f0efff;
  color: var(--app-primary-strong);
  content: "✦ JUEGOS PARA APRENDER";
  font-size: 0.7rem;
  font-weight: 950;
  letter-spacing: 0.09em;
}

#player-screen h1 {
  background: linear-gradient(115deg, #4f3ee8 3%, #bd3f9d 55%, #ff6b6b 98%);
  background-clip: text;
  color: transparent;
}

#player-screen h2 {
  margin: clamp(1rem, 3dvh, 1.75rem) 0 0.85rem;
  color: var(--app-muted);
  font-size: clamp(1.05rem, 3.8vw, 1.35rem);
  font-weight: 800;
  letter-spacing: 0;
}

.player-buttons {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(0.65rem, 2vw, 1rem);
}

.player-button {
  position: relative;
  min-height: 8rem;
  padding: 1rem 0.75rem;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 70%);
  border-radius: 1.5rem;
  font-size: clamp(1.1rem, 4vw, 1.4rem);
  font-weight: 950;
  box-shadow: 0 0.8rem 1.6rem rgb(49 46 129 / 18%), inset 0 1px 0 rgb(255 255 255 / 60%);
  text-shadow: 0 2px 0 rgb(42 30 80 / 22%);
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.player-button::after {
  position: absolute;
  top: -60%;
  left: -50%;
  width: 45%;
  height: 220%;
  background: linear-gradient(90deg, transparent, rgb(255 255 255 / 38%), transparent);
  content: "";
  pointer-events: none;
  transform: rotate(24deg);
  transition: left 420ms ease;
}

.player-button:hover::after {
  left: 120%;
}

.player-button:hover {
  transform: translateY(-0.2rem) scale(1.01);
  filter: saturate(1.08);
  box-shadow: 0 1rem 2rem rgb(49 46 129 / 23%), inset 0 1px 0 rgb(255 255 255 / 70%);
}

.player-button:active {
  transform: translateY(0.12rem) scale(0.99);
}

.player-animal {
  display: block;
  margin-bottom: 0.3rem;
  font-size: clamp(2.65rem, 10vw, 3.7rem);
  line-height: 1;
  filter: drop-shadow(0 0.3rem 0.25rem rgb(42 30 80 / 18%));
}

.home-button,
.settings-button {
  top: max(0.8rem, env(safe-area-inset-top));
  display: grid;
  place-items: center;
  width: 3.5rem;
  min-height: 2.9rem;
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid rgb(98 82 245 / 16%);
  border-radius: 0.95rem;
  background: rgb(255 255 255 / 84%);
  color: var(--app-ink);
  box-shadow: 0 0.55rem 1.5rem rgb(46 43 91 / 10%);
  backdrop-filter: blur(1rem);
  font-weight: 900;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.active-profile {
  appearance: none;
  position: absolute;
  z-index: 119;
  top: max(0.8rem, env(safe-area-inset-top));
  left: 50%;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.9rem;
  max-width: calc(100% - 9rem);
  padding: 0.32rem 0.85rem 0.32rem 0.38rem;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 72%);
  border-radius: 999px;
  color: white;
  box-shadow: 0 0.55rem 1.5rem rgb(46 43 91 / 16%), inset 0 1px 0 rgb(255 255 255 / 32%);
  font-size: 1rem;
  font-weight: 950;
  letter-spacing: -0.015em;
  line-height: 1;
  text-shadow: 0 1px 2px rgb(42 30 80 / 28%);
  transform: translateX(-50%);
  backdrop-filter: blur(1rem);
  cursor: pointer;
  font-family: inherit;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

@media (hover: hover) {
  .active-profile:hover {
    box-shadow: 0 0.8rem 1.8rem rgb(46 43 91 / 23%), inset 0 1px 0 rgb(255 255 255 / 42%);
    transform: translateX(-50%) translateY(-0.1rem);
  }
}

.active-profile:active {
  transform: translateX(-50%) translateY(0.08rem);
}

.active-profile:focus-visible {
  outline: 4px solid #fbbf24;
  outline-offset: 3px;
}

.active-profile[hidden],
body.home-view .active-profile {
  display: none;
}

.active-profile[data-player="Julia"] {
  background: linear-gradient(
    135deg,
    #ef4444 0%,
    #f59e0b 24%,
    #22c55e 48%,
    #3b82f6 72%,
    #a855f7 100%
  );
}

.active-profile[data-player="Andrea"] {
  background: linear-gradient(135deg, #f05ca8, #d6297d 58%, #b81761);
}

.active-profile-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 2.15rem;
  aspect-ratio: 1;
  border: 1px solid rgb(255 255 255 / 58%);
  border-radius: 50%;
  background: rgb(255 255 255 / 82%);
  font-size: 1.35rem;
  line-height: 1;
  text-shadow: none;
  box-shadow: inset 0 1px 0 white;
}

.active-profile-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-control-icon {
  width: 1.75rem;
  height: 1.75rem;
  stroke-width: 2.4;
}

body.pause-active {
  overflow: hidden;
}

body.settings-view {
  height: auto;
  min-height: 100vh;
  min-height: 100dvh;
  align-items: start;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: auto;
  -webkit-overflow-scrolling: touch;
}

#pause-screen {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: max(1.25rem, env(safe-area-inset-top))
    max(1.25rem, env(safe-area-inset-right))
    max(1.25rem, env(safe-area-inset-bottom))
    max(1.25rem, env(safe-area-inset-left));
  background:
    radial-gradient(circle at 12% 18%, rgb(255 255 255 / 45%) 0 7rem, transparent 7.1rem),
    radial-gradient(circle at 88% 82%, rgb(255 255 255 / 35%) 0 9rem, transparent 9.1rem),
    linear-gradient(145deg, #8dd7ff, #c8b6ff 48%, #ffb6d9);
}

.pause-message {
  width: min(100%, 42rem);
  margin: 0;
  padding: clamp(2rem, 8vw, 4rem);
  border: 2px solid rgb(255 255 255 / 72%);
  border-radius: clamp(1.75rem, 6vw, 3rem);
  background: rgb(255 255 255 / 90%);
  color: #202442;
  box-shadow: 0 1.5rem 4rem rgb(43 53 103 / 24%), inset 0 1px 0 white;
  font-size: clamp(1.65rem, 7vw, 3.2rem);
  font-weight: 950;
  letter-spacing: -0.035em;
  line-height: 1.18;
  text-align: center;
  text-wrap: balance;
}

body.pause-active .home-button {
  visibility: hidden;
}

body.pause-active .settings-button {
  z-index: 1100;
}

.pause-setting-card {
  margin: 1.25rem 0;
  padding: 1rem;
  border: 1px solid #c8c2ff;
  border-radius: 1.15rem;
  background: #f6f4ff;
  text-align: left;
}

.pause-setting-heading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.8rem;
  align-items: center;
}

.pause-setting-icon {
  font-size: 2rem;
  line-height: 1;
}

.pause-setting-title {
  margin: 0;
  color: var(--app-ink);
  font-size: 1.1rem;
  font-weight: 950;
}

.pause-setting-description {
  margin: 0.25rem 0 0;
  color: var(--app-muted);
  font-size: 0.84rem;
  font-weight: 650;
  line-height: 1.35;
}

.pause-setting-state {
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
  font-size: 0.78rem;
  font-weight: 950;
}

.pause-setting-state[data-active="true"] {
  background: #ffe4e6;
  color: #be123c;
}

.pause-toggle-button {
  width: 100%;
  margin-top: 0.9rem;
  background: #5b4df2;
  box-shadow: 0 0.25rem 0 #4032be;
}

.pause-toggle-button[aria-pressed="true"] {
  background: #e11d48;
  box-shadow: 0 0.25rem 0 #9f1239;
}

#pause-control-status {
  min-height: 1.4em;
  margin: 0.7rem 0 0;
  color: var(--app-muted);
  font-size: 0.82rem;
  font-weight: 750;
  text-align: center;
}

.instructor-setting-card {
  margin: 1.25rem 0;
  padding: 1rem;
  border: 1px solid #c8c2ff;
  border-radius: 1.15rem;
  background: #f6f4ff;
  text-align: left;
}

.instructor-setting-title {
  margin: 0;
  color: var(--app-ink);
  font-size: 1.1rem;
  font-weight: 950;
}

.instructor-setting-description {
  margin: 0.3rem 0 0.9rem;
  color: var(--app-muted);
  font-size: 0.84rem;
  font-weight: 650;
  line-height: 1.35;
}

.instructor-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

.instructor-option {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 0.45rem;
  min-width: 0;
  padding: 0.7rem 0.25rem;
  border: 2px solid var(--app-line);
  border-radius: 1rem;
  background: var(--app-surface-solid);
  color: var(--app-ink);
  font: inherit;
  font-size: clamp(0.7rem, 2.8vw, 0.86rem);
  font-weight: 900;
  cursor: pointer;
}

.instructor-option[aria-pressed="true"] {
  border-color: #27b989;
  background: #e6fff7;
  box-shadow: 0 0 0 3px rgb(39 185 137 / 14%);
}

.instructor-option:focus-visible {
  outline: 4px solid #fbbf24;
  outline-offset: 3px;
}

.instructor-option-image {
  width: clamp(3.35rem, 17vw, 4.75rem);
  height: clamp(5rem, 23vw, 6.5rem);
  object-fit: contain;
  filter: drop-shadow(0 0.3rem 0.2rem rgb(41 37 36 / 14%));
}

.word-search-layout {
  display: grid;
  gap: 1rem;
  width: min(100%, 48rem);
  margin: 0 auto;
}

.word-search-theme {
  margin: 0;
  color: var(--app-muted);
  font-size: 0.95rem;
  font-weight: 850;
  text-align: center;
}

.word-search-words {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.word-search-word {
  padding: 0.45rem 0.7rem;
  border: 2px solid #c7d2fe;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-size: clamp(0.78rem, 3vw, 0.95rem);
  font-weight: 950;
  letter-spacing: 0.04em;
  transition: transform 160ms ease, background 160ms ease;
}

.word-search-word.found {
  border-color: #34d399;
  background: #d1fae5;
  color: #065f46;
  text-decoration: line-through;
  transform: scale(0.96);
}

.word-search-board {
  display: grid;
  grid-template-columns: repeat(var(--word-search-size), minmax(0, 1fr));
  gap: clamp(0.12rem, 0.65vw, 0.28rem);
  width: min(100%, 34rem);
  margin: 0 auto;
  padding: clamp(0.35rem, 1.8vw, 0.75rem);
  border: 3px solid #818cf8;
  border-radius: 1.25rem;
  background: linear-gradient(145deg, #eef2ff, #fdf4ff);
  box-shadow: 0 0.45rem 0 rgb(79 70 229 / 16%);
  touch-action: manipulation;
  user-select: none;
}

.word-search-cell {
  display: grid;
  place-items: center;
  min-width: 0;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: clamp(0.25rem, 1.3vw, 0.6rem);
  background: var(--app-surface-solid);
  color: var(--app-ink);
  box-shadow: inset 0 0 0 1px rgb(99 102 241 / 18%);
  font: inherit;
  font-size: var(--word-search-font, 1rem);
  font-weight: 950;
  line-height: 1;
  cursor: pointer;
}

.word-search-cell:hover,
.word-search-cell:focus-visible {
  background: #fef3c7;
}

.word-search-cell:focus-visible {
  outline: 3px solid #f59e0b;
  outline-offset: 1px;
}

.word-search-cell.selected {
  background: #fde68a;
  color: #92400e;
  box-shadow: inset 0 0 0 3px #f59e0b;
}

.word-search-cell.found {
  background: #6ee7b7;
  color: #064e3b;
  box-shadow: inset 0 0 0 2px #10b981;
}

.word-search-cell.wrong {
  background: #fecdd3;
  color: #9f1239;
  animation: wrong-shake 280ms ease;
}

.word-search-reward {
  display: grid;
  place-items: center;
  grid-column: 1 / -1;
  min-height: min(70vw, 22rem);
  font-size: clamp(7rem, 35vw, 14rem);
}

html[data-theme="dark"] .word-search-word {
  border-color: #6366f1;
  background: #27265c;
  color: #e0e7ff;
}

html[data-theme="dark"] .word-search-word.found {
  border-color: #10b981;
  background: #064e3b;
  color: #d1fae5;
}

html[data-theme="dark"] .word-search-board {
  border-color: #818cf8;
  background: linear-gradient(145deg, #202341, #30203e);
}

@media (min-width: 46rem) {
  .word-search-layout {
    grid-template-columns: minmax(10rem, 14rem) minmax(0, 1fr);
    align-items: start;
  }

  .word-search-side {
    position: sticky;
    top: 1rem;
  }

  .word-search-words {
    flex-direction: column;
    align-items: stretch;
  }

  .word-search-word {
    text-align: center;
  }
}

.instructor-option-check {
  position: absolute;
  top: 0.45rem;
  right: 0.5rem;
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  background: #16a34a;
  color: white;
  font-size: 0.85rem;
}

.instructor-option-check:empty {
  display: none;
}

#instructor-status {
  min-height: 1.4em;
  margin: 0.7rem 0 0;
  color: #166534;
  font-size: 0.84rem;
  font-weight: 800;
  text-align: center;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.pause-code-input {
  width: min(100%, 12rem);
  margin: 0.25rem auto 0;
  padding: 0.8rem 1rem;
  border: 2px solid var(--app-line);
  border-radius: 0.9rem;
  background: var(--app-surface-solid);
  color: var(--app-ink);
  font: inherit;
  font-size: 1.6rem;
  font-weight: 950;
  letter-spacing: 0.35em;
  text-align: center;
}

.pause-code-input:focus {
  border-color: var(--app-primary);
  outline: 4px solid rgb(98 82 245 / 18%);
}

#pause-code-error {
  min-height: 1.4em;
  margin: 0.65rem 0 0;
  color: #be123c;
  font-size: 0.9rem;
  font-weight: 850;
}

.home-button {
  left: max(0.8rem, env(safe-area-inset-left));
  transform: none;
}

.settings-button {
  right: max(0.8rem, env(safe-area-inset-right));
}

.home-button:hover,
.settings-button:hover {
  transform: translateY(-0.1rem);
  box-shadow: 0 0.7rem 1.7rem rgb(46 43 91 / 16%);
}

body.home-view {
  height: 100dvh;
  min-height: 0;
  padding: max(4.6rem, calc(env(safe-area-inset-top) + 4rem)) 0.75rem
    max(4.6rem, calc(env(safe-area-inset-top) + 4rem));
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: auto;
}

body.home-view .app-header {
  position: absolute;
  inset: 0 0 auto;
  height: 0;
}

body.home-view main {
  width: min(100%, 42rem);
  max-height: calc(100dvh - 5.35rem);
  padding: clamp(1.2rem, 4dvh, 2.5rem);
}

body.home-view .player-button {
  min-height: clamp(6.6rem, 20dvh, 8rem);
  padding: clamp(0.65rem, 2dvh, 1rem);
}

.games-title {
  margin: 0;
  color: var(--app-ink);
  font-size: clamp(1.8rem, 7vw, 2.75rem);
  font-weight: 950;
  letter-spacing: -0.04em;
}

.games-intro {
  margin: 0.55rem 0 1.4rem;
  color: var(--app-muted);
  font-size: clamp(1rem, 3.6vw, 1.2rem);
  font-weight: 650;
}

.games-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.game-card {
  --card-accent: var(--app-primary);
  --card-soft: #f0efff;
  position: relative;
  display: grid;
  grid-template-columns: 4.15rem minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 0.9rem;
  align-items: center;
  min-height: 7.1rem;
  padding: 1rem;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--card-accent) 20%, white);
  border-radius: var(--app-radius-lg);
  background:
    radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--card-accent) 14%, transparent) 0 4.5rem, transparent 4.6rem),
    var(--card-soft);
  color: var(--app-ink);
  box-shadow: var(--app-shadow-card);
  text-align: left;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.game-card::after {
  position: absolute;
  right: 0.85rem;
  bottom: 0.7rem;
  color: color-mix(in srgb, var(--card-accent) 58%, transparent);
  content: "›";
  font-size: 1.65rem;
  font-weight: 950;
  line-height: 1;
}

.game-card:hover {
  border-color: color-mix(in srgb, var(--card-accent) 48%, white);
  transform: translateY(-0.2rem);
  box-shadow: 0 1rem 2rem color-mix(in srgb, var(--card-accent) 15%, transparent);
}

.game-card:active {
  transform: translateY(0.08rem) scale(0.995);
}

.game-icon {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 4.15rem;
  aspect-ratio: 1;
  margin: 0;
  border: 1px solid rgb(255 255 255 / 75%);
  border-radius: 1.2rem;
  background: color-mix(in srgb, var(--card-accent) 17%, white);
  box-shadow: inset 0 1px 0 white;
  font-size: 2.35rem;
}

.game-name {
  align-self: end;
  padding-right: 1rem;
  color: color-mix(in srgb, var(--card-accent) 82%, #18213d);
  font-size: clamp(1.05rem, 3.8vw, 1.35rem);
  font-weight: 950;
  letter-spacing: -0.025em;
  line-height: 1.05;
}

.game-description {
  align-self: start;
  margin-top: 0.3rem;
  padding-right: 1rem;
  color: var(--app-muted);
  font-size: 0.83rem;
  font-weight: 650;
  line-height: 1.3;
}

#memory-game,
#classic-memory {
  --card-accent: #6d5dfc;
  --card-soft: #f1efff;
}

#animal-words-game,
#unicorn-memory {
  --card-accent: #ec4899;
  --card-soft: #fff0f7;
}

#numbers-game,
#shapes-memory {
  --card-accent: #f59e0b;
  --card-soft: #fff8e8;
}

#relations-game,
#disney-memory {
  --card-accent: #12a37d;
  --card-soft: #ebfbf7;
}

#differences-game,
#vaiana-memory {
  --card-accent: #2684ff;
  --card-soft: #edf6ff;
}

#kpop-memory {
  --card-accent: #8b5cf6;
  --card-soft: #f5f0ff;
}

#zootropolis-memory {
  --card-accent: #ef476f;
  --card-soft: #fff0f4;
}

#frozen-memory {
  --card-accent: #0ea5e9;
  --card-soft: #eefaff;
}

#games-screen .games-list .game-card:last-child:nth-child(odd),
#memory-mode-screen .games-list .game-card:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.back-button,
.intro-back-button {
  min-height: 3rem;
  margin-top: 1.3rem;
  padding: 0.55rem 0.75rem;
  border: 0;
  background: transparent;
  color: var(--app-muted);
  box-shadow: none;
  font-size: 0.95rem;
  font-weight: 850;
}

.back-button:hover,
.intro-back-button:hover {
  color: var(--app-primary-strong);
  text-decoration: none;
}

#game-status {
  min-height: 0;
  margin-top: 0.65rem;
  color: var(--app-muted);
}

.memory-header {
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--app-line);
}

.memory-title {
  color: var(--app-ink);
  font-size: clamp(1.35rem, 5vw, 2.15rem);
  font-weight: 950;
  letter-spacing: -0.035em;
  text-align: left;
}

.level-badge {
  padding: 0.55rem 0.85rem;
  border: 1px solid rgb(98 82 245 / 12%);
  border-radius: 0.85rem;
  background: #f0efff;
  color: var(--app-primary-strong);
  font-size: clamp(0.78rem, 2.7vw, 0.95rem);
  font-weight: 950;
}

.memory-stats,
.animal-progress {
  width: fit-content;
  margin: 0 auto 1rem;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  background: var(--app-surface-soft);
  color: var(--app-muted);
  font-size: 0.9rem;
  font-weight: 850;
}

.memory-board {
  gap: clamp(0.4rem, 1.25vw, 0.7rem);
}

.memory-card {
  border: 1px solid rgb(255 255 255 / 36%);
  border-radius: clamp(0.75rem, 2vw, 1rem);
  background:
    radial-gradient(circle at 28% 20%, rgb(255 255 255 / 20%) 0 0.2rem, transparent 0.24rem),
    linear-gradient(145deg, #7867ff, #563ddf);
  box-shadow: 0 0.3rem 0 #3f2aaf, 0 0.6rem 1.1rem rgb(76 61 190 / 18%);
}

.memory-card:hover:not(.revealed):not(.matched) {
  transform: translateY(-0.15rem) scale(1.01);
}

.memory-card.revealed,
.memory-card.matched {
  border-color: var(--app-line);
  background: var(--app-surface-solid);
  color: var(--app-ink);
  box-shadow: 0 0.3rem 0 #dfe1ef, 0 0.6rem 1.1rem rgb(47 43 89 / 8%);
}

.memory-card.matched {
  border-color: #75dfb5;
  background: #eafbf5;
  box-shadow: 0 0.3rem 0 #9ee9ce;
}

#memory-message,
#animal-message,
#numbers-message,
#relations-message,
#differences-message,
#word-search-message {
  display: grid;
  place-items: center;
  width: min(100%, 48rem);
  min-height: 3.35rem;
  margin: 0.65rem auto 0;
  padding: 0.2rem 0.5rem;
  border-radius: 0.9rem;
  color: #087449;
  font-size: 1rem;
  font-weight: 850;
  line-height: 1.35;
}

.action-button {
  min-height: 3rem;
  padding: 0.75rem 1.15rem;
  border: 1px solid rgb(255 255 255 / 22%);
  border-radius: 0.95rem;
  background: linear-gradient(180deg, #22ba75, var(--app-green));
  color: white;
  box-shadow: 0 0.25rem 0 var(--app-green-strong), 0 0.65rem 1.2rem rgb(22 167 101 / 16%);
  font-weight: 950;
  transition: transform 150ms ease, box-shadow 150ms ease, filter 150ms ease;
}

.action-button:hover {
  transform: translateY(-0.1rem);
  filter: saturate(1.05);
}

.action-button:active {
  transform: translateY(0.16rem);
  box-shadow: 0 0.08rem 0 var(--app-green-strong);
}

.action-button.secondary {
  border: 1px solid var(--app-line);
  background: var(--app-surface-solid);
  color: var(--app-muted);
  box-shadow: none;
}

.action-button.next-level-button {
  background: linear-gradient(180deg, #22ba75, var(--app-green));
  box-shadow: 0 0.25rem 0 var(--app-green-strong), 0 0.65rem 1.2rem rgb(22 167 101 / 16%);
}

.gameplay-actions {
  min-height: 3rem;
  margin-top: 1rem;
}

.gameplay-actions .next-level-button {
  min-width: 12rem;
  padding: 0.8rem 1.1rem;
  font-size: 1rem;
}

.gameplay-actions .secondary {
  width: 3rem;
  height: 3rem;
  border: 1px solid var(--app-line);
  border-radius: 0.9rem;
  background: var(--app-surface-solid);
  color: var(--app-muted);
  opacity: 1;
}

.gameplay-actions .finish-home-button {
  min-width: 12rem;
  margin-top: 0;
  padding: 0.8rem 1.1rem;
  border: 0;
  background: linear-gradient(180deg, #5799ff, var(--app-blue));
  font-size: 1rem;
  box-shadow: 0 0.25rem 0 #245fbd, 0 0.65rem 1.2rem rgb(59 130 246 / 20%);
}

.gameplay-actions .finish-home-button[hidden] {
  display: none !important;
}

.grandpa-message {
  min-height: 10rem;
  margin: 1.7rem 0 1.5rem 8.5rem;
  padding: 1.25rem 1.4rem;
  border: 2px solid var(--app-ink);
  border-radius: 1.45rem 1.45rem 1.45rem 0.55rem;
  background: var(--app-surface-solid);
  box-shadow: 0.4rem 0.45rem 0 var(--app-yellow), var(--app-shadow-card);
}

.grandpa-message::before {
  top: auto;
  bottom: 7.2rem;
  left: -0.72rem;
  width: 1.25rem;
  height: 1.25rem;
  border: 0;
  border-bottom: 2px solid var(--app-ink);
  border-left: 2px solid var(--app-ink);
  background: var(--app-surface-solid);
  transform: rotate(45deg);
}

.grandpa-icon {
  bottom: -0.25rem;
  left: -8.6rem;
  width: 7.25rem;
  filter: drop-shadow(0 0.55rem 0.35rem rgb(41 37 36 / 15%));
}

.grandpa-name {
  display: inline-flex;
  padding: 0.32rem 0.7rem;
  border: 0;
  border-radius: 0.65rem;
  background: #fff0b8;
  color: #6c4b00;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
}

.grandpa-message p {
  margin-top: 0.75rem;
  color: var(--app-ink);
  font-size: clamp(0.95rem, 2.6vw, 1.12rem);
  font-weight: 720;
  line-height: 1.55;
}

.intro-start-actions {
  margin-top: 0.25rem;
}

.word-options,
.number-options {
  gap: 0.7rem;
}

.word-button,
.number-button {
  min-height: 3.5rem;
  border: 1px solid #bfdbfe;
  border-radius: 1rem;
  background: #f3f8ff;
  color: #2458a6;
  box-shadow: 0 0.25rem 0 #d5e4f8;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease;
}

.word-button:hover,
.number-button:hover {
  border-color: #7db5ff;
  background: #eaf3ff;
  transform: translateY(-0.1rem);
}

.animal-picture {
  min-height: 9rem;
  margin-bottom: 1rem;
  filter: drop-shadow(0 0.7rem 0.8rem rgb(47 43 89 / 12%));
}

.counting-items {
  min-height: 12rem;
  border: 1px solid #f1d27a;
  border-radius: var(--app-radius-lg);
  background:
    radial-gradient(circle at 10% 10%, rgb(255 255 255 / 70%) 0 3rem, transparent 3.1rem),
    #fff9e8;
  box-shadow: inset 0 0 0 0.35rem rgb(255 255 255 / 52%);
}

.relations-board {
  min-width: 0;
  padding: 0.7rem;
  border: 1px solid #ded9ff;
  border-radius: var(--app-radius-lg);
  background: #f7f5ff;
  box-shadow: inset 0 0 0 0.35rem rgb(255 255 255 / 60%);
}

.relation-item {
  border: 1px solid #c7c0ff;
  border-radius: 1rem;
  background: var(--app-surface-solid);
  color: #4f3ee8;
  box-shadow: 0 0.25rem 0 #ddd9ff, var(--app-shadow-card);
}

.relation-item.right {
  border-color: #b9d8ff;
  color: #2466bc;
  box-shadow: 0 0.25rem 0 #d5e9ff, var(--app-shadow-card);
}

.relation-label {
  font-size: clamp(1rem, 2.4vw, 1.08rem);
}

.difference-picture-title {
  color: var(--app-muted);
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.difference-panel,
.differences-reward {
  border: 1px solid #d8d3ff;
  border-radius: var(--app-radius-lg);
  background: #eef6ff;
  box-shadow: 0 0.35rem 0 #d9d5f5, var(--app-shadow-card);
}

.difference-hotspot.found {
  border-width: 4px;
  border-color: var(--app-coral);
  background: rgb(255 107 107 / 24%);
  box-shadow: 0 0 0 3px white, 0 0 0 6px var(--app-coral);
}

.difference-hotspot {
  min-width: 3rem;
  min-height: 3rem;
}

.theme-options {
  gap: 0.75rem;
  margin: 1.4rem 0;
}

.theme-option {
  min-height: 5rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--app-line);
  border-radius: 1.1rem;
  background: var(--app-surface-soft);
  color: var(--app-ink);
  box-shadow: none;
}

.theme-option[aria-pressed="true"] {
  border-color: #75dfb5;
  background: #eafbf5;
  box-shadow: 0 0 0 3px rgb(66 211 173 / 18%);
}

.theme-name {
  color: var(--app-ink);
}

.theme-description,
.source-note {
  color: var(--app-muted);
}

.home-confirm-dialog {
  width: min(calc(100% - 1.5rem), 28rem);
  border: 1px solid rgb(98 82 245 / 16%);
  border-radius: 1.6rem;
  background: var(--app-surface-solid);
  color: var(--app-ink);
  box-shadow: 0 2rem 6rem rgb(20 24 50 / 34%);
}

.home-confirm-dialog::backdrop {
  background: rgb(18 21 42 / 48%);
  backdrop-filter: blur(0.45rem);
}

.home-confirm-title {
  color: var(--app-ink);
}

.home-confirm-text {
  color: var(--app-muted);
}

.home-confirm-icon {
  display: grid;
  place-items: center;
  width: 4.2rem;
  aspect-ratio: 1;
  margin: 0 auto 0.7rem;
  border-radius: 1.25rem;
  background: #f0efff;
}

.source-note {
  font-size: 0.875rem;
}

@keyframes app-surface-in {
  from {
    opacity: 0;
    transform: translateY(0.6rem) scale(0.99);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

html[data-theme="dark"] {
  --app-bg: #111426;
  --app-surface: rgb(26 30 55 / 92%);
  --app-surface-solid: #1a1e37;
  --app-surface-soft: #222744;
  --app-ink: #f7f7ff;
  --app-muted: #b3bad3;
  --app-line: #343a5b;
  --app-primary: #9488ff;
  --app-primary-strong: #b4adff;
  color: var(--app-ink);
  background: var(--app-bg);
}

html[data-theme="dark"] body {
  color: var(--app-ink);
  background:
    radial-gradient(circle at 8% 8%, rgb(255 200 61 / 13%) 0 9rem, transparent 9.1rem),
    radial-gradient(circle at 96% 12%, rgb(240 82 164 / 12%) 0 10rem, transparent 10.1rem),
    radial-gradient(circle at 90% 92%, rgb(66 211 173 / 10%) 0 12rem, transparent 12.1rem),
    linear-gradient(145deg, #171326 0%, #111426 48%, #111b2e 100%);
}

html[data-theme="dark"] main {
  border-color: rgb(148 136 255 / 13%);
  background: var(--app-surface);
  box-shadow: 0 1.6rem 4.5rem rgb(0 0 0 / 30%), inset 0 1px 0 rgb(255 255 255 / 5%);
}

html[data-theme="dark"] .home-button,
html[data-theme="dark"] .settings-button,
html[data-theme="dark"] .gameplay-actions .secondary,
html[data-theme="dark"] .action-button.secondary {
  border-color: var(--app-line);
  background: rgb(26 30 55 / 88%);
  color: var(--app-ink);
}

html[data-theme="dark"] #player-screen::before,
html[data-theme="dark"] .level-badge,
html[data-theme="dark"] .home-confirm-icon {
  border-color: rgb(148 136 255 / 18%);
  background: #292650;
  color: #c4beff;
}

html[data-theme="dark"] .game-card {
  border-color: color-mix(in srgb, var(--card-accent) 25%, #313754);
  background:
    radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--card-accent) 15%, transparent) 0 4.5rem, transparent 4.6rem),
    color-mix(in srgb, var(--card-accent) 8%, #1a1e37);
  color: var(--app-ink);
  box-shadow: 0 0.75rem 1.8rem rgb(0 0 0 / 18%);
}

html[data-theme="dark"] .game-icon {
  border-color: rgb(255 255 255 / 6%);
  background: color-mix(in srgb, var(--card-accent) 22%, #1a1e37);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 7%);
}

html[data-theme="dark"] .game-name,
html[data-theme="dark"] .games-title,
html[data-theme="dark"] .memory-title,
html[data-theme="dark"] .theme-name,
html[data-theme="dark"] .home-confirm-title {
  color: var(--app-ink);
}

html[data-theme="dark"] .game-description,
html[data-theme="dark"] .games-intro,
html[data-theme="dark"] .memory-stats,
html[data-theme="dark"] .animal-progress,
html[data-theme="dark"] .theme-description,
html[data-theme="dark"] .source-note,
html[data-theme="dark"] .home-confirm-text {
  color: var(--app-muted);
}

html[data-theme="dark"] .grandpa-message,
html[data-theme="dark"] .grandpa-message::before,
html[data-theme="dark"] .memory-card.revealed,
html[data-theme="dark"] .relation-item,
html[data-theme="dark"] .theme-option,
html[data-theme="dark"] .instructor-setting-card,
html[data-theme="dark"] .instructor-option,
html[data-theme="dark"] .pause-setting-card,
html[data-theme="dark"] .home-confirm-dialog {
  border-color: var(--app-line);
  background: var(--app-surface-solid);
  color: var(--app-ink);
}

html[data-theme="dark"] .instructor-option[aria-pressed="true"] {
  border-color: #48d6a8;
  background: #153b35;
}

html[data-theme="dark"] .grandpa-message {
  box-shadow: 0.4rem 0.45rem 0 #705f1b, var(--app-shadow-card);
}

html[data-theme="dark"] .grandpa-message p {
  color: var(--app-ink);
}

html[data-theme="dark"] .grandpa-name {
  background: #504313;
  color: #ffe8a3;
}

html[data-theme="dark"] .counting-items {
  border-color: #625326;
  background: #302915;
}

html[data-theme="dark"] .relations-board {
  border-color: #39345f;
  background: #211f3d;
}

html[data-theme="dark"] .relation-item.right {
  border-color: #36557c;
  background: var(--app-surface-solid);
  color: #b8d8ff;
}

html[data-theme="dark"] .word-button,
html[data-theme="dark"] .number-button {
  border-color: #38577d;
  background: #172744;
  color: #cfe3ff;
  box-shadow: 0 0.25rem 0 #223958;
}

html[data-theme="dark"] .difference-panel,
html[data-theme="dark"] .differences-reward {
  border-color: #3b4167;
  background: #1b2b44;
  box-shadow: 0 0.35rem 0 #272d4d, var(--app-shadow-card);
}

html[data-theme="dark"] .theme-option[aria-pressed="true"],
html[data-theme="dark"] .memory-card.matched,
html[data-theme="dark"] .relation-item.matched {
  border-color: #3b9d77;
  background: #173d32;
  color: #d8fff1;
}

html[data-theme="dark"] #memory-message,
html[data-theme="dark"] #animal-message,
html[data-theme="dark"] #numbers-message,
html[data-theme="dark"] #relations-message,
html[data-theme="dark"] #differences-message,
html[data-theme="dark"] #theme-status {
  color: #8ce9c6;
}

@media (max-width: 42rem) {
  body {
    padding: max(4.85rem, calc(env(safe-area-inset-top) + 4.1rem)) 0.65rem
      max(0.65rem, env(safe-area-inset-bottom));
  }

  main,
  main.memory-active {
    padding: 1.05rem;
    border-radius: 1.55rem;
  }

  .home-button,
  .settings-button {
    width: 3.25rem;
    min-height: 3rem;
    padding: 0;
    border-radius: 0.85rem;
  }

  .active-profile {
    min-height: 3rem;
    max-width: calc(100% - 8rem);
    padding: 0.3rem 0.7rem 0.3rem 0.35rem;
    font-size: 0.95rem;
  }

  .active-profile-icon {
    width: 2rem;
    font-size: 1.25rem;
  }

  .games-list {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  #games-screen .games-list .game-card:last-child:nth-child(odd),
  #memory-mode-screen .games-list .game-card:last-child:nth-child(odd) {
    grid-column: auto;
  }

  .game-card {
    grid-template-columns: 3.6rem minmax(0, 1fr);
    min-height: 5.75rem;
    padding: 0.75rem;
    border-radius: 1.1rem;
  }

  .game-icon {
    width: 3.6rem;
    border-radius: 1rem;
    font-size: 2rem;
  }

  .game-name {
    font-size: clamp(1rem, 4.6vw, 1.22rem);
  }

  .game-description {
    font-size: 0.76rem;
  }

  .memory-header {
    align-items: flex-start;
    flex-direction: row;
    gap: 0.6rem;
  }

  .memory-title {
    flex: 1;
    font-size: clamp(1.15rem, 5.5vw, 1.55rem);
  }

  .level-badge {
    flex: 0 0 auto;
    max-width: 48%;
  }

  .grandpa-message {
    min-height: 9rem;
    margin: 1.35rem 0 1.4rem 5.6rem;
    padding: 1rem;
    border-radius: 1.2rem 1.2rem 1.2rem 0.45rem;
    box-shadow: 0.3rem 0.35rem 0 var(--app-yellow);
  }

  .grandpa-message::before {
    top: auto;
    bottom: 4.6rem;
    left: -0.65rem;
    width: 1.1rem;
    height: 1.1rem;
  }

  .grandpa-icon {
    bottom: 0;
    left: -5.75rem;
    width: 5rem;
  }

  .grandpa-message p {
    font-size: 0.9rem;
    line-height: 1.46;
  }

  .word-options {
    grid-template-columns: 1fr;
  }

  .differences-scenes {
    gap: 0.9rem;
  }

  .gameplay-actions {
    grid-template-columns: auto auto minmax(0.3rem, 1fr) auto;
  }

  .gameplay-actions .next-level-button {
    min-width: 10.6rem;
    padding-inline: 0.85rem;
    font-size: 0.92rem;
  }

  .gameplay-actions .secondary {
    width: 3rem;
    height: 3rem;
  }
}

@media (max-width: 23rem) {
  body.home-view main {
    padding: 1rem 0.85rem;
  }

  #player-screen::before {
    margin-bottom: 0.7rem;
    font-size: 0.62rem;
  }

  #player-screen h1 {
    font-size: clamp(2rem, 11vw, 2.5rem);
  }

  .player-button {
    min-height: 6.25rem;
    padding-inline: 0.35rem;
  }

  .player-animal {
    font-size: 2.5rem;
  }

  .home-button,
  .settings-button {
    width: 3.1rem;
    min-height: 3.1rem;
    padding: 0;
  }

  .active-profile {
    width: 3.1rem;
    min-height: 3.1rem;
    padding: 0;
    justify-content: center;
  }

  .active-profile-name {
    display: none;
  }

  .gameplay-actions {
    grid-template-columns: auto auto minmax(0.2rem, 1fr) auto;
    column-gap: 0.3rem;
  }

  .gameplay-actions .next-level-button,
  .gameplay-actions .finish-home-button {
    min-width: 9.1rem;
    max-width: 9.1rem;
    padding-inline: 0.55rem;
    font-size: 0.86rem;
    line-height: 1.1;
  }

  .gameplay-actions .secondary {
    width: 2.75rem;
    height: 2.75rem;
  }

  .grandpa-message {
    margin-left: 4.7rem;
    padding: 0.85rem;
  }

  .grandpa-icon {
    left: -4.8rem;
    width: 4.25rem;
  }

  .grandpa-message p {
    font-size: 0.84rem;
  }
}

@media (min-width: 72rem) {
  main.memory-active {
    padding: 2.5rem 3rem;
  }

  .game-card {
    min-height: 7.4rem;
  }
}

@media (hover: none) {
  .player-button:hover,
  .game-card:hover,
  .action-button:hover,
  .home-button:hover,
  .settings-button:hover {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  main,
  .player-button,
  .game-card,
  .action-button,
  .active-profile {
    animation: none;
    transition: none;
  }
}

.game-card[data-learning-game="robot"] {
  --card-accent: #6252f5;
  --card-soft: #f1efff;
}

.game-card[data-learning-game="sounds"] {
  --card-accent: #ec4899;
  --card-soft: #fff0f7;
}

.game-card[data-learning-game="market"] {
  --card-accent: #f97316;
  --card-soft: #fff4e8;
}

.game-card[data-learning-game="patterns"] {
  --card-accent: #8b5cf6;
  --card-soft: #f5f0ff;
}

.game-card[data-learning-game="stories"] {
  --card-accent: #3b82f6;
  --card-soft: #edf6ff;
}

.game-card[data-learning-game="emotions"] {
  --card-accent: #f43f5e;
  --card-soft: #fff0f4;
}

.game-card[data-learning-game="tangram"] {
  --card-accent: #06b6d4;
  --card-soft: #ecfeff;
}

.game-card[data-learning-game="music"] {
  --card-accent: #a855f7;
  --card-soft: #faf0ff;
}

.game-card[data-learning-game="habitats"] {
  --card-accent: #10b981;
  --card-soft: #ebfbf7;
}

.game-card[data-learning-game="science"] {
  --card-accent: #14b8a6;
  --card-soft: #ecfdf9;
}

.game-card[data-learning-game="clock"] {
  --card-accent: #eab308;
  --card-soft: #fffbea;
}

.game-card[data-learning-game="sorting"] {
  --card-accent: #22c55e;
  --card-soft: #f0fdf4;
}

.game-card[data-learning-game="shadows"] {
  --card-accent: #64748b;
  --card-soft: #f1f5f9;
}

.game-card[data-learning-game="maze"] {
  --card-accent: #0ea5e9;
  --card-soft: #eefaff;
}

.game-card[data-learning-game="silly"] {
  --card-accent: #f59e0b;
  --card-soft: #fff8e8;
}
