/* ================================================
   TAROT HEBREO - APP STYLES
   ================================================ */

.th-app {
    --th-oro: #ffd700;
    --th-azul: #4b0082;
    --th-purpura: #6a0dad;
    --th-gradiente: linear-gradient(135deg, #4b0082 0%, #ffd700 50%, #6a0dad 100%);
    --th-gradiente-oro: linear-gradient(135deg, #ffd700 0%, #f0e68c 100%);
    --th-sombra: 0 10px 30px rgba(75, 0, 130, 0.2);
    --th-sombra-hover: 0 15px 40px rgba(75, 0, 130, 0.3);
    --th-radio: 16px;
    --th-transicion: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    position: relative;
    overflow: hidden;
}

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

.th-fase {
    animation: thFadeIn 0.6s ease;
}

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

.th-pregunta-contenido {
    text-align: center;
    padding: 2.5rem 1rem;
}

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

@keyframes thBrillar {
    0%, 100% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.1); filter: brightness(1.3); }
}

.th-destello {
    position: absolute;
    font-size: 1rem;
    opacity: 0;
    animation: thDestello 3s ease-in-out infinite;
    pointer-events: none;
}

.th-destello::before { content: '\2726'; }
.th-d2::before { content: '\2756'; }
.th-d3::before { content: '\2727'; }

.th-d1 { animation-delay: -0.5s; top: -10px; left: 10px; }
.th-d2 { animation-delay: -1.5s; top: -5px; right: 15px; }
.th-d3 { animation-delay: -2.5s; bottom: 5px; left: 25px; }

@keyframes thDestello {
    0%, 100% { opacity: 0; transform: translateY(0) scale(0.5); }
    50% { opacity: 0.8; transform: translateY(-20px) scale(1); }
}

.th-titulo-pregunta {
    color: #fff;
    font-size: 2rem;
    margin-bottom: 0.5rem;
    background: var(--th-gradiente-oro);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

/* Tirada buttons */
.th-tirada-opciones {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.th-tirada-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 215, 0, 0.2);
    border-radius: 12px;
    padding: 1.2rem 0.8rem;
    color: #fff;
    cursor: pointer;
    transition: var(--th-transicion);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    font-family: inherit;
}

.th-tirada-btn:hover {
    background: rgba(255, 215, 0, 0.1);
    border-color: var(--th-oro);
    transform: translateY(-3px);
    box-shadow: var(--th-sombra);
}

.th-tirada-btn.th-tirada-btn-active {
    background: rgba(255, 215, 0, 0.15);
    border-color: var(--th-oro);
    box-shadow: var(--th-sombra);
}

.th-tirada-icono {
    font-size: 2rem;
}

.th-tirada-nombre {
    font-size: 0.95rem;
    font-weight: 600;
}

.th-tirada-desc {
    font-size: 0.8rem;
    opacity: 0.7;
}

/* Pregunta textarea */
.th-pregunta-area {
    margin-bottom: 1.5rem;
}

.th-pregunta-label {
    display: block;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.th-pregunta-input {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    display: block;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    color: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    transition: var(--th-transicion);
}

.th-pregunta-input:focus {
    outline: none;
    border-color: var(--th-oro);
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.15);
    background: rgba(255, 255, 255, 0.08);
}

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

.th-instruccion {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.95rem;
}

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

.th-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

.th-loading-carta {
    width: 60px;
    height: 90px;
    background: var(--th-gradiente);
    border-radius: 12px;
    animation: thBarajar 1.2s ease-in-out infinite;
    box-shadow: 0 4px 15px rgba(75, 0, 130, 0.3);
    margin-bottom: 1rem;
    border: 2px solid rgba(255, 215, 0, 0.3);
}

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

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

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

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

.th-cartas-contenido {
    text-align: center;
    padding: 2rem 1rem;
}

.th-cartas-titulo {
    color: #fff;
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
    background: var(--th-gradiente-oro);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.th-cartas-subtitulo {
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.th-cartas-grid {
    display: grid;
    gap: 1.5rem;
    justify-content: center;
    max-width: 900px;
    margin: 0 auto;
}

.th-cartas-1 { grid-template-columns: repeat(1, 1fr); max-width: 200px; }
.th-cartas-3 { grid-template-columns: repeat(3, 1fr); }
.th-cartas-5 { grid-template-columns: repeat(5, 1fr); }
.th-cartas-7 { grid-template-columns: repeat(4, 1fr); }

.th-carta {
    perspective: 1000px;
    cursor: pointer;
    transition: var(--th-transicion);
}

.th-carta:hover:not(.revelada) {
    transform: translateY(-8px);
}

.th-carta.revelada {
    cursor: default;
}

.th-carta.revelada:hover {
    transform: none;
}

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

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

.th-carta-reverso,
.th-carta-frontal {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 16px;
    overflow: hidden;
}

.th-carta-reverso {
    background: var(--th-gradiente);
    border: 2px solid rgba(255, 215, 0, 0.3);
    box-shadow: 0 12px 35px rgba(75, 0, 130, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.th-carta-reverso::before {
    content: '';
    position: absolute;
    top: 10px; left: 10px; right: 10px; bottom: 10px;
    border: 2px solid rgba(255, 215, 0, 0.15);
    border-radius: 10px;
}

.th-carta-patron {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 50% 50%, rgba(255, 215, 0, 0.06) 0%, transparent 60%),
        repeating-linear-gradient(
            45deg,
            transparent, transparent 10px,
            rgba(255, 255, 255, 0.02) 10px,
            rgba(255, 255, 255, 0.02) 20px
        );
}

.th-carta-signo {
    font-size: 2.5rem;
    color: rgba(255, 215, 0, 0.5);
    z-index: 1;
}

.th-carta-frontal {
    transform: rotateY(180deg);
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 215, 0, 0.3);
    box-shadow: 0 12px 35px rgba(75, 0, 130, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
}

.th-carta-simbolo {
    font-size: 3rem;
}

.th-carta-nombre {
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
}

.th-carta-elemento {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
}

.th-elem-fuego { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.th-elem-agua { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.th-elem-tierra { background: rgba(34, 197, 94, 0.2); color: #4ade80; }
.th-elem-aire { background: rgba(168, 85, 247, 0.2); color: #c084fc; }

.th-carta-posicion {
    color: var(--th-oro);
    font-size: 0.8rem;
    margin-top: 0.5rem;
    font-style: italic;
    text-align: center;
}

.th-carta:hover:not(.revelada) .th-carta-reverso {
    box-shadow: 0 20px 50px rgba(255, 215, 0, 0.3);
    border-color: rgba(255, 215, 0, 0.5);
}

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

.th-resultado-contenido {
    padding: 2rem 1rem;
}

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

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

.th-resultado-subtitulo {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.95rem;
}

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

.th-resultado-carta {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 215, 0, 0.15);
    border-radius: var(--th-radio);
    padding: 2rem;
    animation: thSlideIn 0.6s ease both;
}

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

.th-resultado-carta-header {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    margin-bottom: 1.5rem;
}

.th-resultado-carta-simbolo {
    font-size: 3.5rem;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    flex-shrink: 0;
}

.th-elem-bg-fuego { background: rgba(239, 68, 68, 0.15); }
.th-elem-bg-agua { background: rgba(59, 130, 246, 0.15); }
.th-elem-bg-tierra { background: rgba(34, 197, 94, 0.15); }
.th-elem-bg-aire { background: rgba(168, 85, 247, 0.15); }

.th-resultado-carta-info h3 {
    color: #fff;
    font-size: 1.3rem;
    margin-bottom: 0.3rem;
}

.th-elem-badge {
    font-size: 0.8rem;
    padding: 3px 12px;
    border-radius: 20px;
    display: inline-block;
}

.th-badge-fuego { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.th-badge-agua { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.th-badge-tierra { background: rgba(34, 197, 94, 0.2); color: #4ade80; }
.th-badge-aire { background: rgba(168, 85, 247, 0.2); color: #c084fc; }

.th-resultado-posicion {
    color: var(--th-oro);
    font-size: 0.9rem;
    font-style: italic;
    margin-bottom: 1rem;
    padding-left: 0.5rem;
    border-left: 3px solid var(--th-oro);
}

.th-resultado-mensaje {
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.8;
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

.th-resultado-consejo {
    background: rgba(255, 215, 0, 0.08);
    border-left: 3px solid var(--th-oro);
    padding: 1rem 1.2rem;
    border-radius: 0 10px 10px 0;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.95rem;
    font-style: italic;
}

.th-resultado-consejo::before { content: '\1F56F  '; }

/* Boton nueva consulta */
.th-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, 215, 0, 0.3);
    border-radius: 50px;
    padding: 0.9rem 2rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--th-transicion);
    margin-top: 2rem;
    font-family: inherit;
}

.th-btn-nueva:hover {
    background: rgba(255, 215, 0, 0.15);
    border-color: var(--th-oro);
    transform: translateY(-2px);
}

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

.th-app::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle at 30% 40%, rgba(255, 215, 0, 0.06) 0%, transparent 50%),
                radial-gradient(circle at 70% 30%, rgba(75, 0, 130, 0.04) 0%, transparent 50%),
                radial-gradient(circle at 50% 80%, rgba(106, 13, 173, 0.05) 0%, transparent 50%);
    animation: thFondo 25s linear infinite;
    pointer-events: none;
    z-index: 0;
}

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

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

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

@media (max-width: 768px) {
    .th-tirada-opciones {
        grid-template-columns: repeat(2, 1fr);
    }

    .th-titulo-pregunta { font-size: 1.6rem; }
    .th-icono-oraculo { font-size: 3rem; }

    .th-cartas-1 { max-width: 160px; }
    .th-cartas-3 { grid-template-columns: repeat(3, 1fr); gap: 1rem; }
    .th-cartas-5 { grid-template-columns: repeat(3, 1fr); gap: 1rem; }
    .th-cartas-7 { grid-template-columns: repeat(4, 1fr); gap: 0.8rem; }

    .th-resultado-carta { padding: 1.5rem; }
    .th-resultado-carta-simbolo { width: 65px; height: 65px; font-size: 2.8rem; }
}

@media (max-width: 480px) {
    .th-pregunta-contenido { padding: 1.5rem 0.5rem; }
    .th-titulo-pregunta { font-size: 1.4rem; }
    .th-subtitulo-pregunta { font-size: 0.85rem; }
    .th-tirada-opciones { grid-template-columns: repeat(2, 1fr); gap: 0.8rem; }
    .th-tirada-btn { padding: 0.8rem 0.5rem; }
    .th-tirada-icono { font-size: 1.5rem; }
    .th-tirada-nombre { font-size: 0.85rem; }

    .th-cartas-1 { max-width: 140px; }
    .th-cartas-3 { grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }
    .th-cartas-5 { grid-template-columns: repeat(2, 1fr); gap: 0.8rem; }
    .th-cartas-7 { grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }

    .th-carta-signo { font-size: 1.8rem; }
    .th-carta-nombre { font-size: 0.7rem; }

    .th-resultado-carta { padding: 1.2rem; }
    .th-resultado-carta-simbolo { width: 55px; height: 55px; font-size: 2.2rem; }
    .th-resultado-carta-info h3 { font-size: 1.1rem; }
    .th-resultado-carta-header { gap: 0.8rem; }
    .th-btn-nueva { padding: 0.8rem 1.5rem; font-size: 0.9rem; }
}

@media (max-width: 360px) {
    .th-cartas-5 { grid-template-columns: repeat(2, 1fr); }
    .th-cartas-7 { grid-template-columns: repeat(2, 1fr); }
}

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

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

@media (prefers-contrast: high) {
    .th-carta-reverso { border: 3px solid white; }
    .th-resultado-carta { border: 2px solid rgba(255, 255, 255, 0.5); }
}

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