/* ================================================
   TAROT DE LOS ANIMALES - APP STYLES
   ================================================ */

.tan-app {
    --tan-verde: #4caf50;
    --tan-verde-oscuro: #2e7d32;
    --tan-verde-claro: #81c784;
    --tan-dorado: #ffc107;
    --tan-marron: #8d6e63;
    --tan-azul: #4fc3f7;
    --tan-rojo: #ff7043;
    --tan-violeta: #ab47bc;
    --tan-gradiante-naturaleza: linear-gradient(135deg, #4caf50 0%, #8bc34a 100%);
    --tan-gradiante-tierra: linear-gradient(135deg, #8d6e63 0%, #a1887f 100%);
    --tan-gradiante-mistico: linear-gradient(135deg, #2e7d32 0%, #4caf50 50%, #66bb6a 100%);
    --tan-gradiante-dorado: linear-gradient(135deg, #ffc107 0%, #ff8f00 100%);
    --tan-sombra: 0 10px 30px rgba(76, 175, 80, 0.12);
    --tan-sombra-hover: 0 15px 40px rgba(76, 175, 80, 0.22);
    --tan-radio: 16px;
    --tan-transicion: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    position: relative;
    overflow: hidden;
}

/* ================================================
   FASE PREGUNTA
   ================================================ */

.tan-fase {
    animation: tanFadeIn 0.6s ease;
}

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

.tan-pregunta-contenido {
    text-align: center;
    padding: 2rem 1rem;
}

.tan-icono-totem {
    font-size: 4rem;
    position: relative;
    display: inline-block;
    margin-bottom: 1.5rem;
    animation: tanRespirar 3s ease-in-out infinite;
}

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

.tan-particula {
    position: absolute;
    font-size: 0.9rem;
    opacity: 0;
    animation: tanParticula 4s ease-in-out infinite;
    pointer-events: none;
}

.tan-particula::before { content: '🍃'; }
.tan-p2::before { content: '🌿'; }
.tan-p3::before { content: '✨'; }

.tan-p2 { animation-delay: -1.3s; top: -10px; left: 25px; }
.tan-p3 { animation-delay: -2.6s; top: 5px; right: 15px; }

@keyframes tanParticula {
    0%, 100% { opacity: 0; transform: translateY(0) scale(0.5); }
    50% { opacity: 0.7; transform: translateY(-25px) scale(1); }
}

.tan-titulo-pregunta {
    color: #fff;
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    background: var(--tan-gradiante-naturaleza);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tan-subtitulo-pregunta {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 2rem;
    font-size: 1rem;
}

/* Textarea */
.tan-textarea-contenedor {
    position: relative;
    max-width: 500px;
    margin: 0 auto 2rem;
}

.tan-pregunta-input {
    width: 100%;
    padding: 1rem 1.2rem;
    padding-bottom: 2rem;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(76, 175, 80, 0.3);
    border-radius: 14px;
    color: #fff;
    font-size: 1rem;
    font-family: inherit;
    resize: none;
    transition: var(--tan-transicion);
}

.tan-pregunta-input::placeholder { color: rgba(255, 255, 255, 0.4); }

.tan-pregunta-input:focus {
    outline: none;
    border-color: var(--tan-verde);
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.2);
    background: rgba(255, 255, 255, 0.12);
}

.tan-contador {
    position: absolute;
    bottom: 8px;
    right: 14px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
}

/* Tiradas */
.tan-tiradas {
    max-width: 600px;
    margin: 0 auto 2rem;
}

.tan-tiradas-label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.tan-tiradas-opciones {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.tan-tirada-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--tan-radio);
    padding: 1.2rem 0.8rem;
    cursor: pointer;
    transition: var(--tan-transicion);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    color: #fff;
}

.tan-tirada-btn:hover {
    border-color: rgba(76, 175, 80, 0.5);
    background: rgba(76, 175, 80, 0.1);
    transform: translateY(-3px);
}

.tan-tirada-btn.tan-tirada-activa {
    border-color: var(--tan-verde);
    background: rgba(76, 175, 80, 0.15);
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.2);
}

.tan-tirada-icono { font-size: 2rem; line-height: 1; }
.tan-tirada-nombre { font-size: 0.95rem; font-weight: 600; }
.tan-tirada-desc { font-size: 0.75rem; opacity: 0.6; }

/* Boton Consultar */
.tan-btn-consultar {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--tan-gradiante-naturaleza);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--tan-transicion);
    box-shadow: var(--tan-sombra);
    font-family: inherit;
}

.tan-btn-consultar:hover {
    transform: translateY(-3px);
    box-shadow: var(--tan-sombra-hover);
}

.tan-btn-consultar:active { transform: translateY(0); }
.tan-btn-icono { font-size: 1.2rem; }

/* ================================================
   FASE CARTAS
   ================================================ */

.tan-pregunta-mostrada {
    text-align: center;
    color: var(--tan-verde-claro);
    font-style: italic;
    margin-bottom: 1rem;
    font-size: 1.05rem;
    padding: 0.8rem 1.2rem;
    background: rgba(76, 175, 80, 0.1);
    border-radius: 10px;
    border: 1px solid rgba(76, 175, 80, 0.2);
}

.tan-instruccion-cartas {
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

/* Cartas */
.tan-cartas-area {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding: 2rem 0;
    perspective: 1000px;
}

.tan-cartas-area.tan-cartas-medicina {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 0.8rem;
    max-width: 500px;
    margin: 0 auto;
    padding: 1rem 0;
}

.tan-carta-contenedor {
    width: 130px;
    height: 200px;
    perspective: 1000px;
    cursor: pointer;
}

.tan-cartas-area.tan-cartas-medicina .tan-carta-contenedor {
    width: 110px;
    height: 170px;
}

.tan-carta-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.tan-carta-contenedor.tan-revelada .tan-carta-inner {
    transform: rotateY(180deg);
}

.tan-carta-frente,
.tan-carta-reverso {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Reverso de la carta */
.tan-carta-reverso {
    background: var(--tan-gradiante-mistico);
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.tan-carta-reverso::before {
    content: '';
    position: absolute;
    top: 8px; left: 8px; right: 8px; bottom: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
}

.tan-carta-reverso::after {
    content: '🐾';
    font-size: 2.5rem;
    color: rgba(255, 255, 255, 0.25);
    position: absolute;
}

.tan-carta-reverso .tan-carta-patron {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        45deg,
        transparent, transparent 10px,
        rgba(255, 255, 255, 0.02) 10px,
        rgba(255, 255, 255, 0.02) 20px
    );
}

.tan-carta-reverso .tan-carta-posicion {
    position: absolute;
    bottom: 10px;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    width: 100%;
    padding: 0 6px;
}

/* Hover carta boca abajo */
.tan-carta-contenedor:not(.tan-revelada):hover .tan-carta-inner {
    transform: translateY(-8px);
}

.tan-carta-contenedor:not(.tan-revelada):hover .tan-carta-reverso {
    box-shadow: 0 15px 35px rgba(46, 125, 50, 0.4);
    border-color: rgba(255, 255, 255, 0.4);
}

/* Frente de la carta */
.tan-carta-frente {
    background: rgba(15, 25, 15, 0.95);
    border: 2px solid rgba(76, 175, 80, 0.4);
    box-shadow: 0 8px 25px rgba(76, 175, 80, 0.15);
    transform: rotateY(180deg);
    padding: 0.8rem 0.5rem;
}

.tan-carta-simbolo {
    font-size: 2.8rem;
    line-height: 1;
    margin-bottom: 0.3rem;
}

.tan-carta-frente .tan-carta-nombre {
    font-size: 0.85rem;
    color: #fff;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
}

.tan-carta-frente .tan-carta-elemento-badge {
    font-size: 0.6rem;
    padding: 2px 8px;
    border-radius: 20px;
    margin-top: 0.3rem;
    font-weight: 500;
}

.tan-elemento-aire { background: rgba(79, 195, 247, 0.3); color: #81d4fa; }
.tan-elemento-tierra { background: rgba(141, 110, 99, 0.3); color: #bcaaa4; }
.tan-elemento-agua { background: rgba(77, 208, 225, 0.3); color: #80deea; }
.tan-elemento-fuego { background: rgba(255, 112, 67, 0.3); color: #ffab91; }

.tan-carta-mensaje-corto {
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 0.2rem;
    font-style: italic;
    text-align: center;
    line-height: 1.2;
    max-width: 90%;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Progreso */
.tan-progreso {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
    margin-top: 1rem;
}

/* Medicina layout */
.tan-cartas-medicina .tan-carta-contenedor:nth-child(1) { grid-column: 2; grid-row: 2; }
.tan-cartas-medicina .tan-carta-contenedor:nth-child(2) { grid-column: 1; grid-row: 2; }
.tan-cartas-medicina .tan-carta-contenedor:nth-child(3) { grid-column: 3; grid-row: 2; }
.tan-cartas-medicina .tan-carta-contenedor:nth-child(4) { grid-column: 2; grid-row: 3; }
.tan-cartas-medicina .tan-carta-contenedor:nth-child(5) { grid-column: 2; grid-row: 1; }

/* ================================================
   FASE RESULTADO
   ================================================ */

.tan-resultado-header {
    text-align: center;
    margin-bottom: 2rem;
}

.tan-resultado-titulo {
    font-size: 1.8rem;
    background: var(--tan-gradiante-naturaleza);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.tan-resultado-pregunta {
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
    font-size: 0.95rem;
}

.tan-resultado-cartas {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.tan-resultado-carta {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--tan-radio);
    padding: 1.5rem;
    animation: tanSlideIn 0.5s ease;
    animation-fill-mode: both;
}

.tan-resultado-carta:nth-child(1) { animation-delay: 0.1s; }
.tan-resultado-carta:nth-child(2) { animation-delay: 0.25s; }
.tan-resultado-carta:nth-child(3) { animation-delay: 0.4s; }
.tan-resultado-carta:nth-child(4) { animation-delay: 0.55s; }
.tan-resultado-carta:nth-child(5) { animation-delay: 0.7s; }

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

.tan-resultado-carta-posicion {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--tan-verde-claro);
    margin-bottom: 0.8rem;
    font-weight: 600;
}

.tan-resultado-carta-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.tan-resultado-carta-simbolo {
    font-size: 2.5rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    flex-shrink: 0;
}

.tan-resultado-carta-simbolo.tan-simbolo-aire { background: rgba(79, 195, 247, 0.15); }
.tan-resultado-carta-simbolo.tan-simbolo-tierra { background: rgba(141, 110, 99, 0.15); }
.tan-resultado-carta-simbolo.tan-simbolo-agua { background: rgba(77, 208, 225, 0.15); }
.tan-resultado-carta-simbolo.tan-simbolo-fuego { background: rgba(255, 112, 67, 0.15); }

.tan-resultado-carta-info h3 {
    color: #fff;
    font-size: 1.2rem;
    margin-bottom: 0.2rem;
}

.tan-resultado-carta-info .tan-elemento-badge {
    font-size: 0.75rem;
    padding: 2px 10px;
    border-radius: 20px;
    display: inline-block;
}

.tan-elemento-badge.tan-badge-aire { background: rgba(79, 195, 247, 0.2); color: #81d4fa; }
.tan-elemento-badge.tan-badge-tierra { background: rgba(141, 110, 99, 0.2); color: #bcaaa4; }
.tan-elemento-badge.tan-badge-agua { background: rgba(77, 208, 225, 0.2); color: #80deea; }
.tan-elemento-badge.tan-badge-fuego { background: rgba(255, 112, 67, 0.2); color: #ffab91; }

.tan-resultado-carta-mensaje {
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.7;
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.tan-resultado-carta-consejo {
    background: rgba(76, 175, 80, 0.08);
    border-left: 3px solid var(--tan-verde);
    padding: 0.8rem 1rem;
    border-radius: 0 8px 8px 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    font-style: italic;
}

.tan-resultado-carta-consejo::before { content: '🪶 '; }

/* Consejo final */
.tan-resultado-consejo {
    margin-top: 2rem;
    text-align: center;
    padding: 2rem;
    background: rgba(76, 175, 80, 0.08);
    border: 1px solid rgba(76, 175, 80, 0.2);
    border-radius: var(--tan-radio);
}

.tan-resultado-consejo h3 {
    color: var(--tan-verde-claro);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.tan-resultado-consejo p {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.7;
}

/* Boton nueva consulta */
.tan-btn-nueva {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    padding: 0.9rem 2rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--tan-transicion);
    margin-top: 2rem;
    font-family: inherit;
}

.tan-btn-nueva:hover {
    background: rgba(76, 175, 80, 0.15);
    border-color: var(--tan-verde);
    transform: translateY(-2px);
}

/* ================================================
   LOADING
   ================================================ */

.tan-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    min-height: 300px;
}

.tan-loading-animales {
    display: flex;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

.tan-loading-animal {
    width: 50px;
    height: 75px;
    background: var(--tan-gradiante-mistico);
    border-radius: 8px;
    animation: tanCaminar 1.2s ease-in-out infinite;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.tan-loading-animal::after { content: '🐾'; }
.tan-la2 { animation-delay: 0.2s; }
.tan-la3 { animation-delay: 0.4s; }

@keyframes tanCaminar {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-10px) rotate(-3deg); }
    75% { transform: translateY(5px) rotate(2deg); }
}

.tan-loading-texto {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    animation: tanPulso 1.5s ease-in-out infinite;
}

@keyframes tanPulso {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* ================================================
   PARTICULAS DE FONDO
   ================================================ */

.tan-app::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle at 30% 50%, rgba(76, 175, 80, 0.05) 0%, transparent 50%),
                radial-gradient(circle at 70% 30%, rgba(139, 195, 74, 0.05) 0%, transparent 50%),
                radial-gradient(circle at 50% 80%, rgba(255, 193, 7, 0.03) 0%, transparent 50%);
    animation: tanFondo 25s linear infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes tanFondo {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.tan-fase { position: relative; z-index: 1; }
.tan-loading { position: relative; z-index: 1; }

/* ================================================
   RESPONSIVE
   ================================================ */

@media (max-width: 768px) {
    .tan-titulo-pregunta { font-size: 1.4rem; }
    .tan-icono-totem { font-size: 3rem; }
    .tan-carta-contenedor { width: 110px; height: 170px; }
    .tan-cartas-area.tan-cartas-medicina .tan-carta-contenedor { width: 90px; height: 140px; }
    .tan-carta-simbolo { font-size: 2rem; }
    .tan-carta-frente .tan-carta-nombre { font-size: 0.75rem; }
    .tan-resultado-carta { padding: 1.2rem; }
    .tan-cartas-area { gap: 1rem; }
}

@media (max-width: 480px) {
    .tan-pregunta-contenido { padding: 1rem 0.5rem; }
    .tan-titulo-pregunta { font-size: 1.2rem; }
    .tan-subtitulo-pregunta { font-size: 0.85rem; }
    .tan-tiradas-opciones { grid-template-columns: 1fr; gap: 0.7rem; }
    .tan-tirada-btn { flex-direction: row; padding: 0.8rem 1rem; gap: 0.6rem; }
    .tan-tirada-icono { font-size: 1.5rem; }
    .tan-carta-contenedor { width: 95px; height: 145px; }
    .tan-cartas-area { gap: 0.6rem; }
    .tan-cartas-area.tan-cartas-medicina .tan-carta-contenedor { width: 75px; height: 115px; }
    .tan-carta-simbolo { font-size: 1.5rem; }
    .tan-carta-frente .tan-carta-nombre { font-size: 0.65rem; }
    .tan-carta-elemento-badge { font-size: 0.5rem !important; }
    .tan-carta-mensaje-corto { display: none; }
    .tan-btn-consultar { padding: 0.8rem 1.8rem; font-size: 1rem; }
    .tan-resultado-titulo { font-size: 1.4rem; }
    .tan-resultado-carta-simbolo { width: 45px; height: 45px; font-size: 1.8rem; }
    .tan-resultado-carta-info h3 { font-size: 1rem; }
    .tan-resultado-carta-header { gap: 0.7rem; }
}

@media (max-width: 360px) {
    .tan-carta-contenedor { width: 80px; height: 125px; }
    .tan-cartas-area { gap: 0.4rem; }
}

/* ================================================
   ACCESIBILIDAD
   ================================================ */

@media (prefers-reduced-motion: reduce) {
    .tan-app::before { animation: none; }
    .tan-icono-totem { animation: none; }
    .tan-particula { animation: none; display: none; }
    .tan-loading-animal { animation: none; }
    .tan-loading-texto { animation: none; opacity: 1; }
    .tan-carta-inner { transition-duration: 0.01ms; }
    .tan-resultado-carta { animation: none; opacity: 1; transform: none; }
    * { transition-duration: 0.05ms !important; animation-duration: 0.05ms !important; }
}

@media (prefers-contrast: high) {
    .tan-carta-reverso { border: 3px solid white; }
    .tan-carta-frente { border: 3px solid white; }
    .tan-tirada-btn { border: 2px solid white; }
    .tan-tirada-btn.tan-tirada-activa { border-color: var(--tan-verde); }
    .tan-resultado-carta { border: 2px solid rgba(255, 255, 255, 0.5); }
}

@media print {
    .tan-app::before { display: none; }
    .tan-btn-consultar, .tan-btn-nueva { display: none; }
    .tan-resultado-carta { break-inside: avoid; }
}