:root {
    /* Color Palette */
    --bg-color: #f8f9fa;
    --surface-color: #ffffff;
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;

    /* Level Colors */
    --level-gray: #9ca3af;
    --level-purple: #8b5cf6;
    --level-gold: #f59e0b;
    --level-impossible: linear-gradient(135deg, #3b82f6, #10b981, #f59e0b);

    /* Typography */
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    font-family: var(--font-family);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 80px;
    /* Space for footer */
}

/* Top Strip */
body::before {
    content: "";
    display: block;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), #818cf8);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9999;
}

/* Header */
header {
    margin-top: 40px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.shifty-logo {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
}

.tiles_logo {
    display: flex;
    gap: 4px;
    z-index: 2;
}

.tile_logo {
    width: 40px;
    height: 40px;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 20px;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease;
}

.tile_logo:hover {
    transform: translateY(-2px);
}

.words {
    font-size: 20px;
    font-weight: 300;
    color: var(--text-secondary);
    margin-left: 8px;
    letter-spacing: -0.5px;
}

.level-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-top: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Level Styles */
.level-gray .tile_logo {
    border-bottom: 3px solid var(--level-gray);
}

.level-purple .tile_logo {
    border-bottom: 3px solid var(--level-purple);
    color: var(--level-purple);
}

.level-gold .tile_logo {
    border-bottom: 3px solid var(--level-gold);
    color: var(--level-gold);
}

.level-impossible .tile_logo {
    border-bottom: 3px solid transparent;
    border-image: var(--level-impossible) 1;
}

/* Stats Bar */
#moves-left {
    display: flex;
    gap: 20px;
    background: var(--surface-color);
    padding: 10px 20px;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-sm);
    margin-bottom: 30px;
    font-size: 14px;
    font-weight: 500;
}

.label {
    color: var(--text-secondary);
    margin-right: 4px;
}

#streak,
#winStreak {
    color: var(--primary-color);
    font-weight: 700;
}

/* Game Board Area */
#columns-container {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    margin-bottom: 30px;
    min-height: 300px;
    align-items: flex-start;
}

.column-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: transparent;
    border-radius: var(--radius-lg);
    transition: transform 0.2s ease;
}

.column-wrapper.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.drag-handle {
    width: 100%;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: grab;
    background-color: rgba(0, 0, 0, 0.03);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    margin-bottom: 4px;
    touch-action: none;

}

.column-wrapper:hover .drag-handle {
    background-color: rgba(0, 0, 0, 0.05);
}

.drag-handle.disabled {
    display: none;
}

.column {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 6px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-lg);
}

.letter-cell {
    width: 48px;
    height: 48px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    user-select: none;
}

.letter-cell:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.letter-cell:active {
    transform: scale(0.95);
}



.letter-cell.eliminated {
    opacity: 0.4;
    background-color: var(--border-color);
    color: var(--text-secondary);
    pointer-events: none;
    box-shadow: none;
}

.letter-cell.found {
    background-color: #c7d2fe;
    /* Indigo 200 - Very Light Purple */
    color: #312e81;
    /* Indigo 900 - Dark Text */
    border-color: #c7d2fe;
    opacity: 1;
}

.letter-cell.selected {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Controls Area */
.controls-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 500px;
}

#guess-button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 32px;
    border-radius: var(--radius-full);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all 0.2s ease;
    min-width: 120px;
}

#guess-button:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

#guess-button:active {
    transform: translateY(0);
}

#guess-button:disabled {
    background: var(--text-secondary);
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#moves-left-button {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface-color);
    padding: 8px 16px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
}

#movesLeft {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 18px;
}

/* Guess Board */
#board {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 20px;
    padding: 20px;
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.guess-row {
    display: flex;
    gap: 6px;
    justify-content: center;
}

.tile {
    width: 48px;
    height: 48px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    text-transform: uppercase;
    transition: all 0.3s ease;
}

/* Tile States */
.tile.correct {
    background-color: #10b981;
    /* Green */
    border-color: #10b981;
    color: white;
}

.tile.misplaced {
    background-color: #f59e0b;
    /* Yellow/Gold */
    border-color: #f59e0b;
    color: white;
}

.tile.wrong {
    background-color: #6b7280;
    /* Gray */
    border-color: #6b7280;
    color: white;
}

.tile.win {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    animation: bounce 0.5s ease;
}

@keyframes bounce {

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

    50% {
        transform: scale(1.1);
    }
}

/* Instructions */
#instructions {
    max-width: 600px;
    margin: 20px auto;
    padding: 24px;
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    text-align: center;
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 16px;
}

/* Footer */
footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--surface-color);
    border-top: 1px solid var(--border-color);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-secondary);
    z-index: 2000;
}

.switch-language-icon {
    cursor: pointer;
    margin-left: 8px;
    transition: transform 0.2s ease;
    display: inline-block;
}

.switch-language-icon:hover {
    transform: scale(1.2);
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

footer a:hover {
    text-decoration: underline;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    /* Hidden by default */
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--surface-color);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 90%;
    width: 600px;
    position: relative;
    animation: slideUp 0.3s ease;
    margin: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.close {
    color: var(--text-secondary);
    opacity: 0.7;
}

.close:hover {
    opacity: 1;
    color: var(--text-primary);
}

/* Mobile Responsiveness */
/* Mobile Responsiveness */
@media (max-width: 600px) {
    header {
        margin-top: 10px;
        /* Reduced from 20px */
        margin-bottom: 10px;
    }

    .shifty-logo {
        transform: scale(0.8);
        /* Reduced from 0.9 */
    }

    #columns-container {
        gap: 2px;
        /* Reduced from 4px */
        padding: 2px;
        overflow-x: auto;
        justify-content: center;
        /* Center columns */
        padding-left: max(5px, env(safe-area-inset-left));
        padding-right: max(5px, env(safe-area-inset-right));
    }

    .column-wrapper {
        margin-bottom: 2px;
    }

    .column {
        gap: 4px;
        /* Reduced from 6px */
        padding: 4px;
    }

    .letter-cell {
        width: 38px;
        /* Reduced from 42px */
        height: 38px;
        font-size: 16px;
    }

    .tile {
        width: 36px;
        /* Reduced from 40px */
        height: 36px;
        font-size: 16px;
    }

    .controls-container {
        flex-direction: row;
        /* Keep row but wrap if needed, or just row */
        gap: 10px;
        /* Reduced from 16px */
        margin-bottom: 10px;
        /* Reduced from 20px */
        flex-wrap: wrap;
    }

    #guess-button {
        width: auto;
        /* Allow natural width */
        flex: 1;
        /* Take available space */
        padding: 10px 20px;
    }

    #moves-left {
        font-size: 16px;
    }

    footer {
        padding: 8px 12px;
        flex-direction: row;
        /* Allow side-by-side if fits */
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px 16px;
        /* Row gap 8px, Column gap 16px */
        text-align: center;
    }

    .footer-content {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px 16px;
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.hidden-board {
    opacity: 0;
    transform: translateY(20px);
}

.visible {
    opacity: 1;
    transform: translateY(0);
}

#download-result {
    margin-top: 40px;
    margin-bottom: 100px;
    /* Extra space before footer */
    text-align: center;
    font-size: 18px;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    display: none;
    /* Hidden by default, toggled by JS */
    width: 100%;
}

#download-result:hover {
    text-decoration: underline;
}