/* Đảo Capy. One phone-shaped stage (at most 480px wide): the painted island on top, the spin machine under it, tabs at the bottom.
   The art is painted pictures (capy/art); the frames around it are chunky cartoon parts: brown outline, gold rim, a light band on top. */
:root {
  --o: #4a2a12; --cream: #fff6dc; --paper: #fffaf0; --orange: #ffa62b; --red: #ff5f57; --green: #3ccf6e; --green-d: #23a04e; --blue: #4fc3ff; --gold: #ffd23f; --sand: #ffe7a3; --rim: #ffd766;
  --f-d: "Baloo 2", "Be Vietnam Pro", system-ui, sans-serif; --f-b: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  --tabs: calc(68px + env(safe-area-inset-bottom, 0px)); --mach: 332px; --rh: 118px;
  --spring: cubic-bezier(.2, 1.4, .4, 1); --out: cubic-bezier(.2, .8, .2, 1);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; background: #58c4f5; }
body { -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
button { font: inherit; color: inherit; cursor: pointer; padding: 0; }
button:focus-visible, a:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
#capy { position: fixed; inset: 0; display: flex; justify-content: center; background: linear-gradient(180deg, #46b9f0, #9be0ff); }
.cg-boot { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 14px; font: 800 17px var(--f-b); color: #fff; text-shadow: 0 2px 0 rgba(0, 60, 120, .45); }
.cg-boot img { width: 132px; height: 120px; object-fit: contain; animation: cg-cheer 1s var(--out) infinite; transform-origin: 50% 100%; }
.cg-boot i { width: 150px; height: 10px; border-radius: 99px; background: rgba(255, 255, 255, .35); overflow: hidden; }
.cg-boot i::after { content: ""; display: block; width: 40%; height: 100%; border-radius: inherit; background: #fff; animation: cg-load 1.1s ease-in-out infinite; }
.cg { position: relative; width: 100%; max-width: 480px; height: 100%; overflow: hidden; overflow: clip; font-family: var(--f-b); font-size: 14px; line-height: 1.35; color: var(--o); background: #7fd6ff; isolation: isolate; }
@media (min-width: 520px) { .cg { box-shadow: 0 0 0 4px var(--o), 0 30px 80px rgba(0, 40, 90, .45); } }
.cg svg, .cg img { display: block; }
.cg img { -webkit-user-drag: none; object-fit: contain; }
.cg-sym { width: 100%; height: 100%; }
.cg-d { font-family: var(--f-d); font-weight: 800; }
.cg-out { color: #fff; text-shadow: 0 3px 0 var(--o), 2px 0 0 var(--o), -2px 0 0 var(--o), 0 -2px 0 var(--o), 2px 2px 0 var(--o), -2px 2px 0 var(--o), 2px -2px 0 var(--o), -2px -2px 0 var(--o); }

/* ───────── world: plain sky and sea behind, the painted island on top ─────────
   The painted base is a square with its own sky and sea. --box (its side), --bb (its gap from the bottom) and --hz (where its
   horizon falls) are set from the page size in game.js, so the plain sky and sea behind line up with the picture's edges. */
.cg-world { position: absolute; left: 0; right: 0; top: 0; height: calc(100% - var(--tabs) - var(--mach) + 34px); overflow: hidden; --box: min(100vw, 480px); --bb: 3%; --hz: 30%; }
.cg-scene { position: absolute; inset: 0; transform-origin: 50% 100%; transition: transform .6s var(--out); }
.cg.is-build .main .cg-scene { transform: translateY(var(--lift, -30%)) scale(var(--ls, .9)); }
.cg-sky { position: absolute; left: -60%; right: -60%; top: -90%; bottom: calc(100% - var(--hz)); background: linear-gradient(0deg, #c8f1fb 0, #b9eaf9 calc(var(--box) * .016), #6fd2f2 calc(var(--box) * .035), #52c6ee calc(var(--box) * .07), #39b9ec calc(var(--box) * .14), #1caae9 calc(var(--box) * .19), #0f97e7 calc(var(--box) * .239), #0a82d6 calc(var(--box) * .239 + 260px)); }
.cg-sea { position: absolute; left: -60%; right: -60%; top: var(--hz); bottom: -90%; background: linear-gradient(90deg, rgba(90, 228, 238, .3) 0, rgba(90, 228, 238, .3) calc(50% - var(--box) * .5), rgba(90, 228, 238, 0) 50%, rgba(0, 140, 225, .22) calc(50% + var(--box) * .5), rgba(0, 140, 225, .22) 100%), linear-gradient(180deg, #1bbeea 0, #38cbdc calc(var(--box) * .26), #06c2d6 calc(var(--box) * .51), #02a3c0 calc(var(--box) * .68), #0186a9 calc(var(--box) * .761), #017592 100%); }
.cg-islebox { position: absolute; left: calc(50% - var(--box) / 2); bottom: var(--bb); width: var(--box); height: var(--box); }
.cw { position: absolute; inset: 0; isolation: isolate; }
.cw-base { position: absolute; inset: 0; width: 100%; height: 100%; -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 9%, #000 91%, transparent 100%), linear-gradient(180deg, transparent 0, #000 6%, #000 91%, transparent 100%); mask-image: linear-gradient(90deg, transparent 0, #000 9%, #000 91%, transparent 100%), linear-gradient(180deg, transparent 0, #000 6%, #000 91%, transparent 100%); -webkit-mask-composite: source-in; mask-composite: intersect; }
/* a building: placed by its foot (left/top = the middle of where it stands) */
.cw-b { position: absolute; transform: translate(-50%, -100%); pointer-events: none; }
.cw-body { position: relative; transform-origin: 50% 97%; animation: cw-breathe 4.4s ease-in-out infinite; animation-delay: var(--d, 0s); }
.cw-body img { width: 100%; height: auto; }
.cw-wheel { position: absolute; transform: translate(-50%, -50%) scale(.9, 1); }
.cw-wheel img { animation: cw-spin 11s linear infinite; }
.cw-b.dmg .cw-wheel img { animation-play-state: paused; }
.cw-sh { position: absolute; left: 4%; right: 4%; bottom: -3%; height: 14%; border-radius: 50%; background: radial-gradient(closest-side, rgba(96, 52, 8, .46), rgba(96, 52, 8, .2) 60%, rgba(96, 52, 8, 0)); }
.cw-b.flat .cw-sh, .cw-b.plot .cw-sh { display: none; }
.cw-b.plot .cw-body, .cw-b.flat .cw-body { animation: none; }
.cw-b.sea .cw-sh { left: -8%; right: -8%; bottom: -7%; height: 26%; background: radial-gradient(closest-side, rgba(255, 255, 255, .7), rgba(255, 255, 255, .28) 62%, rgba(255, 255, 255, 0)); animation: cw-foam 3.4s ease-in-out infinite; }
.cw-b.sea .cw-body { animation: cw-bob 3.4s ease-in-out infinite; transform-origin: 50% 82%; }
.cw-b.dmg .cw-pic, .cw-b.dmg .cw-wheel { filter: saturate(.45) brightness(.8); }
.cw-b.dmg .cw-body { animation: none; transform: rotate(-3deg); }
.cw-ring { display: none; position: absolute; left: -7%; right: -7%; bottom: -9%; height: 38%; border-radius: 50%; border: 4px solid #ff3d33; box-shadow: 0 0 0 2px #fff, inset 0 0 0 2px #fff, 0 0 14px 2px rgba(255, 61, 51, .7); animation: cw-ring 1s ease-in-out infinite; }
.cw-b.can .cw-ring { display: block; }
.cw-b.can .cw-body { animation: cw-wig 1.3s ease-in-out infinite; }
.cw-fx { position: absolute; inset: 0; }
.cw-puff { position: absolute; width: 15%; aspect-ratio: 1; margin: -7.5% 0 0 -7.5%; border-radius: 50%; opacity: 0; animation: cw-puff 3.3s ease-out infinite; }
.cw-puff.smoke { background: radial-gradient(circle at 40% 35%, #fff 0, #eef1f4 55%, rgba(238, 241, 244, 0) 72%); }
.cw-puff.steam { width: 24%; margin: -12% 0 0 -12%; background: radial-gradient(circle, rgba(255, 255, 255, .9) 0, rgba(255, 255, 255, .5) 45%, rgba(255, 255, 255, 0) 70%); }
.cw-puff.dark { width: 19%; margin: -9.5% 0 0 -9.5%; background: radial-gradient(circle at 40% 35%, #8a8078 0, #5b5148 55%, rgba(91, 81, 72, 0) 72%); animation-duration: 2.4s; }
.cw-capy { position: absolute; transform: translate(-50%, -100%); border: 0; background: none; padding: 0; cursor: pointer; }
.cw-capy[hidden] { display: none; }
.cw-capy img { width: 100%; height: auto; transform-origin: 50% 100%; animation: cw-breathe 3s ease-in-out infinite; }
.cw-capy .cw-sh { left: 8%; right: 8%; bottom: -5%; height: 16%; }
.cw-cloud { position: absolute; left: -30%; top: 2%; width: 27%; height: auto; opacity: .95; animation: cw-drift 80s linear infinite; pointer-events: none; }
.cw-cloud.c2 { top: 11.5%; width: 17%; opacity: .85; animation-duration: 115s; animation-delay: -50s; }
.cw-glint { position: absolute; width: 2.6%; aspect-ratio: 1; background: #fff; -webkit-clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%); clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%); opacity: 0; animation: cw-glint 3.6s ease-in-out infinite; pointer-events: none; }
.cw-glint.g1 { left: 6%; top: 80%; } .cw-glint.g2 { left: 31%; top: 93%; animation-delay: -1.1s; } .cw-glint.g3 { left: 71%; top: 95.5%; animation-delay: -2.1s; } .cw-glint.g4 { left: 94%; top: 61%; animation-delay: -2.9s; }

/* ───────── top bar ───────── */
.cg-hud { position: absolute; left: 0; right: 0; top: 0; z-index: 30; display: flex; align-items: center; gap: 8px; padding: calc(10px + env(safe-area-inset-top, 0px)) 10px 0; pointer-events: none; }
.cg-hud > * { pointer-events: auto; }
.cg-ava { position: relative; width: 48px; height: 48px; flex: none; border-radius: 50%; border: 3px solid var(--o); background: radial-gradient(circle at 50% 28%, #fffbe8 0%, #ffe08f 70%, #ffc85a 100%); box-shadow: inset 0 0 0 2.5px #fff3c4, 0 3px 0 var(--o), 0 9px 14px -5px rgba(30, 15, 0, .5); display: grid; place-items: center; }
.cg-ava :is(svg, img) { width: 38px; height: 38px; }
.cg-ava b { position: absolute; right: -7px; bottom: -6px; min-width: 21px; height: 21px; padding: 0 4px; border-radius: 11px; border: 2.5px solid var(--o); background: linear-gradient(180deg, #ffe566, #ffb300); box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, .7); font: 800 11px/16px var(--f-b); text-align: center; }
.cg-pill { position: relative; height: 38px; margin-left: 12px; padding: 0 15px 0 36px; border-radius: 99px; border: 3px solid var(--o); background: linear-gradient(180deg, #8a5226 0%, #5a3013 50%, #3f200b 100%); box-shadow: inset 0 0 0 2px #f4bd3e, inset 0 8px 5px -4px rgba(255, 255, 255, .3), 0 3px 0 var(--o), 0 9px 14px -5px rgba(30, 15, 0, .5); display: flex; align-items: center; color: #fff6cf; text-shadow: 0 2px 0 rgba(30, 10, 0, .65); font: 800 20px/1 var(--f-d); font-variant-numeric: tabular-nums; }
.cg-pill :is(svg, img) { position: absolute; left: -13px; top: 50%; width: 46px; height: 46px; margin-top: -24px; filter: drop-shadow(0 3px 0 rgba(30, 15, 0, .45)); }
.cg-pill.bump { animation: cg-bump .28s var(--spring); }
/* the coin pill is the one part of the top bar that gives way: its number turns short (12,5k · 1,2tr) and, last, is clipped */
.cg-pill { flex: 0 1 auto; min-width: 0; }
.cg-pill span { min-width: 0; padding: 3px 0; overflow: hidden; white-space: nowrap; }
.cg-sp { min-width: 0; }
.cg-shields { flex: none; display: flex; align-items: center; }
.cg-shn { display: none; }
/* no settings while a hammer or dig scene plays */
.cg.is-over .cg-gear { opacity: .45; pointer-events: none; }
.cg-sp { flex: 1; }
.cg-shields { display: flex; gap: 0; padding: 3px 7px; border-radius: 99px; border: 3px solid var(--o); background: linear-gradient(180deg, #8a5226 0%, #5a3013 50%, #3f200b 100%); box-shadow: inset 0 0 0 2px #f4bd3e, inset 0 8px 5px -4px rgba(255, 255, 255, .3), 0 3px 0 var(--o), 0 9px 14px -5px rgba(30, 15, 0, .5); }
.cg-shields i { width: 24px; height: 26px; display: block; opacity: .4; filter: grayscale(1) brightness(.7); transition: opacity .3s, filter .3s; }
.cg-shields i.on { opacity: 1; filter: none; }
.cg-shields i.new { animation: cg-bump .5s var(--spring); }
.cg-round { width: 42px; height: 42px; flex: none; border-radius: 50%; border: 3px solid var(--o); background: radial-gradient(circle at 50% 22%, #ffd98a 0%, #ff9a1f 58%, #e97400 100%); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .4), inset 0 -5px 5px -2px rgba(140, 50, 0, .5), 0 3px 0 var(--o), 0 9px 14px -5px rgba(30, 15, 0, .5); display: grid; place-items: center; }
.cg-round :is(svg, img) { width: 24px; height: 24px; }
.cg-chip { position: absolute; left: 50%; top: calc(66px + env(safe-area-inset-top, 0px)); z-index: 29; transform: translateX(-50%); height: 32px; padding: 0 14px; border-radius: 99px; border: 3px solid var(--o); background: linear-gradient(180deg, #fffdf2, #ffe6a8); box-shadow: inset 0 0 0 2px #fff, 0 3px 0 var(--o), 0 9px 14px -5px rgba(30, 15, 0, .5); display: flex; align-items: center; gap: 8px; white-space: nowrap; font-weight: 700; font-size: 13px; transition: opacity .3s; }
.cg-chip b { display: flex; align-items: center; gap: 3px; color: #c97a00; }
.cg-chip .cg-star { width: 18px; height: 18px; margin: -2px 0; }
.cg.is-over .cg-chip { opacity: 0; }
.cg-star.off { filter: grayscale(1) brightness(1.25); opacity: .42; }

/* ───────── the spin machine ───────── */
.cg-machine { position: absolute; left: 10px; right: 10px; bottom: calc(var(--tabs) + 6px); height: calc(var(--mach) - 16px); z-index: 10; padding: 40px 13px 17px; border-radius: 34px; border: 4px solid var(--o); background: repeating-linear-gradient(180deg, rgba(120, 48, 0, 0) 0, rgba(120, 48, 0, 0) 30px, rgba(120, 48, 0, .13) 30px, rgba(120, 48, 0, .13) 32px), radial-gradient(120% 55% at 50% 0%, rgba(255, 255, 255, .34), rgba(255, 255, 255, 0) 62%), linear-gradient(180deg, #ffb548 0%, #f78f1c 48%, #dc6608 100%); box-shadow: inset 0 0 0 3px #ffe9a6, inset 0 0 0 5px #d97a00, inset 0 -16px 18px -8px rgba(120, 40, 0, .55), 0 7px 0 var(--o), 0 24px 34px -10px rgba(0, 35, 80, .65); display: flex; flex-direction: column; gap: 10px; transition: transform .5s var(--out); }
/* a row of small lamps along the top: two sets that take turns */
.cg-machine::before, .cg-machine::after { content: ""; position: absolute; left: 22px; right: 22px; top: 11px; height: 10px; background: radial-gradient(circle at 50% 50%, #fffdf0 0 2.4px, #ffd23f 3px 4.3px, rgba(255, 210, 63, 0) 5px) 0 0 / 28px 10px repeat-x; pointer-events: none; animation: cg-lamp 1.1s steps(1) infinite; -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(50% - 128px), transparent calc(50% - 124px), transparent calc(50% + 124px), #000 calc(50% + 128px)); mask-image: linear-gradient(90deg, #000 0, #000 calc(50% - 128px), transparent calc(50% - 124px), transparent calc(50% + 124px), #000 calc(50% + 128px)); }
.cg-machine::after { background-position: 14px 0; animation-delay: -.55s; }
.cg.is-build .cg-machine, .cg.is-news .cg-machine { transform: translateY(120%); }
.cg-marq { position: absolute; left: 50%; top: -74px; z-index: 1; width: 250px; height: 104px; margin-left: -125px; pointer-events: none; }
.cg-roof { position: absolute; inset: 0; width: 100%; height: 100%; filter: drop-shadow(0 6px 4px rgba(50, 18, 0, .45)); }
.cg-marq b { position: absolute; left: 15%; right: 15%; top: 60%; bottom: 7%; display: grid; place-items: center; font: 800 23px/1 var(--f-d); letter-spacing: .5px; white-space: nowrap; }
.cg-lan { position: absolute; top: 43%; width: 9%; height: auto; transform-origin: 50% 0; animation: cg-swing 3.4s ease-in-out infinite; filter: drop-shadow(0 4px 3px rgba(50, 18, 0, .35)); }
.cg-lan.l { left: -1.5%; } .cg-lan.r { right: -1.5%; animation-delay: -1.4s; }
.cg-peek { position: absolute; left: 4px; bottom: calc(100% - 3px); width: 70px; height: auto; transform-origin: 50% 100%; animation: cg-peek 5s ease-in-out infinite; pointer-events: none; }
.cg-reels { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 10px; border-radius: 24px; border: 4px solid var(--o); background: linear-gradient(180deg, #4a240b 0%, #8a4a12 40%, #5e3110 100%); box-shadow: inset 0 0 0 3px #ffcf4a, inset 0 0 0 5px #a85d00, inset 0 12px 14px rgba(0, 0, 0, .4), 0 3px 0 rgba(255, 255, 255, .4); }
.cg-reel { position: relative; height: var(--rh); border-radius: 13px; border: 3px solid var(--o); background: #fffdf6; overflow: hidden; }
.cg-reel::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(180deg, rgba(92, 52, 14, .5) 0%, rgba(92, 52, 14, .12) 13%, rgba(92, 52, 14, 0) 26%, rgba(92, 52, 14, 0) 74%, rgba(92, 52, 14, .12) 87%, rgba(92, 52, 14, .5) 100%); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .7); pointer-events: none; }
.cg-strip { position: absolute; left: 0; right: 0; top: 0; will-change: transform; }
.cg-strip.fast { filter: blur(1.4px); }
.cg-tile { display: grid; place-items: center; }
.cg-tile :is(svg, img) { width: 88%; height: 88%; filter: drop-shadow(0 4px 2px rgba(60, 30, 5, .28)); }
.cg-reel.land .cg-tile.cur :is(svg, img) { animation: cg-land .34s var(--spring); }
.cg-reel.win { animation: cg-winbox .7s ease-in-out 3; }
.cg-reel.win .cg-tile.cur :is(svg, img) { animation: cg-winsym .7s ease-in-out 3; }
.cg-reel.tense { box-shadow: 0 0 0 3px var(--gold), 0 0 18px 4px rgba(255, 210, 63, .9); }
.cg-line { position: absolute; top: 50%; width: 0; height: 0; border: 9px solid transparent; transform: translateY(-50%); z-index: 2; filter: drop-shadow(0 2px 0 var(--o)); }
.cg-line.l { left: -5px; border-left-color: var(--gold); }
.cg-line.r { right: -5px; border-right-color: var(--gold); }
.cg-bar { display: flex; align-items: center; gap: 8px; }
.cg-bar :is(svg, img) { width: 32px; height: 32px; margin: -4px -2px -4px 0; flex: none; filter: drop-shadow(0 2px 0 rgba(90, 40, 0, .4)); }
.cg-meter { position: relative; flex: 1; height: 26px; border-radius: 99px; border: 3px solid var(--o); background: linear-gradient(180deg, #3a1d0a, #6a3a14); box-shadow: 0 2px 0 rgba(255, 255, 255, .4); overflow: hidden; }
.cg-meter i { position: absolute; left: 0; top: 0; bottom: 0; min-width: 14px; background: linear-gradient(180deg, #d4f7ff 0%, #5fd6ff 30%, #22a6ee 70%, #1785d3 100%); border-radius: 99px; box-shadow: inset 0 2px 0 rgba(255, 255, 255, .7), 2px 0 0 rgba(0, 0, 0, .25); transition: width .4s var(--out); }
.cg-meter b { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 13.5px; font-weight: 800; text-shadow: 0 1.5px 0 #173d6b, 1px 0 0 #173d6b, -1px 0 0 #173d6b, 0 -1px 0 #173d6b; font-variant-numeric: tabular-nums; }
.cg-next { min-width: 78px; padding: 4px 8px; border-radius: 99px; background: rgba(120, 50, 0, .22); color: #fff8e0; text-shadow: 0 1px 0 rgba(90, 35, 0, .7); font-size: 12px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.cg-go { position: relative; margin-top: auto; height: 68px; flex: none; border-radius: 26px; border: 4px solid var(--o); background: linear-gradient(180deg, #5cea8c 0%, #22c25a 52%, #0f9a40 100%); box-shadow: inset 0 0 0 2.5px rgba(255, 255, 255, .4), inset 0 -11px 10px -5px rgba(0, 85, 30, .6), 0 4px 0 #0c7230, 0 8px 0 var(--o), 0 16px 16px -6px rgba(60, 20, 0, .55); font: 800 34px/1 var(--f-d); letter-spacing: 1.5px; transition: transform .08s, box-shadow .08s, filter .2s; overflow: hidden; }
.cg-go::before { content: ""; position: absolute; left: 9px; right: 9px; top: 5px; height: 44%; border-radius: 18px 18px 40px 40px / 16px 16px 16px 16px; background: linear-gradient(180deg, rgba(255, 255, 255, .62), rgba(255, 255, 255, .1)); pointer-events: none; }
.cg-go span { position: relative; z-index: 1; display: inline-block; animation: cg-beat 1.7s ease-in-out infinite; }
.cg-go[disabled] span { animation: none; }
.cg-go::after { content: ""; position: absolute; top: 0; bottom: 0; left: -40%; width: 26%; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .55), transparent); transform: skewX(-18deg); animation: cg-sheen 3.4s ease-in-out infinite; }
.cg-go:active, .cg-go.down { transform: translateY(6px); box-shadow: inset 0 0 0 2.5px rgba(255, 255, 255, .4), inset 0 -6px 8px -5px rgba(0, 85, 30, .6), 0 1px 0 #0c7230, 0 2px 0 var(--o), 0 6px 8px -4px rgba(60, 20, 0, .5); }
.cg-go[disabled] { filter: saturate(.5) brightness(.95); }
.cg-go[disabled]::after { animation: none; opacity: 0; }

/* ───────── tabs ───────── */
.cg-tabs { position: absolute; left: 0; right: 0; bottom: 0; z-index: 40; height: var(--tabs); padding: 6px 10px calc(10px + env(safe-area-inset-bottom, 0px)); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; background: linear-gradient(180deg, rgba(26, 132, 214, 0), #136fc0 46%); transition: transform .45s var(--out); }
.cg.is-over .cg-tabs { transform: translateY(115%); }
.cg-tab { position: relative; border-radius: 20px; border: 3px solid var(--o); background: linear-gradient(180deg, #fffef6 0%, #ffe9b6 100%); box-shadow: inset 0 0 0 2px #fff, inset 0 -7px 6px -4px rgba(205, 130, 25, .4), 0 4px 0 var(--o), 0 12px 12px -6px rgba(0, 25, 60, .55); display: flex; align-items: center; justify-content: center; gap: 5px; font-weight: 800; font-size: 14px; transition: transform .08s, box-shadow .08s, background .2s; }
.cg-tab :is(svg, img) { width: 34px; height: 34px; margin: -4px 0; filter: drop-shadow(0 2px 0 rgba(74, 42, 18, .3)); }
.cg-tab:active { transform: translateY(3px); box-shadow: inset 0 0 0 2px #fff, 0 1px 0 var(--o); }
.cg-tab[aria-current="true"] { background: linear-gradient(180deg, #fff6a8 0%, #ffcf2e 55%, #ffab0f 100%); box-shadow: inset 0 0 0 2px #fff8cc, inset 0 -7px 6px -4px rgba(190, 95, 0, .5), 0 4px 0 var(--o), 0 12px 12px -6px rgba(0, 25, 60, .55); }
.cg-tab .cg-badge { position: absolute; right: -4px; top: -8px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; border: 2.5px solid var(--o); background: var(--red); color: #fff; font: 800 12px/17px var(--f-b); text-align: center; animation: cg-bump .5s var(--spring); }
.cg-tab.nudge { animation: cg-nudge 1.1s ease-in-out infinite; }

/* ───────── sheets ───────── */
.cg-dim { position: absolute; inset: 0; z-index: 44; background: rgba(20, 40, 80, .45); opacity: 0; pointer-events: none; transition: opacity .3s; }
.cg-dim.on { opacity: 1; pointer-events: auto; }
.cg-sheet { position: absolute; left: 6px; right: 6px; bottom: calc(var(--tabs) + 2px); z-index: 35; top: 39%; padding: 15px 13px 13px; border-radius: 30px; border: 4px solid var(--o); background: linear-gradient(180deg, #fff9e6 0%, #ffedc0 100%); box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 5px #f4cb72, 0 6px 0 var(--o), 0 -12px 40px rgba(0, 30, 70, .35); display: flex; flex-direction: column; gap: 10px; transform: translateY(125%); transition: transform .5s var(--out); visibility: hidden; }
.cg-sheet.on { transform: none; visibility: visible; }
.cg-sheet.news { top: 16%; }
.cg-sheet.modal { z-index: 46; top: auto; bottom: 50%; transform: translateY(50%) scale(.6); opacity: 0; transition: transform .35s var(--spring), opacity .2s, visibility 0s .35s; left: 18px; right: 18px; }
.cg-sheet.modal.on { transform: translateY(50%); opacity: 1; transition: transform .35s var(--spring), opacity .2s; }
.cg-sheet.modal { max-height: 88%; overflow-y: auto; scrollbar-width: none; }
.cg-sh { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cg-sh h2 { margin: 0; font: 800 24px/1 var(--f-d); }
.cg-sh .cg-starsum { display: flex; align-items: center; gap: 4px; font-weight: 800; font-size: 15px; color: #c97a00; }
.cg-sh .cg-starsum .cg-star { width: 20px; height: 20px; }
.cg-x { width: 38px; height: 38px; flex: none; border-radius: 50%; border: 3px solid var(--o); background: radial-gradient(circle at 50% 22%, #ff9a90, #f0483f 60%, #cf2d25); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .4), 0 3px 0 var(--o); display: grid; place-items: center; }
.cg-x :is(svg, img) { width: 18px; height: 18px; }
.cg-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 2px 2px 6px; scrollbar-width: none; overscroll-behavior: contain; }
.cg-list::-webkit-scrollbar { display: none; }
.cg-row { display: flex; align-items: center; gap: 10px; padding: 5px 8px 5px 5px; border-radius: 18px; border: 3px solid var(--o); background: linear-gradient(180deg, #fff 0%, #fff4dc 100%); box-shadow: inset 0 -4px 0 rgba(205, 150, 60, .2), 0 3px 0 rgba(74, 42, 18, .22); }
.cg-row.dmg { border-color: #d4423a; background: linear-gradient(180deg, #fff, #ffe4df); }
.cg-row.max { background: linear-gradient(180deg, #fbfff4, #e2f7cf); }
.cg-th { width: 58px; height: 58px; flex: none; border-radius: 14px; border: 2.5px solid var(--o); background: linear-gradient(180deg, #bfeaff 0%, #e6f8ff 58%, #9be56c 59%, #74d14c 100%); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .65); display: grid; place-items: center; overflow: hidden; }
.cg-th :is(svg, img) { width: 52px; height: 52px; }
.cg-rt { flex: 1; min-width: 0; }
.cg-rt b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.news .cg-rt b { display: inline; }
.cg-rt small { display: block; font-size: 12px; font-weight: 700; color: #d4423a; }
.cg-stars { display: flex; gap: 1px; margin-top: 2px; }
.cg-stars .cg-star { width: 18px; height: 18px; }
.cg-stars .cg-star.pop { animation: cg-starpop .6s var(--spring); }
.cg-btn { --b1: #5cea8c; --b2: #17a548; --b3: rgba(0, 85, 30, .55); min-width: 100px; height: 44px; padding: 0 12px; border-radius: 15px; border: 3px solid var(--o); background: radial-gradient(95% 75% at 50% 0%, rgba(255, 255, 255, .55), rgba(255, 255, 255, 0) 64%), linear-gradient(180deg, var(--b1), var(--b2)); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .35), inset 0 -6px 5px -3px var(--b3), 0 4px 0 var(--o); color: #fff; font: 800 15px/1 var(--f-b); text-shadow: 0 1.5px 0 var(--o), 1px 0 0 var(--o), -1px 0 0 var(--o), 0 -1px 0 var(--o); display: inline-flex; align-items: center; justify-content: center; gap: 4px; white-space: nowrap; transition: transform .08s, box-shadow .08s; font-variant-numeric: tabular-nums; }
.cg-btn :is(svg, img) { width: 26px; height: 26px; margin: -3px 0 -3px -4px; }
.cg-btn:active { transform: translateY(4px); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .35), 0 0 0 var(--o); }
.cg-btn.fix { --b1: #ffc869; --b2: #f58a0a; --b3: rgba(140, 50, 0, .5); }
.cg-btn.red { --b1: #ff8a80; --b2: #e23a31; --b3: rgba(120, 0, 0, .5); }
.cg-btn.blue { --b1: #8adcff; --b2: #2596e6; --b3: rgba(0, 50, 120, .5); }
.cg-btn.plain { --b1: #fff; --b2: #ffeccb; --b3: rgba(205, 130, 25, .4); color: var(--o); text-shadow: none; }
.cg-btn.poor { --b1: #e2dccf; --b2: #b3ab9b; --b3: rgba(60, 50, 40, .4); }
.cg-btn.big { height: 58px; border-radius: 20px; font: 800 23px/1 var(--f-d); width: 100%; border-width: 4px; box-shadow: inset 0 0 0 2.5px rgba(255, 255, 255, .35), inset 0 -8px 7px -4px var(--b3), 0 5px 0 var(--o); }
.cg-btn.no { animation: cg-no .35s; }
.cg-done { font-weight: 800; font-size: 13px; color: var(--green-d); min-width: 96px; text-align: center; }
.cg-foot { padding: 8px 12px; border-radius: 14px; background: linear-gradient(180deg, #ffe9a8, #ffdb85); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .5); font-size: 13px; font-weight: 600; }
.cg-empty { margin: auto; text-align: center; font-weight: 600; color: #8a6a4a; padding: 20px; }
.cg-ni { width: 44px; height: 44px; flex: none; border-radius: 50%; border: 3px solid var(--o); display: grid; place-items: center; background: radial-gradient(circle at 50% 25%, #fff6cf, #ffd98a); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .6); }
.cg-ni :is(svg, img) { width: 32px; height: 32px; }
.cg-row time { display: block; font-size: 12px; color: #8a6a4a; font-weight: 500; }
.cg-row.new { background: #fff8e0; }
.cg-odds { display: grid; grid-template-columns: auto 1fr auto; gap: 6px 10px; align-items: center; font-size: 13px; }
.cg-odds :is(svg, img) { width: 30px; height: 30px; }
.cg-odds b { font-variant-numeric: tabular-nums; }
.cg-set { display: flex; flex-direction: column; gap: 10px; }
.cg-note { font-size: 12px; color: #8a6a4a; text-align: center; }

/* ───────── scenes over the game: hammer, dig, island finished ───────── */
.cg-over { position: absolute; inset: 0; z-index: 25; overflow: hidden; visibility: hidden; -webkit-clip-path: circle(0% at 50% 62%); clip-path: circle(0% at 50% 62%); transition: clip-path .55s cubic-bezier(.7, 0, .2, 1), visibility 0s .55s; }
.cg-over.on { visibility: visible; -webkit-clip-path: circle(140% at 50% 62%); clip-path: circle(140% at 50% 62%); transition: clip-path .6s cubic-bezier(.7, 0, .2, 1), -webkit-clip-path .6s cubic-bezier(.7, 0, .2, 1); }
.cg-over .cg-world { height: 100%; }
.cg-over.attack .cg-world::after { content: ""; position: absolute; inset: 0; background: radial-gradient(120% 78% at 50% 46%, rgba(160, 30, 10, 0) 58%, rgba(120, 20, 5, .42) 100%); pointer-events: none; }
.cg-banner { position: absolute; left: 0; right: 0; top: calc(66px + env(safe-area-inset-top, 0px)); z-index: 3; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.cg-ribbon { height: 52px; padding: 0 26px; border-radius: 99px; border: 4px solid var(--o); background: radial-gradient(90% 70% at 50% 0%, rgba(255, 255, 255, .5), rgba(255, 255, 255, 0) 62%), linear-gradient(180deg, #ff8076 0%, #ee443b 55%, #c9261f 100%); box-shadow: inset 0 0 0 2.5px var(--rim), inset 0 -7px 8px -3px rgba(110, 0, 0, .5), 0 5px 0 var(--o), 0 14px 16px -6px rgba(40, 10, 0, .5); display: flex; align-items: center; gap: 8px; font: 800 26px/1 var(--f-d); white-space: nowrap; }
.cg-ribbon :is(svg, img) { width: 40px; height: 40px; margin: -4px 0; filter: drop-shadow(0 3px 0 rgba(40, 10, 0, .35)); }
.cg-ribbon.or { background: radial-gradient(90% 70% at 50% 0%, rgba(255, 255, 255, .5), rgba(255, 255, 255, 0) 62%), linear-gradient(180deg, #ffc869 0%, #ff9a1f 55%, #e06c00 100%); box-shadow: inset 0 0 0 2.5px #fff0b8, inset 0 -7px 8px -3px rgba(130, 45, 0, .5), 0 5px 0 var(--o), 0 14px 16px -6px rgba(40, 10, 0, .5); }
.cg-over.on .cg-ribbon { animation: cg-drop .6s var(--spring) .25s both; }
.cg-sub { padding: 5px 14px; border-radius: 99px; background: linear-gradient(180deg, #fff, #ffefc9); border: 2.5px solid var(--o); box-shadow: 0 3px 0 rgba(74, 42, 18, .3); font-weight: 700; font-size: 13px; }
.cg-card { position: absolute; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); z-index: 4; padding: 15px; border-radius: 28px; border: 4px solid var(--o); background: linear-gradient(180deg, #fff9e6 0%, #ffedc0 100%); box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 5px #f4cb72, 0 6px 0 var(--o), 0 20px 30px -10px rgba(0, 30, 70, .5); display: flex; flex-direction: column; gap: 10px; }
.cg-who { display: flex; align-items: center; gap: 10px; }
.cg-who .cg-ava { width: 50px; height: 50px; }
.cg-who .cg-ava :is(svg, img) { width: 42px; height: 42px; }
.cg-who b { font-size: 17px; }
.cg-who span { display: block; font-size: 13px; }
.cg-who .sh { margin-left: auto; display: flex; align-items: center; gap: 3px; font-weight: 800; }
.cg-who .sh :is(svg, img) { width: 24px; height: 26px; }
.cg-msg { font-size: 14px; font-weight: 600; text-align: center; min-height: 20px; }
.cg-res { display: flex; align-items: center; justify-content: center; gap: 8px; font: 800 30px/1 var(--f-d); }
.cg-res :is(svg, img) { width: 42px; height: 42px; margin: -4px 0; }
.cg-over.attack .cg-banner { transition: opacity .3s, transform .3s; }
.cg-over.attack.lock .cg-banner { opacity: 0; transform: translateY(-20px); }
.cg-hammer { position: absolute; left: 0; top: 0; width: 130px; height: 130px; z-index: 6; pointer-events: none; opacity: 0; filter: drop-shadow(0 10px 4px rgba(74, 42, 18, .3)); }
.cg-shieldfx { position: absolute; left: 0; top: 0; width: 150px; height: 150px; z-index: 5; pointer-events: none; opacity: 0; }
.cg-flash { position: absolute; inset: 0; z-index: 7; background: #fff; opacity: 0; pointer-events: none; }
.cg-flash.on { animation: cg-flash .32s ease-out; }
.cg.shake { animation: cg-shake .42s cubic-bezier(.36, .07, .19, .97); }
/* dig */
.cg-over.raid { background: #6fd04a url("/capy/art/meadow.webp?v=1") center / cover; }
.cg-over.raid::before { content: ""; position: absolute; inset: 0; background: radial-gradient(70% 46% at 50% 42%, rgba(255, 255, 220, .28), rgba(255, 255, 220, 0) 70%), linear-gradient(180deg, rgba(10, 60, 20, .28) 0, rgba(10, 60, 20, 0) 18%, rgba(10, 60, 20, 0) 70%, rgba(10, 60, 20, .3) 100%); }
.cg-mounds { position: absolute; left: 22px; right: 22px; top: calc(150px + env(safe-area-inset-top, 0px)); bottom: 286px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 10px 18px; z-index: 2; }
.cg-mound { position: relative; border: 0; background: none; display: grid; place-items: center; transition: transform .15s; }
.cg-mound :is(svg, img) { width: 100%; height: 100%; max-height: 150px; overflow: visible; filter: drop-shadow(0 9px 5px rgba(20, 60, 5, .4)); }
.cg-mound:not([disabled]):active { transform: scale(.94); }
.cg-mound:not([disabled]) :is(svg, img) { animation: cg-wig2 1.8s ease-in-out infinite; }
.cg-mound:nth-child(2) :is(svg, img) { animation-delay: .3s; } .cg-mound:nth-child(3) :is(svg, img) { animation-delay: .6s; } .cg-mound:nth-child(4) :is(svg, img) { animation-delay: .9s; }
.cg-mound.late { opacity: .55; }
.cg-mound .v { position: absolute; left: 0; right: 0; bottom: 6%; text-align: center; font: 800 21px/1 var(--f-d); }
.cg-digger { position: absolute; left: 50%; bottom: 196px; width: 124px; height: 124px; margin-left: -62px; z-index: 3; pointer-events: none; transition: none; filter: drop-shadow(0 8px 5px rgba(30, 80, 10, .35)); }
.cg-digger :is(svg, img) { width: 100%; height: 100%; }
.cg-digger.dig :is(svg, img) { animation: cg-dig .22s ease-in-out infinite; transform-origin: 50% 90%; }
.cg-pips { display: flex; gap: 6px; }
.cg-pips i { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--o); background: radial-gradient(circle at 40% 30%, #ffe08a, #ff9a1f 70%); transition: background .2s, transform .3s var(--spring); }
.cg-pips i.used { background: #d9c9a8; transform: scale(.8); }
.cg-tot { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 16px; border: 3px solid var(--o); background: linear-gradient(180deg, #fff, #fff4dc); box-shadow: inset 0 -4px 0 rgba(205, 150, 60, .2); }
.cg-tot :is(svg, img) { width: 36px; height: 36px; margin: -4px 0; }
.cg-tot span { flex: 1; font-weight: 700; }
.cg-tot b { font: 800 26px/1 var(--f-d); font-variant-numeric: tabular-nums; }
/* island finished */
.cg-over.fin { z-index: 47; background: radial-gradient(80% 50% at 50% 30%, #fff3a8 0%, rgba(255, 243, 168, 0) 70%), linear-gradient(180deg, #58c4f5, #9be0ff); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; text-align: center; }
.cg-fin-rays { position: absolute; left: 50%; top: 32%; width: 900px; height: 900px; margin: -450px 0 0 -450px; background: repeating-conic-gradient(rgba(255, 255, 255, .5) 0 10deg, transparent 10deg 20deg); border-radius: 50%; animation: cg-turn 30s linear infinite; -webkit-mask-image: radial-gradient(closest-side, #000 20%, transparent 75%); mask-image: radial-gradient(closest-side, #000 20%, transparent 75%); }
.cg-over.fin > * { position: relative; }
.cg-fin-capy { width: 150px; height: 190px; margin: -6px 0 -14px; animation: cg-cheer 1.1s var(--out) infinite; transform-origin: 50% 100%; }
.cg-fin-t { font: 800 44px/1 var(--f-d); }
.cg-fin-s { display: flex; justify-content: center; width: 100%; }
.cg-fin-s .cg-star { flex: 0 1 26px; min-width: 0; height: 26px; opacity: 0; }
.cg-over.fin.on .cg-fin-s .cg-star { animation: cg-starpop .5s var(--spring) both; opacity: 1; }
.cg-fin-next { width: 100%; padding: 15px; border-radius: 24px; border: 4px solid var(--o); background: linear-gradient(180deg, #fff9e6 0%, #ffedc0 100%); box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 5px #f4cb72, 0 6px 0 var(--o), 0 20px 30px -10px rgba(0, 30, 70, .5); display: flex; flex-direction: column; gap: 8px; align-items: center; }
.cg-fin-next .tease { width: 100%; height: 112px; border-radius: 16px; border: 3px solid var(--o); background: #7fd0ee; position: relative; overflow: hidden; }
.cg-fin-next .tease :is(svg, img) { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 62%; }
.cg-fin-next .tease i { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255, 255, 255, .5) 0, rgba(255, 255, 255, .12) 45%, rgba(255, 255, 255, .5) 100%); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .6); }

/* ───────── floating bits ───────── */
.cg-fx { position: absolute; inset: 0; z-index: 60; pointer-events: none; width: 100%; height: 100%; }
.cg-pop { position: absolute; z-index: 61; pointer-events: none; transform: translate(-50%, -50%); font: 800 26px/1 var(--f-d); white-space: nowrap; animation: cg-popup 1.25s var(--out) forwards; }
.cg-pop.big { font-size: 40px; animation-duration: 1.6s; }
.cg-pop.blue { color: #c9f1ff; } .cg-pop.gold { color: #ffe680; } .cg-pop.red { color: #ffd0cc; }
.cg-win { position: absolute; left: 50%; top: 34%; z-index: 58; transform: translate(-50%, -50%); pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 4px; animation: cg-winin 1.9s var(--out) forwards; }
.cg-win .cg-ribbon { height: 56px; font-size: 30px; }
.cg-win small { font: 800 34px/1 var(--f-d); }
.cg-toast { position: absolute; left: 50%; top: calc(108px + env(safe-area-inset-top, 0px)); z-index: 62; transform: translate(-50%, -30px); opacity: 0; transition: transform .3s var(--spring), opacity .2s; padding: 9px 16px; border-radius: 99px; border: 3px solid var(--o); background: linear-gradient(180deg, #fff, #ffefc9); font-weight: 700; font-size: 13.5px; max-width: 90%; text-align: center; pointer-events: none; box-shadow: 0 3px 0 var(--o), 0 12px 14px -6px rgba(30, 15, 0, .45); }
.cg-toast.on { opacity: 1; transform: translate(-50%, 0); }
.cg-tip { position: absolute; z-index: 42; transform: translate(-50%, -100%); padding: 8px 14px; border-radius: 14px; border: 3px solid var(--o); background: #fff; font-weight: 800; font-size: 14px; white-space: nowrap; pointer-events: none; animation: cg-tipbob 1s ease-in-out infinite; box-shadow: 0 3px 0 var(--o); }
.cg-tip::after { content: ""; position: absolute; left: 50%; bottom: -11px; width: 14px; height: 14px; margin-left: -7px; background: #fff; border-right: 3px solid var(--o); border-bottom: 3px solid var(--o); transform: rotate(45deg); }
.cg-tip.below { transform: translate(-50%, 0); }
.cg-tip.below::after { bottom: auto; top: -11px; transform: rotate(225deg); }

/* ───────── motion ───────── */
@keyframes cg-turn { to { transform: rotate(360deg); } }
@keyframes cg-bump { 0% { transform: scale(1); } 45% { transform: scale(1.16); } 100% { transform: scale(1); } }
@keyframes cg-land { 0% { transform: translateY(-9%) scale(.96, 1.06); } 50% { transform: translateY(3%) scale(1.07, .93); } 100% { transform: none; } }
@keyframes cg-winsym { 0%, 100% { transform: scale(1) rotate(0); } 30% { transform: scale(1.2) rotate(-7deg); } 60% { transform: scale(1.14) rotate(6deg); } }
@keyframes cg-winbox { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 210, 63, 0); background-color: transparent; } 50% { box-shadow: 0 0 0 4px var(--gold), 0 0 22px 6px rgba(255, 210, 63, .95); } }
@keyframes cg-sheen { 0%, 60% { left: -40%; } 100% { left: 120%; } }
@keyframes cg-nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes cg-starpop { 0% { transform: scale(0) rotate(-80deg); } 70% { transform: scale(1.35) rotate(10deg); } 100% { transform: scale(1); } }
@keyframes cg-no { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
@keyframes cg-drop { 0% { transform: translateY(-140px) scale(.7); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes cg-wig2 { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes cg-dig { 0%, 100% { transform: rotate(-9deg) translateY(0); } 50% { transform: rotate(7deg) translateY(4px); } }
@keyframes cg-flash { 0% { opacity: .85; } 100% { opacity: 0; } }
@keyframes cg-shake { 10%, 90% { transform: translate(-2px, 1px); } 20%, 80% { transform: translate(5px, -3px); } 30%, 50%, 70% { transform: translate(-8px, 4px); } 40%, 60% { transform: translate(8px, -2px); } }
@keyframes cg-popup { 0% { transform: translate(-50%, -30%) scale(.4); opacity: 0; } 18% { transform: translate(-50%, -70%) scale(1.15); opacity: 1; } 30% { transform: translate(-50%, -80%) scale(1); } 75% { opacity: 1; } 100% { transform: translate(-50%, -190%) scale(1); opacity: 0; } }
@keyframes cg-winin { 0% { transform: translate(-50%, -50%) scale(.2) rotate(-8deg); opacity: 0; } 14% { transform: translate(-50%, -50%) scale(1.12) rotate(2deg); opacity: 1; } 22% { transform: translate(-50%, -50%) scale(1); } 80% { transform: translate(-50%, -50%) scale(1); opacity: 1; } 100% { transform: translate(-50%, -80%) scale(.9); opacity: 0; } }
@keyframes cg-tipbob { 0%, 100% { margin-top: 0; } 50% { margin-top: -7px; } }
@keyframes cw-breathe { 0%, 100% { transform: none; } 50% { transform: scale(1.008, 1.018); } }
@keyframes cw-bob { 0%, 100% { transform: translateY(0) rotate(-1.6deg); } 50% { transform: translateY(-2.5%) rotate(1.6deg); } }
@keyframes cw-foam { 0%, 100% { transform: scale(1); opacity: .85; } 50% { transform: scale(1.08); opacity: .55; } }
@keyframes cw-ring { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.08); opacity: .6; } }
@keyframes cw-wig { 0%, 100% { transform: rotate(-1.8deg); } 50% { transform: rotate(1.8deg); } }
@keyframes cw-puff { 0% { transform: translateY(20%) scale(.5); opacity: 0; } 22% { opacity: .9; } 100% { transform: translateY(-260%) translateX(40%) scale(1.7); opacity: 0; } }
@keyframes cw-spin { to { transform: rotate(360deg); } }
@keyframes cw-drift { to { transform: translateX(520%); } }
@keyframes cw-glint { 0%, 70%, 100% { transform: scale(.2) rotate(0); opacity: 0; } 82% { transform: scale(1) rotate(45deg); opacity: .95; } }
@keyframes cg-load { 0% { transform: translateX(-110%); } 100% { transform: translateX(260%); } }
@keyframes cg-swing { 0%, 100% { transform: rotate(-7deg); } 50% { transform: rotate(7deg); } }
@keyframes cg-peek { 0%, 62%, 100% { transform: translateY(0); } 70% { transform: translateY(26%); } 84% { transform: translateY(26%); } 92% { transform: translateY(-4%); } }
@keyframes cg-cheer { 0%, 100% { transform: translateY(0) scale(1, 1); } 18% { transform: translateY(0) scale(1.08, .9); } 50% { transform: translateY(-16%) scale(.96, 1.06); } }
@keyframes cg-lamp { 0%, 49.9% { opacity: 1; } 50%, 100% { opacity: .3; } }
@keyframes cg-beat { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }

/* arriving: the island rises, the bar drops in, the machine and the tabs come up */
.cg-hud, .cg-chip { animation: cg-in-down .6s var(--out) .15s backwards; }
.cg-world.main .cg-islebox { animation: cg-in-isle .9s var(--spring) .1s backwards; }
.cg-machine { animation: cg-in-up .7s var(--out) .25s backwards; }
.cg-tabs { animation: cg-in-up .6s var(--out) .4s backwards; }
@keyframes cg-in-down { from { transform: translateY(-90px); opacity: 0; } }
.cg-chip { animation-name: cg-in-chip; }
@keyframes cg-in-chip { from { transform: translate(-50%, -90px); opacity: 0; } }
@keyframes cg-in-up { from { transform: translateY(110%); } }
@keyframes cg-in-isle { from { transform: translateY(60px) scale(.8); opacity: 0; } }
/* short phones: a lower machine so the island keeps its room */
@media (max-height: 720px) { :root { --mach: 292px; --rh: 96px; } .build .cg-foot { display: none; } .cg-go { height: 56px; font-size: 28px; } .cg-machine { gap: 8px; padding-top: 34px; } .cg-marq { width: 214px; height: 89px; margin-left: -107px; top: -64px; } .cg-marq b { font-size: 20px; } .cg-peek { width: 58px; } .cg-chip { top: calc(60px + env(safe-area-inset-top, 0px)); } .cg-mounds { bottom: 262px; top: calc(136px + env(safe-area-inset-top, 0px)); } .cg-digger { bottom: 176px; width: 100px; height: 100px; margin-left: -50px; } }
@media (max-height: 600px) { :root { --mach: 262px; --rh: 76px; } .cg-go { height: 50px; } }
/* ───────── motion: one rhythm for every press, sheet and scene change ───────── */
.cg-btn, .cg-tab, .cg-go, .cg-mound, .cg-ava, .cw-capy, .cg [data-x] { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
/* a press answers the finger at once (the spring back is played from script on release) */
.cg .pr { scale: .94; transition: scale .07s ease-out; }
/* sheets rise with a soft overshoot and leave faster than they came; their rows follow one after another */
.cg-sheet { will-change: transform; }
.cg-sheet.on:not(.modal) { transition: transform .46s cubic-bezier(.2, 1.12, .3, 1); }
.cg-sheet:not(.on):not(.modal) { transition: transform .3s cubic-bezier(.5, 0, .85, .35), visibility 0s .3s; }
.cg-list.enter .cg-row, .cg-list.enter .cg-empty { animation: cg-rowin .42s var(--out) both; animation-delay: calc(var(--i, 0) * 45ms + 110ms); }
.cg-sheet.modal.on > * { animation: cg-rowin .34s var(--out) both; }
.cg-sheet.modal.on > :nth-child(1) { animation-delay: 60ms; } .cg-sheet.modal.on > :nth-child(2) { animation-delay: 100ms; } .cg-sheet.modal.on > :nth-child(3) { animation-delay: 140ms; }
.cg-sheet.modal.on > :nth-child(4) { animation-delay: 180ms; } .cg-sheet.modal.on > :nth-child(n+5) { animation-delay: 220ms; }
.cg-sheet.modal:not(.on) { transition: transform .22s cubic-bezier(.5, 0, .85, .35), opacity .18s, visibility 0s .22s; }
.cg-dim { transition: opacity .28s var(--out); }
/* the chosen tab's picture hops; the others settle */
.cg-tab[aria-current="true"] :is(img, svg) { animation: cg-tabpop .42s var(--spring); }
/* scene change: the island pulls back a little as the next scene opens over it, and comes forward again after */
.cg-scene { will-change: transform; }
.cg.is-over:not(.is-build) .main .cg-scene { transform: scale(1.07); transition: transform .7s cubic-bezier(.7, 0, .2, 1); }
.cg-over.on > :is(.cg-banner, .cg-pips, .cg-mounds, .cg-hint) { animation: cg-overin .5s var(--out) .32s backwards; }
@keyframes cg-rowin { from { transform: translateY(18px) scale(.97); opacity: 0; } }
@keyframes cg-tabpop { 0% { transform: translateY(0) scale(1); } 35% { transform: translateY(-22%) scale(1.14); } 70% { transform: translateY(3%) scale(.97); } 100% { transform: none; } }
@keyframes cg-overin { from { opacity: 0; translate: 0 22px; } }
@media (prefers-reduced-motion: reduce) {
  .cg-list.enter .cg-row, .cg-list.enter .cg-empty, .cg-sheet.modal.on > *, .cg-tab[aria-current="true"] :is(img, svg), .cg-over.on > *, .cg-hud, .cg-chip, .cg-world.main .cg-islebox, .cg-machine, .cg-tabs, .cg-go::after, .cg-go span, .cg-machine::before, .cg-machine::after, .cg-fin-rays, .cg-fin-capy, .cg-tab.nudge, .cg-tip, .cg-mound :is(svg, img), .cg-lan, .cg-peek, .cw-body, .cw-wheel img, .cg-boot img, .cw-capy img, .cw-b.sea .cw-sh, .cw-ring, .cw-cloud, .cw-glint, .cw-puff { animation: none !important; }
  .cg.shake { animation: none; }
}

.cg-home { display: grid; place-items: center; pointer-events: auto; text-decoration: none; background: radial-gradient(circle at 50% 22%, #9fe6ff 0%, #3bb3ef 58%, #1e8ad0 100%); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .4), inset 0 -5px 5px -2px rgba(0, 50, 110, .5), 0 3px 0 var(--o); }

/* narrow phones: a tighter top bar so the gear always stays on screen (320px included) */
@media (max-width: 430px) {
  .cg-hud { gap: 5px; padding-left: 8px; padding-right: 8px; }
  .cg-round { width: 38px; height: 38px; }
  .cg-round :is(svg, img) { width: 22px; height: 22px; }
  .cg-ava { width: 42px; height: 42px; }
  .cg-ava :is(svg, img) { width: 33px; height: 33px; }
  .cg-pill { height: 36px; margin-left: 9px; padding: 0 10px 0 30px; font-size: 18px; }
  .cg-pill :is(svg, img) { left: -11px; width: 40px; height: 40px; margin-top: -21px; }
  .cg-shields { padding: 3px 5px; }
  .cg-shields i { width: 19px; height: 21px; }
}
@media (max-width: 360px) {
  .cg-shields i:not(:first-child) { display: none; }
  .cg-shn { display: block; margin: 0 2px 0 1px; color: #fff6cf; text-shadow: 0 2px 0 rgba(30, 10, 0, .65); font: 800 15px/1 var(--f-d); font-variant-numeric: tabular-nums; }
}

/* phones held sideways (and short windows): the island on the left, the spin machine on the right */
@media (orientation: landscape) and (max-height: 500px) {
  :root { --tabs: calc(58px + env(safe-area-inset-bottom, 0px)); --rh: clamp(44px, calc(100vh - 296px), 110px); }
  .cg { max-width: 960px; }
  .cg-tabs { padding-top: 4px; }
  .cg-world.main { right: 50%; bottom: var(--tabs); height: auto; }
  .cg-chip { left: 25%; }
  .cg-machine { left: calc(50% + 4px); right: 10px; top: calc(62px + env(safe-area-inset-top, 0px)); height: auto; padding: 14px 12px 12px; gap: 8px; }
  .cg-machine::before, .cg-machine::after, .cg-marq { display: none; }
  .cg-go { height: 48px; border-radius: 20px; font-size: 26px; }
  .cg.is-build .main .cg-scene { transform: none; }
  .cg-sheet, .cg-sheet.news { left: calc(50% + 4px); right: 6px; top: calc(62px + env(safe-area-inset-top, 0px)); }
  .cg-sheet.modal { left: max(18px, calc(50% - 230px)); right: max(18px, calc(50% - 230px)); top: auto; max-height: 92%; }
  .cg-win { left: 75%; }
  /* scenes: the other island (or the meadow) on the left, the card on the right */
  .cg-banner { right: min(380px, 46%); top: calc(56px + env(safe-area-inset-top, 0px)); }
  .cg-over .cg-islebox { left: calc((100% - min(380px, 46%) - var(--box)) / 2); }
  .cg-card { left: auto; right: 10px; width: calc(min(380px, 46%) - 14px); bottom: calc(8px + env(safe-area-inset-bottom, 0px)); max-height: calc(100% - 66px); overflow-y: auto; }
  .cg-mounds { left: 18px; right: calc(min(380px, 46%) + 12px); top: calc(146px + env(safe-area-inset-top, 0px)); bottom: 10px; gap: 6px 18px; }
  .cg-digger { left: calc((100% - min(380px, 46%)) / 2); bottom: 6px; width: 84px; height: 84px; margin-left: -42px; }
  .cg-over.fin { justify-content: flex-start; justify-content: safe center; overflow-y: auto; gap: 8px; padding: 12px 24px; }
  .cg-over.fin > :not(.cg-fin-rays) { flex-shrink: 0; }
  .cg .cg-fin-capy { display: none; }
  .cg-fin-t { font-size: 32px; }
  .cg-fin-next { max-width: 460px; }
  .cg-fin-next .tease { display: none; }
}

/* ───────── the spin multiplier: NHÂN ×1 · ×2 · ×3 · ×5 beside QUAY, a tag on the machine while it is above ×1 ───────── */
.cg-gorow { margin-top: auto; flex: none; display: flex; gap: 8px; }
.cg-gorow .cg-go { flex: 1; min-width: 0; margin-top: 0; }
.cg-go span i { font-style: normal; font-size: .74em; color: #fff6a8; }
.cg-bet { --b1: #9fe6ff; --b2: #2f9ee6; --b3: rgba(0, 50, 120, .55); --b4: #145f9e; order: -1; flex: none; width: 76px; border-radius: 22px; border: 4px solid var(--o); background: radial-gradient(95% 70% at 50% 0%, rgba(255, 255, 255, .55), rgba(255, 255, 255, 0) 64%), linear-gradient(180deg, var(--b1), var(--b2)); box-shadow: inset 0 0 0 2.5px rgba(255, 255, 255, .4), inset 0 -9px 9px -5px var(--b3), 0 4px 0 var(--b4), 0 8px 0 var(--o), 0 16px 16px -6px rgba(60, 20, 0, .55); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; color: #fff; transition: transform .08s, box-shadow .08s, filter .2s; }
.cg-bet small { font: 800 10px/1 var(--f-b); letter-spacing: .6px; text-shadow: 0 1px 0 rgba(0, 0, 0, .35); }
.cg-bet b { font: 800 28px/1 var(--f-d); font-variant-numeric: tabular-nums; }
.cg-bet.x2 { --b1: #ffd27a; --b2: #f28a0c; --b3: rgba(140, 50, 0, .55); --b4: #a85200; }
.cg-bet.x3 { --b1: #ff9a8a; --b2: #e5392f; --b3: rgba(120, 0, 0, .55); --b4: #8f1a14; }
.cg-bet.x5 { --b1: #e2a6ff; --b2: #9a3fe0; --b3: rgba(60, 0, 110, .6); --b4: #5d1f96; }
.cg-bet.x5 b, .cg-bet.x3 b { animation: cg-beat 1.2s ease-in-out infinite; }
.cg-bet:active { transform: translateY(6px); box-shadow: inset 0 0 0 2.5px rgba(255, 255, 255, .4), 0 1px 0 var(--b4), 0 2px 0 var(--o); }
.cg-go[disabled] + .cg-bet { filter: saturate(.5) brightness(.95); }
.cg-bet.bump { animation: cg-bump .3s var(--spring); }
.cg-xbadge { position: absolute; right: -12px; top: -16px; z-index: 3; min-width: 50px; height: 50px; padding: 0 6px; border-radius: 99px; border: 3px solid var(--o); background: radial-gradient(circle at 50% 25%, #fff3a0, #ffc21f 55%, #f08c00); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .55), 0 3px 0 var(--o), 0 0 16px 3px rgba(255, 210, 63, .8); display: grid; place-items: center; font: 800 24px/1 var(--f-d); transform: rotate(10deg); pointer-events: none; animation: cg-xin .45s var(--spring); }
.cg-machine[data-x="1"] .cg-xbadge, .cg-machine:not([data-x]) .cg-xbadge { display: none; }
.cg-machine[data-x="5"] .cg-reels { box-shadow: inset 0 0 0 3px #ffcf4a, inset 0 0 0 5px #a85d00, inset 0 12px 14px rgba(0, 0, 0, .4), 0 0 0 3px #c77dff, 0 0 18px 4px rgba(190, 110, 255, .75); }
.cg-xtag { display: inline-block; margin: 0 0 0 7px; padding: 1px 9px 0; border-radius: 99px; border: 2.5px solid var(--o); background: linear-gradient(180deg, #ffe566, #ffae00); color: #fff; font: 800 .78em/1.25 var(--f-d); font-style: normal; vertical-align: middle; text-shadow: 0 2px 0 var(--o), 1px 0 0 var(--o), -1px 0 0 var(--o), 0 -1px 0 var(--o); box-shadow: 0 2px 0 var(--o); white-space: nowrap; }
.cg-res .cg-xtag { font-size: .62em; }
@keyframes cg-xin { 0% { transform: rotate(10deg) scale(0); } 70% { transform: rotate(10deg) scale(1.2); } 100% { transform: rotate(10deg) scale(1); } }
@media (max-height: 720px) { .cg-bet b { font-size: 24px; } .cg-xbadge { min-width: 42px; height: 42px; font-size: 20px; } }
@media (max-width: 360px) { .cg-bet { width: 64px; } .cg-go { font-size: 30px; } }
@media (orientation: landscape) and (max-height: 500px) { .cg-bet { width: 64px; border-radius: 18px; } .cg-bet b { font-size: 22px; } .cg-xbadge { right: -8px; top: -12px; min-width: 38px; height: 38px; font-size: 18px; } }
@media (prefers-reduced-motion: reduce) { .cg-bet b, .cg-xbadge { animation: none !important; } }
/* candy smoke on Xứ Kẹo Ngọt */
.cw-puff.pink { background: radial-gradient(circle at 40% 35%, #fff 0, #ffd6e8 55%, rgba(255, 214, 232, 0) 72%); }
/* island finished, on short phones: a smaller Capy and teaser so the next island's card and its button stay on screen */
.cg-over.fin { justify-content: safe center; overflow-y: auto; }
.cg-over.fin > :not(.cg-fin-rays) { flex-shrink: 0; }
.cg-fin-next span { font-size: 13.5px; font-weight: 600; }
@media (max-height: 760px) { .cg-over.fin { gap: 9px; padding: 16px 20px; } .cg-fin-capy { width: 108px; height: 136px; } .cg-fin-t { font-size: 38px; } .cg-fin-next { padding: 12px; gap: 6px; } .cg-fin-next .tease { height: 84px; } }
@media (max-height: 620px) { .cg-over.fin .cg-fin-capy { display: none; } }

/* each island's own plain sea and sky behind its painted base (b3d/seacss.py: island 1's colours moved by how far each base's sea is from island 1's) */
.cg[data-isle="rungtre"] .cg-sea { background: linear-gradient(90deg, rgba(90, 228, 238, .3) 0, rgba(90, 228, 238, .3) calc(50% - var(--box) * .5), rgba(90, 228, 238, 0) 50%, rgba(0, 140, 225, .22) calc(50% + var(--box) * .5), rgba(0, 140, 225, .22) 100%), linear-gradient(180deg, #29a0d7 0, #42b0cd calc(var(--box) * .26), #179ec0 calc(var(--box) * .51), #1284ab calc(var(--box) * .68), #0f6c96 calc(var(--box) * .761), #0d5e81 100%); }
.cg[data-isle="rungtre"] .cg-sky { background: linear-gradient(0deg, #c8edf9 0, #bae5f6 calc(var(--box) * .016), #72c8ec calc(var(--box) * .035), #57bae7 calc(var(--box) * .07), #3face4 calc(var(--box) * .14), #239ce0 calc(var(--box) * .19), #1889db calc(var(--box) * .239), #1375cb calc(var(--box) * .239 + 260px)); }
.cg[data-isle="baibien"] .cg-sea { background: linear-gradient(90deg, rgba(90, 228, 238, .3) 0, rgba(90, 228, 238, .3) calc(50% - var(--box) * .5), rgba(90, 228, 238, 0) 50%, rgba(0, 140, 225, .22) calc(50% + var(--box) * .5), rgba(0, 140, 225, .22) 100%), linear-gradient(180deg, #32b5ff 0, #45cdfb calc(var(--box) * .26), #09c3ff calc(var(--box) * .51), #00a6ee calc(var(--box) * .68), #008ad6 calc(var(--box) * .761), #007cbf 100%); }
.cg[data-isle="baibien"] .cg-sky { background: linear-gradient(0deg, #daf5ff 0, #c9eeff calc(var(--box) * .016), #79d4fe calc(var(--box) * .035), #59c7fd calc(var(--box) * .07), #3eb8fd calc(var(--box) * .14), #1fa8fc calc(var(--box) * .19), #0d93ff calc(var(--box) * .239), #007ef6 calc(var(--box) * .239 + 260px)); }
.cg[data-isle="nuituyet"] .cg-sea { background: linear-gradient(90deg, rgba(90, 228, 238, .3) 0, rgba(90, 228, 238, .3) calc(50% - var(--box) * .5), rgba(90, 228, 238, 0) 50%, rgba(0, 140, 225, .22) calc(50% + var(--box) * .5), rgba(0, 140, 225, .22) 100%), linear-gradient(180deg, #3089ed 0, #4ba2e1 calc(var(--box) * .26), #058fef calc(var(--box) * .51), #0174d9 calc(var(--box) * .68), #005cc2 calc(var(--box) * .761), #0053ab 100%); }
.cg[data-isle="nuituyet"] .cg-sky { background: linear-gradient(0deg, #d3edfc 0, #c4e5fa calc(var(--box) * .016), #7ac2f3 calc(var(--box) * .035), #5cb3f0 calc(var(--box) * .07), #43a2ee calc(var(--box) * .14), #268feb calc(var(--box) * .19), #127bf0 calc(var(--box) * .239), #0a67e2 calc(var(--box) * .239 + 260px)); }
.cg[data-isle="xukeo"] .cg-sea { background: linear-gradient(90deg, rgba(90, 228, 238, .3) 0, rgba(90, 228, 238, .3) calc(50% - var(--box) * .5), rgba(90, 228, 238, 0) 50%, rgba(0, 140, 225, .22) calc(50% + var(--box) * .5), rgba(0, 140, 225, .22) 100%), linear-gradient(180deg, #5ceeff 0, #73f7f6 calc(var(--box) * .26), #33fffc calc(var(--box) * .51), #19f5ff calc(var(--box) * .68), #01e6ff calc(var(--box) * .761), #00d4e9 100%); }
.cg[data-isle="xukeo"] .cg-sky { background: linear-gradient(0deg, #effdff 0, #dff9fe calc(var(--box) * .016), #90e7fc calc(var(--box) * .035), #71defa calc(var(--box) * .07), #57d4f9 calc(var(--box) * .14), #38c7f8 calc(var(--box) * .19), #23b9fe calc(var(--box) * .239), #0ca8ff calc(var(--box) * .239 + 260px)); }
