/* game-wizard.css — the start popup and the step-by-step Game Wizard.
   Built for 5–15 year olds: big tap targets, chunky arcade bevels,
   the page's Pixelify Sans font, bright colours on a night-teal
   background. See game-wizard.js. */

.gw-launch, .gw {
  --gw-ink: #0e4242;
  --gw-night: #0e4242;
  --gw-night2: #175c5c;
  --gw-card: #f4f7dc;
  --gw-edge: #0e4242;
  --gw-yellow: #fde047;
  --gw-green: #22c55e;
  --gw-green-lo: #15803d;
  --gw-green-hi: #86efac;
  --gw-orange: #f97316;
  --gw-aqua: #67d8d0;
  font-family: "Pixelify Sans", system-ui, sans-serif;
  color: var(--gw-ink);
}
body.gw-open { overflow: hidden; }

/* starry night backdrop shared by both */
.gw-launch, .gw {
  position: fixed; inset: 0;
  background:
    radial-gradient(2px 2px at 12% 18%, #fff8 50%, transparent 51%),
    radial-gradient(2px 2px at 78% 12%, #fff9 50%, transparent 51%),
    radial-gradient(2px 2px at 40% 70%, #fff6 50%, transparent 51%),
    radial-gradient(2px 2px at 90% 60%, #fff7 50%, transparent 51%),
    radial-gradient(3px 3px at 60% 30%, #5eead4aa 50%, transparent 51%),
    radial-gradient(3px 3px at 22% 88%, #fde04799 50%, transparent 51%),
    radial-gradient(ellipse 900px 600px at 50% 110%, #3a9f98 0%, transparent 60%),
    linear-gradient(180deg, var(--gw-night), #082b2b);
}
.gw-launch[hidden], .gw[hidden] { display: none; }

/* ── start popup ─────────────────────────────────────────────────── */
.gw-launch {
  z-index: 450; display: flex; align-items: center; justify-content: center;
  padding: 20px; overflow-y: auto; animation: gwFade .25s ease-out;
}
.gw-launch-box {
  position: relative; width: min(880px, 100%); text-align: center;
  padding: 26px 26px 22px;
  background: var(--gw-card); border: 4px solid var(--gw-edge);
  box-shadow: inset 0 4px 0 #fff, inset 0 -5px 0 #d6d296, 8px 8px 0 rgba(0,0,0,.4);
  animation: gwBounceIn .45s cubic-bezier(.2,1.4,.4,1);
}
.gw-launch-logo img { height: 64px; max-width: 100%; }
.gw-launch-logo-text { font-size: 44px; font-weight: 900; letter-spacing: 2px; color: #67d8d0; text-shadow: 3px 3px 0 var(--gw-edge); }
.gw-launch-title { font-size: clamp(26px, 5vw, 40px); margin: 6px 0 18px; color: var(--gw-ink); }
.gw-launch-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.gw-choice {
  display: grid; justify-items: center; gap: 4px;
  padding: 22px 16px 18px; cursor: pointer; border-radius: 0;
  font: inherit; color: #fff; border: 4px solid var(--gw-edge);
  transition: transform .08s, filter .12s;
}
.gw-choice:hover { transform: translateY(-3px) rotate(-.5deg); filter: brightness(1.06); border-color: var(--gw-edge); box-shadow: none; }
.gw-choice:active { transform: translateY(2px); }
.gw-choice:focus-visible { outline: 4px solid var(--gw-yellow); outline-offset: 3px; }
.gw-choice-wizard {
  background: linear-gradient(180deg, #22c55e, #15803d);
  box-shadow: inset 0 4px 0 #86efac, inset 0 -6px 0 #14532d, 6px 6px 0 var(--gw-edge);
}
.gw-choice-editor {
  background: linear-gradient(180deg, #0ea5e9, #0369a1);
  box-shadow: inset 0 4px 0 #7dd3fc, inset 0 -6px 0 #0c4a6e, 6px 6px 0 var(--gw-edge);
}
.gw-choice-icon { font-size: 64px; line-height: 1.1; animation: gwWiggle 2.4s ease-in-out infinite; }
.gw-choice-editor .gw-choice-icon { animation-delay: 1.2s; }
.gw-choice-title { font-size: clamp(22px, 3.2vw, 28px); font-weight: 900; text-shadow: 2px 2px 0 rgba(0,0,0,.35); }
.gw-choice-sub { font-size: 16px; opacity: .95; }
.gw-choice-tag {
  margin-top: 8px; font-size: 13px; font-weight: 800; padding: 3px 10px;
  background: var(--gw-yellow); color: var(--gw-ink); border: 2px solid var(--gw-edge);
}
.gw-launch-gameo {
  display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 18px;
}
.gw-launch-gameo .gw-gameo-img { height: 72px; }
.gw-launch-say {
  margin: 0; position: relative; padding: 10px 14px; font-size: 17px; font-weight: 600;
  background: #fff; border: 3px solid var(--gw-edge); box-shadow: 3px 3px 0 var(--gw-edge);
}
.gw-gameo-fallback { font-size: 56px; line-height: 1; }

/* ── wizard frame ────────────────────────────────────────────────── */
.gw { z-index: 300; overflow-y: auto; padding: 14px; animation: gwFade .2s ease-out; }
.gw-frame {
  width: min(1100px, 100%); min-height: calc(100vh - 28px); margin: 0 auto;
  display: grid; grid-template-rows: auto auto 1fr auto; gap: 12px;
}

.gw-head { display: flex; align-items: center; gap: 12px; }
.gw-steps {
  flex: 1; display: flex; gap: 6px; list-style: none; margin: 0; padding: 0;
  overflow-x: auto;
}
.gw-step { flex: 1 1 0; min-width: 64px; }
.gw-step button {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 6px; border-radius: 0; font: inherit; font-size: 15px; font-weight: 800;
  color: #a7e8df; background: rgba(255,255,255,.06); border: 3px solid #1d5a54; box-shadow: none;
  cursor: default;
}
.gw-step button:disabled { opacity: 1; cursor: default; }
.gw-step.done button { color: var(--gw-ink); background: var(--gw-aqua); border-color: var(--gw-edge); cursor: pointer; }
.gw-step.done button:hover { filter: brightness(1.08); border-color: var(--gw-edge); box-shadow: none; }
.gw-step.now button {
  color: var(--gw-ink); background: var(--gw-yellow); border-color: var(--gw-edge);
  box-shadow: 0 0 0 3px rgba(253,224,71,.35);
}
.gw-step-icon { font-size: 18px; }
.gw-head-btns { display: flex; gap: 6px; }
.gw-icon-btn {
  width: 44px; height: 44px; padding: 0; border-radius: 0; font-size: 20px; line-height: 1;
  background: var(--gw-card); border: 3px solid var(--gw-edge); box-shadow: 3px 3px 0 #000a; cursor: pointer;
}
.gw-icon-btn:hover { background: #fff; border-color: var(--gw-edge); box-shadow: 3px 3px 0 #000a; }
.gw-icon-btn[aria-pressed="true"] { background: var(--gw-yellow); }

/* Gameo + speech bubble */
.gw-guide { display: flex; align-items: center; gap: 14px; }
.gw-gameo { flex: 0 0 auto; width: 84px; height: 84px; display: grid; place-items: center; }
.gw-gameo .gw-gameo-img { max-width: 100%; max-height: 100%; animation: gwBob 2.2s ease-in-out infinite; }
.gw-bubble {
  position: relative; flex: 1; margin: 0; padding: 14px 18px;
  font-size: clamp(18px, 2.4vw, 23px); font-weight: 700; line-height: 1.3;
  background: #fff; border: 4px solid var(--gw-edge); box-shadow: 5px 5px 0 rgba(0,0,0,.35);
}
.gw-bubble::before {
  content: ""; position: absolute; left: -16px; top: 50%; margin-top: -10px;
  border: 10px solid transparent; border-right: 14px solid var(--gw-edge); border-left: 0;
}

/* the white "page" each step draws on */
.gw-stage {
  background: var(--gw-card); border: 4px solid var(--gw-edge);
  box-shadow: inset 0 4px 0 #fff, 6px 6px 0 rgba(0,0,0,.35);
  padding: 18px; min-height: 0;
  animation: gwSlide .25s ease-out;
}

.gw-foot { display: flex; align-items: center; gap: 12px; padding-bottom: 4px; }
.gw-foot-note { flex: 1; text-align: right; color: #a7e8df; font-size: 16px; font-weight: 700; }

/* ── buttons ─────────────────────────────────────────────────────── */
.gw-btn {
  font: inherit; font-size: 20px; font-weight: 900; letter-spacing: .3px;
  padding: 12px 24px; border-radius: 0; cursor: pointer; color: #fff;
  background: var(--gw-green); border: 3px solid var(--gw-edge);
  box-shadow: inset 0 3px 0 var(--gw-green-hi), inset 0 -4px 0 var(--gw-green-lo), 4px 4px 0 var(--gw-edge);
  text-shadow: 1px 1px 0 rgba(0,0,0,.3);
  transition: transform .06s, filter .1s;
}
.gw-btn:hover:not(:disabled) { filter: brightness(1.07); border-color: var(--gw-edge); box-shadow: inset 0 3px 0 var(--gw-green-hi), inset 0 -4px 0 var(--gw-green-lo), 4px 4px 0 var(--gw-edge); }
.gw-btn:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: inset 0 3px 0 var(--gw-green-hi), inset 0 -4px 0 var(--gw-green-lo), 1px 1px 0 var(--gw-edge); }
.gw-btn:disabled { filter: grayscale(1); opacity: .55; cursor: not-allowed; }
.gw-btn.small { font-size: 16px; padding: 8px 14px; }
.gw-btn.ghost {
  color: var(--gw-ink); background: #fff; text-shadow: none;
  box-shadow: inset 0 -4px 0 #cdeee9, 4px 4px 0 var(--gw-edge);
}
.gw-btn.ghost:hover:not(:disabled) { box-shadow: inset 0 -4px 0 #cdeee9, 4px 4px 0 var(--gw-edge); }
.gw-back {
  color: var(--gw-ink); background: var(--gw-card); text-shadow: none;
  box-shadow: inset 0 -4px 0 #a7e8df, 4px 4px 0 #000a;
}
.gw-back:hover:not(:disabled) { box-shadow: inset 0 -4px 0 #a7e8df, 4px 4px 0 #000a; }
.gw-next { font-size: 22px; padding: 14px 28px; }
.gw-next:not(:disabled) { animation: gwPulse 1.6s ease-in-out infinite; }

/* ── form bits ───────────────────────────────────────────────────── */
.gw-field { margin-bottom: 14px; }
.gw-label { display: block; font-size: 20px; font-weight: 900; margin: 0 0 8px; }
.gw-input {
  width: 100%; font: inherit; font-size: 24px; font-weight: 700; padding: 10px 14px;
  background: #fff; color: var(--gw-ink); border: 3px solid var(--gw-edge); border-radius: 0;
  box-shadow: inset 3px 3px 0 #d4efe9;
}
.gw-input:focus { outline: 4px solid var(--gw-yellow); outline-offset: 0; }
.gw-input.small { font-size: 18px; padding: 8px 12px; }

/* ── world picker ────────────────────────────────────────────────── */
.gw-world-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.gw-world {
  position: relative; display: grid; justify-items: center; align-content: center; gap: 2px;
  min-height: 118px; padding: 10px 8px; cursor: pointer; border-radius: 0;
  font: inherit; color: #fff; border: 4px solid var(--gw-edge);
  box-shadow: inset 0 3px 0 rgba(255,255,255,.35), 4px 4px 0 var(--gw-edge);
  transition: transform .08s;
}
.gw-world:hover { transform: translateY(-3px); border-color: var(--gw-edge); box-shadow: inset 0 3px 0 rgba(255,255,255,.35), 4px 7px 0 var(--gw-edge); }
.gw-world-emoji { font-size: 46px; line-height: 1.1; filter: drop-shadow(2px 2px 0 rgba(0,0,0,.3)); }
.gw-world-label { font-size: 18px; font-weight: 900; text-shadow: 2px 2px 0 rgba(0,0,0,.5); }
.gw-world.picked { outline: 5px solid var(--gw-yellow); outline-offset: 2px; transform: translateY(-3px) scale(1.03); }
.gw-world.picked::after {
  content: "✔"; position: absolute; top: -12px; right: -12px; width: 32px; height: 32px;
  display: grid; place-items: center; font-size: 18px; font-weight: 900;
  background: var(--gw-yellow); color: var(--gw-ink); border: 3px solid var(--gw-edge);
}
.gw-world-custom { background: #fff; color: var(--gw-ink); cursor: default; }
.gw-world-custom:hover { transform: none; }
.gw-world-custom .gw-input { text-align: center; }

/* ── word chips (hero / bad guy / difficulty) ────────────────────── */
.gw-chip-row { display: flex; flex-wrap: wrap; gap: 10px; }
.gw-chip-row.center { justify-content: center; }
.gw-chip {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; border-radius: 0;
  font: inherit; font-size: 19px; font-weight: 800; padding: 8px 14px;
  color: var(--gw-ink); background: #fff; border: 3px solid var(--gw-edge);
  box-shadow: 3px 3px 0 var(--gw-edge); transition: transform .06s;
}
.gw-chip:hover { transform: translateY(-2px); border-color: var(--gw-edge); box-shadow: 3px 5px 0 var(--gw-edge); }
.gw-chip-emoji { font-size: 26px; line-height: 1; }
.gw-chip.picked { background: var(--gw-yellow); }
.gw-chip.big { font-size: 24px; padding: 12px 22px; }
.gw-chip.big .gw-chip-emoji { font-size: 34px; }
.gw-own { display: flex; gap: 10px; margin-top: 12px; max-width: 560px; }
.gw-own .gw-input { flex: 1; }

/* ── picker cards (heroes / bad guys) ────────────────────────────── */
.gw-picks { display: flex; flex-wrap: wrap; gap: 16px; margin: 18px 0 6px; min-height: 60px; }
.gw-pick {
  position: relative; display: grid; justify-items: center; gap: 6px; width: 180px;
  padding: 12px 10px 10px; border-radius: 0; cursor: pointer;
  font: inherit; color: var(--gw-ink); background: #fff; border: 4px solid var(--gw-edge);
  box-shadow: 4px 4px 0 var(--gw-edge); transition: transform .08s;
}
button.gw-pick:hover:not(:disabled) { transform: translateY(-3px); border-color: var(--gw-edge); box-shadow: 4px 7px 0 var(--gw-edge); }
.gw-pick:disabled { cursor: default; opacity: 1; }
.gw-pick.picked { background: #fffbe0; outline: 5px solid var(--gw-yellow); outline-offset: 2px; }
.gw-pick-art {
  width: 150px; height: 150px; display: grid; place-items: center;
  background: repeating-conic-gradient(#e6f6f3 0% 25%, #ffffff 0% 50%) 50% / 20px 20px;
  border: 3px solid var(--gw-edge);
}
.gw-sprite { width: 100%; height: 100%; image-rendering: pixelated; object-fit: contain; }
.gw-pick-label { font-size: 18px; font-weight: 900; text-align: center; }
.gw-badge {
  font-size: 13px; font-weight: 800; padding: 2px 8px;
  background: #ccfbf1; border: 2px solid var(--gw-edge);
}
.gw-pick-btns { position: absolute; top: -12px; right: -12px; display: flex; gap: 4px; }
.gw-mini {
  width: 34px; height: 34px; padding: 0; border-radius: 0; font: 900 18px/1 inherit; cursor: pointer;
  background: #fff; color: var(--gw-ink); border: 3px solid var(--gw-edge); box-shadow: 2px 2px 0 var(--gw-edge);
}
.gw-mini:hover:not(:disabled) { background: var(--gw-yellow); border-color: var(--gw-edge); box-shadow: 2px 2px 0 var(--gw-edge); }
.gw-oops { font-size: 56px; }
.gw-empty { color: #5f8479; font-size: 18px; font-weight: 700; margin: 10px 0; }
.gw-tools { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.gw-tools.center { justify-content: center; }

.gw-spinner {
  width: 54px; height: 54px; border: 7px solid #ccfbf1; border-top-color: #0d9488;
  border-radius: 50%; animation: gwSpin .8s linear infinite;
}
.gw-spinner.small { width: 22px; height: 22px; border-width: 4px; }

/* ── painting step ───────────────────────────────────────────────── */
.gw-paint { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.gw-paint-scene canvas, .gw-level canvas {
  width: 100%; image-rendering: pixelated; display: block;
  border: 4px solid var(--gw-edge); background: #0c1f1b; box-shadow: 4px 4px 0 var(--gw-edge);
}
.gw-paint-scene canvas { aspect-ratio: 160 / 128; }
.gw-scene-cap { text-align: center; font-weight: 800; margin: 8px 0 0; }
.gw-bar { height: 20px; background: #0c1f1b; border: 3px solid var(--gw-edge); margin-bottom: 12px; }
.gw-bar-fill {
  height: 100%; width: 0; transition: width .4s;
  background: repeating-linear-gradient(90deg, #5eead4 0 12px, #2dd4bf 12px 24px);
}
.gw-paint-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.gw-paint-cell {
  display: grid; justify-items: center; gap: 2px; padding: 6px 4px;
  background: #fff; border: 3px solid var(--gw-edge); font-size: 13px; font-weight: 800; text-align: center;
}
.gw-paint-cell.done { background: #f0fdf4; }
.gw-paint-cell.error { background: #fff1f2; }
.gw-paint-art {
  width: 52px; height: 52px; display: grid; place-items: center; font-size: 26px;
  background: repeating-conic-gradient(#e6f6f3 0% 25%, #ffffff 0% 50%) 50% / 12px 12px;
}
.gw-paint-cell.done .gw-paint-art { animation: gwPop .35s cubic-bezier(.2,1.6,.4,1); }

/* ── level step ──────────────────────────────────────────────────── */
.gw-level { display: grid; gap: 12px; max-width: 540px; margin: 16px auto 0; }
.gw-level #gwLevelView { aspect-ratio: 160 / 128; }
.gw-level #gwLevelStrip { aspect-ratio: 800 / 32; image-rendering: auto; }

/* ── finish step ─────────────────────────────────────────────────── */
.gw-finish { display: grid; gap: 20px; }
.gw-big-play {
  justify-self: center; font: inherit; font-size: clamp(30px, 6vw, 52px); font-weight: 900; letter-spacing: 1px;
  padding: 18px 44px; border-radius: 0; cursor: pointer; color: #fff;
  background: linear-gradient(180deg, #22c55e, #15803d); border: 5px solid var(--gw-edge);
  box-shadow: inset 0 5px 0 #86efac, inset 0 -7px 0 #14532d, 7px 7px 0 var(--gw-edge);
  text-shadow: 3px 3px 0 rgba(0,0,0,.35);
  animation: gwPulse 1.4s ease-in-out infinite;
}
.gw-big-play:hover:not(:disabled) { filter: brightness(1.07); border-color: var(--gw-edge); box-shadow: inset 0 5px 0 #86efac, inset 0 -7px 0 #14532d, 7px 7px 0 var(--gw-edge); }
.gw-big-play:active:not(:disabled) { transform: translate(4px, 4px); }
.gw-big-play:disabled { animation: none; filter: grayscale(1); opacity: .55; }
.gw-finish-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; }
.gw-send { background: #fff; border: 4px solid var(--gw-edge); padding: 14px 16px; box-shadow: 4px 4px 0 var(--gw-edge); }
.gw-send h3 { margin: 0 0 10px; font-size: 22px; }
.gw-send-steps { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 10px; font-size: 17px; font-weight: 700; }
.gw-send-steps li { display: flex; align-items: center; gap: 10px; }
.gw-send-steps li > span:not(.gw-num) { flex: 1; }
.gw-num {
  flex: 0 0 auto; width: 32px; height: 32px; display: grid; place-items: center;
  background: var(--gw-orange); color: #fff; font-weight: 900; border: 3px solid var(--gw-edge);
}
.gw-send-msg { margin: 0; min-height: 22px; font-size: 15px; font-weight: 700; color: #0f766e; }
.gw-more { display: grid; gap: 12px; align-content: start; }

/* ── animations ──────────────────────────────────────────────────── */
@keyframes gwFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes gwBounceIn { from { transform: scale(.8) translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes gwSlide { from { transform: translateX(16px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes gwPop { from { transform: scale(.4); } to { transform: none; } }
@keyframes gwSpin { to { transform: rotate(360deg); } }
@keyframes gwBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes gwWiggle { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-10deg); } 90% { transform: rotate(10deg); } 95% { transform: rotate(-5deg); } }
@keyframes gwPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
@media (prefers-reduced-motion: reduce) {
  .gw-launch *, .gw * { animation: none !important; transition: none !important; }
}

/* ── small screens ───────────────────────────────────────────────── */
@media (max-width: 760px) {
  .gw-launch-choices { grid-template-columns: 1fr; }
  .gw-choice-icon { font-size: 48px; }
  .gw-step-label { display: none; }
  .gw-step { min-width: 40px; }
  .gw-gameo { width: 60px; height: 60px; }
  .gw-stage { padding: 12px; }
  .gw-world-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .gw-world { min-height: 96px; }
  .gw-world-emoji { font-size: 36px; }
  .gw-pick { width: calc(50% - 8px); min-width: 140px; }
  .gw-pick-art { width: 110px; height: 110px; }
  .gw-paint, .gw-finish-grid { grid-template-columns: 1fr; }
  .gw-paint-grid { grid-template-columns: repeat(3, 1fr); }
  .gw-btn { font-size: 17px; padding: 10px 16px; }
  .gw-next { font-size: 18px; padding: 12px 18px; }
  .gw-own { flex-direction: column; }
}
