/* Wordle Argentina - Mobile First CSS */

:root {
    /* Colores principales */
    --color-bg: #121213;
    --color-surface: #1a1a1b;

    /* Estados de celda */
    --color-correct: #538d4e;
    --color-present: #b59f3b;
    --color-absent: #3a3a3c;

    /* Teclado */
    --color-key: #818384;
    --color-key-hover: #a0a0a0;

    /* UI */
    --color-border: #3a3a3c;
    --color-border-active: #565758;
    --color-text: #ffffff;
    --color-text-muted: #818384;

    /* Espaciado */
    --gap: 6px;
    --cell-size: 58px;
    --key-height: 58px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    user-select: none;
    -webkit-user-select: none;
}

.container {
    width: 100%;
    max-width: 500px;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    padding: 0 8px;
}

/* Header */
.header {
    text-align: center;
    padding: 16px 0 8px;
    border-bottom: 1px solid var(--color-border);
}

.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 500px;
    margin: 0 auto;
    padding: 0 8px;
}

.header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
}

.header-spacer {
    width: 36px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border: 1px solid var(--color-border);
    border-radius: 50%;
    background: transparent;
    color: var(--color-text);
    font-size: 1.25rem;
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.2s, border-color 0.2s;
}

.btn-icon:hover {
    background: var(--color-surface);
    border-color: var(--color-text-muted);
}

.day-number {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin-top: 4px;
}

/* Grilla de juego */
.game {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 0;
}

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

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

.cell {
    width: var(--cell-size);
    height: var(--cell-size);
    border: 2px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    text-transform: uppercase;
    background: transparent;
    transition: border-color 0.1s;
}

.cell.filled {
    border-color: var(--color-border-active);
    animation: pop 0.1s ease;
}

.cell.correct {
    background: var(--color-correct);
    border-color: var(--color-correct);
}

.cell.present {
    background: var(--color-present);
    border-color: var(--color-present);
}

.cell.absent {
    background: var(--color-absent);
    border-color: var(--color-absent);
}

.cell.reveal {
    animation: flip 0.5s ease forwards;
}

.row.shake {
    animation: shake 0.5s ease;
}

.row.bounce .cell {
    animation: bounce 0.5s ease;
}

.row.bounce .cell:nth-child(1) { animation-delay: 0.0s; }
.row.bounce .cell:nth-child(2) { animation-delay: 0.1s; }
.row.bounce .cell:nth-child(3) { animation-delay: 0.2s; }
.row.bounce .cell:nth-child(4) { animation-delay: 0.3s; }
.row.bounce .cell:nth-child(5) { animation-delay: 0.4s; }

/* Teclado virtual */
.keyboard {
    padding: 8px 0 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

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

.key {
    height: var(--key-height);
    min-width: 32px;
    padding: 0 12px;
    border: none;
    border-radius: 4px;
    background: var(--color-key);
    color: var(--color-text);
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.1s, transform 0.1s;
}

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

.key.wide {
    min-width: 56px;
    font-size: 0.75rem;
}

.key.correct {
    background: var(--color-correct);
}

.key.present {
    background: var(--color-present);
}

.key.absent {
    background: var(--color-absent);
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 100;
}

.modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--color-surface);
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 360px;
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.3s;
}

.modal-overlay.visible .modal {
    transform: scale(1);
}

.modal h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.modal p {
    color: var(--color-text-muted);
    margin-bottom: 24px;
}

/* Estadísticas */
.stats {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
}

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

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* Distribución */
.distribution {
    margin-bottom: 24px;
}

.dist-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 0.875rem;
}

.dist-row span:first-child {
    width: 16px;
    text-align: right;
}

.dist-bar {
    height: 20px;
    background: var(--color-absent);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 8px;
    min-width: 24px;
    font-size: 0.75rem;
    font-weight: 700;
}

.dist-bar.highlight {
    background: var(--color-correct);
}

/* Botones */
.modal-actions {
    display: flex;
    gap: 12px;
}

.btn {
    flex: 1;
    height: 48px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: opacity 0.1s, transform 0.1s;
}

.btn:active {
    transform: scale(0.98);
}

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

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

.btn-full {
    width: 100%;
}

/* Modal de ayuda */
.modal-help {
    text-align: left;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-help h2 {
    text-align: center;
    margin-bottom: 8px;
}

.help-intro {
    text-align: center;
    color: var(--color-text);
    font-size: 1rem;
    margin-bottom: 16px;
}

.help-section {
    margin-bottom: 16px;
    font-size: 0.875rem;
    color: var(--color-text-muted);
    line-height: 1.5;
}

.help-section p {
    margin-bottom: 8px;
}

.help-examples {
    margin-bottom: 16px;
}

.help-example {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--color-border);
}

.help-example:last-child {
    border-bottom: none;
    margin-bottom: 8px;
    padding-bottom: 0;
}

.example-row {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
}

.example-cell {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    border: 2px solid var(--color-border);
    text-transform: uppercase;
}

.example-cell.correct {
    background: var(--color-correct);
    border-color: var(--color-correct);
}

.example-cell.present {
    background: var(--color-present);
    border-color: var(--color-present);
}

.example-cell.absent {
    background: var(--color-absent);
    border-color: var(--color-absent);
}

.help-example p {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin: 0;
}

.help-footer {
    text-align: center;
    margin-bottom: 16px;
}

.help-footer p {
    margin: 0;
    font-size: 0.875rem;
}

.help-note {
    color: var(--color-text-muted);
    margin-top: 4px !important;
}

/* Toast */
.toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-text);
    color: var(--color-bg);
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 700;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 200;
}

.toast.visible {
    opacity: 1;
    visibility: visible;
}

/* Animaciones */
@keyframes pop {
    50% { transform: scale(1.1); }
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-4px); }
    40%, 80% { transform: translateX(4px); }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Responsive - Tablets y Desktop */
@media (min-width: 768px) {
    .container {
        padding: 0 16px;
    }

    :root {
        --cell-size: 62px;
    }

    .header h1 {
        font-size: 2rem;
    }
}

/* Viewport muy pequeño */
@media (max-width: 340px) {
    :root {
        --cell-size: 50px;
        --key-height: 50px;
    }

    .key {
        padding: 0 8px;
        min-width: 26px;
        font-size: 0.75rem;
    }

    .key.wide {
        min-width: 44px;
    }
}
