/* the tile games: a slim header, the board in the middle, the tray under it; charcoal and chalk like the rest */
.g-page { max-width: 760px; margin: 0 auto; padding: 10px 16px 28px; box-sizing: border-box }
.g-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 4px 0 10px }
.g-back { font-size: 13px; font-weight: 600; color: var(--soft); text-decoration: none; padding: 4px 10px 4px 8px; border-radius: 999px }
.g-back::before { content: '‹ ' }
.g-back:hover { color: var(--ink); background: var(--wash) }
.g-head h1 { font-size: 19px; letter-spacing: -.01em; margin: 0; font-weight: 800 }
.g-stats { display: flex; align-items: center; gap: 12px; font-variant-numeric: tabular-nums }
.g-stats > span:empty { display: none }
.g-stats small { display: block; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--soft); font-family: var(--mono) }
.g-stats b { font-size: 17px; font-weight: 800 }
.g-lives { display: inline-flex; align-items: center; gap: 2px }
.g-lives svg { width: 22px; height: 22px }
.g-note { font-size: 13px; color: var(--soft); display: inline-flex; align-items: center; gap: 4px }
.g-note svg { width: 22px; height: 22px }
.g-btns { margin-left: auto; display: flex; gap: 6px; align-items: center }
.g-extra { display: contents }

.g-tool, .g-btn { font: 600 14px var(--sans); color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; transition: background .15s }
.g-tool { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0 }
.g-tool svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round }
.g-tool:hover, .g-btn:hover { background: var(--wash) }
.g-tool[aria-pressed="true"] { background: var(--wash2) }
.g-tool:disabled { opacity: .35; cursor: default }
.g-btn { padding: 9px 16px }
.g-btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink) }
.g-btn.small { padding: 6px 12px; font-size: 13px }
.g-tool:focus-visible, .g-btn:focus-visible, .g-pc:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px }

/* the board: no grid; just the square under the pointer */
.g-board-wrap { display: flex; justify-content: center; touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent }
.g-board { display: block; color: var(--ink); overflow: visible; touch-action: manipulation; cursor: pointer }
.g-sq { fill: var(--wash); stroke: var(--line); stroke-width: 1.5px; vector-effect: non-scaling-stroke }
.g-sq.armed { stroke: color-mix(in srgb, var(--ink) 28%, transparent) }
.g-soil { fill: var(--wash2) }
.g-edge { fill: none; stroke: var(--line); stroke-width: 1px; stroke-dasharray: 4 5; vector-effect: non-scaling-stroke }
.g-ghost { pointer-events: none }

/* the boil: every piece is drawn three times and only the current frame shows */
.g-board:not([data-f="0"]) .f0, .g-board:not([data-f="1"]) .f1, .g-board:not([data-f="2"]) .f2,
.g-pic:not([data-f="0"]) .f0, .g-pic:not([data-f="1"]) .f1, .g-pic:not([data-f="2"]) .f2 { display: none }

/* a piece going down: a little squash, then settle */
.g-in { transform-box: fill-box; transform-origin: 50% 100% }
.g-cell.pop .g-in { animation: g-pop .2s cubic-bezier(.3, 1.6, .5, 1) }
@keyframes g-pop { 0% { transform: scale(1.12, .82) } 60% { transform: scale(.96, 1.06) } 100% { transform: none } }
.g-cell.bloom .g-in { animation: g-bloom .5s ease-out }
@keyframes g-bloom { 0% { transform: scale(1) } 35% { transform: scale(1.12) } 100% { transform: none } }
.g-cell.wilt { opacity: .38; transition: opacity .5s }
.g-cell.sleep { opacity: .9 }
.g-float > g { transform-box: fill-box; animation: g-float .9s ease-out forwards }
@keyframes g-float { from { transform: none; opacity: 1 } to { transform: translateY(-40%); opacity: 0 } }

/* the tray */
.g-tray { display: flex; align-items: center; gap: 10px; justify-content: center; padding: 12px 0 0; flex-wrap: wrap }
.g-tray-row { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center }
.g-tray-tools { display: flex; gap: 6px }
.g-pc { position: relative; display: grid; place-items: center; width: 50px; height: 50px; padding: 2px; border: 1px solid transparent; border-radius: 14px; background: var(--wash); color: var(--ink); cursor: pointer; box-sizing: border-box }
.g-pc svg { width: 100%; height: 100%; overflow: visible }
.g-pc.on { border-color: color-mix(in srgb, var(--ink) 35%, transparent); background: var(--wash2) }
.g-pc.out { opacity: .3 }
.g-pc.next { width: 38px; height: 38px; opacity: .6; cursor: default }
.g-pc i { position: absolute; right: 3px; bottom: 1px; font: 600 11px var(--mono); font-style: normal; color: var(--soft) }
.g-pc .g-txt { font: 800 13px var(--sans) }

/* sheets and toasts */
.g-sheet { border: 1px solid var(--line); border-radius: 22px; background: var(--bg); color: var(--ink); padding: 0; width: min(440px, calc(100vw - 32px)); max-height: 82vh; box-shadow: 0 20px 60px rgba(0, 0, 0, .25) }
.g-sheet::backdrop { background: color-mix(in srgb, var(--charcoal) 40%, transparent) }
.g-sheet-in { padding: 22px 22px 18px; margin: 0; outline: none }
.g-sheet h2 { margin: 0 0 10px; font-size: 20px; letter-spacing: -.01em }
.g-sheet-body { font-size: 15px; line-height: 1.55; color: var(--ink) }
.g-sheet-body p { margin: 0 0 10px }
.g-sheet-body ul { margin: 0 0 10px; padding-left: 20px }
.g-sheet-body kbd { font: 500 12px var(--mono); border: 1px solid var(--line); border-radius: 6px; padding: 1px 5px }
.g-sheet-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px }
.g-over-pic { display: flex; justify-content: center; margin: 4px 0 12px }
.g-over-pic svg { max-width: 100%; max-height: 46vh; color: var(--ink) }
.g-toasts { position: fixed; left: 16px; right: 16px; bottom: 24px; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; z-index: 20 }
.g-toast { max-width: 100%; box-sizing: border-box; text-align: center; background: var(--ink); color: var(--bg); font-weight: 600; font-size: 14px; padding: 9px 16px; border-radius: 999px; animation: g-toast .25s ease-out }
@keyframes g-toast { from { transform: translateY(8px); opacity: 0 } }

/* a bar that fills (Grow's countdown and sap) */
.g-bar { height: 5px; border-radius: 999px; background: var(--wash2); overflow: hidden; margin: 2px 0 8px }
.g-bar > i { display: block; height: 100%; width: 0; background: var(--ink); border-radius: inherit; transition: width .3s linear }

/* the hub */
.g-hub { max-width: 980px; margin: 0 auto; padding: 44px 20px 72px }
.g-hub h1 { font-size: 34px; letter-spacing: -.02em; margin: 0 0 6px; text-align: center }
.g-hub .sub { text-align: center; color: var(--soft); margin: 0 0 32px; font-size: 16px }
.g-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; list-style: none; margin: 0; padding: 0 }
.g-cards a, .g-cards span.soon { display: flex; flex-direction: column; gap: 6px; height: 100%; box-sizing: border-box; padding: 16px 18px 20px; border: 1px solid var(--line); border-radius: 18px; text-decoration: none; transition: background .15s, transform .15s }
.g-cards a:hover, .g-cards a:focus-visible { background: var(--wash); transform: translateY(-2px); outline: none }
.g-cards .g-pic { width: 100%; height: 120px; color: var(--ink); margin-bottom: 6px }
.g-cards .g-shot { width: 100%; height: 120px; object-fit: cover; border-radius: 10px; margin-bottom: 6px }
:root[data-theme="dark"] .g-cards .only-light, :root:not([data-theme="dark"]) .g-cards .only-dark { display: none }
.g-cards b { font-size: 19px; letter-spacing: -.01em }
.g-cards small { color: var(--soft); font-size: 14px; line-height: 1.45 }
.g-cards em { font: 500 11px var(--mono); font-style: normal; color: var(--soft); letter-spacing: .04em; text-transform: uppercase }

@media (max-width: 640px) {
  .g-page { padding: 8px 12px 24px }
  .g-head h1 { font-size: 17px }
  .g-pc { width: 44px; height: 44px; border-radius: 12px }
  .g-hub { padding: 30px 16px 56px }
  .g-hub h1 { font-size: 28px }
}
@media (prefers-reduced-motion: reduce) {
  .g-cards a, .g-tool, .g-btn { transition: none }
  .g-cell .g-in, .g-float > g, .g-toast { animation: none !important }
}
