/* ================================================
   ARITMOMANCIA - APP STYLES
   ================================================ */

.ar-app {
    --ar-azul: #667eea;
    --ar-violeta: #764ba2;
    --ar-oro: #ffeaa7;
    --ar-gradiente: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --ar-gradiente-oro: linear-gradient(135deg, #ffeaa7 0%, #fab1a0 100%);
    --ar-sombra: 0 10px 30px rgba(102, 126, 234, 0.15);
    --ar-radio: 16px;
    --ar-transicion: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    position: relative;
    overflow: hidden;
}

.ar-fase {
    animation: arFadeIn 0.6s ease;
}

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

/* ================================================
   FASE FORMULARIO
   ================================================ */

.ar-form-contenido {
    text-align: center;
    padding: 2.5rem 1rem;
}

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

@keyframes arPulso {
    0%, 100% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.1); filter: brightness(1.3) drop-shadow(0 0 20px rgba(255, 234, 167, 0.5)); }
}

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

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

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

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

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

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

.ar-form-campo {
    max-width: 500px;
    margin: 0 auto 1rem;
    text-align: left;
}

.ar-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 234, 167, 0.3);
    border-radius: 12px;
    padding: 0.9rem 1.2rem;
    color: #fff;
    font-family: inherit;
    font-size: 1.05rem;
    transition: var(--ar-transicion);
    box-sizing: border-box;
}

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

.ar-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.ar-btn-calcular {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--ar-gradiente);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 0.9rem 2.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--ar-transicion);
    margin-top: 1.5rem;
    font-family: inherit;
}

.ar-btn-calcular:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.ar-instruccion {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
    margin-top: 1.5rem;
}

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

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

.ar-loading-orbe {
    width: 90px;
    height: 90px;
    position: relative;
    margin-bottom: 1.5rem;
}

.ar-orbe-centro {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5rem;
    animation: arGiroPulso 2s ease-in-out infinite;
}

@keyframes arGiroPulso {
    0%, 100% { transform: translate(-50%, -50%) scale(1) rotate(0deg); }
    50% { transform: translate(-50%, -50%) scale(1.2) rotate(180deg); filter: drop-shadow(0 0 15px rgba(255, 234, 167, 0.6)); }
}

.ar-orbe-arc {
    position: absolute;
    top: 5px; left: 5px;
    width: 80px; height: 80px;
    border: 2px dashed rgba(255, 234, 167, 0.25);
    border-radius: 50%;
    animation: arArcGiro 8s linear infinite;
}

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

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

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

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

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

.ar-seccion {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(102, 126, 234, 0.1);
    border-radius: var(--ar-radio);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    animation: arSlideIn 0.6s ease both;
}

.ar-seccion:nth-child(2) { animation-delay: 0s; }
.ar-seccion:nth-child(3) { animation-delay: 0.1s; }
.ar-seccion:nth-child(4) { animation-delay: 0.15s; }
.ar-seccion:nth-child(5) { animation-delay: 0.2s; }

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

.ar-seccion-titulo {
    color: var(--ar-oro);
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

/* ================================================
   RESULTADO NUMERO
   ================================================ */

.ar-numero-destacado {
    text-align: center;
    margin-bottom: 1.5rem;
}

.ar-numero-grande {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: var(--ar-gradiente-oro);
    color: #333;
    box-shadow: 0 8px 25px rgba(255, 234, 167, 0.3);
}

.ar-numero-tipo {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.ar-maestro-badge {
    display: inline-block;
    background: linear-gradient(135deg, #fd79a8 0%, #e84393 100%);
    color: #fff;
    padding: 0.3rem 1rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

/* ================================================
   DESGLOSE LETRAS
   ================================================ */

.ar-letras-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.ar-letra-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(102, 126, 234, 0.08);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 10px;
    padding: 0.5rem 0.6rem;
    min-width: 40px;
}

.ar-letra-char {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
}

.ar-letra-valor {
    font-size: 0.75rem;
    color: var(--ar-oro);
    font-weight: 600;
}

.ar-suma-display {
    text-align: center;
    padding: 0.8rem;
    background: rgba(255, 234, 167, 0.06);
    border: 1px solid rgba(255, 234, 167, 0.2);
    border-radius: 12px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.85);
    font-family: 'Courier New', monospace;
    word-break: break-all;
}

.ar-suma-label {
    color: var(--ar-oro);
    font-weight: 600;
    font-family: inherit;
}

/* ================================================
   SIGNIFICADO
   ================================================ */

.ar-significado-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.ar-significado-icono {
    font-size: 1.5rem;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ar-significado-nombre {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
}

.ar-significado-desc {
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.7;
    font-size: 0.95rem;
    margin-bottom: 1.2rem;
}

.ar-palabras-box {
    background: rgba(102, 126, 234, 0.06);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.85);
}

.ar-palabras-label {
    color: var(--ar-azul);
    font-weight: 600;
}

.ar-consejo-box {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    background: rgba(16, 185, 129, 0.06);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 12px;
    padding: 0.8rem 1rem;
}

.ar-consejo-icon {
    flex-shrink: 0;
    font-size: 1rem;
}

.ar-consejo-text {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.88rem;
    line-height: 1.5;
}

/* ================================================
   NUEVA CONSULTA
   ================================================ */

.ar-btn-nueva {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 50px;
    padding: 0.9rem 2rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--ar-transicion);
    font-family: inherit;
}

.ar-btn-nueva:hover {
    background: rgba(102, 126, 234, 0.15);
    border-color: var(--ar-azul);
    transform: translateY(-2px);
}

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

.ar-app::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle at 30% 40%, rgba(102, 126, 234, 0.06) 0%, transparent 50%),
                radial-gradient(circle at 70% 30%, rgba(118, 75, 162, 0.04) 0%, transparent 50%),
                radial-gradient(circle at 50% 80%, rgba(255, 234, 167, 0.03) 0%, transparent 50%);
    animation: arFondo 25s linear infinite;
    pointer-events: none;
    z-index: 0;
}

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

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

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

@media (max-width: 768px) {
    .ar-titulo-form { font-size: 1.6rem; }
    .ar-icono-oraculo { font-size: 3rem; }
    .ar-numero-grande { width: 80px; height: 80px; font-size: 2.4rem; }
}

@media (max-width: 480px) {
    .ar-form-contenido { padding: 1.5rem 0.5rem; }
    .ar-titulo-form { font-size: 1.4rem; }
    .ar-subtitulo-form { font-size: 0.85rem; }
    .ar-resultado-contenido { padding: 1.5rem 0.5rem; }
    .ar-seccion { padding: 1.2rem; }
    .ar-btn-nueva { padding: 0.8rem 1.5rem; font-size: 0.9rem; }
    .ar-btn-calcular { padding: 0.8rem 1.8rem; font-size: 0.9rem; }
    .ar-numero-grande { width: 70px; height: 70px; font-size: 2rem; }
    .ar-letras-grid { gap: 0.3rem; }
    .ar-letra-item { padding: 0.4rem 0.4rem; min-width: 34px; }
}

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

@media (prefers-reduced-motion: reduce) {
    .ar-app::before { animation: none; }
    .ar-icono-oraculo { animation: none; }
    .ar-destello { animation: none; display: none; }
    .ar-loading-orbe { animation: none; }
    .ar-loading-texto { animation: none; opacity: 1; }
    .ar-seccion { animation: none; opacity: 1; transform: none; }
    .ar-numero-grande { animation: none; }
    * { transition-duration: 0.05ms !important; animation-duration: 0.05ms !important; }
}

@media (prefers-contrast: high) {
    .ar-seccion { border: 2px solid rgba(255, 255, 255, 0.4); }
    .ar-input { border: 2px solid rgba(255, 255, 255, 0.4); }
}

@media print {
    .ar-app::before { display: none; }
    .ar-btn-nueva { display: none; }
    .ar-seccion { break-inside: avoid; }
}