/* ================================================
   ORACULO DE LAS GEMAS - APP STYLES
   ================================================ */

.ogm-app {
    --ogm-violeta: #7c3aed;
    --ogm-violeta-claro: #a78bfa;
    --ogm-azul: #3b82f6;
    --ogm-cian: #06b6d4;
    --ogm-dorado: #fbbf24;
    --ogm-dorado-oscuro: #d97706;
    --ogm-gradiante-mistico: linear-gradient(135deg, #7c3aed 0%, #3b82f6 50%, #06b6d4 100%);
    --ogm-gradiante-gema: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --ogm-sombra: 0 10px 30px rgba(102, 126, 234, 0.15);
    --ogm-sombra-hover: 0 15px 40px rgba(102, 126, 234, 0.25);
    --ogm-radio: 16px;
    --ogm-transicion: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    position: relative;
    overflow: hidden;
}

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

.ogm-fase {
    animation: ogmFadeIn 0.6s ease;
}

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

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

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

@keyframes ogmGlow {
    0%, 100% { filter: drop-shadow(0 0 10px rgba(167, 139, 250, 0.3)); }
    50% { filter: drop-shadow(0 0 20px rgba(167, 139, 250, 0.6)); }
}

.ogm-gema-flotante {
    position: absolute;
    font-size: 1rem;
    opacity: 0;
    animation: ogmGemaFloat 3s ease-in-out infinite;
    pointer-events: none;
}

.ogm-gema-flotante::before { content: '💎'; }
.ogm-gf2::before { content: '✨'; }
.ogm-gf3::before { content: '🌙'; }

.ogm-gf2 { animation-delay: -1s; top: -10px; left: 30px; }
.ogm-gf3 { animation-delay: -2s; top: 10px; right: 20px; }

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

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

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

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

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

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

.ogm-pregunta-input:focus {
    outline: none;
    border-color: var(--ogm-violeta-claro);
    box-shadow: 0 0 20px rgba(167, 139, 250, 0.2);
    background: rgba(255, 255, 255, 0.12);
}

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

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

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

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

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

.ogm-tirada-btn:hover {
    border-color: rgba(167, 139, 250, 0.5);
    background: rgba(167, 139, 250, 0.1);
    transform: translateY(-3px);
}

.ogm-tirada-btn.ogm-tirada-activa {
    border-color: var(--ogm-violeta-claro);
    background: rgba(167, 139, 250, 0.15);
    box-shadow: 0 0 20px rgba(167, 139, 250, 0.2);
}

.ogm-tirada-icono {
    font-size: 2rem;
    line-height: 1;
}

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

.ogm-tirada-desc {
    font-size: 0.75rem;
    opacity: 0.6;
}

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

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

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

.ogm-btn-icono {
    font-size: 1.2rem;
}

/* ================================================
   FASE GEMAS
   ================================================ */

.ogm-pregunta-mostrada {
    text-align: center;
    color: var(--ogm-dorado);
    font-style: italic;
    margin-bottom: 1rem;
    font-size: 1.05rem;
    padding: 0.8rem 1.2rem;
    background: rgba(251, 191, 36, 0.1);
    border-radius: 10px;
    border: 1px solid rgba(251, 191, 36, 0.2);
}

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

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

.ogm-gemas-area.ogm-gemas-chakra {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.8rem;
    max-width: 600px;
    margin: 0 auto;
    padding: 1rem 0;
}

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

.ogm-gemas-area.ogm-gemas-chakra .ogm-gema-contenedor {
    width: 100px;
    height: 160px;
}

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

.ogm-gema-contenedor.ogm-revelada .ogm-gema-inner {
    transform: rotateY(180deg);
}

.ogm-gema-frente,
.ogm-gema-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 gema */
.ogm-gema-reverso {
    background: var(--ogm-gradiante-gema);
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

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

.ogm-gema-reverso::after {
    content: '💎';
    font-size: 2.5rem;
    color: rgba(255, 255, 255, 0.3);
    position: absolute;
}

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

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

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

.ogm-gema-contenedor:not(.ogm-revelada):hover .ogm-gema-reverso {
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.4);
    border-color: rgba(167, 139, 250, 0.4);
}

/* Frente de la gema */
.ogm-gema-frente {
    background: rgba(20, 15, 40, 0.95);
    border: 2px solid rgba(167, 139, 250, 0.4);
    box-shadow: 0 8px 25px rgba(167, 139, 250, 0.2);
    transform: rotateY(180deg);
    padding: 0.8rem 0.5rem;
}

.ogm-gema-frente.ogm-gema-invertida {
    border-color: rgba(206, 17, 38, 0.5);
    box-shadow: 0 8px 25px rgba(206, 17, 38, 0.2);
}

.ogm-gema-simbolo {
    font-size: 2.5rem;
    line-height: 1;
    margin-bottom: 0.3rem;
}

.ogm-gema-frente .ogm-gema-nombre {
    font-size: 0.8rem;
    color: #fff;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
    font-style: italic;
}

.ogm-gema-orientacion {
    font-size: 0.65rem;
    margin-top: 0.2rem;
    font-style: italic;
}

.ogm-gema-orientacion.ogm-invertida-texto {
    color: #ce1126;
}

.ogm-gema-orientacion.ogm-derecha-texto {
    color: #22c55e;
}

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

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

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

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

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

.ogm-resultado-gemas {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

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

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

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

.ogm-resultado-gema-posicion {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--ogm-dorado);
    margin-bottom: 0.8rem;
    font-weight: 600;
}

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

.ogm-resultado-gema-simbolo {
    font-size: 2.5rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(167, 139, 250, 0.1);
    border-radius: 12px;
    flex-shrink: 0;
}

.ogm-resultado-gema-info h3 {
    color: #fff;
    font-size: 1.2rem;
    margin-bottom: 0.2rem;
    font-style: italic;
}

.ogm-resultado-gema-info .ogm-orientacion-badge {
    font-size: 0.75rem;
    padding: 2px 10px;
    border-radius: 20px;
    display: inline-block;
}

.ogm-orientacion-badge.ogm-badge-derecha {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.ogm-orientacion-badge.ogm-badge-invertida {
    background: rgba(206, 17, 38, 0.2);
    color: #ef4444;
}

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

.ogm-resultado-gema-consejo {
    background: rgba(251, 191, 36, 0.08);
    border-left: 3px solid var(--ogm-dorado);
    padding: 0.8rem 1rem;
    border-radius: 0 8px 8px 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    font-style: italic;
}

.ogm-resultado-gema-consejo::before {
    content: '💎 ';
}

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

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

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

/* Boton nueva consulta */
.ogm-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(--ogm-transicion);
    margin-top: 2rem;
    font-family: inherit;
}

.ogm-btn-nueva:hover {
    background: rgba(167, 139, 250, 0.15);
    border-color: var(--ogm-violeta-claro);
    transform: translateY(-2px);
}

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

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

.ogm-loading-gemas {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.ogm-loading-gema {
    width: 50px;
    height: 75px;
    background: var(--ogm-gradiante-gema);
    border-radius: 8px;
    animation: ogmBrillar 1.2s ease-in-out infinite;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.ogm-lg2 { animation-delay: 0.2s; }
.ogm-lg3 { animation-delay: 0.4s; }

@keyframes ogmBrillar {
    0%, 100% { transform: translateY(0) rotate(0deg); opacity: 0.7; }
    25% { transform: translateY(-15px) rotate(-5deg); opacity: 1; }
    75% { transform: translateY(5px) rotate(3deg); opacity: 0.8; }
}

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

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

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

.ogm-app::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 50%, rgba(124, 58, 237, 0.06) 0%, transparent 50%),
                radial-gradient(circle at 70% 30%, rgba(59, 130, 246, 0.06) 0%, transparent 50%),
                radial-gradient(circle at 50% 80%, rgba(167, 139, 250, 0.04) 0%, transparent 50%);
    animation: ogmFondo 20s linear infinite;
    pointer-events: none;
    z-index: 0;
}

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

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

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

@media (max-width: 768px) {
    .ogm-titulo-pregunta { font-size: 1.4rem; }
    .ogm-icono-gema { font-size: 3rem; }
    .ogm-gema-contenedor { width: 110px; height: 170px; }
    .ogm-gemas-area.ogm-gemas-chakra .ogm-gema-contenedor { width: 90px; height: 140px; }
    .ogm-gema-simbolo { font-size: 2rem; }
    .ogm-gema-frente .ogm-gema-nombre { font-size: 0.7rem; }
    .ogm-resultado-gema { padding: 1.2rem; }
    .ogm-gemas-area { gap: 1rem; }
}

@media (max-width: 480px) {
    .ogm-pregunta-contenido { padding: 1rem 0.5rem; }
    .ogm-titulo-pregunta { font-size: 1.2rem; }
    .ogm-subtitulo-pregunta { font-size: 0.85rem; }
    .ogm-tiradas-opciones { grid-template-columns: 1fr; gap: 0.7rem; }
    .ogm-tirada-btn { flex-direction: row; padding: 0.8rem 1rem; gap: 0.6rem; }
    .ogm-tirada-icono { font-size: 1.5rem; }
    .ogm-gema-contenedor { width: 95px; height: 145px; }
    .ogm-gemas-area { gap: 0.6rem; }
    .ogm-gemas-area.ogm-gemas-chakra .ogm-gema-contenedor { width: 75px; height: 115px; }
    .ogm-gema-simbolo { font-size: 1.5rem; }
    .ogm-gema-frente .ogm-gema-nombre { font-size: 0.65rem; }
    .ogm-btn-consultar { padding: 0.8rem 1.8rem; font-size: 1rem; }
    .ogm-resultado-titulo { font-size: 1.4rem; }
    .ogm-resultado-gema-simbolo { width: 45px; height: 45px; font-size: 1.8rem; }
    .ogm-resultado-gema-info h3 { font-size: 1rem; }
    .ogm-resultado-gema-header { gap: 0.7rem; }
}

@media (max-width: 360px) {
    .ogm-gema-contenedor { width: 80px; height: 125px; }
    .ogm-gemas-area { gap: 0.4rem; }
}

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

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

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

/* Print */
@media print {
    .ogm-app::before { display: none; }
    .ogm-btn-consultar, .ogm-btn-nueva { display: none; }
    .ogm-resultado-gema { break-inside: avoid; }
}
