/* opening.css: מסכי הפתיחה בתמונות (הבעלים 26.10 08:49 + 08:54): אריחי ילדים, אריח "+", הקוסם / הקוסמת של הטופס, כפתורי בן/בת בתמונות, בועות גיל, ומדליית המדריך בביצה | the opening in pictures: child tiles, the "+" tile, the form's wizard / sorceress, picture gender buttons, age bubbles, the egg guide.
   Talks to: app/index.html (#familyScreen, #kidCards, #newKidBtn, #kidForm, #eggScreen), ui/opening-hero.js, ui/opening-art.js, ui/profile-picker.js.
   Update: tile size = --kt; the hero = .hall-wiz; colours are the tokens below. */
#familyScreen { --og-glass: rgba(38, 22, 104, .58); --og-rim: rgba(255, 214, 102, .75); --og-gold: #FFC93C; --og-deep: #1E1258; --kt: min(168px, calc((100vw - 46px) / 2)); justify-content: center; }
.fam-title { margin: 4px 0 8px; font: 700 28px/1.5 'Rubik', sans-serif; color: #FFF6D6; letter-spacing: .5px;
  text-shadow: 0 2px 0 #8A4B00, 0 4px 0 rgba(30, 16, 80, .55), 0 0 18px rgba(255, 201, 60, .55); }

/* the hall character: one only (owner 08:54:30 "לא צריך גם פעמיים קוסם"): on the form; the picker's tiles are the characters */
.hall-wiz { position: relative; flex: 0 0 auto; width: 176px; height: 206px; margin: 0 auto 18px; pointer-events: none; z-index: 1; }
#familyScreen:has(#kidForm[hidden]) .hall-wiz { display: none; }
.hall-wiz .hw-ring { position: absolute; left: 50%; bottom: -10px; width: 176px; height: 44px; transform: translateX(-50%); border-radius: 50%;
  background: radial-gradient(closest-side, rgba(20, 8, 60, .55), rgba(20, 8, 60, .25) 60%, transparent), radial-gradient(closest-side, transparent 70%, rgba(255, 214, 102, .9) 74%, transparent 80%);
  box-shadow: 0 0 22px 4px rgba(255, 201, 60, .45); animation: hwRing 4s ease-in-out infinite; }
.hall-wiz .hw-ring::after { content: ""; position: absolute; inset: 7px 18px; border-radius: 50%; border: 2px dashed rgba(255, 236, 170, .75); }
.hall-wiz::after { content: ""; position: absolute; inset: -6px -26px 20px; pointer-events: none;
  background: radial-gradient(3px 3px at 12% 30%, #FFF6C8, transparent), radial-gradient(2px 2px at 88% 22%, #fff, transparent), radial-gradient(3px 3px at 82% 70%, #FFE28A, transparent), radial-gradient(2px 2px at 18% 74%, #fff, transparent);
  animation: hwTwinkle 2.4s ease-in-out infinite; }
.hall-wiz img { position: relative; width: 100%; height: 100%; object-fit: contain; object-position: 50% 100%; transform-origin: 50% 100%;
  filter: drop-shadow(0 10px 10px rgba(20, 10, 60, .5)) drop-shadow(0 0 16px rgba(255, 214, 102, .35)); animation: hwBreathe 3.2s ease-in-out infinite; }
.hall-wiz[data-state=speaking] img { animation: hwTalk .5s ease-in-out infinite; }
.hall-wiz.swap img { animation: hwSwap .55s cubic-bezier(.3, 1.5, .5, 1); }
@keyframes hwBreathe { 50% { transform: scale(1.03, .98) translateY(-2px); } }
@keyframes hwTalk { 50% { transform: scale(1.02, 1.01) rotate(-1.5deg); } }
@keyframes hwSwap { 0% { transform: scale(.5, .5) rotate(-8deg); opacity: .2; } 60% { transform: scale(1.08, .96); opacity: 1; } 100% { transform: none; } }
@keyframes hwRing { 50% { box-shadow: 0 0 30px 8px rgba(255, 201, 60, .6); } }
@keyframes hwTwinkle { 50% { opacity: .35; } }

/* the picker: a big picture per child, the name small under it; the new child = a glowing "+" picture */
#kidCards { display: grid; grid-template-columns: repeat(2, var(--kt)); justify-content: center; gap: 14px; width: 100%; max-width: 380px; }
#kidCards:has(.kid-card:only-child) { grid-template-columns: var(--kt); }
.kid-card, .new-kid { position: relative; font: inherit; width: var(--kt); height: 206px; padding: 0; border: 2px solid var(--og-rim); border-bottom: 7px solid var(--og-deep); border-radius: 28px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; overflow: hidden; color: #fff;
  background: radial-gradient(90% 70% at 50% 38%, rgba(156, 134, 255, .65), rgba(50, 28, 130, .78) 70%, rgba(30, 16, 80, .85));
  box-shadow: 0 12px 22px rgba(10, 4, 40, .45), inset 0 2px 0 rgba(255, 255, 255, .3); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.kid-card:active, .new-kid:active { transform: translateY(5px); border-bottom-width: 2px; }
.kid-card.current { border-color: var(--og-gold); box-shadow: 0 0 0 3px rgba(255, 201, 60, .55), 0 0 26px rgba(255, 201, 60, .6), 0 12px 22px rgba(10, 4, 40, .45); }
.kid-card .kt-glow, .new-kid .kt-glow { position: absolute; left: 50%; bottom: 40px; width: 130px; height: 30px; transform: translateX(-50%); border-radius: 50%;
  background: radial-gradient(closest-side, rgba(20, 8, 60, .6), rgba(255, 201, 60, .35) 70%, transparent); }
.kid-card .kt-hero { position: absolute; left: 50%; bottom: 46px; width: 120px; height: 144px; margin-left: -60px; object-fit: contain; object-position: 50% 100%; transform-origin: 50% 100%;
  filter: drop-shadow(0 8px 8px rgba(10, 4, 40, .45)); animation: hwBreathe 3.4s ease-in-out infinite; }
.kid-card:nth-child(2n) .kt-hero { animation-delay: -1.1s; }
.kid-card .kt-pet { position: absolute; left: 6px; bottom: 40px; width: 64px; height: 64px; object-fit: contain; filter: drop-shadow(0 4px 5px rgba(10, 4, 40, .45)); animation: ktHop 2.6s ease-in-out infinite; }
.kid-card svg { width: 100%; height: auto; max-height: 150px; margin-bottom: auto; } /* no art (?ai=0): the drawn wizard */
.kid-name { position: relative; z-index: 1; margin: 0 0 6px; max-width: calc(100% - 16px); padding: 0 12px; border-radius: 14px; font-size: 16px; line-height: 1.7;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: rgba(20, 10, 60, .55); border: 1px solid rgba(255, 255, 255, .25); }
.new-kid { justify-content: center; border-style: dashed; border-bottom-style: solid; border-color: rgba(255, 236, 170, .8); background: radial-gradient(90% 70% at 50% 40%, rgba(255, 236, 170, .25), rgba(50, 28, 130, .55) 70%); }
#kidCards ~ .new-kid { margin-top: 0; }
.new-kid .nk-art { position: relative; width: 120px; height: 120px; animation: hwBreathe 2.6s ease-in-out infinite; filter: drop-shadow(0 6px 8px rgba(10, 4, 40, .4)); }
.new-kid .kt-glow { bottom: 34px; }
.fam-pick { display: grid; grid-template-columns: repeat(2, var(--kt)); justify-content: center; gap: 14px; }
@keyframes ktHop { 0%, 70%, 100% { transform: none; } 80% { transform: translateY(-8px) scale(.96, 1.05); } 90% { transform: translateY(0) scale(1.05, .95); } }

/* the form: soft glass, pictures first; the name for the parents stays on the device only (D-136) */
#kidForm { position: relative; z-index: 2; width: 100%; max-width: 380px; box-sizing: border-box; padding: 10px 16px 16px; border-radius: 28px; color: #fff;
  background: var(--og-glass); border: 1.5px solid rgba(255, 255, 255, .28); box-shadow: 0 14px 30px rgba(10, 4, 40, .45), inset 0 1px 0 rgba(255, 255, 255, .25);
  -webkit-backdrop-filter: blur(12px) saturate(1.2); backdrop-filter: blur(12px) saturate(1.2); }
#kidForm .sec-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } /* read aloud, not shown: the pictures explain */
#kidName { width: 100%; box-sizing: border-box; font: inherit; font-size: 20px; padding: 8px 44px 8px 14px; border-radius: 16px; border: 2px solid rgba(255, 214, 102, .85); color: var(--ink);
  background: #FFFDF6 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 17l10-10 3 3-10 10H4z' fill='%23FFC93C' stroke='%23B7791F' stroke-width='1.4'/%3E%3Cpath d='M14 7l3 3' stroke='%23B7791F' stroke-width='1.4'/%3E%3C/svg%3E") no-repeat right 12px center / 24px; box-shadow: inset 0 2px 4px rgba(0, 0, 0, .12); }
#kidAge { display: flex; justify-content: center; gap: 6px; margin: 8px 0 4px; }
#kidAge .chip { width: 54px; height: 54px; min-width: 0; padding: 0; border-radius: 50%; font: 700 24px/1 'Rubik', sans-serif; color: #fff;
  background: radial-gradient(circle at 38% 30%, #B9ADFF, #6A4BF0 60%, #4B32C8); border: 2px solid rgba(255, 255, 255, .5); border-bottom: 5px solid #2E1D8A; }
#kidAge .chip[aria-pressed="true"] { background: radial-gradient(circle at 38% 30%, #FFF6C8, #FFC93C 60%, #E08A00); color: #5A2E00; border-color: #FFF6C8; border-bottom-color: #A35A00; box-shadow: 0 0 18px rgba(255, 201, 60, .8); }
#kidForm #kidNext { min-height: 58px; font-size: 22px; display: flex; align-items: center; justify-content: center; gap: 8px; }

/* the egg and lock screens: the child's own guide in a small live medal (wizard for a boy, sorceress for a girl):
   under the 3 eggs while picking; beside the big egg (its free left side) during the 5 locks; never on the title */
#eggScreen .egg-guide { position: relative; flex: 0 0 auto; width: 68px; height: 68px; margin: 0 auto 4vh; pointer-events: none; z-index: 3; }
#eggWrap .egg-guide { position: absolute; left: -90px; top: 22px; margin: 0; }
@media (max-height: 760px) { .hall-wiz { width: 140px; height: 164px; margin-bottom: 14px; } #familyScreen { --kt: min(156px, calc((100vw - 46px) / 2)); } .kid-card, .new-kid { height: 190px; } }
/* owner spec 72 (ProfileSetup, Guy 29.10 09:54; supersedes the spec 71 painted form): landscape RTL, two balanced sides on the calm night
   library. RIGHT: the real title "מִי מְשַׂחֵק?" (C-72c) with a soft glow, under it the one wizard and Blinky looking at him. LEFT: a clean
   magic wood panel with a thin gold frame: the optional name, "בְּנֵי כַּמָּה אַתֶּם?", 5 gem age buttons (4 right .. 8 left), a wide "הַמְשֵׁךְ". */
.hall-wiz .hw-pet { position: absolute; left: -44%; bottom: 0; width: 52%; height: auto; aspect-ratio: 1; object-fit: contain; transform: scaleX(-1); animation: hwPet 3.6s ease-in-out infinite;
  filter: drop-shadow(0 8px 6px rgba(20, 10, 60, .55)); }
@keyframes hwPet { 50% { transform: scaleX(-1) translateY(-3px) scale(1.02, .98); } }
#familyScreen .fam-title { text-shadow: 0 2px 0 #8A4B00, 0 4px 0 rgba(30, 16, 80, .55), 0 0 22px rgba(255, 214, 102, .75), 0 0 44px rgba(150, 120, 255, .45); }
#kidForm { display: flex; flex-direction: column; align-items: stretch; gap: 10px; max-width: 420px; padding: 16px 18px 18px; border-radius: 22px; color: #FFF4D6;
  background: linear-gradient(180deg, rgba(255, 236, 190, .14), rgba(40, 18, 4, .18)), repeating-linear-gradient(180deg, transparent 0 52px, rgba(70, 36, 12, .35) 52px 54px),
    radial-gradient(120% 90% at 30% 20%, #C68B52, #9A6233 60%, #7A4A24);
  border: 3px solid #E8C27A; box-shadow: inset 0 0 0 3px #5B3516, inset 0 3px 0 rgba(255, 236, 190, .45), 0 14px 30px rgba(10, 4, 40, .5), 0 0 24px rgba(255, 214, 102, .25);
  -webkit-backdrop-filter: none; backdrop-filter: none; }
#kidForm .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
#kidForm #kidName { background-color: #FFFFFF; border-color: #F3D9A0; border-radius: 18px; min-height: 48px; }
#kidForm #kidName::placeholder { color: #8A6A4A; opacity: 1; }
#kidForm .age-title { margin: 2px 0 0; text-align: center; font: 700 22px/1.4 'Rubik', sans-serif; color: #FFF4D6; text-shadow: 0 2px 0 #5B3516, 0 0 10px rgba(255, 214, 102, .45); }
#kidForm #kidAge { display: flex; flex-wrap: nowrap; justify-content: center; gap: 12px; margin: 4px 0 6px; }
#kidForm #kidAge .chip { flex: 0 0 auto; margin: 0; }
#kidForm #kidAge .chip { width: 56px; height: 56px; color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .35); border: 3px solid rgba(255, 255, 255, .55); border-bottom-width: 6px;
  transition: transform .15s, box-shadow .2s; }
#kidForm #kidAge .gem4 { background: radial-gradient(circle at 36% 28%, #E6CCFF, #9B5DE5 55%, #5B2A9E); border-bottom-color: #3E1C70; }
#kidForm #kidAge .gem5 { background: radial-gradient(circle at 36% 28%, #FFE1B8, #F08A3C 55%, #A84F12); border-bottom-color: #74350A; }
#kidForm #kidAge .gem6 { background: radial-gradient(circle at 36% 28%, #D8F0FF, #4FA3D9 55%, #1F5F8F); border-bottom-color: #143F60; }
#kidForm #kidAge .gem7 { background: radial-gradient(circle at 36% 28%, #D4FFD9, #3FBF6A 55%, #1C7A3C); border-bottom-color: #11542A; }
#kidForm #kidAge .gem8 { background: radial-gradient(circle at 36% 28%, #D2DEFF, #4A6CF0 55%, #2335A8); border-bottom-color: #172470; }
#kidForm #kidAge .chip[aria-pressed="true"] { transform: scale(1.12); color: #fff; border-color: #FFF6C8; box-shadow: 0 0 0 4px #FFD84D, 0 0 18px 6px rgba(255, 214, 90, .85); }
#kidForm #kidAge .chip.bounce { animation: ageBounce .5s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes ageBounce { 0% { transform: scale(1); } 45% { transform: translateY(-8px) scale(1.16, .94); } 75% { transform: scale(1.06, 1.14); } 100% { transform: scale(1.12); } }
#kidForm #kidAge.nudge .chip { animation: ageNudge .7s ease-in-out 2; }
#kidForm #kidAge.nudge .chip:nth-child(2) { animation-delay: .06s; } #kidForm #kidAge.nudge .chip:nth-child(3) { animation-delay: .12s; }
#kidForm #kidAge.nudge .chip:nth-child(4) { animation-delay: .18s; } #kidForm #kidAge.nudge .chip:nth-child(5) { animation-delay: .24s; }
@keyframes ageNudge { 50% { transform: translateY(-6px) scale(1.08); box-shadow: 0 0 16px 4px rgba(255, 236, 160, .9); } }
#kidForm #kidNext { width: 100%; min-height: 56px; font: 700 24px/1 'Rubik', sans-serif; display: flex; align-items: center; justify-content: center; }
#kidForm #kidNext.off { filter: saturate(.45) brightness(.85); box-shadow: none; }
/* C-72i: the back arrow (only when other kids exist): a round 3D button in the top corner, away from "הַמְשֵׁךְ" */
.kid-back { position: fixed; z-index: 3; top: max(10px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); width: 48px; height: 48px; padding: 0; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer; border: 2px solid rgba(255, 255, 255, .55); border-bottom: 5px solid #2E1D8A;
  background: radial-gradient(circle at 38% 30%, #B9ADFF, #6A4BF0 60%, #4B32C8); box-shadow: 0 6px 12px rgba(10, 4, 40, .4); }
.kid-back svg { width: 24px; height: 24px; } .kid-back:active { transform: translateY(3px); border-bottom-width: 2px; }
@media (orientation: landscape) {
  #familyScreen:has(#kidForm:not([hidden])) { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas: "title form" "hero form"; column-gap: 4vw; align-items: center; justify-items: center; overflow: hidden;
    padding: max(8px, env(safe-area-inset-top)) max(4vw, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(4vw, env(safe-area-inset-left)); }
  #familyScreen:has(#kidForm:not([hidden])) .fam-title { grid-area: title; margin: 0; font-size: clamp(30px, 10vh, 48px); line-height: 1.3; }
  #familyScreen:has(#kidForm:not([hidden])) .hall-wiz { grid-area: hero; align-self: start; width: min(176px, 44vh); height: min(206px, 52vh); margin: 0 0 0 18%; }
  #kidForm { grid-area: form; width: 100%; }
}
@media (orientation: landscape) and (max-height: 420px) {
  #kidForm { gap: 8px; padding: 12px 16px 14px; } #kidForm .age-title { font-size: 20px; } #kidForm #kidAge { gap: 10px; } #kidForm #kidAge .chip { width: 50px; height: 50px; font-size: 22px; }
  #kidForm #kidName { min-height: 44px; font-size: 19px; } #kidForm #kidNext { min-height: 52px; }
}
@media (prefers-reduced-motion: reduce) { #kidForm #kidAge.nudge .chip { animation: none; box-shadow: 0 0 14px 4px rgba(255, 236, 160, .9); } .hall-wiz .hw-pet { animation: none; } }
@media (prefers-reduced-motion: reduce) {
  .hall-wiz img, .hall-wiz.swap img, .hall-wiz .hw-ring, .hall-wiz::after, .kid-card .kt-hero, .kid-card .kt-pet, .new-kid .nk-art { animation: none !important; }
}
