/* =========================================================
   FONTS
   ========================================================= */
/* Example with Orbitron */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&display=swap');
/* or with Audiowide */
@import url('https://fonts.googleapis.com/css2?family=Audiowide&display=swap');


/* =========================================================
   DESIGN TOKENS — Pac-Man palette
   ========================================================= */
:root{
  /* Core palette */
  --bg:#050507;                 /* cabinet black */
  --maze:#0037ff;               /* maze wall blue */
  --maze-dark:#001a9e;          /* inner rim blue */
  --pacman:#ffed00;             /* Pac-Man yellow */
  --pellet:#ffe9a5;             /* small pellet */
  --white:#F5F7FA;

  /* Ghost accents */
  --ghost-red:#ff0000;          /* blinky */
  --ghost-pink:#ff74c6;         /* pinky */
  --ghost-cyan:#00ffff;         /* inky */
  --ghost-orange:#ff9900;       /* clyde */

  /* UI neutrals */
  --panel:#0b0f1d;
  --panel-2:#0e1224;
  --muted:#b9c0cc;
  --shadow: 0 12px 30px rgba(0,0,0,.55);
  --radius:16px;
}

/* =========================================================
   GLOBAL
   ========================================================= */
*{ box-sizing:border-box; }
html, body { height:100%; }
.cp_app{
  margin:0;
  background:
    radial-gradient(1200px 800px at 50% -10%, #0b1530 0%, #070812 35%, var(--bg) 100%);
  color:var(--white);
  font-family: 'Orbitron', 'Audiowide', system-ui, sans-serif;
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}

.prompt, .question-text, .choices button {
  font-family: 'Orbitron', sans-serif; 
  font-weight: 700;
}
button{ cursor:pointer; }

/* App layout */
.cp_app{
  display:flex;
  width:100%;
  min-height:100vh;
  justify-content:center;
  align-items:center;
  padding:40px 24px;
}

/* Screens */
.screen{
  width:100%;
  max-width:1200px;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:20px;
}

/* =========================================================
   TITLES
   ========================================================= */
.app-title{
  margin:.2rem 0 1rem;
  text-align:center;
  line-height:.9;
  letter-spacing:.4px;
}
.title-top{
  display:block;
  font-size: clamp(28px, 5vw, 54px);
  font-weight:800;
  color:var(--white);
  opacity:.92;
  font-family:"Press Start 2P", system-ui;
  letter-spacing:1px;
}
.title-bottom{
  display:block;
  font-size: clamp(42px, 8vw, 84px);
  color:var(--pacman);
  text-shadow:
    0 0 0 #000,
    0 0 22px rgba(255,237,0,.35),
    0 0 6px rgba(0,0,0,.8);
  font-family:"Press Start 2P", system-ui;
  letter-spacing:2px;
}

/* Section titles */
.screen-title{
  font-size: clamp(18px, 3.4vw, 32px);
  font-family:"Press Start 2P", system-ui;
  color: var(--pacman);
  text-shadow: 0 0 14px rgba(255,237,0,.45);
  margin: 6px 0 12px;
}

/* Cover (global baseline) */
.cover{
  width: 40rem;
  border-radius: 18px;
  box-shadow: var(--shadow), 0 0 28px rgba(255,237,0,.18);
  border:3px solid var(--maze);
  outline: 8px solid var(--maze-dark);
  object-fit: cover;
  margin-bottom: 10px;
}

/* =========================================================
   START SCREEN — Arcade Hero
   ========================================================= */

#start-screen{
  position:relative;
  isolation:isolate;
  padding: 34px 0 40px;
  text-align:center;
}

#start-screen::before{
  content:"";
  position:absolute;
  inset:-16vh -10vw;
  background:
    radial-gradient(1200px 780px at 50% 0%, rgba(255,237,0,.20), transparent 55%),
    radial-gradient(1000px 640px at 8% 90%, rgba(0,55,255,.16), transparent 68%),
    radial-gradient(900px 620px at 92% 80%, rgba(255,0,0,.16), transparent 72%);
  filter:blur(3px);
  z-index:-2;
}
#start-screen::after{
  content:"";
  position:absolute;
  inset:auto 0 0 0;
  height:260px;
  background:linear-gradient(180deg, rgba(255,255,255,.05), rgba(0,0,0,0));
  z-index:-1;
}

#start-screen .app-title{
  margin-bottom: 20px;
}

/* beefed up frame just on the hero */
#start-screen .cover{
  width:min(640px, 96vw);
  border-radius:24px;
  border:4px solid var(--maze);
  outline:10px solid var(--maze-dark);
  box-shadow:
    0 0 0 3px #000 inset,
    0 20px 0 rgba(0,0,0,.85),
    0 26px 54px rgba(0,0,0,.9),
    0 0 40px rgba(255,237,0,.25);
  margin-bottom: 18px;
}

#start-screen .start-btn{
  width:min(480px, 88vw);
  font-size: clamp(18px, 3.4vw, 28px);
  margin-top:10px;
  border-radius: 18px;
  box-shadow:
    0 8px 0 #000,
    0 0 26px rgba(255,237,0,.48),
    0 0 34px rgba(255,237,0,.35);
}

/* optional tagline if you add one */
#start-screen .start-tagline{
  margin-top: 8px;
  font-size: 13px;
  text-transform:uppercase;
  letter-spacing:.12em;
  color:var(--muted);
}

/* =========================================================
   PRIMARY BUTTON
   ========================================================= */
.btn{
  appearance:none;
  border:none;
  user-select:none;
  background: linear-gradient(180deg, var(--pacman), #e5cc00);
  color:#18120a;
  font-weight:900;
  letter-spacing:.6px;
  border-radius: 14px;
  padding:16px 24px;
  font-size:18px;
  font-family:"Press Start 2P", system-ui;
  box-shadow: 0 6px 0 #000, 0 0 22px rgba(255,237,0,.38);
  transition: transform .08s ease, box-shadow .2s ease, filter .15s ease;
}
.btn:hover{
  transform: translateY(-1px);
  box-shadow: 0 8px 0 #000, 0 0 26px rgba(255,237,0,.48);
}
.btn:active{
  transform: translateY(0);
  filter:saturate(1.06) contrast(1.03);
}
.start-btn{ width:min(520px, 90vw); font-size: clamp(18px, 3.4vw, 28px); }

/* =========================================================
   SKILL SELECTION (Pac-maze card language)
   ========================================================= */
/* =========================================================
   SKILL SELECTION — Pac-maze card language (v2)
   ========================================================= */
#select-screen{
  position:relative;
  isolation:isolate;
  padding: 30px 0 40px;
  display:flex;
  flex-direction:column;
  align-items:center;
}

#select-screen::before{
  content:"";
  position:absolute;
  inset:-12vh -8vw;
  background:
    radial-gradient(1000px 600px at 50% 15%, rgba(0,55,255,.18), transparent 62%),
    radial-gradient(1200px 700px at 85% 60%, rgba(255,237,0,.12), transparent 66%),
    radial-gradient(900px 600px  at 15% 70%, rgba(255,0,0,.10), transparent 68%);
  filter: blur(3px);
  z-index:-2;
}
#select-screen::after{
  content:"";
  position:absolute;
  inset:auto 0 0 0;
  height: 260px;
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(0,0,0,.00));
  z-index:-1;
}

/* grid wrapper */
.select-wrap{
  width:100%;
  max-width: 1040px;
  display:flex;
  flex-direction:column;
  gap: 24px;
  margin-top: 10px;
}

/* Pac-maze glass cards */
.skill-card{
  position:relative;
  width:100%;
  background:
    radial-gradient(circle at 0% 0%, rgba(0,55,255,.28), transparent 55%),
    radial-gradient(circle at 100% 100%, rgba(0,0,0,.92), #05070f 70%);
  border-radius: 22px;
  padding: 18px 18px 20px;
  border: 3px solid rgba(0,55,255,.85);
  box-shadow:
    0 0 0 8px rgba(0,0,0,.9) inset,
    0 20px 36px rgba(0,0,0,.85),
    0 0 30px rgba(0,55,255,.40);
  backdrop-filter: blur(16px);
  display:flex;
  flex-direction:column;
  gap: 14px;
  overflow:hidden;
  transition:
    transform .10s ease,
    box-shadow .25s ease,
    border-color .25s ease,
    filter .25s ease,
    background-position .35s ease;
}

.skill-card::after{
  /* subtle vertical shine */
  content:"";
  position:absolute;
  inset:0;
  background: radial-gradient(300px 120% at 0% 0%, rgba(255,255,255,.08), transparent 60%);
  mix-blend-mode:screen;
  opacity:.6;
  pointer-events:none;
}

.skill-card:hover{
  transform: translateY(-3px);
  border-color: var(--pacman);
  box-shadow:
    0 0 0 8px rgba(0,0,0,.92) inset,
    0 24px 44px rgba(0,0,0,.95),
    0 0 40px rgba(255,237,0,.45);
  filter:saturate(1.06);
}

/* header row */
.skill-header{
  position:relative;
  z-index:1;
  display:flex;
  align-items:flex-start;
  gap: 14px;
}

.skill-icon{
  width:56px;
  height:56px;
  display:grid;
  place-items:center;
  font-size:22px;
  background:
    radial-gradient(circle at 30% 0%, rgba(255,255,255,.22), transparent 70%),
    radial-gradient(circle at 70% 100%, rgba(0,55,255,.40), rgba(0,55,255,.16));
  border-radius: 16px;
  border:2px solid rgba(0,55,255,.9);
  box-shadow:
    0 0 18px rgba(0,55,255,.55),
    0 0 0 4px rgba(0,0,0,.85) inset;
  color:#eaf2ff;
}

.skill-title{
  margin:0;
  font-size: clamp(18px, 2.6vw, 26px);
  font-weight:900;
  letter-spacing:.3px;
  color:#eaf2ff;
  font-family:"Press Start 2P", system-ui;
}

.skill-sub{
  margin:.25rem 0 0;
  color:#cfe6ff;
  opacity:.9;
  font-size:12px;
}

/* subtle divider between header + grades */
.skill-meta-row{
  margin-top: 6px;
  font-size: 11px;
  text-transform:uppercase;
  letter-spacing:.16em;
  color:#9fb3ff;
  opacity:.85;
}

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

/* Grade buttons — bigger Pac pills */
.grade-btn{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  justify-content:center;
  text-align:left;
  padding:14px 16px;
  min-height:60px;
  width:100%;
  color:#111;
  font-weight:900;
  background: radial-gradient(circle at 20% 0%, #fff7a8, #ffd900);
  border:2px solid #e5cc00;
  border-radius:999px;
  box-shadow:
    0 6px 0 #000,
    0 0 18px rgba(255,237,0,.40);
  transition:
    transform .08s ease,
    box-shadow .18s ease,
    filter .18s ease,
    border-color .18s ease;
  position:relative;
  overflow:hidden;
  font-family:"Press Start 2P", system-ui;
}

.grade-btn::after{
  /* tiny moving shine */
  content:"";
  position:absolute;
  inset:0;
  background:linear-gradient(120deg, rgba(255,255,255,.28), transparent 60%);
  mix-blend-mode:screen;
  opacity:.0;
  transform: translateX(-40%);
  transition: opacity .2s ease, transform .3s ease;
}

.grade-btn strong{
  font-size: 1.05rem;
  line-height:1.1;
}

.grade-btn span{
  font-size:10px;
  opacity:.9;
  font-weight:900;
  margin-top:4px;
}

.grade-btn:hover{
  transform: translateY(-2px) scale(1.04);
  box-shadow:
    0 8px 0 #000,
    0 0 24px rgba(255,237,0,.60);
  filter:saturate(1.08);
  border-color:#fff06b;
}

.grade-btn:hover::after{
  opacity:.85;
  transform: translateX(0%);
}

.grade-btn:active{
  transform: translateY(1px) scale(1.01);
}


/* =========================================================
   DIFFICULTY — Ghost Gauntlet
   ========================================================= */
#difficulty-screen{
  position:relative;
  isolation:isolate;
  padding: 30px 0 40px;
  text-align:center;
}
#difficulty-screen::before{
  content:"";
  position:absolute;
  inset:-14vh -10vw;
  background:
    radial-gradient(1100px 700px at 50% 10%, rgba(255,237,0,.14), transparent 60%),
    radial-gradient(1000px 600px at 10% 80%, rgba(0,55,255,.16), transparent 66%),
    radial-gradient(900px 600px  at 90% 70%, rgba(255,0,0,.12), transparent 70%);
  filter:blur(3px);
  z-index:-2;
}
#difficulty-screen::after{
  content:"";
  position:absolute;
  inset:auto 0 0 0;
  height:260px;
  background:linear-gradient(180deg, rgba(255,255,255,.05), rgba(0,0,0,0));
  z-index:-1;
}

/* row layout */
.pill-row{
  display:grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap:18px;
  width:min(980px, 92vw);
  margin-top:10px;
}

/* base pill card */
.pill{
  position:relative;
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  justify-content:flex-start;
  padding:18px 16px 20px;
  min-height:120px;
  text-align:left;
  color:#f5f7ff;
  font-weight:800;
  border-radius:18px;
  border:3px solid rgba(255,255,255,.08);
  background: radial-gradient(circle at 20% 0%, rgba(255,255,255,.06), transparent 55%),
              radial-gradient(circle at 100% 100%, rgba(0,0,0,.85), #050507 65%);
  box-shadow:
    0 0 0 6px rgba(0,0,0,.9) inset,
    0 16px 32px rgba(0,0,0,.7);
  overflow:hidden;
  transition:
    transform .12s ease,
    box-shadow .22s ease,
    border-color .18s ease,
    filter .18s ease,
    background-position .3s ease;
}
.pill .pill-title{
  font-size:1.2rem;
  font-family:"Press Start 2P", system-ui;
  margin-bottom:4px;
}
.pill .pill-sub{
  font-size:.8rem;
  opacity:.9;
  margin-top:2px;
}

/* ghost icon bubble */
.pill::before{
  content:"👻";
  position:absolute;
  top:10px;
  right:12px;
  font-size:26px;
  filter:drop-shadow(0 0 8px rgba(0,0,0,.8));
  opacity:.9;
  transform-origin:center;
  transition: transform .14s ease, opacity .18s ease;
}

/* difficulty meter */
.pill::after{
  content:"";
  position:absolute;
  left:16px;
  bottom:14px;
  height:8px;
  width:72%;
  border-radius:999px;
  background:linear-gradient(90deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  box-shadow: inset 0 0 0 2px rgba(0,0,0,.9);
}

/* hover */
.pill:hover{
  transform: translateY(-3px) scale(1.02);
  filter:saturate(1.05);
  box-shadow:
    0 0 0 6px rgba(0,0,0,.85) inset,
    0 22px 40px rgba(0,0,0,.85);
}
.pill:hover::before{
  transform: translateY(-2px) scale(1.07);
  opacity:1;
}

/* EASY – calm neon green */
#difficulty-easy{
  border-color: #54f29c;
  background:
    radial-gradient(circle at 15% 0%, rgba(84,242,156,.25), transparent 60%),
    radial-gradient(circle at 100% 100%, rgba(0,0,0,.85), #050507 60%);
  box-shadow:
    0 0 22px rgba(84,242,156,.35),
    0 16px 32px rgba(0,0,0,.8);
}
#difficulty-easy::after{
  background:linear-gradient(90deg,
    #54f29c 0%, #54f29c 25%,
    rgba(84,242,156,.15) 25%, rgba(84,242,156,.04) 100%);
}

/* MEDIUM – charged cyan */
#difficulty-medium{
  border-color:#00e5ff;
  background:
    radial-gradient(circle at 20% 0%, rgba(0,229,255,.3), transparent 60%),
    radial-gradient(circle at 100% 100%, rgba(0,0,0,.85), #050507 60%);
  box-shadow:
    0 0 22px rgba(0,229,255,.35),
    0 16px 32px rgba(0,0,0,.8);
}
#difficulty-medium::after{
  background:linear-gradient(90deg,
    #00e5ff 0%, #00e5ff 50%,
    rgba(0,229,255,.18) 50%, rgba(0,229,255,.04) 100%);
}

/* HARD – aggressive red */
#difficulty-hard{
  border-color:#ff3b3b;
  background:
    radial-gradient(circle at 20% 0%, rgba(255,76,76,.3), transparent 60%),
    radial-gradient(circle at 100% 100%, rgba(0,0,0,.9), #050507 60%);
  box-shadow:
    0 0 24px rgba(255,76,76,.4),
    0 18px 36px rgba(0,0,0,.9);
}
#difficulty-hard::after{
  background:linear-gradient(90deg,
    #ff3b3b 0%, #ff3b3b 75%,
    rgba(255,76,76,.18) 75%, rgba(255,76,76,.04) 100%);
}

/* EXTREME – danger zone purple/red */
#difficulty-extreme{
  border-color:#ff00ff;
  background:
    radial-gradient(circle at 12% 0%, rgba(255,0,255,.35), transparent 60%),
    radial-gradient(circle at 100% 100%, rgba(0,0,0,1), #050507 60%);
  box-shadow:
    0 0 30px rgba(255,0,255,.55),
    0 20px 44px rgba(0,0,0,1);
  animation: extremeGlow 1.8s ease-in-out infinite alternate;
}
#difficulty-extreme::before{
  content:"💀";
}
#difficulty-extreme::after{
  background:linear-gradient(90deg,
    #ff00ff 0%, #ff00ff 100%);
}

@keyframes extremeGlow{
  from{
    box-shadow:
      0 0 26px rgba(255,0,255,.45),
      0 18px 40px rgba(0,0,0,1);
    filter:saturate(1);
  }
  to{
    box-shadow:
      0 0 38px rgba(255,0,255,.75),
      0 24px 52px rgba(0,0,0,1);
    filter:saturate(1.08);
  }
}

/* =========================================================
   CONTROL SCREEN — Centered Buttons
   ========================================================= */

#control-screen{
  position:relative;
  isolation:isolate;
  padding: 26px 0 34px;
  text-align:center;
}

#control-screen .pill-row{
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  gap:16px;
  width:min(720px, 92vw);
  margin: 12px auto 0;
}

#control-screen .pill{
  align-items:center;
  text-align:center;
  min-width:min(260px, 100%);
}

/* Grade/Difficulty responsive */
@media (max-width: 980px){
  .select-wrap{ grid-template-columns: 1fr; }
  .grade-grid{ grid-template-columns: repeat(2, minmax(160px, 1fr)); }
  .pill-row{ grid-template-columns: 1fr; }
}
@media (max-width: 520px){
  .grade-grid{ grid-template-columns: 1fr; }
}

/* =========================================================
   QUESTION SCREEN — Pac-look
   ========================================================= */
/* =========================================================
   QUESTION SCREEN — Neon question console
   ========================================================= */
/* =========================================================
   QUESTION SCREEN — Neon question console
   ========================================================= */
#question-screen {
  width: 100%;
  max-width: 1200px;
  padding: 18px 0 22px;
  position: relative;
  isolation: isolate;

  /* IMPORTANT: hide by default so it doesn't show on start */
  display: none;

  /* (these are harmless to keep even without flex) */
  align-items: center;
  gap: 16px;
}

#question-screen::before {
  content: "";
  position: absolute;
  inset: -8vh -6vw;
  background:
    radial-gradient(1200px 800px at 50% -20%, rgba(0,55,255,.14), transparent 60%),
    radial-gradient(900px 600px  at 80% 20%, rgba(255,237,0,.12), transparent 62%),
    radial-gradient(700px 500px  at 20% 60%, rgba(255,0,0,.10), transparent 66%);
  filter: blur(3px);
  z-index: -2;
}

/* main neon card */
.question-panel{
  position:relative;
  width: min(980px, 94vw);
  padding: 24px 24px 20px;
  border-radius: 26px;
  background:
    radial-gradient(circle at 0% 0%, rgba(0,55,255,.30), transparent 60%),
    radial-gradient(circle at 100% 100%, rgba(0,0,0,.96), #05060f 70%);
  border: 3px solid rgba(0,55,255,.95);
  box-shadow:
    0 0 0 9px rgba(0,0,0,.92) inset,
    0 26px 52px rgba(0,0,0,.95),
    0 0 38px rgba(0,55,255,.45);
  backdrop-filter: blur(18px);
  display:flex;
  flex-direction:column;
  align-items:center;
  gap: 12px;
  overflow:hidden;
}

.question-panel::before{
  /* subtle animated sweep across the card */
  content:"";
  position:absolute;
  top:-40%; left:-60%;
  width:70%; height:180%;
  background: radial-gradient(circle at 0% 50%, rgba(255,255,255,.16), transparent 70%);
  opacity:.0;
  transform: translateX(-10%);
  animation: questionSweep 4s linear infinite;
  mix-blend-mode:screen;
  pointer-events:none;
}

@keyframes questionSweep{
  0%   { opacity:0;   transform: translateX(-20%); }
  40%  { opacity:.65; transform: translateX(20%); }
  100% { opacity:0;   transform: translateX(80%); }
}

/* content widths */
#prompt,
#question-text,
#choices,
.retry,
.progress-bar,
.hint{
  width: 100%;
}

/* Prompt / stem */
.prompt{
  margin-top: 4px;
  font-size: clamp(20px, 3.6vw, 32px);
  color: #fff;
  text-align:center;
  letter-spacing:.3px;
  font-weight: 700;
  font-family:"Press Start 2P", system-ui;
}

.question-text{
  margin-top: 6px;
  font-weight: 600;
  text-align: center;
  color: #eaf2ff;
  font-size: clamp(18px, 3.2vw, 26px);
  line-height: 1.45;
  text-shadow:
    0 0 18px rgba(0,55,255,.18),
    0 0 2px rgba(255,255,255,.60);
}

/* Answer choices — neon rails */
.choices{
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  place-items: center;
}

.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: #fff;
  font-weight: 800;
  font-size: clamp(15px, 2.8vw, 21px);
  letter-spacing: .2px;
  font-family:"Press Start 2P", system-ui;
  box-shadow:
    0 0 0 8px var(--maze-dark) inset,
    0 7px 0 #000,
    0 12px 26px rgba(0,55,255,.28);
  transition:
    transform .08s ease,
    box-shadow .18s ease,
    border-color .18s ease,
    background .2s ease,
    color .2s ease,
    filter .18s ease;
  position: relative;
  overflow: hidden;
}

.choices button::after{
  content:"";
  position:absolute;
  inset:0;
  background:linear-gradient(120deg, rgba(255,255,255,.24), transparent 60%);
  opacity:0;
  transform: translateX(-40%);
  transition: opacity .18s ease, transform .28s ease;
  mix-blend-mode:screen;
}

.choices button:hover,
.choices button:focus-visible{
  border-color: var(--pacman);
  background: radial-gradient(circle at 0% 0%, #1d2141, #131629 80%);
  color:#fff;
  box-shadow:
    0 0 0 8px var(--maze-dark) inset,
    0 9px 0 #000,
    0 0 30px rgba(255,237,0,.42);
  transform: translateY(-1px);
  filter:saturate(1.08);
}

.choices button:hover::after,
.choices button:focus-visible::after{
  opacity:.9;
  transform: translateX(0%);
}

.choices button:active{
  transform: translateY(1px) scale(.996);
}

/* Right/Wrong borders still work via JS */
.choices button.correct { border-color: var(--pacman); }
.choices button.wrong   { border-color: var(--ghost-red); }

/* Retry */
.retry{
  color:#ff9b9b;
  font-weight:900;
  letter-spacing:.3px;
  text-shadow: 0 0 14px rgba(255,98,98,.35);
  margin: 8px 0 0;
  text-align:center;
  font-family:"Press Start 2P", system-ui;
}
.pulse{ animation: pulse .9s ease; }
@keyframes pulse {
  0%{ transform:scale(1); opacity:.95; }
  30%{ transform:scale(1.03); opacity:1; }
  100%{ transform:scale(1); opacity:.95; }
}

/* Progress bar — Pac-dots filling */
.progress-bar{
  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,.16);
  display: grid;
  grid-auto-flow: column;
  gap: 4px;
  padding: 3px 6px;
  margin: 12px auto 4px;
}

.progress-bar .segment{
  border-radius: 999px;
  background: radial-gradient(circle at 50% 50%, #1b223a 0%, #12192e 60%);
  transition: background .25s ease, box-shadow .25s ease, transform .15s ease;
}

.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,.55), 0 0 20px rgba(255,237,0,.28);
  transform: scale(1.02);
}

/* Hint text */
.hint{
  color:#e7ecf7;
  opacity:.92;
  font-size:12px;
  text-align:center;
  margin:6px 0 2px;
  font-family:"Press Start 2P", system-ui;
}

/* Canvas frame (maze bezel) */
#game{
  border:10px solid var(--maze);
  background:#000;
  max-width:95vw;
  max-height:85vh;
  touch-action:none;
  box-shadow: 0 0 0 8px var(--maze-dark) inset, 0 16px 40px rgba(0,0,0,.6);
  border-radius:10px;
}

/* Overlays */
.overlay{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.72);
  display:none;
  align-items:center;
  justify-content:center;
  z-index:1000;
}
.modal{
  background: linear-gradient(#060810,#070a14);
  padding:28px 36px;
  border:3px solid var(--maze);
  border-radius:14px;
  text-align:center;
  box-shadow: 0 0 0 8px var(--maze-dark) inset, 0 0 18px rgba(255,237,0,.25);
}
.modal h2{
  color:var(--pacman);
  margin:6px 0 10px;
  font-family:"Press Start 2P", system-ui;
}
.modal .btn{ margin-top:8px; }

/* Focus */
:focus-visible{
  outline:3px solid var(--pacman);
  outline-offset:2px;
  border-radius:8px;
}

/* Overlay must sit above site header/footers */
.cp_app .overlay{
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.72);
  z-index: 99999;
  pointer-events: none;
}
.cp_app .overlay.show{
  display: flex;
  pointer-events: auto;
  animation: cpFadeIn .15s ease-out;
}
@keyframes cpFadeIn { from { opacity: 0 } to { opacity: 1 } }

.cp_app .modal{
  background: linear-gradient(#060810,#070a14);
  padding: 28px 36px;
  border: 3px solid var(--maze);
  border-radius: 14px;
  text-align: center;
  box-shadow: 0 0 0 8px var(--maze-dark) inset, 0 0 18px rgba(255,237,0,.25);
  max-width: min(92vw, 520px);
}
.cp_app .modal h2{
  color: var(--pacman);
  margin: 6px 0 10px;
  font-family: "Press Start 2P", system-ui;
}

/* A11y helper */
.cp_app .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;
}

/* Search bar layout */
.cp_app .skill-search { width:min(980px, 92vw); margin: 6px 0 12px; }
.cp_app .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,.18);
  border-radius: 14px;
  padding: 8px;
}
.cp_app #skillFilter{
  flex:1;
  background: transparent;
  border:0;
  color:#eaf2ff;
  font-size:15px;
  outline:none;
  padding:10px 12px;
  font-family: 'Orbitron', system-ui, sans-serif;
}
.cp_app #skillFilter::placeholder{ color:#9fb3d9; opacity:.9; }
.cp_app #skillClear{
  appearance:none;
  border:0;
  background:#1b2340;
  color:#eaf2ff;
  font-weight:900;
  width:36px;
  height:36px;
  border-radius:10px;
  cursor:pointer;
  box-shadow: 0 0 0 4px var(--maze-dark) inset;
}
.cp_app #skillClear:hover{ filter:saturate(1.06); }

.cp_app .skill-results{
  margin-top:6px;
  font-size:12px;
  color:#cfe6ff;
  opacity:.95;
  font-family:"Press Start 2P", system-ui;
}

/* Highlight matches */
.cp_app mark.hl{
  background: #fff3a3;
  color:#111;
  padding:0 .15em;
  border-radius:4px;
  box-shadow: 0 0 0 2px rgba(255,237,0,.35);
}

/* Smooth hide/show */
.cp_app .is-hidden { display:none !important; }

/* Responsive tweaks */
@media (max-width: 600px){
  .question-text{ font-size: clamp(18px, 5vw, 22px); }
  .choices button{ padding: 14px 14px; }
  .bottom-ui{ flex-direction: column; align-items: stretch; gap:10px; }
}

/* ----------------------------------------------
   GLOBAL RESPONSIVE TUNING
---------------------------------------------- */

/* Tablets landscape / small laptops (≤ 1024px) */
@media (max-width: 1024px){
  .cp_app{ padding: 36px 22px; }
  #select-screen .select-wrap{ grid-template-columns: 1fr; gap: 18px; }
  .grade-grid{ grid-template-columns: repeat(3, minmax(150px, 1fr)); }
  .pill-row{ display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .pill{ margin-left: 0; }
  #game{ width: 96vw; height: auto; max-height: 70vh; }
  .bottom-ui{ gap: 10px; }
  .choices button{ max-width: 92vw; }
}

/* Tablets portrait / large phones (≤ 820px) */
@media (max-width: 820px){
  .cp_app{ padding: 28px 18px; }
  .skill-card{ padding: 14px; border-width: 3px; }
  .grade-grid{ grid-template-columns: repeat(2, minmax(160px, 1fr)); }
  .pill-row{ grid-template-columns: 1fr 1fr; }
  .pill{ min-height: 78px; }
  .choices{ gap: 10px; }
  .choices button{ padding: 14px 14px; font-size: clamp(15px, 2.6vw, 20px); }
  .progress-bar{ height: 14px; width: min(700px, 92vw); }
  .hud-chip{ font-size: 12px; padding: 7px 10px; }
  .hint{ font-size: 12px; }
}

/* Phones (≤ 600px) */
@media (max-width: 600px){
  .cp_app{ padding: 22px 14px; }
  .cover{ width: 92vw; border-width: 2px; outline-width: 6px; }
  .skill-card{ border-width: 3px; border-radius: 14px; }
  .skill-header{ gap: 12px; }
  .skill-icon{ width: 48px; height: 48px; border-radius: 12px; }
  .grade-grid{ grid-template-columns: 1fr; }
  .grade-btn{ min-height: 52px; padding: 12px 14px; }
  .grade-btn strong{ font-size: 13px; }
  .grade-btn span{ font-size: 10px; }
  #control-screen .pill-row{ grid-template-columns: 1fr; }
  .pill{ min-height: 72px; }
  #prompt{ font-size: clamp(18px, 5.8vw, 26px); }
  .question-text{ font-size: clamp(16px, 4.4vw, 20px); }
  .progress-bar{ height: 12px; padding: 2px 5px; }
  .progress-bar .segment.filled{ box-shadow: 0 0 8px rgba(255,237,0,.5), 0 0 16px rgba(255,237,0,.25); }
  .bottom-ui{ flex-direction: column; align-items: stretch; gap: 8px; }
  #game{ width: 96vw; height: auto; max-height: 64vh; border-width: 8px; box-shadow: 0 0 0 6px var(--maze-dark) inset, 0 12px 30px rgba(0,0,0,.55); }
  .modal{ width: min(92vw, 520px); padding: 22px 18px; }
}

/* Small phones (≤ 420px) */
@media (max-width: 420px){
  .cp_app{ padding: 18px 10px; }
  .title-top{ font-size: clamp(22px, 7vw, 32px); }
  .title-bottom{ font-size: clamp(34px, 10vw, 56px); }
  .btn{ padding: 14px 16px; font-size: 16px; border-radius: 12px; }
  .start-btn{ width: 92vw; }
  .skill-card{ padding: 12px; }
  .pill{ min-height: 66px; padding: 14px 12px; }
  .choices button{ font-size: clamp(14px, 4vw, 18px); border-width: 2px; }
  #game{ border-width: 6px; border-radius: 8px; }
  .hud-chip{ font-size: 11px; padding: 6px 9px; border-width: 2px; }
  .retry{ font-size: 12px; }
}

/* Ultra-compact (≤ 360px) */
@media (max-width: 360px){
  .cp_app{ padding: 14px 8px; }
  .skill-card{ border-width: 2px; border-radius: 12px; }
  .grade-btn{ padding: 10px 12px; min-height: 48px; }
  .pill{ min-height: 62px; border-width: 3px; }
  .progress-bar{ height: 10px; gap: 3px; }
  .modal{ width: 94vw; padding: 18px 14px; border-width: 2px; }
}


  /* Very short viewports (e.g., landscape phones) */
@media (orientation: landscape) and (max-height: 480px){
  .cover{ display: none; }
  .cp_app{ padding: 10px; }
  #select-screen, #difficulty-screen, #control-screen{ padding: 10px 0 14px; }
  #game{ max-height: 68vh; width: 96vw; }
  .hint{ display: none; }
  .modal{ width: 86vw; padding: 16px; }
}

/* Touch-first tweaks (bigger hit targets, no hover reliance) */
@media (hover: none), (pointer: coarse){
  .grade-btn,
  .choices button,
  .pill,
  .btn{ padding-block: calc(1em + 4px); }
  .choices button:hover{ transform: none; }
  .grade-btn:hover{ transform: none; }
}

/* Reduced motion accessibility */
@media (prefers-reduced-motion: reduce){
  *{ animation: none !important; transition: none !important; }
  .pulse{ animation: none !important; }
}

/* Respect iOS safe areas (notches) */
@supports (padding: max(0px)){
  body{
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
    padding-bottom: max(0px, env(safe-area-inset-bottom));
  }
}

/* Make sure the canvas never causes pull-to-refresh or highlight issues */
canvas{
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
