/* Screens: menu, panels, results, skins, word book, champions, settings */
.screen { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: calc(14px + var(--safe-t)) 14px calc(14px + var(--safe-b)); }
.screen.dim { background: radial-gradient(100% 80% at 50% 40%, rgba(27, 18, 64, .45), rgba(12, 6, 32, .82)); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.menu { flex-direction: column; justify-content: space-between; align-items: stretch; background: linear-gradient(180deg, rgba(20,10,50,.35) 0%, transparent 28%, transparent 55%, rgba(20,10,50,.55) 100%); }
.topbar { display: flex; gap: 8px; align-items: center; }
.brand { text-align: center; margin-top: 2vh; }
.logo { margin: 0; font-family: Plex, sans-serif; font-weight: 700; font-weight: 400; font-size: clamp(96px, 26vw, 168px); line-height: .9; position: relative; display: inline-block; }
.logo span { background-image: linear-gradient(110deg, transparent 42%, rgba(255,255,255,.95) 50%, transparent 58%), linear-gradient(180deg, #fffbea 8%, #ffd65e 48%, #f39a21 72%, #c8640e 100%); background-size: 300% 100%, 100% 100%; background-repeat: no-repeat; -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 5px 0 #6b2a00) drop-shadow(0 18px 30px rgba(40, 10, 0, .5)); animation: shine 3.6s ease-in-out infinite; }
@keyframes shine { 0%, 55% { background-position: 150% 0, 0 0; } 100% { background-position: -50% 0, 0 0; } }
.latin { margin: 6px 0 0; font-family: Plex, sans-serif; font-weight: 700;  font-size:14px; opacity: .85; }
.tag { margin: 8px auto 0; max-width: 340px; font-size:18px; font-weight: 700; text-shadow: 0 2px 8px rgba(0,0,0,.45); }
.menu-dock { width: 100%; max-width: 440px; margin: 0 auto; display: grid; gap: 10px; }
.btn-play { position: relative; height: 74px; border-radius: 26px; display: flex; align-items: center; justify-content: center; gap: 12px; font-family: Plex, sans-serif; font-weight: 700; font-size:36px; color: #4a1d00; background: linear-gradient(180deg, #fff1b8 0%, #ffd34f 40%, #f7a11a 100%); box-shadow: 0 8px 0 #b55d07, 0 16px 34px rgba(255, 150, 30, .45), inset 0 2px 0 rgba(255,255,255,.8); transition: transform .15s var(--ease), box-shadow .15s; overflow: hidden; }
.btn-play svg { width: 30px; height: 30px; fill: #4a1d00; }
[dir=rtl] .btn-play svg { transform: scaleX(-1); }
.btn-play::before { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.65) 50%, transparent 70%); transform: translateX(-120%); animation: sweep 2.8s ease-in-out infinite 1s; }
@keyframes sweep { 60%, 100% { transform: translateX(120%); } }
.btn-play:active { transform: translateY(6px) scale(.98); box-shadow: 0 2px 0 #b55d07, 0 8px 18px rgba(255, 150, 30, .35); }
.daily { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 22px; text-align: start; transition: transform .15s var(--ease); }
.daily:active, .tile:active { transform: scale(.96); }
.daily img { width: 54px; height: 46px; object-fit: contain; animation: wiggle 3s ease-in-out infinite; }
@keyframes wiggle { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-8deg); } 90% { transform: rotate(7deg); } 95% { transform: rotate(-4deg); } }
.d-txt { flex: 1; display: grid; }
.d-txt b { font-size:18px; }
.d-txt small { opacity: .85; font-size:14px; }
.d-badge { padding: 4px 10px; border-radius: 999px; background: linear-gradient(180deg, #ff8fa6, #ff4f74); font-weight: 700; box-shadow: 0 4px 12px rgba(255, 80, 120, .45); }
.d-badge.done { background: linear-gradient(180deg, #7ef0d2, #2cc59f); }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tile { display: grid; justify-items: center; gap: 2px; padding: 10px 6px 8px; border-radius: 20px; font-weight: 700; font-size:14px; transition: transform .15s var(--ease); }
.tile img { width: 46px; height: 46px; object-fit: contain; filter: drop-shadow(0 4px 6px rgba(0,0,0,.3)); }
.tile:first-child img { border-radius: 12px; }
.best { margin: 2px 0 0; text-align: center; opacity: .85; font-size:16px; }
@media (min-width: 900px) {
  .menu { align-items: flex-start; padding-inline: 6vw; justify-content: center; gap: 22px; background: linear-gradient(270deg, rgba(20,10,50,.6) 0%, rgba(20,10,50,.15) 45%, transparent 70%); }
  .menu-dock { margin: 0; }
  [dir=ltr] .menu { align-items: flex-end; background: linear-gradient(90deg, rgba(20,10,50,.6) 0%, rgba(20,10,50,.15) 45%, transparent 70%); }
  .topbar { position: fixed; top: 18px; inset-inline: 22px; }
  .brand, .menu-dock { width: 440px; }
}

.panel { width: 100%; max-width: 440px; max-height: 100%; overflow: auto; padding: 22px; border-radius: 30px; background: linear-gradient(180deg, rgba(64, 42, 130, .92), rgba(30, 18, 72, .95)); border: 1px solid rgba(255,255,255,.18); box-shadow: 0 30px 80px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.25); text-align: center; }
.panel.small { max-width: 340px; display: grid; gap: 12px; }
.panel.wide { max-width: 760px; }
.panel h2 { margin: 0 0 6px; font-family: Plex, sans-serif; font-weight: 700; font-weight: 400; font-size:36px; color: #ffe39a; }
.panel h3 { margin: 18px 0 4px; font-size:16px; opacity: .8; }
.panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.panel-head h2 { flex: 1; text-align: start; margin: 0; }
.close { background: rgba(255,255,255,.12); font-size:18px; }
.btn { height: 52px; padding: 0 20px; border-radius: 18px; font-weight: 700; font-size:18px; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22); box-shadow: 0 4px 0 rgba(0,0,0,.25); transition: transform .15s var(--ease); }
.btn:active { transform: translateY(3px) scale(.97); box-shadow: 0 1px 0 rgba(0,0,0,.25); }
.btn.gold { color: #4a1d00; background: linear-gradient(180deg, #fff0b0, #ffcf45 45%, #f4a01c); border: 0; box-shadow: 0 5px 0 #b55d07, 0 10px 24px rgba(255, 150, 30, .35); }
.btn.danger { background: rgba(255, 80, 110, .2); border-color: rgba(255, 120, 140, .5); margin-top: 8px; }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.muted { opacity: .75; } .small { font-size:14px; } .tiny { font-size:12px; margin-top: 14px; }

.results { position: relative; padding-top: 10px; }
.chest-wrap { position: relative; width: 170px; height: 150px; margin: 0 auto; cursor: pointer; }
.chest-wrap img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 12px 18px rgba(0,0,0,.4)); }
.rays { position: absolute; inset: -60px; background: repeating-conic-gradient(from 0deg, rgba(255, 220, 120, .45) 0 10deg, transparent 10deg 24deg); -webkit-mask: radial-gradient(circle, #000 20%, transparent 68%); mask: radial-gradient(circle, #000 20%, transparent 68%); opacity: 0; animation: spin 9s linear infinite; }
@keyframes spin { to { transform: rotate(1turn); } }
.chest-gain { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); font-family: Plex, sans-serif; font-weight: 700; font-size:28px; color: #ffe17a; text-shadow: 0 3px 0 #7a3a00; white-space: nowrap; opacity: 0; display: flex; align-items: center; gap: 6px; }
.chest-gain img { position: static; width: 30px; height: 30px; }
.new-best { margin: 0; display: inline-block; padding: 4px 14px; border-radius: 999px; background: linear-gradient(180deg, #ff8fa6, #ff4f74); font-weight: 700; }
.big-score { font-family: Plex, sans-serif; font-weight: 700; font-size:64px; line-height: 1; margin: 6px 0; background: linear-gradient(180deg, #fff, #ffd45c); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 8px 0; }
.stat { padding: 8px 4px; border-radius: 16px; background: rgba(255,255,255,.08); }
.stat b { display: block; font-family: Plex, sans-serif; font-weight: 700; font-size:22px; color: #ffe39a; }
.stat span { font-size:12px; opacity: .8; }
.word-strip { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 6px; }
.word-strip span { padding: 4px 12px; border-radius: 999px; background: rgba(255, 220, 140, .16); border: 1px solid rgba(255, 220, 140, .35); font-weight: 700; font-size:18px; }
.name-form { margin-top: 12px; } .name-form label { font-size:14px; opacity: .85; }
.name-form input { height: 48px; border-radius: 14px; border: 1px solid rgba(255,255,255,.3); background: rgba(0,0,0,.25); color: #fff; font: inherit; font-size:18px; padding: 0 14px; width: 170px; }

.skin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.skin { position: relative; padding: 12px 10px 12px; border-radius: 22px; background: rgba(255,255,255,.08); border: 1.5px solid rgba(255,255,255,.14); display: grid; justify-items: center; gap: 6px; transition: transform .15s var(--ease); }
.skin:active { transform: scale(.96); }
.skin.on { border-color: var(--gold); background: rgba(255, 207, 90, .14); box-shadow: 0 0 0 4px rgba(255, 207, 90, .15); }
.skin .bird { width: 128px; height: 92px; background: url(../assets/falcon.webp) no-repeat; background-size: 512px 92px; background-position: -128px 0; animation: flap .5s steps(1) infinite; }
@keyframes flap { 0% { background-position: 0 0; } 25% { background-position: -128px 0; } 50% { background-position: -256px 0; } 75% { background-position: -128px 0; } }
.skin.locked .bird { filter: brightness(0) opacity(.45) !important; animation: none; }
.skin b { font-size:16px; }
.skin small { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; opacity: .9; }
.skin small img { width: 18px; height: 18px; }
.book-progress { position: relative; height: 26px; border-radius: 14px; background: rgba(0,0,0,.25); overflow: hidden; margin-bottom: 12px; }
.book-progress i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #4fe3c1, #8fd3ff); border-radius: 14px; }
[dir=rtl] .book-progress i { inset: 0 0 0 auto; }
.book-progress span { position: relative; line-height: 26px; font-weight: 700; font-size:14px; }
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.bw { padding: 8px 4px; border-radius: 18px; background: rgba(255,255,255,.08); display: grid; justify-items: center; gap: 2px; }
.bw img { width: 48px; height: 48px; }
.bw b { font-size:22px; } .bw small { font-size:12px; opacity: .75; }
.bw.no img { filter: brightness(0) opacity(.35); } .bw.no b { opacity: .35; }
.leader-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; counter-reset: r; }
.leader-list li { counter-increment: r; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 16px; background: rgba(255,255,255,.08); font-weight: 700; }
.leader-list li::before { content: counter(r); width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.15); font-family: Plex, sans-serif; font-weight: 700; }
.leader-list li:nth-child(1)::before { background: linear-gradient(180deg, #fff0b0, #f4a01c); color: #4a1d00; }
.leader-list li:nth-child(2)::before { background: linear-gradient(180deg, #fff, #b9c4d6); color: #233; }
.leader-list li:nth-child(3)::before { background: linear-gradient(180deg, #ffd2a8, #c47a3c); color: #3a1800; }
.leader-list li span { flex: 1; text-align: start; } .leader-list li em { font-style: normal; color: #ffe39a; font-family: Plex, sans-serif; font-weight: 700; font-size:22px; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 4px; border-bottom: 1px solid rgba(255,255,255,.1); font-weight: 700; text-align: start; }
.toggle input { appearance: none; width: 52px; height: 30px; border-radius: 99px; background: rgba(255,255,255,.2); position: relative; transition: background .2s; flex: none; order: 2; }
.toggle input::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .25s var(--ease); box-shadow: 0 2px 4px rgba(0,0,0,.3); }
.toggle input:checked { background: linear-gradient(180deg, #ffd34f, #f7a11a); }
.toggle input:checked::after { transform: translateX(22px); }
[dir=rtl] .toggle input:checked::after { transform: translateX(-22px); }

/* missions, ghost hand, tap-anywhere, word count */
.missions { width: 100%; margin: 6px 0 10px; text-align: start; }
.missions .mis-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; font-size:16px; }
.missions .mult { background: linear-gradient(180deg, #ffe48a, #f3a32a); color: #4a1d00; font-weight: 700; border-radius: 999px; padding: 2px 10px; box-shadow: 0 3px 0 #9a4d00; }
.missions ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.missions li { position: relative; display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 8px; padding: 8px 10px 12px; border-radius: 14px; background: rgba(255,255,255,.06); font-size:14px; overflow: hidden; }
.missions li i { font-style: normal; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.14); font-size:12px; font-weight: 700; }
.missions li.ok i { background: #3fd08a; color: #053; }
.missions li em { font-style: normal; opacity: .8; font-size:12px; font-variant-numeric: tabular-nums; }
.missions li .bar { position: absolute; inset-inline: 10px; bottom: 5px; height: 4px; border-radius: 4px; background: rgba(255,255,255,.12); }
.missions li .bar b { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #ffd65e, #ff9d2e); }
.missions li.ok .bar b { background: #3fd08a; }
#ghost { position: fixed; left: 0; top: 0; z-index: 40; pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 6px; will-change: transform; }
#ghost[hidden] { display: none; }
#ghost .gh-hand { font-size:46px; filter: drop-shadow(0 6px 10px rgba(0,0,0,.45)); transform: translate(-50%, 0); animation: ghTap 1s ease-in-out infinite; }
#ghost .gh-text { transform: translate(-50%, 0); background: rgba(27,18,64,.82); color: #fff; padding: 6px 12px; border-radius: 999px; font-weight: 700; font-size:16px; white-space: nowrap; box-shadow: 0 6px 18px rgba(0,0,0,.35); }
@keyframes ghTap { 0%, 100% { scale: 1; } 50% { scale: .86; } }
.tap-any { margin: 2px 0 0; text-align: center; font-weight: 700; font-size:14px; opacity: .85; animation: tapPulse 1.8s ease-in-out infinite; }
@keyframes tapPulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
#bookBtn { position: relative; }
#bookBtn .count { position: absolute; top: 6px; inset-inline-end: 8px; font-size:12px; background: rgba(0,0,0,.35); border-radius: 999px; padding: 1px 7px; font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { #ghost .gh-hand, .tap-any { animation: none; } }

.mult, #mult, .d-badge, .ltr-num { direction: ltr; unicode-bidi: isolate; }

#gate { z-index: 60; }
.gate .q { font-size:18px; font-weight: 700; margin: 4px 0 10px; }
.gate input { width: 120px; height: 56px; margin: 0 auto; border-radius: 16px; border: 2px solid rgba(255,255,255,.35); background: rgba(10,4,40,.4); color: #fff; font-size:28px; text-align: center; font-weight: 700; }
.gate .row { display: flex; gap: 10px; justify-content: center; margin-top: 6px; }
.btn.link { display: inline-flex; align-items: center; justify-content: center; margin-top: 8px; color: #fff; text-decoration: none; }

/* first flight: language + age band (onboard.js) */
#first { z-index: 55; }
.first .langs { display: flex; gap: 8px; justify-content: center; margin-bottom: 6px; }
.first .langs button { min-height: 44px; min-width: 96px; border-radius: 22px; border: 2px solid rgba(255,255,255,.35); background: rgba(10,4,40,.35); color: #fff; font: inherit; font-weight: 700; font-size:18px; }
.first .langs button.on { background: #ffd84a; color: #2a1b5c; border-color: #ffd84a; }
.first .ages { display: grid; gap: 10px; margin-top: 10px; }
.first .age { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 64px; font-size:22px; }
.first .age i { font-style: normal; font-size:28px; }
.parent-week { font-weight: 700; color: #ffe39a; margin: 12px 0 6px; }
.kids { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 8px; }
.kid { min-height: 44px; padding: 0 16px; border-radius: 22px; border: 2px solid rgba(255,255,255,.35); background: rgba(10,4,40,.35); color: #fff; font: inherit; font-weight: 700; font-size:16px; }
.kid.on { background: #ffd84a; color: #2a1b5c; border-color: #ffd84a; } .kid.add { border-style: dashed; }
#buyFamily { margin-top: 8px; }
.parent-check{margin:.6rem 0;padding:.6rem;border-radius:14px;background:rgba(255,255,255,.07)}
.parent-check p{margin:0 0 .4rem}
.code-row{display:flex;gap:.4rem;margin-top:.5rem}
.code-row input{flex:1;min-width:0;padding:.55rem .7rem;border-radius:12px;border:1px solid rgba(255,255,255,.25);background:rgba(0,0,0,.25);color:#fff;font:inherit;}
.check-say{font-size:2.4rem;width:5rem;height:5rem;margin:.4rem auto;display:block}
.check-opts{display:grid;gap:.5rem;margin:.6rem 0}
.check-opt{font-size:1.9rem;padding:.7rem}
.check-opt.right{background:#2e9e5b;color:#fff}
.check-opt.wrong{background:#b8433a;color:#fff}
.check-done{font-size:1.4rem;text-align:center;font-weight:700}
body.classmode::after{content:"وضع الصف · Class mode";position:fixed;bottom:.4rem;left:.5rem;padding:.2rem .7rem;border-radius:99px;background:rgba(42,27,92,.85);color:#ffd76a;font-size:.8rem;pointer-events:none;z-index:50}
