/* ================================================================== */
/* CSS EXCLUSIVO DE A TIENTAS (EL MEMORY RURAL) - VERDE JUEBLO        */
/* ================================================================== */

.at-container { max-width: 900px; margin: 0 auto; padding: 15px; font-family: 'Inter', sans-serif; box-sizing: border-box; width: 100%; }

.at-lobby-card, .at-results-card, .at-countdown-card, .at-table-container, .at-tabs { max-width: 550px; margin-left: auto; margin-right: auto; }

/* CABECERA Y TABS */
.at-header { text-align: center; margin-bottom: 20px; width: 100%; }
.at-title { font-family: 'Crimson Pro', serif; font-size: 2.2rem; color: #2d5a27; margin: 0 0 5px 0; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 10px; }
.at-subtitle { color: #666; font-size: 0.9rem; margin: 0; text-transform: uppercase; letter-spacing: 1px; }

.at-tabs { display: flex; width: 100%; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 4px 15px rgba(0,0,0,0.05); margin-bottom: 25px; border: 1px solid #eee; }
.at-tab-btn { flex: 1; padding: 12px 5px; background: transparent; border: none; font-size: 0.85rem; font-weight: 700; color: #777; cursor: pointer; transition: all 0.2s; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.at-tab-btn i { font-size: 1.2rem; }
.at-tab-btn.active { background: #2d5a27; color: #fff; }
.at-tab-btn:not(.active):hover { background: #f0f8f0; }

.at-tab-content { display: none; width: 100%; animation: fadeInAt 0.3s ease-in-out; }
.at-tab-content.active { display: block; }
@keyframes fadeInAt { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* LOBBY: EL RETO */
.at-lobby-card { background: #fff; border-radius: 20px; padding: 25px; box-shadow: 0 8px 25px rgba(0,0,0,0.08); text-align: center; border: 1px solid #f0f0f0; }
.at-hook-phrase { font-size: 1.1rem; color: #333; font-weight: 700; line-height: 1.4; margin-bottom: 20px; }

.at-prizes-box { background: linear-gradient(135deg, #fffcf0 0%, #fff6d6 100%); border: 2px dashed #f1c40f; border-radius: 15px; padding: 15px; margin-bottom: 20px; }
.at-prizes-title { font-size: 0.85rem; text-transform: uppercase; color: #b89600; font-weight: 800; margin-bottom: 15px; letter-spacing: 1px; }
.at-prizes-grid { display: flex; justify-content: center; gap: 10px; }
.at-prize-item { background: #fff; border-radius: 10px; padding: 10px; flex: 1; box-shadow: 0 4px 10px rgba(0,0,0,0.05); }
.at-prize-pos { font-size: 1.2rem; margin-bottom: 5px; }
.at-prize-val { font-weight: 800; color: #333; font-size: 1.1rem; display: flex; align-items: center; justify-content: center; gap: 4px; }
.at-prize-val i { color: #f1c40f; font-size: 0.9rem; }

.at-btn-play { width: 100%; padding: 18px; font-size: 1.2rem; font-weight: 800; text-transform: uppercase; background: #2d5a27; color: white; border: none; border-radius: 50px; cursor: pointer; box-shadow: 0 6px 15px rgba(45, 90, 39, 0.3); transition: transform 0.1s; margin-bottom: 15px; display: flex; align-items: center; justify-content: center; gap: 10px; }
.at-btn-play:active { transform: scale(0.97); }
.at-btn-play.disabled { background: #95a5a6; cursor: not-allowed; box-shadow: none; }

/* ESTADO: YA JUGADO (CAJA FUERTE) */
.at-locked-box { background: #f0f8f0; border: 2px dashed #4CAF50; border-radius: 15px; padding: 20px; margin-bottom: 20px; text-align: center; }
.at-locked-icon { font-size: 2rem; color: #4CAF50; margin-bottom: 10px; }
.at-locked-title { color: #2d5a27; margin: 0 0 10px 0; font-size: 1.2rem; font-family: 'Crimson Pro', serif; font-weight: 800; }
.at-locked-text { color: #555; font-size: 0.95rem; margin: 0; line-height: 1.5; }

/* ESTADO: ABANDONO (CAJA ROJA) */
.at-abandon-box { background: #f8d7da; border: 2px dashed #dc3545; border-radius: 15px; padding: 20px; margin-bottom: 20px; text-align: center; }
.at-abandon-icon { font-size: 2rem; color: #dc3545; margin-bottom: 10px; }
.at-abandon-title { color: #721c24; margin: 0 0 10px 0; font-size: 1.2rem; font-family: 'Crimson Pro', serif; font-weight: 800; }
.at-abandon-text { color: #721c24; font-size: 0.95rem; margin: 0; line-height: 1.5; }

.at-accordion-btn { width: 100%; text-align: left; background: #f9f9f9; border: 1px solid #eee; padding: 15px; font-weight: 700; color: #555; border-radius: 12px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; transition: background 0.2s; }
.at-accordion-btn:hover { background: #f1f1f1; }
.at-accordion-content { max-height: 0; overflow: hidden; transition: max-height 0.3s ease-out; background: #fff; padding: 0 15px; text-align: left; font-size: 0.9rem; color: #666; line-height: 1.5; border-radius: 0 0 12px 12px; }
.at-accordion-content ul { padding-left: 20px; margin: 15px 0; }
.at-accordion-content li { margin-bottom: 8px; }

/* TABLAS RANKING E HISTORIAL */
.at-table-container { background: #fff; border-radius: 15px; overflow: hidden; box-shadow: 0 4px 15px rgba(0,0,0,0.05); border: 1px solid #eee; }
.at-history-scroll { max-height: 450px; overflow-y: auto; }

.at-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.9rem; table-layout: fixed; }
.at-table th { background: #2d5a27; color: #fff; padding: 12px 10px; font-weight: 600; text-transform: uppercase; font-size: 0.75rem; letter-spacing: 1px; }
.at-table td { padding: 12px 10px; border-bottom: 1px solid #f0f0f0; color: #444; word-wrap: break-word; vertical-align: middle; }
.at-table tr:last-child td { border-bottom: none; }
.at-td-nowrap { white-space: nowrap; font-weight: 600; font-size: 0.9rem; }

.at-row-gold { background: linear-gradient(90deg, #fffcf0 0%, #fff 100%); font-weight: 700; }
.at-row-silver { background: linear-gradient(90deg, #f8f9fa 0%, #fff 100%); font-weight: 700; }
.at-row-bronze { background: linear-gradient(90deg, #fff6f0 0%, #fff 100%); font-weight: 700; }
.at-medal { font-size: 1.2rem; margin-right: 5px; }

/* UI Ranking Componentes */
.mc-user-flex { display: flex; align-items: center; gap: 10px; cursor: pointer; transition: transform 0.2s; }
.mc-user-flex:hover { transform: translateX(5px); }
.mc-shield-img { height: 28px; width: auto; object-fit: contain; }
.mc-shield-fallback { height: 28px; width: 28px; background: #eee; border-radius: 4px; display: flex; align-items: center; justify-content: center; color: #ccc; font-size: 0.8rem; }
.mc-user-texts { display: flex; flex-direction: column; line-height: 1.2; }
.mc-user-name { font-weight: 700; color: #2d5a27; font-size: 0.95rem; }
.mc-user-sub { font-size: 0.7rem; color: #888; text-transform: uppercase; }

/* PANTALLA CUENTA ATRÁS */
.at-countdown-card { background: #fff; border-radius: 20px; padding: 40px 20px; box-shadow: 0 8px 25px rgba(0,0,0,0.08); text-align: center; }
.at-countdown-number { font-size: 6rem; font-family: 'Crimson Pro', serif; font-weight: 900; color: #2d5a27; margin: 10px 0; text-shadow: 3px 3px 0 #f0f0f0; line-height: 1; transition: all 0.2s ease; min-height: 100px; }
.at-countdown-label { color: #666; font-weight: 800; text-transform: uppercase; letter-spacing: 2px; }

/* HUD DE JUEGO (BARRA Y CRONO) */
.at-game-hud { width: 100%; box-sizing: border-box; background: #fff; border-radius: 15px; padding: 15px; box-shadow: 0 8px 25px rgba(0,0,0,0.08); margin-bottom: 10px; }
.at-hud-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; gap: 15px; }
.at-progress-label { font-weight: 800; color: #666; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1px; margin-right: 10px; white-space: nowrap; }
.at-progress-bg { flex-grow: 1; height: 16px; background: #f0f0f0; border-radius: 20px; overflow: hidden; box-shadow: inset 0 2px 4px rgba(0,0,0,0.05); }
.at-progress-fill { height: 100%; background: linear-gradient(90deg, #4CAF50, #2d5a27); width: 0%; transition: width 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); border-radius: 20px; }

.at-btn-abandonar { background: #fff; color: #dc3545; border: 2px solid #dc3545; border-radius: 8px; width: 35px; height: 35px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; flex-shrink: 0; font-size: 1.2rem; }
.at-btn-abandonar:hover { background: #dc3545; color: #fff; }

.at-hud-bottom { text-align: center; padding-top: 5px; border-top: 1px dashed #eee; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.at-hud-bottom-label { font-size: 0.75rem; text-transform: uppercase; color: #999; font-weight: bold; letter-spacing: 1px; margin-bottom: 5px; }
.at-chrono { font-family: 'Courier New', monospace; font-size: 2.2rem; font-weight: 900; color: #2d5a27; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: 2px; }

/* ================================================================== */
/* EL TABLERO Y LAS CARTAS DE MEMORY (A TIENTAS)                      */
/* ================================================================== */
.at-grid {
    display: grid;
    gap: 12px;
    width: 100%;
    margin: 0 auto;
    perspective: 1000px;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(5, 1fr);
}

@media (min-width: 600px) {
    .at-grid {
        grid-template-columns: repeat(5, 1fr);
        grid-template-rows: repeat(4, 1fr);
        gap: 15px;
    }
}

.at-card {
    background-color: transparent;
    width: 100%;
    aspect-ratio: 1 / 1.05; 
    cursor: pointer;
    perspective: 1000px;
}

.at-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    border-radius: 12px;
}

.at-card.flipped .at-card-inner { transform: rotateY(180deg); }

@keyframes atPulseMatch {
    0% { transform: rotateY(180deg) scale(1); }
    50% { transform: rotateY(180deg) scale(1.08); }
    100% { transform: rotateY(180deg) scale(1); }
}

.at-card.matched .at-card-inner { transform: rotateY(180deg); opacity: 1; animation: atPulseMatch 0.4s ease; }
.at-card.matched .at-card-back { border: 3px solid #4CAF50; box-shadow: inset 0 0 20px rgba(76, 175, 80, 0.15); background-color: #f0f8f0; }
.at-card.matched { cursor: default; }

.at-card-front, .at-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden; 
    backface-visibility: hidden;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.at-card-front {
    background: linear-gradient(135deg, #4CAF50 0%, #2d5a27 100%);
    border: 2px solid #1e3d1a;
}

.at-card-front::after {
    content: '';
    background-image: url('../img/logo.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    width: 50%;
    height: 50%;
    opacity: 0.15;
    filter: brightness(0) invert(1);
}

.at-card-back {
    background-color: #fcfcfc;
    transform: rotateY(180deg);
    border: 2px solid #eee;
    font-size: 3rem; /* Tamaño gigante para el Emoji */
    box-shadow: inset 0 0 15px rgba(0,0,0,0.03);
    box-sizing: border-box;
}

@media (max-width: 450px) {
    .at-card-back { font-size: 2.3rem; }
}

.at-grid.locked { pointer-events: none; }

/* MODALES Y UTILIDADES */
.at-results-card { background: #fff; border-radius: 20px; padding: 30px 20px; box-shadow: 0 8px 25px rgba(0,0,0,0.08); text-align: center; }
.at-results-card h2 { color: #2d5a27; font-family: 'Crimson Pro', serif; font-size: 2rem; margin-top: 0; }

.at-btn-back { width: 100%; padding: 15px; border-radius: 50px; font-weight: 700; background: #e0e0e0; color: #555; border: none; cursor: pointer; text-transform: uppercase; margin-top: 20px; transition: background 0.2s; }
.at-btn-back:hover { background: #d0d0d0; }

.at-btn-share { width: 100%; padding: 15px; border-radius: 50px; font-weight: 800; background: #25D366; color: #fff; border: none; cursor: pointer; text-transform: uppercase; margin-top: 10px; transition: background 0.2s; display: flex; align-items: center; justify-content: center; gap: 8px; box-shadow: 0 4px 10px rgba(37, 211, 102, 0.3); }
.at-btn-share:hover { background: #128C7E; }

/* Modal de abandono específico */
#at-modal-abandono { position: fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.8); z-index:99999; display:flex; justify-content:center; align-items:center; backdrop-filter:blur(5px); }
.at-modal-content { background:#fff; padding:25px; border-radius:20px; text-align:center; width:90%; max-width:400px; }
.at-modal-content h3 { color:#dc3545; font-family:'Crimson Pro'; font-size:1.8rem; margin:0 0 10px 0; }
.at-modal-content p { color:#555; line-height:1.5; margin-bottom:20px; }

.at-hidden { display: none !important; }