/* Ducky Doubles — tile component styles extracted from game.css. */

/* ========================================
   TILE STYLES
   ======================================== */

.tile {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    box-sizing: border-box;
    /* border: 2px solid #240A0E; */
    font-weight: 700;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: left 100ms cubic-bezier(0.68, -0.15, 0.265, 1.15),
                top 100ms cubic-bezier(0.68, -0.15, 0.265, 1.15),
                transform 160ms cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, left, top;
}

.tile--new {
    animation: tileAppear 280ms ease-in-out;
}

.tile--merging {
    animation: tileMerge 200ms ease-out forwards;
    /* z-index set dynamically in JS based on slide distance (3-5) */
}

.tile--merged-result {
    animation: tileMergeResult 350ms ease-out;
    z-index: 20;
}

.tile--game-over-shrink {
    animation: tileGameOverBounce 500ms ease-in-out forwards;
}

.tile--ducky {
    /* Customize special duck tiles here if needed. */
}

.tile--chain-preview {
    box-shadow: 0px 0 0 3px rgba(19, 41, 64, 0.4),
                0 0 12px rgba(255, 246, 200, 0.6),
                0 3px 4px rgba(19, 43, 64, 0.55);
    transition: box-shadow 120ms ease-out, filter 120ms ease-out;
}

.tile--chain-glide {
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45),
                0 0 18px rgba(255, 255, 255, 0.65),
                0 18px 28px rgba(0, 0, 0, 0.6);
    transition: box-shadow 250ms ease-out, filter 250ms ease-out;
}

.tile--chain-merge {
    animation: chainExplosion 400ms ease-out;
}

.tile--static-inline {
    position: relative !important;
    left: 0 !important;
    top: 0 !important;
    transform: none !important;
    transition: none !important;
}

.tile--static-board {
    position: absolute;
    transition: none !important;
}

.tile--admin-mode {
    cursor: pointer;
    transition: all 100ms ease;
}

.tile--admin-mode:hover {
    transform: scale(1.05);
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.5);
}

.tile--nudge-left {
    animation: tileNudgeLeft 300ms ease-in-out;
}

.tile--nudge-right {
    animation: tileNudgeRight 300ms ease-in-out;
}

.tile--nudge-up {
    animation: tileNudgeUp 300ms ease-in-out;
}

.tile--nudge-down {
    animation: tileNudgeDown 300ms ease-in-out;
}

/* ========================================
   PUZZLE MODE TILE TYPES
   ======================================== */

.tile--stationary {
    background: linear-gradient(135deg, #4b5563 0%, #1f2937 100%) !important;
    border: 2px solid #9ca3af;
    opacity: 0.85;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3),
                0 4px 6px -1px rgba(0, 0, 0, 0.15);
}

.tile--stationary .tile__number {
    color: #e5e7eb !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8) !important;
    opacity: 0.9;
}

.tile--block {
    background: linear-gradient(135deg, #7c2d12 0%, #431407 100%) !important;
    border: 2px dashed #f97316;
    opacity: 0.9;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4),
                0 4px 6px -1px rgba(0, 0, 0, 0.2);
}

.tile--block .tile__number {
    color: #fed7aa !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8) !important;
}

.grid-cell {
    position: absolute;
    border-radius: 12px;
    /* box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.2); */
}

/* ========================================
   TILE NUMBER DISPLAY
   ======================================== */

.tile__number {
    font-size: 28px;
    line-height: 1;
    height: 100%;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    /* box-shadow: inset 0px 0px 10px -2px rgba(255, 255, 255, 0.5); */
    margin: 3px;
    border-radius: 8px;
}

/* Responsive font sizing based on digit count */
.tile__number--1digit,
.tile__number--2digit,
.tile__number--3digit {
    font-size: 28px;
}

.tile__number--4digit {
    font-size: 21px;
}

.tile__number--5digit {
    font-size: 18.2px;
}

.tile__number--6digit {
    font-size: 15.4px;
}

/* ========================================
   TILE VALUE COLORS
   ======================================== */

/* Tiles with dark text (light shadow) */
.tile--value-0 {
    /* background-color: #F8F3DF; */
    background-color: var(--peach-100);
    color: #776e65;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.4);
}

.tile--value-2 {
    background-color: #FFFBBB;
    /* background-color: var(--yellow-200); */
    color: #776e65;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.4);
}

.tile--value-4 {
    background-color: #FEE1B1;
    /* background-color: var(--yellow-300); */
    color: #776e65;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.4);
}

/* Tiles with white text (dark shadow) */
.tile--value-3 {
    background-color: #132B40;
    /* background-color: var(--gray-900); */
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.tile--value-8 {
    background-color: #FF9E7C;
    /* background-color: var(--peach-600); */
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.tile--value-16 {
    background-color: #E86A7D;
    /* background-color: var(--pink-600); */
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.tile--value-32 {
    background-color: #88CEE9;
    /* background-color: var(--blue-500); */
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.tile--value-64 {
    background-color: #4FAFD2;
    /* background-color: var(--teal-500); */
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.tile--value-128 {
    background-color: #17BDC1;
    /* background-color: var(--teal-600); */
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.tile--value-256 {
    background-color: #008BAF;
    /* background-color: var(--teal-700); */
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.tile--value-512 {
    background-color: #A8CC6E;
    /* background-color: var(--green-400); */
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.tile--value-1024 {
    background-color: #8BAB53;
    background-color: var(--green-600);
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.tile--value-2048 {
    background-color: #A89DDF;
    /* background-color: var(--purple-300); */
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.tile--value-4096 {
    background-color: #925FBA;
    /* background-color: var(--teal-600); */
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.tile--value-8192 {
    background-color: #587B92;
    /* background-color: var(--slate-700); */
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.tile--value-16384 {
    background-color: #425662;
    /* background-color: var(--slate-800); */
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.tile--value-32768 {
    background-color: #252A2E;
    /* background-color: var(--gray-900); */
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.tile--value-65536 {
    background-color: #262A2D;
    /* background-color: var(--gray-900); */
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.tile--value-131072 {
    background-color: #25292C;
    /* background-color: var(--gray-900); */
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.tile--value-262144 {
    background-color: #1D2125;
    /* background-color: var(--gray-900); */
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.tile--value-524288 {
    background-color: #25292D;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

/* ========================================
   ADMIN TILE MENU
   ======================================== */

.admin-menu-backdrop {
    backdrop-filter: blur(2px);
}

.admin-tile-menu {
    background: white;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    min-width: 280px;
}

.admin-tile-menu-header {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    text-align: center;
}

.admin-tile-menu-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.admin-tile-menu-item {
    width: 70px;
    height: 70px;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 100ms ease, box-shadow 100ms ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.admin-tile-menu-item:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.admin-tile-menu-item:active {
    transform: scale(0.95);
}

/* ========================================
   TILE ANIMATIONS
   ======================================== */

@keyframes tileGameOverBounce {
    0% { transform: scale(1); }
    35% { transform: scale(0.9); }
    65% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes chainExplosion {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(0.95);
        opacity: 0.8;
    }
    100% {
        transform: scale(1.15);
        opacity: 1;
    }
}

@keyframes tileAppear {
    0% { transform: scale(0.8); }
    60% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

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

@keyframes tileMergeResult {
    0% { transform: scale(0.8); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes tileNudgeLeft {
    0% { transform: translateX(0); }
    30% { transform: translateX(-10px); }
    100% { transform: translateX(0); }
}

@keyframes tileNudgeRight {
    0% { transform: translateX(0); }
    30% { transform: translateX(10px); }
    100% { transform: translateX(0); }
}

@keyframes tileNudgeUp {
    0% { transform: translateY(0); }
    30% { transform: translateY(-10px); }
    100% { transform: translateY(0); }
}

@keyframes tileNudgeDown {
    0% { transform: translateY(0); }
    30% { transform: translateY(10px); }
    100% { transform: translateY(0); }
}
