/* game_2048.css — celikezor 2048 oyunu stilleri */
/* Tek kart layout (Dino ile aynı pattern) */

/* ── Layout wrapper ── */
.game-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: calc(100vh - 120px);
    box-sizing: border-box;
    position: relative;
    gap: 1.25rem;
}

/* ── Card ── */
.glass-card {
    background: rgba(10, 15, 25, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    padding: 1.75rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    color: var(--text-primary);
    box-sizing: border-box;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* ── Score row ── */
.game-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.game-brand {
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent-color);
    letter-spacing: 2px;
    user-select: none;
}

.scores-container {
    display: flex;
    gap: 0.75rem;
}

.score-box {
    background: rgba(19, 34, 56, 0.35);
    border: 1px solid var(--surface-border);
    padding: 0.45rem 1.1rem;
    border-radius: 8px;
    text-align: center;
    min-width: 85px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.score-label {
    display: block;
    font-size: 0.68rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.12rem;
}

.score-val {
    font-size: 1.35rem;
    font-weight: 800;
    color: #ffffff;
}

/* ── Description ── */
.game-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    text-align: center;
    margin: 0.5rem auto 1rem;
    max-width: 90%;
}

/* ── Controls row (dino-btn tarzı inline butonlar) ── */
.controls-row {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    width: 100%;
}

.action-btn {
    flex: 1;
    background: transparent;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    padding: 0.6rem 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    user-select: none;
    white-space: nowrap;
}

.action-btn:hover:not(:disabled) {
    background: rgba(0, 210, 255, 0.1);
    box-shadow: 0 0 8px rgba(0, 210, 255, 0.2);
}

.action-btn:disabled {
    border-color: var(--surface-border);
    color: var(--text-secondary);
    opacity: 0.4;
    cursor: not-allowed;
}

.action-btn.danger {
    border-color: var(--danger-color);
    color: var(--danger-color);
}

.action-btn.danger:hover:not(:disabled) {
    background: rgba(255, 51, 51, 0.1);
    box-shadow: 0 0 8px rgba(255, 51, 51, 0.2);
}

/* Board Area */
.game-board-wrapper {
    position: relative;
    width: 100%;
    max-width: 480px;
    aspect-ratio: 1;
    margin: 0 auto;
    box-sizing: border-box;
}

/* Bulletproof Responsive Grid Sizing using matching Percentages */
.grid-container {
    position: relative;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 2.5%;
    padding: 2.5%;
    background: rgba(10, 15, 25, 0.85);
    border: 2px solid var(--surface-border);
    border-radius: 12px;
    width: 100%;
    height: 100%;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 12px rgba(0, 210, 255, 0.04);
    box-sizing: border-box;
    z-index: 1;
}

.grid-cell {
    background: rgba(19, 34, 56, 0.25);
    border: 1px solid rgba(0, 210, 255, 0.04);
    border-radius: 8px;
    width: 100%;
    height: 100%;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Absolute sliding tiles container overlapping the grid content box */
.tile-container {
    position: absolute;
    top: 2.5%;
    left: 2.5%;
    right: 2.5%;
    bottom: 2.5%;
    pointer-events: none;
}

/* Exact coordinate positioning with transition */
.tile {
    position: absolute;
    width: 23.125%;
    /* (100% - 3 * 2.5%) / 4 */
    height: 23.125%;
    left: calc(var(--col) * (23.125% + 2.5%));
    top: calc(var(--row) * (23.125% + 2.5%));
    transition: left 150ms cubic-bezier(0.25, 1, 0.5, 1), top 150ms cubic-bezier(0.25, 1, 0.5, 1), opacity 150ms ease-out;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    border-radius: 8px;
    user-select: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    font-size: 2.2rem;
    box-sizing: border-box;
}

/* Small font scaling for higher digits */
.tile.tile-size-3 {
    font-size: 1.8rem;
}

.tile.tile-size-4 {
    font-size: 1.3rem;
}

.tile.tile-size-5 {
    font-size: 1.0rem;
}

/* Elegant Dark/Cyan Neon Blue Palette Spectrum */
.tile-2 {
    background: hsl(210, 80%, 15%);
    color: #00d2ff;
    border: 1px solid rgba(0, 210, 255, 0.2);
}

.tile-4 {
    background: hsl(210, 80%, 20%);
    color: #00d2ff;
    border: 1px solid rgba(0, 210, 255, 0.3);
}

.tile-8 {
    background: hsl(210, 85%, 25%);
    color: #ffffff;
    border: 1px solid rgba(0, 210, 255, 0.4);
    text-shadow: 0 0 4px rgba(0, 210, 255, 0.35);
}

.tile-16 {
    background: hsl(210, 85%, 30%);
    color: #ffffff;
    border: 1px solid rgba(0, 210, 255, 0.5);
    box-shadow: 0 2px 4px rgba(0, 210, 255, 0.08);
}

.tile-32 {
    background: hsl(210, 90%, 35%);
    color: #ffffff;
    border: 1px solid rgba(0, 210, 255, 0.6);
    box-shadow: 0 2px 6px rgba(0, 210, 255, 0.1);
}

.tile-64 {
    background: hsl(210, 90%, 40%);
    color: #ffffff;
    border: 1px solid rgba(0, 210, 255, 0.7);
    box-shadow: 0 2px 8px rgba(0, 210, 255, 0.12);
}

.tile-128 {
    background: hsl(210, 95%, 45%);
    color: #ffffff;
    border: 1px solid rgba(0, 210, 255, 0.8);
    box-shadow: 0 2px 10px rgba(0, 210, 255, 0.15);
}

.tile-256 {
    background: hsl(210, 95%, 50%);
    color: #ffffff;
    border: 1px solid #00d2ff;
    box-shadow: 0 2px 12px rgba(0, 210, 255, 0.18);
}

.tile-512 {
    background: hsl(205, 100%, 55%);
    color: #ffffff;
    border: 1px solid #33e0ff;
    box-shadow: 0 3px 14px rgba(51, 224, 255, 0.2);
}

.tile-1024 {
    background: hsl(200, 100%, 62%);
    color: #ffffff;
    border: 1px solid #80f0ff;
    box-shadow: 0 3px 16px rgba(128, 240, 255, 0.22);
    font-weight: 900;
}

.tile-2048 {
    background: hsl(195, 100%, 70%);
    color: #0a0f19;
    border: 1px solid #b3f7ff;
    box-shadow: 0 3px 18px rgba(179, 247, 255, 0.25);
    animation: blueGlow 1.5s infinite alternate;
    font-weight: 900;
}

.tile-4096 {
    background: hsl(190, 100%, 76%);
    color: #0a0f19;
    border: 2px solid hsl(190, 70%, 48%);
    box-shadow: 0 3px 20px rgba(0, 190, 210, 0.2);
    animation: blueGlow2 1.5s infinite alternate;
    font-weight: 900;
}

.tile-8192 {
    background: hsl(185, 100%, 82%);
    color: #0a0f19;
    border: 2px solid hsl(185, 65%, 52%);
    box-shadow: 0 3px 22px rgba(0, 195, 205, 0.22);
    animation: blueGlow3 1.5s infinite alternate;
    font-weight: 900;
}

.tile-16384 {
    background: hsl(180, 100%, 88%);
    color: #0a0f19;
    border: 2px solid hsl(180, 60%, 56%);
    box-shadow: 0 3px 24px rgba(0, 200, 200, 0.24);
    animation: blueGlow4 1.5s infinite alternate;
    font-weight: 950;
}

.tile-super {
    background: #ffffff;
    color: #0a0f19;
    border: 2px solid hsl(190, 70%, 50%);
    box-shadow: 0 3px 26px rgba(0, 210, 255, 0.3);
    font-weight: 950;
}

@keyframes blueGlow {
    0% {
        box-shadow: 0 2px 6px rgba(179, 247, 255, 0.15);
    }

    100% {
        box-shadow: 0 3px 16px rgba(179, 247, 255, 0.35);
    }
}

@keyframes blueGlow2 {
    0% {
        box-shadow: 0 2px 8px rgba(0, 190, 210, 0.15);
    }

    100% {
        box-shadow: 0 3px 18px rgba(0, 190, 210, 0.32);
    }
}

@keyframes blueGlow3 {
    0% {
        box-shadow: 0 2px 10px rgba(0, 195, 205, 0.18);
    }

    100% {
        box-shadow: 0 3px 20px rgba(0, 195, 205, 0.36);
    }
}

@keyframes blueGlow4 {
    0% {
        box-shadow: 0 2px 12px rgba(0, 200, 200, 0.2);
    }

    100% {
        box-shadow: 0 3px 22px rgba(0, 200, 200, 0.4);
    }
}

/* Pop/Spawn Keyframes (Animate Scale only to prevent coordinate collisions) */
@keyframes scaleUp {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes pop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

.tile.new-tile {
    animation: scaleUp 220ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.tile.merged-tile {
    animation: pop 220ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Game Messages & Overlays */
.game-message {
    position: absolute;
    inset: 0;
    background: rgba(10, 15, 25, 0.96);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    text-align: center;
    padding: 2rem;
}

.game-message.show {
    opacity: 1;
    pointer-events: auto;
}

.game-message p {
    font-size: 2.5rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 1.5rem;
    text-shadow: 0 0 8px rgba(0, 210, 255, 0.3);
}

.modal-btn {
    background: var(--accent-color);
    color: #000;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 0 8px rgba(0, 210, 255, 0.2);
    user-select: none;
}

.modal-btn:hover {
    background: #00b8e6;
    box-shadow: 0 0 12px rgba(0, 210, 255, 0.35);
    transform: translateY(-1px);
}

/* ── Fullscreen Mode ── */
.game-layout:fullscreen {
    background: radial-gradient(circle at center, #0e1726 0%, #050811 100%) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.game-layout:-webkit-full-screen {
    background: radial-gradient(circle at center, #0e1726 0%, #050811 100%) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.game-layout.fullscreen-active {
    max-width: 100% !important;
    min-height: 100vh !important;
    height: auto !important;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1.5rem;
    background: radial-gradient(circle at center, #0e1726 0%, #050811 100%) !important;
    overflow-y: auto !important;
}

.game-layout.fullscreen-active .glass-card {
    max-width: 500px;
    padding: 1.25rem;
}

.game-layout.fullscreen-active .game-board-wrapper {
    max-width: min(480px, 65vh) !important;
    max-height: min(480px, 65vh) !important;
}

.game-layout.fullscreen-active .game-message {
    z-index: 9999 !important;
    background: rgba(10, 15, 25, 0.98) !important;
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .game-layout {
        padding: 1rem 0.5rem;
        gap: 1rem;
    }

    .glass-card {
        padding: 1.25rem;
        gap: 1rem;
    }

    .game-brand {
        font-size: 1.6rem;
    }

    .controls-row {
        gap: 0.4rem;
    }

    .action-btn {
        font-size: 0.78rem;
        padding: 0.5rem 0.35rem;
    }
}

@media (max-width: 520px) {
    .tile {
        font-size: 1.8rem;
        border-radius: 6px;
    }

    .tile.tile-size-3 {
        font-size: 1.4rem;
    }

    .tile.tile-size-4 {
        font-size: 1.1rem;
    }

    .tile.tile-size-5 {
        font-size: 0.9rem;
    }

    .game-brand {
        font-size: 2rem;
    }

    .score-box {
        padding: 0.4rem 0.6rem;
        min-width: 65px;
    }

    .score-val {
        font-size: 1.1rem;
    }

    .action-btn {
        padding: 0.6rem;
        font-size: 0.85rem;
    }
}

/* Lider tablosu ile oyun kartı arasında boşluk */
#leaderboard2048 {
    margin-top: 1.5rem;
}

/* Mobile Touch Standardizations */
canvas, .game-layout, .game-board {
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}