/* SQUEEDLES — bubbly cartoon UI */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --ink: #3a2e4f;
  --card: #fffdf6;
  --pop-pink: #ff7eb9;
  --pop-purple: #a78bfa;
  --pop-yellow: #ffd93d;
  --pop-teal: #4fd1c5;
  --radius: 26px;
  --border: 4px solid var(--ink);
}
html, body { width: 100%; height: 100%; overflow: hidden; }
body {
  font-family: "Baloo 2", "Comic Sans MS", "Marker Felt", "Arial Rounded MT Bold", sans-serif;
  color: var(--ink);
  background: #bfe9ff;
}
#game, #game canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.overlay {
  position: absolute; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 30%, rgba(255,255,255,.35), rgba(90,60,140,.45));
  backdrop-filter: blur(3px);
}
.hidden { display: none !important; }

.menu-card {
  background: var(--card); border: var(--border); border-radius: var(--radius);
  box-shadow: 0 12px 0 rgba(58,46,79,.35);
  padding: 28px 34px; max-width: 640px; width: 92%; text-align: center;
  max-height: 92vh; overflow-y: auto;
}
#game-title {
  font-size: 64px; letter-spacing: 2px; line-height: 1;
  background: linear-gradient(180deg, var(--pop-pink), var(--pop-purple));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 4px 0 rgba(58,46,79,.15);
}
#game-tagline { font-size: 18px; margin: 6px 0 14px; font-weight: 700; color: #7c6ba8; }
.pick-label { font-size: 22px; margin-bottom: 10px; }

#char-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px; margin-bottom: 16px;
}
.char-card {
  background: #f4efff; border: 3px solid var(--ink); border-radius: 18px;
  padding: 10px 6px 8px; cursor: pointer; transition: transform .12s, box-shadow .12s;
  user-select: none;
  position: relative;
}
.char-card.selected { z-index: 5; }
#play-badge {
  position: absolute; left: 50%; bottom: -18px; transform: translateX(-50%);
  font-family: inherit; font-size: 18px; font-weight: 800; color: var(--ink);
  background: linear-gradient(180deg, var(--pop-yellow), #ffc93d);
  border: 3px solid var(--ink); border-radius: 999px; padding: 8px 20px;
  cursor: pointer; box-shadow: 0 5px 0 rgba(58,46,79,.4);
  white-space: nowrap; z-index: 6;
  animation: badge-bounce 1.1s ease-in-out .45s infinite alternate;
}
#play-badge::before {
  content: ""; position: absolute; top: -9px; left: 50%; margin-left: -8px;
  border: 8px solid transparent; border-bottom: 9px solid var(--ink); border-top: none;
}
#play-badge:hover { background: linear-gradient(180deg, #ffe27a, var(--pop-yellow)); }
#play-badge.badge-pop { animation: badge-pop .4s cubic-bezier(.34,1.56,.64,1), badge-bounce 1.1s ease-in-out .45s infinite alternate; }
@keyframes badge-pop {
  0% { transform: translateX(-50%) scale(.3); }
  70% { transform: translateX(-50%) scale(1.15); }
  100% { transform: translateX(-50%) scale(1); }
}
@keyframes badge-bounce {
  from { transform: translateX(-50%) scale(1); }
  to { transform: translateX(-50%) scale(1.08) translateY(-2px); }
}
.char-card:hover { transform: translateY(-3px) scale(1.03); }
.char-card.selected {
  background: var(--pop-yellow); box-shadow: 0 6px 0 rgba(58,46,79,.3);
  transform: translateY(-3px) scale(1.05);
}
.char-card .char-face { width: 72px; height: 72px; margin: 0 auto 6px; border-radius: 50%; border: 3px solid var(--ink); }
.char-card .char-name { font-weight: 800; font-size: 15px; }
.char-card .char-tag { font-size: 11px; color: #6b5e8c; line-height: 1.15; }

.big-btn {
  font-family: inherit; font-size: 24px; font-weight: 800; color: var(--ink);
  background: linear-gradient(180deg, var(--pop-yellow), #ffc93d);
  border: var(--border); border-radius: 999px; padding: 12px 42px;
  cursor: pointer; box-shadow: 0 6px 0 rgba(58,46,79,.4);
  transition: transform .1s, box-shadow .1s;
}
.big-btn:not(:disabled):hover { transform: translateY(-2px); box-shadow: 0 8px 0 rgba(58,46,79,.4); }
.big-btn:not(:disabled):active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(58,46,79,.4); }
.big-btn:disabled { opacity: .45; cursor: not-allowed; }
.small-btn { font-size: 17px; padding: 8px 22px; }
.ghost { background: #eee7ff; }
.controls-hint { margin-top: 12px; font-size: 13px; color: #8a7cab; }

/* Avatar studio */
#avatar-studio { z-index: 30; } /* above the 3D select-preview canvas (25) */
.studio-card { max-width: 560px; position: relative; }
#btn-close-studio {
  position: absolute; top: 12px; right: 14px; width: 40px; height: 40px;
  font-family: inherit; font-size: 20px; font-weight: 800; color: var(--ink);
  background: #eee7ff; border: 3px solid var(--ink); border-radius: 50%;
  cursor: pointer; box-shadow: 0 4px 0 rgba(58,46,79,.35);
  transition: transform .1s;
  line-height: 1;
}
#btn-close-studio:hover { transform: scale(1.1) rotate(90deg); background: var(--pop-pink); }
.studio-hint { font-size: 15px; color: #7c6ba8; margin-bottom: 12px; }
#drop-zone {
  position: relative; border: 3px dashed #b3a5da; border-radius: 20px;
  padding: 14px; margin-bottom: 12px; min-height: 180px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
}
#drop-zone.dragover { background: #f1eaff; border-color: var(--pop-purple); }
#crop-canvas {
  width: 240px; height: 240px; border-radius: 50%; border: 4px solid var(--ink);
  background: #efe9ff; cursor: grab; display: none; touch-action: none;
}
#crop-canvas.has-img { display: block; }
#drop-hint { color: #9a8cc0; font-weight: 700; }
.tool-label { display: block; font-weight: 800; margin: 8px 0; }
#zoom-slider { width: 60%; accent-color: var(--pop-purple); vertical-align: middle; }
#swatch-row { display: flex; gap: 10px; justify-content: center; margin: 10px 0; }
.swatch {
  width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--ink);
  cursor: pointer; transition: transform .1s;
}
.swatch:hover { transform: scale(1.15); }
.swatch.selected { outline: 4px solid var(--pop-yellow); transform: scale(1.15); }
#squishy-name {
  font-family: inherit; font-size: 18px; font-weight: 700; color: var(--ink);
  border: 3px solid var(--ink); border-radius: 12px; padding: 8px 14px; width: 70%;
  text-align: center; margin-bottom: 10px; background: #fffdf6;
}
.btn-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* HUD */
#hud { position: absolute; top: 14px; left: 14px; right: 14px; z-index: 10; pointer-events: none; }
.hud-pill {
  display: inline-block; background: var(--card); border: 3px solid var(--ink);
  border-radius: 999px; padding: 6px 16px; font-size: 20px; font-weight: 800;
  margin-right: 8px; box-shadow: 0 4px 0 rgba(58,46,79,.3);
}
#mission-card {
  position: absolute; top: 0; right: 0; max-width: 300px;
  background: var(--card); border: 3px solid var(--ink); border-radius: 16px;
  padding: 10px 16px; box-shadow: 0 4px 0 rgba(58,46,79,.3);
}
#mission-title { font-weight: 800; font-size: 16px; color: #8b5cf6; }
#mission-obj { font-size: 14px; }

/* Dialogue */
#dialogue { position: absolute; left: 0; right: 0; bottom: 26px; z-index: 15; display: flex; justify-content: center; }
#dialogue-card {
  background: var(--card); border: var(--border); border-radius: 22px;
  padding: 14px 26px; max-width: 620px; width: 90%;
  box-shadow: 0 8px 0 rgba(58,46,79,.35); cursor: pointer;
}
#dialogue-name { font-weight: 800; font-size: 17px; color: var(--pop-pink); margin-bottom: 2px; }
#dialogue-text { font-size: 19px; min-height: 48px; }
#dialogue-next { text-align: right; font-size: 12px; color: #9a8cc0; font-weight: 700; }

/* Toast + interact */
#toast {
  position: absolute; top: 84px; left: 50%; transform: translateX(-50%);
  background: var(--pop-yellow); border: var(--border); border-radius: 999px;
  padding: 10px 28px; font-size: 20px; font-weight: 800; z-index: 18;
  box-shadow: 0 6px 0 rgba(58,46,79,.35); animation: toast-pop .35s;
}
@keyframes toast-pop { 0% { transform: translateX(-50%) scale(.4); } 70% { transform: translateX(-50%) scale(1.12); } 100% { transform: translateX(-50%) scale(1); } }
#interact-prompt {
  position: absolute; bottom: 120px; left: 50%; transform: translateX(-50%);
  background: var(--card); border: 3px solid var(--ink); border-radius: 999px;
  padding: 6px 18px; font-size: 16px; font-weight: 700; z-index: 12;
}
