/* ===== VARIABLES CSS ===== */
:root {
    /* Paleta basada en montevideo.com.uy */
    --primary-color: #E74C3C;
    --secondary-color: #27AE60;
    --accent-color: #F39C12;
    --warning-color: #F1C40F;
    --info-color: #3498DB;
    --text-dark: #333333;
    --text-light: #666666;
    --bg-white: #FFFFFF;
    --bg-light: #F8F9FA;
    --bg-gray: #E0E0E0;
    --border-color: #DDDDDD;
    --success-color: #27AE60;
    --error-color: #E74C3C;
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    
    /* Border radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    
    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 8px rgba(0,0,0,0.15);
    --shadow-lg: 0 8px 16px rgba(0,0,0,0.2);
}

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--spacing-sm);
}

/* ===== HEADER ===== */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #c0392b 100%);
    color: white;
    padding: var(--spacing-lg) 0;
    text-align: center;
    box-shadow: var(--shadow-md);
    margin-bottom: var(--spacing-lg);
}

.header-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: var(--spacing-xs);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.header-content h1 i {
    margin-right: var(--spacing-sm);
}

.subtitle {
    font-size: 1.1rem;
    font-weight: 300;
    opacity: 0.95;
}

/* ===== INTRO SECTION ===== */
.intro {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--secondary-color);
}

.intro h2 {
    color: var(--primary-color);
    font-size: 1.8rem;
    margin-bottom: var(--spacing-md);
}

.intro p {
    font-size: 1.05rem;
    color: var(--text-light);
    margin-bottom: var(--spacing-md);
}

.intro-tips {
    background: #FFF9E6;
    border-left: 3px solid var(--accent-color);
    padding: var(--spacing-md);
    border-radius: var(--radius-sm);
    margin-top: var(--spacing-md);
}

.intro-tips p {
    margin: 0;
    color: var(--text-dark);
}

.intro-tips i {
    color: var(--accent-color);
    margin-right: var(--spacing-xs);
}

/* ===== CONTROLS SECTION ===== */
.controls {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
}

.control-group h3 {
    color: var(--primary-color);
    font-size: 1.4rem;
    margin-bottom: var(--spacing-md);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.control-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-md);
}

.control-item {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.control-item label {
    font-weight: 500;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.badge {
    background: var(--accent-color);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 700;
}

/* ===== BUTTONS ===== */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    box-shadow: var(--shadow-sm);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

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

.btn-primary:hover {
    background: #c0392b;
}

.btn-secondary {
    background: var(--bg-light);
    color: var(--text-dark);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-gray);
}

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

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

.btn-help:hover {
    background: #e67e22;
}

.btn-help:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-warning {
    background: var(--warning-color);
    color: var(--text-dark);
}

.btn-warning:hover {
    background: #f4d03f;
}

.btn-group {
    display: flex;
    gap: var(--spacing-xs);
    flex-wrap: wrap;
}

/* ===== GAME AREA ===== */
.game-area {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.game-grid-section,
.definitions-section {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
}

.game-grid-section h3,
.definitions-section h3 {
    color: var(--primary-color);
    font-size: 1.4rem;
    margin-bottom: var(--spacing-md);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

/* ===== GAME GRID ===== */
.game-grid {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
}

.word-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.word-number {
    background: var(--primary-color);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.word-number:hover {
    background: #c0392b;
    transform: scale(1.1);
}

.word-number.checking {
    animation: pulse 0.5s ease;
}

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

.word-cells {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.cell {
    width: 45px;
    height: 45px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 600;
    text-transform: uppercase;
    transition: all 0.3s ease;
    background: white;
}

.cell input {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-dark);
    outline: none;
}

.cell.highlighted {
    background: var(--bg-gray);
    border-color: var(--info-color);
}

.cell.correct {
    background: #d4edda;
    border-color: var(--success-color);
    animation: correctAnim 0.5s ease;
}

.cell.incorrect {
    background: #f8d7da;
    border-color: var(--error-color);
    animation: shake 0.5s ease;
}

.cell.revealed {
    background: #fff3cd;
    border-color: var(--accent-color);
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ===== HIDDEN MESSAGE ===== */
.hidden-message {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px dashed var(--info-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    text-align: center;
}

.hidden-message h4 {
    color: var(--info-color);
    margin-bottom: var(--spacing-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
}

.revealed-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
    letter-spacing: 4px;
    font-family: 'Courier New', monospace;
}

/* ===== DEFINITIONS LIST ===== */
.definitions-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    max-height: 600px;
    overflow-y: auto;
    padding-right: var(--spacing-xs);
}

.definition-item {
    padding: var(--spacing-md);
    background: var(--bg-light);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--secondary-color);
    transition: all 0.3s ease;
}

.definition-item:hover {
    background: #e8ecf1;
    transform: translateX(4px);
}

.definition-item.completed {
    background: #d4edda;
    border-left-color: var(--success-color);
}

.definition-number {
    display: inline-block;
    background: var(--secondary-color);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    text-align: center;
    line-height: 28px;
    font-weight: 700;
    font-size: 0.85rem;
    margin-right: var(--spacing-xs);
}

.definition-text {
    display: inline;
    font-size: 0.95rem;
    color: var(--text-dark);
}

/* ===== SYLLABLES SECTION ===== */
.syllables-section {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
}

.syllables-section h3 {
    color: var(--primary-color);
    font-size: 1.4rem;
    margin-bottom: var(--spacing-sm);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.syllables-hint {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: var(--spacing-md);
    font-style: italic;
}

.syllables-container {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
}

.syllable {
    background: var(--info-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.syllable:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.syllable.used {
    background: #95a5a6;
    text-decoration: line-through;
    opacity: 0.6;
}

/* ===== MODALS ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideDown 0.4s ease;
}

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

.modal-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #c0392b 100%);
    color: white;
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.close-modal {
    background: transparent;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    transition: transform 0.3s ease;
}

.close-modal:hover {
    transform: scale(1.2);
}

.modal-body {
    padding: var(--spacing-lg);
}

.modal-body ol {
    padding-left: var(--spacing-lg);
}

.modal-body li {
    margin-bottom: var(--spacing-sm);
    line-height: 1.8;
}

.modal-body ul {
    margin-top: var(--spacing-xs);
    padding-left: var(--spacing-lg);
}

.revealed-saying {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
    text-align: center;
    margin: var(--spacing-md) 0;
}

.revealed-saying h3 {
    color: var(--secondary-color);
    margin-bottom: var(--spacing-sm);
}

.final-message {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
    font-style: italic;
    line-height: 1.8;
}

.modal-footer {
    padding: var(--spacing-lg);
    background: var(--bg-light);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    display: flex;
    justify-content: center;
    gap: var(--spacing-sm);
}

/* ===== FLOATING BUTTON ===== */
.btn-float {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--info-color);
    color: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
    z-index: 999;
}

.btn-float:hover {
    background: #2980b9;
    transform: scale(1.1);
}

/* ===== FOOTER ===== */
.footer {
    background: white;
    text-align: center;
    padding: var(--spacing-lg);
    margin-top: var(--spacing-xl);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    color: var(--text-light);
}

/* ===== SCROLLBAR ===== */
.definitions-list::-webkit-scrollbar {
    width: 8px;
}

.definitions-list::-webkit-scrollbar-track {
    background: var(--bg-light);
    border-radius: var(--radius-sm);
}

.definitions-list::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: var(--radius-sm);
}

.definitions-list::-webkit-scrollbar-thumb:hover {
    background: #c0392b;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .game-area {
        grid-template-columns: 1fr;
    }
    
    .definitions-list {
        max-height: 400px;
    }
}

@media (max-width: 768px) {
    .header-content h1 {
        font-size: 2rem;
    }
    
    .intro h2 {
        font-size: 1.4rem;
    }
    
    .control-options {
        grid-template-columns: 1fr;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .cell {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }
    
    .cell input {
        font-size: 1rem;
    }
    
    .revealed-text {
        font-size: 1.2rem;
        letter-spacing: 2px;
    }
    
    .btn-float {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .header-content h1 {
        font-size: 1.6rem;
    }
    
    .subtitle {
        font-size: 0.95rem;
    }
    
    .cell {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }
    
    .cell input {
        font-size: 0.9rem;
    }
    
    .word-number {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }
    
    .syllable {
        font-size: 0.85rem;
        padding: 0.4rem 0.8rem;
    }
    
    .final-message {
        font-size: 1.2rem;
    }
}