/* KulliQ — فقاعات الألوان: big bubbles rise through a blue sky, each with a 3D thing of its colour inside (drawn
   with Gemini); Sara asks for a colour at the top, the stars won sit at the bottom. The grown-ups' screen, the way out and the
   overlays are those of «المزرعة السحرية» (games/farm/farm.css), kept here so each game stands on its own. */
:root {
  --sky1: #5EC4FF; --sky2: #D8F4FF; --panel: #FFFFFF; --chip: #EEF6FF; --chipLine: #D3E6FA; --sel: #FFF6CC;
  --ink: #1B2A4A; --soft: #4C5B7A; --dim: #6E7B96;
  --sun: #FFD23F; --sunD: #E0A800; --sunInk: #3A2600; --mint: #2EC4B6; --pink: #FF4D6D;
  --display: "Baloo Bhaijaan 2", "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --cloud: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 64'%3E%3Cg fill='%23fff'%3E%3Ccircle cx='32' cy='40' r='20'/%3E%3Ccircle cx='58' cy='28' r='26'/%3E%3Ccircle cx='88' cy='38' r='20'/%3E%3Crect x='30' y='38' width='60' height='22' rx='11'/%3E%3C/g%3E%3C/svg%3E");
  --sky: var(--cloud) 6% 9% / 150px auto no-repeat, var(--cloud) 92% 5% / 190px auto no-repeat, var(--cloud) 12% 90% / 120px auto no-repeat,
    linear-gradient(180deg, var(--sky1) 0%, var(--sky2) 100%);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--sky2); color: var(--ink); font-family: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, system-ui, sans-serif; }
button { font-family: inherit; cursor: pointer; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- the grown-up's screen: the game's name and a big «ابدأ اللعب» in the middle; «المزيد» opens the rest ---- */
.setup { position: relative; min-height: 100vh; min-height: 100dvh; background: var(--sky); background-attachment: fixed; }
.first { position: relative; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 84px 16px 36px; }
.more { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 0 16px 44px; }
.setup.open .first { min-height: 0; padding-bottom: 16px; }
.back { position: absolute; top: 16px; inset-inline-start: 16px; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 999px; background: rgba(255, 255, 255, .9); color: var(--ink); text-decoration: none; font-weight: 600; box-shadow: 0 4px 12px rgba(27, 42, 74, .12); }
.back:hover { background: #fff; }
.sHead { display: flex; flex-direction: column; align-items: center; gap: 12px; width: min(700px, 100%); text-align: center; }
.logo { width: clamp(120px, 30vw, 170px); height: auto; filter: drop-shadow(0 12px 16px rgba(30, 94, 154, .25)); }
.sHead h1 { margin: 0; font: 800 clamp(36px, 9vw, 60px)/1.15 var(--display); color: var(--ink); -webkit-text-stroke: .1em #fff; paint-order: stroke fill; }
.sHead p { margin: 2px 0 0; color: var(--soft); font-size: 17px; font-weight: 600; }
.sCard { width: min(700px, 100%); background: var(--panel); border-radius: 26px; padding: 22px clamp(16px, 4vw, 28px); display: flex; flex-direction: column; gap: 22px; box-shadow: 0 10px 30px rgba(27, 42, 74, .12); }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 12px; font-size: 17px; font-weight: 700; }
.timers { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.timers.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.timers.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.hintLine { margin: 10px 0 0; color: var(--soft); font-size: 14px; line-height: 1.7; }
.chip { background: var(--chip); border: 2px solid var(--chipLine); border-radius: 16px; color: var(--ink); font-size: 15px; font-weight: 600; min-height: 48px; padding: 10px 6px; }
.chip:hover { border-color: #A9CDF2; }
.chip[aria-pressed="true"] { background: var(--sel); border-color: var(--sun); box-shadow: 0 4px 0 var(--sunD); }
.chip:focus-visible, .start:focus-visible, .switch:focus-visible, .back:focus-visible, .lock:focus-visible, .plBtn:focus-visible, .moreBtn:focus-visible, .ask:focus-visible { outline: 3px solid var(--pink); outline-offset: 3px; }
.soundRow { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.soundRow > div { display: flex; flex-direction: column; gap: 2px; }
.soundRow b { font-size: 17px; font-weight: 700; }
.soundRow span { color: var(--soft); font-size: 14px; }
.switch { flex: 0 0 64px; height: 36px; border-radius: 18px; border: 0; padding: 4px; background: #C8D3E6; display: flex; justify-content: flex-start; }
.switch span { width: 28px; height: 28px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.switch[aria-checked="true"] { background: var(--mint); justify-content: flex-end; }
.start { width: min(560px, 100%); display: flex; align-items: center; justify-content: center; gap: 12px; border: 0; border-radius: 22px; padding: 18px 0 15px; background: var(--sun); color: var(--sunInk); box-shadow: 0 7px 0 var(--sunD), 0 14px 28px rgba(27, 42, 74, .2); font: 800 32px/1.2 var(--display); }
.start:active { transform: translateY(4px); box-shadow: 0 3px 0 var(--sunD); }
.first .start { animation: nudge 3s ease-in-out 1.5s infinite; }
.first .start:active { animation: none; }
@keyframes nudge { 0%, 76%, 100% { transform: scale(1); } 84% { transform: scale(1.045); } 92% { transform: scale(.99); } }
.moreBtn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 20px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, .82); color: var(--ink); font-size: 16px; font-weight: 700; box-shadow: 0 4px 12px rgba(27, 42, 74, .1); }
.moreBtn:hover { background: #fff; }
.moreBtn svg { transition: transform .2s; }
.moreBtn[aria-expanded="true"] svg { transform: rotate(180deg); }
.about h2 { margin: 0; font-size: 18px; }
.notes { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; color: var(--soft); font-size: 15px; line-height: 1.7; }
.notes li { display: flex; align-items: flex-start; gap: 10px; }
.notes svg { flex: 0 0 20px; margin-top: 3px; }
.note { margin: 0; width: min(560px, 100%); font-size: 14px; line-height: 1.7; text-align: center; }
.note.warn { color: #9A4B00; }
.also { width: min(700px, 100%); display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.also a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 999px; background: rgba(255, 255, 255, .85); color: var(--ink); text-decoration: none; font-size: 15px; font-weight: 600; box-shadow: 0 4px 12px rgba(27, 42, 74, .1); }
.also a:hover { background: #fff; }
.credits { margin: 0; width: min(700px, 100%); color: var(--dim); font-size: 12px; text-align: center; }
.credits a { color: var(--soft); }
.phoneLock { width: min(700px, 100%); padding: 16px; border-radius: 22px; border: 3px solid var(--sun); background: var(--panel); display: flex; flex-direction: column; gap: 10px; box-shadow: 0 10px 30px rgba(27, 42, 74, .12); }
.plHead { display: flex; align-items: center; gap: 12px; }
.plIcon { flex: 0 0 40px; height: 40px; border-radius: 12px; background: var(--ink); display: flex; align-items: center; justify-content: center; }
.plHead div { display: flex; flex-direction: column; gap: 2px; }
.plHead b { font-size: 16px; }
.plHead span { color: var(--soft); font-size: 14px; line-height: 1.6; }
.plBtn { display: flex; align-items: center; justify-content: center; min-height: 46px; border: 2px solid var(--chipLine); border-radius: 14px; background: var(--chip); color: var(--ink); text-decoration: none; font-size: 16px; font-weight: 600; }
.plBtn:hover { border-color: #A9CDF2; }
@media (max-width: 560px) {
  .first { gap: 18px; padding: 74px 14px 28px; }
  .more { padding: 0 14px 32px; }
  .sCard { padding: 16px 14px; gap: 16px; border-radius: 22px; }
  legend { margin-bottom: 10px; font-size: 16px; }
  .timers { gap: 8px; }
  .chip { font-size: 14px; min-height: 44px; }
  .start { font-size: 28px; padding: 15px 0 12px; }
}

/* ---- the sky the bubbles rise through ---- */
.play { position: fixed; inset: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; overscroll-behavior: none; }
.sky { position: absolute; inset: 0; background: var(--sky); }
.field { position: absolute; inset: 0; -webkit-tap-highlight-color: transparent; }

/* a bubble: a clear ball tinted with its colour (--c; --a light, --b deeper, set by bubbles.js), a white shine, a rim,
   and its thing inside; bubbles.js moves the box, the ball breathes inside it */
.bub { position: absolute; left: 0; top: 0; border-radius: 50%; will-change: transform; cursor: pointer; }
.bub .ball { position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 30% 26%, rgba(255, 255, 255, .95) 0 6%, rgba(255, 255, 255, .45) 7% 12%, rgba(255, 255, 255, 0) 13%),
    radial-gradient(circle at 50% 55%, var(--a) 0 48%, var(--b) 76%, var(--c) 100%),
    /* a milky base, so the blue sky behind does not turn a red bubble purple */
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, .62) 0 60%, rgba(255, 255, 255, .3) 100%);
  box-shadow: inset 0 0 0 5px var(--c), inset 0 0 0 8px rgba(255, 255, 255, .55), inset -8px -10px 18px rgba(255, 255, 255, .3), 0 10px 22px rgba(27, 42, 74, .2);
  animation: breathe 2.6s ease-in-out infinite; animation-delay: var(--dl, 0s); }
@keyframes breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.04, .96); } }
.bub .pic, .thing .pic { position: absolute; inset: 19%; background-repeat: no-repeat; pointer-events: none; filter: drop-shadow(0 4px 4px rgba(27, 42, 74, .22)); }
/* the first bubbles of a round come in where they float (scale composes with the transform bubbles.js sets) */
.bub.in { animation: bubIn .5s cubic-bezier(.2, .9, .3, 1.3) both; }
@keyframes bubIn { from { scale: .3; opacity: 0; } to { scale: 1; opacity: 1; } }
/* a bubble popping: it swells and is gone */
.bub.popped { pointer-events: none; }
.bub.popped .ball { animation: burstOut .2s ease-out forwards; }
.bub.popped .pic { visibility: hidden; }
@keyframes burstOut { to { transform: scale(1.35); opacity: 0; } }

/* the thing that was inside: it jumps out with a bounce, says its name, and fades */
.thing { position: absolute; pointer-events: none; animation: thingOut 1.9s cubic-bezier(.3, .8, .3, 1.2) forwards; }
.thing .pic { inset: 0; }
@keyframes thingOut { 0% { transform: scale(.7); } 18% { transform: scale(1.25) rotate(-6deg); } 32% { transform: scale(1) rotate(4deg); } 44% { transform: scale(1.05) rotate(0); }
  80% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(.85) translateY(-14%); } }
/* its name over it */
.lbl { position: absolute; z-index: 4; padding: 6px 18px; border-radius: 999px; background: rgba(255, 255, 255, .95); color: var(--ink);
  font: 800 clamp(22px, 3.6vh, 34px)/1.3 var(--display); white-space: nowrap; pointer-events: none; box-shadow: 0 6px 16px rgba(27, 42, 74, .18);
  transform: translateX(-50%); animation: lbl 1.9s ease-out forwards; }
.lbl i { display: inline-block; width: .7em; height: .7em; margin-inline-start: 8px; border-radius: 50%; background: var(--c); vertical-align: .04em; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .7); }
@keyframes lbl { 0% { opacity: 0; transform: translate(-50%, 10px) scale(.7); } 14% { opacity: 1; transform: translate(-50%, 0) scale(1.06); } 22% { transform: translate(-50%, 0) scale(1); }
  80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -18px); } }

/* what a pop throws out: drops of its colour and a ring; a star flying to the stars below */
.layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.p { position: absolute; pointer-events: none; animation: fly .7s cubic-bezier(.2, .7, .3, 1) forwards; }
.p.dot { border-radius: 50%; }
.p.ring { border-radius: 50%; border: 4px solid; animation: ring .5s ease-out forwards; }
.p svg { display: block; width: 100%; height: 100%; }
@keyframes fly { 0% { transform: translate(0, 0) scale(.4); opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) scale(1) rotate(var(--r)); opacity: 0; } }
@keyframes ring { 0% { transform: scale(.6); opacity: 1; } 100% { transform: scale(1.5); opacity: 0; } }
.flyStar { position: absolute; z-index: 6; pointer-events: none; filter: drop-shadow(0 0 10px rgba(255, 200, 0, .9));
  transition: transform .8s cubic-bezier(.5, -.2, .3, 1), width .8s, height .8s; }
.flyStar svg { display: block; width: 100%; height: 100%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.confetti { position: absolute; top: -20px; width: 12px; height: 18px; border-radius: 3px; pointer-events: none; animation: fall var(--t, 2.4s) cubic-bezier(.3, .2, .6, 1) forwards; }
@keyframes fall { to { transform: translate(var(--dx, 0), 110vh) rotate(var(--r, 540deg)); } }

/* ---- what Sara asks for, at the top ---- */
.ask { position: absolute; z-index: 5; left: 50%; top: calc(2.4vh + 66px + env(safe-area-inset-top, 0px)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; max-width: 94vw; padding: 6px 10px 6px 20px; border: 0; border-radius: 999px;
  background: rgba(255, 255, 255, .95); color: var(--ink); box-shadow: 0 8px 22px rgba(27, 42, 74, .18); white-space: nowrap; }
.ask .sara { flex: 0 0 auto; width: 52px; height: 52px; border-radius: 50%; object-fit: cover; object-position: 50% 12%; background: #FFE9C7; }
.ask #askText { font: 800 min(36px, 3.8vh, 6.2vw)/1.25 var(--display); }
.swatch { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%; background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, .9) 0 9%, rgba(255, 255, 255, 0) 10%), var(--c, #ccc);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .7), 0 3px 8px rgba(27, 42, 74, .2); }
.ask.pop { animation: askPop .45s cubic-bezier(.2, .9, .3, 1.3) both; }
@keyframes askPop { from { transform: translateX(-50%) scale(.6); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }
.ask.talking .sara { animation: nodTalk .5s ease-in-out infinite alternate; }
@keyframes nodTalk { from { transform: none; } to { transform: scale(1.06) rotate(-3deg); } }
@media (max-width: 420px) { .ask { gap: 8px; padding-inline: 8px 12px; } .ask .sara { width: 44px; height: 44px; } .swatch { width: 36px; height: 36px; } }

/* the stars won, five to a party */
.stars { position: absolute; z-index: 5; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); display: flex; gap: 6px;
  padding: 8px 14px; border-radius: 999px; background: rgba(255, 255, 255, .82); box-shadow: 0 6px 16px rgba(27, 42, 74, .14); pointer-events: none; }
.stars svg { width: clamp(30px, 5vh, 44px); height: clamp(30px, 5vh, 44px); }
.stars path { fill: #DCE6F2; stroke: #C3D1DF; stroke-width: 1; transition: fill .3s; }
.stars .won path { fill: #FFD23F; stroke: #E0A800; }
.stars .won { animation: won .5s cubic-bezier(.2, .9, .3, 1.4); }
@keyframes won { 0% { transform: scale(.4); } 60% { transform: scale(1.35) rotate(15deg); } 100% { transform: none; } }

/* ---- the grown-ups' way out, the clock ---- */
.lock { position: absolute; top: calc(2.4vh + env(safe-area-inset-top, 0px)); left: 2.4vh; z-index: 8; direction: ltr; height: 56px; padding: 0 18px 0 6px; border: 0; border-radius: 28px; background: rgba(255, 255, 255, .88); color: var(--soft); display: flex; align-items: center; gap: 6px; font-size: 16px; font-weight: 600; touch-action: none; box-shadow: 0 4px 12px rgba(27, 42, 74, .14); }
.lock:hover { color: var(--ink); }
.lockIcon { position: relative; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; }
.lockIcon .ring { position: absolute; inset: 0; width: 44px; height: 44px; }
.hint { position: absolute; top: calc(2.4vh + 66px); left: 2.4vh; z-index: 9; padding: 8px 14px; border-radius: 12px; background: #fff; color: var(--ink); font-size: 15px; font-weight: 600; box-shadow: 0 8px 24px rgba(27, 42, 74, .25); pointer-events: none; }
.clock { position: absolute; top: calc(2.4vh + env(safe-area-inset-top, 0px)); right: 2.4vh; z-index: 5; display: flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: rgba(255, 255, 255, .88); color: var(--soft); font-size: 15px; pointer-events: none; box-shadow: 0 4px 12px rgba(27, 42, 74, .12); }
.clock.soon { color: #B04A00; }
@media (max-width: 640px) { .clock { display: none; } }

/* play time over, and a pause */
.sleep, .paused { position: absolute; inset: 0; z-index: 7; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: rgba(21, 23, 61, .9); color: #fff; text-align: center; padding: 16px; }
.sleep h2 { margin: 10px 0 0; font: 800 clamp(34px, 7vh, 60px)/1.2 var(--display); }
.sleep p, .paused p { margin: 0; color: #C3C6EC; font-size: clamp(16px, 2.6vh, 22px); }
.paused .start { width: min(420px, 90vw); }
.plain { margin-top: 10px; min-height: 44px; padding: 0 18px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, .14); color: #C3C6EC; font-size: 16px; font-weight: 600; }
.plain:hover { color: #fff; }

/* ---- the grown-ups' question ---- */
.gateWrap { position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(27, 42, 74, .55);
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.gate { width: min(460px, 100%); background: #fff; color: var(--ink); border-radius: 26px; padding: 26px 30px 22px; box-shadow: 0 24px 60px rgba(27, 42, 74, .35); display: flex; flex-direction: column; gap: 16px; }
.gHead { display: flex; align-items: center; gap: 14px; }
.gIcon { flex: 0 0 48px; height: 48px; border-radius: 14px; background: var(--ink); display: flex; align-items: center; justify-content: center; }
.gHead h2 { margin: 0; font-size: 22px; }
.gHead p { margin: 2px 0 0; color: var(--soft); font-size: 15px; }
.q { display: flex; align-items: center; justify-content: center; gap: 16px; background: var(--chip); border-radius: 18px; padding: 14px 10px; }
#question { font-size: 44px; font-weight: 700; letter-spacing: 1px; white-space: nowrap; }
#answer { box-sizing: border-box; display: flex; align-items: center; justify-content: center; width: 110px; height: 58px; border-radius: 14px; border: 2px solid var(--chipLine); background: #fff; font-size: 34px; font-weight: 700; line-height: 1; color: var(--ink); }
#answer.wait { color: var(--soft); }
#answer.bad { border-color: #C62828; color: #C62828; }
.gMsg { margin: -6px 0 0; min-height: 1.4em; text-align: center; font-size: 15px; color: #C62828; }
.pad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.pad button { min-height: 52px; border-radius: 14px; border: 2px solid var(--chipLine); background: #fff; color: var(--ink); font-size: 24px; font-weight: 600; }
.pad button:hover { background: var(--chip); }
.pad .zero { grid-column: 2; }
.gFoot { display: flex; flex-direction: column; gap: 6px; }
.bar { height: 6px; border-radius: 3px; background: var(--chipLine); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 3px; background: var(--sun); }
.gRow { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; color: var(--soft); }
.link { border: 0; background: none; color: #1B7C74; font-weight: 600; font-size: 14px; min-height: 44px; padding: 0 4px; }
@media (max-width: 420px) {
  .gate { padding: 22px 18px 18px; }
  #question { font-size: 36px; }
  #answer { width: 88px; height: 52px; font-size: 30px; }
}
/* a phone on its side: the pad beside the question, so the whole card fits the short screen */
@media (orientation: landscape) and (max-height: 560px) {
  .gate { width: min(640px, 100%); display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 8px 22px; padding: 16px 22px; }
  .gHead, .q, .gMsg, .gFoot { grid-column: 1; }
  .gHead p { font-size: 14px; }
  .q { padding: 10px 8px; gap: 12px; }
  #question { font-size: 34px; }
  #answer { width: 76px; height: 50px; font-size: 28px; }
  .gMsg { margin: 0; }
  .pad { grid-column: 2; grid-row: 1 / span 4; gap: 8px; }
  .pad button { min-height: 46px; }
}

@media (prefers-reduced-motion: reduce) {
  .first .start, .bub .ball, .ask.talking .sara, .flyStar svg { animation: none !important; }
  .thing, .lbl, .p, .confetti { animation-duration: .6s; }
}
