/* ==========================================================================
   Toddler controls (js/touch.js): bigger pictures, a pressed look on every
   touch, sparkles on empty space, press-and-hold rings for grown-up buttons.
   Loaded last, so its sizes win over app.css and stories.css.
   ========================================================================== */

html, body { -webkit-touch-callout: none; }
.room, .room-map, .shelf, .kid-picker { touch-action: none; }

/* ---------- Bigger pictures to tap ---------- */
.option {
  width: clamp(96px, 29vmin, 170px);
  height: clamp(96px, 29vmin, 170px);
}
.stage { gap: 3.5vmin; }
.option.token, .slot {
  width: clamp(72px, 18vmin, 110px);
  height: clamp(72px, 18vmin, 110px);
}
.count-pool, .count-basket, .order-pool, .order-slots { min-height: calc(clamp(72px, 18vmin, 110px) + 16px); }

/* Portrait: the star counter owns the top right, so the bubbles and the owl start below it */
@media (orientation: portrait) {
  .bubble, .friend, .bubble--friend { top: calc(94px + env(safe-area-inset-top, 0px)); }
  .stage { top: max(22%, calc(186px + env(safe-area-inset-top, 0px))); }
}
/* Landscape: the pictures' column starts under the star counter */
@media (orientation: landscape) {
  .option { width: clamp(88px, 25vmin, 150px); height: clamp(88px, 25vmin, 150px); }
  .stage { top: calc(50% + 35px); gap: 1.5vmin; }
  .doors { top: calc(50% + 36px); }
}

/* ---------- Pressed look (touch.js sets .is-press the moment a finger lands) ---------- */
.option.is-press { transform: translateY(4px) scale(.95); }
.door.is-press { transform: scale(.94); }
.zakzak { transition: scale .12s; }
.zakzak.is-press { scale: .95; }
.books-btn.is-press, .treasure-btn.is-press { translate: 0 3px; }
.map-room, .kid-face, .book { transition: scale .1s; }
.map-room.is-press, .kid-face.is-press, .book.is-press,
.tr-room.is-press, .tr-tab.is-press, .tr-book.is-press { scale: .93; }

/* The right picture glows when a child has not tapped for a while */
.option.is-hint:not(.is-right):not(.is-wrong) {
  box-shadow: 0 0 0 8px #ffd84d, 0 6px 0 #d8d0f7, 0 0 26px 6px rgba(255, 216, 77, .7);
  animation: opt-hint 1.1s ease-in-out 3;
}
@keyframes opt-hint {
  50% { transform: scale(1.08); box-shadow: 0 0 0 10px rgba(255, 216, 77, .75), 0 0 34px 10px rgba(255, 216, 77, .8); }
}

/* ---------- A tap on empty space: a little burst ---------- */
.tap-spark { position: fixed; width: 0; height: 0; z-index: 40; pointer-events: none; }
.tap-spark i {
  position: absolute;
  left: -7px;
  top: -7px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffd84d;
  animation: spark-out .6s ease-out forwards;
}
.tap-spark i:nth-child(1) { --dx: 0px;   --dy: -44px; background: #ff7aa8; }
.tap-spark i:nth-child(2) { --dx: 38px;  --dy: -22px; }
.tap-spark i:nth-child(3) { --dx: 38px;  --dy: 22px;  background: #6ec6ff; }
.tap-spark i:nth-child(4) { --dx: 0px;   --dy: 44px;  background: #7fd36b; }
.tap-spark i:nth-child(5) { --dx: -38px; --dy: 22px;  background: #b9a7ff; }
.tap-spark i:nth-child(6) { --dx: -38px; --dy: -22px; background: #ff8a3d; }
@keyframes spark-out {
  from { translate: 0 0; scale: .5; opacity: 1; }
  to   { translate: var(--dx) var(--dy); scale: 1; opacity: 0; }
}

/* ---------- Grown-up buttons: a ring fills while the button is held ---------- */
@property --hold { syntax: "<percentage>"; inherits: false; initial-value: 0%; }
.hold-ring {
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  background: conic-gradient(#ffd84d var(--hold), rgba(255, 255, 255, .5) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px));
  animation: hold-fill linear forwards;
  pointer-events: none;
}
.home-btn .hold-ring { inset: 7px; }
@keyframes hold-fill { to { --hold: 100%; } }
.home-btn.is-holding svg, .parents-btn.is-holding, .kid-btn.is-holding { scale: .94; }
.home-btn svg { transition: scale .15s; }
.parents-btn, .kid-btn { transition: scale .15s; }

/* Shown to the parent who only tapped a hold button */
.hold-hint {
  position: fixed;
  z-index: 40;
  padding: 8px 14px;
  border-radius: 14px;
  background: #4a3f7a;
  color: #fff;
  font: 600 15px/1.3 system-ui, sans-serif;
  white-space: nowrap;
  pointer-events: none;
  animation: modal-pop .25s cubic-bezier(.3, 1.4, .5, 1);
}

/* Home during a lesson is a grown-up button now: quieter, so it does not invite taps */
.home-btn svg { opacity: .8; }

@media (prefers-reduced-motion: reduce) {
  .tap-spark { display: none; }
  .option.is-hint { animation: none; box-shadow: 0 0 0 8px #ffd84d; }
}

/* ---------- Zakzak or the owl answers a tap (app.js pause): the other pictures rest ---------- */
.stage.is-wait .option:not(.is-right):not(.is-wrong) {
  opacity: .45;
  scale: .92;
  transition: transform .08s, opacity .2s, scale .2s;
  transition-delay: 0s;
}
