/* ========== Wordle Styles ========== */

.game-container {
    max-width: 520px;
    margin: 0 auto;
    padding: 0 16px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.game-header {
    text-align: center;
    margin-bottom: 8px;
}

.game-header h1 {
    font-size: 2rem;
    background: linear-gradient(135deg, var(--primary-neon), var(--accent-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}

.subtitle {
    color: var(--text-dim);
    font-size: 0.9rem;
}

/* Toolbar */
.game-toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.toolbar-btn {
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    padding: 8px 16px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    backdrop-filter: blur(10px);
}

.toolbar-btn:hover {
    background: rgba(255,255,255,0.12);
    border-color: var(--primary-neon);
}

/* Toast */
.toast-container {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: var(--text-main);
    color: var(--bg-dark);
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 1.2s forwards;
}

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

@keyframes toastOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ========== Board ========== */
.board-container {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.board {
    display: grid;
    grid-template-rows: repeat(6, 1fr);
    gap: 6px;
}

.board-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
}

.tile {
    width: 58px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 800;
    text-transform: uppercase;
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    color: var(--text-main);
    background: transparent;
    transition: transform 0.1s;
    user-select: none;
}

.tile.filled {
    border-color: rgba(255,255,255,0.4);
    animation: tilePop 0.1s ease;
}

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

/* Flip animation */
.tile.flip {
    animation: flipIn 0.3s ease forwards;
}

.tile.flip-out {
    animation: flipOut 0.3s ease forwards;
}

@keyframes flipIn {
    0% { transform: rotateX(0); }
    100% { transform: rotateX(90deg); }
}

@keyframes flipOut {
    0% { transform: rotateX(90deg); }
    100% { transform: rotateX(0); }
}

/* Tile states */
.tile.correct {
    background: #538d4e;
    border-color: #538d4e;
}

.tile.present {
    background: #b59f3b;
    border-color: #b59f3b;
}

.tile.absent {
    background: #3a3a3c;
    border-color: #3a3a3c;
}

/* Shake animation */
.board-row.shake {
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 50%, 90% { transform: translateX(-6px); }
    30%, 70% { transform: translateX(6px); }
}

/* Win dance */
.tile.dance {
    animation: dance 0.5s ease forwards;
}

@keyframes dance {
    0%, 100% { transform: translateY(0); }
    25% { transform: translateY(-20px); }
    50% { transform: translateY(5px); }
    75% { transform: translateY(-10px); }
}

/* ========== Keyboard ========== */
.keyboard {
    width: 100%;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.keyboard-row {
    display: flex;
    gap: 5px;
    justify-content: center;
    width: 100%;
}

.key {
    height: 52px;
    min-width: 32px;
    padding: 0 8px;
    border: none;
    border-radius: 6px;
    background: rgba(255,255,255,0.15);
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    transition: all 0.15s;
    user-select: none;
    flex: 1;
    max-width: 44px;
}

.key:hover {
    background: rgba(255,255,255,0.25);
}

.key:active {
    transform: scale(0.95);
}

.key.wide {
    flex: 1.5;
    max-width: 66px;
    font-size: 0.75rem;
}

.key.correct {
    background: #538d4e;
}

.key.present {
    background: #b59f3b;
}

.key.absent {
    background: rgba(255,255,255,0.06);
    color: var(--text-dim);
}

/* ========== Modal ========== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: rgba(30,30,40,0.95);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    padding: 32px;
    max-width: 400px;
    width: 90%;
    position: relative;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.5rem;
    cursor: pointer;
}

.modal h2 {
    text-align: center;
    font-size: 1.3rem;
    margin-bottom: 20px;
    color: var(--text-main);
}

.modal h3 {
    font-size: 0.85rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 20px 0 12px;
}

/* Stats */
.stats-row {
    display: flex;
    justify-content: space-around;
    text-align: center;
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-box .stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-main);
}

.stat-box .stat-label {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-top: 4px;
}

/* Distribution */
.distribution {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dist-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

.dist-label {
    width: 14px;
    text-align: center;
    color: var(--text-dim);
    font-weight: 700;
}

.dist-bar {
    min-width: 24px;
    padding: 2px 8px;
    text-align: right;
    background: #3a3a3c;
    color: var(--text-main);
    font-weight: 700;
    font-size: 0.8rem;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.dist-bar.highlight {
    background: #538d4e;
}

/* Modal Actions */
.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.share-btn, .play-again-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.share-btn {
    background: #538d4e;
    color: #fff;
}

.share-btn:hover {
    background: #6aaf5e;
}

.play-again-btn {
    background: linear-gradient(135deg, var(--primary-neon), var(--accent-cyan));
    color: #fff;
}

.play-again-btn:hover {
    opacity: 0.9;
}

/* ========== Responsive ========== */
@media (max-width: 400px) {
    .tile {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    .key {
        height: 46px;
        font-size: 0.75rem;
        padding: 0 4px;
    }

    .board-row {
        gap: 4px;
    }

    .board {
        gap: 4px;
    }
}

@media (max-width: 340px) {
    .tile {
        width: 44px;
        height: 44px;
        font-size: 1.3rem;
    }
}
