/**
 * puzzle-grid.css — Grid layout, tile styling, animations
 * Framework grid styles for sliding tile puzzle games
 */

/* ── Game Board ─────────────────────────────────────────────────────────────── */
.game-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 8px;
    background: var(--apz-bg-panel, #1a0a2a);
    border: 3px solid var(--apz-accent, #00f5ff);
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 0 20px color-mix(in srgb, var(--apz-accent, #00f5ff) 30%, transparent);
}

/* ── Tiles ──────────────────────────────────────────────────────────────────── */
.tile {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    border-radius: 6px;
    background: var(--apz-border, #2a1a3a);
    color: var(--apz-text, #f0ead8);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    user-select: none;
    -webkit-user-select: none;
}

.tile-empty {
    background: transparent;
    box-shadow: none;
}

/* ── Tile Value Styling ─────────────────────────────────────────────────────── */
/* Override these in game-specific CSS */

.tile[data-value] {
    background: #3a2a4a;
}

/* ── Tile Animations ────────────────────────────────────────────────────────── */
.tile-new {
    animation: tileAppear 0.2s ease-out;
}

.tile-merged {
    animation: tileMerge 0.15s ease-out;
}

@keyframes tileAppear {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes tileMerge {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* ── Tile Value Colors (Generic) ────────────────────────────────────────────── */
/* Override these in game-specific CSS for custom themes */

.tile[data-value="2"]    { background: #1a3a5a; color: #7ec8f0; }
.tile[data-value="4"]    { background: #1a4a7a; color: #8ed8ff; }
.tile[data-value="8"]    { background: #0a7abf; color: #ffffff; }
.tile[data-value="16"]   { background: #6a0060; color: #f07ad0; }
.tile[data-value="32"]   { background: #b0006a; color: #ffffff; }
.tile[data-value="64"]   { background: #F23C8F; color: #ffffff; }
.tile[data-value="128"]  { background: #c47a00; color: #fff0a0; }
.tile[data-value="256"]  { background: #FFD54A; color: #1a0a00; }
.tile[data-value="512"]  { background: #FFC107; color: #1a0a00; }
.tile[data-value="1024"] { background: #FFEE58; color: #1a0a00; }
.tile[data-value="2048"] { background: #ffffff; color: #1a0a00; }
.tile[data-value="4096"] { background: linear-gradient(135deg, #fff, #f07ad0, #7ec8f0); color: #1a0a00; }
.tile[data-value="8192"] { background: linear-gradient(135deg, #fff, #f07ad0, #7ec8f0); color: #1a0a00; }

/* ── Tile Glow Effects ──────────────────────────────────────────────────────── */
.tile[data-value="8"]    { box-shadow: 0 0 8px rgba(10, 122, 191, 0.4); }
.tile[data-value="16"]   { box-shadow: 0 0 8px rgba(106, 0, 96, 0.4); }
.tile[data-value="32"]   { box-shadow: 0 0 10px rgba(176, 0, 106, 0.5); }
.tile[data-value="64"]   { box-shadow: 0 0 12px rgba(242, 60, 143, 0.6); }
.tile[data-value="128"]  { box-shadow: 0 0 14px rgba(196, 122, 0, 0.6); }
.tile[data-value="256"]  { box-shadow: 0 0 16px rgba(255, 213, 74, 0.7); }
.tile[data-value="512"]  { box-shadow: 0 0 18px rgba(255, 193, 7, 0.7); }
.tile[data-value="1024"] { box-shadow: 0 0 20px rgba(255, 238, 88, 0.8); }
.tile[data-value="2048"] { box-shadow: 0 0 25px rgba(255, 255, 255, 0.9); animation: glow 1.5s ease-in-out infinite; }
.tile[data-value="4096"],
.tile[data-value="8192"] { box-shadow: 0 0 30px rgba(255, 255, 255, 1); animation: glow 0.8s ease-in-out infinite; }

/* ── Game Over Overlay ──────────────────────────────────────────────────────── */
.game-over-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 6, 18, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.game-over-overlay.active {
    opacity: 1;
    visibility: visible;
}

.game-over-title {
    font-size: 24px;
    color: var(--apz-accent-alt, #ff2d78);
    text-shadow: 0 0 15px color-mix(in srgb, var(--apz-accent-alt, #ff2d78) 60%, transparent);
    margin-bottom: 20px;
}

.game-over-score {
    font-size: 12px;
    color: var(--apz-text, #f0ead8);
    margin-bottom: 20px;
}
