/* Colour Mixing Lab — fixed 1920×1080 stage scaled into the container.
   Same visual language as the circuit game: Baloo Bhaijaan 2, chunky cards with a solid
   bottom shadow, blue gradient menu, big stars, dashed "did you know?" box.
   Everything is scoped under .ls-colors so nothing leaks into the site. */

.ls-colors {
  --ink: #1d2a44;
  --blue: #1e5bd8;
  --blue-dark: #163f9c;
  --sky: #eaf5ff;
  --paper: #fffaf0;
  --yellow: #ffd54f;
  --orange: #ff9800;
  --green: #2e9d4f;
  --red: #e53935;
  --font: 'Baloo Bhaijaan 2', 'Tajawal', 'Segoe UI', Tahoma, Arial, sans-serif;
  position: relative; height: 100%; overflow: hidden;
  background: #0d1b3a; color: var(--ink); font-family: var(--font);
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.ls-colors, .ls-colors * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
.ls-colors button { font-family: inherit; color: inherit; cursor: pointer; }
.ls-colors button:focus-visible { outline: 6px solid #ffb300; outline-offset: 6px; }
.ls-colors [hidden] { display: none !important; }

.ls-colors #viewport { position: absolute; inset: 0; overflow: hidden; }
.ls-colors #stage {
  position: absolute; left: 0; top: 0; width: 1920px; height: 1080px;
  transform-origin: 0 0; overflow: hidden; background: var(--sky);
}
.ls-colors .screen { position: absolute; inset: 0; display: none; }
.ls-colors .screen.active { display: block; }

/* ---------------------------------------------------------------- menu */
.ls-colors #screen-menu { background: linear-gradient(160deg, #2a62d6, #173b8c); }
.ls-colors .menu-title { margin: 0; padding: 60px 0 30px; text-align: center; color: #fff; font-size: 76px; font-weight: 800; }
.ls-colors #menu-cards { display: grid; grid-template-columns: repeat(4, 380px); gap: 36px; justify-content: center; }
.ls-colors .level-card {
  position: relative; height: 380px; border: none; border-radius: 36px;
  background: #fff; box-shadow: 0 12px 0 #0b2466, 0 20px 40px #0006;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  transition: transform .12s;
}
.ls-colors .level-card:active { transform: translateY(8px) scale(.97); box-shadow: 0 4px 0 #0b2466; }
.ls-colors .level-card .lc-icon { font-size: 110px; line-height: 1.1; }
.ls-colors .level-card .lc-num { font-size: 28px; font-weight: 700; color: #5a6b8c; }
.ls-colors .level-card .lc-name { font-size: 40px; font-weight: 800; padding: 0 16px; text-align: center; line-height: 1.15; }
.ls-colors .level-card .lc-stars { font-size: 46px; letter-spacing: 6px; color: #d7deea; }
.ls-colors .level-card .lc-stars .on { color: var(--yellow); text-shadow: 0 2px 0 #c77800; }
.ls-colors .level-card.lab { background: linear-gradient(160deg, #fff8e1, #ffe082); }
.ls-colors .level-card.locked { background: linear-gradient(160deg, #eceff1, #cfd8dc); color: #546e7a; }
.ls-colors .level-card .lc-badge {
  position: absolute; top: -18px; inset-inline-start: -14px;
  background: var(--red); color: #fff; font-size: 30px; font-weight: 800;
  padding: 6px 22px; border-radius: 30px; transform: rotate(-6deg);
  box-shadow: 0 4px 0 #8e1b1b; animation: lc-wobble 1.8s ease-in-out infinite;
}
@keyframes lc-wobble { 50% { transform: rotate(4deg) scale(1.08); } }
.ls-colors .pill-btn {
  position: absolute; top: 28px; inset-inline-end: 40px;
  min-width: 160px; height: 72px; padding: 0 28px; border-radius: 36px;
  border: 3px solid #ffffff99; background: #ffffff22; color: #fff; font-size: 30px; font-weight: 700;
}

/* ---------------------------------------------------------------- level layout */
.ls-colors #screen-level.active {
  display: grid;
  grid-template-columns: 560px 1360px;
  grid-template-rows: 100px 860px 120px;
  grid-template-areas: "top top" "goal lab" "controls controls";
}
.ls-colors #topbar {
  grid-area: top; display: flex; align-items: center; gap: 30px; padding-inline: 40px;
  background: linear-gradient(90deg, var(--blue-dark), var(--blue)); color: #fff;
  box-shadow: 0 4px 12px #0003; z-index: 3;
}
.ls-colors .tb-text { flex: 1; display: flex; align-items: baseline; gap: 26px; min-width: 0; }
.ls-colors #level-name { font-size: 34px; font-weight: 800; white-space: nowrap; background: #ffffff26; padding: 4px 22px; border-radius: 30px; }
.ls-colors #challenge { font-size: 38px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ls-colors #goal-count { font-size: 28px; font-weight: 700; color: #ffffffcc; white-space: nowrap; }
.ls-colors #level-stars { font-size: 48px; letter-spacing: 4px; color: #ffffff55; white-space: nowrap; }
.ls-colors #level-stars .on { color: var(--yellow); }

/* goal panel */
.ls-colors #goal-panel {
  grid-area: goal; background: var(--paper); border-inline-end: 4px solid #f0dfb8;
  padding: 34px 34px 0; display: flex; flex-direction: column; gap: 26px; z-index: 2;
}
.ls-colors .gp-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.ls-colors .gp-block {
  margin: 0; background: #fff; border-radius: 30px; padding: 18px 14px 20px;
  box-shadow: 0 6px 0 #e3cf9f, 0 8px 18px #0001;
  display: flex; flex-direction: column; align-items: center; gap: 12px; min-height: 330px;
}
.ls-colors .gp-block figcaption { font-size: 32px; font-weight: 800; }
.ls-colors .swatch {
  width: 190px; height: 190px; border-radius: 50%;
  background: var(--sw, transparent);
  border: 8px solid #fff; box-shadow: 0 0 0 4px #d5dce8, inset 0 -18px 0 #0000001a, inset 0 14px 0 #ffffff40;
  transition: background-color .45s;
}
.ls-colors .swatch.empty { background: repeating-conic-gradient(#eef2f7 0 25%, #fff 0 50%) 0 0 / 34px 34px; }
.ls-colors .sw-name { font-size: 24px; font-weight: 700; color: #5a6b8c; text-align: center; line-height: 1.2; min-height: 2.4em; }

.ls-colors #meter { display: flex; flex-direction: column; gap: 10px; }
.ls-colors .meter-track { height: 34px; border-radius: 17px; background: #e7edf5; box-shadow: inset 0 3px 0 #0000000f; overflow: hidden; }
.ls-colors .meter-fill { height: 100%; width: 0; border-radius: 17px; background: #9aa5b8; transition: width .5s cubic-bezier(.3, 1.4, .5, 1), background-color .3s; }
.ls-colors #meter[data-band="near"] .meter-fill { background: var(--orange); }
.ls-colors #meter[data-band="close"] .meter-fill { background: #7cb342; }
.ls-colors #meter[data-band="match"] .meter-fill { background: var(--green); }
.ls-colors .meter-label { font-size: 34px; font-weight: 800; text-align: center; min-height: 1.3em; }
.ls-colors #meter[data-band="match"] .meter-label { color: var(--green); }

.ls-colors #chips { display: flex; flex-wrap: wrap; gap: 10px; }
.ls-colors .chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 16px 6px 12px;
  background: #fff; border-radius: 22px; font-size: 24px; font-weight: 700; box-shadow: 0 3px 0 #e3cf9f;
}
.ls-colors .chip i { width: 22px; height: 22px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px #0002; }
.ls-colors .chip.off { opacity: .5; }
.ls-colors .chip.total { background: transparent; box-shadow: none; color: #5a6b8c; }

/* lab (centre) */
.ls-colors #lab { grid-area: lab; position: relative; display: grid; grid-template-rows: 600px 260px; background: #f4faff; overflow: hidden; }
.ls-colors #paint-area { display: grid; place-items: center; background: radial-gradient(ellipse at 50% 85%, #dcebfb 0 40%, transparent 41%), #f4faff; }
.ls-colors #beaker-wrap { width: 460px; height: 530px; }
.ls-colors .beaker-svg { width: 100%; height: 100%; overflow: visible; }
.ls-colors .liquid, .ls-colors .liquid-top { transition: y .45s cubic-bezier(.3, 1.3, .5, 1), height .45s cubic-bezier(.3, 1.3, .5, 1), cy .45s cubic-bezier(.3, 1.3, .5, 1), fill .6s; }
.ls-colors .liquid-shine { transition: opacity .3s; }
.ls-colors .ripple { fill: none; stroke: #ffffffcc; stroke-width: 4; transform-box: fill-box; transform-origin: center; animation: col-ripple .7s ease-out forwards; }
@keyframes col-ripple { to { transform: scale(3.4); opacity: 0; } }
.ls-colors #lab.matched #beaker-wrap { animation: col-jump .6s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes col-jump { 40% { transform: translateY(-26px) scale(1.04); } }

.ls-colors #light-area { position: relative; }
.ls-colors #light-svg { width: 100%; height: 100%; display: block; }
.ls-colors .beam { mix-blend-mode: screen; }
.ls-colors #spot { transition: fill .35s; }

.ls-colors #shelf {
  display: flex; align-items: flex-end; justify-content: center; gap: 34px;
  padding: 0 40px 22px; background: linear-gradient(#f4faff, #e3eefb);
  border-top: 10px solid #c9a46a; box-shadow: inset 0 6px 0 #a87f45;
}
.ls-colors #shelf.lamps { direction: ltr; gap: 160px; background: linear-gradient(#141b33, #0f1528); border-top-color: #2b3557; box-shadow: none; }
.ls-colors .shelf-item {
  position: relative; border: none; background: transparent; padding: 0;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.ls-colors .shelf-item .art { display: block; width: 130px; height: 200px; }
.ls-colors .shelf-item .art svg { width: 100%; height: 100%; overflow: visible; }
.ls-colors .shelf-item .name {
  font-size: 26px; font-weight: 800; background: #fff; padding: 2px 18px; border-radius: 18px;
  box-shadow: 0 4px 0 #c5d3e6;
}
.ls-colors #shelf.lamps .shelf-item .name { background: #26304f; color: #fff; box-shadow: 0 4px 0 #0a0f1f; }
.ls-colors .tube .tube-squeeze { transform-box: fill-box; transform-origin: 50% 100%; }
.ls-colors .tube.squeeze .tube-squeeze { animation: col-squeeze .32s ease-out; }
@keyframes col-squeeze { 35% { transform: scale(1.12, .86); } 70% { transform: scale(.96, 1.05); } }
.ls-colors .tube:active .art, .ls-colors .lamp:active .art { transform: translateY(6px); }
.ls-colors .lamp .art { filter: drop-shadow(0 0 0 transparent); transition: filter .25s; }
.ls-colors .lamp.on .art { filter: drop-shadow(0 -10px 26px var(--glow)); }
.ls-colors .level-dots { display: flex; gap: 8px; height: 16px; }
.ls-colors .level-dots i { width: 16px; height: 16px; border-radius: 50%; background: #3a4566; }
.ls-colors .level-dots i.on { background: #fff59d; box-shadow: 0 0 10px #fff59d; }
.ls-colors .shelf-item.hint-glow .art { animation: col-hint 1s ease-in-out infinite; }
@keyframes col-hint { 50% { transform: translateY(-14px) scale(1.06); filter: drop-shadow(0 0 22px #ffeb3b); } }

/* controls */
.ls-colors #controls {
  grid-area: controls; display: flex; align-items: center; justify-content: center; gap: 34px;
  background: #dcebfb; border-top: 4px solid #c5dbf3; z-index: 2;
}
.ls-colors .ctrl {
  width: 96px; height: 96px; border-radius: 26px; border: none; background: #fff; box-shadow: 0 6px 0 #a9c3e2;
  display: flex; flex-direction: column; align-items: center; justify-content: center; transition: transform .08s;
}
.ls-colors .ctrl:active { transform: translateY(5px); box-shadow: 0 1px 0 #a9c3e2; }
.ls-colors .ctrl .ico { font-size: 44px; line-height: 1; }
.ls-colors .ctrl .lbl { font-size: 17px; font-weight: 700; line-height: 1.2; }

/* ---------------------------------------------------------------- Qatra + bubble */
/* Qatra stands on the shelf's free corner; the bubble floats above the tubes, never over them. */
.ls-colors #qatra { position: absolute; bottom: 140px; inset-inline-end: 34px; width: 170px; height: 170px; z-index: 6; pointer-events: none; }
.ls-colors .qatra-svg { width: 100%; height: 100%; overflow: visible; }
.ls-colors .qa-body { fill: var(--qa, #64b5f6); stroke: var(--qa-dark, #1e5bd8); stroke-width: 5; stroke-linejoin: round; transition: fill .5s, stroke .5s; }
.ls-colors .qa-aura { fill: var(--qa, #64b5f6); opacity: .22; transition: fill .5s; }
.ls-colors .qa-arm path { fill: none; stroke: var(--qa-dark, #1e5bd8); stroke-width: 7; stroke-linecap: round; }
.ls-colors .qa-arm circle { fill: var(--qa, #64b5f6); stroke: var(--qa-dark, #1e5bd8); stroke-width: 3; }
.ls-colors .qa-bob { animation: qa-bob 2.4s ease-in-out infinite; }
@keyframes qa-bob { 50% { transform: translateY(-7px); } }
.ls-colors .qa-arm-r { transform-origin: 50px 32px; }
.ls-colors .qa-arm-l { transform-origin: -50px 32px; }
.ls-colors .qatra-slot.cheer .qatra-svg { animation: qa-cheer .5s ease-in-out 2; }
@keyframes qa-cheer { 40% { transform: translateY(-50px) rotate(-12deg); } 70% { transform: translateY(0) rotate(8deg); } }
.ls-colors .qatra-slot.cheer .qa-arm { animation: qa-wave .25s ease-in-out infinite alternate; }
@keyframes qa-wave { from { transform: rotate(10deg); } to { transform: rotate(-40deg); } }
.ls-colors .qatra-slot.flash .qatra-svg { animation: qa-flash .3s ease-in-out 6 alternate; }
@keyframes qa-flash { to { filter: drop-shadow(0 0 22px #ffeb3b) brightness(1.15); transform: scale(1.1); } }
.ls-colors .qatra-slot.worried .qatra-svg { animation: qa-shake .12s linear 8; }
@keyframes qa-shake { 25% { transform: translate(-4px, 1px) rotate(-3deg); } 75% { transform: translate(4px, -1px) rotate(3deg); } }

.ls-colors #bubble {
  position: absolute; bottom: 400px; inset-inline-end: 150px; z-index: 6; max-width: 560px; padding: 18px 28px;
  background: #fff; border: 4px solid var(--orange); border-radius: 30px;
  font-size: 32px; font-weight: 700; line-height: 1.3; box-shadow: 0 8px 20px #0003; pointer-events: none;
}
.ls-colors #bubble::after {
  content: ''; position: absolute; bottom: -22px; inset-inline-end: 24px;
  border: 14px solid transparent; border-top: 18px solid var(--orange);
}
.ls-colors #bubble.pop { animation: col-pop .35s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes col-pop { from { transform: scale(.4); opacity: 0; } }

/* falling drops + confetti */
.ls-colors #drop-layer { position: absolute; inset: 0; pointer-events: none; z-index: 8; }
.ls-colors .drop { position: absolute; left: -20px; top: -30px; width: 40px; height: 50px; }
.ls-colors .drop-svg { width: 100%; height: 100%; overflow: visible; }
.ls-colors #fx { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; pointer-events: none; z-index: 30; }

/* ---------------------------------------------------------------- overlays (same as circuit) */
.ls-colors .overlay { position: absolute; inset: 0; z-index: 20; background: #0d1b3acc; display: flex; align-items: center; justify-content: center; }
.ls-colors .card {
  background: #fff; border-radius: 44px; padding: 44px 64px; box-shadow: 0 16px 0 #0b2466, 0 30px 60px #0008;
  text-align: center; animation: col-cardin .45s cubic-bezier(.3, 1.5, .5, 1);
}
@keyframes col-cardin { from { transform: scale(.5) translateY(80px); opacity: 0; } }
.ls-colors .card h2 { margin: 0 0 8px; font-size: 72px; font-weight: 800; color: var(--blue-dark); }
.ls-colors .big-stars { font-size: 110px; letter-spacing: 12px; color: #dde3ec; line-height: 1.1; }
.ls-colors .big-stars span { display: inline-block; }
.ls-colors .big-stars .on { color: var(--yellow); text-shadow: 0 5px 0 #c77800; animation: col-star .5s cubic-bezier(.3, 1.8, .5, 1) backwards; }
@keyframes col-star { from { transform: scale(0) rotate(-90deg); } }
.ls-colors .success-card { width: 1100px; }
.ls-colors .dyk { background: #fff8e1; border: 4px dashed #ffca28; border-radius: 30px; padding: 18px 36px; margin: 18px 0 30px; }
.ls-colors .dyk h3 { margin: 0; font-size: 40px; color: #e65100; }
.ls-colors .dyk p { margin: 8px 0 0; font-size: 36px; font-weight: 600; line-height: 1.4; }
.ls-colors .card-buttons { display: flex; gap: 30px; justify-content: center; }
.ls-colors .btn {
  min-width: 300px; height: 110px; padding: 0 44px; border-radius: 55px; border: none;
  background: #e3ebf7; font-size: 42px; font-weight: 800; box-shadow: 0 8px 0 #a9bad4;
}
.ls-colors .btn.primary { background: var(--green); color: #fff; box-shadow: 0 8px 0 #1b6b33; }
.ls-colors .btn:active { transform: translateY(6px); box-shadow: 0 2px 0 #a9bad4; }
.ls-colors .cert-card { width: 1200px; border: 14px double #ffca28; background: linear-gradient(#fffdf5, #fff6dc); }
.ls-colors .cert-medal { font-size: 120px; line-height: 1; }
.ls-colors .cert-qatra { width: 180px; height: 180px; margin: 0 auto; }
.ls-colors #cert-body { font-size: 44px; font-weight: 700; margin: 6px 0; }
.ls-colors #cert-stars bdi { color: #c77800; font-size: 90px; font-weight: 800; }

@media (prefers-reduced-motion: reduce) {
  .ls-colors *, .ls-colors *::before, .ls-colors *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
