.app-detail-main { flex: 1; padding: 128px 24px 104px; }
.app-detail-container { width: min(100%, 760px); margin: 0 auto; }
.app-detail-heading { margin-bottom: 24px; display: flex; align-items: center; gap: 10px; }
.app-detail-heading h1 { font-size: var(--text-2xl); font-weight: 650; line-height: 1.25; overflow-wrap: anywhere; }
.app-detail-back { background: var(--surface); }
.tool-body { padding: 28px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.tool-body > * { width: 100%; }

@media (max-width: 768px) {
    .app-detail-main { padding: 88px 12px calc(96px + env(safe-area-inset-bottom)); }
    .tool-body { padding: 20px 14px; }
    .app-detail-heading { margin-bottom: 16px; }
    .app-detail-heading h1 { font-size: var(--text-xl); }
}

.app-detail-container-game { max-width: 520px; }

.game-stats { display: flex; justify-content: center; gap: 32px; margin-bottom: 16px; }
.game-stat { min-width: 72px; text-align: center; }
.game-stat-value { color: var(--text); font-size: var(--text-xl); font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.game-stat-label { margin-top: 4px; color: var(--text-muted); font-size: var(--text-sm); }
.game-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 16px; }

.game2048 { max-width: 384px; margin: 0 auto; }

.game2048-board {
    position: relative; width: min(100%, 384px); aspect-ratio: 1; margin: 0 auto;
    padding: 8px; border-radius: var(--radius-sm); background: var(--bg-tertiary);
    touch-action: none; outline: none;
}
.game2048-board:focus-visible { box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25); }
.game2048-grid { display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(4, 1fr); gap: 8px; width: 100%; height: 100%; }
.game2048-cell {
    position: relative; display: flex; align-items: center; justify-content: center; min-width: 0;
    border-radius: var(--radius-sm); background: var(--bg-secondary); color: var(--text);
    font-size: var(--text-xl); font-weight: 700; font-variant-numeric: tabular-nums;
}
.game2048-tile, .game2048-merge-source { position: absolute; inset: 0; display: grid; place-items: center; border-radius: inherit; }
.game2048-tile { z-index: 1; }
.game2048-merge-source { z-index: 2; }
.game2048-tile-2 { background: #fff; color: #243954; box-shadow: inset 0 0 0 2px #bccde2; }
[data-theme="dark"] .game2048-tile-2 { background: #46576e; color: #f2f6ff; box-shadow: inset 0 0 0 1px #68819c; }
[data-theme="dark"] .game2048-tile-4 { background: #335b82; color: #f2f6ff; }
.game2048-tile-4 { background: #e0f2fe; color: #334155; }
.game2048-tile-8 { background: #bfdbfe; color: #1e3a8a; }
.game2048-tile-16 { background: #93c5fd; color: #1e3a8a; }
.game2048-tile-32 { background: #60a5fa; color: #172554; }
.game2048-tile-64 { background: #2563eb; color: #ffffff; }
.game2048-tile-128 { background: #22c55e; color: #052e16; }
.game2048-tile-256 { background: #eab308; color: #422006; }
.game2048-tile-512 { background: #f97316; color: #431407; }
.game2048-tile-1024 { background: #b91c1c; color: #ffffff; }
.game2048-tile-2048 { background: #6d28d9; color: #ffffff; }
.game2048-tile-super { background: #0f172a; color: #ffffff; }
.game2048-tile.digits-4 { font-size: var(--text-lg); }
.game2048-tile.digits-5 { font-size: var(--text-base); }
.game2048-tile.digits-many { font-size: var(--text-xs); }
.game2048-tile.is-new { animation: game2048Pop 0.16s ease-out; }
.game2048-tile.is-merged { animation: game2048Merge 0.2s ease-out; }

.game2048-message { text-align: center; }

.game2048-new-game { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }

@keyframes game2048Pop { from { transform: scale(0.65); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes game2048Merge { 50% { transform: scale(1.12); } }
