/* =========================================================
   READING PAC-MAN CSS
   Fully scoped to #readingPacmanGame
   Safe for ABZ header, topper, homepage, and other site sections
   ========================================================= */

@import url("https://fonts.googleapis.com/css2?family=Orbitron:wght@400;600;700;800;900&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Audiowide&display=swap");

/* =========================================================
   GAME SCOPE TOKENS
   ========================================================= */

#readingPacmanGame {
  --bg: #050507;
  --bg-2: #080b18;
  --maze: #0037ff;
  --maze-soft: rgba(0, 55, 255, 0.38);
  --maze-dark: #001a9e;
  --pacman: #ffed00;
  --pacman-dark: #d7b900;
  --pellet: #ffe9a5;
  --white: #f8fafc;
  --muted: #b9c0cc;
  --panel: #0b0f1d;
  --panel-2: #0e1224;
  --ghost-red: #ff3b3b;
  --ghost-pink: #ff5aa5;
  --ghost-cyan: #00e5ff;
  --ghost-orange: #ff9900;
  --ghost-green: #54f29c;
  --ghost-purple: #ff00ff;
  --radius: 22px;
  --shadow-heavy: 0 24px 70px rgba(0, 0, 0, 0.82);
  --shadow-glow-blue: 0 0 36px rgba(0, 55, 255, 0.42);
  --shadow-glow-yellow: 0 0 36px rgba(255, 237, 0, 0.42);

  width: 100%;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: #050507;
}

#readingPacmanGame,
#readingPacmanGame *,
#readingPacmanGame *::before,
#readingPacmanGame *::after {
  box-sizing: border-box;
}

#readingPacmanGame button,
#readingPacmanGame input,
#readingPacmanGame select,
#readingPacmanGame textarea {
  font: inherit;
}

#readingPacmanGame button {
  cursor: pointer;
}

#readingPacmanGame .hide,
#readingPacmanGame .hidden,
#readingPacmanGame .is-hidden {
  display: none !important;
}

/* =========================================================
   MAIN APP WRAPPER
   ========================================================= */

#readingPacmanGame .cp_app {
  width: 100%;
  min-height: 100vh;
  margin: 0;
  padding: clamp(28px, 5vw, 56px) clamp(16px, 4vw, 32px);
  display: flex;
  align-items: center;
  justify-content: center;

  color: var(--white);
  font-family: "Orbitron", "Audiowide", system-ui, sans-serif;
  background:
    radial-gradient(circle at 50% -10%, rgba(0, 55, 255, 0.28), transparent 34%),
    radial-gradient(circle at 13% 82%, rgba(255, 59, 59, 0.16), transparent 34%),
    radial-gradient(circle at 88% 80%, rgba(255, 237, 0, 0.14), transparent 38%),
    linear-gradient(180deg, #090d1f 0%, #050507 100%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Theme variables applied to game only */

#readingPacmanGame .cp_app.theme-classic {
  --bg: #050507;
  --bg-2: #080b18;
  --maze: #0037ff;
  --maze-dark: #001a9e;
  --pacman: #ffed00;
  --pellet: #ffe9a5;
  --panel: #0b0f1d;
}

#readingPacmanGame .cp_app.theme-neon {
  --bg: #050014;
  --bg-2: #120024;
  --maze: #00f5ff;
  --maze-dark: #7c3aed;
  --pacman: #ffff00;
  --pellet: #ff7af5;
  --panel: #100021;
}

#readingPacmanGame .cp_app.theme-candy {
  --bg: #160013;
  --bg-2: #2a0825;
  --maze: #ff8ad8;
  --maze-dark: #9d174d;
  --pacman: #ffe066;
  --pellet: #ffd1ec;
  --panel: #2a0825;
}

#readingPacmanGame .cp_app.theme-space {
  --bg: #020617;
  --bg-2: #0f172a;
  --maze: #8b5cf6;
  --maze-dark: #312e81;
  --pacman: #facc15;
  --pellet: #dbeafe;
  --panel: #0f172a;
}

/* =========================================================
   SCREEN BASE
   ========================================================= */

#readingPacmanGame .screen {
  width: 100%;
  max-width: 1240px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  position: relative;
  isolation: isolate;
  text-align: center;
}

#readingPacmanGame .screen::before {
  content: "";
  position: absolute;
  inset: -10vh -8vw;
  z-index: -2;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 237, 0, 0.14), transparent 38%),
    radial-gradient(circle at 0% 80%, rgba(0, 55, 255, 0.22), transparent 36%),
    radial-gradient(circle at 100% 78%, rgba(255, 90, 165, 0.13), transparent 34%);
  filter: blur(3px);
  pointer-events: none;
}

#readingPacmanGame .screen::after {
  content: "";
  position: absolute;
  inset: 4% auto auto 50%;
  width: min(920px, 92vw);
  height: min(640px, 80vh);
  transform: translateX(-50%);
  z-index: -1;
  border-radius: 44px;
  background:
    linear-gradient(90deg, rgba(0, 55, 255, 0.10) 1px, transparent 1px),
    linear-gradient(rgba(0, 55, 255, 0.10) 1px, transparent 1px);
  background-size: 46px 46px;
  opacity: 0.26;
  mask-image: radial-gradient(circle, #000 0%, transparent 72%);
  pointer-events: none;
}

/* =========================================================
   TITLES
   ========================================================= */

#readingPacmanGame .app-title {
  margin: 0 0 18px;
  text-align: center;
  line-height: 0.9;
  letter-spacing: 0.4px;
}

#readingPacmanGame .title-top {
  display: block;
  font-size: clamp(32px, 5vw, 60px);
  font-weight: 900;
  color: var(--white);
  text-shadow: 0 0 18px rgba(248, 250, 252, 0.26);
}

#readingPacmanGame .title-bottom {
  display: block;
  font-size: clamp(48px, 8vw, 92px);
  font-weight: 1000;
  color: var(--pacman);
  text-shadow:
    0 7px 0 #000,
    0 0 28px rgba(255, 237, 0, 0.58),
    0 0 60px rgba(255, 237, 0, 0.25);
}

#readingPacmanGame .screen-title,
#readingPacmanGame .screen h1,
#readingPacmanGame .screen h2 {
  margin: 0;
  color: #ffffff !important;
  font-family: "Orbitron", "Audiowide", system-ui, sans-serif;
  font-size: clamp(2rem, 4.5vw, 4rem);
  font-weight: 1000;
  line-height: 1;
  letter-spacing: -0.045em;
  text-shadow:
    0 4px 0 #000,
    0 0 24px rgba(255, 237, 0, 0.30);
}

#readingPacmanGame .screen-title {
  margin-bottom: 10px;
}

/* =========================================================
   BUTTONS
   ========================================================= */

#readingPacmanGame .btn {
  appearance: none;
  border: 0;
  min-height: 58px;
  padding: 16px 26px;
  border-radius: 999px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;

  color: #18120a;
  background:
    radial-gradient(circle at 25% 0%, rgba(255, 255, 255, 0.58), transparent 36%),
    linear-gradient(180deg, #fff875, var(--pacman) 52%, var(--pacman-dark));
  font-family: "Orbitron", system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 1000;
  letter-spacing: 0.04em;

  box-shadow:
    0 9px 0 #000,
    0 0 28px rgba(255, 237, 0, 0.42),
    0 18px 44px rgba(0, 0, 0, 0.55);
  transition:
    transform 0.12s ease,
    box-shadow 0.18s ease,
    filter 0.18s ease;
}

#readingPacmanGame .btn:hover {
  transform: translateY(-2px);
  filter: saturate(1.08);
  box-shadow:
    0 11px 0 #000,
    0 0 36px rgba(255, 237, 0, 0.58),
    0 22px 52px rgba(0, 0, 0, 0.62);
}

#readingPacmanGame .btn:active {
  transform: translateY(1px);
}

#readingPacmanGame .secondary-btn {
  color: #ffffff !important;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.06)) !important;
  border: 2px solid rgba(255, 255, 255, 0.20) !important;
  box-shadow:
    0 8px 0 #000,
    0 0 22px rgba(255, 255, 255, 0.08) !important;
}

#readingPacmanGame .start-btn {
  width: min(520px, 90vw);
  min-height: 70px;
  font-size: clamp(20px, 3vw, 30px);
}

/* =========================================================
   START SCREEN
   ========================================================= */

#readingPacmanGame #start-screen {
  padding: 36px 0 44px;
}

#readingPacmanGame .cover,
#readingPacmanGame #start-screen .cover {
  width: min(670px, 94vw);
  max-width: 100%;
  border-radius: 30px;
  border: 4px solid var(--maze);
  outline: 10px solid var(--maze-dark);
  object-fit: cover;
  margin-bottom: 20px;
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.08) inset,
    0 22px 0 rgba(0, 0, 0, 0.88),
    0 34px 78px rgba(0, 0, 0, 0.92),
    0 0 48px rgba(0, 55, 255, 0.42),
    0 0 32px rgba(255, 237, 0, 0.24);
}

/* =========================================================
   PLAYER / USERNAME / AVATAR SETUP
   ========================================================= */

#readingPacmanGame .pac-player-card {
  position: relative;
  overflow: hidden;
  width: min(900px, 94vw);
  padding: clamp(28px, 4vw, 52px);
  border-radius: 36px;
  border: 3px solid rgba(0, 55, 255, 0.88);
  background:
    radial-gradient(circle at 16% 0%, rgba(255, 237, 0, 0.18), transparent 34%),
    radial-gradient(circle at 92% 18%, rgba(0, 255, 255, 0.14), transparent 34%),
    linear-gradient(135deg, rgba(12, 16, 34, 0.96), rgba(4, 5, 12, 0.98));
  box-shadow:
    0 0 0 8px rgba(0, 0, 0, 0.76) inset,
    var(--shadow-heavy),
    var(--shadow-glow-blue);
}

#readingPacmanGame .pac-player-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 237, 0, 0.16) 0 8px, transparent 8px 28px),
    linear-gradient(rgba(0, 55, 255, 0.12) 1px, transparent 1px);
  background-size: 36px 100%, 100% 34px;
  opacity: 0.08;
  pointer-events: none;
}

#readingPacmanGame .pac-setup-step {
  display: none;
}

#readingPacmanGame .pac-setup-step.active {
  display: block;
}

#readingPacmanGame .pac-setup-note {
  color: #b8c7e4;
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  font-weight: 850;
  line-height: 1.55;
  max-width: 640px;
  margin: 0 auto 18px;
}

#readingPacmanGame .pac-name-input,
#readingPacmanGame input[type="text"],
#readingPacmanGame input[type="search"],
#readingPacmanGame input[type="email"],
#readingPacmanGame input[type="password"] {
  width: min(620px, 94%);
  min-height: 64px;
  border-radius: 999px;
  border: 3px solid var(--pacman);
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 237, 0, 0.10), transparent 34%),
    #050507;
  color: #ffffff;
  padding: 0 24px;
  font-family: "Orbitron", system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 900;
  text-align: center;
  outline: none;
  box-shadow:
    0 0 0 6px rgba(255, 237, 0, 0.08),
    0 0 32px rgba(255, 237, 0, 0.24);
}

#readingPacmanGame input::placeholder {
  color: rgba(255, 255, 255, 0.54);
}

#readingPacmanGame input:focus {
  border-color: var(--ghost-cyan);
  box-shadow:
    0 0 0 6px rgba(0, 255, 255, 0.10),
    0 0 34px rgba(0, 255, 255, 0.34);
}

#readingPacmanGame .pac-student-account-link,
#readingPacmanGame .text-link,
#readingPacmanGame a {
  color: #7dd3fc;
  font-weight: 1000;
  text-underline-offset: 4px;
}

#readingPacmanGame .pac-setup-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 24px;
}

/* Avatar grid */

#readingPacmanGame .pac-avatar-grid {
  width: min(780px, 100%);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 16px;
  margin: 24px auto 0;
}

#readingPacmanGame .pac-avatar-btn {
  position: relative;
  overflow: hidden;
  min-height: 128px;
  border-radius: 26px;
  border: 2px solid rgba(0, 55, 255, 0.72);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 237, 0, 0.12), transparent 38%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0.04));
  display: grid;
  place-items: center;
  box-shadow:
    0 12px 26px rgba(0, 0, 0, 0.42),
    0 0 22px rgba(0, 55, 255, 0.22);
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    border-color 0.16s ease;
}

#readingPacmanGame .pac-avatar-btn:hover,
#readingPacmanGame .pac-avatar-btn.selected {
  transform: translateY(-4px) scale(1.02);
  border-color: var(--pacman);
  box-shadow:
    0 18px 38px rgba(0, 0, 0, 0.52),
    0 0 34px rgba(255, 237, 0, 0.36);
}

#readingPacmanGame .pac-avatar-btn img {
  width: 82px;
  height: 82px;
  object-fit: contain;
  border-radius: 18px;
}

#readingPacmanGame .pac-avatar-fallback {
  font-size: 3rem;
}

/* =========================================================
   THEME SCREEN
   Fixes dark text issue + modern card design
   ========================================================= */

#readingPacmanGame #theme-screen {
  padding: 36px 0 46px;
}

#readingPacmanGame #theme-screen,
#readingPacmanGame #theme-screen * {
  color: #ffffff;
}

#readingPacmanGame .theme-grid {
  width: min(1120px, 96vw);
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 22px;
  margin-top: 18px;
}

#readingPacmanGame .theme-pill {
  min-height: 230px;
  padding: 28px;
  border-radius: 32px;
  border: 3px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 0 0 7px rgba(0, 0, 0, 0.64) inset,
    0 22px 52px rgba(0, 0, 0, 0.68);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease;
}

#readingPacmanGame .theme-pill::before {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 24px;
  border: 2px dashed rgba(255, 255, 255, 0.18);
  pointer-events: none;
}

#readingPacmanGame .theme-pill::after {
  content: "● ● ●";
  position: absolute;
  right: 24px;
  bottom: 20px;
  color: rgba(255, 255, 255, 0.65);
  letter-spacing: 0.35em;
}

#readingPacmanGame .theme-pill:hover {
  transform: translateY(-5px) scale(1.01);
}

#readingPacmanGame .theme-pill strong,
#readingPacmanGame .theme-pill .pill-title {
  position: relative;
  z-index: 2;
  color: #ffffff !important;
  font-size: clamp(1.4rem, 2.4vw, 2rem);
  font-weight: 1000;
  text-shadow: 0 4px 0 #000, 0 0 18px rgba(255, 255, 255, 0.20);
}

#readingPacmanGame .theme-pill span,
#readingPacmanGame .theme-pill p,
#readingPacmanGame .theme-pill .pill-sub {
  position: relative;
  z-index: 2;
  color: rgba(255, 255, 255, 0.86) !important;
  font-weight: 850;
  line-height: 1.45;
}

#readingPacmanGame .theme-classic {
  background:
    radial-gradient(circle at 16% 0%, rgba(255, 237, 0, 0.32), transparent 38%),
    linear-gradient(135deg, #001a9e, #050507 62%);
  border-color: #2b7fff;
}

#readingPacmanGame .theme-neon {
  background:
    radial-gradient(circle at 16% 0%, rgba(0, 245, 255, 0.32), transparent 36%),
    radial-gradient(circle at 90% 10%, rgba(255, 0, 255, 0.28), transparent 38%),
    linear-gradient(135deg, #050014, #080014 62%);
  border-color: #00f5ff;
  box-shadow:
    0 0 0 7px rgba(0, 0, 0, 0.64) inset,
    0 22px 52px rgba(0, 0, 0, 0.68),
    0 0 34px rgba(0, 245, 255, 0.26);
}

#readingPacmanGame .theme-candy {
  background:
    radial-gradient(circle at 16% 0%, rgba(255, 138, 216, 0.40), transparent 38%),
    linear-gradient(135deg, #9d174d, #160013 62%);
  border-color: #ff8ad8;
}

#readingPacmanGame .theme-space {
  background:
    radial-gradient(circle at 16% 0%, rgba(139, 92, 246, 0.38), transparent 38%),
    radial-gradient(circle at 88% 10%, rgba(219, 234, 254, 0.18), transparent 34%),
    linear-gradient(135deg, #312e81, #020617 62%);
  border-color: #8b5cf6;
}

/* =========================================================
   MODE / CHARACTER SCREEN
   Fixes dark font issue
   ========================================================= */

#readingPacmanGame #mode-screen {
  padding: 36px 0 48px;
}

#readingPacmanGame #mode-screen,
#readingPacmanGame #mode-screen * {
  color: #ffffff;
}

#readingPacmanGame .mode-search-wrap {
  width: min(900px, 94vw);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0 auto 22px;
}

#readingPacmanGame .mode-search {
  flex: 1 1 440px;
  min-height: 58px;
  border-radius: 999px;
  border: 3px solid rgba(0, 245, 255, 0.72);
  background:
    radial-gradient(circle at 10% 0%, rgba(255, 255, 255, 0.12), transparent 50%),
    rgba(3, 7, 18, 0.92);
  color: #ffffff;
  padding: 0 24px;
  font-family: "Orbitron", system-ui, sans-serif;
  font-weight: 900;
  font-size: 0.95rem;
  text-align: left;
  outline: none;
  box-shadow:
    0 0 24px rgba(0, 245, 255, 0.25),
    0 8px 0 rgba(0, 0, 0, 0.75);
}

#readingPacmanGame .mode-search-clear {
  min-height: 58px;
  border: 0;
  border-radius: 999px;
  padding: 0 22px;
  font-weight: 1000;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.75);
}

#readingPacmanGame .mode-search-results {
  flex-basis: 100%;
  margin: 0;
  min-height: 18px;
  color: #cfe6ff;
  font-size: 0.78rem;
  text-align: center;
  font-weight: 800;
}

#readingPacmanGame .mode-showdown {
  width: min(1240px, 96vw);
  display: grid;
  grid-template-columns: repeat(2, minmax(320px, 1fr));
  gap: 26px;
  margin-top: 8px;
}

#readingPacmanGame .mode-pill {
  position: relative;
  min-height: 480px;
  padding: 24px;
  text-align: left;
  align-items: flex-start;
  border-radius: 32px;
  border: 3px solid rgba(255, 255, 255, 0.12);
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 255, 255, 0.08), transparent 56%),
    radial-gradient(circle at 100% 100%, rgba(0, 0, 0, 0.94), #050507 70%);
  box-shadow:
    0 0 0 7px rgba(0, 0, 0, 0.78) inset,
    0 22px 50px rgba(0, 0, 0, 0.78);
  overflow: hidden;
  transition:
    transform 0.16s ease,
    box-shadow 0.18s ease,
    filter 0.18s ease;
}

#readingPacmanGame .mode-pill:hover {
  transform: translateY(-5px) scale(1.01);
  filter: saturate(1.08);
}

#readingPacmanGame .mode-pill .pill-title {
  color: #ffffff !important;
  font-size: clamp(1.25rem, 2vw, 1.8rem);
  font-weight: 1000;
  line-height: 1.15;
  margin: 12px 0 6px;
  text-shadow: 0 4px 0 #000, 0 0 18px rgba(255, 255, 255, 0.20);
}

#readingPacmanGame .mode-pill .pill-sub,
#readingPacmanGame .mode-stat {
  color: #e8ecff !important;
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.5;
}

#readingPacmanGame .mode-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #eef5ff !important;
}

#readingPacmanGame .mode-visual,
#readingPacmanGame .neon-preview,
#readingPacmanGame .dumpling-preview {
  position: relative;
  width: 100%;
  min-height: 200px;
  margin: 20px 0 18px;
  border-radius: 24px;
  overflow: hidden;
  background: #03040b;
  display: grid;
  place-items: center;
  box-shadow:
    inset 0 0 0 4px rgba(0, 0, 0, 0.82),
    0 14px 30px rgba(0, 0, 0, 0.50);
}

#readingPacmanGame .mode-visual-svg {
  padding: 0;
}

#readingPacmanGame .mini-maze-svg {
  width: 100%;
  height: 100%;
  display: block;
}

#readingPacmanGame .mode-diff-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

#readingPacmanGame .mode-diff-list span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 11px;
  border-radius: 999px;
  font-size: 0.72rem;
  color: #eef5ff !important;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.10);
  font-weight: 900;
}

#readingPacmanGame .mode-pill-pacman {
  border-color: #2b7fff;
  box-shadow:
    0 0 0 7px rgba(0, 0, 0, 0.78) inset,
    0 0 30px rgba(43, 127, 255, 0.30),
    0 22px 50px rgba(0, 0, 0, 0.78);
}

#readingPacmanGame .mode-pill-mspacman {
  border-color: #ff5aa5;
  box-shadow:
    0 0 0 7px rgba(0, 0, 0, 0.78) inset,
    0 0 30px rgba(255, 90, 165, 0.30),
    0 22px 50px rgba(0, 0, 0, 0.78);
}

#readingPacmanGame .mode-pill-cat {
  border-color: #7ee787;
}

#readingPacmanGame .mode-pill-dog {
  border-color: #ffb357;
}

#readingPacmanGame .mode-pill-neon {
  border-color: #00f5ff;
  background:
    radial-gradient(circle at 10% 0%, rgba(0, 245, 255, 0.22), transparent 45%),
    radial-gradient(circle at 90% 12%, rgba(255, 0, 255, 0.20), transparent 44%),
    radial-gradient(circle at 50% 100%, rgba(57, 255, 20, 0.14), transparent 58%),
    #040014;
}

#readingPacmanGame .mode-pill.is-hidden-by-search {
  display: none !important;
}

/* SVG colors */

#readingPacmanGame .pacmaze-svg .maze-stroke {
  stroke: #38b6ff;
}

#readingPacmanGame .mspacmaze-svg .maze-stroke {
  stroke: #ff6bb4;
}

#readingPacmanGame .catmaze-svg .maze-stroke {
  stroke: #7ee787;
}

#readingPacmanGame .dogmaze-svg .maze-stroke {
  stroke: #ffb357;
}

#readingPacmanGame .mini-maze-svg .maze-stroke {
  stroke-width: 10;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 6px currentColor);
}

#readingPacmanGame .mini-maze-svg .pellet {
  fill: #fff2ad;
  filter: drop-shadow(0 0 4px rgba(255, 237, 0, 0.40));
}

#readingPacmanGame .mini-maze-svg .pac-body {
  fill: var(--pacman);
  filter: drop-shadow(0 0 8px rgba(255, 237, 0, 0.36));
}

#readingPacmanGame .mini-maze-svg .pac-mouth-cut,
#readingPacmanGame .mini-maze-svg .pac-mouth-cut-pink {
  fill: #05060f;
}

#readingPacmanGame .mini-maze-svg .ghost-red {
  color: #ff3b3b;
}

#readingPacmanGame .mini-maze-svg .ghost-cyan {
  color: #00e5ff;
}

#readingPacmanGame .mini-maze-svg .ghost-pink {
  color: #ff7fc2;
}

#readingPacmanGame .mini-maze-svg .ghost-orange {
  color: #ff9900;
}

/* =========================================================
   DIFFICULTY SCREEN
   Complete redesign
   ========================================================= */

#readingPacmanGame #difficulty-screen {
  padding: 38px 0 50px;
}

#readingPacmanGame #difficulty-screen::after {
  width: min(1100px, 96vw);
  height: min(720px, 82vh);
}

#readingPacmanGame #difficulty-screen .screen-title,
#readingPacmanGame #difficulty-screen h1,
#readingPacmanGame #difficulty-screen h2 {
  margin-bottom: 12px;
  color: #ffffff !important;
  font-size: clamp(2.2rem, 4.2vw, 4.4rem);
  text-shadow:
    0 5px 0 #000,
    0 0 28px rgba(255, 237, 0, 0.40);
}

#readingPacmanGame #difficulty-screen .pill-row {
  width: min(1180px, 96vw);
  display: grid;
  grid-template-columns: repeat(4, minmax(190px, 1fr));
  gap: 22px;
  margin: 18px auto 0;
}

#readingPacmanGame #difficulty-screen .difficulty-bottom-row {
  width: min(780px, 96vw);
  grid-template-columns: 1fr;
  margin-top: 22px;
}

#readingPacmanGame #difficulty-screen .pill {
  min-height: 190px;
  padding: 24px;
  border-radius: 34px;
  border: 3px solid rgba(255, 255, 255, 0.12);
  position: relative;
  overflow: hidden;

  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;

  color: #ffffff !important;
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 255, 255, 0.08), transparent 55%),
    radial-gradient(circle at 100% 100%, rgba(0, 0, 0, 0.94), #050507 70%);
  box-shadow:
    0 0 0 8px rgba(0, 0, 0, 0.78) inset,
    0 24px 54px rgba(0, 0, 0, 0.76);
  transition:
    transform 0.16s ease,
    box-shadow 0.18s ease,
    filter 0.18s ease;
}

#readingPacmanGame #difficulty-screen .pill::before {
  content: "";
  position: absolute;
  top: 22px;
  right: 22px;
  width: 54px;
  height: 54px;
  border-radius: 999px;
  background: var(--difficulty-glow, var(--pacman));
  opacity: 0.16;
  box-shadow: 0 0 34px var(--difficulty-glow, var(--pacman));
}

#readingPacmanGame #difficulty-screen .pill::after {
  content: "";
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 22px;
  height: 10px;
  border-radius: 999px;
  background:
    linear-gradient(
      90deg,
      var(--difficulty-glow, var(--pacman)) 0%,
      var(--difficulty-glow, var(--pacman)) var(--difficulty-fill, 40%),
      rgba(255, 255, 255, 0.08) var(--difficulty-fill, 40%),
      rgba(255, 255, 255, 0.05) 100%
    );
  box-shadow:
    inset 0 0 0 2px rgba(0, 0, 0, 0.78),
    0 0 18px var(--difficulty-glow, var(--pacman));
}

#readingPacmanGame #difficulty-screen .pill:hover {
  transform: translateY(-6px) scale(1.02);
  filter: saturate(1.08);
}

#readingPacmanGame #difficulty-screen .pill-title {
  color: #ffffff !important;
  font-size: clamp(1.25rem, 2vw, 1.7rem);
  font-weight: 1000;
  margin-bottom: 8px;
  text-shadow: 0 4px 0 #000;
}

#readingPacmanGame #difficulty-screen .pill-sub {
  color: rgba(255, 255, 255, 0.84) !important;
  font-size: 0.94rem;
  font-weight: 900;
  line-height: 1.35;
}

#readingPacmanGame #difficulty-easy {
  --difficulty-glow: #54f29c;
  --difficulty-fill: 25%;
  border-color: #54f29c;
  background:
    radial-gradient(circle at 18% 0%, rgba(84, 242, 156, 0.26), transparent 54%),
    linear-gradient(135deg, rgba(6, 78, 59, 0.72), #050507 70%);
}

#readingPacmanGame #difficulty-medium {
  --difficulty-glow: #00e5ff;
  --difficulty-fill: 50%;
  border-color: #00e5ff;
  background:
    radial-gradient(circle at 18% 0%, rgba(0, 229, 255, 0.28), transparent 54%),
    linear-gradient(135deg, rgba(8, 47, 73, 0.76), #050507 70%);
}

#readingPacmanGame #difficulty-hard {
  --difficulty-glow: #ff3b3b;
  --difficulty-fill: 72%;
  border-color: #ff3b3b;
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 59, 59, 0.30), transparent 54%),
    linear-gradient(135deg, rgba(127, 29, 29, 0.76), #050507 70%);
}

#readingPacmanGame #difficulty-extreme {
  --difficulty-glow: #ff00ff;
  --difficulty-fill: 100%;
  border-color: #ff00ff;
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 0, 255, 0.34), transparent 54%),
    linear-gradient(135deg, rgba(88, 28, 135, 0.78), #050507 70%);
  animation: readingPacmanExtremeGlow 1.6s ease-in-out infinite alternate;
}

#readingPacmanGame #difficulty-unbeatable {
  --difficulty-glow: #facc15;
  --difficulty-fill: 100%;
  min-height: 210px;
  border-color: #f4e7a1;
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 255, 255, 0.20), transparent 46%),
    linear-gradient(135deg, rgba(250, 204, 21, 0.18), rgba(255, 0, 153, 0.12) 44%, rgba(0, 229, 255, 0.10) 70%, #050507 100%);
}

#readingPacmanGame .difficulty-overline {
  color: #f7f0ca !important;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin-bottom: 10px;
  font-weight: 1000;
}

#readingPacmanGame .difficulty-note {
  margin-top: 10px;
  display: block;
  max-width: 32ch;
  font-size: 0.78rem;
  line-height: 1.45;
  color: #f7f0ca !important;
  opacity: 0.96;
  font-weight: 850;
}

@keyframes readingPacmanExtremeGlow {
  from {
    box-shadow:
      0 0 0 8px rgba(0, 0, 0, 0.78) inset,
      0 0 28px rgba(255, 0, 255, 0.42),
      0 24px 54px rgba(0, 0, 0, 0.76);
  }

  to {
    box-shadow:
      0 0 0 8px rgba(0, 0, 0, 0.78) inset,
      0 0 48px rgba(255, 0, 255, 0.72),
      0 28px 64px rgba(0, 0, 0, 0.86);
  }
}

/* =========================================================
   CONTROL SCREEN
   Complete redesign
   ========================================================= */

#readingPacmanGame #control-screen {
  padding: 38px 0 48px;
}

#readingPacmanGame #control-screen .screen-title,
#readingPacmanGame #control-screen h1,
#readingPacmanGame #control-screen h2 {
  margin-bottom: 18px;
  color: #ffffff !important;
  font-size: clamp(2.2rem, 4.2vw, 4.2rem);
  text-shadow:
    0 5px 0 #000,
    0 0 28px rgba(255, 237, 0, 0.38);
}

#readingPacmanGame #control-screen .pill-row {
  width: min(780px, 94vw);
  display: grid;
  grid-template-columns: repeat(2, minmax(230px, 1fr));
  gap: 22px;
  margin: 0 auto;
}

#readingPacmanGame #control-screen .pill {
  min-height: 210px;
  padding: 28px;
  border-radius: 36px;
  position: relative;
  overflow: hidden;

  display: grid;
  place-items: center;
  text-align: center;

  color: #111827 !important;
  background:
    radial-gradient(circle at 28% 0%, rgba(255, 255, 255, 0.74), transparent 36%),
    linear-gradient(180deg, #fff875, var(--pacman) 56%, #d8bb00);
  border: 3px solid rgba(255, 255, 255, 0.34);
  box-shadow:
    0 12px 0 #000,
    0 0 34px rgba(255, 237, 0, 0.46),
    0 24px 56px rgba(0, 0, 0, 0.70);
  transition:
    transform 0.16s ease,
    box-shadow 0.18s ease,
    filter 0.18s ease;
}

#readingPacmanGame #control-screen .pill::before {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 28px;
  border: 3px solid rgba(0, 0, 0, 0.38);
  pointer-events: none;
}

#readingPacmanGame #control-screen .pill::after {
  content: "";
  position: absolute;
  left: 32px;
  right: 32px;
  bottom: 28px;
  height: 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.82);
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.44) inset,
    0 0 18px rgba(0, 0, 0, 0.18);
}

#readingPacmanGame #control-screen .pill:hover {
  transform: translateY(-6px) scale(1.02);
  filter: saturate(1.08);
  box-shadow:
    0 14px 0 #000,
    0 0 44px rgba(255, 237, 0, 0.62),
    0 28px 66px rgba(0, 0, 0, 0.78);
}

#readingPacmanGame #control-screen .pill-title {
  color: #111827 !important;
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  font-weight: 1000;
  text-shadow: none;
}

#readingPacmanGame #control-screen .pill-sub {
  color: rgba(17, 24, 39, 0.82) !important;
  font-size: 0.95rem;
  font-weight: 1000;
  margin-top: 6px;
}

#readingPacmanGame #control-screen .hint,
#readingPacmanGame #control-screen p {
  color: rgba(255, 255, 255, 0.84) !important;
  font-weight: 800;
  margin-top: 18px;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.12);
}

/* =========================================================
   SKILL SELECT SCREEN
   ========================================================= */

#readingPacmanGame #select-screen {
  padding: 36px 0 48px;
}

#readingPacmanGame .skill-search {
  width: min(980px, 94vw);
  margin: 6px 0 14px;
}

#readingPacmanGame .skill-search-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background:
    linear-gradient(180deg, #0e1224, #0b0f1d);
  border: 3px solid var(--maze);
  box-shadow:
    0 0 0 6px var(--maze-dark) inset,
    0 10px 24px rgba(0, 55, 255, 0.18);
  border-radius: 18px;
  padding: 9px;
}

#readingPacmanGame #skillFilter {
  flex: 1;
  background: transparent;
  border: 0;
  color: #eaf2ff;
  font-size: 0.95rem;
  outline: none;
  padding: 10px 12px;
  box-shadow: none;
  min-height: 44px;
  text-align: left;
}

#readingPacmanGame #skillClear {
  appearance: none;
  border: 0;
  background: #1b2340;
  color: #eaf2ff;
  font-weight: 1000;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 0 0 4px var(--maze-dark) inset;
}

#readingPacmanGame .skill-results {
  margin-top: 8px;
  font-size: 0.78rem;
  color: #cfe6ff;
  opacity: 0.95;
  font-weight: 800;
}

#readingPacmanGame .select-wrap {
  width: min(1120px, 96vw);
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 10px;
}

#readingPacmanGame .skill-card {
  position: relative;
  width: 100%;
  border-radius: 30px;
  padding: 24px;
  border: 3px solid rgba(0, 55, 255, 0.78);
  background:
    radial-gradient(circle at 0% 0%, rgba(0, 255, 255, 0.14), transparent 35%),
    radial-gradient(circle at 100% 100%, rgba(255, 237, 0, 0.12), transparent 36%),
    linear-gradient(135deg, rgba(10, 14, 30, 0.96), rgba(2, 4, 12, 0.98));
  box-shadow:
    0 0 0 7px rgba(0, 0, 0, 0.74) inset,
    0 22px 54px rgba(0, 0, 0, 0.68),
    0 0 34px rgba(0, 55, 255, 0.28);
  overflow: hidden;
  transition:
    transform 0.14s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease;
}

#readingPacmanGame .skill-card:hover {
  transform: translateY(-4px);
  border-color: var(--pacman);
  box-shadow:
    0 0 0 7px rgba(0, 0, 0, 0.74) inset,
    0 26px 62px rgba(0, 0, 0, 0.78),
    0 0 42px rgba(255, 237, 0, 0.34);
}

#readingPacmanGame .skill-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  position: relative;
  z-index: 2;
  text-align: left;
}

#readingPacmanGame .skill-icon {
  width: 60px;
  height: 60px;
  display: grid;
  place-items: center;
  font-size: 1.45rem;
  background:
    radial-gradient(circle at 30% 0%, rgba(255, 255, 255, 0.22), transparent 70%),
    radial-gradient(circle at 70% 100%, rgba(0, 55, 255, 0.40), rgba(0, 55, 255, 0.16));
  border-radius: 18px;
  border: 2px solid rgba(0, 55, 255, 0.90);
  box-shadow:
    0 0 18px rgba(0, 55, 255, 0.55),
    0 0 0 4px rgba(0, 0, 0, 0.85) inset;
}

#readingPacmanGame .skill-title {
  margin: 0;
  color: #ffffff !important;
  font-size: clamp(1.25rem, 2.4vw, 2rem);
  font-weight: 1000;
  letter-spacing: -0.02em;
}

#readingPacmanGame .skill-sub {
  margin: 0.35rem 0 0;
  color: #cfe6ff !important;
  font-size: 0.9rem;
  line-height: 1.45;
  font-weight: 800;
}

#readingPacmanGame .skill-meta-row {
  margin-top: 10px;
  color: #9fb3ff !important;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 900;
}

#readingPacmanGame .grade-grid {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 12px;
  margin-top: 18px;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

#readingPacmanGame .grade-btn {
  min-height: 66px;
  width: 100%;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.26);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  text-align: left;
  color: #171102 !important;
  background:
    radial-gradient(circle at 20% 0%, #fff9b8, transparent 40%),
    linear-gradient(180deg, var(--pacman), #e7ca00);
  box-shadow:
    0 7px 0 #000,
    0 0 18px rgba(255, 237, 0, 0.40);
  font-weight: 1000;
  transition:
    transform 0.12s ease,
    box-shadow 0.18s ease,
    filter 0.18s ease;
}

#readingPacmanGame .grade-btn:hover {
  transform: translateY(-3px) scale(1.03);
  filter: saturate(1.08);
  box-shadow:
    0 9px 0 #000,
    0 0 28px rgba(255, 237, 0, 0.56);
}

#readingPacmanGame .grade-btn strong {
  font-size: 0.92rem;
}

#readingPacmanGame .grade-btn span {
  font-size: 0.72rem;
  opacity: 0.86;
  margin-top: 4px;
}

/* =========================================================
   QUESTION / CHALLENGE SCREEN
   Kept close to original. Not a full redesign.
   ========================================================= */

#readingPacmanGame #question-screen {
  width: 100%;
  max-width: 1200px;
  padding: 18px 0 22px;
  position: relative;
  isolation: isolate;
  display: none;
  align-items: center;
  gap: 16px;
}

#readingPacmanGame .question-panel {
  position: relative;
  width: min(980px, 94vw);
  padding: 24px;
  border-radius: 26px;
  background:
    radial-gradient(circle at 0% 0%, rgba(0, 55, 255, 0.30), transparent 60%),
    radial-gradient(circle at 100% 100%, rgba(0, 0, 0, 0.96), #05060f 70%);
  border: 3px solid rgba(0, 55, 255, 0.95);
  box-shadow:
    0 0 0 9px rgba(0, 0, 0, 0.92) inset,
    0 26px 52px rgba(0, 0, 0, 0.95),
    0 0 38px rgba(0, 55, 255, 0.45);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

/* Question text */

#readingPacmanGame .prompt {
  width: 100%;
  margin-top: 4px;
  color: #ffffff;
  white-space: pre-line;
  text-align: center;
  font-size: clamp(20px, 3.6vw, 32px);
  font-weight: 900;
}

#readingPacmanGame .question-text {
  width: 100%;
  color: #eaf2ff;
  text-align: center;
  font-size: clamp(18px, 3.2vw, 26px);
  font-weight: 850;
  line-height: 1.45;
}

/* Choices */

#readingPacmanGame .choices {
  width: 100%;
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  place-items: center;
}

#readingPacmanGame .choices button {
  width: 100%;
  max-width: 900px;
  padding: 16px 18px;
  border: 3px solid var(--maze);
  border-radius: 999px;
  background:
    radial-gradient(circle at 0% 0%, #0e1733, #050816 75%);
  color: #ffffff;
  font-weight: 900;
  font-size: clamp(15px, 2.8vw, 21px);
  box-shadow:
    0 0 0 8px var(--maze-dark) inset,
    0 7px 0 #000,
    0 12px 26px rgba(0, 55, 255, 0.28);
  transition:
    transform 0.08s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease,
    background 0.2s ease;
}

#readingPacmanGame .choices button:hover,
#readingPacmanGame .choices button:focus-visible {
  border-color: var(--pacman);
  box-shadow:
    0 0 0 8px var(--maze-dark) inset,
    0 9px 0 #000,
    0 0 30px rgba(255, 237, 0, 0.42);
  transform: translateY(-1px);
}

#readingPacmanGame .choices button.correct {
  border-color: var(--pacman);
}

#readingPacmanGame .choices button.wrong {
  border-color: var(--ghost-red);
}

/* Progress */

#readingPacmanGame .progress-bar {
  width: 100%;
  height: 16px;
  border-radius: 999px;
  background: linear-gradient(180deg, #0e1224, #0b0f1d);
  border: 3px solid var(--maze);
  box-shadow:
    inset 0 0 0 6px var(--maze-dark),
    0 0 18px rgba(0, 55, 255, 0.16);
  display: grid;
  grid-auto-flow: column;
  gap: 4px;
  padding: 3px 6px;
  margin: 12px auto 4px;
}

#readingPacmanGame .progress-bar .segment {
  border-radius: 999px;
  background: radial-gradient(circle at 50% 50%, #1b223a 0%, #12192e 60%);
}

#readingPacmanGame .progress-bar .segment.filled {
  background: radial-gradient(circle at 50% 50%, var(--pellet) 0%, var(--pacman) 70%);
  box-shadow:
    0 0 10px rgba(255, 237, 0, 0.55),
    0 0 20px rgba(255, 237, 0, 0.28);
}

/* =========================================================
   GAME CANVAS / HUD
   ========================================================= */

#readingPacmanGame #game {
  max-width: 95vw;
  max-height: 85vh;
  border: 10px solid var(--maze);
  border-radius: 10px;
  background: #000000;
  touch-action: none;
  box-shadow:
    0 0 0 8px var(--maze-dark) inset,
    0 16px 40px rgba(0, 0, 0, 0.60);
}

#readingPacmanGame canvas {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

#readingPacmanGame .hud {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

#readingPacmanGame .hud-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 3px solid var(--maze);
  background: linear-gradient(180deg, #0b1130, #050816);
  box-shadow:
    0 0 0 5px var(--maze-dark) inset,
    0 10px 22px rgba(0, 0, 0, 0.45);
  color: #ffffff;
  font-size: 0.82rem;
  line-height: 1;
  font-weight: 900;
}

#readingPacmanGame .hint,
#readingPacmanGame #game-hint {
  color: #e7ecf7;
  opacity: 0.92;
  font-size: 0.78rem;
  text-align: center;
  line-height: 1.6;
  max-width: min(980px, 92vw);
}

/* =========================================================
   MODALS / FINAL POPUP / LEADERBOARD
   ========================================================= */

#readingPacmanGame .overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.72);
  pointer-events: none;
}

#readingPacmanGame .overlay.show {
  display: flex;
  pointer-events: auto;
  animation: readingPacmanFadeIn 0.15s ease-out;
}

@keyframes readingPacmanFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

#readingPacmanGame .modal {
  width: min(92vw, 560px);
  padding: 30px 36px;
  border-radius: 24px;
  border: 3px solid var(--maze);
  text-align: center;
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 237, 0, 0.12), transparent 38%),
    linear-gradient(#060810, #070a14);
  box-shadow:
    0 0 0 8px var(--maze-dark) inset,
    0 0 28px rgba(255, 237, 0, 0.25),
    0 24px 70px rgba(0, 0, 0, 0.76);
}

#readingPacmanGame .modal h2 {
  color: var(--pacman) !important;
  margin: 6px 0 10px;
  font-weight: 1000;
}

#readingPacmanGame .pac-final-modal,
#readingPacmanGame .final-card,
#readingPacmanGame .results-card {
  width: min(980px, 94vw) !important;
  max-height: min(90vh, 900px);
  overflow-y: auto;
  border-radius: 34px !important;
  border: 3px solid rgba(0, 55, 255, 0.75) !important;
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 237, 0, 0.14), transparent 34%),
    radial-gradient(circle at 90% 20%, rgba(0, 255, 255, 0.12), transparent 34%),
    linear-gradient(135deg, rgba(12, 16, 34, 0.96), rgba(5, 5, 7, 0.98)) !important;
  box-shadow:
    0 0 0 8px rgba(0, 0, 0, 0.72) inset,
    0 26px 70px rgba(0, 0, 0, 0.78),
    0 0 42px rgba(0, 55, 255, 0.34) !important;
}

#readingPacmanGame .pac-final-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
  margin: 18px 0;
}

#readingPacmanGame .pac-final-stat,
#readingPacmanGame .stat-card {
  border-radius: 22px;
  padding: 14px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 237, 0, 0.12), transparent 38%),
    rgba(255, 255, 255, 0.075);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

#readingPacmanGame .pac-final-stat span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

#readingPacmanGame .pac-final-stat strong {
  display: block;
  margin-top: 6px;
  color: var(--pacman);
  font-size: 1.55rem;
  font-weight: 1000;
}

#readingPacmanGame .pac-leaderboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
  text-align: left;
}

#readingPacmanGame .pac-leaderboard-card {
  border-radius: 28px;
  border: 1px solid rgba(0, 55, 255, 0.48);
  background:
    radial-gradient(circle at 0% 0%, rgba(0, 55, 255, 0.16), transparent 34%),
    rgba(0, 0, 0, 0.26);
  padding: 16px;
}

#readingPacmanGame .pac-leaderboard-card h3 {
  margin: 0 0 10px;
  color: var(--pacman);
  font-size: 1.05rem;
}

#readingPacmanGame .pac-leaderboard-row {
  display: grid;
  grid-template-columns: 34px 42px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

#readingPacmanGame .pac-leaderboard-row.current {
  background: rgba(255, 237, 0, 0.08);
  border-radius: 12px;
  padding-left: 6px;
  padding-right: 6px;
}

#readingPacmanGame .pac-leaderboard-avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.10);
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  overflow: hidden;
}

#readingPacmanGame .pac-leaderboard-name {
  font-weight: 950;
  color: #ffffff;
}

#readingPacmanGame .pac-leaderboard-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.72rem;
}

#readingPacmanGame .pac-leaderboard-score {
  color: var(--pacman);
  font-weight: 1000;
}

/* =========================================================
   ASSIGN TOOL SAFETY
   Keep old floating aside hidden if you are using topper assign
   ========================================================= */

#readingPacmanGame .teacher-assign-checkpoint {
  display: none !important;
}

/* =========================================================
   ACCESSIBILITY
   ========================================================= */

#readingPacmanGame :focus-visible {
  outline: 3px solid var(--pacman);
  outline-offset: 3px;
  border-radius: 10px;
}

#readingPacmanGame .sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1100px) {
  #readingPacmanGame .mode-showdown {
    grid-template-columns: 1fr;
  }

  #readingPacmanGame #difficulty-screen .pill-row {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }

  #readingPacmanGame .grade-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
}

@media (max-width: 760px) {
  #readingPacmanGame .cp_app {
    padding: 26px 14px;
  }

  #readingPacmanGame .theme-grid,
  #readingPacmanGame #control-screen .pill-row,
  #readingPacmanGame #difficulty-screen .pill-row,
  #readingPacmanGame .pac-leaderboard-grid,
  #readingPacmanGame .pac-final-stats {
    grid-template-columns: 1fr;
  }

  #readingPacmanGame .mode-pill {
    min-height: auto;
  }

  #readingPacmanGame .mode-visual,
  #readingPacmanGame .neon-preview,
  #readingPacmanGame .dumpling-preview {
    min-height: 160px;
  }

  #readingPacmanGame .grade-grid {
    grid-template-columns: 1fr;
  }

  #readingPacmanGame .pac-setup-actions {
    display: grid;
    width: 100%;
  }

  #readingPacmanGame .pac-setup-actions .btn,
  #readingPacmanGame .pac-player-card .btn {
    width: 100%;
  }

  #readingPacmanGame #game {
    width: 96vw;
    height: auto;
    max-height: 68vh;
    border-width: 8px;
  }
}

@media (max-width: 480px) {
  #readingPacmanGame .title-top {
    font-size: clamp(24px, 8vw, 34px);
  }

  #readingPacmanGame .title-bottom {
    font-size: clamp(38px, 12vw, 58px);
  }

  #readingPacmanGame .cover,
  #readingPacmanGame #start-screen .cover {
    width: 92vw;
    border-width: 3px;
    outline-width: 7px;
  }

  #readingPacmanGame .theme-pill,
  #readingPacmanGame .mode-pill,
  #readingPacmanGame #difficulty-screen .pill,
  #readingPacmanGame #control-screen .pill,
  #readingPacmanGame .skill-card,
  #readingPacmanGame .pac-player-card {
    border-radius: 26px;
    padding: 22px;
  }

  #readingPacmanGame .btn {
    width: 100%;
    min-height: 56px;
    padding: 14px 18px;
  }

  #readingPacmanGame .choices button {
    font-size: 0.92rem;
    border-width: 2px;
  }

  #readingPacmanGame #game {
    border-width: 6px;
    border-radius: 8px;
  }
}

@media (orientation: landscape) and (max-height: 480px) {
  #readingPacmanGame .cover {
    display: none;
  }

  #readingPacmanGame .cp_app {
    padding: 12px;
  }

  #readingPacmanGame .screen {
    gap: 12px;
  }

  #readingPacmanGame #game {
    max-height: 68vh;
    width: 96vw;
  }

  #readingPacmanGame .hint {
    display: none;
  }
}

@media (hover: none), (pointer: coarse) {
  #readingPacmanGame .grade-btn,
  #readingPacmanGame .choices button,
  #readingPacmanGame .pill,
  #readingPacmanGame .btn {
    padding-block: calc(1em + 4px);
  }

  #readingPacmanGame .choices button:hover,
  #readingPacmanGame .grade-btn:hover,
  #readingPacmanGame .pill:hover {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  #readingPacmanGame *,
  #readingPacmanGame *::before,
  #readingPacmanGame *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* =========================================================
   MODE / CHARACTER SCREEN
   Clean card layout + Trending section
   ========================================================= */

#readingPacmanGame #mode-screen {
  padding: 36px 0 56px;
}

#readingPacmanGame #mode-screen,
#readingPacmanGame #mode-screen * {
  color: #ffffff;
}

#readingPacmanGame #mode-screen .screen-title {
  font-size: clamp(2.7rem, 6vw, 5.4rem);
  letter-spacing: -0.055em;
  margin-bottom: 4px;
}

#readingPacmanGame .mode-search-wrap {
  width: min(920px, 94vw);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 4px auto 22px;
}

#readingPacmanGame .mode-search {
  flex: 1 1 520px;
  min-height: 62px;
  border-radius: 999px;
  border: 3px solid var(--pacman);
  background: rgba(0, 0, 0, 0.72);
  color: #ffffff;
  padding: 0 26px;
  font-family: "Orbitron", system-ui, sans-serif;
  font-weight: 900;
  font-size: 0.96rem;
  text-align: left;
  outline: none;
  box-shadow:
    0 8px 0 #000,
    0 0 32px rgba(255, 237, 0, 0.24);
}

#readingPacmanGame .mode-search::placeholder {
  color: rgba(255, 255, 255, 0.58);
}

#readingPacmanGame .mode-search:focus {
  border-color: #00e5ff;
  box-shadow:
    0 8px 0 #000,
    0 0 36px rgba(0, 229, 255, 0.34);
}

#readingPacmanGame .mode-search-clear {
  min-height: 62px;
  border: 0;
  border-radius: 999px;
  padding: 0 24px;
  color: #ffffff;
  background: #252a3e;
  font-weight: 1000;
  box-shadow: 0 8px 0 #000;
}

#readingPacmanGame .mode-search-results {
  flex-basis: 100%;
  min-height: 18px;
  margin: 0;
  color: #cfe6ff;
  font-size: 0.78rem;
  text-align: center;
  font-weight: 850;
}

#readingPacmanGame .mode-section {
  width: min(1240px, 96vw);
  margin: 8px auto 26px;
}

#readingPacmanGame .mode-section-head {
  width: 100%;
  text-align: left;
  margin: 0 0 14px;
  padding: 0 4px;
}

#readingPacmanGame .mode-section-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 7px 13px;
  border-radius: 999px;
  background: rgba(255, 237, 0, 0.12);
  border: 1px solid rgba(255, 237, 0, 0.32);
  color: #fff6a8 !important;
  font-size: 0.72rem;
  font-weight: 1000;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

#readingPacmanGame .mode-section-head h3 {
  margin: 10px 0 5px;
  color: #ffffff;
  font-size: clamp(1.45rem, 3vw, 2.2rem);
  font-weight: 1000;
  letter-spacing: -0.04em;
  text-shadow: 0 4px 0 #000;
}

#readingPacmanGame .mode-section-head p {
  margin: 0;
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.94rem;
  font-weight: 800;
}

#readingPacmanGame .mode-grid {
  width: 100%;
  display: grid;
  gap: 22px;
}

#readingPacmanGame .mode-trending-grid {
  grid-template-columns: repeat(3, minmax(240px, 1fr));
}

#readingPacmanGame .mode-all-grid {
  grid-template-columns: repeat(3, minmax(240px, 1fr));
}

#readingPacmanGame .mode-pill {
  width: 100%;
  min-height: 420px;
  padding: 24px;
  border-radius: 30px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;

  color: #ffffff !important;
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 255, 255, 0.08), transparent 42%),
    linear-gradient(180deg, rgba(12, 15, 31, 0.98), rgba(3, 4, 10, 0.98));
  border: 3px solid rgba(255, 255, 255, 0.14);

  box-shadow:
    0 0 0 6px rgba(0, 0, 0, 0.76) inset,
    0 18px 44px rgba(0, 0, 0, 0.66);
  transition:
    transform 0.16s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease,
    filter 0.18s ease;
}

#readingPacmanGame .mode-pill:hover {
  transform: translateY(-5px);
  filter: saturate(1.06);
}

#readingPacmanGame .mode-pill-featured {
  min-height: 450px;
}

#readingPacmanGame .mode-pill .mode-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 7px 12px;
  border-radius: 999px;
  color: #eef5ff !important;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 0.66rem;
  font-weight: 1000;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

#readingPacmanGame .mode-pill .pill-title {
  display: block;
  margin: 14px 0 7px;
  color: #ffffff !important;
  font-size: clamp(1.55rem, 3vw, 2.5rem);
  font-weight: 1000;
  line-height: 0.96;
  letter-spacing: -0.055em;
  text-shadow:
    0 4px 0 #000,
    0 0 18px rgba(255, 255, 255, 0.18);
}

#readingPacmanGame .mode-pill .pill-sub {
  display: block;
  min-height: 44px;
  color: rgba(255, 255, 255, 0.82) !important;
  font-size: 0.88rem;
  font-weight: 850;
  line-height: 1.35;
}

#readingPacmanGame .mode-stat {
  display: block;
  color: #ffffff !important;
  font-size: 0.9rem;
  font-weight: 900;
  line-height: 1.45;
  margin-top: auto;
}

#readingPacmanGame .mode-visual,
#readingPacmanGame .neon-preview,
#readingPacmanGame .dumpling-preview {
  position: relative;
  width: 100%;
  min-height: 190px;
  margin: 18px 0 18px;
  border-radius: 24px;
  overflow: hidden;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.05), transparent 62%),
    #03040b;
  display: grid;
  place-items: center;
  box-shadow:
    inset 0 0 0 4px rgba(0, 0, 0, 0.82),
    0 14px 30px rgba(0, 0, 0, 0.45);
}

#readingPacmanGame .mode-visual-svg {
  padding: 0;
}

#readingPacmanGame .mini-maze-svg {
  width: 100%;
  height: 100%;
  display: block;
}

#readingPacmanGame .mode-diff-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

#readingPacmanGame .mode-diff-list span {
  display: inline-flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 999px;
  color: #eef5ff !important;
  background: rgba(255, 255, 255, 0.075);
  border: 1px solid rgba(255, 255, 255, 0.11);
  font-size: 0.69rem;
  font-weight: 900;
}

#readingPacmanGame .mode-helper {
  margin: 0;
  color: rgba(255, 255, 255, 0.70);
  font-size: 0.9rem;
  font-weight: 850;
}

/* Individual card colors */

#readingPacmanGame .mode-pill-pacman {
  border-color: #2b7fff;
  box-shadow:
    0 0 0 6px rgba(0, 0, 0, 0.76) inset,
    0 0 30px rgba(43, 127, 255, 0.28),
    0 18px 44px rgba(0, 0, 0, 0.66);
}

#readingPacmanGame .mode-pill-mspacman {
  border-color: #ff5aa5;
  box-shadow:
    0 0 0 6px rgba(0, 0, 0, 0.76) inset,
    0 0 34px rgba(255, 90, 165, 0.32),
    0 18px 44px rgba(0, 0, 0, 0.66);
}

#readingPacmanGame .mode-pill-cat {
  border-color: #7ee787;
}

#readingPacmanGame .mode-pill-dog {
  border-color: #ffb357;
  box-shadow:
    0 0 0 6px rgba(0, 0, 0, 0.76) inset,
    0 0 34px rgba(255, 179, 87, 0.25),
    0 18px 44px rgba(0, 0, 0, 0.66);
}

#readingPacmanGame .mode-pill-neon {
  border-color: #00f5ff;
  background:
    radial-gradient(circle at 10% 0%, rgba(0, 245, 255, 0.22), transparent 44%),
    radial-gradient(circle at 90% 12%, rgba(255, 0, 255, 0.20), transparent 44%),
    #040014;
}

#readingPacmanGame .mode-pill-dumpling {
  border-color: #ffd166;
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 209, 102, 0.20), transparent 42%),
    radial-gradient(circle at 100% 100%, rgba(138, 90, 45, 0.18), transparent 46%),
    linear-gradient(180deg, rgba(23, 15, 8, 0.98), rgba(4, 4, 8, 0.98));
  box-shadow:
    0 0 0 6px rgba(0, 0, 0, 0.76) inset,
    0 0 38px rgba(255, 209, 102, 0.24),
    0 18px 44px rgba(0, 0, 0, 0.66);
}

#readingPacmanGame .mode-pill.is-hidden-by-search {
  display: none !important;
}

/* Realistic dumpling preview */

#readingPacmanGame .realistic-dumpling-preview-box {
  width: 100%;
  min-height: 170px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background:
    radial-gradient(circle at 50% 80%, rgba(255, 232, 180, 0.20), transparent 52%),
    linear-gradient(180deg, rgba(255, 246, 226, 0.08), rgba(0, 0, 0, 0.25));
}

#readingPacmanGame .real-dumpling {
  position: relative;
  display: block;
  width: 86px;
  height: 62px;
  border-radius: 48% 48% 42% 42%;
  transform: translateY(8px);
  background:
    radial-gradient(circle at 32% 18%, rgba(255, 255, 255, 0.82), transparent 22%),
    radial-gradient(circle at 50% 10%, #fff2c9 0%, #f5d49d 38%, #d5a15b 100%);
  border: 3px solid rgba(117, 75, 35, 0.72);
  box-shadow:
    inset 0 -10px 18px rgba(117, 75, 35, 0.28),
    inset 0 8px 18px rgba(255, 255, 255, 0.34),
    0 14px 24px rgba(0, 0, 0, 0.45);
}

#readingPacmanGame .real-dumpling::before {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  top: 8px;
  height: 26px;
  border-radius: 50%;
  background:
    repeating-radial-gradient(
      ellipse at 50% 0%,
      rgba(126, 83, 40, 0.52) 0 2px,
      transparent 2px 7px
    );
  opacity: 0.55;
  mask-image: radial-gradient(ellipse at center, #000 0%, transparent 72%);
}

#readingPacmanGame .real-dumpling::after {
  content: "";
  position: absolute;
  left: 24px;
  top: 35px;
  width: 38px;
  height: 14px;
  border-bottom: 3px solid rgba(45, 25, 12, 0.76);
  border-radius: 0 0 999px 999px;
}

#readingPacmanGame .real-dumpling-gold {
  background:
    radial-gradient(circle at 32% 18%, rgba(255, 255, 255, 0.92), transparent 22%),
    radial-gradient(circle at 50% 10%, #fff9aa 0%, #ffd166 42%, #b97813 100%);
}

#readingPacmanGame .real-dumpling-pink {
  background:
    radial-gradient(circle at 32% 18%, rgba(255, 255, 255, 0.88), transparent 22%),
    radial-gradient(circle at 50% 10%, #ffe1ec 0%, #ff9fbd 42%, #ba4b72 100%);
}

/* Mini SVG colors */

#readingPacmanGame .pacmaze-svg .maze-stroke {
  stroke: #38b6ff;
}

#readingPacmanGame .mspacmaze-svg .maze-stroke {
  stroke: #ff6bb4;
}

#readingPacmanGame .catmaze-svg .maze-stroke {
  stroke: #7ee787;
}

#readingPacmanGame .dogmaze-svg .maze-stroke {
  stroke: #ffb357;
}

#readingPacmanGame .mini-maze-svg .maze-stroke {
  stroke-width: 10;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 6px currentColor);
}

#readingPacmanGame .mini-maze-svg .pellet {
  fill: #fff2ad;
  filter: drop-shadow(0 0 4px rgba(255, 237, 0, 0.40));
}

#readingPacmanGame .mini-maze-svg .pac-body {
  fill: var(--pacman);
  filter: drop-shadow(0 0 8px rgba(255, 237, 0, 0.36));
}

#readingPacmanGame .mini-maze-svg .pac-mouth-cut,
#readingPacmanGame .mini-maze-svg .pac-mouth-cut-pink {
  fill: #05060f;
}

#readingPacmanGame .mini-maze-svg .ghost-red {
  color: #ff3b3b;
}

#readingPacmanGame .mini-maze-svg .ghost-cyan {
  color: #00e5ff;
}

#readingPacmanGame .mini-maze-svg .ghost-pink {
  color: #ff7fc2;
}

#readingPacmanGame .mini-maze-svg .ghost-orange {
  color: #ff9900;
}

/* Neon preview support */

#readingPacmanGame .neon-preview-maze {
  position: relative;
  width: 82%;
  height: 118px;
  border: 6px solid #00f5ff;
  border-radius: 18px;
  box-shadow:
    0 0 24px #00f5ff,
    inset 0 0 18px rgba(0, 245, 255, 0.45);
}

#readingPacmanGame .neon-pac,
#readingPacmanGame .neon-dot,
#readingPacmanGame .neon-ghost {
  position: absolute;
  display: block;
}

#readingPacmanGame .neon-pac {
  width: 34px;
  height: 34px;
  left: 34px;
  top: 40px;
  border-radius: 50%;
  background: #fff200;
  box-shadow: 0 0 22px #fff200;
  clip-path: polygon(0 0, 100% 0, 68% 50%, 100% 100%, 0 100%);
}

#readingPacmanGame .neon-dot {
  width: 9px;
  height: 9px;
  top: 53px;
  border-radius: 50%;
  background: #ff00ff;
  box-shadow: 0 0 14px #ff00ff;
}

#readingPacmanGame .neon-dot:nth-child(2) {
  left: 110px;
}

#readingPacmanGame .neon-dot:nth-child(3) {
  left: 150px;
}

#readingPacmanGame .neon-dot:nth-child(4) {
  left: 190px;
}

#readingPacmanGame .neon-ghost {
  width: 30px;
  height: 34px;
  top: 41px;
  border-radius: 50% 50% 8px 8px;
}

#readingPacmanGame .neon-pink {
  left: 235px;
  background: #ff2f92;
  box-shadow: 0 0 18px #ff2f92;
}

#readingPacmanGame .neon-blue {
  left: 280px;
  background: #00e5ff;
  box-shadow: 0 0 18px #00e5ff;
}

#readingPacmanGame .neon-green {
  left: 325px;
  background: #39ff14;
  box-shadow: 0 0 18px #39ff14;
}

/* Responsive mode cards */

@media (max-width: 1100px) {
  #readingPacmanGame .mode-trending-grid,
  #readingPacmanGame .mode-all-grid {
    grid-template-columns: repeat(2, minmax(240px, 1fr));
  }
}

@media (max-width: 720px) {
  #readingPacmanGame .mode-trending-grid,
  #readingPacmanGame .mode-all-grid {
    grid-template-columns: 1fr;
  }

  #readingPacmanGame .mode-pill,
  #readingPacmanGame .mode-pill-featured {
    min-height: auto;
  }

  #readingPacmanGame .mode-section-head {
    text-align: center;
  }
}

/* =========================================================
   ICON-ONLY MODE PREVIEWS
   ========================================================= */

#readingPacmanGame .mode-icon-preview {
  min-height: 190px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 42%, rgba(255,255,255,0.08), transparent 48%),
    linear-gradient(180deg, rgba(10,12,24,0.98), rgba(4,5,12,0.98));
  box-shadow:
    inset 0 0 0 4px rgba(0, 0, 0, 0.82),
    0 14px 30px rgba(0, 0, 0, 0.45);
}

#readingPacmanGame .preview-classic {
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 212, 0, 0.10), transparent 48%),
    linear-gradient(180deg, rgba(9,14,30,0.98), rgba(4,6,14,0.98));
}

#readingPacmanGame .preview-dumpling {
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 209, 102, 0.14), transparent 48%),
    linear-gradient(180deg, rgba(30,20,10,0.98), rgba(8,7,10,0.98));
}

#readingPacmanGame .preview-neon {
  background:
    radial-gradient(circle at 30% 35%, rgba(0,245,255,0.18), transparent 34%),
    radial-gradient(circle at 70% 45%, rgba(255,0,200,0.16), transparent 34%),
    linear-gradient(180deg, rgba(8,2,25,0.98), rgba(2,3,10,0.98));
}

#readingPacmanGame .preview-mspacman {
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 98, 170, 0.15), transparent 48%),
    linear-gradient(180deg, rgba(20,7,22,0.98), rgba(5,5,12,0.98));
}

#readingPacmanGame .preview-cat {
  background:
    radial-gradient(circle at 50% 42%, rgba(126,231,135,0.14), transparent 48%),
    linear-gradient(180deg, rgba(10,20,14,0.98), rgba(4,6,10,0.98));
}

#readingPacmanGame .preview-dog {
  background:
    radial-gradient(circle at 50% 42%, rgba(255,179,87,0.14), transparent 48%),
    linear-gradient(180deg, rgba(26,15,8,0.98), rgba(5,5,10,0.98));
}

#readingPacmanGame .theme-icon-svg {
  width: 140px;
  height: 140px;
  overflow: visible;
}

#readingPacmanGame .theme-icon-classic {
  filter: drop-shadow(0 0 18px rgba(255, 212, 0, 0.38));
}

#readingPacmanGame .theme-icon-dumpling {
  filter: drop-shadow(0 0 18px rgba(255, 209, 102, 0.30));
}

#readingPacmanGame .theme-icon-neon {
  filter:
    drop-shadow(0 0 12px rgba(0,245,255,0.55))
    drop-shadow(0 0 22px rgba(255,0,200,0.28));
}

#readingPacmanGame .theme-icon-mspacman {
  filter: drop-shadow(0 0 18px rgba(255, 98, 170, 0.34));
}

#readingPacmanGame .theme-icon-cat {
  filter: drop-shadow(0 0 18px rgba(126,231,135,0.28));
}

#readingPacmanGame .theme-icon-dog {
  filter: drop-shadow(0 0 18px rgba(255,179,87,0.28));
}

/* =========================================================
   MODE PREVIEWS: USE REAL IN-GAME PLAYER CANVAS
   ========================================================= */

#readingPacmanGame .mode-canvas-preview {
  min-height: 190px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 42%, rgba(255,255,255,0.08), transparent 48%),
    linear-gradient(180deg, rgba(10,12,24,0.98), rgba(4,5,12,0.98));
}

#readingPacmanGame .mode-preview-canvas {
  width: 160px;
  height: 160px;
  display: block;
  image-rendering: auto;
}

.pac-student-login-modal {
  position: fixed;
  inset: 0;
  z-index: 2147483600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.74);
  backdrop-filter: blur(10px);
}

.pac-student-login-modal.hidden {
  display: none !important;
}

.pac-student-login-card {
  position: relative;
  width: min(760px, 94vw);
  max-height: 90vh;
  overflow-y: auto;
  padding: clamp(26px, 4vw, 46px);
  border-radius: 34px;
  border: 3px solid var(--maze, #0038ff);
  background:
    radial-gradient(circle at 20% 0%, rgba(255,237,0,.16), transparent 44%),
    radial-gradient(circle at 90% 20%, rgba(0,245,255,.14), transparent 46%),
    rgba(5,5,7,.98);
  box-shadow:
    0 0 0 8px rgba(0,0,0,.72) inset,
    0 28px 80px rgba(0,0,0,.88),
    0 0 42px rgba(0,55,255,.38);
  text-align: center;
}

.pac-student-login-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: rgba(255,255,255,.12);
  color: #ffffff;
  font-size: 1.6rem;
  font-weight: 1000;
  cursor: pointer;
}

.pac-student-login-close:hover {
  background: rgba(255,237,0,.20);
  color: var(--pacman, #ffed00);
}

.pac-student-login-step {
  display: none;
}

.pac-student-login-step.active {
  display: block;
}

.pac-student-login-form {
  display: grid;
  gap: 16px;
  justify-items: center;
  margin-top: 18px;
}

.pac-student-message {
  min-height: 24px;
  margin: 16px auto 0;
  color: #cfe6ff;
  font-weight: 900;
  line-height: 1.4;
}

.pac-student-message.good {
  color: #54f29c;
}

.pac-student-message.bad {
  color: #ff6b8a;
}

.pac-student-preview {
  width: min(520px, 100%);
  margin: 18px auto;
  padding: 16px;
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.14);
}

.pac-student-preview-avatar {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: rgba(255,255,255,.12);
  font-size: 2rem;
}

.pac-student-preview-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pac-password-slots {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 18px auto;
}

.pac-password-slot {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.08);
  border: 2px solid rgba(255,255,255,.18);
  color: #ffffff;
  font-size: 1.8rem;
  font-weight: 1000;
}

.pac-password-slot.filled {
  border-color: var(--pacman, #ffed00);
  box-shadow: 0 0 22px rgba(255,237,0,.34);
}

.pac-password-grid {
  width: min(620px, 100%);
  margin: 18px auto 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(54px, 1fr));
  gap: 12px;
}

.pac-icon-btn {
  min-height: 62px;
  border-radius: 18px;
  border: 2px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.08);
  font-size: 2rem;
  cursor: pointer;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}

.pac-icon-btn:hover,
.pac-icon-btn.selected {
  transform: translateY(-2px);
  border-color: var(--pacman, #ffed00);
  box-shadow: 0 0 22px rgba(255,237,0,.34);
}

@media (max-width: 620px) {
  .pac-password-grid {
    grid-template-columns: repeat(3, minmax(54px, 1fr));
  }
}

.pac-student-success-modal {
  position: fixed;
  inset: 0;
  z-index: 2147483700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(12px);
}

.pac-student-success-modal.hidden {
  display: none !important;
}

.pac-student-success-card {
  width: min(540px, 94vw);
  padding: 38px 34px;
  border-radius: 34px;
  border: 3px solid var(--pacman, #ffed00);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 237, 0, .22), transparent 42%),
    radial-gradient(circle at 90% 15%, rgba(0, 245, 255, .14), transparent 38%),
    rgba(5, 5, 7, .98);
  box-shadow:
    0 0 0 8px rgba(0, 0, 0, .72) inset,
    0 30px 80px rgba(0, 0, 0, .86),
    0 0 42px rgba(255, 237, 0, .36);
  text-align: center;
  color: #ffffff;
}

.pac-student-success-icon {
  width: 76px;
  height: 76px;
  margin: 0 auto 18px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #06120a;
  background:
    radial-gradient(circle at 30% 0%, #ffffff, transparent 38%),
    linear-gradient(135deg, #54f29c, #00e5ff);
  font-size: 2.6rem;
  font-weight: 1000;
  box-shadow:
    0 0 30px rgba(84, 242, 156, .48),
    0 12px 0 #000;
}

.pac-student-success-card h2 {
  margin: 0;
  color: #ffffff !important;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1;
  letter-spacing: -.05em;
  text-shadow:
    0 4px 0 #000,
    0 0 22px rgba(255, 237, 0, .32);
}

.pac-student-success-card p {
  margin: 14px auto 24px;
  color: #cfe6ff;
  font-weight: 900;
  line-height: 1.45;
}

/* =========================================================
   FINAL RESULTS / LEADERBOARD SCREEN REVAMP
   Scoped to Reading Pac-Man
   ========================================================= */

#readingPacmanGame #final-popup {
  position: fixed;
  inset: 0;
  z-index: 2147483400;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background:
    radial-gradient(circle at 20% 10%, rgba(255, 237, 0, 0.16), transparent 34%),
    radial-gradient(circle at 80% 20%, rgba(0, 229, 255, 0.14), transparent 34%),
    radial-gradient(circle at 50% 95%, rgba(255, 0, 153, 0.14), transparent 42%),
    rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(14px);
}

#readingPacmanGame #final-popup.show {
  display: flex !important;
}

#readingPacmanGame .pac-end-shell {
  width: min(1180px, 96vw);
  max-height: 92vh;
  overflow-y: auto;
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.1fr);
  gap: 22px;
  padding: 22px;
  border-radius: 38px;
  border: 3px solid rgba(255, 237, 0, 0.86);
  background:
    linear-gradient(90deg, rgba(255, 237, 0, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(0, 229, 255, 0.05) 1px, transparent 1px),
    radial-gradient(circle at 10% 0%, rgba(255, 237, 0, 0.18), transparent 36%),
    radial-gradient(circle at 90% 0%, rgba(255, 90, 165, 0.14), transparent 34%),
    linear-gradient(135deg, rgba(7, 10, 24, 0.98), rgba(1, 3, 10, 0.98));
  background-size: 42px 42px, 42px 42px, auto, auto, auto;
  box-shadow:
    0 0 0 8px rgba(0, 0, 0, 0.68) inset,
    0 30px 90px rgba(0, 0, 0, 0.88),
    0 0 50px rgba(255, 237, 0, 0.26);
}

#readingPacmanGame .pac-end-hero {
  position: sticky;
  top: 0;
  align-self: start;
  padding: 28px;
  border-radius: 30px;
  border: 2px solid rgba(0, 229, 255, 0.46);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 237, 0, 0.18), transparent 40%),
    linear-gradient(180deg, rgba(12, 20, 44, 0.96), rgba(4, 5, 12, 0.96));
  box-shadow:
    0 0 0 6px rgba(0, 0, 0, 0.52) inset,
    0 18px 44px rgba(0, 0, 0, 0.52);
}

#readingPacmanGame .pac-end-kicker {
  display: inline-flex;
  margin: 0 0 12px;
  padding: 8px 13px;
  border-radius: 999px;
  color: #18120a;
  background: var(--pacman, #ffed00);
  font-size: 0.72rem;
  font-weight: 1000;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  box-shadow: 0 6px 0 #000;
}

#readingPacmanGame #pacEndTitle {
  margin: 0;
  color: #ffffff !important;
  font-size: clamp(2.1rem, 4.6vw, 4.2rem);
  line-height: 0.92;
  letter-spacing: -0.06em;
  font-weight: 1000;
  text-shadow:
    0 5px 0 #000,
    0 0 28px rgba(255, 237, 0, 0.38);
}

#readingPacmanGame #pacEndSubtitle {
  margin: 14px 0 22px;
  color: #cfe6ff;
  font-size: 1rem;
  font-weight: 850;
  line-height: 1.45;
}

#readingPacmanGame .pac-player-result-card {
  display: grid;
  grid-template-columns: 76px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: 24px;
  background:
    radial-gradient(circle at 0% 0%, rgba(0, 229, 255, 0.16), transparent 38%),
    rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

#readingPacmanGame .pac-end-player-avatar,
#readingPacmanGame .pac-end-avatar-img {
  width: 76px;
  height: 76px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  object-fit: cover;
  overflow: hidden;
  background: #050507;
  border: 2px solid rgba(255, 237, 0, 0.7);
  box-shadow: 0 0 22px rgba(255, 237, 0, 0.22);
  font-size: 2.2rem;
}

#readingPacmanGame .pac-end-player-copy span {
  display: block;
  color: #ffffff;
  font-size: 1.1rem;
  font-weight: 1000;
}

#readingPacmanGame .pac-end-player-copy small {
  display: block;
  margin-top: 4px;
  color: #aebee6;
  font-size: 0.78rem;
  font-weight: 850;
  line-height: 1.3;
}

#readingPacmanGame .pac-end-score-badge {
  min-width: 92px;
  padding: 12px;
  border-radius: 20px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.35), transparent 40%),
    linear-gradient(180deg, #fff875, var(--pacman, #ffed00));
  color: #18120a;
  box-shadow: 0 8px 0 #000;
}

#readingPacmanGame .pac-end-score-badge small {
  display: block;
  font-size: 0.68rem;
  font-weight: 1000;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

#readingPacmanGame .pac-end-score-badge strong {
  display: block;
  margin-top: 3px;
  font-size: 1.3rem;
  font-weight: 1000;
}

#readingPacmanGame .pac-simple-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 18px 0 22px;
}

#readingPacmanGame .pac-simple-stats div {
  padding: 14px 10px;
  border-radius: 20px;
  text-align: center;
  background: rgba(255, 255, 255, 0.075);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

#readingPacmanGame .pac-simple-stats strong {
  display: block;
  color: var(--pacman, #ffed00);
  font-size: 1.15rem;
  font-weight: 1000;
}

#readingPacmanGame .pac-simple-stats span {
  display: block;
  margin-top: 5px;
  color: #b9c7e9;
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

#readingPacmanGame .pac-play-again-btn {
  width: 100%;
}

#readingPacmanGame .pac-end-leaderboards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

#readingPacmanGame .pac-board-card {
  padding: 22px;
  border-radius: 30px;
  border: 2px solid rgba(0, 55, 255, 0.62);
  background:
    radial-gradient(circle at 0% 0%, rgba(0, 229, 255, 0.14), transparent 34%),
    linear-gradient(180deg, rgba(12, 16, 34, 0.98), rgba(4, 5, 12, 0.98));
  box-shadow:
    0 0 0 6px rgba(0, 0, 0, 0.48) inset,
    0 18px 46px rgba(0, 0, 0, 0.48);
}

#readingPacmanGame .pac-board-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

#readingPacmanGame .pac-board-head p {
  margin: 0;
  color: var(--pacman, #ffed00);
  font-size: 0.74rem;
  font-weight: 1000;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

#readingPacmanGame .pac-board-head h3 {
  margin: 0;
  color: #ffffff;
  font-size: clamp(1.15rem, 2.3vw, 1.75rem);
  line-height: 1.08;
  font-weight: 1000;
  text-align: right;
}

#readingPacmanGame .pac-board-list {
  display: grid;
  gap: 10px;
}

#readingPacmanGame .pac-board-row {
  display: grid;
  grid-template-columns: 48px 54px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 13px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.10);
}

#readingPacmanGame .pac-board-row.current {
  background:
    radial-gradient(circle at 0% 50%, rgba(255, 237, 0, 0.18), transparent 44%),
    rgba(255, 237, 0, 0.09);
  border-color: rgba(255, 237, 0, 0.56);
  box-shadow: 0 0 26px rgba(255, 237, 0, 0.14);
}

#readingPacmanGame .pac-board-rank {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: #050507;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--pacman, #ffed00);
  font-size: 1rem;
  font-weight: 1000;
}

#readingPacmanGame .pac-board-row .pac-leaderboard-avatar {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  object-fit: cover;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.10);
  font-size: 1.6rem;
}

#readingPacmanGame .pac-board-player strong {
  display: block;
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 1000;
}

#readingPacmanGame .pac-board-player span {
  display: block;
  margin-top: 4px;
  color: #aebee6;
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1.35;
}

#readingPacmanGame .pac-board-score {
  color: var(--pacman, #ffed00);
  font-size: 1.1rem;
  font-weight: 1000;
  white-space: nowrap;
}

#readingPacmanGame .pac-empty-board,
#readingPacmanGame .pac-board-loading {
  padding: 20px;
  border-radius: 20px;
  text-align: center;
  color: #cfe6ff;
  background: rgba(255, 255, 255, 0.07);
  font-weight: 850;
}

#readingPacmanGame .pac-empty-board span {
  display: block;
  font-size: 2rem;
  margin-bottom: 8px;
}

#readingPacmanGame .pac-empty-board p {
  margin: 0;
}

@media (max-width: 900px) {
  #readingPacmanGame .pac-end-shell {
    grid-template-columns: 1fr;
  }

  #readingPacmanGame .pac-end-hero {
    position: relative;
  }
}

@media (max-width: 620px) {
  #readingPacmanGame #final-popup {
    padding: 12px;
  }

  #readingPacmanGame .pac-end-shell {
    padding: 14px;
    border-radius: 28px;
  }

  #readingPacmanGame .pac-player-result-card,
  #readingPacmanGame .pac-board-row {
    grid-template-columns: 1fr;
    text-align: center;
  }

  #readingPacmanGame .pac-end-player-avatar,
  #readingPacmanGame .pac-end-avatar-img,
  #readingPacmanGame .pac-board-rank,
  #readingPacmanGame .pac-board-row .pac-leaderboard-avatar {
    margin: 0 auto;
  }

  #readingPacmanGame .pac-end-score-badge {
    width: 100%;
  }

  #readingPacmanGame .pac-simple-stats {
    grid-template-columns: 1fr;
  }

  #readingPacmanGame .pac-board-head {
    display: block;
    text-align: center;
  }

  #readingPacmanGame .pac-board-head h3 {
    text-align: center;
    margin-top: 8px;
  }
}

#question-screen {
  display: none;
  min-height: calc(100vh - 180px);
  padding: 70px 24px;
  align-items: center;
  justify-content: flex-start;
  flex-direction: column;
}

#question-screen .screen-title {
  margin-bottom: 24px;
}

.question-panel {
  width: min(920px, 94vw);
  border: 3px solid var(--maze, #0038ff);
  border-radius: 28px;
  padding: 34px;
  background:
    radial-gradient(circle at 10% 0%, rgba(0, 55, 255, 0.18), transparent 44%),
    radial-gradient(circle at 95% 10%, rgba(255, 237, 0, 0.10), transparent 46%),
    rgba(5, 5, 7, 0.96);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.78),
    0 0 36px rgba(0, 55, 255, 0.32);
}

.prompt {
  margin: 0 0 20px;
  color: #ffffff;
  font-size: clamp(1rem, 1.7vw, 1.3rem);
  font-weight: 850;
  line-height: 1.55;
  white-space: pre-wrap;
}

.question-text {
  margin: 0 0 22px;
  color: var(--pacman, #ffed00);
  font-size: clamp(1.2rem, 2vw, 1.75rem);
  font-weight: 1000;
  line-height: 1.35;
}

.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 18px;
}

.choice-btn {
  min-height: 68px;
  border: 2px solid rgba(255, 237, 0, 0.75);
  border-radius: 20px;
  padding: 16px 18px;
  background:
    linear-gradient(135deg, rgba(255, 237, 0, 0.96), rgba(255, 190, 0, 0.94));
  color: #111111;
  font-family: Orbitron, Inter, system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 1000;
  cursor: pointer;
  box-shadow:
    0 10px 0 rgba(0, 0, 0, 0.65),
    0 0 24px rgba(255, 237, 0, 0.26);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.choice-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
}

.choice-btn:disabled {
  cursor: not-allowed;
  opacity: 0.78;
}

.retry {
  min-height: 24px;
  margin: 18px 0 0;
  color: #ff5c8a;
  font-weight: 1000;
  text-align: center;
}

.progress-bar {
  display: flex;
  gap: 8px;
  width: 100%;
  height: auto;
  margin: 22px 0 0;
  border: 0;
  background: transparent;
}

.progress-bar .segment {
  flex: 1;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(0, 55, 255, 0.75);
  box-shadow: 0 0 14px rgba(0, 55, 255, 0.25);
}

.progress-bar .segment.filled {
  background: var(--pacman, #ffed00);
  border-color: var(--pacman, #ffed00);
  box-shadow: 0 0 18px rgba(255, 237, 0, 0.55);
}

@media (max-width: 720px) {
  .choices {
    grid-template-columns: 1fr;
  }

  .question-panel {
    padding: 24px;
  }
}

.pac-student-login-modal,
.pac-student-success-modal {
  position: fixed;
  inset: 0;
  z-index: 2147483500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 35%, rgba(0, 55, 255, 0.22), transparent 42%),
    rgba(0, 0, 0, 0.66);
  backdrop-filter: blur(7px);
}

.pac-student-login-modal.hidden,
.pac-student-success-modal.hidden {
  display: none !important;
}

.pac-student-login-card,
.pac-student-success-card {
  position: relative;
  width: min(820px, 94vw);
  max-height: min(90vh, 850px);
  overflow-y: auto;
  border: 3px solid var(--maze, #0038ff);
  border-radius: 30px;
  padding: 38px 34px;
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 237, 0, 0.15), transparent 42%),
    radial-gradient(circle at 90% 20%, rgba(0, 245, 255, 0.14), transparent 46%),
    rgba(5, 5, 7, 0.97);
  box-shadow:
    0 25px 80px rgba(0, 0, 0, 0.88),
    0 0 40px rgba(0, 55, 255, 0.55);
  text-align: center;
}

.pac-student-login-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-size: 1.6rem;
  font-weight: 1000;
  cursor: pointer;
}

.pac-student-login-form {
  display: grid;
  gap: 16px;
  justify-items: center;
  margin-top: 18px;
}

.pac-student-login-step {
  display: none;
}

.pac-student-login-step.active {
  display: block;
}

.pac-student-message {
  min-height: 28px;
  margin: 18px 0 0;
  color: #ff5c8a;
  font-weight: 1000;
}

.pac-student-message.good {
  color: #22c55e;
}

.pac-student-message.bad {
  color: #ff5c8a;
}

.pac-student-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 18px auto;
  color: #ffffff;
  font-weight: 1000;
}

.pac-student-preview img {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  object-fit: cover;
}

.pac-student-preview .student-avatar-emoji {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 2rem;
}

.pac-password-slots {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 18px 0;
}

.pac-password-slot {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border: 3px solid var(--pacman, #ffed00);
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.45);
  color: #ffffff;
  font-size: 2rem;
  box-shadow: 0 0 18px rgba(255, 237, 0, 0.25);
}

.pac-password-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(58px, 1fr));
  gap: 12px;
  margin: 18px auto 0;
  max-width: 620px;
}

.pac-password-icon-btn {
  min-height: 58px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-size: 1.8rem;
  cursor: pointer;
}

.pac-password-icon-btn:hover {
  border-color: var(--pacman, #ffed00);
  box-shadow: 0 0 18px rgba(255, 237, 0, 0.32);
}

.pac-password-icon-btn.selected {
  background: rgba(255, 237, 0, 0.16);
  border-color: var(--pacman, #ffed00);
}

.pac-student-success-icon {
  width: 84px;
  height: 84px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #052e16;
  background: linear-gradient(135deg, #86efac, #22c55e);
  font-size: 3rem;
  font-weight: 1000;
  box-shadow: 0 0 28px rgba(34, 197, 94, 0.45);
}

.pac-student-success-card h2 {
  margin: 0 0 10px;
  color: #ffffff;
  font-family: Orbitron, Inter, system-ui, sans-serif;
  font-size: clamp(2rem, 5vw, 4rem);
}

.pac-student-success-card p {
  margin: 0 0 22px;
  color: var(--muted, #b8c0d6);
  font-weight: 900;
}

@media (max-width: 720px) {
  .pac-password-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .pac-student-login-card,
  .pac-student-success-card {
    padding: 34px 20px;
  }
}

.pac-assignment-complete-card {
  margin: 22px auto 0;
  width: min(720px, 100%);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
  padding: 20px;
  border-radius: 24px;
  border: 2px solid rgba(52, 211, 153, 0.55);
  background:
    radial-gradient(circle at 12% 0%, rgba(52, 211, 153, 0.18), transparent 38%),
    rgba(255, 255, 255, 0.08);
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.36),
    0 0 0 6px rgba(52, 211, 153, 0.08);
  text-align: left;
}

.pac-assignment-complete-card.hidden {
  display: none !important;
}

.pac-assignment-complete-icon {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: rgba(52, 211, 153, 0.2);
  font-size: 1.8rem;
}

.pac-assignment-complete-card h3 {
  margin: 0 0 6px;
  color: #fff;
  font-size: 1.35rem;
}

.pac-assignment-complete-card p {
  margin: 0;
  color: var(--muted, #b8c0d6);
  font-weight: 800;
  line-height: 1.45;
}

.pac-assignment-task-status {
  margin-top: 8px !important;
  color: #ffed00 !important;
}

.pac-assignment-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

/* =========================================================
   READING PAC-MAN RESPONSIVE MASTER FIX
   Screens below 1200px
   Append at the VERY bottom of cp.css
   ========================================================= */

/* ---------- Global game safety ---------- */

@media (max-width: 1200px) {
  html,
  body {
    overflow-x: hidden;
  }

  #readingPacmanGame {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  #readingPacmanGame .cp_app {
    min-height: auto;
    padding: clamp(18px, 4vw, 42px) clamp(12px, 3vw, 24px);
    align-items: flex-start;
  }

  #readingPacmanGame .screen {
    width: 100%;
    max-width: min(1120px, 96vw);
    gap: clamp(14px, 2vw, 22px);
    margin-inline: auto;
  }

  #readingPacmanGame .screen::after {
    width: min(1000px, 96vw);
    height: min(680px, 82vh);
  }

  #readingPacmanGame .screen-title,
  #readingPacmanGame .screen h1,
  #readingPacmanGame .screen h2 {
    font-size: clamp(1.75rem, 5vw, 3.6rem);
    line-height: 1.02;
  }

  #readingPacmanGame .btn {
    max-width: 100%;
    white-space: normal;
    text-align: center;
  }
}

/* ---------- Start screen ---------- */

@media (max-width: 1200px) {
  #readingPacmanGame #start-screen {
    padding-block: clamp(22px, 4vw, 42px);
  }

  #readingPacmanGame .app-title {
    margin-bottom: clamp(8px, 2vw, 18px);
  }

  #readingPacmanGame .title-top {
    font-size: clamp(2rem, 7vw, 3.8rem);
  }

  #readingPacmanGame .title-bottom {
    font-size: clamp(3rem, 11vw, 5.8rem);
  }

  #readingPacmanGame .cover,
  #readingPacmanGame #start-screen .cover {
    width: min(620px, 88vw);
    border-radius: clamp(18px, 4vw, 30px);
    outline-width: clamp(4px, 1.5vw, 10px);
  }

  #readingPacmanGame .start-btn {
    width: min(480px, 88vw);
    min-height: clamp(58px, 8vw, 70px);
    font-size: clamp(1.1rem, 4vw, 1.85rem);
  }
}

/* ---------- Player login, avatar, student modal ---------- */

@media (max-width: 1200px) {
  #readingPacmanGame .pac-player-card,
  #readingPacmanGame .pac-student-login-card,
  #readingPacmanGame .pac-student-success-card {
    width: min(880px, 94vw);
    padding: clamp(20px, 4vw, 42px);
    border-radius: clamp(22px, 4vw, 34px);
  }

  #readingPacmanGame .pac-name-input,
  #readingPacmanGame input[type="text"],
  #readingPacmanGame input[type="search"],
  #readingPacmanGame input[type="email"],
  #readingPacmanGame input[type="password"] {
    width: min(620px, 100%);
    min-height: clamp(52px, 7vw, 64px);
    font-size: clamp(.88rem, 2vw, 1rem);
  }

  #readingPacmanGame .pac-avatar-grid {
    grid-template-columns: repeat(auto-fit, minmax(98px, 1fr));
    gap: clamp(10px, 2vw, 16px);
  }

  #readingPacmanGame .pac-avatar-btn {
    min-height: clamp(96px, 16vw, 128px);
  }

  #readingPacmanGame .pac-avatar-btn img {
    width: clamp(58px, 10vw, 82px);
    height: clamp(58px, 10vw, 82px);
  }
}

/* ---------- Mode/theme selection screens ---------- */

@media (max-width: 1200px) {
  #readingPacmanGame #mode-screen,
  #readingPacmanGame #theme-screen,
  #readingPacmanGame #select-screen,
  #readingPacmanGame #difficulty-screen,
  #readingPacmanGame #control-screen {
    padding-block: clamp(22px, 4vw, 46px);
  }

  #readingPacmanGame .mode-search-wrap,
  #readingPacmanGame .skill-search {
    width: min(940px, 94vw);
  }

  /* Your HTML uses .mode-grid, so this catches the actual current layout */
  #readingPacmanGame .mode-grid,
  #readingPacmanGame .mode-trending-grid,
  #readingPacmanGame .mode-all-grid,
  #readingPacmanGame .mode-showdown,
  #readingPacmanGame .theme-grid {
    width: min(1040px, 96vw);
    display: grid;
    grid-template-columns: repeat(2, minmax(280px, 1fr));
    gap: clamp(14px, 2vw, 22px);
  }

  #readingPacmanGame .mode-pill,
  #readingPacmanGame .theme-pill {
    min-height: auto;
    padding: clamp(18px, 3vw, 26px);
    border-radius: clamp(22px, 3vw, 32px);
  }

  #readingPacmanGame .mode-visual,
  #readingPacmanGame .mode-canvas-preview,
  #readingPacmanGame .neon-preview,
  #readingPacmanGame .dumpling-preview {
    min-height: clamp(150px, 22vw, 210px);
  }

  #readingPacmanGame .mode-preview-canvas {
    width: min(180px, 42vw);
    height: auto;
    aspect-ratio: 1 / 1;
  }

  #readingPacmanGame .mode-pill .pill-title,
  #readingPacmanGame .theme-pill .pill-title,
  #readingPacmanGame .theme-pill strong {
    font-size: clamp(1.1rem, 2.8vw, 1.65rem);
  }

  #readingPacmanGame .mode-pill .pill-sub,
  #readingPacmanGame .mode-stat,
  #readingPacmanGame .theme-pill span,
  #readingPacmanGame .theme-pill p {
    font-size: clamp(.78rem, 1.8vw, .95rem);
  }
}

/* ---------- Skill selection screen ---------- */

@media (max-width: 1200px) {
  #readingPacmanGame .select-wrap {
    width: min(1040px, 96vw);
    display: grid;
    gap: clamp(14px, 2vw, 22px);
  }

  #readingPacmanGame .skill-card {
    width: 100%;
    padding: clamp(16px, 3vw, 28px);
    border-radius: clamp(20px, 3vw, 30px);
  }

  #readingPacmanGame .skill-header {
    align-items: flex-start;
    gap: 12px;
  }

  #readingPacmanGame .grade-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
    gap: clamp(10px, 1.8vw, 14px);
  }

  #readingPacmanGame .grade-btn {
    min-height: 72px;
    padding: 14px;
    white-space: normal;
  }

  #readingPacmanGame .grade-btn strong {
    line-height: 1.2;
  }
}

/* ---------- Difficulty screen ---------- */

@media (max-width: 1200px) {
  #readingPacmanGame #difficulty-screen .pill-row {
    width: min(1040px, 96vw);
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: clamp(14px, 2vw, 22px);
  }

  #readingPacmanGame #difficulty-screen .difficulty-bottom-row {
    width: min(520px, 96vw);
  }

  #readingPacmanGame #difficulty-screen .pill {
    min-height: clamp(150px, 20vw, 190px);
    padding: clamp(18px, 3vw, 24px);
  }
}

/* ---------- Question screen ---------- */

@media (max-width: 1200px) {
  #readingPacmanGame #question-screen {
    width: 100%;
    max-width: 980px;
    margin-inline: auto;
    padding-block: clamp(18px, 4vw, 44px);
  }

  #readingPacmanGame .question-card,
  #readingPacmanGame .question-box,
  #readingPacmanGame .prompt-card,
  #readingPacmanGame #prompt,
  #readingPacmanGame #question-text {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  #readingPacmanGame #prompt,
  #readingPacmanGame #question-text {
    font-size: clamp(1rem, 2.5vw, 1.4rem);
    line-height: 1.55;
  }

  #readingPacmanGame #choices,
  #readingPacmanGame .choices {
    width: min(920px, 96vw);
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: clamp(10px, 2vw, 16px);
  }

  #readingPacmanGame #choices button,
  #readingPacmanGame .choice,
  #readingPacmanGame .choice-btn {
    width: 100%;
    min-height: clamp(58px, 8vw, 78px);
    padding: clamp(12px, 2vw, 18px);
    font-size: clamp(.9rem, 2vw, 1.05rem);
    line-height: 1.35;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  #readingPacmanGame #progress-bar,
  #readingPacmanGame .progress-bar {
    width: min(920px, 96vw);
    max-width: 100%;
  }

  #readingPacmanGame #retry-message {
    max-width: min(760px, 92vw);
    font-size: clamp(.9rem, 2vw, 1.05rem);
  }
}

/* ---------- Game canvas / Pac-Man play screen ---------- */

@media (max-width: 1200px) {
  #readingPacmanGame #game-screen {
    width: 100%;
    max-width: 100%;
    padding-block: clamp(12px, 3vw, 28px);
  }

  #readingPacmanGame .game-wrap,
  #readingPacmanGame .game-shell,
  #readingPacmanGame .canvas-wrap,
  #readingPacmanGame .game-area,
  #readingPacmanGame .maze-wrap {
    width: 100%;
    max-width: min(980px, 96vw);
    margin-inline: auto;
  }

  #readingPacmanGame canvas#game,
  #readingPacmanGame #game {
    display: block;
    width: min(760px, 94vw) !important;
    max-width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
    margin-inline: auto;
    touch-action: none;
  }

  #readingPacmanGame .hud,
  #readingPacmanGame .game-hud,
  #readingPacmanGame .stats-row,
  #readingPacmanGame .score-row {
    width: min(760px, 94vw);
    max-width: 100%;
    margin-inline: auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
  }

  #readingPacmanGame .touch-controls,
  #readingPacmanGame .mobile-controls,
  #readingPacmanGame .control-pad {
    max-width: min(360px, 90vw);
    margin-inline: auto;
  }
}

/* ---------- Final results / leaderboard ---------- */

@media (max-width: 1200px) {
  #readingPacmanGame .pac-final-modal,
  #readingPacmanGame .pac-end-shell,
  #readingPacmanGame .pac-end-card {
    width: min(1040px, 94vw) !important;
    max-height: 88vh;
    overflow-y: auto;
  }

  #readingPacmanGame .pac-final-stats {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  #readingPacmanGame .pac-leaderboard-grid,
  #readingPacmanGame .pac-end-grid,
  #readingPacmanGame .pac-board-grid {
    grid-template-columns: 1fr;
  }

  #readingPacmanGame .pac-leaderboard-row {
    grid-template-columns: 30px 38px minmax(0, 1fr) auto;
  }

  #readingPacmanGame .pac-leaderboard-name,
  #readingPacmanGame .pac-leaderboard-meta {
    min-width: 0;
    overflow-wrap: anywhere;
  }
}

/* ---------- Tablet and phone ---------- */

@media (max-width: 900px) {
  #readingPacmanGame .mode-grid,
  #readingPacmanGame .mode-trending-grid,
  #readingPacmanGame .mode-all-grid,
  #readingPacmanGame .mode-showdown,
  #readingPacmanGame .theme-grid {
    grid-template-columns: 1fr;
  }

  #readingPacmanGame #difficulty-screen .pill-row {
    grid-template-columns: 1fr;
  }

  #readingPacmanGame #choices,
  #readingPacmanGame .choices {
    grid-template-columns: 1fr;
  }

  #readingPacmanGame canvas#game,
  #readingPacmanGame #game {
    width: min(680px, 94vw) !important;
  }
}

@media (max-width: 640px) {
  #readingPacmanGame .cp_app {
    padding: 16px 10px;
  }

  #readingPacmanGame .screen {
    max-width: 96vw;
    gap: 14px;
  }

  #readingPacmanGame .title-top {
    font-size: clamp(1.75rem, 9vw, 2.6rem);
  }

  #readingPacmanGame .title-bottom {
    font-size: clamp(2.6rem, 14vw, 4rem);
  }

  #readingPacmanGame .cover,
  #readingPacmanGame #start-screen .cover {
    width: 92vw;
    border-width: 3px;
    outline-width: 4px;
  }

  #readingPacmanGame .pac-player-card,
  #readingPacmanGame .pac-student-login-card,
  #readingPacmanGame .pac-student-success-card {
    width: 94vw;
    padding: 18px 14px;
  }

  #readingPacmanGame .pac-setup-actions {
    flex-direction: column;
    align-items: stretch;
  }

  #readingPacmanGame .pac-setup-actions .btn {
    width: 100%;
  }

  #readingPacmanGame .grade-grid {
    grid-template-columns: 1fr;
  }

  #readingPacmanGame #prompt,
  #readingPacmanGame #question-text {
    font-size: 1rem;
  }

  #readingPacmanGame canvas#game,
  #readingPacmanGame #game {
    width: min(94vw, 520px) !important;
  }

  #readingPacmanGame .pac-final-stats {
    grid-template-columns: 1fr;
  }

  #readingPacmanGame .pac-leaderboard-row {
    grid-template-columns: 28px 34px minmax(0, 1fr);
  }

  #readingPacmanGame .pac-leaderboard-score {
    grid-column: 3;
    justify-self: start;
    margin-top: 4px;
  }
}

@media (max-width: 420px) {
  #readingPacmanGame .btn {
    min-height: 52px;
    padding: 12px 16px;
    font-size: .9rem;
  }

  #readingPacmanGame .screen-title,
  #readingPacmanGame .screen h1,
  #readingPacmanGame .screen h2 {
    font-size: clamp(1.5rem, 9vw, 2.2rem);
    text-shadow:
      0 3px 0 #000,
      0 0 18px rgba(255, 237, 0, .28);
  }

  #readingPacmanGame .mode-pill,
  #readingPacmanGame .theme-pill,
  #readingPacmanGame .skill-card,
  #readingPacmanGame #difficulty-screen .pill {
    padding: 14px;
    border-radius: 20px;
  }

  #readingPacmanGame .mode-visual,
  #readingPacmanGame .mode-canvas-preview {
    min-height: 130px;
  }

  #readingPacmanGame .pac-avatar-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #readingPacmanGame canvas#game,
  #readingPacmanGame #game {
    width: 92vw !important;
  }
}

/* =========================================================
   FINAL SCREEN SCROLL FIX
   Makes results scroll naturally with the page
   Stops header/topper overlap issues
   ========================================================= */

#readingPacmanGame #final-popup,
#readingPacmanGame #final-popup.show {
  display: flex !important;
  position: relative !important;
  inset: auto !important;
  width: 100% !important;
  min-height: auto !important;
  height: auto !important;
  padding: clamp(28px, 5vw, 64px) clamp(12px, 3vw, 24px) !important;
  align-items: flex-start !important;
  justify-content: center !important;
  overflow: visible !important;
  z-index: 1 !important;
}

#readingPacmanGame .pac-end-shell {
  width: min(1180px, 96vw) !important;
  max-height: none !important;
  height: auto !important;
  overflow: visible !important;
  display: grid !important;
  grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.1fr);
  align-items: start !important;
}

#readingPacmanGame .pac-end-hero {
  position: relative !important;
  top: auto !important;
  align-self: start !important;
}

#readingPacmanGame .pac-end-boards,
#readingPacmanGame .pac-board-stack,
#readingPacmanGame .pac-board-card,
#readingPacmanGame .pac-leaderboard-grid,
#readingPacmanGame .pac-leaderboard-card {
  position: relative !important;
  top: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

/* Keep the real round-end overlay working as a popup */
#readingPacmanGame #round-end.overlay {
  position: fixed !important;
  inset: 0 !important;
  z-index: 99999 !important;
}

/* Give sticky site header/topper room so it does not cover final results */
body:has(#readingPacmanGame #final-popup.show) #readingPacmanGame {
  scroll-margin-top: 180px;
}

/* If your ABZ topper/header is sticky, lower its stacking during final screen */
body:has(#readingPacmanGame #final-popup.show) #abzGameTopper {
  position: relative !important;
  top: auto !important;
  z-index: 1 !important;
}

/* Responsive final screen */
@media (max-width: 900px) {
  #readingPacmanGame .pac-end-shell {
    grid-template-columns: 1fr !important;
  }

  #readingPacmanGame #final-popup,
  #readingPacmanGame #final-popup.show {
    padding-top: 28px !important;
  }
}

@media (max-width: 620px) {
  #readingPacmanGame #final-popup,
  #readingPacmanGame #final-popup.show {
    padding: 18px 10px !important;
  }
}

/* =========================================================
   FINAL SCREEN TRUE PAGE FLOW FIX
   Prevents start screen + final screen from sitting side-by-side
   ========================================================= */

#readingPacmanGame .cp_app {
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-start !important;
}

/* Final results should behave like a normal full-width game section */
#readingPacmanGame #final-popup,
#readingPacmanGame #final-popup.show {
  position: relative !important;
  inset: auto !important;
  display: flex !important;
  width: 100% !important;
  max-width: 100% !important;
  min-height: auto !important;
  height: auto !important;
  padding: clamp(28px, 5vw, 64px) clamp(12px, 3vw, 24px) !important;
  align-items: flex-start !important;
  justify-content: center !important;
  overflow: visible !important;
  z-index: 2 !important;
}

/* Do not let final screen act like a modal scroll box */
#readingPacmanGame .pac-end-shell {
  width: min(1180px, 96vw) !important;
  max-width: 1180px !important;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  display: grid !important;
  grid-template-columns: minmax(300px, 0.9fr) minmax(420px, 1.1fr) !important;
  align-items: start !important;
  margin: 0 auto !important;
}

/* Stop sticky/floating behavior */
#readingPacmanGame .pac-end-hero,
#readingPacmanGame .pac-end-boards,
#readingPacmanGame .pac-board-stack,
#readingPacmanGame .pac-board-card {
  position: relative !important;
  top: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

/* Hide any normal game screen when the final screen is showing */
#readingPacmanGame.final-results-active .screen {
  display: none !important;
}

#readingPacmanGame.final-results-active #final-popup {
  display: flex !important;
}

/* Keep round popup as a real popup */
#readingPacmanGame #round-end.overlay {
  position: fixed !important;
  inset: 0 !important;
  z-index: 99999 !important;
}

/* Mobile/tablet */
@media (max-width: 900px) {
  #readingPacmanGame .pac-end-shell {
    grid-template-columns: 1fr !important;
  }
}

/* =========================================================
   FINAL SCREEN REPLACEMENT FIX
   Final screen replaces game screens instead of stacking below Start
   ========================================================= */

#readingPacmanGame .cp_app {
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-start !important;
}

#readingPacmanGame #final-popup,
#readingPacmanGame #final-popup.show {
  position: relative !important;
  inset: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  min-height: auto !important;
  height: auto !important;
  padding: clamp(28px, 5vw, 64px) clamp(12px, 3vw, 24px) !important;
  align-items: flex-start !important;
  justify-content: center !important;
  overflow: visible !important;
  z-index: 2 !important;
}

#readingPacmanGame .pac-end-shell {
  width: min(1180px, 96vw) !important;
  max-width: 1180px !important;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  display: grid !important;
  grid-template-columns: minmax(300px, 0.9fr) minmax(420px, 1.1fr) !important;
  align-items: start !important;
  margin: 0 auto !important;
}

#readingPacmanGame .pac-end-hero,
#readingPacmanGame .pac-end-boards,
#readingPacmanGame .pac-board-stack,
#readingPacmanGame .pac-board-card {
  position: relative !important;
  top: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

#readingPacmanGame.final-results-active .screen {
  display: none !important;
}

#readingPacmanGame.final-results-active #final-popup {
  display: flex !important;
}

#readingPacmanGame #round-end.overlay {
  position: fixed !important;
  inset: 0 !important;
  z-index: 99999 !important;
}

@media (max-width: 900px) {
  #readingPacmanGame .pac-end-shell {
    grid-template-columns: 1fr !important;
  }
}

/* =========================================================
   FINAL SCREEN CLEAN FIX
   Hidden by default. Shows only when JS adds .show.
   ========================================================= */

#readingPacmanGame .cp_app {
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-start !important;
}

/* Default: final screen must be hidden */
#readingPacmanGame #final-popup {
  display: none !important;
  position: relative !important;
  inset: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  min-height: auto !important;
  height: auto !important;
  padding: 0 !important;
  overflow: visible !important;
  z-index: 2 !important;
}

/* Only show final screen when JS adds .show */
#readingPacmanGame #final-popup.show {
  display: flex !important;
  padding: clamp(28px, 5vw, 64px) clamp(12px, 3vw, 24px) !important;
  align-items: flex-start !important;
  justify-content: center !important;
}

/* Final screen layout */
#readingPacmanGame .pac-end-shell {
  width: min(1180px, 96vw) !important;
  max-width: 1180px !important;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  display: grid !important;
  grid-template-columns: minmax(300px, 0.9fr) minmax(420px, 1.1fr) !important;
  align-items: start !important;
  margin: 0 auto !important;
}

/* Stop sticky/floating behavior */
#readingPacmanGame .pac-end-hero,
#readingPacmanGame .pac-end-boards,
#readingPacmanGame .pac-board-stack,
#readingPacmanGame .pac-board-card {
  position: relative !important;
  top: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

/* While final results are active, hide all normal game screens */
#readingPacmanGame.final-results-active .screen {
  display: none !important;
}

#readingPacmanGame.final-results-active #final-popup.show {
  display: flex !important;
}

/* Keep round-end popup as a real overlay */
#readingPacmanGame #round-end.overlay {
  position: fixed !important;
  inset: 0 !important;
  z-index: 99999 !important;
}

/* Mobile/tablet */
@media (max-width: 900px) {
  #readingPacmanGame .pac-end-shell {
    grid-template-columns: 1fr !important;
  }
}