:root {
    --bg-color: #121213;
    --card-bg: #1e1e1e;
    --text-color: #ffffff;
    --correct: #538d4e;
    --close: #b59f3b;
    --wrong: #3a3a3c;
    --border: #565758;
    --accent: #d49e52;
    --accent-dark: #a37a3f;
}

* {
    box-sizing: border-box;
}

body {
    background: linear-gradient(135deg, #0d0d0e 0%, #1a1a1c 100%);
    color: var(--text-color);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    overflow-x: hidden;
}

.main-container {
    width: 100%;
    max-width: 500px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: fadeIn 0.5s ease;
}

header {
    text-align: center;
    margin-bottom: 30px;
    animation: slideDown 0.6s ease;
}

header h1 {
    font-size: 2.5rem;
    margin: 0 0 10px 0;
    letter-spacing: 3px;
    background: linear-gradient(135deg, var(--accent) 0%, #ffd89b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(212, 158, 82, 0.3);
}

header p {
    margin: 0;
    color: #aaa;
    font-size: 0.95rem;
}

.flag {
    font-size: 2rem;
    display: inline-block;
    animation: wave 2s ease-in-out infinite;
}

/* ============ NAVEGACIÓN ============ */
.screen {
    width: 100%;
    animation: fadeIn 0.4s ease;
}

.screen.hidden {
    display: none;
}

.screen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.screen-title {
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: 25px;
    color: var(--accent);
}

/* ============ PANTALLA INICIO ============ */
.hero-section {
    text-align: center;
    padding: 40px 20px;
    margin-bottom: 30px;
}

.hero-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
}

.hero-section h2 {
    font-size: 2rem;
    margin: 0 0 15px 0;
    color: var(--accent);
}

.hero-text {
    color: #bbb;
    font-size: 1rem;
    line-height: 1.6;
    margin: 0;
}

.menu-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin: 25px 0;
}

.info-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 25px;
}

.info-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    transition: transform 0.3s, border-color 0.3s;
}

.info-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
}

.info-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.info-title {
    font-weight: bold;
    margin-bottom: 5px;
    color: var(--accent);
}

.info-desc {
    font-size: 0.85rem;
    color: #999;
}

/* ============ PANTALLA JUEGO ============ */
.clue-card {
    background: linear-gradient(135deg, var(--card-bg) 0%, #252527 100%);
    border: 2px solid var(--border);
    padding: 25px;
    border-radius: 12px;
    width: 100%;
    margin-bottom: 20px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s;
}

.clue-card:hover {
    transform: scale(1.02);
}

.clue-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 15px;
    letter-spacing: 2px;
    font-weight: bold;
}

#event-description {
    font-size: 1.15rem;
    font-weight: 500;
    line-height: 1.6;
    color: #fff;
}

.attempts-info {
    text-align: center;
    margin-bottom: 15px;
    font-size: 0.9rem;
    color: #aaa;
    font-weight: bold;
}

#attempts-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
    min-height: 200px;
}

.attempt-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px;
    background-color: var(--wrong);
    border-radius: 8px;
    font-weight: bold;
    font-size: 1.1rem;
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid transparent;
    transition: transform 0.2s;
}

.attempt-row:hover {
    transform: translateX(5px);
}

.attempt-row.correct { 
    background-color: var(--correct);
    border-color: #6ca65a;
    box-shadow: 0 0 20px rgba(83, 141, 78, 0.4);
}

.attempt-row.close { 
    background-color: var(--close);
    border-color: #cdb04d;
}

.input-area {
    display: flex;
    gap: 12px;
    width: 100%;
}

input {
    flex-grow: 1;
    padding: 18px;
    font-size: 1.3rem;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--border);
    border-radius: 8px;
    color: white;
    text-align: center;
    transition: all 0.3s;
    font-weight: bold;
}

input:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 15px rgba(212, 158, 82, 0.3);
}

input::placeholder {
    color: #666;
}

/* ============ BOTONES ============ */
.btn-primary {
    padding: 18px 35px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    color: white;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(212, 158, 82, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 158, 82, 0.5);
}

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

.btn-large {
    width: 100%;
    font-size: 1.2rem;
    padding: 20px;
}

.btn-secondary {
    padding: 15px 25px;
    background: var(--card-bg);
    color: white;
    font-weight: bold;
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-secondary:hover {
    border-color: var(--accent);
    background: rgba(212, 158, 82, 0.1);
    transform: translateY(-2px);
}

.btn-back {
    padding: 10px 20px;
    background: transparent;
    color: var(--accent);
    border: 2px solid var(--accent);
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.btn-back:hover {
    background: var(--accent);
    color: black;
}

.btn-icon-only {
    padding: 10px 15px;
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s;
}

.btn-icon-only:hover {
    border-color: var(--accent);
    transform: scale(1.1);
}

.btn-icon {
    font-size: 1.2rem;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.hidden { display: none; }

#result-message {
    margin-top: 25px;
    padding: 25px;
    border-radius: 10px;
    text-align: center;
    width: 100%;
    animation: slideUp 0.5s ease;
}

#result-text {
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 20px;
    white-space: pre-line;
}

/* ============ ESTADÍSTICAS ============ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.stat-box {
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 25px;
    text-align: center;
    transition: all 0.3s;
}

.stat-box:hover {
    border-color: var(--accent);
    transform: translateY(-5px);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--accent);
    margin-bottom: 8px;
}

.stat-label {
    font-size: 0.85rem;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.subsection-title {
    font-size: 1.3rem;
    margin: 30px 0 15px 0;
    color: var(--accent);
    text-align: center;
}

.distribution-chart {
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 25px;
}

.bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.bar-label {
    font-weight: bold;
    min-width: 20px;
    color: var(--accent);
}

.bar-container {
    flex-grow: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.bar-fill {
    background: linear-gradient(90deg, var(--accent) 0%, var(--accent-dark) 100%);
    height: 30px;
    border-radius: 5px;
    min-width: 30px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 10px;
    transition: width 0.5s ease;
}

.bar-value {
    font-weight: bold;
    color: #fff;
    min-width: 30px;
}

/* ============ HISTORIAL ============ */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.empty-message {
    text-align: center;
    color: #666;
    padding: 40px;
    font-style: italic;
}

.history-item {
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    transition: all 0.3s;
    animation: slideIn 0.4s ease;
}

.history-item:hover {
    transform: translateX(5px);
    border-color: var(--accent);
}

.history-item.won {
    border-left: 4px solid var(--correct);
}

.history-item.lost {
    border-left: 4px solid #d32f2f;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.history-date {
    font-size: 0.85rem;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.history-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
}

.badge-win {
    background: rgba(83, 141, 78, 0.3);
    color: #6ca65a;
}

.badge-lose {
    background: rgba(211, 47, 47, 0.3);
    color: #ff5252;
}

.history-event {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 10px;
    color: var(--accent);
}

.history-details {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: #999;
}

.history-year, .history-attempts {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ============ ANIMACIONES ============ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

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

@keyframes popIn {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

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

@keyframes wave {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(15deg);
    }
    75% {
        transform: rotate(-15deg);
    }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 500px) {
    header h1 {
        font-size: 2rem;
    }
    
    .hero-section h2 {
        font-size: 1.6rem;
    }
    
    .stat-value {
        font-size: 2rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
/* ============ MODO SELECTOR ============ */
.mode-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    width: 100%;
}

.mode-btn {
    flex: 1;
    padding: 15px;
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 8px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.mode-btn:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.mode-btn.active {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    border-color: var(--accent);
    box-shadow: 0 4px 15px rgba(212, 158, 82, 0.4);
}

/* ============ MODO WORDLE ============ */
#wordle-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
    min-height: 250px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
}

.wordle-row {
    display: flex;
    gap: 6px;
    justify-content: center;
    align-items: center;
    animation: slideIn 0.3s ease;
}

.wordle-letter {
    min-width: 45px;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 900;
    border: 3px solid var(--border);
    border-radius: 4px;
    transition: all 0.3s;
    animation: flip 0.5s ease;
    text-transform: uppercase;
    background: var(--card-bg);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.wordle-correct {
    background-color: #6aaa64 !important;
    border-color: #6aaa64 !important;
    color: white;
    box-shadow: 0 0 15px rgba(106, 170, 100, 0.6);
}

.wordle-present {
    background-color: #c9b458 !important;
    border-color: #c9b458 !important;
    color: white;
    box-shadow: 0 0 10px rgba(201, 180, 88, 0.4);
}

.wordle-absent {
    background-color: #787c7e !important;
    border-color: #787c7e !important;
    color: white;
}

.wordle-pending {
    background-color: var(--card-bg);
    border-color: var(--border);
}

.wordle-empty {
    min-width: 45px;
    width: 45px;
    height: 45px;
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.wordle-separator {
    width: 12px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wordle-input-area {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.wordle-input-area input {
    flex: 1;
    padding: 15px;
    font-size: 1.1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--border);
    border-radius: 8px;
    color: white;
    text-align: center;
    text-transform: uppercase;
    font-weight: bold;
}

/* ============ TECLADO VIRTUAL ============ */
#keyboard {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
}

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

.keyboard-key {
    min-width: 32px;
    height: 45px;
    padding: 0 8px;
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 5px;
    color: white;
    font-weight: bold;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.keyboard-key:hover {
    transform: scale(1.1);
    border-color: var(--accent);
}

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

.keyboard-key.key-correct {
    background: var(--correct);
    border-color: #6ca65a;
}

.keyboard-key.key-present {
    background: var(--close);
    border-color: #cdb04d;
}

.keyboard-key.key-absent {
    background: var(--wrong);
    opacity: 0.5;
}

/* ============ HISTORIAL MEJORADO ============ */
.history-subtitle {
    text-align: center;
    color: #aaa;
    margin: -15px 0 20px 0;
    font-size: 0.9rem;
}

.history-item.clickeable {
    cursor: pointer;
}

.history-item.clickeable:hover {
    transform: translateX(8px) scale(1.02);
    border-color: var(--accent);
    box-shadow: 0 4px 20px rgba(212, 158, 82, 0.3);
}

.history-item.unplayed {
    border-left: 4px solid #666;
    opacity: 0.8;
}

.badge-today {
    background: rgba(212, 158, 82, 0.3);
    color: var(--accent);
}

.badge-unplayed {
    background: rgba(102, 102, 102, 0.3);
    color: #999;
}

.history-click {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--accent);
    font-size: 0.85rem;
}

/* ============ ANIMACIONES ADICIONALES ============ */
@keyframes flip {
    0% {
        transform: rotateX(0);
    }
    50% {
        transform: rotateX(90deg);
    }
    100% {
        transform: rotateX(0);
    }
}

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

/* ============ RESPONSIVE AJUSTES ============ */
@media (max-width: 500px) {
    .wordle-letter {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .keyboard-key {
        min-width: 28px;
        height: 40px;
        font-size: 0.8rem;
    }
    
    .mode-btn {
        font-size: 0.8rem;
        padding: 12px;
    }
}

/* ============ WORDLE MEJORADO ============ */
.wordle-hint {
    text-align: center;
    padding: 12px;
    background: rgba(212, 158, 82, 0.1);
    border-radius: 8px;
    margin-bottom: 15px;
    color: var(--accent);
    font-size: 0.95rem;
    font-weight: 600;
}

.wordle-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #ccc;
}

.legend-box {
    width: 35px;
    height: 35px;
    border-radius: 4px;
    border: 2px solid transparent;
}

.legend-correct {
    background-color: #6aaa64;
    border-color: #6aaa64;
}

.legend-present {
    background-color: #c9b458;
    border-color: #c9b458;
}

.legend-absent {
    background-color: #787c7e;
    border-color: #787c7e;
}

/* Mejorar botón de enviar en modo Wordle */
#submit-name-btn {
    padding: 15px 30px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    color: white;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(212, 158, 82, 0.3);
}

#submit-name-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 158, 82, 0.5);
}

#submit-name-btn:active {
    transform: translateY(0);
}

#submit-name-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Ajuste responsive para leyenda */
@media (max-width: 500px) {
    .wordle-legend {
        flex-direction: column;
        gap: 12px;
    }
    
    .legend-item {
        justify-content: center;
    }
    
    .legend-box {
        width: 30px;
        height: 30px;
    }
    
    .wordle-hint {
        font-size: 0.85rem;
    }
}

/* ============ CASILLAS WORDLE MEJORADAS ============ */
.wordle-empty {
    background-color: rgba(255, 255, 255, 0.03) !important;
    border: 3px solid rgba(255, 255, 255, 0.15) !important;
    color: transparent;
}

.wordle-row {
    margin: 8px 0;
}

/* Mejorar visualización de intentos no usados */
#wordle-container .wordle-row:not(:first-child) {
    opacity: 0.6;
}

#wordle-container .wordle-row:first-child {
    opacity: 1;
    animation: pulse 1s ease-in-out infinite;
}

#wordle-container .wordle-row.used {
    opacity: 1 !important;
    animation: none !important;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.85;
    }
}

/* Eventos ocultos en historial */
.history-event.hidden-event {
    color: var(--accent);
    font-style: italic;
    letter-spacing: 3px;
}
