:root {
    --bg-color: #0f172a;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --primary-color: #8b5cf6;
    --primary-hover: #7c3aed;
    --board-bg: #1e293b;
    --cell-bg: #334155;
    --border-radius: 12px;
    --container-bg: #1e293b;
    --accent: #10b981;
    --link-color: #38bdf8;
    --link-hover: #7dd3fc;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.4;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 10px;
}

.container {
    max-width: 450px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

h1 {
    font-size: 1.8rem;
    font-weight: 800;
    text-align: center;
    background: linear-gradient(to right, #a855f7, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 4px 20px rgba(139, 92, 246, 0.2);
    margin-bottom: 0;
}

.score-board {
    display: flex;
    gap: 15px;
    width: 100%;
    justify-content: center;
}

.score-box {
    background-color: var(--container-bg);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 8px 15px;
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 100px;
    box-shadow: 0 5px 10px -3px rgba(0, 0, 0, 0.1);
}

.label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 1px;
}

#score, #highscore {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
}

main {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    position: relative;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 3px;
    background-color: var(--board-bg);
    padding: 6px;
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 40vh; /* Limits size on shorter screens */
    aspect-ratio: 1;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5), 0 10px 30px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.05);
}

.cell {
    background-color: var(--cell-bg);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    height: 100%;
}

.cell:hover {
    filter: brightness(1.2);
    transform: scale(0.95);
}

.cell.filled {
    box-shadow: inset 0 0 10px rgba(255,255,255,0.2), 0 0 10px rgba(0,0,0,0.3);
}

.active-piece-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    background-color: rgba(30, 41, 59, 0.5);
    padding: 10px;
    border-radius: var(--border-radius);
    border: 1px dashed rgba(255,255,255,0.2);
}

.active-piece-container h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 5px;
}

.active-piece-preview {
    display: grid;
    gap: 0;
    justify-content: center;
    align-content: center;
    height: 60px;
}

.preview-cell {
    width: 20px;
    height: 20px;
    border-radius: 0;
    background-color: transparent;
}

.preview-cell.filled {
    box-shadow: inset 0 0 5px rgba(255,255,255,0.2);
}

.btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.6);
}

.btn:active {
    transform: translateY(0);
}

.game-over {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
    border-radius: var(--border-radius);
    z-index: 10;
    backdrop-filter: blur(5px);
}

.game-over h2 {
    font-size: 2.5rem;
    color: #ef4444;
    text-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
}

.game-over p {
    font-size: 1.5rem;
    font-weight: 600;
}

footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 5px;
}

.seo-backlink-container {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.9));
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-left: 4px solid var(--primary-color);
    padding: 15px;
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.seo-backlink-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(139, 92, 246, 0.15);
}

.seo-backlink-container h3 {
    font-size: 1rem;
    margin-bottom: 5px;
    color: #e2e8f0;
}

.seo-backlink-container p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.4;
}

.seo-link {
    color: var(--link-color);
    text-decoration: none;
    font-weight: 800;
    position: relative;
    padding-bottom: 2px;
}

.seo-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--link-color);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s ease;
}

.seo-link:hover {
    color: var(--link-hover);
}

.seo-link:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

.copyright {
    text-align: center;
    font-size: 0.8rem;
    color: #475569;
}

/* Animations */
@keyframes pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.pop-animation {
    animation: pop 0.3s ease;
}

@media (max-width: 400px) {
    .game-board {
        gap: 2px;
        padding: 5px;
    }
    .score-board {
        gap: 10px;
    }
    .score-box {
        min-width: 100px;
        padding: 10px 15px;
    }
    h1 {
        font-size: 1.8rem;
    }
}
