body
{
	margin: 0;
	padding: 0;
	font: normal 10pt Arial,Helvetica,sans-serif;
	width:100%;
	color: #2c3e50;
	background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
	height:100%;
	min-height: 100vh;
}
#header
{
	margin: 0;
	height:70px;
	background: linear-gradient(90deg, #2c3e50 0%, #34495e 100%);
	border-bottom: 3px solid #3498db;
	box-shadow: 0 4px 20px rgba(0,0,0,0.1);
	position: relative;
	z-index: 100;
}
#header::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: linear-gradient(90deg, rgba(52, 152, 219, 0.1) 0%, rgba(155, 89, 182, 0.1) 100%);
	pointer-events: none;
}
#footer
{
	clear:both;
	height:45px;
	font-size: 0.9em;
	text-align: center;
	width: 100%;
	border-top: 2px solid rgba(52, 152, 219, 0.3);
	bottom:0px;
	background: linear-gradient(90deg, #2c3e50 0%, #34495e 100%);
    font-weight: 500;
    color: #ecf0f1;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}
#footer a
{
    color: #3498db;
    text-decoration: none;
    transition: color 0.3s ease;
}
#footer a:hover { color: #5dade2; }
#logo
{
	padding: 15px 25px;
	font-size: 32px;
	color:#ffffff;
	font-weight: 700;
    width:150px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    letter-spacing: 2px;
    position: relative;
    z-index: 1;
}
#header_score {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #ffeb3b;
    font-weight: 700;
    font-size: 18px;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.6);
}

#header_score #score {
    color: #ffffff;
    margin-left: 8px;
    background: rgba(0,0,0,0.15);
    padding: 4px 8px;
    border-radius: 6px;
}
#logo::after {
    content: '';
    position: absolute;
    bottom: 10px;
    left: 25px;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #3498db, #9b59b6);
    border-radius: 2px;
}
#container
{
    width:100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 20px 0;
}
.block
{
    margin: auto;
    margin:20px 10px;
    width:315px;
    height:315px;
    border:5px solid rgba(255,255,255,0.2);
    border-radius:12px;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}
.control-container {
    /* container visibility and positioning are handled by media queries
       and the override that places controls above the board. Keep this
       selector minimal to avoid conflicting position styles. */
    align-items: center;
    justify-content: center;
}
/* Tile base styles (td) */
td {
    width:60px;
    height:60px;
    margin:0px;
    text-align: center;
    line-height:60px;
    display:table-cell;
    border:1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    font-weight:bold;
    background-color: #fcfcfc;
    transition: all 0.15s ease-in-out;
    position: relative;
    padding: 0;
    transform-origin: center;
}

/* Smooth sliding animations for tile movements */
td.sliding-left {
    animation: slideLeft 0.2s ease-out;
}

td.sliding-right {
    animation: slideRight 0.2s ease-out;
}

td.sliding-up {
    animation: slideUp 0.2s ease-out;
}

td.sliding-down {
    animation: slideDown 0.2s ease-out;
}

/* Merge animation */
td.merging {
    animation: mergeTile 0.3s ease-out;
}

/* New tile appearance */
td.new-tile {
    animation: newTileAppear 0.3s ease-out;
}

/* Keyframe animations for sliding */
@keyframes slideLeft {
    0% {
        transform: translateX(68px);
        opacity: 0.8;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideRight {
    0% {
        transform: translateX(-68px);
        opacity: 0.8;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideUp {
    0% {
        transform: translateY(68px);
        opacity: 0.8;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideDown {
    0% {
        transform: translateY(-68px);
        opacity: 0.8;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes mergeTile {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
        box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    }
    100% {
        transform: scale(1);
    }
}

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

td:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}
p{
    margin:0px;
}
.restart-button-div {
    text-align:center;
}

#restart-button {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}

#restart-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
    background: linear-gradient(135deg, #5dade2 0%, #3498db 100%);
}

#restart-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(52, 152, 219, 0.3);
}

.instructions {
    text-align: center;
    font-size: 14px;
    color: #ffffff;
    background: rgba(255,255,255,0.15);
    padding: 12px 20px;
    border-radius: 8px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.3);
    font-weight: 500;
    letter-spacing: 0.5px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    margin:20px;
}

.instructions strong {
    color: #ffeb3b;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    margin: 15% auto;
    padding: 0;
    border-radius: 15px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease-out;
    overflow: hidden;
}

.modal-header {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    padding: 20px;
    text-align: center;
    margin: 0;
}

.modal-header.win-header {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
}

.modal-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.modal-body {
    padding: 30px 20px;
    text-align: center;
    color: #2c3e50;
}

.modal-body p {
    margin: 10px 0;
    font-size: 16px;
    line-height: 1.5;
}

.modal-body strong {
    color: #e74c3c;
    font-weight: 700;
}

.modal-footer {
    padding: 20px;
    text-align: center;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.modal-button {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border: none;
    padding: 12px 25px;
    margin: 0 5px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.modal-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
    background: linear-gradient(135deg, #5dade2 0%, #3498db 100%);
}

.modal-button.secondary {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
    box-shadow: 0 4px 15px rgba(149, 165, 166, 0.3);
}

.modal-button.secondary:hover {
    background: linear-gradient(135deg, #bdc3c7 0%, #95a5a6 100%);
    box-shadow: 0 6px 20px rgba(149, 165, 166, 0.4);
}

/* Modal Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 480px) {
    .modal-content {
        margin: 10% auto;
        width: 95%;
    }
    
    .modal-header h2 {
        font-size: 20px;
    }
    
    .modal-body {
        padding: 20px 15px;
    }
    
    .modal-button {
        padding: 10px 20px;
        font-size: 13px;
        margin: 5px;
    }
}

/* Mobile Controls */
.game-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px auto;
    max-width: 600px;
    position: relative;
}

/* Removed legacy absolute-positioned control containers (not used). */

.game-center {
    display: flex;
    flex-direction: column; /* stack controls above the block */
    align-items: center;
    justify-content: center;
    position: relative;
    margin: 0; /* centering handled by #container */
}

.control-btn {
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    overflow: hidden;
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
    background: linear-gradient(135deg, #5dade2 0%, #3498db 100%);
}

.control-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(52, 152, 219, 0.3);
}

.control-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.control-btn:hover::before {
    left: 100%;
}
#game-goal {
    text-align:left;
}




