/* Zarish Avatar App — child-friendly, big buttons, Urdu + simple English */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --pink: #ff6fa5;
  --purple: #8b5cf6;
  --purple-dark: #6d28d9;
  --cream: #fff7fb;
  --card: #ffffff;
  --ink: #3b2a4a;
  --muted: #7a6a8a;
  --gold: #f5b301;
  --green: #22a06b;
}
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Noto Nastaliq Urdu", "Noto Naskh Arabic", "Segoe UI", Tahoma, Arial, sans-serif;
  background: linear-gradient(180deg, #ffe3f0 0%, #f3e8ff 55%, #e0f2fe 100%);
  color: var(--ink);
  min-height: 100vh;
  padding-bottom: 110px;
}
header {
  text-align: center;
  padding: 14px 12px 6px;
}
header h1 { font-size: 30px; color: var(--purple-dark); line-height: 1.5; }
header p { font-size: 16px; color: var(--muted); }
.stars {
  display: inline-block; margin-top: 6px; background: #fff; border: 2px solid var(--gold);
  border-radius: 999px; padding: 4px 14px; font-size: 18px; font-weight: bold; color: #8a6100;
}
main { max-width: 560px; margin: 0 auto; padding: 0 12px; }

/* Avatar stage */
.stage {
  background: var(--card);
  border-radius: 24px;
  padding: 14px;
  box-shadow: 0 6px 20px rgba(139, 92, 246, .18);
  text-align: center;
}
.avatar-wrap {
  position: relative;
  width: min(78vw, 320px);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  border-radius: 50%;
  overflow: hidden;
  border: 5px solid var(--pink);
  background: #fdeef6;
}
.avatar-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-wrap.speaking { animation: bob 0.9s ease-in-out infinite; }
.avatar-wrap.waving { animation: wave-tilt 0.45s ease-in-out 3; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes wave-tilt { 0%,100% { transform: rotate(0deg); } 25% { transform: rotate(-3deg); } 75% { transform: rotate(3deg); } }
.lid {
  position: absolute; width: 13%; height: 9%;
  background: #ffe0cc; border-radius: 50%;
  transform: translate(-50%, -50%) scaleY(0);
  transform-origin: center;
  pointer-events: none;
}
.lid.left { left: 41%; top: 42.5%; }
.lid.right { left: 62.5%; top: 42.5%; }
.lid.blink { transform: translate(-50%, -50%) scaleY(1); transition: transform 90ms ease-in; }
#mouth {
  position: absolute; left: 50.5%; top: 50.5%;
  width: 7%; height: 1.2%;
  background: #a63a4b; border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none; opacity: 0;
}
#mouth.on { opacity: 1; }
.bubble {
  margin-top: 12px; background: #f3e8ff; border: 2px solid #d8b4fe;
  border-radius: 16px; padding: 12px 14px; font-size: 19px; line-height: 1.9;
  min-height: 64px;
}
.bubble .en { color: var(--purple-dark); font-weight: bold; }
.stage-btns { display: flex; gap: 10px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }

/* Buttons */
.btn {
  font-family: inherit; font-size: 19px; line-height: 1.6;
  border: none; border-radius: 999px; padding: 10px 20px;
  background: var(--pink); color: #fff; cursor: pointer;
  box-shadow: 0 3px 0 #d14d84;
}
.btn:active { transform: translateY(2px); box-shadow: none; }
.btn.purple { background: var(--purple); box-shadow: 0 3px 0 var(--purple-dark); }
.btn.green { background: var(--green); box-shadow: 0 3px 0 #177a50; }
.btn.gold { background: var(--gold); box-shadow: 0 3px 0 #b98a00; color: #4a3400; }
.btn.ghost { background: #fff; color: var(--purple-dark); box-shadow: 0 3px 0 #d8b4fe; border: 2px solid #d8b4fe; }

/* Sections */
section { display: none; margin-top: 14px; }
section.active { display: block; }
.card {
  background: var(--card); border-radius: 20px; padding: 16px;
  box-shadow: 0 4px 14px rgba(139, 92, 246, .12); margin-bottom: 14px;
}
.card h2 { font-size: 23px; color: var(--purple-dark); margin-bottom: 10px; line-height: 1.6; }
.card p { font-size: 17px; line-height: 1.9; color: var(--ink); }
.hint { font-size: 15px; color: var(--muted); margin-top: 8px; line-height: 1.8; }

.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  font-family: inherit; font-size: 17px; line-height: 1.7;
  background: #f3e8ff; border: 2px solid #d8b4fe; color: var(--ink);
  border-radius: 16px; padding: 10px 14px; cursor: pointer; text-align: right;
}
.chip:active { background: #e9d5ff; }
.ask-row { display: flex; gap: 8px; margin-top: 12px; }
.ask-row input {
  flex: 1; font-family: inherit; font-size: 18px; padding: 10px 14px;
  border: 2px solid #d8b4fe; border-radius: 999px; background: #fff; color: var(--ink);
  min-width: 0;
}
.answer {
  margin-top: 12px; background: #fff7fb; border: 2px dashed var(--pink);
  border-radius: 16px; padding: 12px 14px; font-size: 18px; line-height: 1.9; min-height: 60px;
}

/* Grids */
.grid { display: grid; gap: 10px; }
.grid.letters { grid-template-columns: repeat(5, 1fr); }
.grid.numbers { grid-template-columns: repeat(5, 1fr); }
.grid.colours { grid-template-columns: repeat(2, 1fr); }
.grid.animals { grid-template-columns: repeat(2, 1fr); }
.tile {
  font-family: inherit; background: #fff; border: 3px solid #e9d5ff; border-radius: 18px;
  padding: 12px 4px; cursor: pointer; text-align: center; color: var(--ink);
}
.tile:active, .tile.sel { border-color: var(--pink); background: #fff0f6; }
.tile .big { font-size: 30px; font-weight: bold; color: var(--purple-dark); line-height: 1.3; }
.tile .ur { font-size: 17px; line-height: 1.7; }
.tile .en { font-size: 14px; color: var(--muted); }
.tile .emoji { font-size: 44px; line-height: 1.2; }
.tile .swatch { height: 44px; border-radius: 12px; margin-bottom: 6px; }
.big-show {
  text-align: center; font-size: 26px; line-height: 1.8; color: var(--purple-dark);
  background: #f3e8ff; border-radius: 16px; padding: 10px; margin-bottom: 12px; min-height: 70px;
}

/* Quiz */
.quiz-q { font-size: 21px; line-height: 1.9; margin-bottom: 12px; }
.quiz-opts { display: grid; gap: 10px; }
.opt {
  font-family: inherit; font-size: 19px; line-height: 1.7; text-align: right;
  background: #fff; border: 3px solid #e9d5ff; border-radius: 16px; padding: 12px 14px;
  cursor: pointer; color: var(--ink);
}
.opt.correct { border-color: var(--green); background: #e6f7ef; }
.opt.wrong { border-color: #e5484d; background: #fdecec; }
.opt:disabled { opacity: .75; cursor: default; }
.quiz-feedback { font-size: 19px; line-height: 1.8; margin-top: 12px; min-height: 34px; }
.quiz-progress { font-size: 16px; color: var(--muted); margin-bottom: 8px; }

/* Drawing */
#drawCanvas {
  width: 100%; height: 300px; background: #fff; border: 3px solid #e9d5ff;
  border-radius: 16px; touch-action: none; display: block;
}
.palette { display: flex; gap: 10px; margin: 12px 0; flex-wrap: wrap; justify-content: center; }
.swatch-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 3px solid #fff;
  box-shadow: 0 0 0 2px #d8b4fe; cursor: pointer;
}
.swatch-btn.sel { box-shadow: 0 0 0 3px var(--pink); transform: scale(1.12); }
.draw-btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* Bottom nav */
nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  background: #fff; border-top: 2px solid #e9d5ff;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
}
nav button {
  font-family: inherit; font-size: 15px; line-height: 1.5; background: none; border: none;
  color: var(--muted); cursor: pointer; padding: 6px 2px; border-radius: 12px;
}
nav button .ic { font-size: 24px; display: block; }
nav button.active { color: var(--purple-dark); background: #f3e8ff; font-weight: bold; }
footer { text-align: center; font-size: 13px; color: var(--muted); padding: 10px 12px 0; line-height: 1.8; }
