/* Shared layout for the small games (used with shared/kit.js) */
/* Game pages are sized to fit one screen: --hdr is the space the header and page padding take */
:root { --hdr: 64px; }
.wrap.g-wrap { padding-top: 8px; padding-bottom: 10px; }
.g-wrap { max-width: 1000px; display: flex; flex-direction: column; gap: 10px; }
.g-wrap.wide { max-width: 1200px; }
.g-top { position: relative; display: flex; flex-wrap: nowrap; align-items: center; gap: 8px 10px; min-height: 46px; }
.g-title { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); min-width: 0; flex-shrink: 1; }
.g-title .g-icon { width: 36px; height: 36px; border-radius: 11px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.g-title > span:last-child { min-width: 0; }
.g-title strong { font-family: var(--display); font-weight: 700; font-size: 22px; line-height: 1.05; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-title small { display: block; font-size: 12px; font-weight: 800; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-stats { display: flex; flex-wrap: nowrap; gap: 6px; flex-shrink: 0; }
.g-stat { display: inline-flex; align-items: center; gap: 5px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 5px 10px; font-size: 14px; font-weight: 800; white-space: nowrap; }
.g-ibtn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 42px; height: 42px; padding: 0 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: 800 13px var(--body); cursor: pointer; text-decoration: none; flex-shrink: 0; white-space: nowrap; }
.g-ibtn svg { width: 20px; height: 20px; flex-shrink: 0; }
.g-ibtn:hover { background: #F3F8FC; color: var(--ink); }
.g-helppop { position: absolute; right: 0; top: 52px; z-index: 55; width: min(420px, calc(100vw - 24px)); background: #FFFFFF; border: 2px solid var(--ink); border-radius: 20px; padding: 14px 16px; box-shadow: 0 10px 30px rgba(34,48,90,.2); display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.g-helppop[hidden] { display: none; }
.g-helppop .g-help { color: var(--ink); font-size: 15px; }
@media (max-width: 1100px) { .g-ibtn span { display: none; } .g-ibtn { padding: 0; } }
@media (max-width: 700px) {
  :root { --hdr: 58px; }
  .wrap.g-wrap { padding-left: 10px; padding-right: 10px; }
  .g-title small { display: none; }
  .g-title strong { font-size: 18px; }
  .g-title .g-icon { width: 32px; height: 32px; }
  .g-stat { padding: 4px 8px; font-size: 13px; }
  .g-stat span { font-size: 9px; letter-spacing: .3px; }
  .g-stats .g-stat:nth-child(n+3) { display: none; }
  .g-ibtn { min-width: 38px; height: 38px; }
}
@media (max-width: 440px) {
  .g-top { gap: 6px; }
  .g-title strong { font-size: 16px; }
  .g-stat { padding: 3px 7px; font-size: 12px; flex-direction: column; gap: 0; line-height: 1.1; }
  .g-ibtn { min-width: 36px; height: 36px; }
}
.g-stat span { font-size: 11px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .6px; }
.g-card { background: var(--card); border: 1px solid var(--line); border-radius: 28px; padding: 18px; }
.g-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.g-center { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.g-help { margin: 0; color: var(--ink-soft); font-size: 14px; line-height: 1.5; }
.btn.small { min-height: 40px; padding: 0 14px; font-size: 13px; border-radius: 14px; }
.btn.on { background: var(--ink); color: #FFFFFF; border-color: var(--ink); }

.g-modal { position: fixed; inset: 0; z-index: 60; background: rgba(34,48,90,.45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.g-modal[hidden] { display: none; }
.g-sheet { width: min(460px, 100%); background: #FFF6E5; border-radius: 30px; padding: 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; animation: gpop .35s cubic-bezier(.3,1.4,.6,1); max-height: calc(100vh - 32px); overflow-y: auto; }
@keyframes gpop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
.g-sheet h2 { font-size: 34px; line-height: 1.05; }
.g-sheet p { margin: 0; color: var(--ink-soft); font-size: 16px; line-height: 1.5; }
.g-stars { display: flex; gap: 8px; }
.g-stars svg { width: 52px; height: 52px; }
.g-stars svg:nth-child(2) { width: 64px; height: 64px; }
.g-stars svg.on { animation: gstar .55s ease-out both; }
.g-stars svg:nth-child(2).on { animation-delay: .2s; } .g-stars svg:nth-child(3).on { animation-delay: .4s; }
@keyframes gstar { 0% { transform: scale(0) rotate(-30deg); } 60% { transform: scale(1.25) rotate(8deg); } 100% { transform: none; } }
.g-share-note { font-size: 14px; color: #0B6B4C; min-height: 18px; }

.g-toasts { position: fixed; left: 50%; top: 16px; transform: translateX(-50%); z-index: 70; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; width: min(92vw, 460px); }
.g-toast { background: #FFFFFF; color: var(--ink); border-radius: 16px; padding: 8px 16px; font-weight: 800; font-size: 15px; box-shadow: 0 4px 0 rgba(0,0,0,.12); animation: gtin .25s ease-out, gtout .4s ease-in 1.8s forwards; text-align: center; }
.g-toast.good { background: #E4FAF2; color: #0B6B4C; } .g-toast.bad { background: #FFE6E0; color: #A6391A; } .g-toast.info { background: #FFF3D1; color: #6A4300; }
@keyframes gtin { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes gtout { to { opacity: 0; transform: translateY(-6px); } }

.g-confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 65; }
.g-confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 3px; animation: gfall 3s linear forwards; }
@keyframes gfall { to { transform: translateY(105vh) rotate(600deg); } }

@keyframes shakeX { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.shake { animation: shakeX .3s ease-in-out; }
@keyframes popIn { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
