/* The playable demo page. Uses the site's palette; the tiles match the game's. */
.demo { width: min(520px, 100% - 32px); margin: 0 auto; padding: 8px 0 72px; }
.demo-head { text-align: center; margin: 10px 0 24px; }
.demo-head h1 { font-size: clamp(38px, 9vw, 56px); margin: 0 0 12px; }
.demo-head h1 span { color: var(--pink); }
.demo-head .lead { margin: 0 auto; max-width: 28em; color: var(--muted); font-size: 18px; }
.site-header nav a[aria-current] { color: var(--ink); }

.game-card { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 32px; padding: 18px; box-shadow: 0 24px 40px -26px rgba(63, 52, 43, 0.35); }
.hud { display: flex; align-items: center; gap: 22px; margin-bottom: 14px; }
.hud .stat { display: flex; flex-direction: column; line-height: 1.1; }
.hud .stat span { font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.hud .stat b { font-family: "Baloo 2", system-ui, sans-serif; font-weight: 800; font-size: 32px; font-variant-numeric: tabular-nums; }
.hud .btn { margin-left: auto; cursor: pointer; }
.btn.small { min-height: 44px; padding: 0 20px; font-size: 17px; }
button.btn { cursor: pointer; font-family: "Baloo 2", system-ui, sans-serif; }

.board { position: relative; width: 100%; border-radius: 22px; background: #efe7d8; touch-action: none; user-select: none; -webkit-user-select: none; outline: none; -webkit-tap-highlight-color: transparent; }
.board:focus-visible { box-shadow: 0 0 0 4px rgba(255, 77, 130, 0.35); }
.slot { position: absolute; left: 0; top: 0; border-radius: 17%; background: #e4dac7; pointer-events: none; }

.tile { position: absolute; left: 0; top: 0; z-index: 1; will-change: transform; transition: transform 0.09s cubic-bezier(0.4, 0, 0.2, 1); cursor: grab; }
.tile.moving { z-index: 4; }
.tile.drag { z-index: 5; transition: none; cursor: grabbing; }
.tile .in { position: relative; width: 100%; height: 100%; border-radius: 17%; display: flex; align-items: center; justify-content: center; font-family: "Baloo 2", system-ui, sans-serif; font-weight: 800; line-height: 1; box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.14); transition: transform 0.12s ease, filter 0.12s ease; }
.tile .in::before { content: ""; position: absolute; left: 9%; right: 9%; top: 7%; height: 28%; border-radius: 30% 30% 40% 40%; background: rgba(255, 255, 255, 0.2); }
.tile.drag .in { transform: scale(1.06); box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.14), 0 12px 18px -8px rgba(42, 34, 51, 0.4); }
.tile.sel .in { transform: scale(1.08); filter: brightness(1.12); }
.tile .in.pop { animation: m-pop 0.14s ease-out; }
.tile .in.spawn { animation: m-spawn 0.12s cubic-bezier(0.3, 1.5, 0.5, 1); }
@keyframes m-pop { 0% { transform: scale(1); } 50% { transform: scale(1.1); } 100% { transform: scale(1); } }
@keyframes m-spawn { from { transform: scale(0.3); } to { transform: scale(1); } }
.cursor { position: absolute; left: 0; top: 0; z-index: 6; border-radius: 17%; border: 4px solid var(--ink); pointer-events: none; }
.cursor[hidden] { display: none; }

.over { position: absolute; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; border-radius: 32px; background: rgba(63, 52, 43, 0.5); }
.over[hidden] { display: none; }
.over-card { background: var(--card); border-radius: 24px; padding: 26px 34px; text-align: center; box-shadow: 0 20px 40px -16px rgba(0, 0, 0, 0.45); }
.over-card h2 { margin: 0 0 6px; font-size: 32px; }
.over-card p { margin: 0 0 18px; font-size: 18px; }

.demo-how { display: grid; gap: 14px; margin-top: 36px; }
.demo-how .card { margin: 0; }
.demo-how .card h3 { font-size: 20px; margin: 0 0 4px; }
.demo-how .card p { margin: 0; color: var(--muted); font-size: 16px; }
.demo .cta { margin-top: 40px; padding: 40px 20px; }
.demo .cta h2 { font-size: 30px; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: 0; }

@media (max-width: 600px) {
  .site-header nav { display: none; }
  .demo { padding-bottom: 56px; }
  .demo-head { margin-bottom: 16px; }
  .demo-head .lead { display: none; }
  .game-card { padding: 12px; border-radius: 26px; }
  .hud { margin-bottom: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .tile, .tile .in { transition: none; animation: none; }
}
