* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Comic Sans MS', 'Segoe UI', system-ui, sans-serif;
  color: #2e2140;
  background: #fff7e8;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 4px;
  flex: 0 0 auto;
}
.topbar + .play { margin-top: 72px; }
.topbar + .grid { margin-top: 72px; }
.topbar + .cards { margin-top: 72px; }
.btn {
  width: 62px;
  height: 62px;
  min-width: 62px;
  min-height: 62px;
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 4px 0 #d8c8b4, 0 8px 18px rgba(60,40,20,.10);
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  color: #2e2140;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  transition: transform .1s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #d8c8b4; }
.title {
  flex: 1;
  text-align: center;
  font-size: clamp(22px, 5vw, 34px);
  font-weight: 800;
  letter-spacing: .5px;
}
.hint {
  flex: 0 0 auto;
  text-align: center;
  font-size: clamp(16px, 4vw, 22px);
  color: #7a6688;
  padding: 2px 14px 8px;
  min-height: 34px;
  transition: opacity .4s;
}
.play {
  position: relative;
  flex: 1 1 auto;
  overflow: hidden;
}
.confetti {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 4px;
  pointer-events: none;
  animation: zboara .75s ease-out forwards;
}
@keyframes zboara {
  from { transform: translate(-50%, -50%) rotate(0); opacity: 1; }
  to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(720deg); opacity: 0; }
}
.bounce { animation: bounce .45s ease; }
@keyframes bounce {
  0%, 100% { transform: scale(1); }
  40% { transform: scale(1.18) rotate(-6deg); }
  70% { transform: scale(.96) rotate(4deg); }
}
.wobble { animation: wobble .35s ease; }
@keyframes wobble {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}
/* Ecranul principal cu jocuri */
.home {
  flex: 1 1 auto;
  min-height: 0;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 1.6vh, 20px);
  padding: 10px 14px 8px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}
.home .logo { font-size: clamp(34px, 9vw, 64px); font-weight: 800; text-align: center; }
.logo-wrap {
  width: min(260px, 58vw, 32dvh);
  max-width: 100%;
  aspect-ratio: 1 / 1;
  flex: 0 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.logo-img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  border-radius: 24px;
  box-shadow: 0 10px 28px rgba(60,40,20,.18);
  display: block;
  object-fit: contain;
  background: #fff;
}
.home .sub { font-size: clamp(14px, 3.8vw, 22px); color: #7a6688; margin-top: -2px; text-align: center; }
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 90vw), 1fr));
  gap: clamp(10px, 1.8vh, 16px);
  width: min(900px, 100%);
}
.card {
  border: 0;
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 8px 0 rgba(0,0,0,.08), 0 16px 30px rgba(60,40,20,.12);
  padding: clamp(12px, 2.4vh, 22px) 18px;
  min-height: clamp(90px, 16dvh, 150px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  color: inherit;
  text-decoration: none;
  transition: transform .1s;
}
.card:active { transform: translateY(5px); }
.card .ico { font-size: clamp(40px, 11vw, 84px); line-height: 1; }
.card .lbl { font-size: clamp(20px, 5vw, 28px); font-weight: 800; }
@media (max-height: 640px) {
  .home { gap: 6px; padding: 6px 12px 6px; }
  .home .sub { font-size: clamp(12px, 3.4vw, 18px); }
  .logo-wrap { width: min(220px, 52vw, 28dvh); }
  .card { min-height: clamp(82px, 15dvh, 120px); padding: 10px 14px; border-radius: 22px; }
  .card .ico { font-size: clamp(34px, 9vw, 56px); }
  .card .lbl { font-size: clamp(17px, 4.6vw, 24px); }
  .footer { padding-bottom: 4px; }
}
.card.baloane { background: #dff3ff; }
.card.animale { background: #fff0d9; }
.card.forme { background: #eae3ff; }
/* Jocul cu animale */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(140px, 42vw), 1fr));
  gap: clamp(8px, 2vw, 16px);
  padding: 4px 12px 14px;
  height: 100%;
  align-content: start;
  overflow-y: auto;
}
.animal {
  border: 0;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 6px 0 rgba(0,0,0,.08), 0 10px 20px rgba(60,40,20,.10);
  min-height: clamp(96px, 17vh, 150px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  color: inherit;
}
.animal:active { transform: translateY(3px); }
.animal .ico { font-size: clamp(46px, 10vw, 76px); line-height: 1; }
.animal .lbl { font-size: clamp(15px, 3.5vw, 20px); font-weight: 700; }
.banner {
  flex: 0 0 auto;
  text-align: center;
  min-height: 58px;
  font-size: clamp(26px, 7vw, 46px);
  font-weight: 800;
  padding: 2px 10px 8px;
}
.tabs { display: flex; gap: 8px; padding: 2px 12px 4px; flex: 0 0 auto; }
.tab {
  flex: 1;
  min-height: 52px;
  border: 0;
  border-radius: 16px;
  background: #fff;
  color: #7a6688;
  font-size: clamp(16px, 4vw, 22px);
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 3px 0 #d8c8b4;
}
.tab.on { background: #7c5cff; color: #fff; box-shadow: 0 3px 0 #5438c9; }
/* Baloane */
#baloane .play { background: linear-gradient(#cdefff, #f2fbff 70%, #eaf8dd); }
.balloon {
  position: absolute;
  left: var(--x);
  bottom: -140px;
  width: var(--s);
  animation: urcare var(--dur) linear forwards;
  animation-delay: var(--delay, 0s);
  cursor: pointer;
  filter: drop-shadow(0 6px 8px rgba(0,0,0,.14));
}
@keyframes urcare {
  from { transform: translate3d(0, 0, 0) rotate(-5deg); }
  to { transform: translate3d(var(--drift), -160vh, 0) rotate(7deg); }
}
.balloon .corp {
  width: 100%;
  height: calc(var(--s) * 1.18);
  border-radius: 50% 50% 46% 46% / 55% 55% 45% 45%;
  position: relative;
  box-shadow: inset -9px -12px 0 rgba(0,0,0,.08), inset 7px 9px 0 rgba(255,255,255,.25);
}
.balloon .corp::after {
  content: '';
  position: absolute;
  left: 22%;
  top: 14%;
  width: 18%;
  height: 24%;
  background: rgba(255,255,255,.55);
  border-radius: 50%;
  transform: rotate(-25deg);
}
.balloon .fir {
  width: 2px;
  height: calc(var(--s) * .55);
  margin: 0 auto;
  background: #8a7a6a;
  transform: rotate(6deg);
}
.pop {
  position: absolute;
  font-size: clamp(40px, 10vw, 70px);
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: pop .5s ease-out forwards;
}
@keyframes pop {
  from { transform: translate(-50%, -50%) scale(.4); opacity: 1; }
  to { transform: translate(-50%, -50%) scale(1.7); opacity: 0; }
}
.pop.niv-4, .pop.niv-5 { font-size: clamp(56px, 13vw, 96px); animation: popBoom .55s ease-out forwards; }
.pop.niv-6, .pop.niv-7 { font-size: clamp(52px, 12vw, 90px); animation: popSparkle .7s ease-out forwards; filter: drop-shadow(0 0 10px rgba(255,215,0,.8)); }
.pop.niv-8, .pop.niv-9, .pop.niv-10 { font-size: clamp(60px, 14vw, 110px); animation: popFirework .85s ease-out forwards; filter: drop-shadow(0 0 12px rgba(255,255,255,.9)); }
@keyframes popBoom {
  0% { transform: translate(-50%, -50%) scale(.2) rotate(-10deg); opacity: 1; }
  40% { transform: translate(-50%, -50%) scale(1.8) rotate(8deg); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(2.2) rotate(0deg); opacity: 0; }
}
@keyframes popSparkle {
  0% { transform: translate(-50%, -50%) scale(.3) rotate(0deg); opacity: 1; }
  50% { transform: translate(-50%, -50%) scale(1.6) rotate(25deg); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(2.1) rotate(-10deg); opacity: 0; }
}
@keyframes popFirework {
  0% { transform: translate(-50%, -50%) scale(.2); opacity: 1; }
  30% { transform: translate(-50%, -50%) scale(1.5); opacity: 1; }
  60% { transform: translate(-50%, -50%) scale(1.9); opacity: .9; }
  100% { transform: translate(-50%, -50%) scale(2.5); opacity: 0; }
}
/* Forme și culori */
#forme .play { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.tinta {
  width: clamp(140px, 34vw, 230px);
  height: clamp(140px, 34vw, 230px);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 6px dashed #c9b8dd;
  border-radius: 28px;
  background: rgba(255,255,255,.7);
  margin-bottom: clamp(12px, 3vh, 26px);
}
.tinta svg { width: 76%; height: 76%; }
.optiuni { display: flex; gap: clamp(10px, 3vw, 22px); flex-wrap: wrap; justify-content: center; }
.opt {
  width: clamp(76px, 21vw, 120px);
  height: clamp(76px, 21vw, 120px);
  border: 0;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 6px 0 rgba(0,0,0,.10), 0 10px 18px rgba(60,40,20,.10);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.opt:active { transform: translateY(3px); }
.opt svg, .opt .cerc { width: 78%; height: 78%; }
.opt .cerc { border-radius: 50%; }
/* Footer + notificare de actualizare */
.footer {
  flex: 0 0 auto;
  text-align: center;
  font-size: clamp(12px, 3vw, 16px);
  color: #5e4f72;
  padding: 2px 8px 8px;
  pointer-events: none;
}
.footer .inima { color: #ff4d6d; }
.update-toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translate(-50%, 20px);
  background: rgba(46,33,64,.92);
  color: #fff;
  border-radius: 30px;
  padding: 10px 20px;
  font-size: clamp(13px, 3.4vw, 17px);
  font-weight: 700;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s, transform .3s, visibility .3s;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  white-space: nowrap;
}
.update-toast.arata { opacity: 1; visibility: visible; transform: translate(-50%, 0); }

/* ---------- Zona ascunsă „Pentru Părinți” ---------- */
.logo-wrap { position: relative; }
.logo-img { cursor: default; -webkit-user-drag: none; }
.gate-dots { display: none !important; }
.gate-dots.arata { opacity: 1; }
.gate-dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(124, 92, 255, .25);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .8);
}
.gate-dots i.on { background: #7c5cff; }

.parents {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background: rgba(35, 25, 48, .55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.parents[hidden] { display: none; }
.parents-card {
  position: relative;
  width: min(520px, 100%);
  max-height: calc(100dvh - 28px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #fffaf1;
  color: #2e2140;
  border-radius: 28px;
  padding: 22px 20px 18px;
  box-shadow: 0 24px 60px rgba(30, 18, 45, .35);
  animation: parintiIn .18s ease-out;
}
@keyframes parintiIn {
  from { transform: translateY(10px) scale(.98); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.parents-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: #f0e7da;
  color: #5e4f72;
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.parents-close:active { transform: translateY(2px); }
.parents-card h2 {
  margin: 0 0 2px;
  padding-right: 44px;
  font-size: clamp(22px, 5vw, 28px);
}
.parents-sub {
  margin: 0 0 16px;
  color: #6b5a78;
  font-size: clamp(13px, 3.4vw, 15px);
}
.parents-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: #fff;
  border-radius: 18px;
  padding: 12px 14px;
  box-shadow: inset 0 0 0 1px #eadfce;
}
.parents-label { display: flex; flex-direction: column; gap: 2px; }
.parents-label strong { font-size: clamp(15px, 4vw, 18px); }
.parents-label small { color: #7a6688; font-size: clamp(12px, 3.2vw, 14px); }
.switch {
  position: relative;
  flex: 0 0 auto;
  width: 58px;
  height: 34px;
  display: inline-block;
}
.switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}
.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #d9cce8;
  transition: background .18s;
}
.switch span::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .22);
  transition: transform .18s;
}
.switch input:checked + span { background: #7c5cff; }
.switch input:checked + span::after { transform: translateX(24px); }
.switch input:focus-visible + span { outline: 3px solid #b9a9ff; outline-offset: 3px; }
.switch input:disabled { cursor: not-allowed; }
.switch input:disabled + span { opacity: .5; }
.parents-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 14px;
  font-size: clamp(14px, 3.6vw, 16px);
  font-weight: 700;
}
.parents-field select {
  width: 100%;
  padding: 12px;
  border-radius: 14px;
  border: 2px solid #e3d6c5;
  background: #fff;
  color: inherit;
  font: inherit;
  font-weight: 700;
}
.parents-help {
  margin: 4px 2px 0;
  color: #8a779c;
  font-size: clamp(11px, 3vw, 13px);
}
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg button {
  border: 2px solid #e3d6c5;
  background: #fff;
  color: #5e4f72;
  border-radius: 14px;
  padding: 10px 8px;
  font: inherit;
  font-size: clamp(12px, 3.2vw, 14px);
  font-weight: 800;
  cursor: pointer;
}
.seg button[aria-pressed="true"] {
  background: #7c5cff;
  border-color: #7c5cff;
  color: #fff;
  box-shadow: 0 3px 0 #5438c9;
}
.seg button:active { transform: translateY(2px); }
.parents-test {
  width: 100%;
  margin-top: 18px;
  border: 0;
  border-radius: 16px;
  background: #ffd166;
  color: #5a3d00;
  font: inherit;
  font-weight: 900;
  font-size: clamp(15px, 4vw, 17px);
  padding: 14px;
  cursor: pointer;
  box-shadow: 0 4px 0 #d9a520;
}
.parents-test:active { transform: translateY(3px); box-shadow: 0 1px 0 #d9a520; }
.parents-test:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.parents-status {
  min-height: 20px;
  margin-top: 10px;
  font-size: clamp(12px, 3.3vw, 14px);
  font-weight: 700;
  color: #6b5a78;
}
.parents-status.ok { color: #1f7a4d; }
.parents-status.err { color: #b4232f; }
.parents-diag {
  margin-top: 12px;
  font-size: clamp(11px, 2.9vw, 12.5px);
  color: #7a6688;
}
.parents-diag summary {
  cursor: pointer;
  font-weight: 800;
  padding: 4px 2px;
}
.parents-diag pre {
  margin: 6px 0 0;
  padding: 10px 12px;
  background: #fff;
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px #eadfce;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(10px, 2.7vw, 12px);
  line-height: 1.45;
  color: #4a3b5c;
}
.parents-note {
  margin: 10px 0 0;
  color: #8a779c;
  font-size: clamp(11px, 2.9vw, 12.5px);
  line-height: 1.4;
}
body.parinti-deschis { overflow: hidden; }

/* Memento în pagină pentru notificările push (când aplicația e deschisă) */
.memento {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  z-index: 2900;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 14px 14px 16px;
  border-radius: 22px;
  background: #fffdf8;
  border: 2px solid #ffd166;
  box-shadow: 0 18px 50px rgba(30, 18, 45, .32);
  animation: mementoIn .25s ease-out;
}
.memento[hidden] { display: none; }
@keyframes mementoIn {
  from { transform: translateY(18px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.memento-ico {
  flex: 0 0 auto;
  font-size: 28px;
  line-height: 1;
}
.memento-text {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.memento-text strong { font-size: clamp(15px, 4vw, 18px); }
.memento-text span { color: #5e4f72; font-size: clamp(13px, 3.5vw, 16px); line-height: 1.35; }
.memento-close {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: #f0e7da;
  color: #5e4f72;
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
}
.memento-close:active { transform: translateY(2px); }
body.parinti-deschis .memento { display: none !important; }

.parents-test-sound {
  margin-top: 10px;
  background: #cdefff;
  color: #134e6b;
  box-shadow: 0 4px 0 #8fc7e8;
}
.parents-test-sound:active { box-shadow: 0 1px 0 #8fc7e8; }


@media (max-height: 640px) {
  .parents { padding: 8px; }
  .parents-card { padding: 16px 15px 14px; border-radius: 22px; max-height: calc(100dvh - 16px); }
  .parents-sub { margin-bottom: 10px; }
  .parents-row { padding: 10px 12px; }
  .parents-field { margin-top: 10px; }
  .parents-test { margin-top: 12px; padding: 11px; }
  .parents-note { margin-top: 8px; }
}

/* ---------- Accesibilitate ---------- */

/* Indicator clar de focus pentru navigare cu tastatura / comutatoare */
*:focus-visible {
  outline: 3px solid #7c5cff;
  outline-offset: 2px;
  border-radius: 6px;
}

/* Nu afisa outline pentru interactiuni cu pointer/touch */
*:focus:not(:focus-visible) { outline: none; }

/* Buton mare: contrast + spatiu de focus */
.opt, .btn, .tab, .card, .start, .parents-test {
  border: 1px solid rgba(0,0,0,.08);
}

/* Respecta preferința sistemului: reduce animatiile pentru sensibilitatea la miscare */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
