/* Game page chrome (GameShell). Loaded after app.css. */
body.cg-game { overflow: hidden; overscroll-behavior: none; background: #07051a; touch-action: manipulation; }
.cg-app { position: fixed; inset: 0; display: flex; flex-direction: column; padding-bottom: var(--safe-bottom); }
.cg-topbar {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  padding-top: var(--top-gap); padding-left: max(12px, var(--safe-left)); padding-right: max(12px, var(--safe-right));
  background: linear-gradient(180deg, rgba(7,5,26,.95), rgba(7,5,26,.75));
  border-bottom: 1px solid var(--line); z-index: 5; flex: none;
}
.cg-title { font-weight: 900; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: linear-gradient(135deg, var(--accent-a), var(--accent-b)); -webkit-background-clip: text; background-clip: text; color: transparent; min-width: 0; }
.cg-stats { display: flex; gap: 6px; margin-left: auto; overflow: hidden; }
.cg-stat { display: flex; flex-direction: column; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 3px 10px; min-width: 52px; }
.cg-stat-l { font-size: 9.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.cg-stat-v { font-size: 15px; font-weight: 900; font-variant-numeric: tabular-nums; }
.cg-stat.bump .cg-stat-v { animation: bump .35s ease; }
@keyframes bump { 40% { transform: scale(1.35); color: var(--gold); } }
@media (max-width: 380px) { .cg-title { display: none; } .cg-stat { min-width: 44px; padding: 3px 7px; } }

.cg-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.cg-stage canvas { display: block; position: absolute; inset: 0; }

/* overlay cards */
.cg-card.pop { animation: popIn .45s cubic-bezier(.2,.9,.3,1.35); }
@keyframes popIn { from { opacity: 0; transform: scale(.85) translateY(20px); } }
.cg-hero.cg-hero-img { width: 132px; height: auto; max-height: 120px; object-fit: contain; }
.cg-hero { width: 96px; height: 96px; filter: drop-shadow(0 12px 22px rgba(0,0,0,.5)); animation: bob 3s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-8px) rotate(4deg); } }
.cg-h1 { margin: 0; font-size: 32px; font-weight: 900; letter-spacing: -.02em; background: linear-gradient(135deg, #fff, var(--accent-b)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.cg-tag { margin: -4px 0 0; color: var(--muted); }
.cg-how { list-style: none; margin: 4px 0; padding: 0; display: grid; gap: 8px; width: 100%; text-align: left; }
.cg-how li { background: rgba(255,255,255,.06); border-radius: 12px; padding: 9px 12px 9px 36px; position: relative; font-size: 14px; }
.cg-how li::before { content: ''; position: absolute; left: 13px; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 3px; transform: rotate(45deg); background: linear-gradient(135deg, var(--accent-a), var(--accent-b)); }
.cg-bestline { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; color: var(--gold); }
.cg-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

.cg-bigscore { font-size: 64px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; background: linear-gradient(180deg, #fff, var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 6px 20px rgba(250,204,21,.35)); }
.cg-bigscore.done { animation: bump .5s ease; }
.cg-ribbon { background: linear-gradient(135deg, #facc15, #ff9f43); color: #3b1d00; font-weight: 900; padding: 6px 16px; border-radius: 999px; letter-spacing: .06em; font-size: 13px; animation: ribbon 1.4s ease-in-out infinite; }
@keyframes ribbon { 50% { transform: scale(1.07); } }
.cg-statgrid, .cg-ranks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; }
.cg-statcell, .cg-rankcell { background: rgba(255,255,255,.06); border-radius: 14px; padding: 8px 4px; display: flex; flex-direction: column; gap: 2px; }
.cg-statcell b, .cg-rankcell b { font-size: 18px; font-weight: 900; }
.cg-statcell span, .cg-rankcell span { font-size: 11px; color: var(--muted); }
.cg-rankcell b { color: var(--gold); }
.cg-minilb { width: 100%; display: grid; gap: 5px; }
.cg-minilb-h { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 800; text-align: left; }
.cg-minilb-row { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 12px; background: rgba(255,255,255,.04); font-size: 14px; text-align: left; }
.cg-minilb-row.me { background: rgba(255,61,127,.25); }
.cg-minilb-rank { width: 18px; font-weight: 900; color: var(--muted); }
.cg-minilb-name { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cg-spinner { width: 48px; height: 48px; border-radius: 50%; border: 5px solid rgba(255,255,255,.12); border-top-color: var(--accent-a); animation: spin .8s linear infinite; }

/* banners */
.cg-banner { position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%); z-index: 15; pointer-events: none; text-align: center; animation: banner 1.3s cubic-bezier(.2,.9,.3,1.2) forwards; white-space: nowrap; }
.cg-banner-t { font-size: clamp(44px, 13vw, 92px); font-weight: 900; letter-spacing: -.02em; line-height: 1; background-image: linear-gradient(180deg, #fff, #facc15); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 6px 0 rgba(40,10,80,.9)) drop-shadow(0 12px 24px rgba(0,0,0,.45)); }
.cg-banner-s { font-size: 18px; font-weight: 800; color: #fff; margin-top: 6px; text-shadow: 0 2px 8px rgba(0,0,0,.6); }
.cg-banner-xl .cg-banner-t { font-size: clamp(80px, 26vw, 160px); }
.cg-banner-sm .cg-banner-t { font-size: clamp(30px, 9vw, 54px); }
@keyframes banner {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.3) rotate(-8deg); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(1.15) rotate(2deg); }
  30% { transform: translate(-50%, -50%) scale(1) rotate(0); }
  80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(1.05); }
}

/* The main button (PLAY / PLAY AGAIN) stays on screen while a tall card scrolls. */
.cg-overlay .cg-card .cg-btn-big { position: sticky; bottom: 10px; z-index: 3; }
/* Short screens (small phones, landscape): a more compact card. */
@media (max-height: 700px) {
  .cg-card { gap: 9px; padding: 16px 16px; }
  .cg-hero { width: 68px; height: 68px; }
  .cg-hero.cg-hero-img { width: 96px; max-height: 80px; }
  .cg-h1 { font-size: 26px; }
  .cg-how { gap: 6px; }
  .cg-how li { padding: 7px 10px 7px 32px; font-size: 13px; }
  .cg-bigscore { font-size: 52px; }
}
@media (max-height: 460px) {
  .cg-card .cg-logo { display: none; }
  .cg-hero, .cg-hero.cg-hero-img { display: none; }
}

/* keep secondary result buttons on one line on narrow phones */
.cg-row { flex-wrap: nowrap; width: 100%; }
.cg-row .cg-btn { flex: 1 1 0; min-width: 0; padding: 12px 10px; font-size: 14px; white-space: nowrap; }
