/* CyberLab Kids: bright cartoon UI, RTL, big touch targets. */
:root {
  --ink: #23314d;
  --sky1: #bdeeff;
  --sky2: #e8f9ff;
  --card: #ffffff;
  --go: #06d6a0;
  --go-d: #04a57b;
  --alt: #ffb703;
  --alt-d: #d48f00;
  --alt2: #8ecae6;
  --alt2-d: #5fa8c9;
  --pink: #ef476f;
  --gold: #ffc300;
  --bar: 58px;
  --r: 20px;
  --shadow: 0 5px 0 rgba(35, 49, 77, .18);
  --font: "Rubik", "Heebo", "Assistant", "Varela Round", "Segoe UI", "Arial Hebrew", Arial, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-weight: 600;
  color: var(--ink);
  background: linear-gradient(180deg, var(--sky1), var(--sky2));
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
button:focus-visible { outline: 4px solid #ffd166; outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
.hidden { display: none !important; }

#app { position: fixed; inset: 0; }
.screen {
  position: absolute; inset: 0;
  display: none; flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.screen.active { display: flex; }

/* ---------- common controls ---------- */
.topbar {
  flex: 0 0 var(--bar);
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px;
}
.topbar h2 { flex: 1; font-size: clamp(17px, 3.2vmin + 6px, 28px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ibtn {
  flex: 0 0 auto;
  width: 50px; height: 50px; border-radius: 50%;
  background: var(--card); box-shadow: var(--shadow);
  font-size: 24px; display: grid; place-items: center;
  transition: transform .1s;
}
.ibtn:active, .btn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(35, 49, 77, .18); }
.chips { display: flex; gap: 8px; }
.chip {
  background: var(--card); border-radius: 999px; padding: 6px 14px;
  box-shadow: var(--shadow); font-size: 18px; white-space: nowrap;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 56px; padding: 0 22px; border-radius: 999px;
  font-size: 20px; font-weight: 800;
  background: var(--alt2); box-shadow: 0 5px 0 var(--alt2-d);
  transition: transform .1s;
}
.btn.big { min-height: 66px; font-size: 24px; padding: 0 30px; }
.btn.small { min-height: 44px; font-size: 17px; padding: 0 16px; }
.btn.go { background: var(--go); box-shadow: 0 5px 0 var(--go-d); color: #fff; }
.btn.alt { background: var(--alt); box-shadow: 0 5px 0 var(--alt-d); }
.btn.alt2 { background: var(--alt2); box-shadow: 0 5px 0 var(--alt2-d); }
.row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* ---------- home ---------- */
#scr-home { background: radial-gradient(circle at 70% 20%, #fff8 0, #fff0 40%), linear-gradient(160deg, #9be7ff 0%, #c8f3ff 50%, #ffe3f1 100%); }
.home-top { display: flex; justify-content: flex-start; align-items: center; gap: 8px; padding: 12px; position: relative; z-index: 2; }
.home-top .android-dl { margin-inline-start: auto; }

/* "Download for Android" button: compact, store-badge style (dark pill, green robot). */
.android-dl {
  display: inline-flex; align-items: center; gap: 10px; height: 50px; padding: 0 16px 0 12px;
  border-radius: 14px; background: #202124; color: #fff; text-decoration: none; box-shadow: var(--shadow);
  border: 1.5px solid #5f6368; transition: transform .1s;
}
.android-dl:active { transform: translateY(2px); }
.android-dl:focus-visible { outline: 4px solid #ffd166; outline-offset: 2px; }
.android-dl svg { width: 38px; height: 24px; flex: 0 0 auto; }
.android-dl span { display: flex; flex-direction: column; line-height: 1.05; }
.android-dl small { font-size: 12px; font-weight: 500; opacity: .85; }
.android-dl b { font-size: 20px; font-weight: 700; direction: ltr; text-align: right; }
.pcard .credit { font-size: 12px; color: #6c757d; line-height: 1.35; }
.codebox {
  width: 100%; font: 14px/1.4 ui-monospace, Consolas, monospace; direction: ltr; text-align: left;
  border: 2px solid #cfe3ff; border-radius: 12px; padding: 8px 10px; resize: vertical; word-break: break-all;
  user-select: text; -webkit-user-select: text;
}
@media (max-width: 420px) {
  .home-top { padding: 10px 8px; gap: 6px; }
  .home-top .chip { padding: 4px 9px; font-size: 15px; }
  .home-top .android-dl { height: 40px; padding: 0 10px 0 8px; gap: 6px; }
  .home-top .android-dl svg { width: 28px; height: 18px; }
  .home-top .android-dl small { font-size: 10px; }
  .home-top .android-dl b { font-size: 15px; }
}
.home-main {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: clamp(10px, 4vw, 50px);
  padding: 0 16px 16px; position: relative; z-index: 2;
}
.home-biti { width: clamp(130px, 30vmin, 260px); cursor: pointer; }
.home-text { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; max-width: 520px; }
.logo { font-size: clamp(36px, 7vmin + 12px, 72px); font-weight: 900; color: #3a0ca3; letter-spacing: -1px; text-shadow: 0 4px 0 #fff, 0 7px 0 rgba(35, 49, 77, .15); line-height: 1; }
.logo span { color: var(--pink); }
.tag { font-size: clamp(16px, 2vmin + 10px, 22px); }
.deco { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.deco .fl { position: absolute; width: clamp(44px, 9vmin, 80px); opacity: .32; animation: floaty 7s ease-in-out infinite; }
.deco .f0 { top: 12%; right: 6%; } .deco .f1 { top: 70%; right: 10%; animation-delay: -1s; }
.deco .f2 { top: 18%; left: 8%; animation-delay: -2s; } .deco .f3 { top: 75%; left: 6%; animation-delay: -3s; }
.deco .f4 { top: 45%; left: 2%; animation-delay: -4s; } .deco .f5 { top: 6%; left: 42%; animation-delay: -5s; }
.deco .f6 { top: 86%; left: 44%; animation-delay: -2.5s; } .deco .f7 { top: 42%; right: 2%; animation-delay: -3.5s; }
@keyframes floaty { 50% { transform: translateY(-14px) rotate(6deg); } }

/* ---------- Biti animations ---------- */
.biti { display: block; width: 100%; height: auto; overflow: visible; }
.wave .b-arm-r { transform-origin: 86px 98px; animation: wave 1.4s ease-in-out infinite; }
@keyframes wave { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-55deg); } }
.dance .biti { animation: dance .5s ease-in-out infinite alternate; transform-origin: 50% 90%; }
.dance .b-arm-r { transform-origin: 86px 98px; animation: wave .5s ease-in-out infinite; }
.dance .b-arm-l { transform-origin: 34px 98px; animation: wave2 .5s ease-in-out infinite; }
@keyframes dance { from { transform: rotate(-8deg) translateY(0); } to { transform: rotate(8deg) translateY(-8px); } }
@keyframes wave2 { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(55deg); } }
.b-ant { animation: blink 2s infinite; }
@keyframes blink { 50% { fill: #ff6b6b; } }

/* ---------- map ---------- */
#scr-map { background: linear-gradient(180deg, var(--sky1), var(--sky2)); }
.wtabs { display: flex; gap: 8px; padding: 0 12px 6px; justify-content: center; }
.wtab {
  flex: 1 1 0; max-width: 190px; min-height: 52px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: #ffffffb0; border-radius: 16px; border: 4px solid transparent; box-shadow: var(--shadow);
  font-size: 17px; padding: 4px 6px;
}
.wtab .we { font-size: 24px; }
.wtab.cur { background: #fff; border-color: var(--wc); }
.wtab.locked { opacity: .65; }
.mapzone { flex: 1; position: relative; margin: 4px 12px 12px; border-radius: 28px; background: #ffffff55; overflow: hidden; }
.mapdeco .md { position: absolute; width: clamp(40px, 9vmin, 76px); opacity: .22; }
.md.m0 { top: 6%; right: 4%; } .md.m1 { bottom: 6%; right: 22%; } .md.m2 { top: 8%; left: 30%; } .md.m3 { bottom: 8%; left: 6%; }
.md.m4 { top: 40%; left: 48%; } .md.m5 { top: 6%; left: 4%; } .md.m6 { bottom: 4%; left: 46%; } .md.m7 { top: 46%; right: 46%; }
.mpath { position: absolute; inset: 0; width: 100%; height: 100%; }
.mpath polyline { fill: none; stroke: #fff; stroke-width: 14; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.lnode {
  position: absolute; transform: translate(-50%, -50%);
  width: clamp(58px, 11vmin, 92px); aspect-ratio: 1; border-radius: 50%;
  background: #fff; border: 5px solid var(--wc); box-shadow: 0 6px 0 rgba(35, 49, 77, .2);
  display: grid; place-items: center;
}
.lnode .ln { font-size: clamp(22px, 4vmin, 36px); font-weight: 900; }
.lnode .lt { position: absolute; top: -10px; left: -10px; font-size: 20px; background: #fff; border-radius: 50%; width: 32px; height: 32px; display: grid; place-items: center; box-shadow: var(--shadow); }
.lnode .ls { position: absolute; bottom: -18px; display: flex; gap: 1px; font-size: 18px; color: #c9cfd8; text-shadow: 0 2px 0 #fff; }
.lnode .ls .on { color: var(--gold); }
.lnode.done { background: #fff8d6; }
.lnode.locked { background: #e9ecef; border-color: #adb5bd; }
.lnode.next { animation: bounce 1.2s ease-in-out infinite; }
@keyframes bounce { 50% { transform: translate(-50%, -58%); } }
.map-biti { position: absolute; width: clamp(46px, 9vmin, 72px); transform: translate(-130%, -105%); pointer-events: none; }

/* ---------- game shell ---------- */
#scr-game { background: linear-gradient(180deg, #c9f2ff, #f2fbff); }
.bubble-row { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; padding: 0 12px 6px; }
.mini-biti { flex: 0 0 auto; width: 66px; }
.bubble {
  flex: 1; position: relative; background: #fff; border-radius: 22px; padding: 10px 16px;
  font-size: clamp(16px, 1.6vmin + 11px, 22px); line-height: 1.35; box-shadow: var(--shadow); min-height: 52px;
  display: flex; align-items: center;
}
.bubble::before {
  content: ""; position: absolute; right: -10px; top: 50%; transform: translateY(-50%);
  border: 10px solid transparent; border-left-color: #fff; border-right: 0;
}
.bubble.pop { animation: pop .35s; }
@keyframes pop { 40% { transform: scale(1.03); } }
.area { flex: 1; min-height: 0; position: relative; margin: 0 10px 10px; }

/* ---------- pairs: cables & match ---------- */
.pairs { position: relative; height: 100%; display: flex; justify-content: space-between; touch-action: none; padding: 4px 0; }
.wires { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; overflow: visible; }
.wire { fill: none; stroke-width: 10; stroke-linecap: round; filter: drop-shadow(0 3px 0 rgba(35, 49, 77, .25)); }
.wire.temp { stroke-dasharray: 2 14; stroke-width: 9; opacity: .85; }
.col { width: 36%; display: flex; flex-direction: column; justify-content: space-around; gap: 6px; z-index: 2; }
.pi {
  flex: 1 1 0; max-height: 96px; min-height: 34px;
  display: flex; align-items: center; gap: 8px;
  border-radius: 18px; transition: transform .15s, box-shadow .15s;
  position: relative;
}
.pi .dicon { height: 82%; max-height: 64px; width: auto; aspect-ratio: 1; flex: 0 0 auto; }
.pi .nm { font-size: clamp(14px, 1.4vmin + 10px, 20px); }
/* cable plug (source) */
.cables .src-i { justify-content: flex-start; }
.cables .tail { flex: 1; height: 12px; background: var(--c); border-radius: 6px 0 0 6px; box-shadow: 0 3px 0 rgba(35, 49, 77, .2); margin-right: -14px; }
.cables .plug {
  flex: 0 0 auto; width: clamp(54px, 9vmin, 72px); height: 82%; max-height: 60px;
  background: var(--c); border: 4px solid var(--ink); border-radius: 14px 8px 8px 14px;
  display: grid; place-items: center; color: #fff; font-size: 30px; line-height: 1; text-shadow: 0 2px 0 rgba(0, 0, 0, .3);
  position: relative;
}
.cables .plug::after { content: ""; position: absolute; left: -12px; top: 30%; width: 10px; height: 40%; background: #adb5bd; border: 3px solid var(--ink); border-radius: 3px; }
.cables .plug .shp { width: 30px; height: 30px; fill: #fff; stroke: rgba(0,0,0,.25); stroke-width: 1.5; }
.cables .port .shp { width: 26px; height: 26px; fill: var(--c); }
@media (max-height: 500px) { .cables .plug .shp { width: 22px; height: 22px; } .cables .port .shp { width: 18px; height: 18px; } }
.cables .src-i.sel .plug { transform: scale(1.1); box-shadow: 0 0 0 6px #fff, 0 0 0 10px var(--c); }
.cables .src-i.done .tail, .cables .src-i.done .plug { opacity: .55; }
/* port (target) */
.dst-i, .dev-card { background: #fff; box-shadow: var(--shadow); padding: 4px 10px; border: 4px solid transparent; }
.cables .port {
  flex: 0 0 auto; width: clamp(40px, 7vmin, 56px); aspect-ratio: 1; border-radius: 50%;
  border: 6px solid var(--c); background: #2b2d42; display: grid; place-items: center;
  color: var(--c); font-size: 24px; line-height: 1;
}
.dst-i.done { border-color: #06d6a0; background: #e9fff7; }
.dst-i.done::after, .dev-card.done::after { content: "✓"; position: absolute; top: -8px; left: -8px; background: #06d6a0; color: #fff; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 17px; }
/* match */
.match .col { width: 40%; }
.dev-card.sel { border-color: #4361ee; transform: scale(1.04); box-shadow: 0 0 0 5px #4361ee44, var(--shadow); }
.dev-card.done { border-color: #06d6a0; background: #e9fff7; }
.job .je { font-size: clamp(22px, 3vmin + 8px, 34px); }
.job .jt { font-size: clamp(14px, 1.3vmin + 10px, 19px); text-align: right; line-height: 1.2; }

/* ---------- device icon states ---------- */
.dicon .led { fill: #52d273; }
.dicon .scr { fill: #90e0ef; }
.dicon .blades { transform-origin: 32px 32px; animation: spin 1.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.off .dicon .led { fill: #b5bcc6; }
.off .dicon .scr { fill: #3d405b; }
.off .dicon .waves, .off .dicon .beam, .off .dicon .shine { opacity: 0; }
.off .dicon .blades { animation: none; }

/* ---------- tech ---------- */
.tech { position: relative; height: 100%; }
.house { height: 100%; display: grid; gap: 8px; }
.house.r2 { grid-template-columns: 1fr 1fr; }
.house.r3 { grid-template-columns: 1fr 1fr 1fr; }
.house.r4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.room {
  position: relative; background: var(--wall); border-radius: 20px;
  border: 4px solid #23314d22; box-shadow: inset 0 -16px 0 #00000010, var(--shadow);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 0;
  transition: background .4s;
}
.room .rname { position: absolute; top: 6px; right: 12px; font-size: clamp(14px, 1.2vmin + 10px, 19px); background: #fff9; padding: 1px 10px; border-radius: 99px; }
.rdevs { display: flex; gap: clamp(8px, 3vw, 28px); align-items: flex-end; padding-top: 18px; }
.dev { position: relative; width: clamp(40px, 12vmin, 82px); }
.dev .dicon { width: 100%; height: auto; display: block; }
.dev .bang {
  position: absolute; top: -8px; left: -6px; width: 28px; height: 28px; border-radius: 50%;
  background: var(--pink); color: #fff; font-style: normal; font-weight: 900; font-size: 20px;
  display: grid; place-items: center; border: 3px solid #fff; animation: pulse 1s infinite;
}
.dev.fault { animation: wobble 1.6s ease-in-out infinite; }
@keyframes wobble { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-6deg); } 90% { transform: rotate(6deg); } 95% { transform: rotate(-3deg); } }
.dev.fixed { filter: drop-shadow(0 0 10px #ffe066); }
.room.ok { background: #d8ffe9; }
.walker {
  position: absolute; top: 0; left: 0; width: clamp(52px, 13vmin, 92px); z-index: 5; pointer-events: none;
  transition: transform .85s ease-in-out;
}
.walker.walking .biti { animation: walk .28s ease-in-out infinite alternate; }
@keyframes walk { to { transform: translateY(-6px) rotate(3deg); } }
.walker.fixing .b-arm-l { transform-origin: 34px 98px; animation: wave2 .25s ease-in-out infinite; }
.fixpanel {
  position: absolute; left: 6px; right: 6px; bottom: 6px; z-index: 6;
  background: #fff; border-radius: 22px; padding: 10px 12px; box-shadow: 0 8px 24px rgba(35, 49, 77, .3), var(--shadow);
  animation: rise .25s ease-out;
}
@keyframes rise { from { transform: translateY(20px); opacity: 0; } }
.fp-title { display: flex; align-items: center; gap: 8px; font-size: clamp(17px, 1.6vmin + 11px, 22px); margin-bottom: 8px; }
.fp-title .dicon { width: 40px; height: 40px; }
.fp-opts { display: flex; gap: 8px; flex-wrap: wrap; }
.opt {
  flex: 1 1 180px; min-height: 56px; display: flex; align-items: center; gap: 8px; padding: 6px 12px;
  background: #f1f7ff; border: 4px solid #cfe3ff; border-radius: 18px; font-size: clamp(15px, 1.4vmin + 10px, 20px); text-align: right;
}
.opt .oe { font-size: 26px; }
.opt.right { background: #d8ffe9; border-color: #06d6a0; }

/* ---------- power ---------- */
.power { position: relative; height: 100%; margin: 0 4%; }
.plines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.pline { stroke: #8d99ae; stroke-width: 8; stroke-linecap: round; stroke-dasharray: 1 14; }
.pline.live { stroke: #ffc300; stroke-dasharray: 16 10; animation: flow .6s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -26; } }
.pnode {
  position: absolute; transform: translate(-50%, -50%);
  width: clamp(86px, 19vmin, 140px); padding: 6px 6px 8px;
  background: #fff; border-radius: 20px; box-shadow: var(--shadow); border: 4px solid #dee2e6;
  display: flex; flex-direction: column; align-items: center; gap: 2px; z-index: 2;
}
.pnode .dicon { width: 62%; height: auto; }
.pnode .nm { font-size: clamp(13px, 1.2vmin + 9px, 18px); line-height: 1.1; text-align: center; }
.pnode .pw { position: absolute; top: -10px; left: -10px; width: 30px; height: 30px; border-radius: 50%; background: #adb5bd; color: #fff; display: grid; place-items: center; font-size: 16px; border: 3px solid #fff; }
.pnode.on { border-color: #ffc300; box-shadow: 0 0 0 5px #ffe06655, 0 0 22px #ffd16699, var(--shadow); }
.pnode.on .pw { background: #ffc300; }
.pnode.root .pw { background: #ff8c42; }
.pnode.off .dicon { filter: saturate(.4) brightness(.92); }

/* ---------- bug ---------- */
.bugwrap { position: relative; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; }
.bugwrap.land { flex-direction: row; gap: 18px; }
.board {
  direction: ltr; position: relative; display: grid;
  grid-template-columns: repeat(var(--w), var(--cell)); grid-auto-rows: var(--cell);
  background: #fff; border-radius: 14px; box-shadow: 0 0 0 5px #fff, 0 0 0 9px #8ecae6, var(--shadow);
}
.cell { border: 1.5px dashed #cfe3ff; }
.cell.start { background: #fff3c4; }
.goal, .bot {
  position: absolute; left: calc(var(--x) * var(--cell)); top: calc(var(--y) * var(--cell));
  width: var(--cell); height: var(--cell); display: grid; place-items: center;
}
.goal { font-size: calc(var(--cell) * .62); animation: pulse 1.4s infinite; }
.bot .biti { width: 100%; height: 100%; }
.bot { padding: 4%; transition: left .35s ease-in-out, top .35s ease-in-out; z-index: 2; }
.bot.happy .biti { animation: dance .4s ease-in-out infinite alternate; }
.side { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.prog { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; max-width: 340px; }
.tile {
  position: relative; width: 56px; height: 62px; border-radius: 14px; background: #fff; box-shadow: var(--shadow);
  border: 4px solid #cfe3ff; display: grid; place-items: center;
}
.tile small { position: absolute; top: 1px; right: 6px; font-size: 12px; opacity: .65; }
.arr { width: 32px; height: 32px; color: #4cc9f0; transition: transform .2s; }
.tile.now { border-color: #ffc300; background: #fff8d6; }
.tile.picked { border-color: var(--pink); }
.tile.caught::after { content: "🐞"; position: absolute; bottom: -10px; left: -8px; font-size: 22px; }
.tile.fixedt { border-color: #06d6a0; background: #e9fff7; }
.tile.fixedt .arr { color: #06d6a0; }
.running .tile { pointer-events: none; }
.dirpick {
  position: absolute; inset: auto 0 0 0; margin: auto; z-index: 6;
  background: #fff; border-radius: 22px; padding: 12px; box-shadow: 0 8px 24px rgba(35, 49, 77, .3);
  display: flex; flex-direction: column; align-items: center; gap: 8px; animation: rise .25s ease-out;
}
.bugwrap.land .dirpick { inset: auto 6px 6px auto; max-width: 46%; }
.dp-title { font-size: 19px; }
.dp-opts { display: flex; gap: 10px; }
.dbtn { width: 64px; height: 64px; border-radius: 18px; background: #f1f7ff; border: 4px solid #cfe3ff; display: grid; place-items: center; }
.dbtn .arr { width: 40px; height: 40px; }
.btn.run { background: var(--go); box-shadow: 0 5px 0 var(--go-d); color: #fff; }

/* ---------- safety ---------- */
.safety { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 4px; }
.scard { background: #fff; border-radius: 26px; padding: 12px 20px; box-shadow: var(--shadow); text-align: center; max-width: 720px; }
.scene { font-size: clamp(38px, 8vmin, 72px); letter-spacing: 6px; }
.sq { font-size: clamp(18px, 2vmin + 11px, 26px); line-height: 1.3; }
.answers { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; width: 100%; max-width: 820px; }
.ans {
  flex: 1 1 200px; min-height: 64px; display: flex; align-items: center; gap: 10px; padding: 8px 16px;
  background: #fff; border: 5px solid #cfe3ff; border-radius: 22px; box-shadow: var(--shadow);
  font-size: clamp(16px, 1.6vmin + 11px, 22px); text-align: right;
}
.ans .ae { font-size: 30px; }
.ans.right { background: #d8ffe9; border-color: #06d6a0; }
.ans.nope { opacity: .55; }
.qdots { display: flex; gap: 8px; }
.qdots i { width: 14px; height: 14px; border-radius: 50%; background: #cfe3ff; }
.qdots i.cur { background: #4cc9f0; transform: scale(1.25); }
.qdots i.done { background: #06d6a0; }

/* ---------- feedback ---------- */
.shake { animation: shake .45s; }
@keyframes shake { 20% { translate: -8px 0; } 40% { translate: 8px 0; } 60% { translate: -5px 0; } 80% { translate: 5px 0; } }
.hinted { animation: hint .8s ease-in-out 4 !important; z-index: 7; }
@keyframes hint { 50% { box-shadow: 0 0 0 8px #ffd166, 0 0 26px #ffd166; scale: 1.06; } }
@keyframes pulse { 50% { scale: 1.15; } }
.spark { position: fixed; z-index: 90; pointer-events: none; font-style: normal; font-size: 22px; transform: translate(-50%, -50%); animation: spark .8s ease-out forwards; }
@keyframes spark { to { translate: var(--dx) var(--dy); opacity: 0; scale: .4; } }
.floaty { position: fixed; z-index: 90; pointer-events: none; font-size: 26px; font-weight: 900; transform: translate(-50%, -50%); animation: floatUp 1.2s ease-out forwards; }
@keyframes floatUp { to { translate: 0 -60px; opacity: 0; } }
#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 80; }
#toast {
  position: fixed; left: 50%; bottom: 18px; transform: translate(-50%, 140%); z-index: 95;
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; font-size: 18px;
  transition: transform .3s, opacity .3s; max-width: 92vw; text-align: center; pointer-events: none; opacity: 0;
}
#toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ---------- overlay / win ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(20, 30, 60, .45); display: flex; align-items: center; justify-content: center; padding: 12px; }
.card { background: #fff; border-radius: 30px; padding: 18px 22px; box-shadow: 0 10px 0 rgba(35, 49, 77, .2); max-width: 560px; width: 100%; max-height: calc(100dvh - 24px); overflow: auto; }
.wincard { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; animation: rise .35s ease-out; }
.wincard h2 { font-size: clamp(26px, 4vmin + 12px, 40px); color: #3a0ca3; }
.win-biti { width: clamp(80px, 18vmin, 130px); }
.bigstars { display: flex; gap: 6px; direction: ltr; }
.bstar { font-size: clamp(44px, 9vmin, 68px); color: #dee2e6; text-shadow: 0 4px 0 #0001; line-height: 1; }
.bstar.on { color: var(--gold); animation: starpop .5s; text-shadow: 0 4px 0 #e0a800; }
@keyframes starpop { 0% { scale: .2; rotate: -90deg; } 70% { scale: 1.35; } }
.earned { font-size: 26px; font-weight: 900; }
.fact { background: #fff8d6; border-radius: 16px; padding: 8px 14px; font-size: 18px; line-height: 1.35; }
.unlocks { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.ul { background: #f3e8ff; border-radius: 16px; padding: 6px 12px; display: flex; align-items: center; gap: 6px; font-size: 16px; animation: starpop .6s 1.6s backwards; }
.ul b { font-size: 28px; }

/* ---------- rewards ---------- */
#scr-rewards { background: linear-gradient(180deg, #ffe3f1, #fff5e1); }
.rtabs { display: flex; gap: 8px; justify-content: center; padding: 0 12px 8px; }
.rtab { min-height: 50px; padding: 0 16px; border-radius: 16px; background: #ffffffa0; box-shadow: var(--shadow); font-size: 18px; border: 4px solid transparent; }
.rtab.cur { background: #fff; border-color: var(--pink); }
.rbody { flex: 1; overflow: auto; padding: 4px 14px 18px; }
.rhint { text-align: center; margin-bottom: 10px; font-size: 18px; }
.stickers { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 12px; max-width: 860px; margin: 0 auto; }
.sticker {
  aspect-ratio: 1; border-radius: 22px; background: #fff; box-shadow: var(--shadow); border: 4px dashed #dee2e6;
  display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 46px;
}
.sticker b { font-size: 34px; color: #ced4da; }
.sticker small { font-size: 14px; color: #868e96; }
.sticker.got { border: 4px solid #ffd166; animation: starpop .5s; }
.shop { display: flex; gap: 16px; align-items: flex-start; max-width: 980px; margin: 0 auto; }
.shop-biti { flex: 0 0 auto; width: clamp(100px, 22vmin, 190px); position: sticky; top: 0; }
.shop-lists { flex: 1; }
.shop-lists h3 { margin: 6px 0; font-size: 20px; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.shop-item { background: #fff; border-radius: 20px; padding: 8px; box-shadow: var(--shadow); border: 4px solid transparent; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.shop-item .sp { width: 62px; }
.shop-item .sn { font-size: 15px; }
.shop-item .sb { font-size: 15px; background: #fff3c4; border-radius: 99px; padding: 2px 10px; }
.shop-item.owned .sb { background: #e7f5ff; }
.shop-item.wearing { border-color: #06d6a0; }
.shop-item.wearing .sb { background: #06d6a0; color: #fff; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; max-width: 900px; margin: 0 auto; }
.badge { background: #fff; border-radius: 22px; padding: 12px; box-shadow: var(--shadow); text-align: center; display: flex; flex-direction: column; gap: 2px; opacity: .6; }
.badge.got { opacity: 1; border: 4px solid #ffd166; }
.badge .be { font-size: 40px; }
.badge small { font-size: 14px; color: #555; }

/* ---------- parents ---------- */
#scr-parents { background: #eef4fb; }
.pbody { flex: 1; overflow: auto; padding: 4px 14px 18px; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.pcard { background: #fff; border-radius: 22px; padding: 14px 18px; box-shadow: var(--shadow); width: 100%; max-width: 720px; display: flex; flex-direction: column; gap: 10px; font-size: 17px; line-height: 1.45; }
.pcard h3 { font-size: 20px; }
.tog { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; cursor: pointer; }
.tog small { display: block; font-weight: 500; font-size: 14px; color: #5c677d; }
.tog input { position: absolute; opacity: 0; pointer-events: none; }
.tog i { flex: 0 0 auto; width: 62px; height: 36px; border-radius: 99px; background: #ced4da; position: relative; transition: background .2s; }
.tog i::after { content: ""; position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; background: #fff; transition: right .2s; box-shadow: 0 2px 3px #0003; }
.tog input:checked + i { background: var(--go); }
.tog input:checked + i::after { right: 30px; }
.tog input:focus-visible + i { outline: 4px solid #ffd166; }
.prow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.seg { display: flex; background: #e9ecef; border-radius: 99px; padding: 4px; }
.seg button { min-height: 40px; padding: 0 14px; border-radius: 99px; font-size: 16px; }
.seg button.cur { background: #fff; box-shadow: 0 2px 0 #0002; }
.danger { border: 3px solid #ffccd5; }
.btn.hold { position: relative; overflow: hidden; background: #ffccd5; box-shadow: 0 5px 0 #f4a3b4; align-self: flex-start; touch-action: none; }
.btn.hold .fill { position: absolute; inset: 0; background: var(--pink); transform: scaleX(0); transform-origin: right; }
.btn.hold.holding .fill { transform: scaleX(1); transition: transform 3s linear; }
.btn.hold .lbl { position: relative; }

/* ---------- small heights (phone landscape) ---------- */
@media (max-height: 500px) {
  :root { --bar: 46px; }
  .android-dl { height: 40px; padding: 0 12px 0 10px; gap: 8px; }
  .android-dl svg { width: 30px; height: 19px; }
  .android-dl small { font-size: 10px; }
  .android-dl b { font-size: 16px; }
  .ibtn { width: 40px; height: 40px; font-size: 19px; }
  .chip { padding: 3px 10px; font-size: 15px; }
  .btn { min-height: 46px; font-size: 17px; }
  .btn.big { min-height: 52px; font-size: 20px; }
  .bubble-row { padding-bottom: 4px; }
  .mini-biti { width: 40px; }
  .bubble { min-height: 40px; padding: 5px 12px; font-size: 15px; line-height: 1.25; }
  .area { margin: 0 8px 6px; }
  .wtabs { padding-bottom: 2px; }
  .wtab { min-height: 40px; font-size: 14px; }
  .wtab .we { font-size: 19px; }
  .mapzone { margin: 2px 10px 8px; }
  .lnode .lt { width: 26px; height: 26px; font-size: 15px; top: -8px; left: -8px; }
  .lnode .ls { font-size: 14px; bottom: -14px; }
  .home-top { padding: 8px; }
  .home-text { gap: 8px; }
  .pi { gap: 5px; min-height: 30px; }
  .cables .plug { font-size: 18px; border-width: 3px; }
  .cables .port { border-width: 4px; font-size: 15px; }
  .room .rname { top: 3px; font-size: 13px; }
  .rdevs { padding-top: 14px; }
  .dev .bang { width: 22px; height: 22px; font-size: 15px; }
  .opt { min-height: 44px; flex-basis: 150px; }
  .fp-title { margin-bottom: 4px; font-size: 16px; }
  .fixpanel { padding: 6px 8px; }
  .pnode { padding: 3px; }
  .tile { width: 46px; height: 50px; }
  .arr { width: 26px; height: 26px; }
  .dbtn { width: 52px; height: 52px; }
  .safety { gap: 6px; }
  .scard { display: flex; align-items: center; gap: 14px; padding: 8px 16px; }
  .scene { font-size: 38px; letter-spacing: 2px; }
  .ans { min-height: 48px; padding: 4px 12px; }
  .card { padding: 10px 16px; }
  .wincard { gap: 4px; }
  .win-biti { width: 64px; }
  .bstar { font-size: 40px; }
  .fact { font-size: 15px; padding: 5px 10px; }
  .earned { font-size: 20px; }
  .rtab { min-height: 40px; font-size: 15px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .wincard { display: grid; grid-template-columns: auto 1fr; column-gap: 14px; text-align: center; max-width: 680px; }
  .wincard .win-biti { grid-row: 1 / span 3; }
  .wincard > :not(.win-biti) { grid-column: 2; justify-self: center; }
}

/* ---------- portrait ---------- */
@media (orientation: portrait) {
  .home-main { flex-direction: column; }
  .house.r3 { grid-template-columns: 1fr; grid-template-rows: repeat(3, 1fr); }
  .house.r4 { grid-template-columns: 1fr 1fr; }
  .wtab .wn { display: none; }
  .wtab .we { font-size: 28px; }
  .chips .chip { padding: 4px 10px; font-size: 15px; }
  .shop { flex-direction: column; align-items: center; }
  .shop-biti { position: static; }
  .col { width: 40%; }
  .cables .col.src { width: 26%; }
  .cables .col.dst { width: 62%; }
  .cables .plug { width: 52px; }
  .pi { overflow: hidden; }
  .pi .dicon { max-height: 46px; }
  .match .col { width: 46%; }
  .match .dev-card { flex-direction: column; justify-content: center; gap: 2px; }
  .match .job { padding: 4px 8px; }
  .pi .nm { font-size: 14px; }
  .job .jt { font-size: 14px; }
}
@media (max-width: 420px) {
  .topbar h2 { font-size: 16px; }
  .cables .tail { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
