/* Cubtoy phase 1 - colours of the approved logo: teal #20C4A6 / #1BA68D, gold #FFC23D, navy #1F2140. Everything centered. */
@font-face { font-family: Fredoka; src: url(/fonts/Fredoka.woff) format('woff'); font-weight: 300 700; font-display: swap; }
:root { --teal: #20C4A6; --teal2: #1BA68D; --gold: #FFC23D; --navy: #1F2140; --ink: #1F2140; --soft: #EFFBF8; --top: 56px; --tabs: 62px; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: radial-gradient(circle at 50% 0, #2b2e5a, var(--navy) 70%); color: var(--ink);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans Arabic', 'Geeza Pro', Tahoma, sans-serif; overscroll-behavior: none; }
button, .btn { font-family: Fredoka, inherit; }
#app { position: relative; max-width: 480px; height: 100dvh; margin: 0 auto; background: var(--soft); display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 0 40px #0006; }
#top { height: var(--top); flex: none; display: flex; align-items: center; justify-content: center; gap: 18px; background: var(--navy); }
#brand { display: flex; align-items: center; gap: 6px; } #brand img { height: 34px; } #brand .word { height: 26px; }
.chip { min-width: 54px; height: 32px; border-radius: 16px; border: 0; background: #ffffff1f; color: #fff; display: inline-flex; align-items: center; justify-content: center; gap: 5px; font: 600 15px Fredoka, sans-serif; text-decoration: none; padding: 0 10px; cursor: pointer; }
.coin { width: 16px; height: 16px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffe08a, var(--gold) 60%, #d99a12); display: inline-block; box-shadow: inset 0 -2px 0 #0002; }
#view { flex: 1; overflow: hidden auto; position: relative; }
#tabs { height: var(--tabs); flex: none; display: flex; justify-content: center; gap: 4px; background: #fff; border-top: 1px solid #0001; }
#tabs a { flex: 0 1 96px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: #6b6f8f; text-decoration: none; font: 600 12px Fredoka, sans-serif; }
#tabs a i { font-style: normal; font-size: 20px; line-height: 1; } #tabs a.on { color: var(--teal2); }
body.kid .only13 { display: none !important; }

/* feed */
.feed { height: 100%; overflow-y: auto; scroll-snap-type: y mandatory; scrollbar-width: none; } .feed::-webkit-scrollbar { display: none; }
.card { height: 100%; scroll-snap-align: start; scroll-snap-stop: always; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 8px 10px; text-align: center; }
.stage { position: relative; width: min(100%, calc((100dvh - var(--top) - var(--tabs) - 120px) * 0.5625)); aspect-ratio: 9 / 16; border-radius: 18px; overflow: hidden; background: #222 center/cover; box-shadow: 0 6px 18px #0003; }
.stage .game { position: absolute; inset: 0; } .stage canvas { display: block; margin: 0 auto; }
.preview { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: #0003; cursor: pointer; }
.preview .sprites { display: flex; gap: 18px; align-items: flex-end; justify-content: center; } .preview .sprites img { height: 64px; filter: drop-shadow(0 4px 4px #0004); }
.play { width: 84px; height: 84px; border-radius: 50%; border: 0; background: var(--gold); color: var(--navy); font-size: 34px; box-shadow: 0 6px 0 #c98f12, 0 10px 20px #0004; cursor: pointer; padding-left: 6px; }
.tag { background: #fffe; color: var(--navy); border-radius: 12px; padding: 4px 12px; font: 600 13px Fredoka, sans-serif; }
.title { font: 700 22px Fredoka, sans-serif; margin: 0; color: var(--navy); } .by { color: #6b6f8f; font-size: 13px; text-decoration: none; }
.actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.act { min-width: 58px; height: 40px; border-radius: 20px; border: 0; background: #fff; color: var(--navy); font: 600 15px Fredoka, sans-serif; display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 0 12px; box-shadow: 0 2px 6px #0002; cursor: pointer; text-decoration: none; }
.act.on { background: #ffe3ea; color: #d6336c; }
.hint { color: #8a8fb0; font-size: 12px; }
.over { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: #1f2140cc; color: #fff; text-align: center; padding: 16px; z-index: 5; }
.over h2 { font: 700 26px Fredoka, sans-serif; margin: 0; } .big { font: 700 64px Fredoka, sans-serif; color: var(--gold); line-height: 1; }
.top5 { list-style: none; margin: 0; padding: 0; min-width: 200px; font-size: 14px; } .top5 li { display: flex; justify-content: space-between; gap: 16px; padding: 3px 8px; border-bottom: 1px solid #fff2; }
.btn { border: 0; border-radius: 22px; height: 44px; padding: 0 22px; background: var(--teal); color: #fff; font-size: 16px; font-weight: 600; cursor: pointer; box-shadow: 0 4px 0 var(--teal2); }
.btn.gold { background: var(--gold); color: var(--navy); box-shadow: 0 4px 0 #c98f12; } .btn.ghost { background: #fff; color: var(--navy); box-shadow: 0 3px 0 #0002; }
.btn:disabled { opacity: .45; cursor: default; }
.count { font: 700 110px Fredoka, sans-serif; color: #fff; text-shadow: 0 6px 20px #0008; }
.score-strip { position: absolute; top: 46px; left: 0; right: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; z-index: 4; pointer-events: none; }
.score-strip span { background: #0008; color: #fff; border-radius: 10px; padding: 2px 8px; font: 600 12px Fredoka, sans-serif; } .score-strip span.me { background: var(--gold); color: var(--navy); }

/* pages */
.page { padding: 16px 14px 30px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.box { width: 100%; background: #fff; border-radius: 18px; padding: 14px; box-shadow: 0 2px 8px #0001; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.box h3 { margin: 0; font: 700 18px Fredoka, sans-serif; color: var(--navy); }
.badge { display: inline-block; background: #e3fbf5; color: var(--teal2); border-radius: 10px; padding: 2px 9px; font: 600 12px Fredoka, sans-serif; }
.badge.test { background: #fff3d6; color: #a46b00; }
.grid { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.pick { width: 72px; min-height: 72px; border-radius: 14px; border: 3px solid transparent; background: #f3f5fb; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 4px; cursor: pointer; font-size: 11px; color: #555; }
.pick img { max-width: 52px; max-height: 44px; } .pick.on { border-color: var(--teal); background: #e3fbf5; }
.tpl { width: 46%; min-height: 76px; border-radius: 14px; border: 3px solid transparent; background: #f3f5fb; padding: 8px; cursor: pointer; text-align: center; }
.tpl b { display: block; font: 700 15px Fredoka, sans-serif; color: var(--navy); } .tpl small { color: #6b6f8f; font-size: 11px; } .tpl.on { border-color: var(--teal); background: #e3fbf5; }
.toggle { border-radius: 16px; border: 2px solid #dfe3f0; background: #fff; padding: 6px 12px; font: 600 13px Fredoka, sans-serif; cursor: pointer; }
.toggle.on { border-color: var(--teal); background: var(--teal); color: #fff; }
.slider { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 13px; } .slider input { width: 80%; accent-color: var(--teal); }
input.text { width: 90%; height: 46px; border-radius: 14px; border: 2px solid #dfe3f0; text-align: center; font: 600 18px Fredoka, system-ui, sans-serif; }
.splitbar { width: 100%; display: flex; height: 30px; border-radius: 10px; overflow: hidden; font: 600 12px Fredoka, sans-serif; color: #fff; }
.splitbar div { display: flex; align-items: center; justify-content: center; }
.ledger { width: 100%; border-collapse: collapse; font-size: 12.5px; } .ledger td { padding: 4px 6px; border-bottom: 1px solid #eef; text-align: center; } .ledger td.n { font-variant-numeric: tabular-nums; font-weight: 600; }
.stats { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; } .stat { min-width: 90px; background: #f3f5fb; border-radius: 14px; padding: 8px 10px; } .stat b { display: block; font: 700 20px Fredoka, sans-serif; color: var(--navy); } .stat small { color: #6b6f8f; font-size: 11px; }
.code { font: 700 40px Fredoka, sans-serif; letter-spacing: 6px; color: var(--navy); }
.players { list-style: none; padding: 0; margin: 0; width: 100%; } .players li { padding: 7px; border-bottom: 1px solid #eef; font: 600 15px Fredoka, sans-serif; }
.mini { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; } .mini a { width: 30%; text-decoration: none; color: var(--navy); font: 600 12px Fredoka, sans-serif; }
.mini .thumb { aspect-ratio: 9/16; border-radius: 12px; background: #333 center/cover; display: flex; align-items: center; justify-content: center; margin-bottom: 4px; } .mini .thumb img { height: 40px; }

/* modal + toast */
#modal { position: fixed; inset: 0; background: #0008; display: flex; align-items: center; justify-content: center; z-index: 50; padding: 14px; }
#modal[hidden] { display: none; }
.sheet { width: 100%; max-width: 420px; max-height: 92dvh; overflow: auto; background: #fff; border-radius: 22px; padding: 18px 16px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.sheet h2 { margin: 0; font: 700 22px Fredoka, sans-serif; color: var(--navy); } .sheet p { margin: 0; color: #555; font-size: 14px; }
.card-form { width: 100%; display: flex; flex-direction: column; gap: 8px; align-items: center; } .card-form input { width: 90%; height: 42px; border-radius: 10px; border: 2px solid #dfe3f0; text-align: center; font-size: 16px; }
#toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 20px; z-index: 60; font: 600 14px Fredoka, sans-serif; text-align: center; max-width: 90vw; }
#toast[hidden] { display: none; }
.confetti { position: absolute; top: -10px; width: 9px; height: 14px; z-index: 9; animation: fall 1.8s linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(540deg); } }
[dir=rtl] .top5 li, [dir=rtl] .ledger { direction: rtl; }
.page .card { width: 100%; height: auto; padding: 0; } .page .stage { width: min(100%, calc((100dvh - var(--top) - var(--tabs) - 60px) * 0.5625)); }
