:root {
  --navy: #063766;
  --navy-dark: #052f58;
  --cream: #fffcf6;
  --mint: #a9eadb;
  --yellow: #ffe3a3;
  --pink: #ffb8b4;
  --blue: #a9dcf7;
  --text: #063766;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Avenir Next", "Nunito", "Segoe UI", Arial, sans-serif;
  background: var(--cream);
  color: var(--text);
}

body {
  min-height: 100vh;
}

button {
  font: inherit;
}

.welcome-screen {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    var(--cream);
}

.welcome-content {
  position: relative;
  z-index: 2;
  width: min(86%, 430px);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 52px 0 38px;
}

.welcome-logo {
  display: block;
  width: min(100%, 390px);
  height: auto;
  object-fit: contain;
  transform: translateY(-4vh);
}

.welcome-actions {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(44px, 6vh);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 17px;
}

.primary-button {
  width: min(100%, 350px);
  min-height: 58px;
  border: 0;
  border-radius: 999px;
  padding: 0 27px;
  background: linear-gradient(135deg, var(--navy), #07548a);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(6, 55, 102, 0.16);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.primary-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 34px rgba(6, 55, 102, 0.21);
}

.primary-button:active {
  transform: translateY(0);
}

.button-arrow {
  font-size: 21px;
  line-height: 1;
}

.login-link {
  border: 0;
  padding: 4px 8px;
  background: transparent;
  color: var(--navy);
  font-size: 12px;
  font-weight: 550;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.pastel-shape {
  position: absolute;
  z-index: 1;
  pointer-events: none;
  filter: saturate(0.9);
}

.shape-mint {
  width: 230px;
  height: 190px;
  top: -80px;
  left: -95px;
  border-radius: 42% 58% 67% 33% / 52% 42% 58% 48%;
  background: var(--mint);
  transform: rotate(-16deg);
}

.shape-yellow {
  width: 175px;
  height: 155px;
  top: -73px;
  right: -66px;
  border-radius: 58% 42% 40% 60% / 47% 62% 38% 53%;
  background: var(--yellow);
  transform: rotate(20deg);
}

.shape-pink {
  width: 215px;
  height: 175px;
  bottom: -91px;
  left: -86px;
  border-radius: 62% 38% 52% 48% / 42% 55% 45% 58%;
  background: var(--pink);
  transform: rotate(13deg);
}

.shape-blue {
  width: 250px;
  height: 190px;
  bottom: -83px;
  right: -104px;
  border-radius: 40% 60% 56% 44% / 55% 38% 62% 45%;
  background: var(--blue);
  transform: rotate(-17deg);
}

@media (min-width: 700px) {
  .welcome-content {
    width: min(78%, 520px);
  }

  .welcome-logo {
    width: min(100%, 455px);
  }

  .primary-button {
    width: 360px;
  }

  .shape-mint {
    width: 330px;
    height: 270px;
  }

  .shape-yellow {
    width: 260px;
    height: 220px;
  }

  .shape-pink {
    width: 310px;
    height: 240px;
  }

  .shape-blue {
    width: 350px;
    height: 250px;
  }
}
/* ========================================
   SAVE SANITY HOME SCREEN
   ======================================== */

[hidden] {
  display: none !important;
}

.home-screen {
  min-height: 100vh;
  background: #fffcf6;
  color: var(--navy);
  padding-bottom: 96px;
}

.home-header {
  width: min(100% - 36px, 1100px);
  margin: 0 auto;
  padding: 20px 0 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.home-logo {
  width: 150px;
  height: 72px;
  object-fit: cover;
  object-position: center;
}

.profile-button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--navy);
  color: white;
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
}

.home-content {
  width: min(100% - 36px, 1000px);
  margin: 0 auto;
}

.greeting-section {
  padding: 26px 0 22px;
}

.eyebrow {
  margin: 0 0 7px;
  color: #7890a5;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.7px;
}

.greeting-section h1 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(30px, 7vw, 42px);
  line-height: 1.08;
  letter-spacing: -1.2px;
}

.greeting-copy {
  margin: 10px 0 0;
  color: #63778a;
  font-size: 15px;
  line-height: 1.5;
}

.motivation-card {
  position: relative;
  overflow: hidden;
  min-height: 165px;
  padding: 25px;
  border: 1px solid #dbece7;
  border-radius: 28px;
  background: #dff5ed;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.motivation-card::after {
  content: "";
  position: absolute;
  width: 145px;
  height: 145px;
  right: -38px;
  bottom: -60px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.42);
}

.motivation-small {
  margin: 0 0 8px;
  color: #5c857b;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
}

.motivation-card h2 {
  margin: 0;
  color: var(--navy);
  font-size: 27px;
  line-height: 1.05;
}

.motivation-card p:last-child {
  margin: 10px 0 0;
  color: #56786f;
  font-size: 14px;
}

.motivation-icon {
  position: relative;
  z-index: 1;
  padding-right: 4px;
  font-size: 42px;
}

.create-section,
.kids-section {
  margin-top: 32px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 15px;
}

.section-heading h2 {
  margin: 0;
  color: var(--navy);
  font-size: 24px;
}

.create-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 13px;
}

.create-card {
  width: 100%;
  min-height: 118px;
  padding: 19px;
  border: 1px solid #e1e9ee;
  border-radius: 24px;
  display: grid;
  grid-template-columns: 56px 1fr 24px;
  gap: 15px;
  align-items: center;
  text-align: left;
  color: var(--navy);
  cursor: pointer;
}

.quiz-card {
  background: #eef8ff;
}

.game-card {
  background: #fff1ee;
}

.create-icon {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: white;
  font-size: 24px;
  font-weight: 900;
  box-shadow: 0 5px 16px rgba(6, 55, 102, 0.07);
}

.create-card h3 {
  margin: 0 0 5px;
  font-size: 19px;
}

.create-card p {
  margin: 0;
  color: #718397;
  font-size: 13px;
  line-height: 1.4;
}

.card-arrow {
  font-size: 22px;
  font-weight: 700;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--navy);
  font-weight: 800;
  cursor: pointer;
}

.kids-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(78px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.kid-card {
  min-width: 78px;
  padding: 13px 6px;
  border: 1px solid #e7ebed;
  border-radius: 22px;
  background: white;
  color: var(--navy);
  cursor: pointer;
}

.kid-avatar {
  width: 52px;
  height: 52px;
  margin: 0 auto 9px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 19px;
  font-weight: 900;
}

.avatar-pink {
  background: #ffd8d5;
}

.avatar-blue {
  background: #d9effc;
}

.avatar-yellow {
  background: #ffeab7;
}

.avatar-add {
  border: 2px dashed #a9bac8;
  background: #f8fafb;
}

.kid-card span {
  display: block;
  font-size: 13px;
  font-weight: 800;
}

.kid-card small {
  display: block;
  margin-top: 3px;
  color: #8a99a7;
  font-size: 10px;
}

.bottom-nav {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  padding: 10px 18px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid #e8ecef;
  background: rgba(255, 252, 246, 0.96);
  backdrop-filter: blur(16px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.nav-item {
  border: 0;
  background: transparent;
  color: #9aa8b3;
  display: grid;
  gap: 3px;
  justify-items: center;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.nav-item.active {
  color: var(--navy);
}

.nav-icon {
  font-size: 23px;
  line-height: 1;
}

@media (min-width: 700px) {
  .home-header {
    padding-top: 28px;
  }

  .home-content {
    padding-top: 15px;
  }

  .create-grid {
    grid-template-columns: 1fr 1fr;
  }

  .kids-row {
    grid-template-columns: repeat(4, 150px);
  }

  .bottom-nav {
    width: min(620px, calc(100% - 40px));
    bottom: 18px;
    border: 1px solid #e5e9ec;
    border-radius: 24px;
    box-shadow: 0 10px 35px rgba(6, 55, 102, 0.09);
  }
}/* Home logo correction */
.home-logo {
  width: 185px;
  height: auto;
  object-fit: contain;
  object-position: center;
  display: block;
}/* Compact dashboard header logo */
.home-logo {
  width: 145px;
  height: auto;
  object-fit: contain;
  display: block;
}

.home-header {
  padding-top: 14px;
  padding-bottom: 4px;
}/* ========================================
   CREATE ACCOUNT / AUTH SCREEN
   ======================================== */

.auth-screen {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background: var(--cream);
  color: var(--navy);
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

.auth-decoration {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.auth-mint {
  width: 300px;
  height: 300px;
  top: -170px;
  left: -140px;
  background: var(--mint);
}

.auth-yellow {
  width: 250px;
  height: 250px;
  right: -135px;
  bottom: -130px;
  background: var(--yellow);
}

.auth-card {
  position: relative;
  z-index: 2;
  width: min(100%, 440px);
  padding: 26px 28px 30px;
  border: 1px solid #e8ecee;
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 18px 55px rgba(6, 55, 102, 0.08);
}

.auth-back-button {
  position: absolute;
  top: 20px;
  left: 20px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: #eef4f6;
  color: var(--navy);
  font-size: 20px;
  cursor: pointer;
}

.auth-logo {
  display: block;
  width: 150px;
  height: auto;
  margin: 0 auto 16px;
  object-fit: contain;
}

.auth-heading {
  text-align: center;
  margin-bottom: 24px;
}

.auth-heading h1 {
  margin: 0;
  color: var(--navy);
  font-size: 30px;
  letter-spacing: -0.8px;
}

.auth-heading > p:last-child {
  margin: 8px 0 0;
  color: #718397;
  font-size: 14px;
}

.google-auth-button {
  width: 100%;
  min-height: 54px;
  border: 1px solid #dce4e9;
  border-radius: 18px;
  background: white;
  color: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.google-letter {
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #f2f6f8;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 900;
}

.auth-divider {
  margin: 20px 0;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #9ba8b3;
  font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: #e1e7ea;
}

.auth-form {
  display: grid;
  gap: 9px;
}

.auth-form label {
  margin-top: 5px;
  color: var(--navy);
  font-size: 12px;
  font-weight: 800;
}

.auth-form input {
  width: 100%;
  box-sizing: border-box;
  min-height: 52px;
  padding: 0 16px;
  border: 1px solid #dce4e9;
  border-radius: 16px;
  outline: none;
  background: white;
  color: var(--navy);
  font: inherit;
}

.auth-form input::placeholder {
  color: #a1adb7;
}

.auth-form input:focus {
  border-color: #8db9d2;
  box-shadow: 0 0 0 3px rgba(169, 220, 247, 0.28);
}

.auth-submit-button {
  width: 100%;
  margin-top: 12px;
}

.auth-error {
  min-height: 18px;
  margin: 12px 0 0;
  color: #b74747;
  text-align: center;
  font-size: 12px;
}

.auth-switch-text {
  margin: 8px 0 0;
  color: #718397;
  text-align: center;
  font-size: 13px;
}

.auth-switch-text button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--navy);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

@media (max-width: 520px) {
  .auth-screen {
    padding: 18px;
  }

  .auth-card {
    padding: 24px 20px 26px;
    border-radius: 26px;
  }

  .auth-logo {
    width: 135px;
  }

  .auth-heading h1 {
    font-size: 27px;
  }
}/* ========================================
   PROFILE SCREEN
   ======================================== */

.profile-screen {
  min-height: 100vh;
  background: var(--cream);
  color: var(--navy);
  padding-bottom: 40px;
}

.profile-header {
  width: min(100% - 36px, 1000px);
  margin: 0 auto;
  padding: 20px 0 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.profile-header .auth-back-button {
  position: absolute;
  left: 0;
  top: 15px;
}

.profile-header h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: -0.4px;
}

.profile-content {
  width: min(100% - 36px, 620px);
  margin: 0 auto;
  padding-top: 22px;
}

.profile-hero {
  padding: 28px 20px 30px;
  border-radius: 28px;
  background: #dff5ed;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.profile-hero::after {
  content: "";
  position: absolute;
  width: 150px;
  height: 150px;
  right: -55px;
  bottom: -70px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.42);
}

.large-profile-avatar {
  width: 76px;
  height: 76px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--navy);
  color: white;
  display: grid;
  place-items: center;
  font-size: 29px;
  font-weight: 800;
}

.profile-hero .eyebrow {
  color: #5c857b;
}

.profile-hero h2 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -0.7px;
}

.profile-hero p:last-child {
  margin: 6px 0 0;
  color: #607d76;
  font-size: 13px;
}

.profile-options {
  margin-top: 20px;
  display: grid;
  gap: 10px;
}

.profile-option {
  width: 100%;
  min-height: 74px;
  padding: 12px 15px;
  border: 1px solid #e2e8eb;
  border-radius: 20px;
  background: white;
  color: var(--navy);
  display: grid;
  grid-template-columns: 42px 1fr 20px;
  gap: 12px;
  align-items: center;
  text-align: left;
  cursor: pointer;
}

.profile-option-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: #f1f6f7;
  display: grid;
  place-items: center;
  font-size: 18px;
}

.profile-option strong,
.profile-option small {
  display: block;
}

.profile-option strong {
  font-size: 14px;
}

.profile-option small {
  margin-top: 3px;
  color: #82919d;
  font-size: 11px;
}

.profile-option > span:last-child {
  color: #91a0aa;
  font-size: 20px;
}

.logout-button {
  width: 100%;
  min-height: 54px;
  margin-top: 24px;
  border: 1px solid #f0cfcf;
  border-radius: 18px;
  background: #fff7f7;
  color: #b74747;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

@media (min-width: 700px) {
  .profile-content {
    padding-top: 30px;
  }
}
/* ========================================
   ADD CHILD SCREEN
   ======================================== */

.child-form-heading {
  margin-bottom: 26px;
  text-align: center;
}

.child-form-icon {
  width: 68px;
  height: 68px;
  margin: 0 auto 16px;
  border-radius: 22px;
  background: #fff0bd;
  color: var(--navy);
  display: grid;
  place-items: center;
  font-size: 27px;
  box-shadow: 0 8px 22px rgba(6, 55, 102, 0.06);
}

.child-form-heading .eyebrow {
  margin-bottom: 7px;
}

.child-form-heading h2 {
  margin: 0;
  color: var(--navy);
  font-size: 28px;
  letter-spacing: -0.7px;
}

.child-form-heading > p:last-child {
  max-width: 390px;
  margin: 9px auto 0;
  color: #758692;
  font-size: 13px;
  line-height: 1.6;
}

.child-form {
  padding: 24px;
  border: 1px solid #e6ebed;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 14px 40px rgba(6, 55, 102, 0.06);
}

.child-form label {
  display: block;
  margin: 0 0 7px;
  color: var(--navy);
  font-size: 13px;
  font-weight: 800;
}

.child-form input,
.child-form select {
  width: 100%;
  min-height: 52px;
  margin-bottom: 18px;
  padding: 0 15px;
  border: 1px solid #dce5e8;
  border-radius: 15px;
  outline: none;
  background: #ffffff;
  color: var(--navy);
  font: inherit;
  font-size: 14px;
  box-sizing: border-box;
}

.child-form input::placeholder {
  color: #a0abb2;
}

.child-form input:focus,
.child-form select:focus {
  border-color: #9bcfc3;
  box-shadow: 0 0 0 3px rgba(169, 234, 219, 0.25);
}

.child-save-button {
  width: 100%;
  margin-top: 5px;
}

@media (min-width: 700px) {
  .child-form {
    padding: 30px;
  }

  .child-form-heading {
    margin-top: 10px;
  }
}
/* ===== QUIZ EXPERIENCE ===== */

.quiz-screen {
  min-height: 100vh;
  background: #fffaf1;
  color: #17233f;
  padding: 0 20px 48px;
}

.quiz-header {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 24px 0 18px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.quiz-exit-button {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: 0;
  border-radius: 50%;
  background: #ffffff;
  color: #17233f;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(23, 35, 63, 0.08);
}

.quiz-progress-area {
  flex: 1;
}

.quiz-progress-area p {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 700;
  color: #667085;
}

.quiz-progress-track {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9eef5;
}

.quiz-progress-bar {
  width: 10%;
  height: 100%;
  border-radius: inherit;
  background: #a9dfcf;
  transition: width 0.3s ease;
}

.quiz-content {
  width: min(680px, 100%);
  margin: 28px auto 0;
}

.quiz-content > .eyebrow {
  text-align: center;
}

.quiz-content > h1 {
  margin: 6px 0 24px;
  text-align: center;
  color: #17233f;
  font-size: clamp(28px, 5vw, 42px);
  line-height: 1.1;
}

.quiz-card {
  background: #ffffff;
  border: 1px solid #dfeaf1;
  border-radius: 28px;
  padding: 30px;
  box-shadow: 0 12px 32px rgba(23, 35, 63, 0.07);
}

.quiz-question {
  margin: 0 0 22px;
  color: #17233f;
  font-size: clamp(22px, 4vw, 30px);
  line-height: 1.3;
  font-weight: 800;
}

.quiz-hint-button {
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  background: #fff3bd;
  color: #17233f;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.quiz-hint {
  margin: 14px 0 0;
  padding: 14px 16px;
  border-radius: 16px;
  background: #fff9dc;
  line-height: 1.5;
}

.quiz-choices {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.quiz-choice-button {
  width: 100%;
  border: 2px solid #dbe8ef;
  border-radius: 18px;
  padding: 17px 18px;
  background: #ffffff;
  color: #17233f;
  text-align: left;
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.quiz-choice-button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: #9dcfc2;
  background: #f5fcf9;
}

.quiz-choice-button.correct {
  border-color: #8fd4bd;
  background: #e6f7f0;
}

.quiz-choice-button.incorrect {
  border-color: #efb5b5;
  background: #fff0f0;
}

.quiz-choice-button:disabled {
  cursor: default;
  opacity: 1;
}

.quiz-feedback {
  margin-top: 20px;
  padding: 16px 18px;
  border-radius: 18px;
  font-weight: 700;
  line-height: 1.5;
}

.quiz-feedback.correct {
  background: #e6f7f0;
}

.quiz-feedback.incorrect {
  background: #fff0f0;
}

.quiz-next-button {
  width: 100%;
  margin-top: 18px;
}

@media (max-width: 600px) {
  .quiz-screen {
    padding-left: 16px;
    padding-right: 16px;
  }

  .quiz-header {
    padding-top: 18px;
  }

  .quiz-content {
    margin-top: 14px;
  }

  .quiz-card {
    padding: 22px 18px;
    border-radius: 24px;
  }
}


/* ===== QUIZ COMPLETE ===== */

.quiz-complete-screen {
  min-height: 100vh;
  background: #fffaf1;
  color: #17233f;
  padding: 40px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quiz-complete-screen[hidden] {
  display: none;
}

.quiz-complete-content {
  width: min(520px, 100%);
  text-align: center;
}

.quiz-complete-icon {
  width: 78px;
  height: 78px;
  margin: 0 auto 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff3bd;
  font-size: 38px;
}

.quiz-complete-content h1 {
  margin: 6px 0 10px;
  font-size: clamp(36px, 7vw, 54px);
  color: #17233f;
}

.quiz-complete-message {
  margin: 0 0 26px;
  color: #667085;
  font-size: 18px;
}

.quiz-score-card {
  margin: 0 auto 26px;
  padding: 28px 20px;
  border: 1px solid #dfeaf1;
  border-radius: 28px;
  background: #ffffff;
  box-shadow: 0 12px 32px rgba(23, 35, 63, 0.07);
}

.quiz-score-number {
  display: block;
  color: #17233f;
  font-size: 48px;
  line-height: 1;
  font-weight: 800;
}

.quiz-score-label {
  display: block;
  margin-top: 10px;
  color: #667085;
  font-weight: 700;
}

.quiz-complete-content .primary-button {
  width: 100%;
}


/* Activity generation loading screen */
.activity-loading-screen {
  min-height: 100vh;
  background: #fffaf1;
  color: #17233f;
}

.activity-loading-content {
  min-height: 100vh;
  max-width: 560px;
  margin: 0 auto;
  padding: 40px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.activity-loading-content h1 {
  margin: 10px 0 12px;
  font-size: clamp(2rem, 6vw, 3rem);
  line-height: 1.08;
  color: #17233f;
}

.activity-loading-message {
  max-width: 430px;
  margin: 0;
  font-size: 1rem;
  line-height: 1.6;
  color: #5f6879;
}

.sanity-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 70px;
  margin-bottom: 18px;
}

.loader-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  animation: sanityBounce 1.2s ease-in-out infinite;
}

.loader-dot:nth-child(1) {
  background: #a9e5d1;
  animation-delay: 0s;
}

.loader-dot:nth-child(2) {
  background: #f7d774;
  animation-delay: 0.15s;
}

.loader-dot:nth-child(3) {
  background: #c9b8ef;
  animation-delay: 0.3s;
}

@keyframes sanityBounce {
  0%, 60%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-14px);
  }
}

/* MATCHING GAME */
.game-screen {
  min-height: 100vh;
  background: #fffaf1;
  color: #17233f;
  padding: 28px 22px 60px;
}

.game-header {
  width: min(900px, 100%);
  margin: 0 auto 34px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.game-exit-button {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: 1px solid #dce5e7;
  border-radius: 50%;
  background: #ffffff;
  color: #17233f;
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
}

.game-progress-area {
  flex: 1;
}

.game-progress-area p {
  margin: 0 0 8px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #667085;
}

.game-progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eeee;
}

.game-progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #a9e5d1;
  transition: width 0.3s ease;
}

.game-content {
  width: min(760px, 100%);
  margin: 0 auto;
  text-align: center;
}

.game-content h1 {
  margin: 7px 0 10px;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.05;
  color: #17233f;
}

.game-instructions {
  max-width: 600px;
  margin: 0 auto 30px;
  color: #667085;
  line-height: 1.6;
}

.matching-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.matching-column {
  display: grid;
  gap: 12px;
}

.matching-card {
  width: 100%;
  min-height: 74px;
  padding: 16px;
  border: 2px solid #d9e8e7;
  border-radius: 18px;
  background: #ffffff;
  color: #17233f;
  font: inherit;
  font-weight: 700;
  line-height: 1.35;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.matching-card:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: #a9e5d1;
}

.matching-card.selected {
  border-color: #8fcfbb;
  background: #eaf8f3;
}

.matching-card.matched {
  border-color: #a9e5d1;
  background: #eaf8f3;
  color: #445d55;
  cursor: default;
}

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

.game-feedback.correct {
  color: #397963;
}

.game-feedback.incorrect {
  color: #b75c68;
}

@media (max-width: 600px) {
  .game-screen {
    padding: 20px 16px 44px;
  }

  .game-header {
    margin-bottom: 28px;
  }

  .matching-board {
    gap: 10px;
  }

  .matching-column {
    gap: 10px;
  }

  .matching-card {
    min-height: 68px;
    padding: 12px 10px;
    border-radius: 15px;
    font-size: 0.92rem;
  }
}

/* MATCHING GAME FEEDBACK POP-UP */
.matching-feedback-popup {
  position: fixed;
  z-index: 1000;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.85);
  width: min(330px, calc(100vw - 40px));
  padding: 24px 28px;
  border-radius: 24px;
  box-shadow: 0 18px 50px rgba(23, 35, 63, 0.16);
  text-align: center;
  pointer-events: none;
}

.matching-feedback-popup.correct {
  background: #eaf8f3;
  border: 2px solid #a9e5d1;
}

.matching-feedback-popup.incorrect {
  background: #fff1ef;
  border: 2px solid #f3c6c1;
}

.matching-feedback-popup.show {
  animation: matchingFeedbackPop 3s ease forwards;
}

.matching-feedback-icon {
  margin-bottom: 7px;
  font-size: 2rem;
}

.matching-feedback-popup strong,
.matching-feedback-popup span {
  display: block;
}

.matching-feedback-popup strong {
  color: #17233f;
  font-size: 1.35rem;
}

.matching-feedback-popup span {
  margin-top: 5px;
  color: #667085;
  font-size: 0.95rem;
}

@keyframes matchingFeedbackPop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.82);
  }
  15% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.05);
  }
  25%, 78% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.94);
  }
}

/* MATCHING CARD REACTIONS */
.matching-card.match-pop {
  animation: matchingCardPop 0.42s ease;
}

.matching-card.match-wiggle {
  animation: matchingCardWiggle 0.38s ease;
}

@keyframes matchingCardPop {
  0% { transform: scale(1); }
  45% { transform: scale(1.07); }
  70% { transform: scale(0.98); }
  100% { transform: scale(1); }
}

@keyframes matchingCardWiggle {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}

@media (prefers-reduced-motion: reduce) {
  .matching-card.match-pop,
  .matching-card.match-wiggle,
  .matching-feedback-popup.show {
    animation: none;
  }
}

/* MATCHING GAME COMPLETION */
.matching-complete-overlay {
  position: fixed;
  z-index: 1100;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(23, 35, 63, 0.18);
  backdrop-filter: blur(4px);
}

.matching-complete-overlay[hidden] {
  display: none;
}

.matching-complete-card {
  width: min(430px, 100%);
  padding: 38px 30px 30px;
  border: 2px solid #d9ebe5;
  border-radius: 30px;
  background: #fffaf1;
  box-shadow: 0 24px 70px rgba(23, 35, 63, 0.2);
  text-align: center;
  animation: matchingCompletePop 0.5s ease;
}

.matching-complete-stars {
  margin-bottom: 14px;
  font-size: 2.2rem;
  letter-spacing: 8px;
  animation: matchingStarsBounce 0.8s ease;
}

.matching-complete-card h2 {
  margin: 6px 0 10px;
  color: #17233f;
  font-size: 2.35rem;
}

.matching-complete-card > p:not(.eyebrow) {
  margin: 0 auto 26px;
  color: #667085;
  line-height: 1.55;
}

.matching-complete-actions {
  display: grid;
  gap: 11px;
}

.matching-home-button {
  min-height: 50px;
  border: 2px solid #d9e8e7;
  border-radius: 999px;
  background: #ffffff;
  color: #17233f;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

@keyframes matchingCompletePop {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  60% {
    transform: scale(1.04);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes matchingStarsBounce {
  0% { transform: translateY(8px) scale(0.8); opacity: 0; }
  60% { transform: translateY(-4px) scale(1.08); opacity: 1; }
  100% { transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .matching-complete-card,
  .matching-complete-stars {
    animation: none;
  }
}

.study-material-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.study-material-file-name {
  min-width: 0;
  flex: 1;
  overflow-wrap: anywhere;
}

.study-material-file-remove {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: #667085;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  padding: 7px 4px;
}

.study-material-file-remove:hover {
  color: #17233f;
}

#quizCompleteHomeButton {
  width: 100%;
  min-height: 50px;
}

/* DYNAMIC GAME WORLD FOUNDATION */
.matching-game-screen {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.matching-game-screen > .game-header,
.matching-game-screen > .game-content {
  position: relative;
  z-index: 2;
}
.game-world {
  position: absolute;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.game-world-scenery {
  position: absolute;
  inset: 0;
}
.game-world-mascot {
  position: absolute;
  right: max(18px, calc((100vw - 1120px) / 2));
  bottom: 24px;
}
.game-world-decor {
  position: absolute;
  pointer-events: none;
}
/* GAME WORLD THEME PALETTES */
.matching-game-screen {
  --world-sky: #dff6ff;
  --world-mid: #ccefe2;
  --world-ground: #fff1bd;
  --world-accent: #66cbb0;
  --world-accent-2: #ffd66b;
  --world-card: rgba(255, 255, 255, 0.94);
}

.matching-game-screen[data-game-theme="royal"] {
  --world-sky: #f3dcff;
  --world-mid: #ffdff0;
  --world-ground: #fff0bd;
  --world-accent: #a879dc;
  --world-accent-2: #f4b84f;
}

.matching-game-screen[data-game-theme="dinosaur"] {
  --world-sky: #bdebdc;
  --world-mid: #8ed1a8;
  --world-ground: #efd18c;
  --world-accent: #3c9b69;
  --world-accent-2: #ef8b4a;
}

.matching-game-screen[data-game-theme="space"] {
  --world-sky: #222d68;
  --world-mid: #5364aa;
  --world-ground: #c7b9ef;
  --world-accent: #72d7ef;
  --world-accent-2: #ffd66b;
}

.matching-game-screen[data-game-theme="sports"] {
  --world-sky: #bfe8ff;
  --world-mid: #84d6bb;
  --world-ground: #5dbb75;
  --world-accent: #257fc0;
  --world-accent-2: #ffcf4f;
}

.matching-game-screen[data-game-theme="ocean"] {
  --world-sky: #a9e8f2;
  --world-mid: #4fc3c9;
  --world-ground: #e9d69d;
  --world-accent: #247da0;
  --world-accent-2: #ff9c72;
}

.matching-game-screen[data-game-theme="animals"] {
  --world-sky: #dff2c7;
  --world-mid: #9bd59c;
  --world-ground: #f0d49a;
  --world-accent: #568f61;
  --world-accent-2: #f2a65a;
}

.matching-game-screen[data-game-theme="art"] {
  --world-sky: #f5d9ff;
  --world-mid: #c8e6ff;
  --world-ground: #fff0c8;
  --world-accent: #8c70d6;
  --world-accent-2: #ff8ea1;
}

.matching-game-screen[data-game-theme="creature"] {
  --world-sky: #bfe9ff;
  --world-mid: #b7d9ff;
  --world-ground: #f5df9d;
  --world-accent: #596ed5;
  --world-accent-2: #ffcb54;
}

.matching-game-screen[data-game-theme="racing"] {
  --world-sky: #bde6ff;
  --world-mid: #d5dce6;
  --world-ground: #68727d;
  --world-accent: #e85b54;
  --world-accent-2: #ffd24c;
}

.matching-game-screen[data-game-theme="custom"] {
  --world-sky: #dcd8ff;
  --world-mid: #bde8df;
  --world-ground: #ffe8b8;
  --world-accent: #756bd0;
  --world-accent-2: #f6a7ba;
}
/* DIMENSIONAL GAME WORLD */
.matching-game-screen {
  background: var(--world-sky);
  min-height: 100vh;
}

.matching-game-screen .game-world-scenery {
  background:
    radial-gradient(circle at 18% 16%, rgba(255,255,255,.78) 0 5%, transparent 5.5%),
    radial-gradient(circle at 76% 12%, rgba(255,255,255,.48) 0 4%, transparent 4.5%),
    linear-gradient(
      180deg,
      var(--world-sky) 0%,
      var(--world-mid) 64%,
      var(--world-ground) 64%,
      var(--world-ground) 100%
    );
}

.matching-game-screen .game-world-scenery::before,
.matching-game-screen .game-world-scenery::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(1px);
}

.matching-game-screen .game-world-scenery::before {
  width: 430px;
  height: 180px;
  left: -110px;
  bottom: 20%;
  background: color-mix(in srgb, var(--world-accent) 60%, white);
  opacity: .48;
  transform: rotate(8deg);
}

.matching-game-screen .game-world-scenery::after {
  width: 520px;
  height: 210px;
  right: -150px;
  bottom: 15%;
  background: color-mix(in srgb, var(--world-accent-2) 52%, white);
  opacity: .42;
  transform: rotate(-7deg);
}

.matching-game-screen .game-header {
  padding: 12px 16px;
  border-radius: 24px;
  background: rgba(255,255,255,.72);
  box-shadow: 0 12px 35px rgba(23,35,63,.08);
  backdrop-filter: blur(12px);
}

.matching-game-screen .game-content {
  padding: 30px;
  border: 1px solid rgba(255,255,255,.68);
  border-radius: 34px;
  background: rgba(255,255,255,.76);
  box-shadow: 0 24px 65px rgba(23,35,63,.13);
  backdrop-filter: blur(16px);
}

.matching-game-screen .matching-card {
  background: var(--world-card);
  border-color: color-mix(in srgb, var(--world-accent) 34%, white);
  box-shadow: 0 8px 20px rgba(23,35,63,.08);
}

.matching-game-screen .matching-card:hover:not(:disabled) {
  border-color: var(--world-accent);
  box-shadow: 0 12px 24px rgba(23,35,63,.12);
}

.matching-game-screen .game-progress-bar {
  background: linear-gradient(90deg, var(--world-accent), var(--world-accent-2));
}

@media (max-width: 600px) {
  .matching-game-screen .game-content {
    padding: 22px 14px;
    border-radius: 26px;
  }
}
/* GAME WORLD AGE / GRADE TREATMENT */

/* Elementary: brightest, roundest, most playful */
.matching-game-screen[data-grade-band="elementary"] .game-content {
  border-radius: 38px;
}
.matching-game-screen[data-grade-band="elementary"] .matching-card {
  border-radius: 22px;
  border-width: 3px;
  font-size: 1.02rem;
}
.matching-game-screen[data-grade-band="elementary"] .game-content h1 {
  font-size: clamp(2.2rem, 6vw, 3.35rem);
}
.matching-game-screen[data-grade-band="elementary"] .game-world-scenery {
  filter: saturate(1.12);
}

/* Middle school: energetic and adventurous, but less little-kid */
.matching-game-screen[data-grade-band="middle"] .game-content {
  border-radius: 28px;
  background: rgba(255,255,255,.79);
}
.matching-game-screen[data-grade-band="middle"] .matching-card {
  border-radius: 17px;
  border-width: 2px;
}
.matching-game-screen[data-grade-band="middle"] .game-world-scenery {
  filter: saturate(1.02) contrast(1.02);
}

/* High school: more sophisticated and cinematic */
.matching-game-screen[data-grade-band="high"] .game-content {
  border-radius: 22px;
  background: rgba(255,255,255,.84);
  box-shadow: 0 26px 70px rgba(23,35,63,.17);
}
.matching-game-screen[data-grade-band="high"] .matching-card {
  border-radius: 13px;
  border-width: 1px;
  font-weight: 650;
}
.matching-game-screen[data-grade-band="high"] .game-content h1 {
  font-size: clamp(1.9rem, 4vw, 2.7rem);
}
.matching-game-screen[data-grade-band="high"] .game-world-scenery {
  filter: saturate(.84) contrast(1.08);
}
/* DEFAULT SAVE SANITY GAME WORLD — NO INTEREST SELECTED */
.matching-game-screen[data-game-theme="default"] {
  --world-sky: #dcecff;
  --world-mid: #d9f3e9;
  --world-ground: #fff0c9;
  --world-accent: #78cdb6;
  --world-accent-2: #f4c95d;
  --world-card: rgba(255,255,255,.95);
}

.matching-game-screen[data-game-theme="default"][data-grade-band="elementary"] {
  --world-sky: #dcecff;
  --world-mid: #d9f3e9;
  --world-ground: #fff0c9;
  --world-accent: #78cdb6;
  --world-accent-2: #f5b7c7;
}

.matching-game-screen[data-game-theme="default"][data-grade-band="middle"] {
  --world-sky: #cfdff4;
  --world-mid: #c8e7df;
  --world-ground: #f2e4bd;
  --world-accent: #58aa9b;
  --world-accent-2: #7e8fd0;
}

.matching-game-screen[data-game-theme="default"][data-grade-band="high"] {
  --world-sky: #cbd5e3;
  --world-mid: #b9d6d0;
  --world-ground: #d9d2bc;
  --world-accent: #497d7a;
  --world-accent-2: #65749a;
}

.matching-game-screen[data-game-theme="default"] .game-world-mascot {
  display: none;
}
/* GAME WORLD MASCOT POSITIONING */
.matching-game-screen .game-world-mascot {
  width: clamp(150px, 18vw, 240px);
  height: clamp(170px, 21vw, 280px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  transform-origin: bottom center;
}

.matching-game-screen .game-mascot-character {
  position: absolute;
  inset: 0;
  background-position: center bottom;
  background-repeat: no-repeat;
  background-size: contain;
  filter: drop-shadow(0 16px 14px rgba(23,35,63,.18));
}

.matching-game-screen .game-mascot-prop {
  position: absolute;
  inset: 0;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

.matching-game-screen[data-grade-band="elementary"] .game-world-mascot {
  transform: scale(1);
}

.matching-game-screen[data-grade-band="middle"] .game-world-mascot {
  transform: scale(.88);
}

.matching-game-screen[data-grade-band="high"] .game-world-mascot {
  transform: scale(.72);
  opacity: .88;
}

.matching-game-screen[data-game-theme="default"] .game-world-mascot,
.matching-game-screen .game-mascot-character[data-character="none"] {
  display: none;
}

@media (max-width: 760px) {
  .matching-game-screen .game-world-mascot {
    width: 125px;
    height: 150px;
    right: -18px;
    bottom: 10px;
    opacity: .72;
  }
}
/* ROYAL / PRINCESS GAME MASCOT */
.matching-game-screen[data-game-theme="royal"] .game-mascot-character[data-character="cat"] {
  background-image: url("/images/game-worlds/mascots/royal/princess-cat.png");
}
/* ROYAL / PRINCESS ENVIRONMENT */
.matching-game-screen[data-game-theme="royal"] .game-world-scenery {
  background-image:
    linear-gradient(rgba(255,255,255,.05), rgba(255,255,255,.05)),
    url("/images/game-worlds/scenery/royal/royal-background.png");
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
}

/* MATCHING CARD — CLEAR SELECTED STATE */
.matching-game-screen .matching-card.selected,
.matching-game-screen .matching-card.is-selected {
  background: #eee4ff !important;
  border: 3px solid #8b63d9 !important;
  color: #3d2868 !important;
  box-shadow:
    0 0 0 4px rgba(139,99,217,.14),
    0 10px 24px rgba(79,53,130,.18) !important;
  transform: translateY(-2px);
}

.matching-game-screen .matching-card.selected:hover,
.matching-game-screen .matching-card.is-selected:hover {
  background: #eee4ff !important;
  border-color: #8b63d9 !important;
}

/* MATCHING CARD — CLEAR WRONG-PAIR FEEDBACK */
.matching-game-screen .matching-card.wrong,
.matching-game-screen .matching-card.is-wrong {
  background: #ffe5e8 !important;
  border: 3px solid #e46f7d !important;
  color: #7b3040 !important;
  box-shadow:
    0 0 0 4px rgba(228,111,125,.12),
    0 10px 22px rgba(123,48,64,.14) !important;
}

/* MATCHING CARD — CLEAR COMPLETED MATCH */
.matching-game-screen .matching-card.matched {
  position: relative;
  background: #dff6e9 !important;
  border: 3px solid #68bd8a !important;
  color: #245c3c !important;
  box-shadow:
    0 0 0 4px rgba(104,189,138,.10),
    0 8px 18px rgba(36,92,60,.10) !important;
  opacity: .82;
}

.matching-game-screen .matching-card.matched::after {
  content: "✓";
  position: absolute;
  top: 7px;
  right: 10px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #68bd8a;
  color: white;
  font-size: 14px;
  font-weight: 900;
}

.matching-game-screen .matching-card.matched:hover {
  transform: none;
  box-shadow:
    0 0 0 4px rgba(104,189,138,.10),
    0 8px 18px rgba(36,92,60,.10) !important;
}

/* DINOSAUR GAME WORLD */
.matching-game-screen[data-game-theme="dinosaur"] .game-world-scenery {
  background-image:
    linear-gradient(rgba(255,255,255,.03), rgba(255,255,255,.03)),
    url("/images/game-worlds/scenery/dinosaur/dinosaur-background.png");
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
}

.matching-game-screen[data-game-theme="dinosaur"] .game-mascot-character[data-character="trex"] {
  background-image: url("/images/game-worlds/mascots/dinosaur/trex-mascot.png");
}

/* IMMERSIVE GAME MASCOT POSITIONING — shared by themed Matching worlds */
@media (min-width: 1000px) {
  .matching-game-screen[data-game-theme]:not([data-game-theme="default"]) .game-world-mascot {
    width: clamp(300px, 27vw, 470px);
    height: clamp(360px, 34vw, 560px);
    left: max(24px, calc(50% - 760px));
    right: auto;
    bottom: 8vh;
    opacity: 1;
    z-index: 1;
  }

  .matching-game-screen[data-game-theme]:not([data-game-theme="default"]) .game-mascot-character {
    width: 100%;
    height: 100%;
    background-size: contain;
    background-position: center bottom;
    background-repeat: no-repeat;
  }
}

/* THEMED MASCOT — enlarge the visible character inside its positioning area */
@media (min-width: 1000px) {
  .matching-game-screen[data-game-theme]:not([data-game-theme="default"]) .game-mascot-character {
    transform: scale(1.65);
    transform-origin: center bottom;
  }
}

/* DESKTOP THEMED MASCOT — keep character clearly beside gameplay */
@media (min-width: 1000px) {
  .matching-game-screen[data-game-theme]:not([data-game-theme="default"]) .game-world-mascot {
    left: max(12px, calc(50% - 900px));
  }
}

/* FINAL DESKTOP MASCOT POSITION — more breathing room beside game board */
@media (min-width: 1000px) {
  .matching-game-screen[data-game-theme]:not([data-game-theme="default"]) .game-world-mascot {
    left: max(-70px, calc(50% - 980px));
  }
}

/* SPACE GAME WORLD */
.matching-game-screen[data-game-theme="space"] .game-world-scenery {
  background-image:
    linear-gradient(rgba(255,255,255,.03), rgba(255,255,255,.03)),
    url("/images/game-worlds/scenery/space/space-background.png");
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
}

.matching-game-screen[data-game-theme="space"] .game-mascot-character[data-character="fox"] {
  background-image: url("/images/game-worlds/mascots/space/space-fox-mascot.png");
}

/* SPORTS GAME WORLD */
.matching-game-screen[data-game-theme="sports"] .game-world-scenery {
  background-image:
    linear-gradient(rgba(255,255,255,.03), rgba(255,255,255,.03)),
    url("/images/game-worlds/scenery/sports/sports-background.png");
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
}

.matching-game-screen[data-game-theme="sports"] .game-mascot-character[data-character="tiger"] {
  background-image: url("/images/game-worlds/mascots/sports/sports-tiger-mascot.png");
}

/* OCEAN GAME WORLD */
.matching-game-screen[data-game-theme="ocean"] .game-world-scenery {
  background-image:
    linear-gradient(rgba(255,255,255,.03), rgba(255,255,255,.03)),
    url("/images/game-worlds/scenery/ocean/ocean-background.png");
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
}

.matching-game-screen[data-game-theme="ocean"] .game-mascot-character[data-character="dolphin"] {
  background-image: url("/images/game-worlds/mascots/ocean/ocean-dolphin-mascot.png");
}

/* ANIMALS GAME WORLD */
.matching-game-screen[data-game-theme="animals"] .game-world-scenery {
  background-image:
    linear-gradient(rgba(255,255,255,.03), rgba(255,255,255,.03)),
    url("/images/game-worlds/scenery/animals/animals-background.png");
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
}

.matching-game-screen[data-game-theme="animals"] .game-mascot-character[data-character="giraffe"] {
  background-image: url("/images/game-worlds/mascots/animals/animals-giraffe.png");
}

/* ART GAME WORLD */
.matching-game-screen[data-game-theme="art"] .game-world-scenery {
  background-image:
    linear-gradient(rgba(255,255,255,.03), rgba(255,255,255,.03)),
    url("/images/game-worlds/scenery/art/art-background.png");
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
}

.matching-game-screen[data-game-theme="art"] .game-mascot-character[data-character="rabbit"] {
  background-image: url("/images/game-worlds/mascots/art/art-rabbit-mascot.png");
}

/* SORTING GAME — IMMERSIVE WORLD FOUNDATION */
.sorting-game-screen {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  min-height: 100vh;

  --world-sky: #dff6ff;
  --world-mid: #ccefe2;
  --world-ground: #fff1bd;
  --world-accent: #66cbb0;
  --world-accent-2: #ffd66b;
  --world-card: rgba(255, 255, 255, 0.94);

  background: var(--world-sky);
}

.sorting-game-screen > .game-header,
.sorting-game-screen > .game-content {
  position: relative;
  z-index: 2;
}

.sorting-game-screen[data-game-theme="royal"] {
  --world-sky: #f3dcff;
  --world-mid: #ffdff0;
  --world-ground: #fff0bd;
  --world-accent: #a879dc;
  --world-accent-2: #f4b84f;
}

.sorting-game-screen[data-game-theme="dinosaur"] {
  --world-sky: #bdebdc;
  --world-mid: #8ed1a8;
  --world-ground: #efd18c;
  --world-accent: #3c9b69;
  --world-accent-2: #ef8b4a;
}

.sorting-game-screen[data-game-theme="space"] {
  --world-sky: #222d68;
  --world-mid: #5364aa;
  --world-ground: #c7b9ef;
  --world-accent: #72d7ef;
  --world-accent-2: #ffd66b;
}

.sorting-game-screen[data-game-theme="sports"] {
  --world-sky: #bfe8ff;
  --world-mid: #84d6bb;
  --world-ground: #5dbb75;
  --world-accent: #257fc0;
  --world-accent-2: #ffcf4f;
}

.sorting-game-screen[data-game-theme="ocean"] {
  --world-sky: #a9e8f2;
  --world-mid: #4fc3c9;
  --world-ground: #e9d69d;
  --world-accent: #247da0;
  --world-accent-2: #ff9c72;
}

.sorting-game-screen[data-game-theme="animals"] {
  --world-sky: #dff2c7;
  --world-mid: #9bd59c;
  --world-ground: #f0d49a;
  --world-accent: #568f61;
  --world-accent-2: #f2a65a;
}

.sorting-game-screen[data-game-theme="art"] {
  --world-sky: #f5d9ff;
  --world-mid: #c8e6ff;
  --world-ground: #fff0c8;
  --world-accent: #8c70d6;
  --world-accent-2: #ff8ea1;
}

.sorting-game-screen[data-game-theme="creature"] {
  --world-sky: #bfe9ff;
  --world-mid: #b7d9ff;
  --world-ground: #f5df9d;
  --world-accent: #596ed5;
  --world-accent-2: #ffcb54;
}

.sorting-game-screen[data-game-theme="racing"] {
  --world-sky: #bde6ff;
  --world-mid: #d5dce6;
  --world-ground: #68727d;
  --world-accent: #e85b54;
  --world-accent-2: #ffd24c;
}

.sorting-game-screen[data-game-theme="custom"] {
  --world-sky: #dcd8ff;
  --world-mid: #bde8df;
  --world-ground: #ffe8b8;
  --world-accent: #756bd0;
  --world-accent-2: #f6a7ba;
}

.sorting-game-screen .game-world-scenery {
  background:
    radial-gradient(circle at 18% 16%, rgba(255,255,255,.78) 0 5%, transparent 5.5%),
    radial-gradient(circle at 76% 12%, rgba(255,255,255,.48) 0 4%, transparent 4.5%),
    linear-gradient(
      180deg,
      var(--world-sky) 0%,
      var(--world-mid) 64%,
      var(--world-ground) 64%,
      var(--world-ground) 100%
    );
}


/* SORTING GAME — THEMED SCENERY + MASCOTS */
.sorting-game-screen[data-game-theme="royal"] .game-world-scenery {
  background-image: linear-gradient(rgba(255,255,255,.05), rgba(255,255,255,.05)), url("/images/game-worlds/scenery/royal/royal-background.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.sorting-game-screen[data-game-theme="royal"] .game-mascot-character[data-character="cat"] {
  background-image: url("/images/game-worlds/mascots/royal/princess-cat.png");
}

.sorting-game-screen[data-game-theme="dinosaur"] .game-world-scenery {
  background-image: linear-gradient(rgba(255,255,255,.03), rgba(255,255,255,.03)), url("/images/game-worlds/scenery/dinosaur/dinosaur-background.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.sorting-game-screen[data-game-theme="dinosaur"] .game-mascot-character[data-character="trex"] {
  background-image: url("/images/game-worlds/mascots/dinosaur/trex-mascot.png");
}

.sorting-game-screen[data-game-theme="space"] .game-world-scenery {
  background-image: linear-gradient(rgba(255,255,255,.03), rgba(255,255,255,.03)), url("/images/game-worlds/scenery/space/space-background.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.sorting-game-screen[data-game-theme="space"] .game-mascot-character[data-character="fox"] {
  background-image: url("/images/game-worlds/mascots/space/space-fox-mascot.png");
}

.sorting-game-screen[data-game-theme="sports"] .game-world-scenery {
  background-image: linear-gradient(rgba(255,255,255,.03), rgba(255,255,255,.03)), url("/images/game-worlds/scenery/sports/sports-background.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.sorting-game-screen[data-game-theme="sports"] .game-mascot-character[data-character="tiger"] {
  background-image: url("/images/game-worlds/mascots/sports/sports-tiger-mascot.png");
}

.sorting-game-screen[data-game-theme="ocean"] .game-world-scenery {
  background-image: linear-gradient(rgba(255,255,255,.03), rgba(255,255,255,.03)), url("/images/game-worlds/scenery/ocean/ocean-background.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.sorting-game-screen[data-game-theme="ocean"] .game-mascot-character[data-character="dolphin"] {
  background-image: url("/images/game-worlds/mascots/ocean/ocean-dolphin-mascot.png");
}

.sorting-game-screen[data-game-theme="animals"] .game-world-scenery {
  background-image: linear-gradient(rgba(255,255,255,.03), rgba(255,255,255,.03)), url("/images/game-worlds/scenery/animals/animals-background.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.sorting-game-screen[data-game-theme="art"] .game-world-scenery {
  background-image: linear-gradient(rgba(255,255,255,.03), rgba(255,255,255,.03)), url("/images/game-worlds/scenery/art/art-background.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.sorting-game-screen[data-game-theme="art"] .game-mascot-character[data-character="rabbit"] {
  background-image: url("/images/game-worlds/mascots/art/art-rabbit-mascot.png");
}


/* SORTING GAME — GAMEPLAY */
.sorting-game-screen .game-content {
  width: min(760px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 64px;
  text-align: center;
}

.sorting-play-area {
  width: 100%;
  margin: 28px auto 0;
}

.sorting-item-card {
  width: min(620px, 100%);
  min-height: 150px;
  margin: 0 auto;
  padding: 30px 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid rgba(255,255,255,.9);
  border-radius: 30px;
  background: var(--world-card);
  box-shadow: 0 18px 45px rgba(34,45,76,.16);
  color: #243354;
  font-size: clamp(1.25rem, 2.4vw, 1.8rem);
  font-weight: 800;
  line-height: 1.35;
}

.sorting-prompt {
  margin: 24px 0 16px;
  color: #243354;
  font-size: 1rem;
  font-weight: 800;
}

.sorting-categories {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  width: min(650px, 100%);
  margin: 0 auto;
}

.sorting-category-button {
  min-height: 72px;
  padding: 16px 20px;
  border: 3px solid rgba(255,255,255,.88);
  border-radius: 22px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 10px 24px rgba(34,45,76,.12);
  color: #243354;
  font: inherit;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease;
}

.sorting-category-button:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px rgba(34,45,76,.16);
  border-color: var(--world-accent);
}

.sorting-category-button.correct {
  background: #dff6e9;
  border-color: #68bd8a;
  color: #245c3c;
}

.sorting-category-button.wrong {
  background: #ffe5e8;
  border-color: #e46f7d;
  color: #7b3040;
}

/* SORTING GAME — THEMED MASCOT */
.sorting-game-screen .game-world-mascot {
  width: 125px;
  height: 150px;
  right: -18px;
  bottom: 10px;
  opacity: .72;
}

.sorting-game-screen .game-mascot-character {
  width: 100%;
  height: 100%;
  background-size: contain;
  background-position: center bottom;
  background-repeat: no-repeat;
}

@media (min-width: 1000px) {
  .sorting-game-screen[data-game-theme]:not([data-game-theme="default"]) .game-world-mascot {
    width: clamp(300px, 27vw, 470px);
    height: clamp(360px, 34vw, 560px);
    left: max(-70px, calc(50% - 980px));
    right: auto;
    bottom: 8vh;
    opacity: 1;
    z-index: 1;
  }

  .sorting-game-screen[data-game-theme]:not([data-game-theme="default"]) .game-mascot-character {
    transform: scale(1.65);
    transform-origin: center bottom;
  }
}

@media (max-width: 620px) {
  .sorting-game-screen .game-content {
    width: min(100% - 24px, 760px);
    padding-top: 18px;
  }

  .sorting-item-card {
    min-height: 125px;
    padding: 24px 20px;
    border-radius: 24px;
  }

  .sorting-categories {
    grid-template-columns: 1fr;
    gap: 11px;
  }

  .sorting-category-button {
    min-height: 62px;
  }
}


/* SORTING GAME — GAMEPLAY */
.sorting-game-screen .game-content {
  width: min(760px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 64px;
  text-align: center;
}

.sorting-play-area {
  width: 100%;
  margin: 28px auto 0;
}

.sorting-item-card {
  width: min(620px, 100%);
  min-height: 150px;
  margin: 0 auto;
  padding: 30px 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid rgba(255,255,255,.9);
  border-radius: 30px;
  background: var(--world-card);
  box-shadow: 0 18px 45px rgba(34,45,76,.16);
  color: #243354;
  font-size: clamp(1.25rem, 2.4vw, 1.8rem);
  font-weight: 800;
  line-height: 1.35;
}

.sorting-prompt {
  margin: 24px 0 16px;
  color: #243354;
  font-size: 1rem;
  font-weight: 800;
}

.sorting-categories {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  width: min(650px, 100%);
  margin: 0 auto;
}

.sorting-category-button {
  min-height: 72px;
  padding: 16px 20px;
  border: 3px solid rgba(255,255,255,.88);
  border-radius: 22px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 10px 24px rgba(34,45,76,.12);
  color: #243354;
  font: inherit;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease;
}

.sorting-category-button:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px rgba(34,45,76,.16);
  border-color: var(--world-accent);
}

.sorting-category-button.correct {
  background: #dff6e9;
  border-color: #68bd8a;
  color: #245c3c;
}

.sorting-category-button.wrong {
  background: #ffe5e8;
  border-color: #e46f7d;
  color: #7b3040;
}

/* SORTING GAME — THEMED MASCOT */
.sorting-game-screen .game-world-mascot {
  width: 125px;
  height: 150px;
  right: -18px;
  bottom: 10px;
  opacity: .72;
}

.sorting-game-screen .game-mascot-character {
  width: 100%;
  height: 100%;
  background-size: contain;
  background-position: center bottom;
  background-repeat: no-repeat;
}

@media (min-width: 1000px) {
  .sorting-game-screen[data-game-theme]:not([data-game-theme="default"]) .game-world-mascot {
    width: clamp(300px, 27vw, 470px);
    height: clamp(360px, 34vw, 560px);
    left: max(-70px, calc(50% - 980px));
    right: auto;
    bottom: 8vh;
    opacity: 1;
    z-index: 1;
  }

  .sorting-game-screen[data-game-theme]:not([data-game-theme="default"]) .game-mascot-character {
    transform: scale(1.65);
    transform-origin: center bottom;
  }
}

@media (max-width: 620px) {
  .sorting-game-screen .game-content {
    width: min(100% - 24px, 760px);
    padding-top: 18px;
  }

  .sorting-item-card {
    min-height: 125px;
    padding: 24px 20px;
    border-radius: 24px;
  }

  .sorting-categories {
    grid-template-columns: 1fr;
    gap: 11px;
  }

  .sorting-category-button {
    min-height: 62px;
  }
}


/* SORTING GAME — READABILITY POLISH */
.sorting-game-screen .game-content > .eyebrow,
.sorting-game-screen #sortingGameTitle,
.sorting-game-screen #sortingGameInstructions {
  position: relative;
  z-index: 3;
}

.sorting-game-screen #sortingGameTitle {
  color: #172746;
  text-shadow: 0 2px 10px rgba(255,255,255,.7);
}

.sorting-game-screen #sortingGameInstructions {
  width: fit-content;
  max-width: 720px;
  margin: 8px auto 0;
  padding: 10px 18px;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 18px;
  background: rgba(255,255,255,.82);
  box-shadow: 0 8px 24px rgba(30,45,75,.10);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #35435f;
  font-weight: 700;
  line-height: 1.45;
}

.sorting-game-screen .sorting-prompt {
  width: fit-content;
  margin: 22px auto 16px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(255,255,255,.88);
  box-shadow: 0 6px 18px rgba(30,45,75,.12);
  color: #172746;
  font-size: 1.05rem;
  font-weight: 900;
}

.sorting-game-screen .game-progress-area {
  padding: 7px 12px;
  border-radius: 18px;
  background: rgba(255,255,255,.76);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

.sorting-game-screen #sortingGameProgressText {
  color: #263754;
  font-weight: 800;
}

.sorting-game-screen .sorting-category-button {
  background: rgba(255,255,255,.94);
  color: #172746;
}


/* SORTING GAME — INTERACTIVE DESTINATION ZONES */
.sorting-game-screen .sorting-categories {
  gap: 18px;
  perspective: 900px;
}

.sorting-game-screen .sorting-category-button {
  position: relative;
  overflow: hidden;
  min-height: 86px;
  padding: 18px 22px;
  border: 3px solid rgba(255,255,255,.92);
  border-radius: 26px;
  background:
    linear-gradient(
      145deg,
      rgba(255,255,255,.97),
      rgba(255,255,255,.84)
    );
  box-shadow:
    0 12px 0 rgba(36,51,84,.08),
    0 18px 30px rgba(36,51,84,.14);
  color: #172746;
  font-size: 1.08rem;
  font-weight: 900;
  transform: translateY(0) scale(1);
  transition:
    transform .18s ease,
    box-shadow .18s ease,
    border-color .18s ease,
    background .18s ease;
}

.sorting-game-screen .sorting-category-button::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    115deg,
    transparent 20%,
    rgba(255,255,255,.62) 45%,
    transparent 70%
  );
  transform: translateX(-120%);
  transition: transform .45s ease;
  pointer-events: none;
}

.sorting-game-screen .sorting-category-button:hover:not(:disabled) {
  transform: translateY(-7px) scale(1.025);
  border-color: var(--world-accent);
  box-shadow:
    0 8px 0 rgba(36,51,84,.08),
    0 22px 36px rgba(36,51,84,.20);
}

.sorting-game-screen .sorting-category-button:hover:not(:disabled)::before {
  transform: translateX(120%);
}

.sorting-game-screen .sorting-category-button:active:not(:disabled) {
  transform: translateY(-1px) scale(.985);
}

.sorting-game-screen .sorting-category-button.correct {
  border-color: #58bd83;
  background: linear-gradient(145deg, #effff5, #c9f3d9);
  box-shadow:
    0 8px 0 rgba(61,145,96,.15),
    0 0 32px rgba(87,201,132,.45);
  transform: translateY(-4px) scale(1.035);
}

.sorting-game-screen .sorting-category-button.wrong {
  border-color: #e87887;
  background: linear-gradient(145deg, #fff4f5, #ffd9de);
  box-shadow:
    0 8px 0 rgba(185,74,91,.12),
    0 0 25px rgba(232,120,135,.28);
}

/* Make the item feel like a game piece */
.sorting-game-screen .sorting-item-card {
  position: relative;
  animation: sortingItemFloat 2.8s ease-in-out infinite;
  transition:
    transform .45s cubic-bezier(.2,.8,.2,1),
    opacity .35s ease;
}

@keyframes sortingItemFloat {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-7px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .sorting-game-screen .sorting-item-card {
    animation: none;
  }

  .sorting-game-screen .sorting-category-button {
    transition: none;
  }
}


/* SORTING GAME — INTERACTIVE DESTINATION ZONES */
.sorting-game-screen .sorting-categories {
  gap: 18px;
  perspective: 900px;
}

.sorting-game-screen .sorting-category-button {
  position: relative;
  overflow: hidden;
  min-height: 86px;
  padding: 18px 22px;
  border: 3px solid rgba(255,255,255,.92);
  border-radius: 26px;
  background:
    linear-gradient(
      145deg,
      rgba(255,255,255,.97),
      rgba(255,255,255,.84)
    );
  box-shadow:
    0 12px 0 rgba(36,51,84,.08),
    0 18px 30px rgba(36,51,84,.14);
  color: #172746;
  font-size: 1.08rem;
  font-weight: 900;
  transform: translateY(0) scale(1);
  transition:
    transform .18s ease,
    box-shadow .18s ease,
    border-color .18s ease,
    background .18s ease;
}

.sorting-game-screen .sorting-category-button::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    115deg,
    transparent 20%,
    rgba(255,255,255,.62) 45%,
    transparent 70%
  );
  transform: translateX(-120%);
  transition: transform .45s ease;
  pointer-events: none;
}

.sorting-game-screen .sorting-category-button:hover:not(:disabled) {
  transform: translateY(-7px) scale(1.025);
  border-color: var(--world-accent);
  box-shadow:
    0 8px 0 rgba(36,51,84,.08),
    0 22px 36px rgba(36,51,84,.20);
}

.sorting-game-screen .sorting-category-button:hover:not(:disabled)::before {
  transform: translateX(120%);
}

.sorting-game-screen .sorting-category-button:active:not(:disabled) {
  transform: translateY(-1px) scale(.985);
}

.sorting-game-screen .sorting-category-button.correct {
  border-color: #58bd83;
  background: linear-gradient(145deg, #effff5, #c9f3d9);
  box-shadow:
    0 8px 0 rgba(61,145,96,.15),
    0 0 32px rgba(87,201,132,.45);
  transform: translateY(-4px) scale(1.035);
}

.sorting-game-screen .sorting-category-button.wrong {
  border-color: #e87887;
  background: linear-gradient(145deg, #fff4f5, #ffd9de);
  box-shadow:
    0 8px 0 rgba(185,74,91,.12),
    0 0 25px rgba(232,120,135,.28);
}

/* Make the item feel like a game piece */
.sorting-game-screen .sorting-item-card {
  position: relative;
  animation: sortingItemFloat 2.8s ease-in-out infinite;
  transition:
    transform .45s cubic-bezier(.2,.8,.2,1),
    opacity .35s ease;
}

@keyframes sortingItemFloat {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-7px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .sorting-game-screen .sorting-item-card {
    animation: none;
  }

  .sorting-game-screen .sorting-category-button {
    transition: none;
  }
}


/* SORTING GAME — SEND IT HOME ANIMATION */
.sorting-game-screen .sorting-item-card.sorting-item-sent {
  animation: sortingSendHome .82s cubic-bezier(.22,.8,.3,1) forwards;
  pointer-events: none;
}

@keyframes sortingSendHome {
  0% {
    transform: translate(0, 0) scale(1) rotate(0deg);
    opacity: 1;
  }

  45% {
    transform:
      translate(
        calc(var(--sorting-move-x) * .48),
        calc(var(--sorting-move-y) * .48 - 28px)
      )
      scale(.9)
      rotate(-2deg);
    opacity: 1;
  }

  100% {
    transform:
      translate(
        var(--sorting-move-x),
        var(--sorting-move-y)
      )
      scale(.32)
      rotate(3deg);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sorting-game-screen .sorting-item-card.sorting-item-sent {
    animation: sortingSendHomeReduced .35s ease forwards;
  }

  @keyframes sortingSendHomeReduced {
    to {
      opacity: 0;
      transform: scale(.85);
    }
  }
}


/* =========================================================
   DRAG & DROP GAME — WORLD FOUNDATION
   ========================================================= */

.drag-drop-game-screen {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  min-height: 100vh;
  --world-sky: #dff6ff;
  --world-mid: #ccefe2;
  --world-ground: #fff1bd;
  --world-accent: #66cbb0;
  --world-accent-2: #ffd66b;
  --world-card: rgba(255, 255, 255, 0.94);
  background: var(--world-sky);
}

.drag-drop-game-screen > .game-header,
.drag-drop-game-screen > .game-content {
  position: relative;
  z-index: 2;
}

.drag-drop-game-screen .game-world {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.drag-drop-game-screen .game-world-scenery {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 18%, rgba(255,255,255,.75) 0 5%, transparent 6%),
    radial-gradient(circle at 82% 22%, rgba(255,255,255,.55) 0 4%, transparent 5%),
    linear-gradient(
      to bottom,
      var(--world-sky) 0%,
      var(--world-mid) 62%,
      var(--world-ground) 100%
    );
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.drag-drop-game-screen .game-content {
  width: min(760px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 64px;
  text-align: center;
}

.drag-drop-game-screen .game-content > h1 {
  color: #17233f;
  text-shadow: 0 2px 12px rgba(255,255,255,.9);
}

.drag-drop-game-screen #dragDropGameInstructions {
  width: fit-content;
  max-width: 720px;
  margin: 8px auto 0;
  padding: 10px 18px;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 18px;
  background: rgba(255,255,255,.82);
  box-shadow: 0 8px 24px rgba(30,45,75,.10);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #35435f;
  font-weight: 700;
  line-height: 1.45;
}

.drag-drop-game-screen .game-progress-area {
  padding: 8px 14px;
  border-radius: 18px;
  background: rgba(255,255,255,.78);
  box-shadow: 0 8px 22px rgba(30,45,75,.09);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.drag-drop-play-area {
  width: 100%;
  margin: 28px auto 0;
  position: relative;
}

.drag-drop-prompt {
  width: fit-content;
  margin: 0 auto 18px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(255,255,255,.88);
  box-shadow: 0 7px 20px rgba(30,45,75,.09);
  color: #35435f;
  font-weight: 800;
}

@media (max-width: 620px) {
  .drag-drop-game-screen .game-content {
    width: min(100% - 22px, 760px);
    padding-bottom: 40px;
  }

  .drag-drop-play-area {
    margin-top: 20px;
  }
}

/* DRAG & DROP GAME — THEMED SCENERY */

.drag-drop-game-screen[data-game-theme="royal"] .game-world-scenery {
  background-image:
    linear-gradient(rgba(255,255,255,.05), rgba(255,255,255,.05)),
    url("/images/game-worlds/scenery/royal/royal-background.png");
}

.drag-drop-game-screen[data-game-theme="dinosaur"] .game-world-scenery {
  background-image:
    linear-gradient(rgba(255,255,255,.03), rgba(255,255,255,.03)),
    url("/images/game-worlds/scenery/dinosaur/dinosaur-background.png");
}

.drag-drop-game-screen[data-game-theme="space"] .game-world-scenery {
  background-image:
    linear-gradient(rgba(10,18,55,.04), rgba(10,18,55,.04)),
    url("/images/game-worlds/scenery/space/space-background.png");
}

.drag-drop-game-screen[data-game-theme="sports"] .game-world-scenery {
  background-image:
    linear-gradient(rgba(255,255,255,.03), rgba(255,255,255,.03)),
    url("/images/game-worlds/scenery/sports/sports-background.png");
}

.drag-drop-game-screen[data-game-theme="ocean"] .game-world-scenery {
  background-image:
    linear-gradient(rgba(255,255,255,.03), rgba(255,255,255,.03)),
    url("/images/game-worlds/scenery/ocean/ocean-background.png");
}

.drag-drop-game-screen[data-game-theme="animals"] .game-world-scenery {
  background-image:
    linear-gradient(rgba(255,255,255,.03), rgba(255,255,255,.03)),
    url("/images/game-worlds/scenery/animals/animals-background.png");
}

.drag-drop-game-screen[data-game-theme="art"] .game-world-scenery {
  background-image:
    linear-gradient(rgba(255,255,255,.04), rgba(255,255,255,.04)),
    url("/images/game-worlds/scenery/art/art-background.png");
}

.drag-drop-game-screen[data-game-theme]:not([data-game-theme="default"]) .game-world-scenery {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* DRAG & DROP GAME — MASCOT LAYER */

.drag-drop-game-screen .game-world-mascot {
  width: 125px;
  height: 150px;
  right: -18px;
  bottom: 10px;
  opacity: .72;
}

.drag-drop-game-screen .game-mascot-character {
  width: 100%;
  height: 100%;
  background-size: contain;
  background-position: center bottom;
  background-repeat: no-repeat;
}

.drag-drop-game-screen[data-game-theme="royal"] .game-mascot-character[data-character="cat"] {
  background-image: url("/images/game-worlds/mascots/royal/princess-cat.png");
}

.drag-drop-game-screen[data-game-theme="dinosaur"] .game-mascot-character[data-character="trex"] {
  background-image: url("/images/game-worlds/mascots/dinosaur/trex-mascot.png");
}

.drag-drop-game-screen[data-game-theme="space"] .game-mascot-character[data-character="fox"] {
  background-image: url("/images/game-worlds/mascots/space/space-fox-mascot.png");
}

.drag-drop-game-screen[data-game-theme="sports"] .game-mascot-character[data-character="tiger"] {
  background-image: url("/images/game-worlds/mascots/sports/sports-tiger-mascot.png");
}

.drag-drop-game-screen[data-game-theme="ocean"] .game-mascot-character[data-character="dolphin"] {
  background-image: url("/images/game-worlds/mascots/ocean/ocean-dolphin-mascot.png");
}

.drag-drop-game-screen[data-game-theme="art"] .game-mascot-character[data-character="rabbit"] {
  background-image: url("/images/game-worlds/mascots/art/art-rabbit-mascot.png");
}

@media (min-width: 1000px) {
  .drag-drop-game-screen[data-game-theme]:not([data-game-theme="default"]) .game-world-mascot {
    width: clamp(300px, 27vw, 470px);
    height: clamp(360px, 34vw, 560px);
    left: max(-70px, calc(50% - 980px));
    right: auto;
    bottom: 8vh;
    opacity: 1;
    z-index: 1;
  }

  .drag-drop-game-screen[data-game-theme]:not([data-game-theme="default"]) .game-mascot-character {
    transform: scale(1.65);
    transform-origin: center bottom;
  }
}

/* DRAG & DROP GAME — MOVABLE PIECE */

.drag-drop-game-screen .drag-drop-piece {
  position: relative;
  z-index: 5;
  width: min(430px, 86%);
  min-height: 112px;
  margin: 0 auto 30px;
  padding: 24px 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid rgba(255,255,255,.95);
  border-radius: 28px;
  background:
    linear-gradient(145deg, rgba(255,255,255,.98), rgba(245,248,255,.94));
  box-shadow:
    0 16px 32px rgba(35,48,82,.16),
    0 5px 0 rgba(55,75,115,.12);
  color: #17233f;
  font-size: clamp(1.05rem, 2.3vw, 1.35rem);
  font-weight: 850;
  line-height: 1.3;
  text-align: center;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  transition:
    transform .18s ease,
    box-shadow .18s ease,
    border-color .18s ease;
  animation: dragDropPieceFloat 3s ease-in-out infinite;
}

.drag-drop-game-screen .drag-drop-piece::before {
  content: "✦";
  position: absolute;
  top: 10px;
  left: 14px;
  color: var(--world-accent);
  font-size: 1rem;
  opacity: .7;
}

.drag-drop-game-screen .drag-drop-piece::after {
  content: "⋮⋮";
  position: absolute;
  right: 15px;
  bottom: 8px;
  color: #8390aa;
  font-size: 1rem;
  letter-spacing: -2px;
  opacity: .55;
}

.drag-drop-game-screen .drag-drop-piece:hover {
  transform: translateY(-4px) scale(1.015);
  box-shadow:
    0 20px 38px rgba(35,48,82,.20),
    0 6px 0 rgba(55,75,115,.12);
}

.drag-drop-game-screen .drag-drop-piece:active,
.drag-drop-game-screen .drag-drop-piece.dragging {
  cursor: grabbing;
  animation: none;
  box-shadow:
    0 24px 44px rgba(35,48,82,.23),
    0 0 0 5px rgba(255,255,255,.35);
}

.drag-drop-game-screen .drag-drop-piece.correct {
  border-color: #6fd3ad;
  box-shadow:
    0 18px 38px rgba(69,180,139,.24),
    0 0 0 5px rgba(111,211,173,.16);
}

.drag-drop-game-screen .drag-drop-piece.wrong {
  border-color: #f28ca8;
  animation: dragDropWrongShake .42s ease;
}

@keyframes dragDropPieceFloat {
  0%, 100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-7px);
  }
}

@keyframes dragDropWrongShake {
  0%, 100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-9px) rotate(-1deg);
  }

  50% {
    transform: translateX(8px) rotate(1deg);
  }

  75% {
    transform: translateX(-5px);
  }
}

@media (max-width: 620px) {
  .drag-drop-game-screen .drag-drop-piece {
    width: min(92%, 430px);
    min-height: 96px;
    margin-bottom: 22px;
    padding: 20px 24px;
    border-radius: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .drag-drop-game-screen .drag-drop-piece {
    animation: none;
    transition: none;
  }
}


/* DRAG & DROP GAME — DESTINATION ZONES */

.drag-drop-game-screen .drag-drop-targets {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 0 auto;
}

.drag-drop-game-screen .drag-drop-target {
  position: relative;
  min-height: 92px;
  padding: 18px 20px;
  overflow: hidden;
  border: 2px dashed rgba(76, 95, 135, .34);
  border-radius: 24px;
  background: rgba(255,255,255,.88);
  box-shadow:
    0 10px 24px rgba(35,48,82,.11),
    inset 0 0 0 2px rgba(255,255,255,.55);
  color: #253451;
  font: inherit;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.3;
  cursor: pointer;
  transition:
    transform .18s ease,
    border-color .18s ease,
    box-shadow .18s ease,
    background .18s ease;
}

.drag-drop-game-screen .drag-drop-target::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    115deg,
    transparent 25%,
    rgba(255,255,255,.58) 45%,
    transparent 65%
  );
  transform: translateX(-130%);
  transition: transform .5s ease;
  pointer-events: none;
}

.drag-drop-game-screen .drag-drop-target:hover {
  transform: translateY(-3px);
  border-color: var(--world-accent);
  box-shadow:
    0 15px 30px rgba(35,48,82,.15),
    0 0 0 4px rgba(255,255,255,.30);
}

.drag-drop-game-screen .drag-drop-target:hover::before {
  transform: translateX(130%);
}

.drag-drop-game-screen .drag-drop-target.drag-over {
  transform: translateY(-5px) scale(1.035);
  border-style: solid;
  border-color: var(--world-accent);
  background: rgba(255,255,255,.97);
  box-shadow:
    0 18px 38px rgba(35,48,82,.18),
    0 0 0 6px rgba(255,255,255,.38);
}

.drag-drop-game-screen .drag-drop-target.correct {
  border-style: solid;
  border-color: #61c99f;
  background: rgba(226,250,239,.97);
  color: #17664c;
  box-shadow:
    0 16px 34px rgba(62,177,133,.22),
    0 0 0 6px rgba(111,211,173,.18);
  animation: dragDropTargetSuccess .55s ease;
}

.drag-drop-game-screen .drag-drop-target.wrong {
  border-style: solid;
  border-color: #ef87a4;
  background: rgba(255,235,241,.97);
  color: #9b3654;
  box-shadow:
    0 14px 30px rgba(211,83,120,.17),
    0 0 0 5px rgba(242,140,168,.14);
  animation: dragDropTargetWrong .42s ease;
}

@keyframes dragDropTargetSuccess {
  0% { transform: scale(1); }
  50% { transform: scale(1.055); }
  100% { transform: scale(1); }
}

@keyframes dragDropTargetWrong {
  0%, 100% { transform: translateX(0); }
  35% { transform: translateX(-6px); }
  70% { transform: translateX(6px); }
}

@media (max-width: 620px) {
  .drag-drop-game-screen .drag-drop-targets {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .drag-drop-game-screen .drag-drop-target {
    min-height: 68px;
    padding: 15px 17px;
    border-radius: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .drag-drop-game-screen .drag-drop-target {
    transition: none;
  }

  .drag-drop-game-screen .drag-drop-target.correct,
  .drag-drop-game-screen .drag-drop-target.wrong {
    animation: none;
  }
}


/* DRAG & DROP GAME — SNAP INTO PLACE */

.drag-drop-game-screen .drag-drop-piece.drag-drop-piece-sent {
  animation: dragDropSendHome .82s cubic-bezier(.22,.8,.3,1) forwards;
  pointer-events: none;
}

@keyframes dragDropSendHome {
  0% {
    transform: translate(0, 0) scale(1) rotate(0deg);
    opacity: 1;
  }

  45% {
    transform:
      translate(
        calc(var(--drag-drop-move-x) * .48),
        calc(var(--drag-drop-move-y) * .48 - 30px)
      )
      scale(.9)
      rotate(-2deg);
    opacity: 1;
  }

  100% {
    transform:
      translate(
        var(--drag-drop-move-x),
        var(--drag-drop-move-y)
      )
      scale(.3)
      rotate(3deg);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .drag-drop-game-screen .drag-drop-piece.drag-drop-piece-sent {
    animation: dragDropSendHomeReduced .35s ease forwards;
  }

  @keyframes dragDropSendHomeReduced {
    to {
      opacity: 0;
      transform: scale(.85);
    }
  }
}
