/* ============================================================
   Leon's Pokémon Maze — the colours and shapes
   Want a different colour? Change it here and press refresh!
   ============================================================ */

:root {
  --sky-top:    #7fd4ff;   /* sky at the top */
  --sky-bottom: #b6f0c4;   /* grass colour at the bottom */
  --hedge:      #2f8f4e;   /* the maze walls */
  --hedge-dark: #1f6b39;
  --path:       #f6e3b4;   /* the sandy path you walk on */
  --path-line:  #ecd396;
  --ink:        #26323d;
  --pop:        #ff5470;   /* buttons */
  --gold:       #ffd93b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Comic Sans MS", "Comic Neue", "Chalkboard SE", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(var(--sky-top), var(--sky-bottom));
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  -webkit-tap-highlight-color: transparent;
}

.hidden { display: none !important; }

.screen {
  width: 100%;
  max-width: 820px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

h1 {
  margin: 8px 0 4px;
  font-size: clamp(28px, 7vw, 48px);
  color: #fff;
  text-shadow: 0 3px 0 var(--hedge-dark), 0 6px 12px rgba(0,0,0,.25);
  text-align: center;
}

.subtitle {
  margin: 0 0 20px;
  font-size: clamp(18px, 4vw, 24px);
}


/* ---------- Screen 1: choosing a Pokémon ---------- */

#pokemon-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  width: 100%;
}

.card {
  background: #fff;
  border: 4px solid var(--ink);
  border-radius: 22px;
  padding: 14px 10px 12px;
  cursor: pointer;
  text-align: center;
  box-shadow: 0 6px 0 var(--ink);
  transition: transform .1s, box-shadow .1s;
  font: inherit;
  color: inherit;
}
.card:hover  { transform: translateY(-3px); box-shadow: 0 9px 0 var(--ink); }
.card:active { transform: translateY(4px);  box-shadow: 0 2px 0 var(--ink); }

.card .avatar { width: 110px; height: 110px; }
.card .name   { font-size: 22px; margin-top: 8px; font-weight: bold; }
.card .draw-me { font-size: 13px; opacity: .6; margin-top: 2px; }


/* ---------- Pokémon pictures (photo, or a blob until you draw one) ---------- */

.avatar {
  display: block;
  margin: 0 auto;
  border-radius: 18px;
  object-fit: contain;       /* show the whole drawing, never crop it */
  background: transparent;   /* the drawings are cut out, so no white box */
}

.blob {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  border: 3px dashed rgba(255,255,255,.75);
  container-type: size;      /* lets the letter measure itself against the blob */
}

.blob span {
  font-weight: bold;
  line-height: 1;
  text-shadow: 0 2px 3px rgba(0,0,0,.35);
  font-size: 1.4rem;         /* fallback for older browsers */
  font-size: 46cqmin;        /* scales with the blob, big or small */
}


/* ---------- Screen 2: the HUD along the top ---------- */

#hud {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: #fff;
  border: 4px solid var(--ink);
  border-radius: 18px;
  padding: 8px 12px;
  margin-bottom: 12px;
  font-size: 20px;
  flex-wrap: wrap;
}

#hud-pokemon .avatar { width: 40px; height: 40px; }

.hud-item { display: flex; align-items: center; gap: 4px; font-weight: bold; }
.hud-icon { font-size: 24px; }
.hud-spacer { flex: 1; }

#key-status            { opacity: .3; filter: grayscale(1); transition: .2s; }
#key-status.have-key   { opacity: 1;  filter: none; transform: scale(1.15); }

#maze-label { font-size: 17px; opacity: .7; }

.tiny-btn {
  font: inherit;
  font-size: 20px;
  line-height: 1;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 12px;
  padding: 4px 8px;
  cursor: pointer;
}
.tiny-btn:active { transform: translateY(2px); }


/* ---------- The maze board ---------- */

#board-wrap {
  background: var(--hedge-dark);
  border: 5px solid var(--ink);
  border-radius: 18px;
  padding: 6px;
  box-shadow: 0 8px 0 rgba(0,0,0,.2);
}

#board {
  --cell: 44px;
  position: relative;
  display: grid;
  line-height: 1;
}

.cell {
  width: var(--cell);
  height: var(--cell);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--cell) * 0.6);
}

.cell.wall {
  background: var(--hedge);
  box-shadow: inset 0 0 0 2px var(--hedge-dark),
              inset 0 6px 0 rgba(255,255,255,.13);
}

.cell.floor {
  background: var(--path);
  box-shadow: inset 0 0 0 1px var(--path-line);
}

.cell.door         { background: #c9a227; box-shadow: inset 0 0 0 3px #8a6f13; }
.cell.door.open    { background: #7ef2a0; box-shadow: inset 0 0 0 3px #2f8f4e; animation: glow 1s infinite alternate; }

@keyframes glow { from { filter: brightness(1); } to { filter: brightness(1.35); } }

/* the little bounce when you pick something up */
.cell .item { animation: bob 1.4s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

/* the player sprite, gliding from square to square */
#player {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--cell);
  height: var(--cell);
  padding: 2px;
  transition: transform .12s ease-out;
  z-index: 2;
  pointer-events: none;
}
#player .avatar { width: 100%; height: 100%; }

/* the drawings all look left, so walking right mirrors them */
#player.facing-right .avatar { transform: scaleX(-1); }

#player.bump { animation: bump .2s; }
@keyframes bump { 50% { filter: brightness(1.6) saturate(2); } }

#hint { font-size: 16px; opacity: .75; margin: 12px 0 4px; text-align: center; }


/* ---------- The arrow buttons ---------- */

#dpad { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 4px; }
.pad-row { display: flex; gap: 8px; }

.pad {
  width: 64px;
  height: 56px;
  font-size: 26px;
  background: var(--pop);
  color: #fff;
  border: 4px solid var(--ink);
  border-radius: 16px;
  box-shadow: 0 5px 0 var(--ink);
  cursor: pointer;
  user-select: none;
}
.pad:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }


/* ---------- Screen 3: winning ---------- */

#win-pokemon .avatar { width: 160px; height: 160px; animation: cheer .6s ease-in-out infinite alternate; }
@keyframes cheer { from { transform: rotate(-6deg) translateY(0); } to { transform: rotate(6deg) translateY(-10px); } }

#win-text { font-size: 24px; text-align: center; margin: 16px 0 24px; }

.big-btn {
  font: inherit;
  font-size: 24px;
  background: var(--gold);
  border: 4px solid var(--ink);
  border-radius: 18px;
  padding: 12px 28px;
  margin: 6px;
  cursor: pointer;
  box-shadow: 0 6px 0 var(--ink);
}
.big-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--ink); }
.big-btn.secondary { background: #fff; }
