/* Word Salad Game Styles */

:root {
    --primary-color: #6aaa64;
    --secondary-color: #c9b458;
    --background: #ffffff;
    --text-color: #1a1a1b;
    --border-color: #d3d6da;
    --cell-bg: #ffffff;
    --cell-selected: #ffd700;
    --cell-found: #6aaa64;
    --cell-correct: #c9b458;
    --modal-bg: rgba(0, 0, 0, 0.5);
    --grid-gap: 12px;
    --border-radius: 8px;
}

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

body {
    font-family: 'Clear Sans', 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--background);
    color: var(--text-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 500px;
    margin: 0 auto;
    padding: 10px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.game-header h1 {
    font-size: 28px;
    font-weight: 700;
    text-align: center;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px;
}

.game-header .home-link {
    color: inherit;
    text-decoration: none;
    transition: opacity 0.2s;
}

.game-header .home-link:hover {
    opacity: 0.7;
}

.game-header .separator {
    margin: 0 8px;
    opacity: 0.5;
}

.game-header .game-title {
    white-space: nowrap;
}

.header-left, .header-right {
    min-width: 60px;
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.header-right {
    text-align: right;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.icon-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

a.icon-btn {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: inherit;
}

/* Game Navigation */
.game-nav {
    text-align: center;
    padding: 8px 0;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.game-nav .nav-link {
    color: var(--text-color);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s;
}

.game-nav .nav-link:hover {
    color: var(--primary-color);
}

.game-nav .nav-separator {
    margin: 0 12px;
    color: var(--border-color);
}

/* SEO Content Styling */
.seo-content {
    max-width: 600px;
    margin: 0 auto;
}

.seo-content h3 {
    color: var(--primary-color);
    font-size: 18px;
    margin-bottom: 10px;
}

.seo-content p {
    line-height: 1.6;
    color: var(--text-color);
    margin-bottom: 10px;
}

.seo-content ul {
    margin: 10px 0;
}

.seo-content li {
    margin-bottom: 8px;
}

.seo-content a:hover {
    text-decoration: underline;
}

/* Game Info */
.game-info {
    margin-bottom: 20px;
}

.puzzle-theme {
    font-size: 20px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 15px;
    color: var(--primary-color);
}

.game-stats {
    display: flex;
    justify-content: space-around;
    gap: 10px;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    background-color: #f6f7f8;
    border-radius: var(--border-radius);
    flex: 1;
}

.stat-label {
    font-size: 12px;
    color: #787c7e;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-color);
}

/* Word Grid */
.game-board {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    min-height: 320px;
}

.word-grid {
    display: grid;
    row-gap: var(--grid-gap);
    column-gap: var(--grid-gap);
    padding: 10px;
    background-color: #f6f7f8;
    border-radius: var(--border-radius);
    user-select: none;
}

.grid-cell {
    aspect-ratio: 1;
    background-color: var(--cell-bg);
    border: 2px solid var(--border-color);
    border-radius: 4px;
    /* Improved touch target size */
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.grid-cell:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(106, 170, 100, 0.3);
}

.grid-cell.selected {
    background-color: var(--cell-selected);
    border-color: var(--secondary-color);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.5);
    font-weight: bold;
    z-index: 10;
}

.grid-cell.found {
    background-color: var(--cell-found);
    color: white;
    border-color: var(--cell-found);
    animation: fadeOut 0.5s ease forwards;
}

.grid-cell.hint {
    background-color: var(--cell-correct);
    color: white;
    animation: pulse 0.5s ease;
}

.grid-cell.hidden {
    opacity: 0;
    transform: scale(0);
    pointer-events: none;
    visibility: hidden;
    transition: all 0.3s ease-out;
}

/* Disappearing animation */
@keyframes disappear {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.2) rotate(10deg);
    }
    100% {
        opacity: 0;
        transform: scale(0) rotate(20deg);
        visibility: hidden;
    }
}

.grid-cell.disappearing {
    animation: disappear 0.4s ease-out forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: scale(0.8);
    }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* Found Words */
.found-words {
    background-color: #f6f7f8;
    border-radius: var(--border-radius);
    padding: 15px;
    margin-bottom: 20px;
}

.found-words h3 {
    font-size: 16px;
    margin-bottom: 10px;
    color: #787c7e;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.words-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.found-word {
    background-color: var(--primary-color);
    color: white;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 600;
    text-transform: capitalize;
}

.word-slot {
    background-color: white;
    border: 2px dashed var(--border-color);
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    color: #787c7e;
    min-width: 50px;
    text-align: center;
}

/* Current Word */
.current-word {
    text-align: center;
    min-height: 40px;
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 15px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.btn {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

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

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: #5a9a54;
}

.btn-secondary {
    background-color: #e5e7eb;
    color: var(--text-color);
}

.btn-secondary:hover {
    background-color: #d1d5db;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--modal-bg);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: var(--border-radius);
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-content h2 {
    margin-bottom: 20px;
    font-size: 24px;
    text-align: center;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 32px;
    cursor: pointer;
    color: #787c7e;
    padding: 5px 10px;
}

.close-btn:hover {
    color: var(--text-color);
}

/* Victory Modal */
.victory-stats {
    text-align: center;
    margin: 20px 0;
    font-size: 18px;
}

.victory-stats div {
    margin: 10px 0;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* Menu Modal */
.menu-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.menu-btn {
    width: 100%;
    padding: 16px;
    background-color: #f6f7f8;
    border: none;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.menu-btn:hover {
    background-color: #e5e7eb;
}

/* Instructions */
.instructions {
    margin: 20px 0;
}

.instruction-step {
    margin-bottom: 20px;
}

.instruction-step h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--primary-color);
}

.instruction-step p {
    color: #787c7e;
    line-height: 1.5;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin: 20px 0;
}

.stat-box {
    background-color: #f6f7f8;
    padding: 20px;
    border-radius: var(--border-radius);
    text-align: center;
}

.stat-number {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-color);
}

/* Responsive */
@media (max-width: 480px) {
    :root {
        --grid-gap: 8px;
    }

    .grid-cell {
        font-size: 20px;
    }

    .game-header h1 {
        font-size: 18px;
    }

    .game-header .separator {
        display: none;
    }

    .game-header .home-link {
        font-size: 14px;
    }

    .game-header .game-title {
        font-size: 18px;
    }

    .game-nav {
        font-size: 12px;
    }

    .game-nav .nav-separator {
        margin: 0 8px;
    }

    .current-word {
        font-size: 24px;
    }

    .icon-btn {
        font-size: 20px;
        padding: 6px;
    }
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal.active .modal-content {
    animation: slideIn 0.3s ease;
}
